com.xd.sdk.payment 6.22.3 → 6.23.0

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.
@@ -11,6 +11,11 @@ namespace XD.SDK.Payment{
11
11
  XDGPaymentMobileImpl.GetInstance().PayWithProduct(orderId, productId, roleId, serverId, ext, callback);
12
12
  }
13
13
 
14
+ public void PayWithParams(XDGPaymentParams paymentParams, Action<XDGOrderInfoWrapper> callback)
15
+ {
16
+ XDGPaymentMobileImpl.GetInstance().PayWithParams(paymentParams, callback);
17
+ }
18
+
14
19
  public static void PayWithWeb(
15
20
  string orderId,
16
21
  string productId,
@@ -4,6 +4,7 @@ using LC.Newtonsoft.Json;
4
4
  using TapTap.Common;
5
5
  using UnityEngine;
6
6
  using XD.SDK.Common;
7
+ using XD.SDK.Common.Internal;
7
8
 
8
9
  namespace XD.SDK.Payment{
9
10
  public class XDGPaymentMobileImpl{
@@ -48,6 +49,35 @@ namespace XD.SDK.Payment{
48
49
  callback(new XDGSkuDetailInfoMobile(result.content) as XDGSkuDetailInfo);
49
50
  });
50
51
  }
52
+
53
+ public void PayWithParams(XDGPaymentParams paymentParams, Action<XDGOrderInfoWrapper> callback)
54
+ {
55
+ var paramsDic = new Dictionary<string, object>{
56
+ {"gameOrderId", paymentParams.gameOrderId},
57
+ {"productId", paymentParams.productId},
58
+ {"roleId", paymentParams.roleId},
59
+ {"serverId", paymentParams.serverId},
60
+ {"ext", paymentParams.ext},
61
+ {"quantity", paymentParams.quantity}
62
+ };
63
+ var dic = new Dictionary<string, object>
64
+ {
65
+ {"params", paramsDic}
66
+ };
67
+
68
+ var command = new Command.Builder()
69
+ .Service(XDG_PAYMENT_SERVICE)
70
+ .Method("payWithParams")
71
+ .Args(dic)
72
+ .Callback(true)
73
+ .OnceTime(true)
74
+ .CommandBuilder();
75
+ EngineBridge.GetInstance().CallHandler(command,
76
+ (result) => {
77
+ XDGLogger.Debug("PayWithParams 方法结果: " + result.ToJSON());
78
+ callback(new XDGOrderInfoWrapperMobile(result.content) as XDGOrderInfoWrapper);
79
+ });
80
+ }
51
81
 
52
82
  public void PayWithProduct(string orderId, string productId, string roleId, string serverId, string ext,
53
83
  Action<XDGOrderInfoWrapper> callback){
@@ -5,6 +5,8 @@
5
5
 
6
6
  @class XDGOrderInfo;
7
7
 
8
+ @class XDGPaymentParams;
9
+
8
10
  #import <XDPaymentSDK/XDGTransactionInfo.h>
9
11
 
10
12
  NS_ASSUME_NONNULL_BEGIN
@@ -44,6 +46,11 @@ typedef void(^XDGRePaymentCallback)(XDGRepayMentCode code,NSString * _Nullable m
44
46
  /// @param completionHandler 查询结果处理
45
47
  + (void)queryWithProductIds:(NSArray *)productIds completionHandler:(XDGQueryProductsCallback)completionHandler;
46
48
 
49
+ /// 支付商品 (支持批量购买)
50
+ /// @param paymentParam 支付参数
51
+ /// @param completionHandler 支付结果回调
52
+ + (void)payWithParams:(XDGPaymentParams *)paymentParam completionHandler:(XDGPaymentCallback)completionHandler;
53
+
47
54
  /// 支付商品
48
55
  /// @param orderId 商品ID
49
56
  /// @param productId 商品ID
@@ -0,0 +1,25 @@
1
+ //
2
+ // XDGPaymentParams.h
3
+ // XDPaymentSDK
4
+ //
5
+ // Created by Fattycat on 2024/9/13.
6
+ //
7
+
8
+ #import <Foundation/Foundation.h>
9
+
10
+ NS_ASSUME_NONNULL_BEGIN
11
+
12
+ @interface XDGPaymentParams : NSObject
13
+
14
+ @property(nonatomic, strong, nullable) NSString *gameOrderId;
15
+ @property(nonatomic, strong) NSString *productId;
16
+ @property(nonatomic, strong, nullable) NSString *roleId;
17
+ @property(nonatomic, strong, nullable) NSString *serverId;
18
+ @property(nonatomic, strong, nullable) NSString *ext;
19
+ @property(nonatomic, assign) NSInteger quantity;
20
+
21
+ - (NSError *_Nullable)checkValid;
22
+
23
+ @end
24
+
25
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: 99b31cdab1e4b4b14b89b4dcd5003f5e
3
+ DefaultImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
@@ -10,9 +10,13 @@
10
10
  NS_ASSUME_NONNULL_BEGIN
11
11
 
12
12
  @interface XDGPaymentService : NSObject
13
+
13
14
  // 查询 queryWithProductIds :
14
15
  + (void)productIds:(NSArray *)productIds bridgeCallback:(void (^)(NSString *result))callback;
15
16
 
17
+ + (void)params:(NSDictionary *)params
18
+ bridgeCallback:(void (^)(NSString *result))callback;
19
+
16
20
  // 支付 payWithProduct
17
21
  + (void)orderId:(NSString *)orderId
18
22
  productId:(NSString *)productId
@@ -23,14 +27,13 @@ NS_ASSUME_NONNULL_BEGIN
23
27
 
24
28
  + (void)queryRestoredPurchases:(void (^)(NSString *result))callback;
25
29
 
26
- + (void)purchaseToken:(NSString *)purchaseToken
27
- productId:(NSString *)productId
28
- orderId:(NSString *)orderId
29
- roleId:(NSString *)roleId
30
- serverId:(NSString *)serverId
31
- ext:(NSString *)ext
32
- ext2:(NSString *)ext2
33
- bridgeCallback:(void (^)(NSString *result))callback;
30
+ + (void)transactionIdentifier:(NSString *)transactionIdentifier
31
+ productIdentifier:(NSString *)productIdentifier
32
+ orderId:(NSString *)orderId
33
+ roleId:(NSString *)roleId
34
+ serverId:(NSString *)serverId
35
+ ext:(NSString *)ext
36
+ bridgeCallback:(void (^)(NSString *result))callback;
34
37
 
35
38
  /// 不带界面的补款
36
39
  + (void)checkRefundStatus:(void (^)(NSString *result))callback;
@@ -5,5 +5,5 @@
5
5
  // Created by Fattycat on 2023/4/14.
6
6
  //
7
7
 
8
- #define XDGPayment_VERSION @"6.22.3"
9
- // HASH 8f76a97
8
+ #define XDGPayment_VERSION @"6.23.0"
9
+ // HASH 98afc55
@@ -21,3 +21,4 @@ FOUNDATION_EXPORT const unsigned char XDPaymentSDKVersionString[];
21
21
  #import <XDPaymentSDK/XDGOrderInfo.h>
22
22
  #import <XDPaymentSDK/XDGPaymentService.h>
23
23
  #import <XDPaymentSDK/XDGPaymentVersion.h>
24
+ #import <XDPaymentSDK/XDGPaymentParams.h>
@@ -5,6 +5,8 @@ namespace XD.SDK.Payment
5
5
  {
6
6
  public interface IXDGPayment
7
7
  {
8
+ void PayWithParams(XDGPaymentParams paymentParams, Action<XDGOrderInfoWrapper> callback);
9
+
8
10
  void PayWithProduct(string orderId, string productId, string roleId, string serverId, string ext,
9
11
  Action<XDGOrderInfoWrapper> callback);
10
12
 
@@ -26,6 +26,11 @@ namespace XD.SDK.Payment{
26
26
  TapLogger.Error($"No class implements {interfaceType} Type. Current Platform: {Application.platform}, if you are using Editor, please check if you have installed XDSDK pc module.");
27
27
  }
28
28
  }
29
+
30
+ public static void PayWithParams(XDGPaymentParams paymentParams, Action<XDGOrderInfoWrapper> callback)
31
+ {
32
+ platformWrapper.PayWithParams(paymentParams, callback);
33
+ }
29
34
 
30
35
  public static void PayWithProduct(string orderId, string productId, string roleId, string serverId, string ext,
31
36
  Action<XDGOrderInfoWrapper> callback){
@@ -0,0 +1,82 @@
1
+ using XD.SDK.Common.Internal;
2
+
3
+ namespace XD.SDK.Payment
4
+ {
5
+ public class XDGPaymentParams
6
+ {
7
+ /// <summary>
8
+ /// 游戏订单号
9
+ /// 可以为空,为空时 SDK 会自动生成
10
+ /// </summary>
11
+ public string gameOrderId;
12
+
13
+ /// <summary>
14
+ /// 商品ID
15
+ /// 不能为空
16
+ /// </summary>
17
+ public string productId;
18
+
19
+ /// <summary>
20
+ /// 角色 ID
21
+ /// 不建议为空
22
+ /// </summary>
23
+ public string roleId;
24
+
25
+ /// <summary>
26
+ /// 服务器 ID
27
+ /// 不建议为空
28
+ /// </summary>
29
+ public string serverId;
30
+
31
+ /// <summary>
32
+ /// 扩展字段
33
+ /// 可以为空,透传给游戏服务器
34
+ /// </summary>
35
+ public string ext;
36
+
37
+ /// <summary>
38
+ /// 数量
39
+ /// 只在 Apple 支付时有效,限制为 1-10,默认为 1
40
+ /// </summary>
41
+ public int quantity = 1;
42
+
43
+ public XDGPaymentParams()
44
+ {
45
+ }
46
+
47
+ public XDGPaymentParams(string gameOrderId, string productId, string roleId, string serverId, string ext)
48
+ {
49
+ this.gameOrderId = gameOrderId;
50
+ this.productId = productId;
51
+ this.roleId = roleId;
52
+ this.serverId = serverId;
53
+ this.ext = ext;
54
+ this.quantity = 1;
55
+ }
56
+
57
+ public XDGPaymentParams(string gameOrderId, string productId, string roleId, string serverId, string ext, int quantity)
58
+ {
59
+ this.gameOrderId = gameOrderId;
60
+ this.productId = productId;
61
+ this.roleId = roleId;
62
+ this.serverId = serverId;
63
+ this.ext = ext;
64
+ this.quantity = quantity;
65
+ }
66
+
67
+ public XDException CheckValid()
68
+ {
69
+ if (string.IsNullOrEmpty(productId))
70
+ {
71
+ return new XDException(XDException.InvalidParam, "productId can not be null or empty");
72
+ }
73
+
74
+ if (quantity < 1 || quantity > 10)
75
+ {
76
+ return new XDException(XDException.InvalidParam, "quantity must be between 1 and 10");
77
+ }
78
+
79
+ return null;
80
+ }
81
+ }
82
+ }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: 9c153b234f1241c89697066cab33f483
3
+ timeCreated: 1726805844
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "com.xd.sdk.payment",
3
3
  "displayName": "XDSDK Payment",
4
- "version": "6.22.3",
4
+ "version": "6.23.0",
5
5
  "description": "XDSDK",
6
6
  "unity": "2018.3",
7
7
  "license": "MIT",
8
8
  "dependencies": {
9
- "com.xd.tds.common": "3.27.1-xd.1"
9
+ "com.xd.tds.common": "3.29.4-xd.2"
10
10
  }
11
11
  }