com.xd.sdk.payment 0.0.1 → 0.0.11-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Plugins/Android/libs/XDGPaymentUPPay_7.0.0.aar +0 -0
- package/Plugins/Android/libs/{XDGPayment_6.21.1.aar.meta → XDGPaymentUPPay_7.0.0.aar.meta} +2 -2
- package/Plugins/Android/libs/XDGPayment_7.0.0.aar +0 -0
- package/Plugins/Android/libs/XDGPayment_7.0.0.aar.meta +32 -0
- package/Plugins/Android/libs.meta +1 -1
- package/Plugins/Android.meta +1 -1
- package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGOrderInfo.h +9 -9
- package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGOrderInfo.h.meta +1 -1
- package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGPayment.h +12 -57
- package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGPayment.h.meta +1 -1
- package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGPaymentDefines.h +49 -0
- package/{README.md.meta → Plugins/iOS/XDPaymentSDK.framework/Headers/XDGPaymentDefines.h.meta} +2 -2
- package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGPaymentParams.h +43 -0
- package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGPaymentParams.h.meta +7 -0
- package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGPaymentService.h +11 -8
- package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGPaymentService.h.meta +1 -1
- package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGPaymentVersion.h +3 -2
- package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGPaymentVersion.h.meta +1 -1
- package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGPendingPurchase.h +18 -0
- package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGPendingPurchase.h.meta +7 -0
- package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGProductInfo.h +29 -2
- package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGProductInfo.h.meta +1 -1
- package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGTransactionInfo.h +7 -3
- package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGTransactionInfo.h.meta +1 -1
- package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDPaymentSDK.h +2 -1
- package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDPaymentSDK.h.meta +1 -1
- package/Plugins/iOS/XDPaymentSDK.framework/Headers.meta +1 -1
- package/Plugins/iOS/XDPaymentSDK.framework/Info.plist +0 -0
- package/Plugins/iOS/XDPaymentSDK.framework/Info.plist.meta +1 -1
- package/Plugins/iOS/XDPaymentSDK.framework/Modules/module.modulemap.meta +1 -1
- package/Plugins/iOS/XDPaymentSDK.framework/Modules.meta +1 -1
- package/Plugins/iOS/XDPaymentSDK.framework/XDPaymentSDK +0 -0
- package/Plugins/iOS/XDPaymentSDK.framework/XDPaymentSDK.meta +1 -1
- package/Plugins/iOS/XDPaymentSDK.framework.meta +56 -3
- package/Plugins/iOS.meta +1 -1
- package/Plugins.meta +1 -1
- package/{Mobile → Runtime/Internal/Mobile}/PaymentConstants.cs +5 -8
- package/{Mobile/Editor/XDPaymentMobileProcessBuild.cs.meta → Runtime/Internal/Mobile/PaymentConstants.cs.meta} +1 -1
- package/Runtime/Internal/Mobile/PaymentFeaturesImpl.cs +185 -0
- package/{Editor/XDGAndroidPaymentProcessor.cs.meta → Runtime/Internal/Mobile/PaymentFeaturesImpl.cs.meta} +1 -1
- package/Runtime/Internal/Mobile/XDGRestoredPurchasesWrapper.cs +23 -0
- package/{Mobile → Runtime/Internal/Mobile}/XDGRestoredPurchasesWrapper.cs.meta +1 -1
- package/{Mobile.meta → Runtime/Internal/Mobile.meta} +1 -1
- package/Runtime/Internal/Standalone/AliyunTrack.Payment.cs +156 -0
- package/{Mobile/XDGDataBean.cs.meta → Runtime/Internal/Standalone/AliyunTrack.Payment.cs.meta} +1 -1
- package/Runtime/Internal/Standalone/Bean/PayCheckResponse.cs +19 -0
- package/{Editor/XDPaymentProcessBuild.cs.meta → Runtime/Internal/Standalone/Bean/PayCheckResponse.cs.meta} +1 -1
- package/Runtime/Internal/Standalone/Bean/PayInfo.cs +31 -0
- package/Runtime/Internal/Standalone/Bean/PayInfo.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Bean/QueryProductsResponse.cs +46 -0
- package/Runtime/Internal/Standalone/Bean/QueryProductsResponse.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Bean/XDGRefundResultWrapper.cs +19 -0
- package/Runtime/Internal/Standalone/Bean/XDGRefundResultWrapper.cs.meta +11 -0
- package/{Editor/XD.SDK.Payment.Editor.asmdef.meta → Runtime/Internal/Standalone/Bean.meta} +3 -2
- package/Runtime/Internal/Standalone/PayListener.cs +83 -0
- package/Runtime/Internal/Standalone/PayListener.cs.meta +11 -0
- package/Runtime/Internal/Standalone/PayModule.cs +261 -0
- package/Runtime/Internal/Standalone/PayModule.cs.meta +11 -0
- package/Runtime/Internal/Standalone/PaymentAlert.cs +112 -0
- package/Runtime/Internal/Standalone/PaymentAlert.cs.meta +11 -0
- package/Runtime/Internal/Standalone/PaymentFeaturesImpl.cs +238 -0
- package/Runtime/Internal/Standalone/PaymentFeaturesImpl.cs.meta +11 -0
- package/{Mobile/Editor.meta → Runtime/Internal/Standalone.meta} +1 -1
- package/Runtime/Internal/XDGPaymentInternal.cs +46 -0
- package/Runtime/Internal/XDGPaymentInternal.cs.meta +11 -0
- package/Runtime/{XDGRefundDetails.cs → Internal/XDGRefundDetails.cs} +3 -5
- package/Runtime/Internal/XDGRefundDetails.cs.meta +11 -0
- package/Runtime/{XDGRefundResultWrapper.cs → Internal/XDGRefundResultWrapper.cs} +1 -1
- package/Runtime/Internal/XDGRefundResultWrapper.cs.meta +11 -0
- package/{Editor.meta → Runtime/Internal.meta} +1 -1
- package/Runtime/Public/XDGPayment.Deprecated.cs +231 -0
- package/Runtime/Public/XDGPayment.Deprecated.cs.meta +11 -0
- package/Runtime/Public/XDGPayment.cs +97 -0
- package/Runtime/Public/XDGPayment.cs.meta +11 -0
- package/Runtime/Public/XDGPaymentEventHandler.cs +34 -0
- package/Runtime/Public/XDGPaymentEventHandler.cs.meta +3 -0
- package/Runtime/Public.meta +8 -0
- package/Runtime/XD.SDK.Payment.asmdef +5 -2
- package/Runtime/XD.SDK.Payment.asmdef.meta +6 -2
- package/Runtime.meta +7 -2
- package/package.json +5 -5
- package/package.json.meta +2 -2
- package/Editor/XD.SDK.Payment.Editor.asmdef +0 -19
- package/Editor/XDGAndroidPaymentProcessor.cs +0 -44
- package/Editor/XDPaymentProcessBuild.cs +0 -18
- package/Mobile/Editor/XD.SDK.Payment.Mobile.Editor.asmdef +0 -20
- package/Mobile/Editor/XD.SDK.Payment.Mobile.Editor.asmdef.meta +0 -7
- package/Mobile/Editor/XDPaymentMobileProcessBuild.cs +0 -20
- package/Mobile/PaymentConstants.cs.meta +0 -3
- package/Mobile/XD.SDK.Payment.Mobile.asmdef +0 -22
- package/Mobile/XD.SDK.Payment.Mobile.asmdef.meta +0 -7
- package/Mobile/XDGDataBean.cs +0 -242
- package/Mobile/XDGPaymentDetailsParam.cs +0 -127
- package/Mobile/XDGPaymentDetailsParam.cs.meta +0 -3
- package/Mobile/XDGPaymentMobile.cs +0 -132
- package/Mobile/XDGPaymentMobile.cs.meta +0 -11
- package/Mobile/XDGPaymentMobileImpl.cs +0 -331
- package/Mobile/XDGPaymentMobileImpl.cs.meta +0 -11
- package/Mobile/XDGRestoredPurchasesWrapper.cs +0 -42
- package/Plugins/Android/libs/XDGPayment_6.21.1.aar +0 -0
- package/README.md +0 -0
- package/Runtime/IXDGPayment.cs +0 -38
- package/Runtime/IXDGPayment.cs.meta +0 -3
- package/Runtime/WebPayResultType.cs +0 -8
- package/Runtime/WebPayResultType.cs.meta +0 -3
- package/Runtime/XDGPayType.cs +0 -8
- package/Runtime/XDGPayType.cs.meta +0 -3
- package/Runtime/XDGPayment.cs +0 -101
- package/Runtime/XDGPayment.cs.meta +0 -3
- package/Runtime/XDGRefundDetails.cs.meta +0 -3
- package/Runtime/XDGRefundResultWrapper.cs.meta +0 -3
- package/Runtime/XDGSkuDetailInfo.cs +0 -252
- package/Runtime/XDGSkuDetailInfo.cs.meta +0 -3
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
#if UNITY_ANDROID || UNITY_IOS
|
|
2
|
+
|
|
3
|
+
namespace XD.SDK.Payment.Internal.Mobile
|
|
2
4
|
{
|
|
3
5
|
public class PaymentConstants
|
|
4
6
|
{
|
|
@@ -10,11 +12,6 @@ namespace XD.SDK.Payment
|
|
|
10
12
|
public static int USER_CANCEL = 1;
|
|
11
13
|
public static int PURCHASE_PROCESSING = 2;
|
|
12
14
|
}
|
|
13
|
-
|
|
14
|
-
internal static class PayTypeInternal
|
|
15
|
-
{
|
|
16
|
-
public const string ALIPAY = "Alipay";
|
|
17
|
-
public const string WECHAT_PAY = "WeChatPay";
|
|
18
|
-
}
|
|
19
15
|
}
|
|
20
|
-
}
|
|
16
|
+
}
|
|
17
|
+
#endif
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
#if UNITY_ANDROID || UNITY_IOS
|
|
2
|
+
using System;
|
|
3
|
+
using System.Collections.Generic;
|
|
4
|
+
using XD.SDK.Common;
|
|
5
|
+
using XD.SDK.Common.Internal;
|
|
6
|
+
using XD.SDK.Common.Internal.Mobile.Bridge;
|
|
7
|
+
|
|
8
|
+
namespace XD.SDK.Payment.Internal.Mobile
|
|
9
|
+
{
|
|
10
|
+
public class PaymentFeaturesImpl : IXDGPayment
|
|
11
|
+
{
|
|
12
|
+
private static volatile PaymentFeaturesImpl _instance;
|
|
13
|
+
|
|
14
|
+
// 用于线程同步的锁对象
|
|
15
|
+
private static readonly object Lock = new object();
|
|
16
|
+
|
|
17
|
+
/// <summary>
|
|
18
|
+
/// 获取 PaymentFeaturesImp 的单例实例
|
|
19
|
+
/// </summary>
|
|
20
|
+
public static PaymentFeaturesImpl Instance
|
|
21
|
+
{
|
|
22
|
+
get
|
|
23
|
+
{
|
|
24
|
+
if (_instance != null) return _instance;
|
|
25
|
+
lock (Lock)
|
|
26
|
+
{
|
|
27
|
+
if (_instance == null)
|
|
28
|
+
{
|
|
29
|
+
_instance = new PaymentFeaturesImpl();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return _instance;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/// <summary>
|
|
38
|
+
/// 私有构造函数,防止外部直接创建实例
|
|
39
|
+
/// </summary>
|
|
40
|
+
private PaymentFeaturesImpl()
|
|
41
|
+
{
|
|
42
|
+
EngineBridge.GetInstance()
|
|
43
|
+
.Register(BridgeConstants.Payment.SERVICE_NAME, BridgeConstants.Payment.SERVICE_IMPL);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public void QueryWithProductIds(string[] productIds, Action<List<XDGProductInfo>, XDGError> callback)
|
|
47
|
+
{
|
|
48
|
+
var dic = new Dictionary<string, object>
|
|
49
|
+
{
|
|
50
|
+
{ "productIds", productIds }
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
var command = new Command.Builder()
|
|
54
|
+
.Service(BridgeConstants.Payment.BRIDGE_NAME)
|
|
55
|
+
.Method("queryWithProductIds")
|
|
56
|
+
.Args(dic)
|
|
57
|
+
.Callback(true)
|
|
58
|
+
.OnceTime(true)
|
|
59
|
+
.CommandBuilder();
|
|
60
|
+
|
|
61
|
+
EngineBridge.GetInstance().CallHandler(command, result =>
|
|
62
|
+
{
|
|
63
|
+
XDGLogger.Debug("QueryWithProductIds 方法结果: " + result.ToJson());
|
|
64
|
+
var xdgError = result.Parse2XDGError();
|
|
65
|
+
if (xdgError != null)
|
|
66
|
+
{
|
|
67
|
+
callback(null, xdgError);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
var resultDic = XDGJson.Deserialize(result.content) as Dictionary<string, object>;
|
|
72
|
+
var list = XDDictionary.GetValue<List<object>>(resultDic, "products");
|
|
73
|
+
|
|
74
|
+
var resultList = new List<XDGProductInfo>();
|
|
75
|
+
if (list == null)
|
|
76
|
+
{
|
|
77
|
+
callback(resultList, null);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
foreach (var productInfoDic in list)
|
|
82
|
+
{
|
|
83
|
+
var innerDic = productInfoDic as Dictionary<string, object>;
|
|
84
|
+
var productInfoBean = new XDGProductInfo(innerDic);
|
|
85
|
+
resultList.Add(productInfoBean);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
callback(resultList, null);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
public void PayWithParams(XDGPaymentParams paymentParams, Action<XDGOrderInfo, XDGError> callback)
|
|
93
|
+
{
|
|
94
|
+
var command = new Command.Builder()
|
|
95
|
+
.Service(BridgeConstants.Payment.BRIDGE_NAME)
|
|
96
|
+
.Method("payWithParams")
|
|
97
|
+
.Args(XDUtility.BridgeArgToDictionary("payWithParams", paymentParams))
|
|
98
|
+
.Callback(true)
|
|
99
|
+
.OnceTime(true)
|
|
100
|
+
.CommandBuilder();
|
|
101
|
+
EngineBridge.GetInstance().CallHandler(command, result =>
|
|
102
|
+
{
|
|
103
|
+
XDGLogger.Debug("PayWithParams 方法结果: " + result.ToJson());
|
|
104
|
+
var xdgError = result.Parse2XDGError();
|
|
105
|
+
if (xdgError != null)
|
|
106
|
+
{
|
|
107
|
+
callback(null, xdgError);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
var resultDic = XDGJson.Deserialize(result.content) as Dictionary<string, object>;
|
|
112
|
+
var orderInfoDic = XDDictionary.GetValue<Dictionary<string, object>>(resultDic, "orderInfo");
|
|
113
|
+
|
|
114
|
+
callback(new XDGOrderInfo(orderInfoDic), null);
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
public void QueryPendingPurchases(Action<List<XDGPendingPurchase>, XDGError> callback)
|
|
119
|
+
{
|
|
120
|
+
var command = new Command.Builder()
|
|
121
|
+
.Service(BridgeConstants.Payment.BRIDGE_NAME)
|
|
122
|
+
.Method("queryPendingPurchases")
|
|
123
|
+
.Callback(true)
|
|
124
|
+
.OnceTime(true)
|
|
125
|
+
.CommandBuilder();
|
|
126
|
+
EngineBridge.GetInstance().CallHandler(command, result =>
|
|
127
|
+
{
|
|
128
|
+
XDGLogger.Debug("QueryPendingPurchases 方法结果: " + result.ToJson());
|
|
129
|
+
|
|
130
|
+
var xdgError = result.Parse2XDGError();
|
|
131
|
+
if (xdgError != null)
|
|
132
|
+
{
|
|
133
|
+
callback(null, xdgError);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
var resultDic = XDGJson.Deserialize(result.content) as Dictionary<string, object>;
|
|
138
|
+
var list = XDDictionary.GetValue<List<object>>(resultDic, "pendingPurchases");
|
|
139
|
+
|
|
140
|
+
var resultList = new List<XDGPendingPurchase>();
|
|
141
|
+
if (list == null)
|
|
142
|
+
{
|
|
143
|
+
callback(resultList, null);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
foreach (var pendingPurchaseDic in list)
|
|
148
|
+
{
|
|
149
|
+
var innerDic = pendingPurchaseDic as Dictionary<string, object>;
|
|
150
|
+
var productInfoBean = new XDGPendingPurchase(innerDic);
|
|
151
|
+
resultList.Add(productInfoBean);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
callback(resultList, null);
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
public void HandlePendingPurchase(XDGPaymentParams paymentParams, Action<XDGOrderInfo, XDGError> callback)
|
|
159
|
+
{
|
|
160
|
+
var command = new Command.Builder()
|
|
161
|
+
.Service(BridgeConstants.Payment.BRIDGE_NAME)
|
|
162
|
+
.Method("handlePendingPurchase")
|
|
163
|
+
.Args(XDUtility.BridgeArgToDictionary("handlePendingPurchase", paymentParams))
|
|
164
|
+
.Callback(true)
|
|
165
|
+
.OnceTime(true)
|
|
166
|
+
.CommandBuilder();
|
|
167
|
+
|
|
168
|
+
EngineBridge.GetInstance().CallHandler(command, (result) =>
|
|
169
|
+
{
|
|
170
|
+
var xdgError = result.Parse2XDGError();
|
|
171
|
+
if (xdgError != null)
|
|
172
|
+
{
|
|
173
|
+
callback(null, xdgError);
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
var resultDic = XDGJson.Deserialize(result.content) as Dictionary<string, object>;
|
|
178
|
+
var orderInfoDic = XDDictionary.GetValue<Dictionary<string, object>>(resultDic, "orderInfo");
|
|
179
|
+
|
|
180
|
+
callback(new XDGOrderInfo(orderInfoDic), null);
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
#endif
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#if UNITY_ANDROID || UNITY_IOS
|
|
2
|
+
using System;
|
|
3
|
+
using System.Collections.Generic;
|
|
4
|
+
using XD.SDK.Common;
|
|
5
|
+
|
|
6
|
+
namespace XD.SDK.Payment.Internal.Mobile
|
|
7
|
+
{
|
|
8
|
+
|
|
9
|
+
[Serializable]
|
|
10
|
+
public class XDGRestoredPurchases
|
|
11
|
+
{
|
|
12
|
+
public string transactionIdentifier;
|
|
13
|
+
public string productIdentifier;
|
|
14
|
+
|
|
15
|
+
public XDGRestoredPurchases(Dictionary<string, object> dic)
|
|
16
|
+
{
|
|
17
|
+
if (dic == null) return;
|
|
18
|
+
transactionIdentifier = XDDictionary.GetValue<string>(dic, "transactionIdentifier");
|
|
19
|
+
productIdentifier = XDDictionary.GetValue<string>(dic, "productIdentifier");
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
#endif
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
#if UNITY_EDITOR || UNITY_STANDALONE
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using XD.SDK.Common.Internal.Standalone;
|
|
4
|
+
using CommonAliyunTrack = XD.SDK.Common.Internal.Standalone.AliyunTrack;
|
|
5
|
+
|
|
6
|
+
namespace XD.SDK.Payment.Internal.Standalone
|
|
7
|
+
{
|
|
8
|
+
public partial class AliyunTrack
|
|
9
|
+
{
|
|
10
|
+
internal const string PAY_PLATFORM_WEB = "Web";
|
|
11
|
+
|
|
12
|
+
internal const string PAY_PLATFORM_STEAM = "Steam";
|
|
13
|
+
|
|
14
|
+
internal const string PAY_TYPE_STEAM = "Steam";
|
|
15
|
+
|
|
16
|
+
internal const string PAY_CHANNEL_STEAM = "Steam";
|
|
17
|
+
|
|
18
|
+
private static string PaymentProcessProductId = "";
|
|
19
|
+
|
|
20
|
+
private static string PaymentPlatform;
|
|
21
|
+
|
|
22
|
+
private static string PaymentType;
|
|
23
|
+
|
|
24
|
+
private static string PaymntChannel;
|
|
25
|
+
|
|
26
|
+
private static string PaymentRoleId;
|
|
27
|
+
|
|
28
|
+
private static string _paymentEventSessionId;
|
|
29
|
+
|
|
30
|
+
public static string PaymentEventSessionId => _paymentEventSessionId;
|
|
31
|
+
|
|
32
|
+
public static void PaymentStart(string productId,
|
|
33
|
+
string roleId,
|
|
34
|
+
string platform = PAY_PLATFORM_WEB,
|
|
35
|
+
string type = null,
|
|
36
|
+
string channel = null)
|
|
37
|
+
{
|
|
38
|
+
PaymentProcessProductId = productId;
|
|
39
|
+
PaymentRoleId = roleId;
|
|
40
|
+
PaymentPlatform = platform;
|
|
41
|
+
PaymentType = type;
|
|
42
|
+
PaymntChannel = channel;
|
|
43
|
+
|
|
44
|
+
_paymentEventSessionId = CommonAliyunTrack.GetNewEventSessionId();
|
|
45
|
+
CommonAliyunTrack.LogEventAsync("sdkcharge_request", GetPaymentModuleCommonProperties("sdkcharge_request"));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public static void PaymentCallPage()
|
|
49
|
+
{
|
|
50
|
+
var content = GetPaymentModuleCommonProperties("sdkcharge_ask_pay_period");
|
|
51
|
+
CommonAliyunTrack.LogEventAsync("sdkcharge_ask_pay_period", content);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
public static void PaymentDone()
|
|
55
|
+
{
|
|
56
|
+
CommonAliyunTrack.LogEventAsync("sdkcharge_done", GetPaymentModuleCommonProperties("sdkcharge_done"));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
public static void PaymentFailed(string reason)
|
|
60
|
+
{
|
|
61
|
+
var content = GetPaymentModuleCommonProperties("sdkcharge_fail");
|
|
62
|
+
content["reason"] = reason;
|
|
63
|
+
CommonAliyunTrack.LogEventAsync("sdkcharge_fail", content);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
public static void CreateOrder()
|
|
67
|
+
{
|
|
68
|
+
string eventId = "sdkcharge_order_request";
|
|
69
|
+
Dictionary<string, string> data = GetPaymentModuleCommonProperties(eventId);
|
|
70
|
+
data["pick_country"] = SteamUtils.Instance.GetSteamCountry();
|
|
71
|
+
CommonAliyunTrack.LogEventAsync(eventId, data);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
public static void CreateOrderSuccess()
|
|
75
|
+
{
|
|
76
|
+
string eventId = "sdkcharge_order_create_success";
|
|
77
|
+
Dictionary<string, string> data = GetPaymentModuleCommonProperties(eventId);
|
|
78
|
+
CommonAliyunTrack.LogEventAsync(eventId, data);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
public static void CreateOrderFailure(int code)
|
|
82
|
+
{
|
|
83
|
+
string eventId = "sdkcharge_order_create_fail";
|
|
84
|
+
Dictionary<string, string> data = GetPaymentModuleCommonProperties(eventId);
|
|
85
|
+
data["status"] = code.ToString();
|
|
86
|
+
CommonAliyunTrack.LogEventAsync(eventId, data);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
public static void ReceiveSteamOrder(string orderId)
|
|
90
|
+
{
|
|
91
|
+
string eventId = "sdkcharge_payment_issue";
|
|
92
|
+
Dictionary<string, string> data = GetPaymentModuleCommonProperties(eventId);
|
|
93
|
+
data["order_id"] = orderId;
|
|
94
|
+
CommonAliyunTrack.LogEventAsync(eventId, data);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
public static void ReportOrder(string orderId)
|
|
98
|
+
{
|
|
99
|
+
string eventId = "sdkcharge_receipt_report";
|
|
100
|
+
Dictionary<string, string> data = GetPaymentModuleCommonProperties(eventId);
|
|
101
|
+
data["order_id"] = orderId;
|
|
102
|
+
CommonAliyunTrack.LogEventAsync(eventId, data);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
public static void ReportOrderSuccess(string orderId)
|
|
106
|
+
{
|
|
107
|
+
string eventId = "sdkcharge_payment_upload_success";
|
|
108
|
+
Dictionary<string, string> data = GetPaymentModuleCommonProperties(eventId);
|
|
109
|
+
data["order_id"] = orderId;
|
|
110
|
+
CommonAliyunTrack.LogEventAsync(eventId, data);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
public static void ReportOrderFailure(string orderId, int code, string msg)
|
|
114
|
+
{
|
|
115
|
+
string eventId = "sdkcharge_payment_upload_fail";
|
|
116
|
+
Dictionary<string, string> data = GetPaymentModuleCommonProperties(eventId);
|
|
117
|
+
data["order_id"] = orderId;
|
|
118
|
+
data["status"] = code.ToString();
|
|
119
|
+
data["reason"] = msg;
|
|
120
|
+
CommonAliyunTrack.LogEventAsync(eventId, data);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
public static void PayFailure(string orderId, int code, string msg)
|
|
124
|
+
{
|
|
125
|
+
string eventId = "sdkcharge_fail";
|
|
126
|
+
Dictionary<string, string> data = GetPaymentModuleCommonProperties(eventId);
|
|
127
|
+
data["order_id"] = orderId;
|
|
128
|
+
data["status"] = code.ToString();
|
|
129
|
+
data["reason"] = msg;
|
|
130
|
+
CommonAliyunTrack.LogEventAsync(eventId, data);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
private static Dictionary<string, string> GetPaymentModuleCommonProperties(string eventName)
|
|
134
|
+
{
|
|
135
|
+
Dictionary<string, string> content = new Dictionary<string, string>();
|
|
136
|
+
content["tag"] = "sdkcharge";
|
|
137
|
+
content["event_session_id"] = _paymentEventSessionId;
|
|
138
|
+
content["pay_platform"] = PaymentPlatform;
|
|
139
|
+
if (PaymentType != null)
|
|
140
|
+
{
|
|
141
|
+
content["pay_type"] = PaymentType;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (PaymntChannel != null)
|
|
145
|
+
{
|
|
146
|
+
content["pay_channel"] = PaymntChannel;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
content["product_id"] = PaymentProcessProductId;
|
|
150
|
+
content["role_id"] = PaymentRoleId;
|
|
151
|
+
content["logid"] = CommonAliyunTrack.GetLogId(PaymentEventSessionId, eventName);
|
|
152
|
+
return content;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
#endif
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#if UNITY_EDITOR || UNITY_STANDALONE
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using Newtonsoft.Json;
|
|
4
|
+
using XD.SDK.Common.Internal;
|
|
5
|
+
using XD.SDK.Common.Internal.Standalone;
|
|
6
|
+
|
|
7
|
+
namespace XD.SDK.Payment.Internal.Standalone
|
|
8
|
+
{
|
|
9
|
+
public class PayCheckResult
|
|
10
|
+
{
|
|
11
|
+
[JsonProperty("list")] public List<PayInfo> List { get; set; }
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
public class PayCheckResponse : BaseResponse
|
|
15
|
+
{
|
|
16
|
+
[JsonProperty("data")] public PayCheckResult Result { get; set; }
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
#endif
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#if UNITY_EDITOR || UNITY_STANDALONE
|
|
2
|
+
using Newtonsoft.Json;
|
|
3
|
+
|
|
4
|
+
namespace XD.SDK.Payment.Internal.Standalone
|
|
5
|
+
{
|
|
6
|
+
public class PayInfo : XDGRefundDetails
|
|
7
|
+
{
|
|
8
|
+
[JsonProperty("tradeNo")] public string tradeNo { get; set; }
|
|
9
|
+
|
|
10
|
+
[JsonProperty("outTradeNo")] public string outTradeNo { get; set; }
|
|
11
|
+
|
|
12
|
+
[JsonProperty("productId")] public string productId { get; set; }
|
|
13
|
+
|
|
14
|
+
[JsonProperty("currency")] public string currency { get; set; }
|
|
15
|
+
|
|
16
|
+
[JsonProperty("refundAmount")] public double refundAmount { get; set; }
|
|
17
|
+
|
|
18
|
+
[JsonProperty("supplyStatus")] public int supplyStatus { get; set; }
|
|
19
|
+
|
|
20
|
+
[JsonProperty("platform")] public int platform { get; set; } //1- iOS;2-Android;3-Web;4-macOS;5-Windows;6-unknown
|
|
21
|
+
|
|
22
|
+
[JsonProperty("channelId")] public int ChannelId { get; set; }
|
|
23
|
+
|
|
24
|
+
[JsonProperty("channelType")] public int channelType { get; set; }
|
|
25
|
+
|
|
26
|
+
public bool IsIOS => platform == 1;
|
|
27
|
+
|
|
28
|
+
public bool IsAndroid => platform == 2;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
#endif
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#if UNITY_EDITOR || UNITY_STANDALONE
|
|
2
|
+
|
|
3
|
+
using System.Collections.Generic;
|
|
4
|
+
using Newtonsoft.Json;
|
|
5
|
+
using XD.SDK.Common.Internal;
|
|
6
|
+
using XD.SDK.Common.Internal.Standalone;
|
|
7
|
+
|
|
8
|
+
namespace XD.SDK.Payment.Internal.Standalone
|
|
9
|
+
{
|
|
10
|
+
|
|
11
|
+
public class SkuDetailBean
|
|
12
|
+
{
|
|
13
|
+
[JsonProperty("productSkuName")] public string ProductSkuName { get; set; }
|
|
14
|
+
|
|
15
|
+
[JsonProperty("productSkuCode")] public string ProductSkuCode { get; set; }
|
|
16
|
+
|
|
17
|
+
[JsonProperty("desc")] public string Desc { get; set; }
|
|
18
|
+
|
|
19
|
+
[JsonProperty("channelSkuCode")] public string ChannelSkuCode { get; set; }
|
|
20
|
+
|
|
21
|
+
[JsonProperty("currency")] public string Currency { get; set; }
|
|
22
|
+
|
|
23
|
+
[JsonProperty("region")] public string Region { get; set; }
|
|
24
|
+
|
|
25
|
+
[JsonProperty("costPrice")] public double CostPrice { get; set; }
|
|
26
|
+
|
|
27
|
+
[JsonProperty("salePrice")] public double SalePrice { get; set; }
|
|
28
|
+
|
|
29
|
+
[JsonProperty("displayPrice")] public string DisplayPrice { get; set; }
|
|
30
|
+
|
|
31
|
+
public string ToJSON()
|
|
32
|
+
{
|
|
33
|
+
return JsonConvert.SerializeObject(this);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public SkuDetailBean(Dictionary<string, object> dictionary)
|
|
37
|
+
{
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public class QueryProductsResponse : BaseResponse
|
|
42
|
+
{
|
|
43
|
+
[JsonProperty("data")] public List<SkuDetailBean> Products { get; set; }
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
#endif
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#if UNITY_EDITOR || UNITY_STANDALONE
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using XD.SDK.Common;
|
|
4
|
+
|
|
5
|
+
namespace XD.SDK.Payment.Internal.Standalone
|
|
6
|
+
{
|
|
7
|
+
public class XDGRefundResultWrapperClass : XDGRefundResultWrapper
|
|
8
|
+
{
|
|
9
|
+
public XDGError xdgError { get; private set; }
|
|
10
|
+
public List<XDGRefundDetails> refundList { get; private set; }
|
|
11
|
+
|
|
12
|
+
public XDGRefundResultWrapperClass(List<XDGRefundDetails> refundList, XDGError xdgError)
|
|
13
|
+
{
|
|
14
|
+
this.refundList = refundList;
|
|
15
|
+
this.xdgError = xdgError;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
#endif
|