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.
@@ -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
- data["pick_country"] = SteamUtils.Instance.GetSteamCountry();
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(Uri.EscapeUriString(payRequest));
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 SteamUtils.Instance.GetMicroTxn(createOrderResult.TradeNo);
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 = SteamUtils.Instance.GetSteamId();
147
- string steamLanguage = SteamUtils.Instance.GetSteamLanguage();
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
- #if XD_STEAM_SUPPORT
238
- queryParams.Add("steamId", SteamUtils.Instance.GetSteamId());
239
- url = XDG_QUERY_PRODUCTS;
240
- #endif
241
- var response = await XDHttpClient.Client.GetAsync<QueryProductsResponse>(XDG_QUERY_PRODUCTS,
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
  }
@@ -1,4 +1,4 @@
1
- #if UNITY_EDITOR || UNITY_STANDALONE
1
+ #if (UNITY_EDITOR || UNITY_STANDALONE) && !XDSDK_DISABLE_VUPLEX
2
2
  using System;
3
3
  using UnityEngine;
4
4
  using UnityEngine.UI;
@@ -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
- #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
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, new XDGError(e.Message));
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, "Payment 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.0",
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.0"
9
+ "com.xd.sdk.common": "7.2.1-alpha.2"
10
10
  }
11
11
  }