com.xd.sdk.payment 7.2.0 → 7.2.1-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.
|
@@ -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();
|
|
@@ -204,7 +208,7 @@ namespace XD.SDK.Payment.Internal.Standalone
|
|
|
204
208
|
if (code == PayModule.PAY_CANCEL)
|
|
205
209
|
{
|
|
206
210
|
AliyunTrack.PaymentFailed("user_cancel");
|
|
207
|
-
tcs.TrySetException(XDGErrorExtensions.CancelledError());
|
|
211
|
+
tcs.TrySetException(XDGErrorExtensions.CancelledError(XDLocalization.GetCurrentLocalizableString().PayCancel));
|
|
208
212
|
}
|
|
209
213
|
else
|
|
210
214
|
{
|
|
@@ -217,7 +221,7 @@ namespace XD.SDK.Payment.Internal.Standalone
|
|
|
217
221
|
else if (result == PayModule.PAY_FRAGMENT_CANCEL)
|
|
218
222
|
{
|
|
219
223
|
AliyunTrack.PaymentFailed("user_cancel");
|
|
220
|
-
tcs.TrySetException(XDGErrorExtensions.CancelledError());
|
|
224
|
+
tcs.TrySetException(XDGErrorExtensions.CancelledError(XDLocalization.GetCurrentLocalizableString().PayCancel));
|
|
221
225
|
}
|
|
222
226
|
else
|
|
223
227
|
{
|
|
@@ -232,7 +236,7 @@ namespace XD.SDK.Payment.Internal.Standalone
|
|
|
232
236
|
return;
|
|
233
237
|
}
|
|
234
238
|
|
|
235
|
-
throw new XDGError(ResponseCode.Common.Failed,
|
|
239
|
+
throw new XDGError(ResponseCode.Common.Failed, XDLocalization.GetCurrentLocalizableString().PayFail);
|
|
236
240
|
}
|
|
237
241
|
}
|
|
238
242
|
}
|
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",
|
|
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"
|
|
10
10
|
}
|
|
11
11
|
}
|