[U] sync with ft

This commit is contained in:
2026-03-27 12:29:31 +08:00
parent 3f78e8464a
commit 9f5151c54c
2 changed files with 63 additions and 1 deletions

View File

@@ -20,6 +20,8 @@ namespace tysdk
|___/
=================================================*/
private bool _payFirstNegativeHandled;
//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, JObject purchaseInfo)
{
@@ -76,6 +78,10 @@ namespace tysdk
Debug.LogWarning($"[TYSdkFacade::Pay] Faild {e.Message}");
return new PaymentInfo(){code = "-1"};
}
finally
{
_payFirstNegativeHandled = false;
}
#elif UNITY_IOS
@@ -95,6 +101,10 @@ namespace tysdk
Debug.LogWarning($"[TYSdkFacade::Pay] Faild {e.Message}");
return new PaymentInfo(){code = "-1"};
}
finally
{
_payFirstNegativeHandled = false;
}
#endif
}
@@ -108,7 +118,16 @@ namespace tysdk
result.msg = jresult["errStr"].ToString();
if(result.code == "-1")
{
Debug.Log("[TYSdkFacade] pay failed: waiting next pay callback");
if (!_payFirstNegativeHandled)
{
_payFirstNegativeHandled = true;
TYSDKCallbackManager.Instance.ResetCallbackTimeout<PaymentInfo>(TimeSpan.FromSeconds(5));
Debug.Log("[TYSdkFacade] pay failed (first time): reset timeout to 5s, waiting next pay callback");
}
else
{
Debug.Log("[TYSdkFacade] pay failed: waiting next pay callback");
}
return;
}
TYSDKCallbackManager.Instance.TryTriggerCallback(result);