单军华
2016-12-30 e05aab7eeb55ede6fe6226e41c65b6bfad65957e
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
159
160
161
162
163
//
//  Pingpp.h
//  Pingpp
//
//  Created by afon on 14/11/20.
//
#ifndef Pingpp_Pingpp_h
#define Pingpp_Pingpp_h
 
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
 
typedef NS_ENUM(NSUInteger, PingppErrorOption)
{
    PingppErrInvalidCharge,
    PingppErrInvalidCredential,
    PingppErrInvalidChannel,
    PingppErrWxNotInstalled,
    PingppErrWxAppNotSupported,
    PingppErrCancelled,
    PingppErrUnknownCancel,
    PingppErrViewControllerIsNil,
    PingppErrTestmodeNotifyFailed,
    PingppErrChannelReturnFail,
    PingppErrConnectionError,
    PingppErrUnknownError,
    PingppErrActivation,
    PingppErrRequestTimeOut,
    PingppErrProcessing,
    PingppErrQqNotInstalled,
};
 
typedef NS_ENUM(NSUInteger, PingppRequestContentTypeOption) {
    PingppRequestContentTypeJSON,
    PingppRequestContentTypeForm
};
 
@interface PingppError : NSObject
 
@property(readonly, assign) PingppErrorOption code;
 
- (NSString *)getMsg;
 
@end
 
 
typedef void (^PingppCompletion)(NSString *result, PingppError *error);
 
 
@interface Pingpp : NSObject
 
/**
 *  支付调用接口
 *
 *  @param charge           Charge 对象(JSON 格式字符串 或 NSDictionary)
 *  @param viewController   银联渠道需要
 *  @param scheme           URL Scheme,支付宝渠道回调需要
 *  @param completionBlock  支付结果回调 Block
 */
+ (void)createPayment:(NSObject *)charge viewController:(UIViewController*)viewController appURLScheme:(NSString *)scheme withCompletion:(PingppCompletion)completionBlock;
 
/**
 *  支付调用接口(支付宝/微信)
 *
 *  @param charge           Charge 对象(JSON 格式字符串 或 NSDictionary)
 *  @param scheme           URL Scheme,支付宝渠道回调需要
 *  @param completionBlock  支付结果回调 Block
 */
+ (void)createPayment:(NSObject *)charge appURLScheme:(NSString *)scheme withCompletion:(PingppCompletion)completion;
 
/**
 *  回调结果接口(支付宝/微信/测试模式)
 *
 *  @param url              结果url
 *  @param completionBlock  支付结果回调 Block,保证跳转支付过程中,当 app 被 kill 掉时,能通过这个接口得到支付结果
 *
 *  @return                 当无法处理 URL 或者 URL 格式不正确时,会返回 NO。
 */
+ (BOOL)handleOpenURL:(NSURL *)url withCompletion:(PingppCompletion)completion;
 
/**
 *  回调结果接口(支付宝/微信/测试模式)
 *
 *  @param url                结果url
 *  @param sourceApplication  源应用 Bundle identifier
 *  @param completionBlock    支付结果回调 Block,保证跳转支付过程中,当 app 被 kill 掉时,能通过这个接口得到支付结果
 *
 *  @return                   当无法处理 URL 或者 URL 格式不正确时,会返回 NO。
 */
+ (BOOL)handleOpenURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication withCompletion:(PingppCompletion)completion;
 
/**
 *  版本号
 *
 *  @return         Pingpp SDK 版本号
 */
+ (NSString *)version;
 
/**
 *  设置 Debug 模式
 *
 *  @param enabled    是否启用
 */
+ (void)setDebugMode:(BOOL)enabled;
 
/**
*  web渠道支付成功后点击 "返回商户" 直接关闭支付页面
*  @enabled        是否启用
*/
+ (void)ignoreResultUrl:(BOOL)enabled;
 
/**
 *  设置 App ID
 *  @param  appId  Ping++ 的应用 ID,请登录 https://dashboard.pingxx.com 查看
 */
+ (void)setAppId:(NSString *)appId;
 
+ (NSString *)appId;
 
/**
 *  设置请求的 Content-Type
 *  @param  type  可设置为 JSON 或 Form,默认为 JSON
 */
+ (void)setRequestContentType:(PingppRequestContentTypeOption)type;
 
+ (PingppRequestContentTypeOption)requestContentType;
 
/**
 *  允许 https 自签证书,当你的 chargeURL 为 https 且为自签证书时使用该方法设置
 *  @param  allowInvalidCertificates BOOL
 */
+ (void)setAllowInvalidCertificates:(BOOL)allowInvalidCertificates;
 
+ (BOOL)allowInvalidCertificates;
 
/**
 *  设置网络请求延时(使用壹收款或者应用内快捷支付时有用)
 *
 *  @param timeout  延时时间,单位:秒
 */
+ (void)setNetworkTimeout:(NSTimeInterval)timeout;
 
/**
 *  设置百度钱包导航条背景
 */
+ (void)setBdWalletNavBgImage:(UIImage *)image;
 
/**
 *  设置百度钱包返回键Normal图像
 */
+ (void)setBdWalletNavBackNormalImage:(UIImage *)image;
 
/**
 *  设置百度钱包Title颜色
 */
+ (void)setBdWalletNavTitleColor:(UIColor *)color;
 
/**
 * 设置webView navigationItem 颜色
 */
+ (void)setWebViewItemColor:(UIColor *)itemColor buttonColor:(UIColor*)bntColor;
@end
#endif