修复支付验证失败问题
This commit is contained in:
parent
9662ba6b46
commit
d5ec0e9ab1
|
@ -313,7 +313,7 @@ namespace WZ
|
||||||
if (ES3.KeyExists(_purchaseOrderMap))
|
if (ES3.KeyExists(_purchaseOrderMap))
|
||||||
{
|
{
|
||||||
List<IAPDataConfig> list = ES3.Load(_purchaseOrderMap) as List<IAPDataConfig>;
|
List<IAPDataConfig> list = ES3.Load(_purchaseOrderMap) as List<IAPDataConfig>;
|
||||||
LoggerUtils.Debug("[iap] IAP ProgressCacheOrder 读取失败订单列表,count:" + list.Count + " IAPPurchaseManager.Instance._repeatCountDic" + IAPPurchaseManager.Instance._repeatCountDic.Count);
|
LoggerUtils.Debug("[iap] IAP ProgressCacheOrder 读取失败订单列表,count:" + list.Count + " repeat count:" + IAPPurchaseManager.Instance._repeatCountDic.Count);
|
||||||
if (list.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 当前进程每条订单校验5次,如果失败则不再处理
|
// 当前进程每条订单校验5次,如果失败则不再处理
|
||||||
|
@ -323,7 +323,7 @@ namespace WZ
|
||||||
{
|
{
|
||||||
foreach (var data in list)
|
foreach (var data in list)
|
||||||
{
|
{
|
||||||
LoggerUtils.Debug("[iap] iap start verify fail order with repeat dic" + data.info["order_id"] + " count:" + IAPPurchaseManager.Instance._repeatCountDic[data.info["order_id"]]);
|
LoggerUtils.Debug("[iap] iap start verify order with repeat dic" + data.info["order_id"] + " count:" + IAPPurchaseManager.Instance._repeatCountDic[data.info["order_id"]]);
|
||||||
if (IAPPurchaseManager.Instance._repeatCountDic.ContainsKey(data.info["order_id"]) && IAPPurchaseManager.Instance._repeatCountDic[data.info["order_id"]] <= 5)
|
if (IAPPurchaseManager.Instance._repeatCountDic.ContainsKey(data.info["order_id"]) && IAPPurchaseManager.Instance._repeatCountDic[data.info["order_id"]] <= 5)
|
||||||
{
|
{
|
||||||
tempData = data;
|
tempData = data;
|
||||||
|
@ -334,7 +334,6 @@ namespace WZ
|
||||||
// 如果还有次数不超过5次的订单,则继续校验,否则就不再处理
|
// 如果还有次数不超过5次的订单,则继续校验,否则就不再处理
|
||||||
if (tempData != null)
|
if (tempData != null)
|
||||||
{
|
{
|
||||||
LoggerUtils.Debug("[iap] iap start verify fail order with repeat temp dic" + tempData.info["order_id"] + " count:" + IAPPurchaseManager.Instance._repeatCountDic[tempData.info["order_id"]]);
|
|
||||||
VerifyPurchase(tempData);
|
VerifyPurchase(tempData);
|
||||||
IAPEvent.LogStarVerifyOrderBySdk(new PurchaseInfo(
|
IAPEvent.LogStarVerifyOrderBySdk(new PurchaseInfo(
|
||||||
productName: tempData.info["product_name"],
|
productName: tempData.info["product_name"],
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using NUnit.Framework.Constraints;
|
|
||||||
using Unity.Services.Core;
|
using Unity.Services.Core;
|
||||||
using Unity.Services.Core.Environments;
|
using Unity.Services.Core.Environments;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
@ -382,7 +381,7 @@ namespace WZ
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Initialize()
|
public void Initialize()
|
||||||
{
|
{
|
||||||
LoggerUtils.Debug("[iap] IAP Initialize() _storeController.Debug:" + _storeController + " m_StoreExtensionProvider: " + _storeExtensionProvider);
|
LoggerUtils.Debug("[iap] IAP Initialize() _storeController:" + _storeController + " m_StoreExtensionProvider: " + _storeExtensionProvider);
|
||||||
if (_storeController == null && _storeExtensionProvider == null)
|
if (_storeController == null && _storeExtensionProvider == null)
|
||||||
InitUnityPurchase();
|
InitUnityPurchase();
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace WZ
|
||||||
var ssProperties = new Dictionary<string, object>
|
var ssProperties = new Dictionary<string, object>
|
||||||
{
|
{
|
||||||
{ "is_first", PlayerPrefsUtils.GetPlayerPrefsInt("First_Purchase", 0) == 0 },
|
{ "is_first", PlayerPrefsUtils.GetPlayerPrefsInt("First_Purchase", 0) == 0 },
|
||||||
{ "IAP", args["iap_name"].ToString() },
|
{ "IAP", args["product_name"].ToString() },
|
||||||
{ "product_id", args["product_id"].ToString() },
|
{ "product_id", args["product_id"].ToString() },
|
||||||
{ "payment_type", "GooglePlay" },
|
{ "payment_type", "GooglePlay" },
|
||||||
{ "Price", fPrice }
|
{ "Price", fPrice }
|
||||||
|
@ -54,6 +54,8 @@ namespace WZ
|
||||||
|
|
||||||
}
|
}
|
||||||
args.Add("ss_super_properties", JsonConvert.SerializeObject(ssProperties));
|
args.Add("ss_super_properties", JsonConvert.SerializeObject(ssProperties));
|
||||||
|
LoggerUtils.Debug("[iap] server verify purchase args: "+JsonConvert.SerializeObject(args));
|
||||||
|
LoggerUtils.Debug("[iap] server verify purchase url: "+ StaticValue.VerifyPurchaseUrl);
|
||||||
Post(StaticValue.VerifyPurchaseUrl, args, callback);
|
Post(StaticValue.VerifyPurchaseUrl, args, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +70,7 @@ namespace WZ
|
||||||
|
|
||||||
EncryptionParameters(args);
|
EncryptionParameters(args);
|
||||||
var requestBody = ConvertDictionaryToJson(args);
|
var requestBody = ConvertDictionaryToJson(args);
|
||||||
LoggerUtils.Debug("[server] url=> " + url +" requestBody=>"+requestBody);
|
LoggerUtils.Debug("[iap] [server] url=> " + url +" requestBody=>"+requestBody);
|
||||||
var encryptBody = EncryptRequestBody(requestBody);
|
var encryptBody = EncryptRequestBody(requestBody);
|
||||||
if (!string.IsNullOrEmpty(encryptBody))
|
if (!string.IsNullOrEmpty(encryptBody))
|
||||||
{
|
{
|
||||||
|
@ -90,7 +92,7 @@ namespace WZ
|
||||||
RequestHandler.Instance.SendPostRequest(url, requestBody, headers,
|
RequestHandler.Instance.SendPostRequest(url, requestBody, headers,
|
||||||
(code, res) =>
|
(code, res) =>
|
||||||
{
|
{
|
||||||
LoggerUtils.Debug($"[server] res ====> code : {code} res : {res}");
|
LoggerUtils.Debug($"[iap] [server] res ====> code : {code} res : {res}");
|
||||||
if (code == 0)
|
if (code == 0)
|
||||||
{
|
{
|
||||||
Response<T> resp = null;
|
Response<T> resp = null;
|
||||||
|
@ -103,11 +105,11 @@ namespace WZ
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
errorMsg = $"[server] Data conversion exception。{e.Message} {res}";
|
errorMsg = $"[iap] [server] Data conversion exception。{e.Message} {res}";
|
||||||
LoggerUtils.Debug(errorMsg);
|
LoggerUtils.Debug(errorMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
LoggerUtils.Debug($"[server] resp ====> code : {resp.code} res : {resp.data}");
|
LoggerUtils.Debug($"[iap] [server] resp ====> code : {resp.code} res : {resp.data}");
|
||||||
if (resp != null)
|
if (resp != null)
|
||||||
{
|
{
|
||||||
callback(resp.code, resp.msg, resp.data);
|
callback(resp.code, resp.msg, resp.data);
|
||||||
|
@ -122,7 +124,7 @@ namespace WZ
|
||||||
callback.Invoke(code, res, new T());
|
callback.Invoke(code, res, new T());
|
||||||
}
|
}
|
||||||
|
|
||||||
LoggerUtils.Debug("[server]" + "[res] " + res);
|
LoggerUtils.Debug("[iap] [server]" + "[res] " + res);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +132,7 @@ namespace WZ
|
||||||
{
|
{
|
||||||
var encryptRequestBodyBytes = XXTEA.Encrypt(Encoding.UTF8.GetBytes(requestBody), Encoding.UTF8.GetBytes(XXTEA_KEY));
|
var encryptRequestBodyBytes = XXTEA.Encrypt(Encoding.UTF8.GetBytes(requestBody), Encoding.UTF8.GetBytes(XXTEA_KEY));
|
||||||
var encryptRequestBody = EncryptionUtils.BytesToHexString(encryptRequestBodyBytes, false);
|
var encryptRequestBody = EncryptionUtils.BytesToHexString(encryptRequestBodyBytes, false);
|
||||||
LoggerUtils.Debug($"[[server]] [EncryptRequestBody] requestBody = {requestBody} encryptRequestBody = {encryptRequestBody}");
|
LoggerUtils.Debug($"[iap] [server] [EncryptRequestBody] requestBody = {requestBody} encryptRequestBody = {encryptRequestBody}");
|
||||||
return encryptRequestBody;
|
return encryptRequestBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +140,7 @@ namespace WZ
|
||||||
{
|
{
|
||||||
var decryptResponseBodyBytes = XXTEA.Decrypt(EncryptionUtils.HexStringToBytes(responseBody), Encoding.UTF8.GetBytes(XXTEA_KEY));
|
var decryptResponseBodyBytes = XXTEA.Decrypt(EncryptionUtils.HexStringToBytes(responseBody), Encoding.UTF8.GetBytes(XXTEA_KEY));
|
||||||
var decryptResponseBody = Encoding.UTF8.GetString(decryptResponseBodyBytes);
|
var decryptResponseBody = Encoding.UTF8.GetString(decryptResponseBodyBytes);
|
||||||
LoggerUtils.Debug($"[[server]] [DecryptResponseBody] decryptResponseBody = {decryptResponseBody}");
|
LoggerUtils.Debug($"[iap] [[server]] [DecryptResponseBody] decryptResponseBody = {decryptResponseBody}");
|
||||||
return decryptResponseBody;
|
return decryptResponseBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +181,7 @@ namespace WZ
|
||||||
args.AddIfNotExists("device_type", "Android");
|
args.AddIfNotExists("device_type", "Android");
|
||||||
args.AddIfNotExists("platform_channel", "gp");
|
args.AddIfNotExists("platform_channel", "gp");
|
||||||
args.AddIfNotExists("app_version", Application.version);
|
args.AddIfNotExists("app_version", Application.version);
|
||||||
args.AddIfNotExists("app_version_code", DataUtils.AndroidVersionCode());
|
args.AddIfNotExists("app_version_code", DataUtils.AndroidVersionCode().ToString());
|
||||||
args.AddIfNotExists("language", "ZH");
|
args.AddIfNotExists("language", "ZH");
|
||||||
args.AddIfNotExists("ip", "");
|
args.AddIfNotExists("ip", "");
|
||||||
args.AddIfNotExists("device_id", AdjustManager.Instance.GetGdid());
|
args.AddIfNotExists("device_id", AdjustManager.Instance.GetGdid());
|
||||||
|
@ -207,7 +209,7 @@ namespace WZ
|
||||||
args.AddIfNotExists("memory_usage", "");
|
args.AddIfNotExists("memory_usage", "");
|
||||||
args.AddIfNotExists("country", "");
|
args.AddIfNotExists("country", "");
|
||||||
args.AddIfNotExists("user_id", "");
|
args.AddIfNotExists("user_id", "");
|
||||||
args.AddIfNotExists("user_type", "");
|
args.AddIfNotExists("user_type", 0);
|
||||||
args.AddIfNotExists("ss_distinct_id", TDAnalytics.GetDistinctId() ?? "");
|
args.AddIfNotExists("ss_distinct_id", TDAnalytics.GetDistinctId() ?? "");
|
||||||
args.AddIfNotExists("ss_account_id", "");
|
args.AddIfNotExists("ss_account_id", "");
|
||||||
args.AddIfNotExists("ts", "" + TimeUtils.CurrentTimestamp());
|
args.AddIfNotExists("ts", "" + TimeUtils.CurrentTimestamp());
|
||||||
|
|
Loading…
Reference in New Issue