expo-alipay-sdk 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/README.md +281 -0
- package/android/.gradle/8.9/checksums/checksums.lock +0 -0
- package/android/.gradle/8.9/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/8.9/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.9/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/build.gradle +22 -0
- package/android/src/main/AndroidManifest.xml +14 -0
- package/android/src/main/java/com/goldstar/alipay/AlipayModule.java +140 -0
- package/android/src/main/java/com/goldstar/alipay/AlipayPackage.java +26 -0
- package/android/src/main/java/com/goldstar/alipay/PayResult.java +46 -0
- package/app.plugin.js +53 -0
- package/expo-alipay.podspec +32 -0
- package/ios/Alipay.h +9 -0
- package/ios/Alipay.mm +143 -0
- package/ios/iOS_SDK/AlipaySDK.bundle/alipay_msp_back@2x.png +0 -0
- package/ios/iOS_SDK/AlipaySDK.bundle/alipay_msp_refresh@2x.png +0 -0
- package/ios/iOS_SDK/AlipaySDK.bundle/bar@2x.png +0 -0
- package/ios/iOS_SDK/AlipaySDK.bundle/bridge.js +1 -0
- package/ios/iOS_SDK/AlipaySDK.bundle/bridge_v2.js +79 -0
- package/ios/iOS_SDK/AlipaySDK.bundle/refresh@2x.png +0 -0
- package/ios/iOS_SDK/AlipaySDK.bundle/refresh_click@2x.png +0 -0
- package/ios/iOS_SDK/AlipaySDK.bundle/shutdown@2x.png +0 -0
- package/ios/iOS_SDK/AlipaySDK.bundle/shutdown_click@2x.png +0 -0
- package/ios/iOS_SDK/AlipaySDK.framework/AlipaySDK +0 -0
- package/ios/iOS_SDK/AlipaySDK.framework/AlipaySDK-inside-Info.plist +0 -0
- package/ios/iOS_SDK/AlipaySDK.framework/Headers/AFServiceCenter.h +68 -0
- package/ios/iOS_SDK/AlipaySDK.framework/Headers/AFServiceResponse.h +43 -0
- package/ios/iOS_SDK/AlipaySDK.framework/Headers/APCellularHTTPSClient.h +73 -0
- package/ios/iOS_SDK/AlipaySDK.framework/Headers/APDeductSDK.h +27 -0
- package/ios/iOS_SDK/AlipaySDK.framework/Headers/APayAuthInfo.h +33 -0
- package/ios/iOS_SDK/AlipaySDK.framework/Headers/AlipaySDK.h +253 -0
- package/ios/iOS_SDK/AlipaySDK.framework/Headers/AlipaySDKModule.h +18 -0
- package/ios/iOS_SDK/AlipaySDK.framework/Headers/MQPWebViewResourcesManager.h +37 -0
- package/ios/iOS_SDK/AlipaySDK.framework/Modules/module.modulemap +14 -0
- package/package.json +62 -0
- package/src/index.d.ts +69 -0
- package/src/index.js +164 -0
package/ios/Alipay.mm
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
// Alipay.mm
|
|
2
|
+
|
|
3
|
+
#import "Alipay.h"
|
|
4
|
+
#import <AlipaySDK/AlipaySDK.h>
|
|
5
|
+
#import <React/RCTEventDispatcher.h>
|
|
6
|
+
#import <React/RCTBridge.h>
|
|
7
|
+
#import <React/RCTLog.h>
|
|
8
|
+
|
|
9
|
+
@implementation Alipay
|
|
10
|
+
|
|
11
|
+
// Define error messages
|
|
12
|
+
#define NOT_REGISTERED (@"registerApp required.")
|
|
13
|
+
#define INVOKE_FAILED (@"Alipay API invoke returns false.")
|
|
14
|
+
|
|
15
|
+
@synthesize bridge = _bridge;
|
|
16
|
+
|
|
17
|
+
RCT_EXPORT_MODULE()
|
|
18
|
+
|
|
19
|
+
- (instancetype)init
|
|
20
|
+
{
|
|
21
|
+
self = [super init];
|
|
22
|
+
if (self) {
|
|
23
|
+
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleOpenURL:) name:@"RCTOpenURLNotification" object:nil];
|
|
24
|
+
}
|
|
25
|
+
return self;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
- (void)dealloc
|
|
29
|
+
{
|
|
30
|
+
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
- (BOOL)handleOpenURL:(NSNotification *)aNotification
|
|
34
|
+
{
|
|
35
|
+
NSString * aURLString = [aNotification userInfo][@"url"];
|
|
36
|
+
NSURL * aURL = [NSURL URLWithString:aURLString];
|
|
37
|
+
|
|
38
|
+
if ([aURL.host isEqualToString:@"safepay"]) {
|
|
39
|
+
// 支付跳转支付宝钱包进行支付,处理支付结果
|
|
40
|
+
[[AlipaySDK defaultService] processOrderWithPaymentResult:aURL standbyCallback:^(NSDictionary *resultDic) {
|
|
41
|
+
NSLog(@"result = %@",resultDic);
|
|
42
|
+
[self sendPayResult:resultDic];
|
|
43
|
+
}];
|
|
44
|
+
return YES;
|
|
45
|
+
}
|
|
46
|
+
return NO;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
- (dispatch_queue_t)methodQueue
|
|
50
|
+
{
|
|
51
|
+
return dispatch_get_main_queue();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
+ (BOOL)requiresMainQueueSetup {
|
|
55
|
+
return YES;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
RCT_EXPORT_METHOD(registerApp:(NSString *)appId
|
|
59
|
+
:(NSString *)universalLink
|
|
60
|
+
:(RCTResponseSenderBlock)callback)
|
|
61
|
+
{
|
|
62
|
+
if (appId && appId.length > 0) {
|
|
63
|
+
if (universalLink && universalLink.length > 0) {
|
|
64
|
+
[[AlipaySDK defaultService] registerApp:appId universalLink:universalLink];
|
|
65
|
+
} else {
|
|
66
|
+
[[AlipaySDK defaultService] registerApp:appId universalLink:nil];
|
|
67
|
+
}
|
|
68
|
+
callback(@[[NSNull null], @(YES)]);
|
|
69
|
+
} else {
|
|
70
|
+
callback(@[INVOKE_FAILED, @(NO)]);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
RCT_EXPORT_METHOD(pay:(NSString *)orderInfo
|
|
75
|
+
:(RCTResponseSenderBlock)callback)
|
|
76
|
+
{
|
|
77
|
+
if (!orderInfo || orderInfo.length == 0) {
|
|
78
|
+
callback(@[@"orderInfo cannot be empty"]);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// 获取应用配置的 scheme
|
|
83
|
+
NSString *appScheme = [self getAppScheme];
|
|
84
|
+
if (!appScheme || appScheme.length == 0) {
|
|
85
|
+
callback(@[@"App scheme not configured. Please configure URL scheme in Info.plist"]);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
[[AlipaySDK defaultService] payOrder:orderInfo fromScheme:appScheme callback:^(NSDictionary *resultDic) {
|
|
90
|
+
NSLog(@"reslut = %@",resultDic);
|
|
91
|
+
[self sendPayResult:resultDic];
|
|
92
|
+
NSString *resultStatus = resultDic[@"resultStatus"];
|
|
93
|
+
if ([resultStatus isEqualToString:@"9000"]) {
|
|
94
|
+
callback(@[[NSNull null], resultDic]);
|
|
95
|
+
} else {
|
|
96
|
+
NSString *memo = resultDic[@"memo"] ?: @"支付失败";
|
|
97
|
+
callback(@[memo, resultDic]);
|
|
98
|
+
}
|
|
99
|
+
}];
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
RCT_EXPORT_METHOD(getVersion:(RCTResponseSenderBlock)callback)
|
|
103
|
+
{
|
|
104
|
+
NSString *version = [[AlipaySDK defaultService] currentVersion];
|
|
105
|
+
callback(@[[NSNull null], version ?: @""]);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
RCT_EXPORT_METHOD(isAlipayInstalled:(RCTResponseSenderBlock)callback)
|
|
109
|
+
{
|
|
110
|
+
// 支付宝 SDK 没有直接提供判断是否安装的方法
|
|
111
|
+
// 可以通过尝试打开支付宝 URL Scheme 来判断
|
|
112
|
+
NSURL *alipayURL = [NSURL URLWithString:@"alipay://"];
|
|
113
|
+
BOOL isInstalled = [[UIApplication sharedApplication] canOpenURL:alipayURL];
|
|
114
|
+
callback(@[[NSNull null], @(isInstalled)]);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
- (NSString *)getAppScheme
|
|
118
|
+
{
|
|
119
|
+
NSArray *urlTypes = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleURLTypes"];
|
|
120
|
+
for (NSDictionary *urlType in urlTypes) {
|
|
121
|
+
NSArray *urlSchemes = urlType[@"CFBundleURLSchemes"];
|
|
122
|
+
for (NSString *scheme in urlSchemes) {
|
|
123
|
+
if (![scheme isEqualToString:@"alipay"] && ![scheme isEqualToString:@"alipays"]) {
|
|
124
|
+
return scheme;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return nil;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
- (void)sendPayResult:(NSDictionary *)resultDic
|
|
132
|
+
{
|
|
133
|
+
NSMutableDictionary *body = [NSMutableDictionary dictionary];
|
|
134
|
+
body[@"resultStatus"] = resultDic[@"resultStatus"] ?: @"";
|
|
135
|
+
body[@"result"] = resultDic[@"result"] ?: @"";
|
|
136
|
+
body[@"memo"] = resultDic[@"memo"] ?: @"";
|
|
137
|
+
body[@"type"] = @"PayResult.Resp";
|
|
138
|
+
|
|
139
|
+
[self.bridge.eventDispatcher sendDeviceEventWithName:@"Alipay_Resp" body:body];
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
@end
|
|
143
|
+
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(){if(!window.AlipayJSBridge){window.alipayjsbridgeSetTitle=function(e){document.title=e,t("alipayjsbridge://setTitle?title="+encodeURIComponent(e))},window.alipayjsbridgeRefresh=function(){t("alipayjsbridge://onRefresh?")},window.alipayjsbridgeBack=function(){t("alipayjsbridge://onBack?")},window.alipayjsbridgeExit=function(e){t("alipayjsbridge://onExit?bsucc="+e)},window.alipayjsbridgeShowBackButton=function(e){t("alipayjsbridge://showBackButton?bshow="+e)},window.AlipayJSBridge={version:"2.0",addListener:function(e,i){a[e]=i},hasListener:function(e){if(!a[e])return!1;return!0},callListener:function(e,i,n){var t;n&&(t=function(e){var i="";e&&(i=encodeURIComponent(JSON.stringify(e)));var a="func=h5JsFuncCallback&cbId="+n+"&data="+i;o(a)});var r=a[e];r?r(i,t):console.log("AlipayJSBridge: no h5JsFunc ",e+i)},callNativeFunc:function(e,a,t){var r="";t&&(r="cb_"+i+++"_"+(new Date).getTime(),n[r]=t);var d="";a&&(d=encodeURIComponent(JSON.stringify(a)));o("func="+e+"&cbId="+r+"&data="+d)},callBackFromNativeFunc:function(e,i){var a=n[e];a&&(a(i),delete n[i])}};var e,i=1,n={},a={};window.CustomEvent?e=new CustomEvent("alipayjsbridgeready"):(e=document.createEvent("Event")).initEvent("alipayjsbridgeready",!0,!0),document.dispatchEvent(e),setTimeout(function(){if(window.AlipayJSBridgeInitArray){var e=window.AlipayJSBridgeInitArray;delete window.AlipayJSBridgeInitArray;for(var i=0;i<e.length;i++)try{e[i](AlipayJSBridge)}catch(e){setTimeout(function(){throw e})}}},0)}function t(e){window.webkit&&window.webkit.messageHandlers&&window.webkit.messageHandlers.MQPJSBridgeScheme&&window.webkit.messageHandlers.MQPJSBridgeScheme.postMessage&&window.webkit.messageHandlers.MQPJSBridgeScheme.postMessage(e)}function o(e){t("alipayjsbridge://callNativeFunc?"+e)}}();
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
! function () {
|
|
2
|
+
if (!window.AlipayJSBridge) {
|
|
3
|
+
window.alipayjsbridgeSetTitle = function (e) {
|
|
4
|
+
document.title = e, t("alipayjsbridge://setTitle?title=" + encodeURIComponent(e))
|
|
5
|
+
}, window.alipayjsbridgeRefresh = function () {
|
|
6
|
+
t("alipayjsbridge://onRefresh?")
|
|
7
|
+
}, window.alipayjsbridgeBack = function () {
|
|
8
|
+
t("alipayjsbridge://onBack?")
|
|
9
|
+
}, window.alipayjsbridgeExit = function (e) {
|
|
10
|
+
t("alipayjsbridge://onExit?bsucc=" + e)
|
|
11
|
+
},window.alipayjsbridgeShowBackButton = function (e) {
|
|
12
|
+
t("alipayjsbridge://showBackButton?bshow=" + e)
|
|
13
|
+
}, window.AlipayJSBridge = {
|
|
14
|
+
version: "2.0",
|
|
15
|
+
addListener: function (e, i) {
|
|
16
|
+
a[e] = i
|
|
17
|
+
},
|
|
18
|
+
hasListener: function (e) {
|
|
19
|
+
if (!a[e]) return !1;
|
|
20
|
+
return !0
|
|
21
|
+
},
|
|
22
|
+
callListener: function (e, i, n) {
|
|
23
|
+
var t;
|
|
24
|
+
n && (t = function (e) {
|
|
25
|
+
var i = "";
|
|
26
|
+
e && (i = encodeURIComponent(JSON.stringify(e)));
|
|
27
|
+
var a = "func=h5JsFuncCallback&cbId=" + n + "&data=" + i;
|
|
28
|
+
o(a)
|
|
29
|
+
});
|
|
30
|
+
var r = a[e];
|
|
31
|
+
r ? r(i, t) : console.log("AlipayJSBridge: no h5JsFunc ", e + i)
|
|
32
|
+
},
|
|
33
|
+
callNativeFunc: function (e, a, t) {
|
|
34
|
+
var r = "";
|
|
35
|
+
t && (r = "cb_" + i++ + "_" + (new Date).getTime(), n[r] = t);
|
|
36
|
+
var d = "";
|
|
37
|
+
a && (d = encodeURIComponent(JSON.stringify(a)));
|
|
38
|
+
o("func=" + e + "&cbId=" + r + "&data=" + d)
|
|
39
|
+
},
|
|
40
|
+
callBackFromNativeFunc: function (e, i) {
|
|
41
|
+
var a = n[e];
|
|
42
|
+
a && (a(i), delete n[i])
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
var e, i = 1,
|
|
46
|
+
n = {},
|
|
47
|
+
a = {};
|
|
48
|
+
window.CustomEvent ? e = new CustomEvent("alipayjsbridgeready") : (e = document.createEvent("Event")).initEvent("alipayjsbridgeready", !0, !0), document.dispatchEvent(e), setTimeout(function () {
|
|
49
|
+
if (window.AlipayJSBridgeInitArray) {
|
|
50
|
+
var e = window.AlipayJSBridgeInitArray;
|
|
51
|
+
delete window.AlipayJSBridgeInitArray;
|
|
52
|
+
for (var i = 0; i < e.length; i++) try {
|
|
53
|
+
e[i](AlipayJSBridge)
|
|
54
|
+
} catch (e) {
|
|
55
|
+
setTimeout(function () {
|
|
56
|
+
throw e
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}, 0)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (!window.AlipayChinaMobileBridge) {
|
|
64
|
+
window.AlipayChinaMobileBridge = {
|
|
65
|
+
sendNetworkByWifiBridge: function (e) {
|
|
66
|
+
window.AlipayJSBridge.callNativeFunc('sendNetworkByWifiBridge',e,)
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function t(e) {
|
|
72
|
+
window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.MQPJSBridgeScheme && window.webkit.messageHandlers.MQPJSBridgeScheme.postMessage && window.webkit.messageHandlers.MQPJSBridgeScheme.postMessage(e)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function o(e) {
|
|
76
|
+
t("alipayjsbridge://callNativeFunc?" + e)
|
|
77
|
+
}
|
|
78
|
+
}();
|
|
79
|
+
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
//
|
|
2
|
+
// AFServiceCenter.h
|
|
3
|
+
// AFServiceSDK
|
|
4
|
+
//
|
|
5
|
+
// Created by jiajunchen on 02/01/2018.
|
|
6
|
+
// Copyright © 2018 antfin. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import <Foundation/Foundation.h>
|
|
10
|
+
|
|
11
|
+
@class AFServiceResponse;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
SDK支持的业务枚举值
|
|
15
|
+
|
|
16
|
+
- AFServiceEInvoice: 电子发票
|
|
17
|
+
- AFServiceAuth: 账户授权
|
|
18
|
+
*/
|
|
19
|
+
typedef NS_ENUM(NSUInteger, AFService) {
|
|
20
|
+
AFServiceEInvoice,
|
|
21
|
+
AFServiceAuth,
|
|
22
|
+
AFServiceDeduct
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
extern NSString * const kAFServiceOptionBizParams; // 钱包服务调用入参
|
|
27
|
+
extern NSString * const kAFServiceOptionCallbackScheme; // 业务回跳当前app的scheme
|
|
28
|
+
extern NSString * const kAFServiceOptionCallbackUlink; // 业务回跳当前app的ulink
|
|
29
|
+
extern NSString * const kAFServiceOptionNotUseLanding; // 不使用支付宝提示下载页做补偿,为true时需要商户自己处理用户未安装支付宝的情况
|
|
30
|
+
extern NSString * const kAFServiceBizParamsKeyUrl; // 独立签约入参url
|
|
31
|
+
|
|
32
|
+
typedef void(^AFServiceResultBlock)(AFServiceResponse *response);
|
|
33
|
+
|
|
34
|
+
@interface AFServiceCenter : NSObject
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
调用钱包服务
|
|
38
|
+
|
|
39
|
+
@param service 业务service, 见AFService枚举值
|
|
40
|
+
@param params 参数Dictionary, key值详情参见kAFServiceOptionBizParams、kAFServiceOptionCallbackScheme注释
|
|
41
|
+
@param block 业务结果回调的block, block参数是AFServiceResponse类型,业务结果通过result属性获取,如果未用户未安装支付宝并且kAFServiceOptionNotUseLanding未设置为true,会使用H5landing页做补偿,这种情况下不会有block回调结果。
|
|
42
|
+
*/
|
|
43
|
+
+ (void)callService:(AFService)service
|
|
44
|
+
withParams:(NSDictionary *)params
|
|
45
|
+
andCompletion:(AFServiceResultBlock)block;
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
处理钱包服务回跳APP的URL
|
|
50
|
+
|
|
51
|
+
@param url 回跳URL
|
|
52
|
+
@param block 业务结果回掉的block,详情见调用接口入参上的block。注意此接口上的block只有在跳转钱包后,当前APP被系统回收的情况下回跳才生效
|
|
53
|
+
*/
|
|
54
|
+
+ (void)handleResponseURL:(NSURL *)url
|
|
55
|
+
withCompletion:(AFServiceResultBlock)block;
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* 处理支付宝app支付后通过universalLink跳回商户app携带的支付结果处理
|
|
60
|
+
*
|
|
61
|
+
* @param userActivity 系统接口传入的userActivity
|
|
62
|
+
* @param block 支付结果回调 为nil时默认使用支付接口的completionBlock
|
|
63
|
+
* @return YES表示能处理,NO表示不能处理
|
|
64
|
+
*/
|
|
65
|
+
+ (BOOL)handleOpenUniversalLink:(NSUserActivity *)userActivity
|
|
66
|
+
withCompletion:(AFServiceResultBlock)block;
|
|
67
|
+
|
|
68
|
+
@end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
//
|
|
2
|
+
// AFServiceResponse.h
|
|
3
|
+
// AFServiceSDK
|
|
4
|
+
//
|
|
5
|
+
// Created by jiajunchen on 08/01/2018.
|
|
6
|
+
// Copyright © 2018 antfin. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import <Foundation/Foundation.h>
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
钱包服务调用结果状态吗
|
|
13
|
+
|
|
14
|
+
- AFResSuccess: 默认值,业务调用成功,结果数据参见result字段
|
|
15
|
+
- AFResInvalidService: service枚举值错误
|
|
16
|
+
- AFResInvalidURL: 钱包回跳URL错误
|
|
17
|
+
- AFResRepeatCall: 业务重复调用(3s内)
|
|
18
|
+
- AFResOpenURLErr: 跳转失败
|
|
19
|
+
*/
|
|
20
|
+
typedef NS_ENUM(NSUInteger, AFResCode) {
|
|
21
|
+
AFResSuccess = 0,
|
|
22
|
+
AFResInvalidService = 100,
|
|
23
|
+
AFResInvalidURL,
|
|
24
|
+
AFResRepeatCall,
|
|
25
|
+
AFResOpenURLErr,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@interface AFServiceResponse : NSObject
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
业务调用状态吗
|
|
34
|
+
*/
|
|
35
|
+
@property (nonatomic, assign) AFResCode responseCode;
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
业务结果Dictionary, 内容请参考具体业务方接入文档
|
|
40
|
+
*/
|
|
41
|
+
@property (readonly) NSDictionary *result;
|
|
42
|
+
|
|
43
|
+
@end
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
//
|
|
2
|
+
// APCellularConnectionUtil.h
|
|
3
|
+
// AlipaySDK
|
|
4
|
+
//
|
|
5
|
+
// Created by intfre on 2025/9/11.
|
|
6
|
+
// Copyright © 2025 Alipay. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
// CellularHttpClient.h
|
|
10
|
+
|
|
11
|
+
#import <Foundation/Foundation.h>
|
|
12
|
+
|
|
13
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 定义请求完成后的回调 Block。
|
|
18
|
+
* @param data 响应体数据,如果请求失败则为 nil。
|
|
19
|
+
* @param response HTTP响应对象,包含状态码和头信息,如果请求失败则为 nil。
|
|
20
|
+
* @param error 如果请求过程中发生错误,则为具体的错误信息。
|
|
21
|
+
*/
|
|
22
|
+
typedef void (^CellularRequestCompletionHandler)(NSData * _Nullable data, NSHTTPURLResponse * _Nullable response, NSError * _Nullable error);
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@interface APCellularRequest : NSObject
|
|
28
|
+
|
|
29
|
+
/// 请求的URL
|
|
30
|
+
@property (nonatomic, strong) NSURL *url;
|
|
31
|
+
|
|
32
|
+
/// HTTP方法 (e.g., "GET", "POST"). 默认为 "GET".
|
|
33
|
+
@property (nonatomic, copy) NSString *httpMethod;
|
|
34
|
+
|
|
35
|
+
/// 请求体数据,对于GET请求通常为nil
|
|
36
|
+
@property (nonatomic, strong, nullable) NSData *httpBody;
|
|
37
|
+
|
|
38
|
+
/// 请求头字典
|
|
39
|
+
@property (nonatomic, strong, nullable) NSDictionary<NSString *, NSString *> *allHTTPHeaderFields;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* 便利初始化方法,用于创建一个简单的GET请求。
|
|
43
|
+
* @param url 请求的URL。
|
|
44
|
+
*/
|
|
45
|
+
- (instancetype)initWithURL:(NSURL *)url;
|
|
46
|
+
|
|
47
|
+
@end
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* 一个专门用于通过蜂窝网络强制发送HTTPS请求的客户端。
|
|
52
|
+
*
|
|
53
|
+
* 注意:此类不处理HTTP重定向、Cookie、缓存等高级功能。
|
|
54
|
+
* 它仅用于在Wi-Fi和蜂窝网络同时可用时,强制通过蜂窝网络进行简单的GET请求。
|
|
55
|
+
*/
|
|
56
|
+
@interface APCellularHTTPSClient : NSObject
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* 发送一个HTTPS GET请求,并强制其通过蜂窝网络。
|
|
60
|
+
*
|
|
61
|
+
* @param request 要请求的URL,必须是https协议。
|
|
62
|
+
* @param completionHandler 请求完成后的回调。
|
|
63
|
+
*/
|
|
64
|
+
- (void)sendRequest:(APCellularRequest *)request completion:(CellularRequestCompletionHandler)completionHandler;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* 取消当前正在进行的请求。
|
|
68
|
+
*/
|
|
69
|
+
- (void)cancel;
|
|
70
|
+
|
|
71
|
+
@end
|
|
72
|
+
|
|
73
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//
|
|
2
|
+
// APDeductSDK.h
|
|
3
|
+
// APDeductSDK
|
|
4
|
+
//
|
|
5
|
+
// Created by mingsheng on 2024/9/26.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
#import "AFServiceCenter.h"
|
|
10
|
+
|
|
11
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
12
|
+
// 代扣SDK版本
|
|
13
|
+
extern NSString *const kDeductSDKVersion;
|
|
14
|
+
|
|
15
|
+
@interface APDeductSDK : NSObject
|
|
16
|
+
/**
|
|
17
|
+
* 独立签约
|
|
18
|
+
*
|
|
19
|
+
* @param signParams 签约字符串
|
|
20
|
+
* @param schemeStr 调用签约的app注册在info.plist中的scheme
|
|
21
|
+
* @param universalLink 调用签约的app注册的universalLink
|
|
22
|
+
* @param block 签约结果回调Block
|
|
23
|
+
*/
|
|
24
|
+
+ (void)callDeduct:(NSString *)signParams fromScheme:(NSString *)schemeStr fromUniversalLink:(NSString *)universalLink andCompletion:(AFServiceResultBlock)block;
|
|
25
|
+
@end
|
|
26
|
+
|
|
27
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//
|
|
2
|
+
// APAuthInfo.h
|
|
3
|
+
// APAuth
|
|
4
|
+
//
|
|
5
|
+
// Created by antfin on 17-10-24.
|
|
6
|
+
// Copyright (c) 2017年 AntFin. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import <Foundation/Foundation.h>
|
|
10
|
+
|
|
11
|
+
@interface APayAuthInfo : NSObject
|
|
12
|
+
|
|
13
|
+
@property(nonatomic, copy)NSString *appID;
|
|
14
|
+
@property(nonatomic, copy)NSString *pid;
|
|
15
|
+
@property(nonatomic, copy)NSString *redirectUri;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 初始化AuthInfo
|
|
19
|
+
*
|
|
20
|
+
* @param appIDStr 应用ID
|
|
21
|
+
* @param pidStr 商户ID 可不填
|
|
22
|
+
* @param uriStr 授权的应用回调地址 比如:alidemo://auth
|
|
23
|
+
*
|
|
24
|
+
* @return authinfo实例
|
|
25
|
+
*/
|
|
26
|
+
- (id)initWithAppID:(NSString *)appIDStr
|
|
27
|
+
pid:(NSString *)pidStr
|
|
28
|
+
redirectUri:(NSString *)uriStr;
|
|
29
|
+
|
|
30
|
+
- (NSString *)description;
|
|
31
|
+
- (NSString *)wapDescription;
|
|
32
|
+
|
|
33
|
+
@end
|