BDNCashierSDKObject.h
6.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
//
// BDNCashierSDKObject.h
// BainuoCashierSDK
//
// Created by Jack on 2019/7/30.
// Copyright © 2019 Baidu. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
/**
* @brief 运行环境
*/
typedef NS_ENUM(NSUInteger, BDNCashierEnvironment) {
BDNCashierEnvironmentOL = 0, // 线上正式环境
BDNCashierEnvironmentQA = 1, // 线下测试环境
};
/**
* @brief 支付渠道响应结果
*/
typedef NS_ENUM(NSUInteger, BDNCashierPaymentRespCode) {
BDNCashierPaymentRespCodeSucceeded = 0, // 支付成功
BDNCashierPaymentRespCodeLoading = 1, // 支付中
BDNCashierPaymentRespCodeCanceled = 2, // 支付取消
BDNCashierPaymentRespCodeFailed = 3, // 支付失败
BDNCashierPaymentRespCodeRepeat = 4, // 重复请求
BDNCashierPaymentRespCodeUnknown = 5, // 支付结果未知
BDNCashierPaymentRespCodeDoubleCheck = 6, // 支付结果查询失败,请重试
};
/**
* @brief 收银台响应结果
*/
typedef NS_ENUM(NSUInteger, BDNCashierRespCode) {
BDNCashierRespCodeSucceeded = 0, // 收银台正常调起,进入支付流程
BDNCashierRespCodeInterrupted = 1, // 收银台被打断(如启动了另一个收银台)
BDNCashierRespCodeUserCanceled = 2, // 收银台被用户主动关闭
BDNCashierRespCodeFetchPaymentChannelFailed = 3, // 拉取支付渠道失败
BDNCashierRespCodeCreateOrderFailed = 4, // 创建订单失败
BDNCashierRespCodeOthersFailed = 5, // 其他错误
BDNCashierRespCodeDoubleCheck = BDNCashierPaymentRespCodeDoubleCheck,
} __deprecated_msg("Please use BDNCashierPaymentRespCode, BDNCashierRespCode will be unavailable after SDK version 2.6.0");
/**
* @brief 支付渠道
*/
typedef NSString BDNCashierPaymentChannel;
/// 支付宝
extern BDNCashierPaymentChannel * const BDNCashierPaymentChannelAlipay;
/// 微信
extern BDNCashierPaymentChannel * const BDNCashierPaymentChannelWechat;
/// 百付宝(原百度钱包,现度小满)
extern BDNCashierPaymentChannel * const BDNCashierPaymentChannelBaifubao;
/// 支付宝花呗
extern BDNCashierPaymentChannel * const BDNCashierPaymentChannelAlipayHuaBei;
/// 支付宝花呗分期
extern BDNCashierPaymentChannel * const BDNCashierPaymentChannelAlipayHuaBeiInstallment;
/// 百度闪付
extern BDNCashierPaymentChannel * const BDNCashierPaymentChannelBaiduQuickPay;
/// ApplePay(暂不支持该支付渠道)
extern BDNCashierPaymentChannel * const BDNCashierPaymentChannelApplePay;
/// 银联云闪付支付渠道
extern BDNCashierPaymentChannel * const BDNCashierPaymentChannelUPPay;
/**
* @brief 支付结果回调中的字典所包含的键值
*/
typedef NSString BDNCashierResponseKey;
/// 收银台响应结果,NSNumber类型,描述收银台响应结果(对应枚举:BDNCashierRespCode)
extern BDNCashierResponseKey * const BDNCashierRespCodeKey __deprecated_msg("Please use BDNCashierPaymentRespCodeKey, BDNCashierRespCodeKey will be unavailable after SDK version 2.6.0");
/// 收银台描述文案,NSString类型,描述收银台响应结果
extern BDNCashierResponseKey * const BDNCashierRespMsgKey __deprecated_msg("Please use BDNCashierPaymentRespMsgKey, BDNCashierRespMsgKey will be unavailable after SDK version 2.6.0");
/// 支付渠道响应结果,NSNumber类型,描述支付渠道响应结果(对应枚举:BDNCashierPaymentRespCode)
extern BDNCashierResponseKey * const BDNCashierPaymentRespCodeKey;
/// 支付渠道描述文案,NSString类型,描述支付渠道响应结果
extern BDNCashierResponseKey * const BDNCashierPaymentRespMsgKey;
/// 支付渠道描述文案,NSDictionary 类型,额外信息,如智能小程序直连支付
extern BDNCashierResponseKey * const BDNCashierPaymentRespDataKey;
/**
* @brief 反作弊参数协议
*/
@protocol BDNCashierSDKAntiFraudProcotol <NSObject>
@required;
/// 安全sdk唯一标识zid,App调用安全sdk接口获取(端内活动zid为空会直接拒绝,请重视此参数)
@property (nonatomic, copy) NSString *zid;
@optional;
/// 百度cuid,百度系用户必选(端内活动cuid为空会直接拒绝,请重视此参数)
@property (nonatomic, copy) NSString *cuid;
/// iOS设备的IDFV(尽量获取,不传可能影响防刷效果)
@property (nonatomic, copy) NSString *idfv;
/// iOS设备的IDFA(尽量获取,不传可能影响防刷效果)
@property (nonatomic, copy) NSString *idfa;
/// App所属平台(ios / android / universe)
@property (nonatomic, copy) NSString *platform;
/// App版本号
@property (nonatomic, copy) NSString *version;
@end
/**
* @brief 调起收银台服务所需数据的模型封装,方便传递和扩展
*/
@protocol BDNCashierSDKDelegate;
@protocol BDNCashierSDKPaymentServiceProtocol;
@protocol BDNCashierSDKAntiFraudProcotol;
@interface BDNCashierDealReq : NSObject
typedef void(^BDNCashierPaymentCallback)(NSDictionary *info);
/// 订单参数
@property (nonatomic, copy) NSDictionary *params;
/// 需要禁止的支付渠道
@property (nonatomic, copy) NSArray <BDNCashierPaymentChannel *> *bannedChannels;
/// 反作弊参数
@property (nonatomic, strong) id <BDNCashierSDKAntiFraudProcotol> antiFraud;
/// 用于微信H5支付回跳宿主App,URL Schemes一定要是在微信平台的H5支付中注册配置的授权域名(若无此需求,可不传)
@property (nonatomic, copy) NSString *schemeForWechatH5Pay;
/// 宿主实现的收银台代理对象(目前暂无代理方法需要实现,不传 或 设为nil即可)
@property (nonatomic, weak) id <BDNCashierSDKDelegate> delegate;
/// 支付结果回调(请使用BDNCashierResponseKey提取回调结果中的字典数据)
@property (nonatomic, copy) BDNCashierPaymentCallback completion;
/// 支持传入viewController,用作收银台面板展示时的容器(可选,若不传,则默认新建Window进行展示)
@property (nonatomic, weak) UIViewController *fromViewController;
@end
/**
* @brief 调起收银台优惠券页面所需数据的模型封装,方便传递和扩展
*/
typedef NS_ENUM(NSUInteger, BDNCashierCouponRespCode) {
BDNCashierCouponRespCodeSucceeded = 0,
BDNCashierCouponRespCodeInvalidCouponReq,
BDNCashierCouponRespCodeInvalidCouponReqParams,
BDNCashierCouponRespCodeInvalidCouponReqCompletion
};
extern BDNCashierResponseKey * const BDNCashierCouponRespCodeKey;
extern BDNCashierResponseKey * const BDNCashierCouponRespHasSelectedCouponKey;
extern BDNCashierResponseKey * const BDNCashierCouponRespSelectedCouponKey;
@interface BDNCashierCouponReq : NSObject
typedef void(^BDNCashierCouponCallback)(NSDictionary *info);
@property (nonatomic, copy) NSDictionary *params;
@property (nonatomic, weak) UIViewController *fromViewController;
@property (nonatomic, copy) BDNCashierCouponCallback completion;
@end
extern NSString * const BDNCashierSDKApiErrorDomain;
typedef enum : NSUInteger {
BDNCashierSDKApiInvalidMethodParameter = 666000
} BDNCashierSDKApiErrorType;