update:当前支付成功
This commit is contained in:
@@ -182,17 +182,27 @@ public class SDKTest : MonoBehaviour
|
||||
public async void OnPayTestBtn()
|
||||
{
|
||||
_messageTxt.text = "";
|
||||
if (sku == null){
|
||||
_messageTxt.text = "no product";
|
||||
return;
|
||||
}
|
||||
// if (sku == null){
|
||||
// _messageTxt.text = "no product";
|
||||
// return;
|
||||
// }
|
||||
|
||||
var sku = new SKUDetail();
|
||||
sku.productId = "com.arkgame.ft.1chooseone0199";
|
||||
sku.ourProductId= "comarkgameftcharge0199";
|
||||
sku.title = "$1.99 choose one" ;
|
||||
// sku.price = "16900";
|
||||
sku.ruPrice = 169;
|
||||
|
||||
|
||||
var purchaseInfo = new JObject();
|
||||
purchaseInfo["ver"] = 2;
|
||||
// purchaseInfo["ver"] = 2;
|
||||
purchaseInfo["pfid"] = "TestPlayer";
|
||||
purchaseInfo["sum"] = sku.ProdPrice;
|
||||
// purchaseInfo["sum"] = sku.ProdPrice;
|
||||
purchaseInfo["customData"] = "{\"test\":\"test\"}";
|
||||
// purchaseInfo[]
|
||||
|
||||
PaymentInfo payResult = await TYSdkFacade.Instance.Pay(sku, 1, sku.ProdPrice, purchaseInfo);
|
||||
PaymentInfo payResult = await TYSdkFacade.Instance.Pay(sku, 1, sku.ruPrice, purchaseInfo);
|
||||
_messageTxt.text = "\n" + $"Success : {payResult.isSuccess}";
|
||||
_messageTxt.text += "\n" + $"message : {payResult.msg}";
|
||||
}
|
||||
|
||||
@@ -161,6 +161,7 @@ namespace tysdk
|
||||
|
||||
var userId = (int)ulong.Parse(deviceId, System.Globalization.NumberStyles.HexNumber);
|
||||
|
||||
Debug.Log($"userId -> {userId}");
|
||||
_accountInfo = new AccountInfo()
|
||||
{
|
||||
userId = userId,
|
||||
@@ -173,7 +174,7 @@ namespace tysdk
|
||||
};
|
||||
|
||||
#elif UNITY_ANDROID || UNITY_IOS
|
||||
var task = TYSDKCallbackManager.Instance.RegisterCallback<LoginInfo>(TimeSpan.FromSeconds(30));
|
||||
var task = TYSDKCallbackManager.Instance.RegisterCallback<LoginInfo>(TimeSpan.FromSeconds(120));
|
||||
|
||||
UnityBridgeFunc.UnityLogin(accoutType);
|
||||
|
||||
@@ -435,6 +436,8 @@ namespace tysdk
|
||||
|
||||
#if UNITY_ANDROID
|
||||
string clientid = "Android_5.00_tyGuest,facebook.googleplay.0-hall20587.googleplay.FishingMaster";
|
||||
|
||||
clientid = "Android_5.00_tyGuest,facebook.googleplay.0-hall20587.rustore.FishingTravel";
|
||||
#elif UNITY_IOS
|
||||
string clientid = "IOS_5.00_tyGuest,facebook,appStore.appStore.0-hall20587.appStore.FishingMaster";
|
||||
#endif
|
||||
|
||||
@@ -110,8 +110,8 @@ namespace tysdk
|
||||
Debug.Log("[TYSdkFacade] pay callback:" + json);
|
||||
var jresult = JObject.Parse(json);
|
||||
var result = new PaymentInfo();
|
||||
result.code = jresult["code"].ToString();
|
||||
result.msg = jresult["errStr"].ToString();
|
||||
result.code = jresult["code"]?.ToString();
|
||||
result.msg = jresult["errStr"]?.ToString();
|
||||
TYSDKCallbackManager.Instance.TryTriggerCallback(result);
|
||||
}
|
||||
|
||||
@@ -145,19 +145,21 @@ namespace tysdk
|
||||
string productStr = jresult["respObj"].ToString();
|
||||
result.code = code;
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
// var jsonObjList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SKUDetail>>(productStr);
|
||||
// result.products = jsonObjList;
|
||||
var accountChannel = _accountInfo.channel;
|
||||
if (accountChannel == EAccoutType.hwVkid)
|
||||
{
|
||||
result.ReadSkuFromData(productStr, accountChannel);
|
||||
}
|
||||
else
|
||||
{
|
||||
// var jsonObjList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SKUDetail>>(productStr);
|
||||
// result.products = jsonObjList;
|
||||
result.BaseReadSkuFromData(productStr);
|
||||
}
|
||||
|
||||
var jsonObjList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SKUDetail>>(productStr);
|
||||
result.products = jsonObjList;
|
||||
|
||||
// var accountChannel = _accountInfo.channel;
|
||||
// if (accountChannel == EAccoutType.hwVkid)
|
||||
// {
|
||||
// result.ReadSkuFromData(productStr, accountChannel);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // var jsonObjList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SKUDetail>>(productStr);
|
||||
// // result.products = jsonObjList;
|
||||
// result.BaseReadSkuFromData(productStr);
|
||||
// }
|
||||
#elif UNITY_IOS && !UNITY_EDITOR
|
||||
result.ReadSKUFromJson(productStr);
|
||||
#endif
|
||||
|
||||
@@ -141,6 +141,7 @@ namespace tysdk
|
||||
public string description;
|
||||
public string ourProductId;
|
||||
public string price;
|
||||
public float ruPrice;
|
||||
|
||||
[JsonProperty("price_amount_micros")]
|
||||
public string price_amount_micros { get; set; }
|
||||
@@ -155,7 +156,7 @@ namespace tysdk
|
||||
}
|
||||
|
||||
public string ProdPriceStr => price;
|
||||
//public float ProdPrice => float.Parse(price_amount_micros) / 1000000;
|
||||
// public float ProdPrice => float.Parse(price_amount_micros) / 1000000;
|
||||
public float ProdPrice
|
||||
{
|
||||
get
|
||||
@@ -165,6 +166,7 @@ namespace tysdk
|
||||
return micros / 1_000_000f;
|
||||
}
|
||||
}
|
||||
|
||||
public string ProdID => ourProductId;
|
||||
public string ProdKey => productId;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user