com.xd.sdk.payment 7.2.0 → 7.2.1-alpha.2
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/Runtime/Internal/Standalone/AliyunTrack.Payment.cs +4 -1
- package/Runtime/Internal/Standalone/PayListener.cs +1 -1
- package/Runtime/Internal/Standalone/PayModule.cs +9 -8
- package/Runtime/Internal/Standalone/PaymentAlert.cs +1 -1
- package/Runtime/Internal/Standalone/PaymentFeaturesImpl.cs +23 -15
- package/package.json +2 -2
|
@@ -67,7 +67,10 @@ namespace XD.SDK.Payment.Internal.Standalone
|
|
|
67
67
|
{
|
|
68
68
|
string eventId = "sdkcharge_order_request";
|
|
69
69
|
Dictionary<string, string> data = GetPaymentModuleCommonProperties(eventId);
|
|
70
|
-
|
|
70
|
+
if (SteamWrapper.Initialized())
|
|
71
|
+
{
|
|
72
|
+
data["pick_country"] = SteamWrapper.Instance.GetSteamCountry();
|
|
73
|
+
}
|
|
71
74
|
CommonAliyunTrack.LogEventAsync(eventId, data);
|
|
72
75
|
}
|
|
73
76
|
|
|
@@ -23,7 +23,7 @@ namespace XD.SDK.Payment.Internal.Standalone
|
|
|
23
23
|
XDGLogger.Debug($"pay: {payRequest}",XDGLoggerTag.Pay);
|
|
24
24
|
_timeLeft = TIMEOUT;
|
|
25
25
|
UIManager.ShowLoading(true);
|
|
26
|
-
Application.OpenURL(
|
|
26
|
+
Application.OpenURL(payRequest);
|
|
27
27
|
AliyunTrack.PaymentCallPage();
|
|
28
28
|
// 启动监听
|
|
29
29
|
HttpListener server = new HttpListener();
|
|
@@ -125,7 +125,7 @@ namespace XD.SDK.Payment.Internal.Standalone
|
|
|
125
125
|
{
|
|
126
126
|
CreateOrderResult createOrderResult = await CreateSteamOrder(productId, serverId, roldId, orderId, ext);
|
|
127
127
|
|
|
128
|
-
string microTxn = await
|
|
128
|
+
string microTxn = await SteamWrapper.Instance.GetMicroTxn(createOrderResult.TradeNo);
|
|
129
129
|
AliyunTrack.ReceiveSteamOrder(createOrderResult.TradeNo.ToString());
|
|
130
130
|
await ReportSteamOrder(productId, createOrderResult.TradeNo, microTxn);
|
|
131
131
|
}
|
|
@@ -143,8 +143,8 @@ namespace XD.SDK.Payment.Internal.Standalone
|
|
|
143
143
|
AliyunTrack.CreateOrder();
|
|
144
144
|
try
|
|
145
145
|
{
|
|
146
|
-
string steamId =
|
|
147
|
-
string steamLanguage =
|
|
146
|
+
string steamId = SteamWrapper.Instance.GetSteamId();
|
|
147
|
+
string steamLanguage = SteamWrapper.Instance.GetSteamLanguage();
|
|
148
148
|
Dictionary<string, object> data = new Dictionary<string, object>
|
|
149
149
|
{
|
|
150
150
|
{ "productId", productId },
|
|
@@ -234,11 +234,12 @@ namespace XD.SDK.Payment.Internal.Standalone
|
|
|
234
234
|
{ "skus", string.Join(",", productIds) }
|
|
235
235
|
};
|
|
236
236
|
var url = XDG_QUERY_PRODUCTS_V2;
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
237
|
+
if (SteamWrapper.Initialized())
|
|
238
|
+
{
|
|
239
|
+
queryParams.Add("steamId", SteamWrapper.Instance.GetSteamId());
|
|
240
|
+
url = XDG_QUERY_PRODUCTS;
|
|
241
|
+
}
|
|
242
|
+
var response = await XDHttpClient.Client.GetAsync<QueryProductsResponse>(url,
|
|
242
243
|
queryParams: queryParams);
|
|
243
244
|
return response.Products;
|
|
244
245
|
}
|
|
@@ -63,7 +63,7 @@ namespace XD.SDK.Payment.Internal.Standalone
|
|
|
63
63
|
}
|
|
64
64
|
catch (XDGError e)
|
|
65
65
|
{
|
|
66
|
-
callback.Invoke(null, e);
|
|
66
|
+
callback.Invoke(null, e.ParseToError());
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -82,13 +82,17 @@ namespace XD.SDK.Payment.Internal.Standalone
|
|
|
82
82
|
|
|
83
83
|
try
|
|
84
84
|
{
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
paymentParams.
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
85
|
+
if (SteamWrapper.Initialized())
|
|
86
|
+
{
|
|
87
|
+
await PayModule.PayWithSteam(paymentParams.ProductId, paymentParams.ServerId, paymentParams.RoleId,
|
|
88
|
+
paymentParams.GameOrderId,
|
|
89
|
+
paymentParams.Extra);
|
|
90
|
+
}
|
|
91
|
+
else
|
|
92
|
+
{
|
|
93
|
+
await PayWithWeb(paymentParams);
|
|
94
|
+
}
|
|
95
|
+
|
|
92
96
|
callback.Invoke(
|
|
93
97
|
new XDGOrderInfo
|
|
94
98
|
{
|
|
@@ -101,11 +105,11 @@ namespace XD.SDK.Payment.Internal.Standalone
|
|
|
101
105
|
}
|
|
102
106
|
catch (XDGError e)
|
|
103
107
|
{
|
|
104
|
-
callback.Invoke(null, e);
|
|
108
|
+
callback.Invoke(null, e.ParseToError());
|
|
105
109
|
}
|
|
106
110
|
catch (Exception e)
|
|
107
111
|
{
|
|
108
|
-
callback.Invoke(null,
|
|
112
|
+
callback.Invoke(null, e.ParseToError());
|
|
109
113
|
}
|
|
110
114
|
}
|
|
111
115
|
|
|
@@ -167,7 +171,7 @@ namespace XD.SDK.Payment.Internal.Standalone
|
|
|
167
171
|
}
|
|
168
172
|
catch (XDGError e)
|
|
169
173
|
{
|
|
170
|
-
callback?.Invoke(new XDGRefundResultWrapperClass(null, e));
|
|
174
|
+
callback?.Invoke(new XDGRefundResultWrapperClass(null, e.ParseToError()));
|
|
171
175
|
}
|
|
172
176
|
}
|
|
173
177
|
|
|
@@ -185,7 +189,7 @@ namespace XD.SDK.Payment.Internal.Standalone
|
|
|
185
189
|
// TODO 不需要二次 Encode
|
|
186
190
|
// url = Uri.EscapeUriString(url);
|
|
187
191
|
XDGLogger.Debug("支付 pay URL: " + url, XDGLoggerTag.Pay);
|
|
188
|
-
|
|
192
|
+
|
|
189
193
|
if (ConfigModule.IsGlobal)
|
|
190
194
|
{
|
|
191
195
|
var payListener = new PayListener();
|
|
@@ -193,6 +197,7 @@ namespace XD.SDK.Payment.Internal.Standalone
|
|
|
193
197
|
}
|
|
194
198
|
else
|
|
195
199
|
{
|
|
200
|
+
#if (UNITY_EDITOR || UNITY_STANDALONE) && !XDSDK_DISABLE_VUPLEX
|
|
196
201
|
var tcs = new TaskCompletionSource<object>();
|
|
197
202
|
|
|
198
203
|
var data = new Dictionary<string, object>
|
|
@@ -204,7 +209,7 @@ namespace XD.SDK.Payment.Internal.Standalone
|
|
|
204
209
|
if (code == PayModule.PAY_CANCEL)
|
|
205
210
|
{
|
|
206
211
|
AliyunTrack.PaymentFailed("user_cancel");
|
|
207
|
-
tcs.TrySetException(XDGErrorExtensions.CancelledError());
|
|
212
|
+
tcs.TrySetException(XDGErrorExtensions.CancelledError(XDLocalization.GetCurrentLocalizableString().PayCancel));
|
|
208
213
|
}
|
|
209
214
|
else
|
|
210
215
|
{
|
|
@@ -217,7 +222,7 @@ namespace XD.SDK.Payment.Internal.Standalone
|
|
|
217
222
|
else if (result == PayModule.PAY_FRAGMENT_CANCEL)
|
|
218
223
|
{
|
|
219
224
|
AliyunTrack.PaymentFailed("user_cancel");
|
|
220
|
-
tcs.TrySetException(XDGErrorExtensions.CancelledError());
|
|
225
|
+
tcs.TrySetException(XDGErrorExtensions.CancelledError(XDLocalization.GetCurrentLocalizableString().PayCancel));
|
|
221
226
|
}
|
|
222
227
|
else
|
|
223
228
|
{
|
|
@@ -230,9 +235,12 @@ namespace XD.SDK.Payment.Internal.Standalone
|
|
|
230
235
|
AliyunTrack.PaymentCallPage();
|
|
231
236
|
await tcs.Task;
|
|
232
237
|
return;
|
|
238
|
+
#else
|
|
239
|
+
throw new XDGError(ResponseCode.Common.Failed, "This function need vuplex enabled");
|
|
240
|
+
#endif
|
|
233
241
|
}
|
|
234
242
|
|
|
235
|
-
throw new XDGError(ResponseCode.Common.Failed,
|
|
243
|
+
throw new XDGError(ResponseCode.Common.Failed, XDLocalization.GetCurrentLocalizableString().PayFail);
|
|
236
244
|
}
|
|
237
245
|
}
|
|
238
246
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "com.xd.sdk.payment",
|
|
3
3
|
"displayName": "XDGSDK Payment",
|
|
4
|
-
"version": "7.2.
|
|
4
|
+
"version": "7.2.1-alpha.2",
|
|
5
5
|
"description": "XDGSDK",
|
|
6
6
|
"unity": "2019.3",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"com.xd.sdk.common": "7.2.
|
|
9
|
+
"com.xd.sdk.common": "7.2.1-alpha.2"
|
|
10
10
|
}
|
|
11
11
|
}
|