com.xd.sdk.payment 7.1.2 → 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.
@@ -0,0 +1,19 @@
1
+ //
2
+ // XDGLogger+Payment.h
3
+ // XDPaymentSDK
4
+ //
5
+ // Created by Fattycat on 2023/4/14.
6
+ //
7
+
8
+ #import <Foundation/Foundation.h>
9
+ #import <XDCommonSDK/XDGLogger.h>
10
+
11
+ NS_ASSUME_NONNULL_BEGIN
12
+
13
+ @interface XDGLogger (Payment)
14
+ + (void)paymentLog:(NSString *)content;
15
+
16
+ + (void)paymentLog:(NSString *)content secureContent:(NSString *_Nullable)secureContent;
17
+ @end
18
+
19
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: 8437866c3a996476299356af8ee34b32
3
+ DefaultImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
@@ -5,6 +5,6 @@
5
5
  // Created by Fattycat on 2023/4/14.
6
6
  //
7
7
 
8
- #define XDGPayment_VERSION @"7.1.2"
9
- #define XDSPayment_VERSION_CODE @"7001020"
10
- // HASH 5355bc04
8
+ #define XDGPayment_VERSION @"7.2.0"
9
+ #define XDSPayment_VERSION_CODE @"7020000"
10
+ // HASH 8d15387e
@@ -22,3 +22,4 @@ FOUNDATION_EXPORT const unsigned char XDPaymentSDKVersionString[];
22
22
  #import <XDPaymentSDK/XDGPaymentService.h>
23
23
  #import <XDPaymentSDK/XDGPaymentVersion.h>
24
24
  #import <XDPaymentSDK/XDGPaymentParams.h>
25
+ #import <XDPaymentSDK/XDGLogger+Payment.h>
@@ -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
  }
@@ -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();
@@ -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, "Payment 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.1.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.1.2"
9
+ "com.xd.sdk.common": "7.2.1-alpha"
10
10
  }
11
11
  }