tips:根据安排整合支付模块
- 结构说明
LCPayManager 提供了支付方法和一个回掉查看支付结果1
- (void)orderPayMode:(PayWay)payway orderInfo:(LCPayBaseVo *)vo;
其中PayWay是支付方式1
2
3
4
5
6
7typedef NS_ENUM(NSInteger, PayWay)
{
PayWayByAlipay = 1,
PayWayByCMB = 2,
PayWayByCash = 3,
PayWayByUnionPay = 4,
};
vo 是一个存储支付相关信息的类,里面包含基本的商品信息
暂时直邮银联和招商两种支付方式,所以就提供了两种模式1
2LCCMBPayMode
LCUnionPayMode
- 使用
银联1
2
3
4
5LCPayUnionVo *vo = [[LCPayUnionVo alloc]init];
vo.orderid = backHead.tn;
vo.viewController = self;
[LCPayManager sharedInstance].delegate = self;
[[LCPayManager sharedInstance] orderPayMode:PayWayByUnionPay orderInfo:vo];
招商1
2
3
4
5
6
7
8
9
10
11LCPayManager *ma = [LCPayManager sharedInstance];
ma.delegate = self;
LCPayCMBVo *vo = [[LCPayCMBVo alloc]init];
vo.branchId = backHead.branchId;
vo.coNo = backHead.coNo;
vo.orderid = backHead.billNo;
vo.amount = backHead.amount;
vo.date = backHead.date;
vo.merchantUrl = backHead.merchantUrl;
vo.merchantPara = backHead.merchantPara;
[ma orderPayMode:PayWayByCMB orderInfo:vo];
所有的支付结果在中反回1
2
3
4 - (void)didFinishPayWithResult:(NSString *)result
{
NSLog(@"didFinishPayWithResult is %@",result);
}
因为CMB是跳外部浏览器的,所以在AppDelegate中也要做相应处理- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
添加[LCPayManager sharedInstance].mresult的赋值