com.xd.sdk.payment 0.0.1
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.
- package/Editor/XD.SDK.Payment.Editor.asmdef +19 -0
- package/Editor/XD.SDK.Payment.Editor.asmdef.meta +7 -0
- package/Editor/XDGAndroidPaymentProcessor.cs +44 -0
- package/Editor/XDGAndroidPaymentProcessor.cs.meta +11 -0
- package/Editor/XDPaymentProcessBuild.cs +18 -0
- package/Editor/XDPaymentProcessBuild.cs.meta +11 -0
- package/Editor.meta +8 -0
- package/Mobile/Editor/XD.SDK.Payment.Mobile.Editor.asmdef +20 -0
- package/Mobile/Editor/XD.SDK.Payment.Mobile.Editor.asmdef.meta +7 -0
- package/Mobile/Editor/XDPaymentMobileProcessBuild.cs +20 -0
- package/Mobile/Editor/XDPaymentMobileProcessBuild.cs.meta +11 -0
- package/Mobile/Editor.meta +8 -0
- package/Mobile/PaymentConstants.cs +20 -0
- package/Mobile/PaymentConstants.cs.meta +3 -0
- package/Mobile/XD.SDK.Payment.Mobile.asmdef +22 -0
- package/Mobile/XD.SDK.Payment.Mobile.asmdef.meta +7 -0
- package/Mobile/XDGDataBean.cs +242 -0
- package/Mobile/XDGDataBean.cs.meta +11 -0
- package/Mobile/XDGPaymentDetailsParam.cs +127 -0
- package/Mobile/XDGPaymentDetailsParam.cs.meta +3 -0
- package/Mobile/XDGPaymentMobile.cs +132 -0
- package/Mobile/XDGPaymentMobile.cs.meta +11 -0
- package/Mobile/XDGPaymentMobileImpl.cs +331 -0
- package/Mobile/XDGPaymentMobileImpl.cs.meta +11 -0
- package/Mobile/XDGRestoredPurchasesWrapper.cs +42 -0
- package/Mobile/XDGRestoredPurchasesWrapper.cs.meta +11 -0
- package/Mobile.meta +8 -0
- package/Plugins/Android/libs/XDGPayment_6.21.1.aar +0 -0
- package/Plugins/Android/libs/XDGPayment_6.21.1.aar.meta +32 -0
- package/Plugins/Android/libs.meta +8 -0
- package/Plugins/Android.meta +8 -0
- package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGOrderInfo.h +23 -0
- package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGOrderInfo.h.meta +7 -0
- package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGPayment.h +93 -0
- package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGPayment.h.meta +7 -0
- package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGPaymentService.h +44 -0
- package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGPaymentService.h.meta +7 -0
- package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGPaymentVersion.h +9 -0
- package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGPaymentVersion.h.meta +7 -0
- package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGProductInfo.h +19 -0
- package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGProductInfo.h.meta +7 -0
- package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGTransactionInfo.h +14 -0
- package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDGTransactionInfo.h.meta +7 -0
- package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDPaymentSDK.h +23 -0
- package/Plugins/iOS/XDPaymentSDK.framework/Headers/XDPaymentSDK.h.meta +7 -0
- package/Plugins/iOS/XDPaymentSDK.framework/Headers.meta +8 -0
- package/Plugins/iOS/XDPaymentSDK.framework/Info.plist +0 -0
- package/Plugins/iOS/XDPaymentSDK.framework/Info.plist.meta +7 -0
- package/Plugins/iOS/XDPaymentSDK.framework/Modules/module.modulemap +6 -0
- package/Plugins/iOS/XDPaymentSDK.framework/Modules/module.modulemap.meta +7 -0
- package/Plugins/iOS/XDPaymentSDK.framework/Modules.meta +8 -0
- package/Plugins/iOS/XDPaymentSDK.framework/XDPaymentSDK +0 -0
- package/Plugins/iOS/XDPaymentSDK.framework/XDPaymentSDK.meta +7 -0
- package/Plugins/iOS/XDPaymentSDK.framework.meta +28 -0
- package/Plugins/iOS.meta +8 -0
- package/Plugins.meta +8 -0
- package/README.md +0 -0
- package/README.md.meta +7 -0
- package/Runtime/IXDGPayment.cs +38 -0
- package/Runtime/IXDGPayment.cs.meta +3 -0
- package/Runtime/WebPayResultType.cs +8 -0
- package/Runtime/WebPayResultType.cs.meta +3 -0
- package/Runtime/XD.SDK.Payment.asmdef +16 -0
- package/Runtime/XD.SDK.Payment.asmdef.meta +3 -0
- package/Runtime/XDGPayType.cs +8 -0
- package/Runtime/XDGPayType.cs.meta +3 -0
- package/Runtime/XDGPayment.cs +101 -0
- package/Runtime/XDGPayment.cs.meta +3 -0
- package/Runtime/XDGRefundDetails.cs +21 -0
- package/Runtime/XDGRefundDetails.cs.meta +3 -0
- package/Runtime/XDGRefundResultWrapper.cs +11 -0
- package/Runtime/XDGRefundResultWrapper.cs.meta +3 -0
- package/Runtime/XDGSkuDetailInfo.cs +252 -0
- package/Runtime/XDGSkuDetailInfo.cs.meta +3 -0
- package/Runtime.meta +3 -0
- package/package.json +11 -0
- package/package.json.meta +7 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "XD.SDK.Payment.Editor",
|
|
3
|
+
"references": [
|
|
4
|
+
"GUID:616cea76def2d4f059b94440fc8cc03d",
|
|
5
|
+
"GUID:0acc523941302664db1f4e527237feb3",
|
|
6
|
+
"GUID:27619889b8ba8c24980f49ee34dbb44a"
|
|
7
|
+
],
|
|
8
|
+
"includePlatforms": [
|
|
9
|
+
"Editor"
|
|
10
|
+
],
|
|
11
|
+
"excludePlatforms": [],
|
|
12
|
+
"allowUnsafeCode": false,
|
|
13
|
+
"overrideReferences": false,
|
|
14
|
+
"precompiledReferences": [],
|
|
15
|
+
"autoReferenced": true,
|
|
16
|
+
"defineConstraints": [],
|
|
17
|
+
"versionDefines": [],
|
|
18
|
+
"noEngineReferences": false
|
|
19
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// #if UNITY_EDITOR && UNITY_ANDROID
|
|
2
|
+
// using System.IO;
|
|
3
|
+
// using UnityEditor.Android;
|
|
4
|
+
// using UnityEngine;
|
|
5
|
+
//
|
|
6
|
+
// public class XDGAndroidPaymentProcessor : IPostGenerateGradleAndroidProject{
|
|
7
|
+
// void IPostGenerateGradleAndroidProject.OnPostGenerateGradleAndroidProject(string path){
|
|
8
|
+
// var projectPath = path;
|
|
9
|
+
// if (path.Contains("unityLibrary")){
|
|
10
|
+
// projectPath = path.Substring(0, path.Length - 12);
|
|
11
|
+
// }
|
|
12
|
+
//
|
|
13
|
+
// var parentFolder = Directory.GetParent(Application.dataPath)?.FullName;
|
|
14
|
+
//
|
|
15
|
+
// //配置路径
|
|
16
|
+
// var gradlePropertiesFile = projectPath + "/gradle.properties";
|
|
17
|
+
// var baseProjectGradle = projectPath + "/build.gradle";
|
|
18
|
+
// var launcherGradle = projectPath + "/launcher/build.gradle";
|
|
19
|
+
// #if UNITY_2019_3_OR_NEWER
|
|
20
|
+
// var unityLibraryGradle = projectPath + "/unityLibrary/build.gradle";
|
|
21
|
+
// #else
|
|
22
|
+
// var unityLibraryGradle = projectPath + "/build.gradle";
|
|
23
|
+
// #endif
|
|
24
|
+
//
|
|
25
|
+
// //implementation 可根据需要添加或删除
|
|
26
|
+
// if (File.Exists(unityLibraryGradle))
|
|
27
|
+
// {
|
|
28
|
+
// Debug.Log("编辑 unityLibraryGradle");
|
|
29
|
+
// var writerHelper = new XD.SDK.Common.Editor.XDGScriptHandlerProcessor(unityLibraryGradle);
|
|
30
|
+
// writerHelper.WriteBelow(@"implementation 'com.google.code.gson:gson:2.8.6'", @"
|
|
31
|
+
// implementation 'androidx.browser:browser:1.4.0'
|
|
32
|
+
// ");
|
|
33
|
+
// }
|
|
34
|
+
// else
|
|
35
|
+
// {
|
|
36
|
+
// Debug.LogWarning("打包警告 --- unityLibraryGradle 不存在");
|
|
37
|
+
// }
|
|
38
|
+
// }
|
|
39
|
+
//
|
|
40
|
+
// public int callbackOrder{
|
|
41
|
+
// get{ return 1098; }
|
|
42
|
+
// }
|
|
43
|
+
// }
|
|
44
|
+
// #endif
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using TapTap.Common.Editor;
|
|
3
|
+
using UnityEditor.Build.Reporting;
|
|
4
|
+
|
|
5
|
+
namespace XD.SDK.Payment.Editor
|
|
6
|
+
{
|
|
7
|
+
public class XDPaymentProcessBuild : SDKLinkProcessBuild {
|
|
8
|
+
public override int callbackOrder => 5;
|
|
9
|
+
|
|
10
|
+
public override string LinkPath => "XDSDK/Gen/Payment/link.xml";
|
|
11
|
+
|
|
12
|
+
public override LinkedAssembly[] LinkedAssemblies => new LinkedAssembly[] {
|
|
13
|
+
new LinkedAssembly { Fullname = "XD.SDK.Payment" },
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
public override Func<BuildReport, bool> IsTargetPlatform => (report) => true;
|
|
17
|
+
}
|
|
18
|
+
}
|
package/Editor.meta
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "XD.SDK.Payment.Mobile.Editor",
|
|
3
|
+
"references": [
|
|
4
|
+
"GUID:616cea76def2d4f059b94440fc8cc03d",
|
|
5
|
+
"GUID:747e53b1749584bae9386571797e5eb5",
|
|
6
|
+
"GUID:0acc523941302664db1f4e527237feb3",
|
|
7
|
+
"GUID:27619889b8ba8c24980f49ee34dbb44a"
|
|
8
|
+
],
|
|
9
|
+
"includePlatforms": [
|
|
10
|
+
"Editor"
|
|
11
|
+
],
|
|
12
|
+
"excludePlatforms": [],
|
|
13
|
+
"allowUnsafeCode": false,
|
|
14
|
+
"overrideReferences": false,
|
|
15
|
+
"precompiledReferences": [],
|
|
16
|
+
"autoReferenced": true,
|
|
17
|
+
"defineConstraints": [],
|
|
18
|
+
"versionDefines": [],
|
|
19
|
+
"noEngineReferences": false
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using TapTap.Common.Editor;
|
|
3
|
+
using UnityEditor.Build.Reporting;
|
|
4
|
+
|
|
5
|
+
namespace XD.SDK.Payment.Editor
|
|
6
|
+
{
|
|
7
|
+
public class XDPaymentMobileProcessBuild : SDKLinkProcessBuild {
|
|
8
|
+
public override int callbackOrder => 6;
|
|
9
|
+
|
|
10
|
+
public override string LinkPath => "XDSDK/Gen/Payment/Mobile/link.xml";
|
|
11
|
+
|
|
12
|
+
public override LinkedAssembly[] LinkedAssemblies => new LinkedAssembly[] {
|
|
13
|
+
new LinkedAssembly { Fullname = "XD.SDK.Payment.Mobile" }
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
public override Func<BuildReport, bool> IsTargetPlatform => (report) => {
|
|
17
|
+
return BuildTargetUtils.IsSupportMobile(report.summary.platform);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
namespace XD.SDK.Payment
|
|
2
|
+
{
|
|
3
|
+
public class PaymentConstants
|
|
4
|
+
{
|
|
5
|
+
public static class PaymentResponseCode
|
|
6
|
+
{
|
|
7
|
+
public static int OK = 0;
|
|
8
|
+
public static int ERROR = -1;
|
|
9
|
+
public static int NETWORK_ERROR = -2;
|
|
10
|
+
public static int USER_CANCEL = 1;
|
|
11
|
+
public static int PURCHASE_PROCESSING = 2;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
internal static class PayTypeInternal
|
|
15
|
+
{
|
|
16
|
+
public const string ALIPAY = "Alipay";
|
|
17
|
+
public const string WECHAT_PAY = "WeChatPay";
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "XD.SDK.Payment.Mobile",
|
|
3
|
+
"references": [
|
|
4
|
+
"GUID:66fa57e362eb4ba98db4f804bf7b5c61",
|
|
5
|
+
"GUID:271a06ab0780d4a5ea46c9c3be2ab5dc",
|
|
6
|
+
"GUID:d2c60bf9347574ed480e55a6682a81f4",
|
|
7
|
+
"GUID:0b3f64ec33f5b4da98a17367a35b82f2",
|
|
8
|
+
"GUID:43c632eee0a6f42cdaf21080b154f3a1"
|
|
9
|
+
],
|
|
10
|
+
"includePlatforms": [
|
|
11
|
+
"Android",
|
|
12
|
+
"iOS"
|
|
13
|
+
],
|
|
14
|
+
"excludePlatforms": [],
|
|
15
|
+
"allowUnsafeCode": false,
|
|
16
|
+
"overrideReferences": false,
|
|
17
|
+
"precompiledReferences": [],
|
|
18
|
+
"autoReferenced": true,
|
|
19
|
+
"defineConstraints": [],
|
|
20
|
+
"versionDefines": [],
|
|
21
|
+
"noEngineReferences": false
|
|
22
|
+
}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using TapTap.Common;
|
|
4
|
+
using UnityEngine;
|
|
5
|
+
using XD.SDK.Common;
|
|
6
|
+
using XD.SDK.Payment;
|
|
7
|
+
|
|
8
|
+
namespace XD.SDK.Payment
|
|
9
|
+
{
|
|
10
|
+
public class XDGSkuDetailInfoMobile : XDGSkuDetailInfo
|
|
11
|
+
{
|
|
12
|
+
private XDGError _xdgError;
|
|
13
|
+
|
|
14
|
+
private List<SkuDetailBean> _skuDetailList;
|
|
15
|
+
|
|
16
|
+
public XDGError xdgError => _xdgError;
|
|
17
|
+
|
|
18
|
+
public List<SkuDetailBean> skuDetailList => _skuDetailList;
|
|
19
|
+
|
|
20
|
+
public XDGSkuDetailInfoMobile(string jsonStr)
|
|
21
|
+
{
|
|
22
|
+
var dic = Json.Deserialize(jsonStr) as Dictionary<string, object>;
|
|
23
|
+
var errorDic = SafeDictionary.GetValue<Dictionary<string, object>>(dic, "error");
|
|
24
|
+
if (errorDic != null)
|
|
25
|
+
{
|
|
26
|
+
_xdgError = new XDGErrorMobile(errorDic);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
var list = SafeDictionary.GetValue<List<object>>(dic, "products");
|
|
30
|
+
if (list == null) return;
|
|
31
|
+
_skuDetailList = new List<SkuDetailBean>();
|
|
32
|
+
foreach (var skuDetail in list)
|
|
33
|
+
{
|
|
34
|
+
var innerDic = skuDetail as Dictionary<string, object>;
|
|
35
|
+
var skuDetailBean = new SkuDetailBean(innerDic);
|
|
36
|
+
_skuDetailList.Add(skuDetailBean);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public class XDGOrderInfoWrapperMobile : XDGOrderInfoWrapper
|
|
42
|
+
{
|
|
43
|
+
private XDGError _xdgError;
|
|
44
|
+
private XDGOrderInfo _orderInfo;
|
|
45
|
+
private string _debugMsg;
|
|
46
|
+
|
|
47
|
+
public XDGError xdgError => _xdgError;
|
|
48
|
+
public XDGOrderInfo orderInfo => _orderInfo;
|
|
49
|
+
public string debugMsg => _debugMsg;
|
|
50
|
+
|
|
51
|
+
public XDGOrderInfoWrapperMobile(string jsonStr)
|
|
52
|
+
{
|
|
53
|
+
Debug.LogFormat("支付返回 json: {0}", jsonStr);
|
|
54
|
+
var dic = Json.Deserialize(jsonStr) as Dictionary<string, object>;
|
|
55
|
+
var errorDic = SafeDictionary.GetValue<Dictionary<string, object>>(dic, "error");
|
|
56
|
+
if (errorDic != null)
|
|
57
|
+
{
|
|
58
|
+
_xdgError = new XDGErrorMobile(errorDic);
|
|
59
|
+
XDGLogger.Debug($"产品支付失败: {jsonStr}");
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
var orderInfoDic = SafeDictionary.GetValue<Dictionary<string, object>>(dic, "orderInfo");
|
|
63
|
+
_orderInfo = new XDGOrderInfo(orderInfoDic);
|
|
64
|
+
|
|
65
|
+
_debugMsg = SafeDictionary.GetValue<string>(dic, "debugMessage");
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
public class XDGRestoredPurchaseWrapper
|
|
71
|
+
{
|
|
72
|
+
public List<XDGRestoredPurchase> transactionList;
|
|
73
|
+
|
|
74
|
+
public XDGRestoredPurchaseWrapper(string jsonStr)
|
|
75
|
+
{
|
|
76
|
+
var dic = Json.Deserialize(jsonStr) as Dictionary<string, object>;
|
|
77
|
+
var list = SafeDictionary.GetValue<List<object>>(dic, "transactions");
|
|
78
|
+
if (list == null)
|
|
79
|
+
{
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
transactionList = new List<XDGRestoredPurchase>();
|
|
84
|
+
foreach (var obj in list)
|
|
85
|
+
{
|
|
86
|
+
var beanDic = obj as Dictionary<string, object>;
|
|
87
|
+
transactionList.Add(new XDGRestoredPurchase(beanDic));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
public class XDGRefundResultWrapperMobile : XDGRefundResultWrapper
|
|
93
|
+
{
|
|
94
|
+
private XDGError _xdgError;
|
|
95
|
+
private List<XDGRefundDetails> _refundList;
|
|
96
|
+
|
|
97
|
+
public XDGRefundResultWrapperMobile(string jsonStr)
|
|
98
|
+
{
|
|
99
|
+
var dic = Json.Deserialize(jsonStr) as Dictionary<string, object>;
|
|
100
|
+
var code = SafeDictionary.GetValue<int>(dic, "code");
|
|
101
|
+
var msg = SafeDictionary.GetValue<string>(dic, "msg");
|
|
102
|
+
if (code != Result.RESULT_SUCCESS)
|
|
103
|
+
{
|
|
104
|
+
XDGLogger.Warn($"CheckRefundResult 失败 :{jsonStr}");
|
|
105
|
+
_xdgError = new XDGErrorMobile(code, msg);
|
|
106
|
+
}
|
|
107
|
+
else
|
|
108
|
+
{
|
|
109
|
+
var dataDic = SafeDictionary.GetValue<Dictionary<string, object>>(dic, "data");
|
|
110
|
+
if (dataDic == null) return;
|
|
111
|
+
var list = SafeDictionary.GetValue<List<object>>(dataDic, "list");
|
|
112
|
+
if (list == null)return;
|
|
113
|
+
|
|
114
|
+
_refundList = new List<XDGRefundDetails>();
|
|
115
|
+
for (var index = 0; index < list.Count; index++)
|
|
116
|
+
{
|
|
117
|
+
var obj = list[index];
|
|
118
|
+
var beanDic = obj as Dictionary<string, object>;
|
|
119
|
+
_refundList.Add(new XDGRefundDetailsMobile(beanDic));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
public XDGError xdgError => _xdgError as XDGError;
|
|
125
|
+
public List<XDGRefundDetails> refundList => _refundList?.ConvertAll<XDGRefundDetails>(a => a as XDGRefundDetails);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
[Serializable]
|
|
129
|
+
public class XDGRefundDetailsMobile : XDGRefundDetails
|
|
130
|
+
{
|
|
131
|
+
private string _tradeNo;
|
|
132
|
+
private string _productId;
|
|
133
|
+
private string _currency;
|
|
134
|
+
private string _outTradeNo;
|
|
135
|
+
private double _refundAmount;
|
|
136
|
+
private int _supplyStatus;
|
|
137
|
+
private int _platform;
|
|
138
|
+
private int _channelType;
|
|
139
|
+
|
|
140
|
+
public XDGRefundDetailsMobile(Dictionary<string, object> dic)
|
|
141
|
+
{
|
|
142
|
+
if (dic == null) return;
|
|
143
|
+
_tradeNo = SafeDictionary.GetValue<string>(dic, "tradeNo");
|
|
144
|
+
_productId = SafeDictionary.GetValue<string>(dic, "productId");
|
|
145
|
+
_currency = SafeDictionary.GetValue<string>(dic, "currency");
|
|
146
|
+
_outTradeNo = SafeDictionary.GetValue<string>(dic, "outTradeNo");
|
|
147
|
+
_refundAmount = SafeDictionary.GetValue<double>(dic, "refundAmount");
|
|
148
|
+
_supplyStatus = SafeDictionary.GetValue<int>(dic, "supplyStatus");
|
|
149
|
+
_platform = SafeDictionary.GetValue<int>(dic, "platform");
|
|
150
|
+
_channelType = SafeDictionary.GetValue<int>(dic, "channelType");
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
public string tradeNo => _tradeNo;
|
|
154
|
+
|
|
155
|
+
public string productId => _productId;
|
|
156
|
+
|
|
157
|
+
public string currency => _currency;
|
|
158
|
+
|
|
159
|
+
public string outTradeNo => _outTradeNo;
|
|
160
|
+
|
|
161
|
+
public double refundAmount => _refundAmount;
|
|
162
|
+
|
|
163
|
+
public int supplyStatus => _supplyStatus;
|
|
164
|
+
|
|
165
|
+
public int platform => _platform;
|
|
166
|
+
|
|
167
|
+
public int channelType => _channelType;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
public class XDGInlinePayResult
|
|
171
|
+
{
|
|
172
|
+
public int code = -1;
|
|
173
|
+
public string message = "";
|
|
174
|
+
|
|
175
|
+
public XDGInlinePayResult(string jsonStr)
|
|
176
|
+
{
|
|
177
|
+
if (!(Json.Deserialize(jsonStr) is Dictionary<string, object> dic)) return;
|
|
178
|
+
code = SafeDictionary.GetValue<int>(dic, "code");
|
|
179
|
+
message = SafeDictionary.GetValue<string>(dic, "message");
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
public XDGInlinePayResult(int code, string message)
|
|
183
|
+
{
|
|
184
|
+
this.code = code;
|
|
185
|
+
this.message = message;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
public class ProductSkuWrapper
|
|
191
|
+
{
|
|
192
|
+
public XDGError xdgError;
|
|
193
|
+
|
|
194
|
+
public List<ProductSkuInfo> skuList;
|
|
195
|
+
|
|
196
|
+
public ProductSkuWrapper(string jsonStr)
|
|
197
|
+
{
|
|
198
|
+
var dic = Json.Deserialize(jsonStr) as Dictionary<string, object>;
|
|
199
|
+
var errorDic = SafeDictionary.GetValue<Dictionary<string, object>>(dic, "error");
|
|
200
|
+
if (errorDic != null)
|
|
201
|
+
{
|
|
202
|
+
xdgError = new XDGErrorMobile(errorDic);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
var list = SafeDictionary.GetValue<List<object>>(dic, "products");
|
|
206
|
+
if (list == null) return;
|
|
207
|
+
skuList = new List<ProductSkuInfo>();
|
|
208
|
+
foreach (var skuDetail in list)
|
|
209
|
+
{
|
|
210
|
+
var innerDic = skuDetail as Dictionary<string, object>;
|
|
211
|
+
var skuDetailBean = new ProductSkuInfo(innerDic);
|
|
212
|
+
skuList.Add(skuDetailBean);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
public class ProductSkuInfo
|
|
219
|
+
{
|
|
220
|
+
public string channelSkuCode; // 渠道 sku
|
|
221
|
+
public string costPrice; // 原价
|
|
222
|
+
public string currency; // 货币
|
|
223
|
+
public string desc; // 商品描述
|
|
224
|
+
public string productSkuCode; // 商品 sku
|
|
225
|
+
public string productSkuName; // 商品 sku 的名称
|
|
226
|
+
public string region; // 国家/地区
|
|
227
|
+
public string salePrice; // 现价
|
|
228
|
+
|
|
229
|
+
public ProductSkuInfo(Dictionary<string, object> dic)
|
|
230
|
+
{
|
|
231
|
+
if (dic == null) return;
|
|
232
|
+
channelSkuCode = SafeDictionary.GetValue<string>(dic, "channelSkuCode");
|
|
233
|
+
costPrice = SafeDictionary.GetValue<string>(dic, "costPrice");
|
|
234
|
+
currency = SafeDictionary.GetValue<string>(dic, "currency");
|
|
235
|
+
desc = SafeDictionary.GetValue<string>(dic, "desc");
|
|
236
|
+
productSkuCode = SafeDictionary.GetValue<string>(dic, "productSkuCode");
|
|
237
|
+
productSkuName = SafeDictionary.GetValue<string>(dic, "productSkuName");
|
|
238
|
+
region = SafeDictionary.GetValue<string>(dic, "region");
|
|
239
|
+
salePrice = SafeDictionary.GetValue<string>(dic, "salePrice");
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
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
|
+
}
|