com.xd.sdk.payment 0.0.1 → 0.0.11-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.
Files changed (113) hide show
  1. package/Plugins/Android/libs/XDGPaymentUPPay_7.0.0.aar +0 -0
  2. package/Plugins/Android/libs/{XDGPayment_6.21.1.aar.meta → XDGPaymentUPPay_7.0.0.aar.meta} +2 -2
  3. package/Plugins/Android/libs/XDGPayment_7.0.0.aar +0 -0
  4. package/Plugins/Android/libs/XDGPayment_7.0.0.aar.meta +32 -0
  5. package/Plugins/Android/libs.meta +1 -1
  6. package/Plugins/Android.meta +1 -1
  7. package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGOrderInfo.h +9 -9
  8. package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGOrderInfo.h.meta +1 -1
  9. package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGPayment.h +12 -57
  10. package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGPayment.h.meta +1 -1
  11. package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGPaymentDefines.h +49 -0
  12. package/{README.md.meta → Plugins/iOS/XDPaymentSDK.framework/Headers/XDGPaymentDefines.h.meta} +2 -2
  13. package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGPaymentParams.h +43 -0
  14. package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGPaymentParams.h.meta +7 -0
  15. package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGPaymentService.h +11 -8
  16. package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGPaymentService.h.meta +1 -1
  17. package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGPaymentVersion.h +3 -2
  18. package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGPaymentVersion.h.meta +1 -1
  19. package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGPendingPurchase.h +18 -0
  20. package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGPendingPurchase.h.meta +7 -0
  21. package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGProductInfo.h +29 -2
  22. package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGProductInfo.h.meta +1 -1
  23. package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGTransactionInfo.h +7 -3
  24. package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGTransactionInfo.h.meta +1 -1
  25. package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDPaymentSDK.h +2 -1
  26. package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDPaymentSDK.h.meta +1 -1
  27. package/Plugins/iOS/XDPaymentSDK.framework/Headers.meta +1 -1
  28. package/Plugins/iOS/XDPaymentSDK.framework/Info.plist +0 -0
  29. package/Plugins/iOS/XDPaymentSDK.framework/Info.plist.meta +1 -1
  30. package/Plugins/iOS/XDPaymentSDK.framework/Modules/module.modulemap.meta +1 -1
  31. package/Plugins/iOS/XDPaymentSDK.framework/Modules.meta +1 -1
  32. package/Plugins/iOS/XDPaymentSDK.framework/XDPaymentSDK +0 -0
  33. package/Plugins/iOS/XDPaymentSDK.framework/XDPaymentSDK.meta +1 -1
  34. package/Plugins/iOS/XDPaymentSDK.framework.meta +56 -3
  35. package/Plugins/iOS.meta +1 -1
  36. package/Plugins.meta +1 -1
  37. package/{Mobile → Runtime/Internal/Mobile}/PaymentConstants.cs +5 -8
  38. package/{Mobile/Editor/XDPaymentMobileProcessBuild.cs.meta → Runtime/Internal/Mobile/PaymentConstants.cs.meta} +1 -1
  39. package/Runtime/Internal/Mobile/PaymentFeaturesImpl.cs +185 -0
  40. package/{Editor/XDGAndroidPaymentProcessor.cs.meta → Runtime/Internal/Mobile/PaymentFeaturesImpl.cs.meta} +1 -1
  41. package/Runtime/Internal/Mobile/XDGRestoredPurchasesWrapper.cs +23 -0
  42. package/{Mobile → Runtime/Internal/Mobile}/XDGRestoredPurchasesWrapper.cs.meta +1 -1
  43. package/{Mobile.meta → Runtime/Internal/Mobile.meta} +1 -1
  44. package/Runtime/Internal/Standalone/AliyunTrack.Payment.cs +156 -0
  45. package/{Mobile/XDGDataBean.cs.meta → Runtime/Internal/Standalone/AliyunTrack.Payment.cs.meta} +1 -1
  46. package/Runtime/Internal/Standalone/Bean/PayCheckResponse.cs +19 -0
  47. package/{Editor/XDPaymentProcessBuild.cs.meta → Runtime/Internal/Standalone/Bean/PayCheckResponse.cs.meta} +1 -1
  48. package/Runtime/Internal/Standalone/Bean/PayInfo.cs +31 -0
  49. package/Runtime/Internal/Standalone/Bean/PayInfo.cs.meta +11 -0
  50. package/Runtime/Internal/Standalone/Bean/QueryProductsResponse.cs +46 -0
  51. package/Runtime/Internal/Standalone/Bean/QueryProductsResponse.cs.meta +11 -0
  52. package/Runtime/Internal/Standalone/Bean/XDGRefundResultWrapper.cs +19 -0
  53. package/Runtime/Internal/Standalone/Bean/XDGRefundResultWrapper.cs.meta +11 -0
  54. package/{Editor/XD.SDK.Payment.Editor.asmdef.meta → Runtime/Internal/Standalone/Bean.meta} +3 -2
  55. package/Runtime/Internal/Standalone/PayListener.cs +83 -0
  56. package/Runtime/Internal/Standalone/PayListener.cs.meta +11 -0
  57. package/Runtime/Internal/Standalone/PayModule.cs +261 -0
  58. package/Runtime/Internal/Standalone/PayModule.cs.meta +11 -0
  59. package/Runtime/Internal/Standalone/PaymentAlert.cs +112 -0
  60. package/Runtime/Internal/Standalone/PaymentAlert.cs.meta +11 -0
  61. package/Runtime/Internal/Standalone/PaymentFeaturesImpl.cs +238 -0
  62. package/Runtime/Internal/Standalone/PaymentFeaturesImpl.cs.meta +11 -0
  63. package/{Mobile/Editor.meta → Runtime/Internal/Standalone.meta} +1 -1
  64. package/Runtime/Internal/XDGPaymentInternal.cs +46 -0
  65. package/Runtime/Internal/XDGPaymentInternal.cs.meta +11 -0
  66. package/Runtime/{XDGRefundDetails.cs → Internal/XDGRefundDetails.cs} +3 -5
  67. package/Runtime/Internal/XDGRefundDetails.cs.meta +11 -0
  68. package/Runtime/{XDGRefundResultWrapper.cs → Internal/XDGRefundResultWrapper.cs} +1 -1
  69. package/Runtime/Internal/XDGRefundResultWrapper.cs.meta +11 -0
  70. package/{Editor.meta → Runtime/Internal.meta} +1 -1
  71. package/Runtime/Public/XDGPayment.Deprecated.cs +231 -0
  72. package/Runtime/Public/XDGPayment.Deprecated.cs.meta +11 -0
  73. package/Runtime/Public/XDGPayment.cs +97 -0
  74. package/Runtime/Public/XDGPayment.cs.meta +11 -0
  75. package/Runtime/Public/XDGPaymentEventHandler.cs +34 -0
  76. package/Runtime/Public/XDGPaymentEventHandler.cs.meta +3 -0
  77. package/Runtime/Public.meta +8 -0
  78. package/Runtime/XD.SDK.Payment.asmdef +5 -2
  79. package/Runtime/XD.SDK.Payment.asmdef.meta +6 -2
  80. package/Runtime.meta +7 -2
  81. package/package.json +5 -5
  82. package/package.json.meta +2 -2
  83. package/Editor/XD.SDK.Payment.Editor.asmdef +0 -19
  84. package/Editor/XDGAndroidPaymentProcessor.cs +0 -44
  85. package/Editor/XDPaymentProcessBuild.cs +0 -18
  86. package/Mobile/Editor/XD.SDK.Payment.Mobile.Editor.asmdef +0 -20
  87. package/Mobile/Editor/XD.SDK.Payment.Mobile.Editor.asmdef.meta +0 -7
  88. package/Mobile/Editor/XDPaymentMobileProcessBuild.cs +0 -20
  89. package/Mobile/PaymentConstants.cs.meta +0 -3
  90. package/Mobile/XD.SDK.Payment.Mobile.asmdef +0 -22
  91. package/Mobile/XD.SDK.Payment.Mobile.asmdef.meta +0 -7
  92. package/Mobile/XDGDataBean.cs +0 -242
  93. package/Mobile/XDGPaymentDetailsParam.cs +0 -127
  94. package/Mobile/XDGPaymentDetailsParam.cs.meta +0 -3
  95. package/Mobile/XDGPaymentMobile.cs +0 -132
  96. package/Mobile/XDGPaymentMobile.cs.meta +0 -11
  97. package/Mobile/XDGPaymentMobileImpl.cs +0 -331
  98. package/Mobile/XDGPaymentMobileImpl.cs.meta +0 -11
  99. package/Mobile/XDGRestoredPurchasesWrapper.cs +0 -42
  100. package/Plugins/Android/libs/XDGPayment_6.21.1.aar +0 -0
  101. package/README.md +0 -0
  102. package/Runtime/IXDGPayment.cs +0 -38
  103. package/Runtime/IXDGPayment.cs.meta +0 -3
  104. package/Runtime/WebPayResultType.cs +0 -8
  105. package/Runtime/WebPayResultType.cs.meta +0 -3
  106. package/Runtime/XDGPayType.cs +0 -8
  107. package/Runtime/XDGPayType.cs.meta +0 -3
  108. package/Runtime/XDGPayment.cs +0 -101
  109. package/Runtime/XDGPayment.cs.meta +0 -3
  110. package/Runtime/XDGRefundDetails.cs.meta +0 -3
  111. package/Runtime/XDGRefundResultWrapper.cs.meta +0 -3
  112. package/Runtime/XDGSkuDetailInfo.cs +0 -252
  113. package/Runtime/XDGSkuDetailInfo.cs.meta +0 -3
@@ -1,127 +0,0 @@
1
- namespace XD.SDK.Payment
2
- {
3
- [System.Serializable]
4
- public class XDGPaymentDetailsParam
5
- {
6
- public string orderId;
7
- public string productId;
8
- public string productName;
9
- public double payAmount;
10
- public string roleId;
11
- public string serverId;
12
- public string ext;
13
-
14
- private XDGPaymentDetailsParam(Builder builder) {
15
- orderId = builder.orderId;
16
- productId = builder.productId;
17
- productName = builder.productName;
18
- payAmount = builder.payAmount;
19
- roleId = builder.roleId;
20
- serverId = builder.serverId;
21
- ext = builder.ext;
22
- }
23
-
24
- public static Builder newBuilder() {
25
- return new Builder();
26
- }
27
-
28
- public class Builder {
29
- internal string orderId;
30
- internal string productId;
31
- internal string productName;
32
- internal double payAmount;
33
- internal string roleId;
34
- internal string serverId;
35
- internal string ext;
36
-
37
- internal Builder() {
38
- }
39
-
40
- /**
41
- * Sets the {@code orderId} and returns a reference to this Builder enabling method chaining.
42
- *
43
- * @param orderId the {@code orderId} to set
44
- * @return a reference to this Builder
45
- */
46
- public Builder SetOrderId(string orderId) {
47
- this.orderId = orderId;
48
- return this;
49
- }
50
-
51
- /**
52
- * Sets the {@code productId} and returns a reference to this Builder enabling method chaining.
53
- *
54
- * @param productId the {@code productId} to set
55
- * @return a reference to this Builder
56
- */
57
- public Builder SetProductId(string productId) {
58
- this.productId = productId;
59
- return this;
60
- }
61
-
62
- /**
63
- * Sets the {@code productName} and returns a reference to this Builder enabling method chaining.
64
- *
65
- * @param productName the {@code productName} to set
66
- * @return a reference to this Builder
67
- */
68
- public Builder SetProductName(string productName) {
69
- this.productName = productName;
70
- return this;
71
- }
72
-
73
- /**
74
- * Sets the {@code payAmount} and returns a reference to this Builder enabling method chaining.
75
- *
76
- * @param payAmount the {@code payAmount} to set
77
- * @return a reference to this Builder
78
- */
79
- public Builder SetPayAmount(double payAmount) {
80
- this.payAmount = payAmount;
81
- return this;
82
- }
83
-
84
- /**
85
- * Sets the {@code roleId} and returns a reference to this Builder enabling method chaining.
86
- *
87
- * @param roleId the {@code roleId} to set
88
- * @return a reference to this Builder
89
- */
90
- public Builder SetRoleId(string roleId) {
91
- this.roleId = roleId;
92
- return this;
93
- }
94
-
95
- /**
96
- * Sets the {@code serverId} and returns a reference to this Builder enabling method chaining.
97
- *
98
- * @param serverId the {@code serverId} to set
99
- * @return a reference to this Builder
100
- */
101
- public Builder SetServerId(string serverId) {
102
- this.serverId = serverId;
103
- return this;
104
- }
105
-
106
- /**
107
- * Sets the {@code ext} and returns a reference to this Builder enabling method chaining.
108
- *
109
- * @param ext the {@code ext} to set
110
- * @return a reference to this Builder
111
- */
112
- public Builder SetExt(string ext) {
113
- this.ext = ext;
114
- return this;
115
- }
116
-
117
- /**
118
- * Returns a {@code PayDetailsParams} built from the parameters previously set.
119
- *
120
- * @return a {@code PayDetailsParams} built with parameters of this {@code PayDetailsParams.Builder}
121
- */
122
- public XDGPaymentDetailsParam Build() {
123
- return new XDGPaymentDetailsParam(this);
124
- }
125
- }
126
- }
127
- }
@@ -1,3 +0,0 @@
1
- fileFormatVersion: 2
2
- guid: 8929ecbad39f4b7fac31ea6a7f760331
3
- timeCreated: 1679371809
@@ -1,132 +0,0 @@
1
- #if (UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR
2
- using System;
3
- using System.Collections.Generic;
4
- using XD.SDK.Common;
5
- using XD.SDK.Payment;
6
-
7
- namespace XD.SDK.Payment{
8
- public class XDGPaymentMobile : IXDGPayment{
9
- public static void PayWithProduct(string orderId, string productId, string roleId, string serverId, string ext,
10
- Action<XDGOrderInfoWrapper> callback){
11
- XDGPaymentMobileImpl.GetInstance().PayWithProduct(orderId, productId, roleId, serverId, ext, callback);
12
- }
13
-
14
- public static void PayWithWeb(
15
- string orderId,
16
- string productId,
17
- string productName,
18
- double payAmount,
19
- string roleId,
20
- string serverId,
21
- string extras,
22
- Action<WebPayResultType, string> callback){
23
- XDGPaymentMobileImpl.GetInstance().PayWithWeb(orderId, productId, productName, payAmount, roleId, serverId, extras, callback);
24
- }
25
-
26
- public static void QueryWithProductIds(string[] productIds, Action<XDGSkuDetailInfo> callback){
27
- XDGPaymentMobileImpl.GetInstance().QueryWithProductIds(productIds, callback);
28
- }
29
-
30
- public static void QueryRestoredPurchase(Action<List<XDGRestoredPurchase>> callback){
31
- XDGPaymentMobileImpl.GetInstance().QueryRestoredPurchase(callback);
32
- }
33
-
34
- public static void RestorePurchase(string purchaseToken, string orderId, string productId, string roleId,
35
- string serverId, string ext, Action<XDGOrderInfoWrapper> callback){
36
- XDGPaymentMobileImpl.GetInstance()
37
- .RestorePurchase(purchaseToken, orderId, productId, roleId, serverId, ext, callback);
38
- }
39
-
40
- public static void CheckRefundStatus(Action<XDGRefundResultWrapper> callback){
41
- XDGPaymentMobileImpl.GetInstance().CheckRefundStatus(callback);
42
- }
43
-
44
- public static void CheckRefundStatusWithUI(Action<XDGRefundResultWrapper> callback){
45
- XDGPaymentMobileImpl.GetInstance().CheckRefundStatusWithUI(callback);
46
- }
47
-
48
- /// <summary>
49
- /// 微信支付和支付宝支付的原生实现,带 UI 方式
50
- /// </summary>
51
- /// <param name="orderId">游戏订单 ID,可为空,为空时采用随机字符串 ID 作为游戏 ID</param>
52
- /// <param name="productId">游戏商品 ID,不可为空</param>
53
- /// <param name="productName">游戏商品名称,使用 SDK 自带 UI 方式进行支付时作为弹窗预显示的游戏名称,可为空</param>
54
- /// <param name="payAmount">商品价格,单位(元),使用 SDK 自带 UI 方式进行支付时作为弹窗预显示的商品价格,可为 0</param>
55
- /// <param name="roleId">游戏角色 ID,支付角色 ID,服务端支付回调会包含该字段</param>
56
- /// <param name="serverId">游戏服务器 ID,所在服务器 ID,不能有特殊字符,服务端支付回调会包含该字段</param>
57
- /// <param name="ext">附加信息。服务端支付回调会包含该字段</param>
58
- public static void PayWithUI(string orderId, string productId, string productName, double payAmount,
59
- string roleId, string serverId, string ext, Action<XDGOrderInfoWrapper> callback)
60
- {
61
- XDGPaymentMobileImpl.GetInstance().PayWithUI(orderId, productId, productName, payAmount, roleId, serverId, ext, callback);
62
- }
63
-
64
- /// <summary>
65
- /// 微信支付和支付宝支付的原生实现,不带 UI 方式
66
- /// </summary>
67
- /// <param name="orderId">游戏订单 ID,可为空,为空时采用随机字符串 ID 作为游戏 ID</param>
68
- /// <param name="productId">游戏商品 ID,不可为空</param>
69
- /// <param name="productName">游戏商品名称,使用 SDK 自带 UI 方式进行支付时作为弹窗预显示的游戏名称,可为空</param>
70
- /// <param name="payAmount">商品价格,单位(元),使用 SDK 自带 UI 方式进行支付时作为弹窗预显示的商品价格,可为 0</param>
71
- /// <param name="roleId">游戏角色 ID,支付角色 ID,服务端支付回调会包含该字段</param>
72
- /// <param name="serverId">游戏服务器 ID,所在服务器 ID,不能有特殊字符,服务端支付回调会包含该字段</param>
73
- /// <param name="ext">附加信息。服务端支付回调会包含该字段</param>
74
- public static void Pay(PayType payType, string orderId, string productId, string productName, double payAmount,
75
- string roleId, string serverId, string ext, Action<XDGOrderInfoWrapper> callback)
76
- {
77
- XDGPaymentMobileImpl.GetInstance().Pay(payType, orderId, productId, productName, payAmount, roleId, serverId, ext, callback);
78
- }
79
-
80
- #region Interface
81
- void IXDGPayment.PayWithProduct(string orderId, string productId, string roleId, string serverId, string ext, Action<XDGOrderInfoWrapper> callback)
82
- {
83
- PayWithProduct(orderId, productId, roleId, serverId, ext, callback);
84
- }
85
-
86
- void IXDGPayment.PayWithWeb(string orderId, string productId, string productName, double payAmount, string roleId, string serverId,
87
- string extras, Action<WebPayResultType, string> callback)
88
- {
89
- PayWithWeb(orderId, productId, productName, payAmount, roleId, serverId, extras, callback);
90
- }
91
-
92
- void IXDGPayment.QueryWithProductIds(string[] productIds, Action<XDGSkuDetailInfo> callback)
93
- {
94
- QueryWithProductIds(productIds, callback);
95
- }
96
-
97
- void IXDGPayment.QueryRestoredPurchase(Action<List<XDGRestoredPurchase>> callback)
98
- {
99
- QueryRestoredPurchase(callback);
100
- }
101
-
102
- void IXDGPayment.RestorePurchase(string purchaseToken, string orderId, string productId, string roleId, string serverId, string ext,
103
- Action<XDGOrderInfoWrapper> callback)
104
- {
105
- RestorePurchase(purchaseToken, orderId, productId, roleId, serverId, ext, callback);
106
- }
107
-
108
- void IXDGPayment.CheckRefundStatus(Action<XDGRefundResultWrapper> callback)
109
- {
110
- CheckRefundStatus(callback);
111
- }
112
-
113
- void IXDGPayment.CheckRefundStatusWithUI(Action<XDGRefundResultWrapper> callback)
114
- {
115
- CheckRefundStatusWithUI(callback);
116
- }
117
-
118
- void IXDGPayment.PayWithUI(string orderId, string productId, string productName, double payAmount,
119
- string roleId, string serverId, string ext, Action<XDGOrderInfoWrapper> callback)
120
- {
121
- PayWithUI(orderId, productId, productName, payAmount, roleId, serverId, ext, callback);
122
- }
123
-
124
- void IXDGPayment.Pay(PayType payType, string orderId, string productId, string productName, double payAmount,
125
- string roleId, string serverId, string ext, Action<XDGOrderInfoWrapper> callback)
126
- {
127
- Pay(payType, orderId, productId, productName, payAmount, roleId, serverId, ext, callback);
128
- }
129
- #endregion
130
- }
131
- }
132
- #endif
@@ -1,11 +0,0 @@
1
- fileFormatVersion: 2
2
- guid: 583556303a5da486cbb5ea7701e2a817
3
- MonoImporter:
4
- externalObjects: {}
5
- serializedVersion: 2
6
- defaultReferences: []
7
- executionOrder: 0
8
- icon: {instanceID: 0}
9
- userData:
10
- assetBundleName:
11
- assetBundleVariant:
@@ -1,331 +0,0 @@
1
- using System;
2
- using System.Collections.Generic;
3
- using LC.Newtonsoft.Json;
4
- using TapTap.Common;
5
- using UnityEngine;
6
- using XD.SDK.Common;
7
-
8
- namespace XD.SDK.Payment{
9
- public class XDGPaymentMobileImpl{
10
- //Payment
11
- private static string PAYMENT_SERVICE_NAME = "com.xd.intl.payment.unityBridge.XDGPaymentService";
12
- private static string PAYMENT_SERVICE_IMPL = "com.xd.intl.payment.unityBridge.XDGPaymentServiceImpl";
13
- private readonly string XDG_PAYMENT_SERVICE = "XDGPaymentService"; //注意要和iOS本地桥接类名一样
14
-
15
- private XDGPaymentMobileImpl(){
16
- EngineBridge.GetInstance()
17
- .Register(PAYMENT_SERVICE_NAME, PAYMENT_SERVICE_IMPL);
18
- }
19
-
20
- private static volatile XDGPaymentMobileImpl _instance;
21
- private static readonly object Locker = new object();
22
-
23
- public static XDGPaymentMobileImpl GetInstance(){
24
- lock (Locker){
25
- if (_instance == null){
26
- _instance = new XDGPaymentMobileImpl();
27
- }
28
- }
29
-
30
- return _instance;
31
- }
32
-
33
- public void QueryWithProductIds(string[] productIds, Action<XDGSkuDetailInfo> callback){
34
- var dic = new Dictionary<string, object>{
35
- {"productIds", productIds}
36
- };
37
-
38
- var command = new Command.Builder()
39
- .Service(XDG_PAYMENT_SERVICE)
40
- .Method("queryWithProductIds")
41
- .Args(dic)
42
- .Callback(true)
43
- .OnceTime(true)
44
- .CommandBuilder();
45
-
46
- EngineBridge.GetInstance().CallHandler(command, result => {
47
- XDGLogger.Debug("queryWithProductIds 方法结果: " + result.ToJSON());
48
- callback(new XDGSkuDetailInfoMobile(result.content) as XDGSkuDetailInfo);
49
- });
50
- }
51
-
52
- public void PayWithProduct(string orderId, string productId, string roleId, string serverId, string ext,
53
- Action<XDGOrderInfoWrapper> callback){
54
-
55
- var oid = orderId;
56
- if (string.IsNullOrEmpty(oid)){
57
- oid = XDGTool.GetRandomStr(12) + new DateTimeOffset(DateTime.UtcNow).ToUnixTimeMilliseconds() + "";
58
- }
59
-
60
- var dic = new Dictionary<string, object>{
61
- {"orderId", oid},
62
- {"productId", productId},
63
- {"roleId", roleId},
64
- {"serverId", serverId},
65
- {"ext", ext}
66
- };
67
-
68
- var command = new Command.Builder()
69
- .Service(XDG_PAYMENT_SERVICE)
70
- .Method("payWithProduct")
71
- .Args(dic)
72
- .Callback(true)
73
- .OnceTime(true)
74
- .CommandBuilder();
75
-
76
- EngineBridge.GetInstance().CallHandler(command,
77
- (result) => {
78
- XDGLogger.Debug("PayWithProduct 方法结果: " + result.ToJSON());
79
-
80
- callback(new XDGOrderInfoWrapperMobile(result.content) as XDGOrderInfoWrapper);
81
- });
82
- }
83
-
84
- public void PayWithWeb(
85
- string orderId,
86
- string productId,
87
- string productName,
88
- double payAmount,
89
- string roleId,
90
- string serverId,
91
- string extras,
92
- Action<WebPayResultType, string> callback){
93
-
94
- var oid = orderId;
95
- if (string.IsNullOrEmpty(oid)){
96
- oid = XDGTool.GetRandomStr(12) + new DateTimeOffset(DateTime.UtcNow).ToUnixTimeMilliseconds() + "";
97
- }
98
-
99
- var dic = new Dictionary<string, object>{
100
- {"orderId", oid},
101
- {"productId", productId},
102
- {"productName", productName},
103
- {"payAmount", payAmount},
104
- {"roleId", roleId},
105
- {"serverId", serverId},
106
- {"extras", extras},
107
- };
108
- XDGLogger.Debug("PayWithWeb 参数: " + JsonConvert.SerializeObject(dic));
109
-
110
- var command = new Command.Builder()
111
- .Service(XDG_PAYMENT_SERVICE)
112
- .Method("payWithWeb")
113
- .Args(dic)
114
- .Callback(true)
115
- .OnceTime(true)
116
- .CommandBuilder();
117
-
118
- EngineBridge.GetInstance()
119
- .CallHandler(command, result => {
120
- XDGLogger.Debug("PayWithWeb 方法结果: " + result.ToJSON());
121
-
122
- if (XDGTool.checkResultSuccess(result)){
123
- Dictionary<string, object> resultDic =
124
- Json.Deserialize(result.content) as Dictionary<string, object>;
125
- var code = SafeDictionary.GetValue<int>(resultDic, "code");
126
- var message = SafeDictionary.GetValue<string>(resultDic, "message");
127
-
128
- if (code == 0){
129
- callback(WebPayResultType.OK, "支付完成");
130
- } else if (code == 1){
131
- callback(WebPayResultType.Cancel, "支付取消");
132
- } else if (code == 2){
133
- callback(WebPayResultType.Processing, "支付处理中");
134
- } else{
135
- callback(WebPayResultType.Error, message);
136
- XDGLogger.Warn($"安卓网页支付失败, 参数:{JsonConvert.SerializeObject(dic)} 结果:{result.ToJSON()}");
137
- }
138
- } else{
139
- callback(WebPayResultType.Error, "支付结果解析失败");
140
- XDGLogger.Warn($"支付结果解析失败, 参数:{JsonConvert.SerializeObject(dic)} 结果:{result.ToJSON()}");
141
- }
142
- });
143
- }
144
-
145
- public void QueryRestoredPurchase(Action<List<XDGRestoredPurchase>> callback){
146
- var command = new Command.Builder()
147
- .Service(XDG_PAYMENT_SERVICE)
148
- .Method("queryRestoredPurchases")
149
- .Callback(true)
150
- .OnceTime(true)
151
- .CommandBuilder();
152
- EngineBridge.GetInstance().CallHandler(command,
153
- (result) => {
154
- XDGLogger.Debug("QueryRestoredPurchase 方法结果: " + result.ToJSON());
155
-
156
- if (!XDGTool.checkResultSuccess(result)){
157
- callback(null);
158
- return;
159
- }
160
-
161
- callback(new XDGRestoredPurchaseWrapper(result.content).transactionList);
162
- });
163
- }
164
-
165
- public void RestorePurchase(string purchaseToken, string orderId, string productId, string roleId,
166
- string serverId, string ext, Action<XDGOrderInfoWrapper> callback){
167
-
168
- var oid = orderId;
169
- if (string.IsNullOrEmpty(oid)){
170
- oid = XDGTool.GetRandomStr(12) + new DateTimeOffset(DateTime.UtcNow).ToUnixTimeMilliseconds() + "";
171
- }
172
-
173
- var dic = new Dictionary<string, object>{
174
- #if UNITY_IOS
175
- {"transactionIdentifier", purchaseToken},
176
- {"productIdentifier", productId},
177
- #elif UNITY_ANDROID
178
- {"purchaseToken", purchaseToken},
179
- {"productId", productId},
180
- #endif
181
- {"orderId", oid},
182
- {"roleId", roleId},
183
- {"serverId", serverId},
184
- {"ext", ext}
185
- };
186
- var command = new Command.Builder()
187
- .Service(XDG_PAYMENT_SERVICE)
188
- .Method("restorePurchase")
189
- .Args(dic)
190
- .Callback(true)
191
- .OnceTime(true)
192
- .CommandBuilder();
193
-
194
- EngineBridge.GetInstance().CallHandler(command, (result) => {
195
- XDGLogger.Debug("RestorePurchase 方法结果: " + result.ToJSON());
196
- callback(new XDGOrderInfoWrapperMobile(result.content) as XDGOrderInfoWrapper);
197
- });
198
- }
199
-
200
- public void CheckRefundStatus(Action<XDGRefundResultWrapperMobile> callback){
201
- var command = new Command.Builder()
202
- .Service(XDG_PAYMENT_SERVICE)
203
- .Method("checkRefundStatus")
204
- .Callback(true)
205
- .OnceTime(true)
206
- .CommandBuilder();
207
-
208
- EngineBridge.GetInstance().CallHandler(command, (result) => {
209
- XDGLogger.Debug("CheckRefundStatus result: " + result.ToJSON());
210
- callback(new XDGRefundResultWrapperMobile(result.content));
211
- });
212
- }
213
-
214
- public void CheckRefundStatusWithUI(Action<XDGRefundResultWrapperMobile> callback){
215
- var command = new Command.Builder()
216
- .Service(XDG_PAYMENT_SERVICE)
217
- .Method("checkRefundStatusWithUI")
218
- .Callback(true)
219
- .OnceTime(true)
220
- .CommandBuilder();
221
-
222
- EngineBridge.GetInstance().CallHandler(command,
223
- result => {
224
- XDGLogger.Debug("CheckRefundStatusWithUI result: " + result.ToJSON());
225
- callback(new XDGRefundResultWrapperMobile(result.content));
226
- });
227
- }
228
-
229
- /// <summary>
230
- /// 微信支付和支付宝支付的原生实现,带 UI 方式
231
- /// </summary>
232
- /// <param name="orderId">游戏订单 ID,可为空,为空时采用随机字符串 ID 作为游戏 ID</param>
233
- /// <param name="productId">游戏商品 ID,不可为空</param>
234
- /// <param name="productName">游戏商品名称,使用 SDK 自带 UI 方式进行支付时作为弹窗预显示的游戏名称,可为空</param>
235
- /// <param name="payAmount">商品价格,单位(元),使用 SDK 自带 UI 方式进行支付时作为弹窗预显示的商品价格,可为 0</param>
236
- /// <param name="roleId">游戏角色 ID,支付角色 ID,服务端支付回调会包含该字段</param>
237
- /// <param name="serverId">游戏服务器 ID,所在服务器 ID,不能有特殊字符,服务端支付回调会包含该字段</param>
238
- /// <param name="ext">附加信息。服务端支付回调会包含该字段</param>
239
- public void PayWithUI(string orderId, string productId, string productName, double payAmount,
240
- string roleId, string serverId, string ext, Action<XDGOrderInfoWrapper> callback)
241
- {
242
- var oid = orderId;
243
- if (string.IsNullOrEmpty(oid)){
244
- oid = XDGTool.GetRandomStr(12) + new DateTimeOffset(DateTime.UtcNow).ToUnixTimeMilliseconds() + "";
245
- }
246
-
247
- var dic = new Dictionary<string, object>{
248
- {"orderId", oid ?? ""},
249
- {"productId", productId ?? ""},
250
- {"productName", productName ?? ""},
251
- {"payAmount", payAmount},
252
- {"roleId", roleId ?? ""},
253
- {"serverId", serverId ?? ""},
254
- {"ext", ext ?? ""}
255
- };
256
-
257
- XDGLogger.Debug("PayWithUI 参数: " + JsonConvert.SerializeObject(dic));
258
-
259
- var command = new Command.Builder()
260
- .Service(XDG_PAYMENT_SERVICE)
261
- .Method("payWithUI")
262
- .Args(dic)
263
- .Callback(true)
264
- .OnceTime(true)
265
- .CommandBuilder();
266
-
267
- EngineBridge.GetInstance().CallHandler(command,
268
- (result) => {
269
- XDGLogger.Debug("PayWithUI 方法结果: " + result.ToJSON());
270
- callback(new XDGOrderInfoWrapperMobile(result.content) as XDGOrderInfoWrapper);
271
- });
272
- }
273
-
274
- /// <summary>
275
- /// 微信支付和支付宝支付的原生实现,不带 UI 方式
276
- /// </summary>
277
- /// <param name="orderId">游戏订单 ID,可为空,为空时采用随机字符串 ID 作为游戏 ID</param>
278
- /// <param name="productId">游戏商品 ID,不可为空</param>
279
- /// <param name="productName">游戏商品名称,使用 SDK 自带 UI 方式进行支付时作为弹窗预显示的游戏名称,可为空</param>
280
- /// <param name="payAmount">商品价格,单位(元),使用 SDK 自带 UI 方式进行支付时作为弹窗预显示的商品价格,可为 0</param>
281
- /// <param name="roleId">游戏角色 ID,支付角色 ID,服务端支付回调会包含该字段</param>
282
- /// <param name="serverId">游戏服务器 ID,所在服务器 ID,不能有特殊字符,服务端支付回调会包含该字段</param>
283
- /// <param name="ext">附加信息。服务端支付回调会包含该字段</param>
284
- public void Pay(PayType payType, string orderId, string productId, string productName, double payAmount,
285
- string roleId, string serverId, string ext, Action<XDGOrderInfoWrapper> callback)
286
- {
287
- var oid = orderId;
288
- if (string.IsNullOrEmpty(oid)){
289
- oid = XDGTool.GetRandomStr(12) + new DateTimeOffset(DateTime.UtcNow).ToUnixTimeMilliseconds() + "";
290
- }
291
-
292
- string payTypeString = null;
293
- switch (payType)
294
- {
295
- case PayType.Alipay:
296
- payTypeString = PaymentConstants.PayTypeInternal.ALIPAY;
297
- break;
298
- case PayType.WechatPay:
299
- payTypeString = PaymentConstants.PayTypeInternal.WECHAT_PAY;
300
- break;
301
- }
302
-
303
- var dic = new Dictionary<string, object>{
304
- {"payType", payTypeString},
305
- {"orderId", oid ?? ""},
306
- {"productId", productId ?? ""},
307
- {"productName", productName ?? ""},
308
- {"payAmount", payAmount},
309
- {"roleId", roleId ?? ""},
310
- {"serverId", serverId ?? ""},
311
- {"ext", ext ?? ""}
312
- };
313
- XDGLogger.Debug("Pay 参数: " + JsonConvert.SerializeObject(dic));
314
-
315
- var command = new Command.Builder()
316
- .Service(XDG_PAYMENT_SERVICE)
317
- .Method("pay")
318
- .Args(dic)
319
- .Callback(true)
320
- .OnceTime(true)
321
- .CommandBuilder();
322
-
323
- EngineBridge.GetInstance().CallHandler(command,
324
- (result) => {
325
- XDGLogger.Debug("Pay 方法结果: " + result.ToJSON());
326
-
327
- callback(new XDGOrderInfoWrapperMobile(result.content) as XDGOrderInfoWrapper);
328
- });
329
- }
330
- }
331
- }
@@ -1,11 +0,0 @@
1
- fileFormatVersion: 2
2
- guid: fc65119ecb9d44e4f90fdedb09493215
3
- MonoImporter:
4
- externalObjects: {}
5
- serializedVersion: 2
6
- defaultReferences: []
7
- executionOrder: 0
8
- icon: {instanceID: 0}
9
- userData:
10
- assetBundleName:
11
- assetBundleVariant:
@@ -1,42 +0,0 @@
1
- using System;
2
- using System.Collections.Generic;
3
- using TapTap.Common;
4
-
5
- namespace XD.SDK.Payment
6
- {
7
- [Serializable]
8
- public class XDGRestoredPurchasesWrapper
9
- {
10
- public List<XDGRestoredPurchases> restoredPurchasesList;
11
-
12
- public XDGRestoredPurchasesWrapper(string json)
13
- {
14
- Dictionary<string,object> dic = Json.Deserialize(json) as Dictionary<string,object>;
15
- List<object> dicList = SafeDictionary.GetValue<List<object>>(dic,"transactions");
16
-
17
- if (dicList != null)
18
- {
19
- this.restoredPurchasesList = new List<XDGRestoredPurchases>();
20
- foreach (var detailDic in dicList)
21
- {
22
- Dictionary<string,object> innerDic = detailDic as Dictionary<string,object>;
23
- restoredPurchasesList.Add(new XDGRestoredPurchases(innerDic));
24
- }
25
- }
26
- }
27
- }
28
-
29
- [Serializable]
30
- public class XDGRestoredPurchases
31
- {
32
- public string transactionIdentifier;
33
- public string productIdentifier;
34
-
35
- public XDGRestoredPurchases(Dictionary<string, object> dic)
36
- {
37
- if (dic == null) return;
38
- this.transactionIdentifier = SafeDictionary.GetValue<string>(dic, "transactionIdentifier");
39
- this.productIdentifier = SafeDictionary.GetValue<string>(dic, "productIdentifier");
40
- }
41
- }
42
- }
package/README.md DELETED
File without changes