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
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
#if UNITY_EDITOR || UNITY_STANDALONE
|
|
2
|
+
using System;
|
|
3
|
+
using System.Collections.Generic;
|
|
4
|
+
using System.Globalization;
|
|
5
|
+
using System.Linq;
|
|
6
|
+
using System.Threading;
|
|
7
|
+
using System.Threading.Tasks;
|
|
8
|
+
using XD.SDK.Account;
|
|
9
|
+
using XD.SDK.Common;
|
|
10
|
+
using XD.SDK.Common.Internal;
|
|
11
|
+
using XD.SDK.Common.Internal.Standalone;
|
|
12
|
+
using Task = System.Threading.Tasks.Task;
|
|
13
|
+
|
|
14
|
+
namespace XD.SDK.Payment.Internal.Standalone
|
|
15
|
+
{
|
|
16
|
+
public class PaymentFeaturesImpl : IXDGPayment
|
|
17
|
+
{
|
|
18
|
+
private static volatile PaymentFeaturesImpl _instance;
|
|
19
|
+
|
|
20
|
+
// 用于线程同步的锁对象
|
|
21
|
+
private static readonly object Lock = new object();
|
|
22
|
+
|
|
23
|
+
/// <summary>
|
|
24
|
+
/// 获取 PaymentFeaturesImp 的单例实例
|
|
25
|
+
/// </summary>
|
|
26
|
+
public static PaymentFeaturesImpl Instance
|
|
27
|
+
{
|
|
28
|
+
get
|
|
29
|
+
{
|
|
30
|
+
if (_instance != null) return _instance;
|
|
31
|
+
lock (Lock)
|
|
32
|
+
{
|
|
33
|
+
if (_instance == null)
|
|
34
|
+
{
|
|
35
|
+
_instance = new PaymentFeaturesImpl();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return _instance;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/// <summary>
|
|
44
|
+
/// 私有构造函数,防止外部直接创建实例
|
|
45
|
+
/// </summary>
|
|
46
|
+
private PaymentFeaturesImpl()
|
|
47
|
+
{
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public async void QueryWithProductIds(string[] productIds, Action<List<XDGProductInfo>, XDGError> callback)
|
|
51
|
+
{
|
|
52
|
+
try
|
|
53
|
+
{
|
|
54
|
+
var skuDetails = await PayModule.QueryProducts(productIds);
|
|
55
|
+
var productInfos = skuDetails.Select(sku =>
|
|
56
|
+
new XDGProductInfo
|
|
57
|
+
{
|
|
58
|
+
ProductId = sku?.ProductSkuCode,
|
|
59
|
+
DisplayPrice = sku?.DisplayPrice
|
|
60
|
+
}
|
|
61
|
+
).ToList();
|
|
62
|
+
callback.Invoke(productInfos, null);
|
|
63
|
+
}
|
|
64
|
+
catch (XDGError e)
|
|
65
|
+
{
|
|
66
|
+
callback.Invoke(null, e);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
public async void PayWithParams(XDGPaymentParams paymentParams, Action<XDGOrderInfo, XDGError> callback)
|
|
71
|
+
{
|
|
72
|
+
if (paymentParams.CheckValid() != null)
|
|
73
|
+
{
|
|
74
|
+
callback.Invoke(null, paymentParams.CheckValid());
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (string.IsNullOrEmpty(paymentParams.GameOrderId))
|
|
79
|
+
{
|
|
80
|
+
paymentParams.GameOrderId = Guid.NewGuid().ToString();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
try
|
|
84
|
+
{
|
|
85
|
+
#if XD_STEAM_SUPPORT
|
|
86
|
+
await PayModule.PayWithSteam(paymentParams.ProductId, paymentParams.ServerId, paymentParams.RoleId,
|
|
87
|
+
paymentParams.GameOrderId,
|
|
88
|
+
paymentParams.Extra);
|
|
89
|
+
#else
|
|
90
|
+
await PayWithWeb(paymentParams);
|
|
91
|
+
#endif
|
|
92
|
+
callback.Invoke(
|
|
93
|
+
new XDGOrderInfo
|
|
94
|
+
{
|
|
95
|
+
ProductId = paymentParams.ProductId,
|
|
96
|
+
GameOrderId = paymentParams.GameOrderId,
|
|
97
|
+
Extra = paymentParams.Extra,
|
|
98
|
+
RoleId = paymentParams.RoleId,
|
|
99
|
+
ServerId = paymentParams.ServerId
|
|
100
|
+
}, null);
|
|
101
|
+
}
|
|
102
|
+
catch (XDGError e)
|
|
103
|
+
{
|
|
104
|
+
callback.Invoke(null, e);
|
|
105
|
+
}
|
|
106
|
+
catch (Exception e)
|
|
107
|
+
{
|
|
108
|
+
callback.Invoke(null, new XDGError(e.Message));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
public void QueryPendingPurchases(Action<List<XDGPendingPurchase>, XDGError> callback)
|
|
113
|
+
{
|
|
114
|
+
callback.Invoke(new List<XDGPendingPurchase>(), null);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
public void HandlePendingPurchase(XDGPaymentParams paymentParams, Action<XDGOrderInfo, XDGError> callback)
|
|
118
|
+
{
|
|
119
|
+
callback.Invoke(null, new XDGError(ResponseCode.Common.UnavailableService,"该平台不支持"));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
private async Task<List<XDGRefundDetails>> GetRefunds()
|
|
123
|
+
{
|
|
124
|
+
try
|
|
125
|
+
{
|
|
126
|
+
CancellationTokenSource cts = new CancellationTokenSource();
|
|
127
|
+
cts.CancelAfter(TimeSpan.FromSeconds(3));
|
|
128
|
+
List<PayInfo> payInfos = await PayModule.CheckPay(cts.Token);
|
|
129
|
+
return payInfos?.Cast<XDGRefundDetails>()
|
|
130
|
+
.ToList();
|
|
131
|
+
}
|
|
132
|
+
catch (Exception e)
|
|
133
|
+
{
|
|
134
|
+
XDGLogger.Warn(e.Message);
|
|
135
|
+
return new List<XDGRefundDetails>();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
public async void CheckRefundStatusWithUI(Action<XDGRefundResultWrapper> callback)
|
|
140
|
+
{
|
|
141
|
+
try
|
|
142
|
+
{
|
|
143
|
+
var refunds = await GetRefunds();
|
|
144
|
+
callback?.Invoke(new XDGRefundResultWrapperClass(refunds, null));
|
|
145
|
+
var hasIOS = false;
|
|
146
|
+
var hasAndroid = false;
|
|
147
|
+
foreach (var refund in refunds)
|
|
148
|
+
{
|
|
149
|
+
switch (refund?.platform)
|
|
150
|
+
{
|
|
151
|
+
case 1:
|
|
152
|
+
hasIOS = true;
|
|
153
|
+
break;
|
|
154
|
+
case 2:
|
|
155
|
+
hasAndroid = true;
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (!hasIOS && !hasAndroid) return;
|
|
161
|
+
var param = new Dictionary<string, object>()
|
|
162
|
+
{
|
|
163
|
+
{ "hasIOS", hasIOS },
|
|
164
|
+
{ "hasAndroid", hasAndroid },
|
|
165
|
+
};
|
|
166
|
+
UIManager.ShowUI<PayHintAlert>(param, null);
|
|
167
|
+
}
|
|
168
|
+
catch (XDGError e)
|
|
169
|
+
{
|
|
170
|
+
callback?.Invoke(new XDGRefundResultWrapperClass(null, e));
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
private async Task PayWithWeb(XDGPaymentParams paymentParams)
|
|
175
|
+
{
|
|
176
|
+
var user = XDGAccount.GetCurrentUser();
|
|
177
|
+
if (user == null)
|
|
178
|
+
{
|
|
179
|
+
throw XDGErrorExtensions.NotLoginError();
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
AliyunTrack.PaymentStart(paymentParams.ProductId, paymentParams.RoleId);
|
|
183
|
+
var url = PayModule.GetPayUrl(paymentParams.ServerId, paymentParams.RoleId, paymentParams.ProductId, paymentParams.GameOrderId, "", 0,
|
|
184
|
+
paymentParams.Extra);
|
|
185
|
+
url = Uri.EscapeUriString(url);
|
|
186
|
+
XDGLogger.Debug("支付 pay URL: " + url);
|
|
187
|
+
|
|
188
|
+
if (ConfigModule.IsGlobal)
|
|
189
|
+
{
|
|
190
|
+
var payListener = new PayListener();
|
|
191
|
+
await payListener.Start(url);
|
|
192
|
+
}
|
|
193
|
+
else
|
|
194
|
+
{
|
|
195
|
+
var tcs = new TaskCompletionSource<object>();
|
|
196
|
+
|
|
197
|
+
var data = new Dictionary<string, object>
|
|
198
|
+
{
|
|
199
|
+
{ "url", url }
|
|
200
|
+
};
|
|
201
|
+
Action<int, object> callback = (code, obj) =>
|
|
202
|
+
{
|
|
203
|
+
if (code == PayModule.PAY_CANCEL)
|
|
204
|
+
{
|
|
205
|
+
AliyunTrack.PaymentFailed("user_cancel");
|
|
206
|
+
tcs.TrySetException(XDGErrorExtensions.CancelledError());
|
|
207
|
+
}
|
|
208
|
+
else
|
|
209
|
+
{
|
|
210
|
+
var result = obj as string;
|
|
211
|
+
if (result == PayModule.PAY_FRAGMENT_SUCCESS)
|
|
212
|
+
{
|
|
213
|
+
AliyunTrack.PaymentDone();
|
|
214
|
+
tcs.TrySetResult(result);
|
|
215
|
+
}
|
|
216
|
+
else if (result == PayModule.PAY_FRAGMENT_CANCEL)
|
|
217
|
+
{
|
|
218
|
+
AliyunTrack.PaymentFailed("user_cancel");
|
|
219
|
+
tcs.TrySetException(XDGErrorExtensions.CancelledError());
|
|
220
|
+
}
|
|
221
|
+
else
|
|
222
|
+
{
|
|
223
|
+
AliyunTrack.PaymentFailed($"fail message: {result}");
|
|
224
|
+
tcs.TrySetException(XDGErrorExtensions.UnknownError(result));
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
UIManager.ShowUI<PaymentAlert>("PaymentAlert", data, callback);
|
|
229
|
+
AliyunTrack.PaymentCallPage();
|
|
230
|
+
await tcs.Task;
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
throw new XDGError(ResponseCode.Common.Failed, "Payment failed");
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
#endif
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using UnityEngine;
|
|
4
|
+
using XD.SDK.Common;
|
|
5
|
+
|
|
6
|
+
namespace XD.SDK.Payment.Internal
|
|
7
|
+
{
|
|
8
|
+
public class XDGPaymentInternal
|
|
9
|
+
{
|
|
10
|
+
private static readonly IXDGPayment PlatformWrapper;
|
|
11
|
+
|
|
12
|
+
static XDGPaymentInternal()
|
|
13
|
+
{
|
|
14
|
+
#if UNITY_IOS || UNITY_ANDROID
|
|
15
|
+
PlatformWrapper = Internal.Mobile.PaymentFeaturesImpl.Instance;
|
|
16
|
+
#elif UNITY_STANDALONE
|
|
17
|
+
PlatformWrapper = Internal.Standalone.PaymentFeaturesImpl.Instance;
|
|
18
|
+
#endif
|
|
19
|
+
if (PlatformWrapper == null)
|
|
20
|
+
{
|
|
21
|
+
XDGLogger.Error("unsupported platform: " + Application.platform);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public static void QueryWithProductIds(string[] productIds, Action<List<XDGProductInfo>, XDGError> callback)
|
|
26
|
+
{
|
|
27
|
+
PlatformWrapper.QueryWithProductIds(productIds, callback);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public static void PayWithParams(XDGPaymentParams paymentParams, Action<XDGOrderInfo, XDGError> callback)
|
|
31
|
+
{
|
|
32
|
+
PlatformWrapper.PayWithParams(paymentParams, callback);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public static void QueryPendingPurchases(Action<List<XDGPendingPurchase>, XDGError> callback)
|
|
36
|
+
{
|
|
37
|
+
PlatformWrapper.QueryPendingPurchases(callback);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public static void HandlePendingPurchase(XDGPaymentParams paymentParams,
|
|
41
|
+
Action<XDGOrderInfo, XDGError> callback)
|
|
42
|
+
{
|
|
43
|
+
PlatformWrapper.HandlePendingPurchase(paymentParams, callback);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
using System.Collections.Generic;
|
|
3
|
-
using TapTap.Common;
|
|
4
|
-
|
|
5
|
-
namespace XD.SDK.Payment
|
|
1
|
+
namespace XD.SDK.Payment.Internal
|
|
6
2
|
{
|
|
7
3
|
public interface XDGRefundDetails
|
|
8
4
|
{
|
|
@@ -12,10 +8,12 @@ namespace XD.SDK.Payment
|
|
|
12
8
|
string outTradeNo { get; }
|
|
13
9
|
double refundAmount { get; }
|
|
14
10
|
int supplyStatus { get; }
|
|
11
|
+
|
|
15
12
|
/// <summary>
|
|
16
13
|
/// 1- iOS;2-Android;3-Web;4-macOS;5-Windows;6-unknown
|
|
17
14
|
/// </summary>
|
|
18
15
|
int platform { get; }
|
|
16
|
+
|
|
19
17
|
int channelType { get; }
|
|
20
18
|
}
|
|
21
19
|
}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
#if XDSDK_DEPRECATED
|
|
2
|
+
using System;
|
|
3
|
+
using System.Collections.Generic;
|
|
4
|
+
using Newtonsoft.Json;
|
|
5
|
+
using UnityEngine;
|
|
6
|
+
using XD.SDK.Common;
|
|
7
|
+
|
|
8
|
+
namespace XD.SDK.Payment
|
|
9
|
+
{
|
|
10
|
+
partial class XDGPayment
|
|
11
|
+
{
|
|
12
|
+
[Obsolete("Deprecated in XDSDK 7.x")]
|
|
13
|
+
public static void PayWithParams(XDGPaymentParams paymentParams, Action<XDGOrderInfoWrapper> callback)
|
|
14
|
+
{
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
[Obsolete("Deprecated in XDSDK 7.x")]
|
|
18
|
+
public static void PayWithProduct(string orderId, string productId, string roleId, string serverId, string ext,
|
|
19
|
+
Action<XDGOrderInfoWrapper> callback){
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
[Obsolete("Deprecated in XDSDK 7.x")]
|
|
23
|
+
public static void PayWithWeb(
|
|
24
|
+
string orderId,
|
|
25
|
+
string productId,
|
|
26
|
+
string productName,
|
|
27
|
+
double payAmount,
|
|
28
|
+
string roleId,
|
|
29
|
+
string serverId,
|
|
30
|
+
string extras,
|
|
31
|
+
Action<WebPayResultType, string> callback){
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
[Obsolete("Deprecated in XDSDK 7.x")]
|
|
35
|
+
public static void QueryWithProductIds(string[] productIds, Action<XDGSkuDetailInfo> callback){
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
[Obsolete("Deprecated in XDSDK 7.x")]
|
|
39
|
+
public static void QueryRestoredPurchase(Action<List<XDGRestoredPurchase>> callback){
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
[Obsolete("Deprecated in XDSDK 7.x")]
|
|
44
|
+
public interface XDGOrderInfoWrapper
|
|
45
|
+
{
|
|
46
|
+
XDGError xdgError { get; }
|
|
47
|
+
XDGOrderInfo orderInfo { get; }
|
|
48
|
+
string debugMsg { get; }
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
[Obsolete("Deprecated in XDSDK 7.x")]
|
|
52
|
+
public enum WebPayResultType
|
|
53
|
+
{
|
|
54
|
+
OK = 0,
|
|
55
|
+
Cancel = 1,
|
|
56
|
+
Processing = 2,
|
|
57
|
+
Error = -1,
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
[Obsolete("Deprecated in XDSDK 7.x")]
|
|
61
|
+
public interface XDGSkuDetailInfo
|
|
62
|
+
{
|
|
63
|
+
XDGError xdgError { get; }
|
|
64
|
+
|
|
65
|
+
List<SkuDetailBean> skuDetailList { get; }
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
#if UNITY_IOS
|
|
69
|
+
[Serializable]
|
|
70
|
+
[Obsolete("Deprecated in XDSDK 7.x")]
|
|
71
|
+
public class SkuDetailBean
|
|
72
|
+
{
|
|
73
|
+
public string localizedDescription;
|
|
74
|
+
|
|
75
|
+
public string localizedTitle;
|
|
76
|
+
|
|
77
|
+
public double price;
|
|
78
|
+
|
|
79
|
+
public string productIdentifier;
|
|
80
|
+
|
|
81
|
+
public string localeIdentifier;
|
|
82
|
+
|
|
83
|
+
public PriceLocale priceLocale;
|
|
84
|
+
|
|
85
|
+
public SkuDetailBean(string json)
|
|
86
|
+
{
|
|
87
|
+
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
public SkuDetailBean(Dictionary<string,object> dic)
|
|
91
|
+
{
|
|
92
|
+
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
public SkuDetailBean()
|
|
96
|
+
{
|
|
97
|
+
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
public string ToJSON(){
|
|
101
|
+
return JsonUtility.ToJson(this);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
}
|
|
106
|
+
[Serializable]
|
|
107
|
+
public class PriceLocale
|
|
108
|
+
{
|
|
109
|
+
public string localeIdentifier;
|
|
110
|
+
|
|
111
|
+
public string languageCode;
|
|
112
|
+
|
|
113
|
+
public string countryCode;
|
|
114
|
+
|
|
115
|
+
public string scriptCode;
|
|
116
|
+
|
|
117
|
+
public string calendarIdentifier;
|
|
118
|
+
|
|
119
|
+
public string decimalSeparator;
|
|
120
|
+
|
|
121
|
+
public string currencySymbol;
|
|
122
|
+
|
|
123
|
+
public PriceLocale(Dictionary<string,object> dic)
|
|
124
|
+
{
|
|
125
|
+
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
#elif UNITY_ANDROID
|
|
130
|
+
[Serializable]
|
|
131
|
+
[Obsolete("Deprecated in XDSDK 7.x")]
|
|
132
|
+
public class SkuDetailBean
|
|
133
|
+
{
|
|
134
|
+
private string _originString;
|
|
135
|
+
public string description;
|
|
136
|
+
public string name;
|
|
137
|
+
public string productId;
|
|
138
|
+
public string productType;
|
|
139
|
+
public string title;
|
|
140
|
+
public GoogleOneTimePurchaseOfferDetails googleOneTimePurchaseOfferDetails;
|
|
141
|
+
|
|
142
|
+
public override string ToString()
|
|
143
|
+
{
|
|
144
|
+
return _originString;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
public SkuDetailBean(Dictionary<string, object> dic)
|
|
148
|
+
{
|
|
149
|
+
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
[Serializable]
|
|
154
|
+
public class GoogleOneTimePurchaseOfferDetails
|
|
155
|
+
{
|
|
156
|
+
public string formattedPrice;
|
|
157
|
+
public long priceAmountMicros;
|
|
158
|
+
public string priceCurrencyCode;
|
|
159
|
+
|
|
160
|
+
public GoogleOneTimePurchaseOfferDetails(Dictionary<string, object> dic)
|
|
161
|
+
{
|
|
162
|
+
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
#else
|
|
166
|
+
public class SkuDetailBean
|
|
167
|
+
{
|
|
168
|
+
[JsonProperty("productSkuName")]
|
|
169
|
+
public string ProductSkuName { get; set; }
|
|
170
|
+
|
|
171
|
+
[JsonProperty("productSkuCode")]
|
|
172
|
+
public string ProductSkuCode { get; set; }
|
|
173
|
+
|
|
174
|
+
[JsonProperty("desc")]
|
|
175
|
+
public string Desc { get; set; }
|
|
176
|
+
|
|
177
|
+
[JsonProperty("channelSkuCode")]
|
|
178
|
+
public string ChannelSkuCode { get; set; }
|
|
179
|
+
|
|
180
|
+
[JsonProperty("currency")]
|
|
181
|
+
public string Currency { get; set; }
|
|
182
|
+
|
|
183
|
+
[JsonProperty("region")]
|
|
184
|
+
public string Region { get; set; }
|
|
185
|
+
|
|
186
|
+
[JsonProperty("costPrice")]
|
|
187
|
+
public double CostPrice { get; set; }
|
|
188
|
+
|
|
189
|
+
[JsonProperty("salePrice")]
|
|
190
|
+
public double SalePrice { get; set; }
|
|
191
|
+
|
|
192
|
+
public string ToJSON(){
|
|
193
|
+
return JsonConvert.SerializeObject(this);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
#endif
|
|
197
|
+
|
|
198
|
+
[Serializable]
|
|
199
|
+
[Obsolete("Deprecated in XDSDK 7.x")]
|
|
200
|
+
public class XDGRestoredPurchase
|
|
201
|
+
{
|
|
202
|
+
public string purchaseToken;
|
|
203
|
+
|
|
204
|
+
public string productId;
|
|
205
|
+
|
|
206
|
+
#if UNITY_ANDROID
|
|
207
|
+
public string orderId;
|
|
208
|
+
|
|
209
|
+
public string packageName;
|
|
210
|
+
|
|
211
|
+
public long purchaseTime;
|
|
212
|
+
|
|
213
|
+
public int purchaseState;
|
|
214
|
+
|
|
215
|
+
public string developerPayload;
|
|
216
|
+
|
|
217
|
+
public bool acknowledged;
|
|
218
|
+
|
|
219
|
+
public bool autoRenewing;
|
|
220
|
+
#endif
|
|
221
|
+
public XDGRestoredPurchase(string json)
|
|
222
|
+
{
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
public XDGRestoredPurchase(Dictionary<string, object> dic)
|
|
226
|
+
{
|
|
227
|
+
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
#endif
|