[M] sync with n3
This commit is contained in:
@@ -3,6 +3,8 @@ using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace tysdk
|
||||
{
|
||||
@@ -19,25 +21,22 @@ namespace tysdk
|
||||
=================================================*/
|
||||
|
||||
//public async Task<PaymentInfo> Pay(string prodId, string prodPrice, string prodName, int count, string pType, string price_amount_micros =null)
|
||||
public async Task<PaymentInfo> Pay(SKUDetail prod, int count, float usdprice)
|
||||
public async Task<PaymentInfo> Pay(SKUDetail prod, int count, float usdprice, JObject purchaseInfo)
|
||||
{
|
||||
if (!IsLoggedIn) return new PaymentInfo() { code = "-1", msg = "未登录" };
|
||||
|
||||
var orderId = System.Guid.NewGuid().ToString();
|
||||
|
||||
Dictionary<string, object> extraDic = new Dictionary<string, object>() {
|
||||
{"paytime" , System.DateTime.UtcNow.Ticks},
|
||||
{"sum" , prod.ProdPrice * count},
|
||||
};
|
||||
if(purchaseInfo == null)
|
||||
purchaseInfo = new JObject();
|
||||
|
||||
|
||||
string extraInfo = Newtonsoft.Json.JsonConvert.SerializeObject(extraDic);
|
||||
string extraInfo = purchaseInfo.ToString(Newtonsoft.Json.Formatting.None);
|
||||
//to base64
|
||||
extraInfo = System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(extraInfo));
|
||||
extraInfo = Convert.ToBase64String(Encoding.UTF8.GetBytes(extraInfo));
|
||||
Debug.Log("[TYSdk] extraInfo: " + extraInfo);
|
||||
var prodId = prod.ProdID;
|
||||
var prodPrice = usdprice.ToString();
|
||||
var prodName = prod.title;
|
||||
var pType = "googleiab.global.app";
|
||||
|
||||
#if UNITY_EDITOR
|
||||
|
||||
@@ -55,6 +54,8 @@ namespace tysdk
|
||||
|
||||
return result;
|
||||
#elif UNITY_ANDROID
|
||||
|
||||
var pType = "googleiab.global.app";
|
||||
|
||||
var taskSource = new TaskCompletionSource<PaymentInfo>();
|
||||
callbacks.Add("PayResult", (ITYSdkCallback callback) =>
|
||||
|
||||
Reference in New Issue
Block a user