Commit dfc22a0f6d2a19a175e5f2a8ce5eaefb6322491a
1 parent
8cfe57b8
0.0.3
Showing
23 changed files
with
763 additions
and
168 deletions
CNLivePayCostModule.podspec
| @@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
| 8 | 8 | ||
| 9 | Pod::Spec.new do |s| | 9 | Pod::Spec.new do |s| |
| 10 | s.name = 'CNLivePayCostModule' | 10 | s.name = 'CNLivePayCostModule' |
| 11 | - s.version = '0.0.2' | 11 | + s.version = '0.0.3' |
| 12 | s.summary = 'A short description of CNLivePayCostModule.' | 12 | s.summary = 'A short description of CNLivePayCostModule.' |
| 13 | 13 | ||
| 14 | # This description is used to generate tags and improve search results. | 14 | # This description is used to generate tags and improve search results. |
| @@ -30,7 +30,8 @@ TODO: Add long description of the pod here. | @@ -30,7 +30,8 @@ TODO: Add long description of the pod here. | ||
| 30 | 30 | ||
| 31 | s.ios.deployment_target = '10.0' | 31 | s.ios.deployment_target = '10.0' |
| 32 | 32 | ||
| 33 | - s.source_files = 'CNLivePayCostModule/Classes/**/*' | 33 | +# s.source_files = 'CNLivePayCostModule/Classes/**/*' s.public_header_files |
| 34 | + s.source_files = "CNLivePayCostModule/Classes/Core/*.{h,m}","CNLivePayCostModule/Classes/View/*.{h,m}","CNLivePayCostModule/Classes/UMSPosPayOnly/include/*.h","CNLivePayCostModule/Classes/UPPaymentControl/*.h" | ||
| 34 | 35 | ||
| 35 | s.static_framework = true | 36 | s.static_framework = true |
| 36 | 37 | ||
| @@ -39,6 +40,8 @@ TODO: Add long description of the pod here. | @@ -39,6 +40,8 @@ TODO: Add long description of the pod here. | ||
| 39 | } | 40 | } |
| 40 | 41 | ||
| 41 | # s.public_header_files = 'Pod/Classes/**/*.h' | 42 | # s.public_header_files = 'Pod/Classes/**/*.h' |
| 43 | + s.vendored_libraries = 'CNLivePayCostModule/Classes/UMSPosPayOnly/*.a',"CNLivePayCostModule/Classes/UPPaymentControl/*.a" | ||
| 44 | + | ||
| 42 | 45 | ||
| 43 | #基础库导入 | 46 | #基础库导入 |
| 44 | s.frameworks = 'UIKit', 'MapKit' | 47 | s.frameworks = 'UIKit', 'MapKit' |
CNLivePayCostModule/Assets/CNLivePayCostModule.bundle/ye_zfcg@2x.png
0 → 100644
5.83 KB
CNLivePayCostModule/Assets/CNLivePayCostModule.bundle/ye_zfcg@3x.png
0 → 100644
8.71 KB
CNLivePayCostModule/Classes/Core/CNLivePayCostHeader.h
| @@ -17,8 +17,8 @@ typedef enum : NSUInteger { | @@ -17,8 +17,8 @@ typedef enum : NSUInteger { | ||
| 17 | CNLivePayCostTypeSweep,//扫码支付 | 17 | CNLivePayCostTypeSweep,//扫码支付 |
| 18 | CNLivePayCostTypeTicke,//门票支付 | 18 | CNLivePayCostTypeTicke,//门票支付 |
| 19 | CNLivePayCostTypeSHShop,//上海电商支付 | 19 | CNLivePayCostTypeSHShop,//上海电商支付 |
| 20 | - CNLivePayCostTypeMall,//商城支付 | ||
| 21 | - CNLivePayCostTypeBDMini,//百度小程序支付 | 20 | + CNLivePayCostTypeMall,//商城支付 未用 |
| 21 | + CNLivePayCostTypeBDMini,//百度小程序支付 未用 | ||
| 22 | CNLivePayCostTypeCommunt,//社区支付 | 22 | CNLivePayCostTypeCommunt,//社区支付 |
| 23 | CNLivePayCostTypeHtml,//网页拉起支付 | 23 | CNLivePayCostTypeHtml,//网页拉起支付 |
| 24 | } CNLivePayCostType; | 24 | } CNLivePayCostType; |
| @@ -37,7 +37,7 @@ typedef enum { | @@ -37,7 +37,7 @@ typedef enum { | ||
| 37 | } CNLivePayCostPayType; | 37 | } CNLivePayCostPayType; |
| 38 | 38 | ||
| 39 | typedef enum { | 39 | typedef enum { |
| 40 | - CNLivePayCostThreePayTypePayment = 1,//群收款 | 40 | + CNLivePayCostThreePayTypePayment = 1,//群收款 |
| 41 | CNLivePayCostThreePayTypeOrder = 3, //订单支付 | 41 | CNLivePayCostThreePayTypeOrder = 3, //订单支付 |
| 42 | CNLivePayCostThreePayTypeScren = 2, //扫码支付 | 42 | CNLivePayCostThreePayTypeScren = 2, //扫码支付 |
| 43 | CNLivePayCostThreePayTypeTicke = 4, //门票支付 | 43 | CNLivePayCostThreePayTypeTicke = 4, //门票支付 |
| @@ -96,4 +96,7 @@ typedef enum { | @@ -96,4 +96,7 @@ typedef enum { | ||
| 96 | #import "UMSPPPayUnifyPayPlugin.h" | 96 | #import "UMSPPPayUnifyPayPlugin.h" |
| 97 | //商务全名付 银联 | 97 | //商务全名付 银联 |
| 98 | #import "UPPaymentControl.h" | 98 | #import "UPPaymentControl.h" |
| 99 | +//商务全民付 设置 | ||
| 100 | +#import "UMSPPPayPluginSettings.h" | ||
| 101 | + | ||
| 99 | #endif /* CNLivePayCostHeader_h */ | 102 | #endif /* CNLivePayCostHeader_h */ |
CNLivePayCostModule/Classes/Core/CNLivePayCostModel.h
| @@ -11,7 +11,7 @@ | @@ -11,7 +11,7 @@ | ||
| 11 | #import "CNLivePayCostContentView.h" | 11 | #import "CNLivePayCostContentView.h" |
| 12 | NS_ASSUME_NONNULL_BEGIN | 12 | NS_ASSUME_NONNULL_BEGIN |
| 13 | 13 | ||
| 14 | -@interface CNLivePayCostModel : NSObject | 14 | +@interface CNLivePayCostModel : NSObject<WXApiDelegate> |
| 15 | 15 | ||
| 16 | +(instancetype)sharePayCostModel; | 16 | +(instancetype)sharePayCostModel; |
| 17 | 17 |
CNLivePayCostModule/Classes/Core/CNLivePayCostModel.m
| @@ -32,6 +32,16 @@ | @@ -32,6 +32,16 @@ | ||
| 32 | return self; | 32 | return self; |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | + | ||
| 36 | +- (void)onResp:(BaseResp*)resp { | ||
| 37 | + //处理微信分享等功能 | ||
| 38 | + if ([resp isKindOfClass:[WXLaunchMiniProgramResp class]]) { | ||
| 39 | + NSDictionary * exDict = [((WXLaunchMiniProgramResp *)resp).extMsg mj_JSONObject]; | ||
| 40 | + [[NSNotificationCenter defaultCenter] postNotificationName:@"kCNLiveLaunchMiniResultNotification" object:nil userInfo:exDict]; | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | +} | ||
| 44 | + | ||
| 35 | + (NSString *)payCost_getRandomOrderId { | 45 | + (NSString *)payCost_getRandomOrderId { |
| 36 | // appId+渠道+年月日+毫秒数后10位+2位数的随机数 | 46 | // appId+渠道+年月日+毫秒数后10位+2位数的随机数 |
| 37 | NSString *randomOrderId = @""; | 47 | NSString *randomOrderId = @""; |
CNLivePayCostModule/Classes/Core/CNLivePayCostModule.h
| @@ -12,6 +12,8 @@ NS_ASSUME_NONNULL_BEGIN | @@ -12,6 +12,8 @@ NS_ASSUME_NONNULL_BEGIN | ||
| 12 | 12 | ||
| 13 | @interface CNLivePayCostModule : NSObject | 13 | @interface CNLivePayCostModule : NSObject |
| 14 | 14 | ||
| 15 | +/// 启动设置 | ||
| 16 | ++(void)finishLaunchingWithPayPluginSettings; | ||
| 15 | 17 | ||
| 16 | /// 拉起网家家支付功能 | 18 | /// 拉起网家家支付功能 |
| 17 | /// @param paramDict 参数 (详细见.m中参数解释) | 19 | /// @param paramDict 参数 (详细见.m中参数解释) |
| @@ -31,6 +33,14 @@ NS_ASSUME_NONNULL_BEGIN | @@ -31,6 +33,14 @@ NS_ASSUME_NONNULL_BEGIN | ||
| 31 | FromVC:(UIViewController *)formVC | 33 | FromVC:(UIViewController *)formVC |
| 32 | ResultBlock:(void(^)(CNLivePayCostTypeResult resultType))resultBlock; | 34 | ResultBlock:(void(^)(CNLivePayCostTypeResult resultType))resultBlock; |
| 33 | 35 | ||
| 36 | +/// 拉起电商支付功能 | ||
| 37 | +/// @param paramDict 参数 | ||
| 38 | +/// @param payType 支付界面控制器 | ||
| 39 | +/// @param resultBlock 支付结果 | ||
| 40 | ++(void)showShopPayViwWithParamDict:(NSDictionary *)paramDict | ||
| 41 | + PayType:(CNLivePayCostPayType)payType | ||
| 42 | + ResultBlock:(void(^)(CNLivePayCostTypeResult resultType))resultBlock; | ||
| 43 | + | ||
| 34 | @end | 44 | @end |
| 35 | 45 | ||
| 36 | NS_ASSUME_NONNULL_END | 46 | NS_ASSUME_NONNULL_END |
CNLivePayCostModule/Classes/Core/CNLivePayCostModule.m
| @@ -8,13 +8,23 @@ | @@ -8,13 +8,23 @@ | ||
| 8 | #import "CNLivePayCostModule.h" | 8 | #import "CNLivePayCostModule.h" |
| 9 | #import "CNLivePayCostContentView.h" | 9 | #import "CNLivePayCostContentView.h" |
| 10 | #import "CNLivePayCostModel.h" | 10 | #import "CNLivePayCostModel.h" |
| 11 | + | ||
| 12 | + | ||
| 13 | + | ||
| 11 | @interface CNLivePayCostModule () | 14 | @interface CNLivePayCostModule () |
| 12 | 15 | ||
| 13 | @end | 16 | @end |
| 14 | 17 | ||
| 15 | @implementation CNLivePayCostModule | 18 | @implementation CNLivePayCostModule |
| 16 | 19 | ||
| 17 | - | 20 | +/// 启动设置 |
| 21 | ++(void)finishLaunchingWithPayPluginSettings | ||
| 22 | +{ | ||
| 23 | + [UMSPPPayPluginSettings sharedInstance].umspEnviroment = UMSP_PROD; | ||
| 24 | + | ||
| 25 | + //注册微信支付 | ||
| 26 | + [UMSPPPayUnifyPayPlugin registerApp:WeiChatAppId_Share universalLink:[NSString stringWithFormat:@"%@/",API_Host]]; | ||
| 27 | +} | ||
| 18 | 28 | ||
| 19 | /// 拉起网家家支付功能 | 29 | /// 拉起网家家支付功能 |
| 20 | /// @param paramDict 参数 (详细见.m中参数解释) | 30 | /// @param paramDict 参数 (详细见.m中参数解释) |
| @@ -61,7 +71,8 @@ | @@ -61,7 +71,8 @@ | ||
| 61 | payModel.orderId = [paramDict stringValueForKey:@"orderId" default:@""]; | 71 | payModel.orderId = [paramDict stringValueForKey:@"orderId" default:@""]; |
| 62 | payModel.userId = [paramDict stringValueForKey:@"userId" default:@""]; | 72 | payModel.userId = [paramDict stringValueForKey:@"userId" default:@""]; |
| 63 | payModel.expand = [@{@"fromType":@"1",@"toType":@"3",@"sourceType":@"order"} mj_JSONString]; | 73 | payModel.expand = [@{@"fromType":@"1",@"toType":@"3",@"sourceType":@"order"} mj_JSONString]; |
| 64 | - payModel.descStr = [paramDict stringValueForKey:@"userId" default:@""]; | 74 | + payModel.descStr = [paramDict stringValueForKey:@"descStr" default:@""]; |
| 75 | + payModel.notifyUrl = [paramDict stringValueForKey:@"notifyUrl" default:@""]; | ||
| 65 | payModel.price = [paramDict floatValueForKey:@"price" default:0.00]; | 76 | payModel.price = [paramDict floatValueForKey:@"price" default:0.00]; |
| 66 | if ([[paramDict stringValueForKey:@"orderType" default:@""] isEqualToString:@"3"]) payModel.isHiddenWjjpay =YES; | 77 | if ([[paramDict stringValueForKey:@"orderType" default:@""] isEqualToString:@"3"]) payModel.isHiddenWjjpay =YES; |
| 67 | payModel.payType = payCostType; | 78 | payModel.payType = payCostType; |
| @@ -89,14 +100,13 @@ | @@ -89,14 +100,13 @@ | ||
| 89 | payModel.payType = payCostType; | 100 | payModel.payType = payCostType; |
| 90 | } | 101 | } |
| 91 | //社区支付 | 102 | //社区支付 |
| 92 | - if (payCostType == CNLivePayCostTypeSHShop) { | 103 | + if (payCostType == CNLivePayCostTypeCommunt) { |
| 93 | payModel.orderId = [paramDict stringValueForKey:@"orderId" default:@""]; | 104 | payModel.orderId = [paramDict stringValueForKey:@"orderId" default:@""]; |
| 94 | payModel.isHiddenWjjpay = YES; | 105 | payModel.isHiddenWjjpay = YES; |
| 95 | payModel.price = [paramDict floatValueForKey:@"price" default:1]; | 106 | payModel.price = [paramDict floatValueForKey:@"price" default:1]; |
| 96 | payModel.descStr = [paramDict stringValueForKey:@"body" default:@"网家家"]; | 107 | payModel.descStr = [paramDict stringValueForKey:@"body" default:@"网家家"]; |
| 97 | payModel.attach = @{@"plat":@"i"}; | 108 | payModel.attach = @{@"plat":@"i"}; |
| 98 | payModel.notifyUrl = [paramDict stringValueForKey:@"notifyUrl" default:@""]; | 109 | payModel.notifyUrl = [paramDict stringValueForKey:@"notifyUrl" default:@""]; |
| 99 | - | ||
| 100 | } | 110 | } |
| 101 | //网页支付 | 111 | //网页支付 |
| 102 | if (payCostType == CNLivePayCostTypeHtml) { | 112 | if (payCostType == CNLivePayCostTypeHtml) { |
| @@ -126,14 +136,23 @@ | @@ -126,14 +136,23 @@ | ||
| 126 | 136 | ||
| 127 | if ([[CNUserInfoManager manager].userInfoModel.unionUserStatus isEqualToString:@"3"]) payModel.isHiddenWjjpay = YES; | 137 | if ([[CNUserInfoManager manager].userInfoModel.unionUserStatus isEqualToString:@"3"]) payModel.isHiddenWjjpay = YES; |
| 128 | 138 | ||
| 129 | - CNLivePayCostContentView * payCostView = [[CNLivePayCostContentView alloc] initWithFrame:AppKeyWindow.bounds PayModel:payModel FromVC:formVC CompleterBlock:^(CNLivePayCostType resultType) { | ||
| 130 | - if (resultBlock && resultType == CNLivePayCostTypeResultSucc) resultBlock(CNLivePayCostTypeResultSucc); | 139 | + CNLivePayCostContentView * payCostView = [[CNLivePayCostContentView alloc] initWithFrame:AppKeyWindow.bounds PayModel:payModel FromVC:formVC CompleterBlock:^(CNLivePayCostTypeResult resultType) { |
| 140 | + if (resultBlock) resultBlock(resultType); | ||
| 131 | }]; | 141 | }]; |
| 132 | [AppKeyWindow addSubview:payCostView]; | 142 | [AppKeyWindow addSubview:payCostView]; |
| 133 | [payCostView show]; | 143 | [payCostView show]; |
| 134 | 144 | ||
| 135 | - //支付成功通知回调 | ||
| 136 | - [[NSNotificationCenter defaultCenter] addObserver:payCostView selector:@selector(resultPayAction:) name:@"kIMAMSG_ScanPaySuccessNotification" object:nil]; | 145 | + if (payCostType == CNLivePayCostTypeCommunt) { |
| 146 | + //社区支付结果回调 | ||
| 147 | + [[NSNotificationCenter defaultCenter] addObserver:payCostView selector:@selector(resultPayAction:) name:@"kIMAMSG_CommunityPaySuccessNotification" object:nil]; | ||
| 148 | + }else if (payCostType == CNLivePayCostTypeSweep) { | ||
| 149 | + //二维码识别结果回调 | ||
| 150 | + [[NSNotificationCenter defaultCenter] addObserver:payCostView selector:@selector(resultPayAction:) name:@"CNLiveContentSweepPaymentNotification" object:nil]; | ||
| 151 | + }else{ | ||
| 152 | + //支付成功通知回调 | ||
| 153 | + [[NSNotificationCenter defaultCenter] addObserver:payCostView selector:@selector(resultPayAction:) name:@"kIMAMSG_ScanPaySuccessNotification" object:nil]; | ||
| 154 | + } | ||
| 155 | + | ||
| 137 | } | 156 | } |
| 138 | 157 | ||
| 139 | /// 拉起苹果支付功能 | 158 | /// 拉起苹果支付功能 |
| @@ -182,4 +201,29 @@ | @@ -182,4 +201,29 @@ | ||
| 182 | }); | 201 | }); |
| 183 | }]; | 202 | }]; |
| 184 | } | 203 | } |
| 204 | + | ||
| 205 | +/// 拉起电商支付功能 | ||
| 206 | +/// @param paramDict 参数 | ||
| 207 | +/// @param payType 支付界面控制器 | ||
| 208 | +/// @param resultBlock 支付结果 | ||
| 209 | ++(void)showShopPayViwWithParamDict:(NSDictionary *)paramDict | ||
| 210 | + PayType:(CNLivePayCostPayType)payType | ||
| 211 | + ResultBlock:(void(^)(CNLivePayCostTypeResult resultType))resultBlock | ||
| 212 | +{ | ||
| 213 | + NSString * orderId = [paramDict stringValueForKey:@"orderId" default:@""]; | ||
| 214 | + NSString * body = [paramDict stringValueForKey:@"body" default:@""]; | ||
| 215 | + NSString * price = [paramDict stringValueForKey:@"price" default:@"0.00"]; | ||
| 216 | + NSString * couponFee = [paramDict stringValueForKey:@"coupon_fee" default:@"0.00"]; | ||
| 217 | + NSString * balanceFee = [paramDict stringValueForKey:@"balance_fee" default:@"0.00"]; | ||
| 218 | + NSString * notifyUrl = [paramDict stringValueForKey:@"notifyUrl" default:@""]; | ||
| 219 | + NSString * password = [paramDict stringValueForKey:@"password" default:@""]; | ||
| 220 | + | ||
| 221 | + NSString * p = [NSString stringWithFormat:@"%d",(NSInteger)([price floatValue]*100)]; | ||
| 222 | + | ||
| 223 | + [CNLivePayCostNetwork requestWithUMSPayForPrePayWithOrderId:orderId Body:body Price:p CouponFee:couponFee BalanceFee:balanceFee NotifyUrl:notifyUrl Type:payType FrmId:@"debug" PassWord:password CompleterBlcok:^(NSInteger statue) { | ||
| 224 | + if (resultBlock) { | ||
| 225 | + if (statue == 0) resultBlock(statue == 0?CNLivePayCostTypeResultSucc:CNLivePayCostTypeResultFail); | ||
| 226 | + } | ||
| 227 | + }]; | ||
| 228 | +} | ||
| 185 | @end | 229 | @end |
CNLivePayCostModule/Classes/Core/CNLivePayCostNetwork.h
| @@ -22,6 +22,27 @@ NS_ASSUME_NONNULL_BEGIN | @@ -22,6 +22,27 @@ NS_ASSUME_NONNULL_BEGIN | ||
| 22 | /// 支付id | 22 | /// 支付id |
| 23 | @property (nonatomic, copy) NSString * payId; | 23 | @property (nonatomic, copy) NSString * payId; |
| 24 | 24 | ||
| 25 | +/// 调用维金支付之前的预支付订单 | ||
| 26 | +/// @param orderId 订单id | ||
| 27 | +/// @param body 订单信息 | ||
| 28 | +/// @param price 价格 | ||
| 29 | +/// @param coupon_fee 优惠券金额 | ||
| 30 | +/// @param balance_fee 余额金额 | ||
| 31 | +/// @param notify_url 服务端回调地址 | ||
| 32 | +/// @param type 支付方式 3:支付宝,4:余额,9:云闪付 | ||
| 33 | +/// @param frmId 渠道id | ||
| 34 | +/// param completerBlock 返回 | ||
| 35 | ++(void)requestWithUMSPayForPrePayWithOrderId:(NSString *)orderId | ||
| 36 | + Body:(NSString *)body | ||
| 37 | + Price:(NSString *)price | ||
| 38 | + CouponFee:(NSString *)coupon_fee | ||
| 39 | + BalanceFee:(NSString *)balance_fee | ||
| 40 | + NotifyUrl:(NSString *)notify_url | ||
| 41 | + Type:(CNLivePayCostPayType)type | ||
| 42 | + FrmId:(NSString *)frmId | ||
| 43 | + PassWord:(NSString *)password | ||
| 44 | + CompleterBlcok:(void(^)(NSInteger statue))completerBlock; | ||
| 45 | + | ||
| 25 | /** | 46 | /** |
| 26 | 拉起支付接口,调起支付动作 | 47 | 拉起支付接口,调起支付动作 |
| 27 | 48 | ||
| @@ -53,6 +74,8 @@ NS_ASSUME_NONNULL_BEGIN | @@ -53,6 +74,8 @@ NS_ASSUME_NONNULL_BEGIN | ||
| 53 | @param expand 扩展字段 | 74 | @param expand 扩展字段 |
| 54 | @param sourceId 资源 ID | 75 | @param sourceId 资源 ID |
| 55 | @param payId 支付 ID | 76 | @param payId 支付 ID |
| 77 | + @param desc 描述 | ||
| 78 | + @param notifyUrl 回调地址 | ||
| 56 | @param password 支付密码 | 79 | @param password 支付密码 |
| 57 | @param completerBlock 支付结果返回 | 80 | @param completerBlock 支付结果返回 |
| 58 | */ | 81 | */ |
| @@ -62,6 +85,8 @@ NS_ASSUME_NONNULL_BEGIN | @@ -62,6 +85,8 @@ NS_ASSUME_NONNULL_BEGIN | ||
| 62 | Expand:(NSString *)expand | 85 | Expand:(NSString *)expand |
| 63 | SourceId:(NSString *)sourceId | 86 | SourceId:(NSString *)sourceId |
| 64 | PayId:(NSString *)payId | 87 | PayId:(NSString *)payId |
| 88 | + Desc:(NSString *)desc | ||
| 89 | + NotifyUrl:(NSString *)notifyUrl | ||
| 65 | PassWord:(NSString *)password | 90 | PassWord:(NSString *)password |
| 66 | CompleterBlock:(void (^)(NSInteger))completerBlock; | 91 | CompleterBlock:(void (^)(NSInteger))completerBlock; |
| 67 | 92 | ||
| @@ -71,6 +96,9 @@ NS_ASSUME_NONNULL_BEGIN | @@ -71,6 +96,9 @@ NS_ASSUME_NONNULL_BEGIN | ||
| 71 | -(void)requestActiveForPasswordWithLocalAmount:(float)amount | 96 | -(void)requestActiveForPasswordWithLocalAmount:(float)amount |
| 72 | CompleterBlock:(void(^)(NSInteger isPassword))completerBlock; | 97 | CompleterBlock:(void(^)(NSInteger isPassword))completerBlock; |
| 73 | 98 | ||
| 99 | +// 获取当前活动的navigationcontroller | ||
| 100 | ++ (UINavigationController *)paycost_navigationViewController; | ||
| 101 | + | ||
| 74 | /// 获取图片 | 102 | /// 获取图片 |
| 75 | /// @param imageName 图片名称 | 103 | /// @param imageName 图片名称 |
| 76 | +(UIImage *)payCost_setImageWithName:(NSString *)imageName; | 104 | +(UIImage *)payCost_setImageWithName:(NSString *)imageName; |
CNLivePayCostModule/Classes/Core/CNLivePayCostNetwork.m
| @@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
| 7 | 7 | ||
| 8 | #import "CNLivePayCostNetwork.h" | 8 | #import "CNLivePayCostNetwork.h" |
| 9 | #import <CNLiveBaseTools/CNLiveTimeTools.h> | 9 | #import <CNLiveBaseTools/CNLiveTimeTools.h> |
| 10 | - | 10 | +#import "CNLivePayCostModel.h" |
| 11 | 11 | ||
| 12 | static NSString *const CNLiveWillBecomeActivePaycostForOrderNotification = @"CNLiveWillBecomeActivePaycostForOrderNotification"; | 12 | static NSString *const CNLiveWillBecomeActivePaycostForOrderNotification = @"CNLiveWillBecomeActivePaycostForOrderNotification"; |
| 13 | static NSString *const CNLiveWillBecomeActivePaycostForGroupNotification = @"CNLiveWillBecomeActivePaycostForGroupNotification"; | 13 | static NSString *const CNLiveWillBecomeActivePaycostForGroupNotification = @"CNLiveWillBecomeActivePaycostForGroupNotification"; |
| @@ -15,6 +15,9 @@ static NSString *const CNLiveWillBecomeActivePaycostForTickeNotification = @"CNL | @@ -15,6 +15,9 @@ static NSString *const CNLiveWillBecomeActivePaycostForTickeNotification = @"CNL | ||
| 15 | static NSString *const CNLiveWillBecomeActivePaycostForScanNotification = @"CNLiveWillBecomeActivePaycostForScanNotification"; | 15 | static NSString *const CNLiveWillBecomeActivePaycostForScanNotification = @"CNLiveWillBecomeActivePaycostForScanNotification"; |
| 16 | static NSString *const CNLiveWillBecomeActivePaycostForSHShopNotification = @"CNLiveWillBecomeActivePaycostForSHShopNotification"; | 16 | static NSString *const CNLiveWillBecomeActivePaycostForSHShopNotification = @"CNLiveWillBecomeActivePaycostForSHShopNotification"; |
| 17 | 17 | ||
| 18 | +#define CNUMSPayWithPrePayApiContentURL (@"https://apiumspay.cnlive.com/app/prePay") | ||
| 19 | +#define CNUMSPayWithBalancePayApiContentURL (@"https://apiumspay.cnlive.com/app/balancePay") | ||
| 20 | + | ||
| 18 | @implementation CNLivePayCostNetwork | 21 | @implementation CNLivePayCostNetwork |
| 19 | 22 | ||
| 20 | +(instancetype)sharePayCostNetWork | 23 | +(instancetype)sharePayCostNetWork |
| @@ -27,6 +30,112 @@ static NSString *const CNLiveWillBecomeActivePaycostForSHShopNotification = @"CN | @@ -27,6 +30,112 @@ static NSString *const CNLiveWillBecomeActivePaycostForSHShopNotification = @"CN | ||
| 27 | return payCostNetWork; | 30 | return payCostNetWork; |
| 28 | } | 31 | } |
| 29 | 32 | ||
| 33 | +#pragma mark = 生成预支付订单 | ||
| 34 | + | ||
| 35 | +/// 调用维金支付之前的预支付订单 | ||
| 36 | +/// @param orderId 订单id | ||
| 37 | +/// @param body 订单信息 | ||
| 38 | +/// @param price 价格 | ||
| 39 | +/// @param coupon_fee 优惠券金额 | ||
| 40 | +/// @param balance_fee 余额金额 | ||
| 41 | +/// @param notify_url 服务端回调地址 | ||
| 42 | +/// @param type 支付方式 3:支付宝,4:余额,9:云闪付 | ||
| 43 | +/// @param frmId 渠道id | ||
| 44 | +/// @param completerBlock 返回 | ||
| 45 | ++(void)requestWithUMSPayForPrePayWithOrderId:(NSString *)orderId | ||
| 46 | + Body:(NSString *)body | ||
| 47 | + Price:(NSString *)price | ||
| 48 | + CouponFee:(NSString *)coupon_fee | ||
| 49 | + BalanceFee:(NSString *)balance_fee | ||
| 50 | + NotifyUrl:(NSString *)notify_url | ||
| 51 | + Type:(CNLivePayCostPayType)type | ||
| 52 | + FrmId:(NSString *)frmId | ||
| 53 | + PassWord:(NSString *)password | ||
| 54 | + CompleterBlcok:(void(^)(NSInteger statue))completerBlock | ||
| 55 | +{ | ||
| 56 | + if (type == CNLivePayCostPayTypeWeChatPay) { | ||
| 57 | + NSString * path = [NSString stringWithFormat:@"pages/pays/pay/pay?appId=%@&body=%@&out_trade_no=%@&user_id=%@&total_fee=%@¬ify_url=%@&type=1&&frmId=ios&&page_url=%@&&coupon_fee=0&&balance_fee=0",AppId,body,orderId,CNUserShareModel.uid?CNUserShareModel.uid:@"",price,notify_url,notify_url]; | ||
| 58 | + NSLog(@"===>%@",path); | ||
| 59 | + WXLaunchMiniProgramReq *launchMiniProgramReq = [WXLaunchMiniProgramReq object]; | ||
| 60 | + launchMiniProgramReq.userName = @"gh_061b347b32c1"; //拉起的小程序的username | ||
| 61 | + launchMiniProgramReq.path = path; | ||
| 62 | + launchMiniProgramReq.miniProgramType = WXMiniProgramTypePreview; | ||
| 63 | + [WXApi sendReq:launchMiniProgramReq completion:^(BOOL success) { | ||
| 64 | + | ||
| 65 | + }]; | ||
| 66 | + }else if (type == CNLivePayCostPayTypeWjjPay) { | ||
| 67 | + | ||
| 68 | + NSDictionary * paramDict = @{ | ||
| 69 | + @"appId":AppId, | ||
| 70 | + @"user_id":CNUserShareModel.uid?CNUserShareModel.uid:@"", | ||
| 71 | + @"out_trade_no":orderId, | ||
| 72 | + @"body":body, | ||
| 73 | + @"coupon_fee":@"0", | ||
| 74 | + @"balance_fee":price, | ||
| 75 | + @"notify_url":notify_url, | ||
| 76 | + @"page_url":@"", | ||
| 77 | + @"type":@"4", | ||
| 78 | + @"password":[NSString md5String:password], | ||
| 79 | + @"frmId":@"ios" | ||
| 80 | + }; | ||
| 81 | + [CNLiveNetworking setAllowRequestDefaultArgument:YES]; | ||
| 82 | + [CNLiveNetworking setupShowDataResult:YES]; | ||
| 83 | + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNUMSPayWithBalancePayApiContentURL Param:paramDict CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | ||
| 84 | + [QMUITips hideAllToastInView:AppKeyWindow animated:YES]; | ||
| 85 | + long errorCode = [responseObject longValueForKey:@"errorCode" default:100]; | ||
| 86 | + NSString * errorMessage = [responseObject stringValueForKey:@"errorMessage" default:@""]; | ||
| 87 | + if (errorCode == 0) { | ||
| 88 | + if (completerBlock) completerBlock(0); | ||
| 89 | + }else{ | ||
| 90 | + [QMUITips showError:[errorMessage isNotBlank]?errorMessage:@"支付失败" inView:AppKeyWindow hideAfterDelay:1.5]; | ||
| 91 | + if (completerBlock) { | ||
| 92 | + if (errorCode == 100011) completerBlock(2); | ||
| 93 | + if (errorCode != 100011) completerBlock(3); | ||
| 94 | + } | ||
| 95 | + } | ||
| 96 | + }]; | ||
| 97 | + | ||
| 98 | + }else{ | ||
| 99 | + NSString * index = @""; | ||
| 100 | + if (type == CNLivePayCostPayTypeAliPay) index = @"3"; | ||
| 101 | + if (type == CNLivePayCostPayTypeUnionPay) index = @"9"; | ||
| 102 | + if (type == CNLivePayCostPayTypeWjjPay) index = @"4"; | ||
| 103 | + NSDictionary * paramDict = @{ | ||
| 104 | + @"appId":AppId, | ||
| 105 | + @"user_id":CNUserShareModel.uid?CNUserShareModel.uid:@"", | ||
| 106 | + @"out_trade_no":orderId, | ||
| 107 | + @"body":body, | ||
| 108 | + @"total_fee":price, | ||
| 109 | + @"coupon_fee":coupon_fee, | ||
| 110 | + @"balance_fee":balance_fee, | ||
| 111 | + @"notify_url":notify_url, | ||
| 112 | + @"page_url":@"", | ||
| 113 | + @"type":index, | ||
| 114 | + @"frmId":frmId | ||
| 115 | + }; | ||
| 116 | + [CNLiveNetworking setupShowResult:YES]; | ||
| 117 | + [CNLiveNetworking setupShowDataResult:NO]; | ||
| 118 | + [CNLiveNetworking setAllowRequestDefaultArgument:YES]; | ||
| 119 | + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNUMSPayWithPrePayApiContentURL Param:paramDict CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | ||
| 120 | + [CNLivePayCostNetwork payCost_chooseRequestWithResponseObject:responseObject Error:error isData:YES CompleterBlock:^(id responseObject, NSInteger errorCode) { | ||
| 121 | + if (responseObject) { | ||
| 122 | + NSString *payDataJsonStr = [[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:responseObject options:NSJSONWritingPrettyPrinted error:nil] encoding:NSUTF8StringEncoding]; | ||
| 123 | + [UMSPPPayUnifyPayPlugin payWithPayChannel:CHANNEL_ALIMINIPAY payData:payDataJsonStr callbackBlock:^(NSString *resultCode, NSString *resultInfo) { | ||
| 124 | + if (completerBlock) { | ||
| 125 | + if ([resultCode isEqualToString:@"0000"]) completerBlock(0); | ||
| 126 | + if ([resultCode isEqualToString:@"1000"]) completerBlock(3);//余额支付取消支付 code1000 | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + }]; | ||
| 130 | + } | ||
| 131 | + }]; | ||
| 132 | + }]; | ||
| 133 | + } | ||
| 134 | +} | ||
| 135 | + | ||
| 136 | + | ||
| 137 | +#pragma mark = 以下为老接口 | ||
| 138 | + | ||
| 30 | /** | 139 | /** |
| 31 | 拉起支付接口,调起支付动作 | 140 | 拉起支付接口,调起支付动作 |
| 32 | 141 | ||
| @@ -49,6 +158,9 @@ static NSString *const CNLiveWillBecomeActivePaycostForSHShopNotification = @"CN | @@ -49,6 +158,9 @@ static NSString *const CNLiveWillBecomeActivePaycostForSHShopNotification = @"CN | ||
| 49 | FormVC:(UIViewController *)formVC | 158 | FormVC:(UIViewController *)formVC |
| 50 | CompleterBlcok:(void(^)(NSInteger statue))completerBlock | 159 | CompleterBlcok:(void(^)(NSInteger statue))completerBlock |
| 51 | { | 160 | { |
| 161 | + | ||
| 162 | + | ||
| 163 | + | ||
| 52 | if ((threeType == CNLivePayCostThreePayTypeTicke //门票 | 164 | if ((threeType == CNLivePayCostThreePayTypeTicke //门票 |
| 53 | || threeType == CNLivePayCostThreePayTypeScren | 165 | || threeType == CNLivePayCostThreePayTypeScren |
| 54 | || threeType == CNLivePayCostThreePayTypeOrder | 166 | || threeType == CNLivePayCostThreePayTypeOrder |
| @@ -59,70 +171,111 @@ static NSString *const CNLiveWillBecomeActivePaycostForSHShopNotification = @"CN | @@ -59,70 +171,111 @@ static NSString *const CNLiveWillBecomeActivePaycostForSHShopNotification = @"CN | ||
| 59 | CNLivePayType type = payType == CNLivePayCostPayTypeWeChatPay ? CNLivePayCostPayTypeWeChatPay : payType == CNLivePayCostPayTypeAliPay ? CNLivePayCostPayTypeAliPay : CNLivePayCostPayTypeUnionPay; | 171 | CNLivePayType type = payType == CNLivePayCostPayTypeWeChatPay ? CNLivePayCostPayTypeWeChatPay : payType == CNLivePayCostPayTypeAliPay ? CNLivePayCostPayTypeAliPay : CNLivePayCostPayTypeUnionPay; |
| 60 | 172 | ||
| 61 | NSString * accountString = payType == CNLivePayCostPayTypeWeChatPay ? WXAccount : payType == CNLivePayCostPayTypeAliPay ? @"ztsx" : @"ztyl"; | 173 | NSString * accountString = payType == CNLivePayCostPayTypeWeChatPay ? WXAccount : payType == CNLivePayCostPayTypeAliPay ? @"ztsx" : @"ztyl"; |
| 174 | + | ||
| 62 | 175 | ||
| 63 | - float pri = [price floatValue]*100; | ||
| 64 | - | ||
| 65 | - NSString * notifyUrls = jsfy==YES ? CNJSFYNotifyUrl: (payType == CNLivePayCostPayTypeWeChatPay ? CNWeChatPayUrl : payType == CNLivePayCostPayTypeAliPay ? CNAliPayUrl : CNUnionPayUrl); | ||
| 66 | - | ||
| 67 | - //上海电商需要特殊的回调地址 | ||
| 68 | - if (!CNLiveStringIsEmpty(notifyUrl) | ||
| 69 | - && threeType == CNLivePayCostThreePayTypeSHSop) notifyUrls = notifyUrl; | ||
| 70 | - | ||
| 71 | - [self requestPayFromWXAndAliPay:type OrderId:groupId Account:accountString PriceId:pri Desc:desc Attach:attach CNLiveActiveGroupThreePayType:threeType NotifyUrl:notifyUrls NetAddUrlSchems:payType == CNLivePayCostPayTypeWeChatPay ? nil : payType == CNLivePayCostPayTypeAliPay ? CNLiveNetAddUrlSchems : CNLiveNetAddUnionPaySchems FormVC:formVC CompleterBlock:^{ | ||
| 72 | - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | ||
| 73 | - if (completerBlock) completerBlock(0); | ||
| 74 | - }); | ||
| 75 | - }]; | ||
| 76 | - | 176 | + if ([[CNLivePayCostModel sharePayCostModel].protocol pushActivePaymentNewPaycostWayWithModthod]) { |
| 177 | + | ||
| 178 | + NSString * p = [NSString stringWithFormat:@"%d",(NSInteger)([price floatValue]*100)]; | ||
| 179 | + | ||
| 180 | + [CNLivePayCostNetwork requestWithUMSPayForPrePayWithOrderId:groupId Body:desc Price:p CouponFee:@"0" BalanceFee:@"0" NotifyUrl:notifyUrl Type:payType FrmId:@"ios" PassWord:@"" CompleterBlcok:^(NSInteger statue) { | ||
| 181 | + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | ||
| 182 | + if (completerBlock) completerBlock(statue); | ||
| 183 | + }); | ||
| 184 | + }]; | ||
| 185 | + }else{ | ||
| 186 | + float pri = [price floatValue]*100; | ||
| 187 | + | ||
| 188 | + NSString * notifyUrls = jsfy==YES ? CNJSFYNotifyUrl: (payType == CNLivePayCostPayTypeWeChatPay ? CNWeChatPayUrl : payType == CNLivePayCostPayTypeAliPay ? CNAliPayUrl : CNUnionPayUrl); | ||
| 189 | + | ||
| 190 | + //上海电商需要特殊的回调地址 | ||
| 191 | + if (!CNLiveStringIsEmpty(notifyUrl) | ||
| 192 | + && threeType == CNLivePayCostThreePayTypeSHSop) notifyUrls = notifyUrl; | ||
| 193 | + | ||
| 194 | + [self requestPayFromWXAndAliPay:type OrderId:groupId Account:accountString PriceId:pri Desc:desc Attach:attach CNLiveActiveGroupThreePayType:threeType NotifyUrl:notifyUrls NetAddUrlSchems:payType == CNLivePayCostPayTypeWeChatPay ? nil : payType == CNLivePayCostPayTypeAliPay ? CNLiveNetAddUrlSchems : CNLiveNetAddUnionPaySchems FormVC:formVC CompleterBlock:^{ | ||
| 195 | + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | ||
| 196 | + if (completerBlock) completerBlock(0); | ||
| 197 | + }); | ||
| 198 | + }]; | ||
| 199 | + } | ||
| 77 | }else{ | 200 | }else{ |
| 78 | 201 | ||
| 79 | - __weak typeof(self) weakSelf = self; | ||
| 80 | - NSDictionary * paramDict = @{ | ||
| 81 | - @"groupId":groupId, | ||
| 82 | - @"sid":CNUserShareModel.uid, | ||
| 83 | - @"price":price, | ||
| 84 | - @"fundsId":fundsId | ||
| 85 | - }; | ||
| 86 | - [CNLiveNetworking setAllowRequestDefaultArgument:YES]; | ||
| 87 | - [CNLiveNetworking setupShowDataResult:YES]; | ||
| 88 | - [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNPayByGroupMembersUrl Param:paramDict CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | ||
| 89 | - | 202 | + if ([[CNLivePayCostModel sharePayCostModel].protocol pushActivePaymentNewPaycostWayWithModthod]) { |
| 203 | + | ||
| 204 | + NSString * p = [NSString stringWithFormat:@"%d",(NSInteger)([price floatValue]*100)]; | ||
| 205 | + | ||
| 206 | + NSDictionary * paramDict = @{ | ||
| 207 | + @"appId":AppId, | ||
| 208 | + @"user_id":CNUserShareModel.uid?CNUserShareModel.uid:@"", | ||
| 209 | + @"out_trade_no":groupId, | ||
| 210 | + @"body":desc, | ||
| 211 | + @"coupon_fee":@"0", | ||
| 212 | + @"balance_fee":p, | ||
| 213 | + @"notify_url":notifyUrl, | ||
| 214 | + @"page_url":@"", | ||
| 215 | + @"type":@"4", | ||
| 216 | + @"password":password, | ||
| 217 | + @"frmId":@"ios" | ||
| 218 | + }; | ||
| 219 | + [CNLiveNetworking setAllowRequestDefaultArgument:YES]; | ||
| 220 | + [CNLiveNetworking setupShowDataResult:YES]; | ||
| 221 | + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNUMSPayWithBalancePayApiContentURL Param:paramDict CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | ||
| 222 | + [CNLivePayCostNetwork payCost_chooseRequestWithResponseObject:responseObject Error:error isData:YES CompleterBlock:^(id responseObject, NSInteger errorCode) { | ||
| 223 | + if (responseObject) { | ||
| 224 | + if (completerBlock) completerBlock(0); | ||
| 225 | + }else{ | ||
| 226 | + if (completerBlock) completerBlock(1); | ||
| 227 | + } | ||
| 228 | + }]; | ||
| 229 | + }]; | ||
| 230 | + | ||
| 231 | + } else { | ||
| 232 | + __weak typeof(self) weakSelf = self; | ||
| 233 | + NSDictionary * paramDict = @{ | ||
| 234 | + @"groupId":groupId, | ||
| 235 | + @"sid":CNUserShareModel.uid, | ||
| 236 | + @"price":price, | ||
| 237 | + @"fundsId":fundsId | ||
| 238 | + }; | ||
| 239 | + [CNLiveNetworking setAllowRequestDefaultArgument:YES]; | ||
| 240 | + [CNLiveNetworking setupShowDataResult:YES]; | ||
| 241 | + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNPayByGroupMembersUrl Param:paramDict CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | ||
| 90 | 242 | ||
| 91 | - if (error == nil && [[responseObject allKeys] containsObject:@"payId"] && responseObject[@"payId"] != nil && ![responseObject[@"payId"] isKindOfClass:[NSNull class]]) { | ||
| 92 | - | ||
| 93 | - if (payType == CNLivePayCostPayTypeWjjPay) { | 243 | + if (error == nil && [[responseObject allKeys] containsObject:@"payId"] && responseObject[@"payId"] != nil && ![responseObject[@"payId"] isKindOfClass:[NSNull class]]) { |
| 94 | 244 | ||
| 95 | - NSString * toid = threeType == CNLivePayCostTypeOrder ? fundsId : groupId; | ||
| 96 | - [self requestActiveGroupWjjPayMentWithFromId:CNUserShareModel.uid Toid:toid Price:[price floatValue] Expand:expand SourceId:[responseObject objectForKey:@"payId"] PayId:responseObject[@"payId"] PassWord:password CompleterBlock:^(NSInteger statue) { | ||
| 97 | - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | ||
| 98 | - if (completerBlock) completerBlock(statue); | ||
| 99 | - }); | ||
| 100 | - }]; | 245 | + if (payType == CNLivePayCostPayTypeWjjPay) { |
| 246 | + | ||
| 247 | + NSString * toid = threeType == CNLivePayCostTypeOrder ? fundsId : groupId; | ||
| 248 | + [self requestActiveGroupWjjPayMentWithFromId:CNUserShareModel.uid Toid:toid Price:[price floatValue] Expand:expand SourceId:[responseObject objectForKey:@"payId"] PayId:responseObject[@"payId"] Desc:desc NotifyUrl:notifyUrl PassWord:password CompleterBlock:^(NSInteger statue) { | ||
| 249 | + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | ||
| 250 | + if (completerBlock) completerBlock(statue); | ||
| 251 | + }); | ||
| 252 | + }]; | ||
| 253 | + }else{ | ||
| 254 | + CNLivePayType type = payType == CNLivePayCostPayTypeWeChatPay ? CNLivePayTypeWeChatPay : payType == CNLivePayCostPayTypeAliPay ? CNLivePayTypeAliPay : CNLivePayTypeUnionpay; | ||
| 255 | + | ||
| 256 | + NSString * accountString = payType == CNLivePayCostPayTypeWeChatPay ? WXAccount : payType == CNLivePayCostPayTypeAliPay ? @"ztsx" : @"ztyl"; | ||
| 257 | + | ||
| 258 | + float price = [responseObject[@"price"] floatValue]*100; | ||
| 259 | + NSString * notifyUrls = jsfy == YES ? CNJSFYNotifyUrl : (payType == CNLivePayCostPayTypeWeChatPay ? CNWeChatPayUrl : payType == CNLivePayCostPayTypeAliPay ? CNAliPayUrl : CNUnionPayUrl); | ||
| 260 | + | ||
| 261 | + if (!CNLiveStringIsEmpty(notifyUrl)) notifyUrls = notifyUrl; | ||
| 262 | + | ||
| 263 | + weakSelf.payId = responseObject[@"payId"]; | ||
| 264 | + | ||
| 265 | + [weakSelf requestPayFromWXAndAliPay:type OrderId:responseObject[@"payId"] Account:accountString PriceId:price Desc:desc Attach:@{} CNLiveActiveGroupThreePayType:threeType NotifyUrl:notifyUrls NetAddUrlSchems:payType == CNLivePayCostPayTypeWeChatPay ? nil : payType == CNLivePayCostPayTypeAliPay ? CNLiveNetAddUrlSchems : CNLiveNetAddUnionPaySchems FormVC:formVC CompleterBlock:^{ | ||
| 266 | + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | ||
| 267 | + if (completerBlock) completerBlock(0); | ||
| 268 | + }); | ||
| 269 | + }]; | ||
| 270 | + } | ||
| 101 | }else{ | 271 | }else{ |
| 102 | - CNLivePayType type = payType == CNLivePayCostPayTypeWeChatPay ? CNLivePayTypeWeChatPay : payType == CNLivePayCostPayTypeAliPay ? CNLivePayTypeAliPay : CNLivePayTypeUnionpay; | ||
| 103 | - | ||
| 104 | - NSString * accountString = payType == CNLivePayCostPayTypeWeChatPay ? WXAccount : payType == CNLivePayCostPayTypeAliPay ? @"ztsx" : @"ztyl"; | ||
| 105 | - | ||
| 106 | - float price = [responseObject[@"price"] floatValue]*100; | ||
| 107 | - NSString * notifyUrls = jsfy == YES ? CNJSFYNotifyUrl : (payType == CNLivePayCostPayTypeWeChatPay ? CNWeChatPayUrl : payType == CNLivePayCostPayTypeAliPay ? CNAliPayUrl : CNUnionPayUrl); | ||
| 108 | - | ||
| 109 | - if (!CNLiveStringIsEmpty(notifyUrl)) notifyUrls = notifyUrl; | ||
| 110 | - | ||
| 111 | - weakSelf.payId = responseObject[@"payId"]; | ||
| 112 | - | ||
| 113 | - [weakSelf requestPayFromWXAndAliPay:type OrderId:responseObject[@"payId"] Account:accountString PriceId:price Desc:desc Attach:@{} CNLiveActiveGroupThreePayType:threeType NotifyUrl:notifyUrls NetAddUrlSchems:payType == CNLivePayCostPayTypeWeChatPay ? nil : payType == CNLivePayCostPayTypeAliPay ? CNLiveNetAddUrlSchems : CNLiveNetAddUnionPaySchems FormVC:formVC CompleterBlock:^{ | ||
| 114 | - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | ||
| 115 | - if (completerBlock) completerBlock(0); | ||
| 116 | - }); | ||
| 117 | - }]; | 272 | + [QMUITips hideAllToastInView:AppKeyWindow animated:YES]; |
| 273 | + [QMUITips showError:@"预支付失败" inView:AppKeyWindow hideAfterDelay:1.5]; | ||
| 118 | } | 274 | } |
| 119 | - }else{ | ||
| 120 | - [QMUITips hideAllToastInView:AppKeyWindow animated:YES]; | ||
| 121 | - [QMUITips showError:@"预支付失败" inView:AppKeyWindow hideAfterDelay:1.5]; | ||
| 122 | - } | ||
| 123 | - | ||
| 124 | - if (error) [QMUITips showError:[error.userInfo objectForKey:NSLocalizedDescriptionKey] inView:AppKeyWindow hideAfterDelay:1.5]; | ||
| 125 | - }]; | 275 | + |
| 276 | + if (error) [QMUITips showError:[error.userInfo objectForKey:NSLocalizedDescriptionKey] inView:AppKeyWindow hideAfterDelay:1.5]; | ||
| 277 | + }]; | ||
| 278 | + } | ||
| 126 | } | 279 | } |
| 127 | } | 280 | } |
| 128 | #pragma mark - 网加加余额支付&连带生成预订单 | 281 | #pragma mark - 网加加余额支付&连带生成预订单 |
| @@ -145,72 +298,88 @@ static NSString *const CNLiveWillBecomeActivePaycostForSHShopNotification = @"CN | @@ -145,72 +298,88 @@ static NSString *const CNLiveWillBecomeActivePaycostForSHShopNotification = @"CN | ||
| 145 | Expand:(NSString *)expand | 298 | Expand:(NSString *)expand |
| 146 | SourceId:(NSString *)sourceId | 299 | SourceId:(NSString *)sourceId |
| 147 | PayId:(NSString *)payId | 300 | PayId:(NSString *)payId |
| 301 | + Desc:(NSString *)desc | ||
| 302 | + NotifyUrl:(NSString *)notifyUrl | ||
| 148 | PassWord:(NSString *)password | 303 | PassWord:(NSString *)password |
| 149 | CompleterBlock:(void (^)(NSInteger))completerBlock | 304 | CompleterBlock:(void (^)(NSInteger))completerBlock |
| 150 | { | 305 | { |
| 151 | - [self requestActiveForPrivateKeyWithCompleterBlock:^(NSDictionary * dict) { | ||
| 152 | 306 | ||
| 153 | - NSDictionary * signDict = @{ | ||
| 154 | - @"userId":CNUserShareModel.uid, | ||
| 155 | - @"platFormId":[[NSBundle mainBundle] bundleIdentifier], | ||
| 156 | - @"timestamp":[NSString stringWithFormat:@"%ld",(long)[CNLiveTimeTools getNow10NumTimestamp]], | ||
| 157 | - @"fromId":fromId, | ||
| 158 | - @"toId":toId, | ||
| 159 | - @"price":[NSString stringWithFormat:@"%.2f",price], | ||
| 160 | - @"expand":expand, | ||
| 161 | - @"sourceId":sourceId | ||
| 162 | - }; | 307 | + if ([[CNLivePayCostModel sharePayCostModel].protocol pushActivePaymentNewPaycostWayWithModthod]) { |
| 163 | 308 | ||
| 164 | - NSMutableDictionary * param = [[CNLiveEncryptManager manager] validationEncryptWithParams:signDict preValiDic:dict].mutableCopy; | 309 | + NSString * p = [NSString stringWithFormat:@"%d",(NSInteger)(price*100)]; |
| 165 | 310 | ||
| 166 | - [param addEntriesFromDictionary:@{@"appId":AppId}]; | 311 | + [CNLivePayCostNetwork requestWithUMSPayForPrePayWithOrderId:payId Body:desc Price:p CouponFee:@"0" BalanceFee:@"0" NotifyUrl:notifyUrl Type:CNLivePayCostPayTypeWjjPay FrmId:@"ios" PassWord:password CompleterBlcok:^(NSInteger statue) { |
| 312 | + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | ||
| 313 | + if (completerBlock) completerBlock(statue); | ||
| 314 | + }); | ||
| 315 | + }]; | ||
| 167 | 316 | ||
| 168 | - [CNLiveNetworking setupShowDataResult:NO]; | ||
| 169 | - [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNGroupWjjPayWjjPrePaySourceUrl Param:param CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | 317 | + } else { |
| 318 | + | ||
| 319 | + [self requestActiveForPrivateKeyWithCompleterBlock:^(NSDictionary * dict) { | ||
| 170 | 320 | ||
| 171 | - if (error) { | ||
| 172 | - [QMUITips hideAllToastInView:AppKeyWindow animated:YES]; | ||
| 173 | - if(error.code != 406) [QMUITips showError:[error.userInfo objectForKey:NSLocalizedDescriptionKey] inView:AppKeyWindow hideAfterDelay:2]; | ||
| 174 | - if (error.code == 406) completerBlock(1); | ||
| 175 | - return;; | ||
| 176 | - } | ||
| 177 | - | ||
| 178 | - [CNLivePayCostNetwork payCost_chooseRequestWithResponseObject:responseObject Error:error isData:YES CompleterBlock:^(id responseObject, NSInteger errorCode) { | 321 | + NSDictionary * signDict = @{ |
| 322 | + @"userId":CNUserShareModel.uid, | ||
| 323 | + @"platFormId":[[NSBundle mainBundle] bundleIdentifier], | ||
| 324 | + @"timestamp":[NSString stringWithFormat:@"%ld",(long)[CNLiveTimeTools getNow10NumTimestamp]], | ||
| 325 | + @"fromId":fromId, | ||
| 326 | + @"toId":toId, | ||
| 327 | + @"price":[NSString stringWithFormat:@"%.2f",price], | ||
| 328 | + @"expand":expand, | ||
| 329 | + @"sourceId":sourceId | ||
| 330 | + }; | ||
| 331 | + | ||
| 332 | + NSMutableDictionary * param = [[CNLiveEncryptManager manager] validationEncryptWithParams:signDict preValiDic:dict].mutableCopy; | ||
| 333 | + | ||
| 334 | + [param addEntriesFromDictionary:@{@"appId":AppId}]; | ||
| 335 | + | ||
| 336 | + [CNLiveNetworking setupShowDataResult:NO]; | ||
| 337 | + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNGroupWjjPayWjjPrePaySourceUrl Param:param CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | ||
| 179 | 338 | ||
| 180 | - if (responseObject) { | ||
| 181 | - NSDictionary * subParamDic = @{ | ||
| 182 | - @"userId":CNUserShareModel.uid, | ||
| 183 | - @"platFormId":[[NSBundle mainBundle] bundleIdentifier], | ||
| 184 | - @"timestamp":[NSString stringWithFormat:@"%ld",(long)[CNLiveTimeTools getNow10NumTimestamp]], | ||
| 185 | - @"preId":[responseObject objectForKey:@"preId"], | ||
| 186 | - @"password":[NSString md5String:password], | ||
| 187 | - }; | ||
| 188 | - | ||
| 189 | - NSMutableDictionary * subParam = [[CNLiveEncryptManager manager] validationEncryptWithParams:subParamDic preValiDic:dict].mutableCopy; | ||
| 190 | - | ||
| 191 | - [subParam addEntriesFromDictionary:@{@"appId":AppId}]; | 339 | + if (error) { |
| 340 | + [QMUITips hideAllToastInView:AppKeyWindow animated:YES]; | ||
| 341 | + if(error.code != 406) [QMUITips showError:[error.userInfo objectForKey:NSLocalizedDescriptionKey] inView:AppKeyWindow hideAfterDelay:2]; | ||
| 342 | + if (error.code == 406) completerBlock(1); | ||
| 343 | + return;; | ||
| 344 | + } | ||
| 345 | + | ||
| 346 | + [CNLivePayCostNetwork payCost_chooseRequestWithResponseObject:responseObject Error:error isData:YES CompleterBlock:^(id responseObject, NSInteger errorCode) { | ||
| 192 | 347 | ||
| 193 | - [CNLiveNetworking setupShowResult:YES]; | ||
| 194 | - [CNLiveNetworking setupShowDataResult:YES]; | ||
| 195 | - [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNGroupWjjPayWjjSourceUrl Param:subParam CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | 348 | + if (responseObject) { |
| 349 | + NSDictionary * subParamDic = @{ | ||
| 350 | + @"userId":CNUserShareModel.uid, | ||
| 351 | + @"platFormId":[[NSBundle mainBundle] bundleIdentifier], | ||
| 352 | + @"timestamp":[NSString stringWithFormat:@"%ld",(long)[CNLiveTimeTools getNow10NumTimestamp]], | ||
| 353 | + @"preId":[responseObject objectForKey:@"preId"], | ||
| 354 | + @"password":[NSString md5String:password], | ||
| 355 | + }; | ||
| 356 | + | ||
| 357 | + NSMutableDictionary * subParam = [[CNLiveEncryptManager manager] validationEncryptWithParams:subParamDic preValiDic:dict].mutableCopy; | ||
| 196 | 358 | ||
| 197 | - [QMUITips hideAllToastInView:AppKeyWindow animated:YES]; | 359 | + [subParam addEntriesFromDictionary:@{@"appId":AppId}]; |
| 198 | 360 | ||
| 199 | - if (error == nil) { | 361 | + [CNLiveNetworking setupShowResult:YES]; |
| 362 | + [CNLiveNetworking setupShowDataResult:YES]; | ||
| 363 | + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNGroupWjjPayWjjSourceUrl Param:subParam CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | ||
| 200 | 364 | ||
| 201 | - completerBlock(0); | 365 | + [QMUITips hideAllToastInView:AppKeyWindow animated:YES]; |
| 202 | 366 | ||
| 203 | - }else{ | ||
| 204 | - if (error.code != 414) [QMUITips showError:[error.userInfo objectForKey:NSLocalizedDescriptionKey] inView:AppKeyWindow hideAfterDelay:1.5]; | ||
| 205 | - if (error.code == 414) completerBlock(2); | ||
| 206 | - } | ||
| 207 | - }]; | ||
| 208 | - }else{ | ||
| 209 | - [QMUITips hideAllTipsInView:AppKeyWindow]; | ||
| 210 | - } | 367 | + if (error == nil) { |
| 368 | + | ||
| 369 | + completerBlock(0); | ||
| 370 | + | ||
| 371 | + }else{ | ||
| 372 | + if (error.code != 414) [QMUITips showError:[error.userInfo objectForKey:NSLocalizedDescriptionKey] inView:AppKeyWindow hideAfterDelay:1.5]; | ||
| 373 | + if (error.code == 414) completerBlock(2); | ||
| 374 | + } | ||
| 375 | + }]; | ||
| 376 | + }else{ | ||
| 377 | + [QMUITips hideAllTipsInView:AppKeyWindow]; | ||
| 378 | + } | ||
| 379 | + }]; | ||
| 211 | }]; | 380 | }]; |
| 212 | }]; | 381 | }]; |
| 213 | - }]; | 382 | + } |
| 214 | } | 383 | } |
| 215 | 384 | ||
| 216 | #pragma mark - 获取相关的公钥及随机秘钥 | 385 | #pragma mark - 获取相关的公钥及随机秘钥 |
| @@ -466,10 +635,18 @@ static NSString *const CNLiveWillBecomeActivePaycostForSHShopNotification = @"CN | @@ -466,10 +635,18 @@ static NSString *const CNLiveWillBecomeActivePaycostForSHShopNotification = @"CN | ||
| 466 | && ((NSDictionary *)responseObject[@"data"]).allValues.count > 0) { | 635 | && ((NSDictionary *)responseObject[@"data"]).allValues.count > 0) { |
| 467 | if (completerBlock) completerBlock(responseObject[@"data"],0); | 636 | if (completerBlock) completerBlock(responseObject[@"data"],0); |
| 468 | }else{ | 637 | }else{ |
| 469 | - [QMUITips showError:@"请求失败" inView:AppKeyWindow hideAfterDelay:1.5]; | ||
| 470 | - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | ||
| 471 | - if (completerBlock) completerBlock(nil,-500); | ||
| 472 | - }); | 638 | + NSString * errorMessage = [responseObject stringValueForKey:@"errorMessage" default:@""]; |
| 639 | + if ([errorMessage length] > 0) { | ||
| 640 | + [QMUITips showError:errorMessage inView:AppKeyWindow hideAfterDelay:1.5]; | ||
| 641 | + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | ||
| 642 | + if (completerBlock) completerBlock(nil,-500); | ||
| 643 | + }); | ||
| 644 | + }else{ | ||
| 645 | + [QMUITips showError:@"请求失败" inView:AppKeyWindow hideAfterDelay:1.5]; | ||
| 646 | + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | ||
| 647 | + if (completerBlock) completerBlock(nil,-500); | ||
| 648 | + }); | ||
| 649 | + } | ||
| 473 | } | 650 | } |
| 474 | }else{ | 651 | }else{ |
| 475 | if (completerBlock) completerBlock(responseObject,0); | 652 | if (completerBlock) completerBlock(responseObject,0); |
CNLivePayCostModule/Classes/Core/CNLivePayCostProtocol.h
| @@ -15,6 +15,10 @@ NS_ASSUME_NONNULL_BEGIN | @@ -15,6 +15,10 @@ NS_ASSUME_NONNULL_BEGIN | ||
| 15 | /// @param isChangePassword 是否是设置密码界面 | 15 | /// @param isChangePassword 是否是设置密码界面 |
| 16 | -(void)pushActivePaymentResultViewModthodChangePassword:(BOOL)isChangePassword; | 16 | -(void)pushActivePaymentResultViewModthodChangePassword:(BOOL)isChangePassword; |
| 17 | 17 | ||
| 18 | + | ||
| 19 | +/// 改变支付调用方法 | ||
| 20 | +-(BOOL)pushActivePaymentNewPaycostWayWithModthod; | ||
| 21 | + | ||
| 18 | @end | 22 | @end |
| 19 | 23 | ||
| 20 | NS_ASSUME_NONNULL_END | 24 | NS_ASSUME_NONNULL_END |
CNLivePayCostModule/Classes/View/CNLivePayCostContentView.h
| @@ -12,7 +12,7 @@ | @@ -12,7 +12,7 @@ | ||
| 12 | 12 | ||
| 13 | NS_ASSUME_NONNULL_BEGIN | 13 | NS_ASSUME_NONNULL_BEGIN |
| 14 | 14 | ||
| 15 | -typedef void(^CompleterBlock)(CNLivePayCostType resultType); | 15 | +typedef void(^CompleterBlock)(CNLivePayCostTypeResult resultType); |
| 16 | 16 | ||
| 17 | @interface CNLivePayCostContentView : UIView | 17 | @interface CNLivePayCostContentView : UIView |
| 18 | 18 |
CNLivePayCostModule/Classes/View/CNLivePayCostContentView.m
| @@ -62,6 +62,8 @@ static NSString *const CNActiveContentPayViewIdentifier = @"CNActiveContentPayVi | @@ -62,6 +62,8 @@ static NSString *const CNActiveContentPayViewIdentifier = @"CNActiveContentPayVi | ||
| 62 | 62 | ||
| 63 | //进入app的成功回调 | 63 | //进入app的成功回调 |
| 64 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(standardBecomeActive) name:UIApplicationWillEnterForegroundNotification object:nil]; | 64 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(standardBecomeActive) name:UIApplicationWillEnterForegroundNotification object:nil]; |
| 65 | + | ||
| 66 | + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(launchMiniResultAction:) name:@"kCNLiveLaunchMiniResultNotification" object:nil]; | ||
| 65 | // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateGroupNoticeSuccess:) name:kIMAMSG_UpdateGroupInfoNotification object:nil]; | 67 | // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateGroupNoticeSuccess:) name:kIMAMSG_UpdateGroupInfoNotification object:nil]; |
| 66 | } | 68 | } |
| 67 | return self; | 69 | return self; |
| @@ -70,6 +72,18 @@ static NSString *const CNActiveContentPayViewIdentifier = @"CNActiveContentPayVi | @@ -70,6 +72,18 @@ static NSString *const CNActiveContentPayViewIdentifier = @"CNActiveContentPayVi | ||
| 70 | { | 72 | { |
| 71 | if (self) [self dismissAction:NULL]; | 73 | if (self) [self dismissAction:NULL]; |
| 72 | } | 74 | } |
| 75 | +-(void)launchMiniResultAction:(NSNotification *)note | ||
| 76 | +{ | ||
| 77 | + NSDictionary * paramDict = (NSDictionary *)note.userInfo; | ||
| 78 | + NSString * code = [paramDict stringValueForKey:@"code" default:@""]; | ||
| 79 | + NSString * message = [paramDict stringValueForKey:@"message" default:@""]; | ||
| 80 | + NSString * orderId = [paramDict stringValueForKey:@"out_trade_no" default:@""]; | ||
| 81 | + if ([orderId isEqualToString:self.payModel.orderId]) { | ||
| 82 | + if ([code isEqualToString:@"0"] && self.completerBlock)self.completerBlock(CNLivePayCostTypeResultSucc); | ||
| 83 | + if ([code isEqualToString:@"1"] && self.completerBlock)self.completerBlock(CNLivePayCostTypeResultUnknow); | ||
| 84 | + if ([code isEqualToString:@"2"] && self.completerBlock)self.completerBlock(CNLivePayCostTypeResultFail); | ||
| 85 | + } | ||
| 86 | +} | ||
| 73 | -(void)resultPayAction:(NSNotification *)note | 87 | -(void)resultPayAction:(NSNotification *)note |
| 74 | { | 88 | { |
| 75 | __weak typeof(self) weakSelf = self; | 89 | __weak typeof(self) weakSelf = self; |
| @@ -79,6 +93,11 @@ static NSString *const CNActiveContentPayViewIdentifier = @"CNActiveContentPayVi | @@ -79,6 +93,11 @@ static NSString *const CNActiveContentPayViewIdentifier = @"CNActiveContentPayVi | ||
| 79 | NSDictionary * systemPayData = [paramDict dictionaryForKey:@"systemPayData"]; | 93 | NSDictionary * systemPayData = [paramDict dictionaryForKey:@"systemPayData"]; |
| 80 | NSString * type = [systemPayData stringValueForKey:@"text" default:@"0"]; | 94 | NSString * type = [systemPayData stringValueForKey:@"text" default:@"0"]; |
| 81 | if (weakSelf.completerBlock) weakSelf.completerBlock([type isEqualToString:@"2"]?CNLivePayCostTypeResultSucc:CNLivePayCostTypeResultFail); | 95 | if (weakSelf.completerBlock) weakSelf.completerBlock([type isEqualToString:@"2"]?CNLivePayCostTypeResultSucc:CNLivePayCostTypeResultFail); |
| 96 | + }else if ([note.name isEqualToString:@"CNLiveContentSweepPaymentNotification"]) { | ||
| 97 | + NSDictionary * paramDict = (NSDictionary *)note.object; | ||
| 98 | + if ([[paramDict stringValueForKey:@"payType" default:@""] isEqualToString:@"0"]) { | ||
| 99 | + if (weakSelf.completerBlock) weakSelf.completerBlock(CNLivePayCostTypeResultSucc); | ||
| 100 | + } | ||
| 82 | }else{ | 101 | }else{ |
| 83 | if (weakSelf.completerBlock) weakSelf.completerBlock(CNLivePayCostTypeResultSucc); | 102 | if (weakSelf.completerBlock) weakSelf.completerBlock(CNLivePayCostTypeResultSucc); |
| 84 | } | 103 | } |
| @@ -170,6 +189,7 @@ static NSString *const CNActiveContentPayViewIdentifier = @"CNActiveContentPayVi | @@ -170,6 +189,7 @@ static NSString *const CNActiveContentPayViewIdentifier = @"CNActiveContentPayVi | ||
| 170 | if (indexPath.row == 0) cell.textLabel.textAlignment = NSTextAlignmentCenter; | 189 | if (indexPath.row == 0) cell.textLabel.textAlignment = NSTextAlignmentCenter; |
| 171 | NSDictionary * dict = [self.dataArray objectAtIndex:indexPath.row]; | 190 | NSDictionary * dict = [self.dataArray objectAtIndex:indexPath.row]; |
| 172 | cell.textLabel.text = [dict objectForKey:@"text"]; | 191 | cell.textLabel.text = [dict objectForKey:@"text"]; |
| 192 | + cell.textLabel.textColor = [UIColor blackColor]; | ||
| 173 | UIImage * image = [CNLivePayCostNetwork payCost_setImageWithName:[dict objectForKey:@"image"]]; | 193 | UIImage * image = [CNLivePayCostNetwork payCost_setImageWithName:[dict objectForKey:@"image"]]; |
| 174 | cell.imageView.image = image; | 194 | cell.imageView.image = image; |
| 175 | cell.accessoryView = [self setSelectView]; | 195 | cell.accessoryView = [self setSelectView]; |
| @@ -232,13 +252,13 @@ static NSString *const CNActiveContentPayViewIdentifier = @"CNActiveContentPayVi | @@ -232,13 +252,13 @@ static NSString *const CNActiveContentPayViewIdentifier = @"CNActiveContentPayVi | ||
| 232 | [button startButtonActivityIndicatorView:UIActivityIndicatorViewStyleWhite]; | 252 | [button startButtonActivityIndicatorView:UIActivityIndicatorViewStyleWhite]; |
| 233 | 253 | ||
| 234 | if (self.payModel.payType == CNLivePayCostTypeGroup) { | 254 | if (self.payModel.payType == CNLivePayCostTypeGroup) { |
| 235 | - | 255 | + |
| 236 | [[CNLivePayCostNetwork sharePayCostNetWork] requestActiveGroupPayInfoWithGroupId:self.payModel.orderId CNLiveActiveGroupPayType:type CNLiveActiveGroupThreePayType:CNLivePayCostThreePayTypePayment PriceId:[NSString stringWithFormat:@"%.2f",self.payModel.price] Desc:self.payModel.descStr Expand:@"" NotifyUrl:self.payModel.notifyUrl jsfy:NO PassWord:_headerView.passwordView.textField.text FundsId:self.payModel.fundsId Attach:nil FormVC:self.fromVC CompleterBlcok:^(NSInteger statue) { | 256 | [[CNLivePayCostNetwork sharePayCostNetWork] requestActiveGroupPayInfoWithGroupId:self.payModel.orderId CNLiveActiveGroupPayType:type CNLiveActiveGroupThreePayType:CNLivePayCostThreePayTypePayment PriceId:[NSString stringWithFormat:@"%.2f",self.payModel.price] Desc:self.payModel.descStr Expand:@"" NotifyUrl:self.payModel.notifyUrl jsfy:NO PassWord:_headerView.passwordView.textField.text FundsId:self.payModel.fundsId Attach:nil FormVC:self.fromVC CompleterBlcok:^(NSInteger statue) { |
| 237 | [weakSelf showPayStatue:statue]; | 257 | [weakSelf showPayStatue:statue]; |
| 238 | }]; | 258 | }]; |
| 239 | } | 259 | } |
| 240 | if (self.payModel.payType == CNLivePayCostTypeOrder || self.payModel.payType == CNLivePayCostTypeSHShop || self.payModel.payType == CNLivePayCostTypeCommunt || self.payModel.payType == CNLivePayCostTypeHtml) { | 260 | if (self.payModel.payType == CNLivePayCostTypeOrder || self.payModel.payType == CNLivePayCostTypeSHShop || self.payModel.payType == CNLivePayCostTypeCommunt || self.payModel.payType == CNLivePayCostTypeHtml) { |
| 241 | - | 261 | + |
| 242 | NSString * priceString = [NSString stringWithFormat:@"%.2f",self.payModel.price]; | 262 | NSString * priceString = [NSString stringWithFormat:@"%.2f",self.payModel.price]; |
| 243 | CNLivePayCostThreePayType payType = self.payModel.payType == CNLivePayCostTypeOrder?CNLivePayCostThreePayTypeOrder:CNLivePayCostThreePayTypeSHSop; | 263 | CNLivePayCostThreePayType payType = self.payModel.payType == CNLivePayCostTypeOrder?CNLivePayCostThreePayTypeOrder:CNLivePayCostThreePayTypeSHSop; |
| 244 | [[CNLivePayCostNetwork sharePayCostNetWork] requestActiveGroupPayInfoWithGroupId:self.payModel.orderId CNLiveActiveGroupPayType:type CNLiveActiveGroupThreePayType:payType PriceId:priceString Desc:self.payModel.descStr Expand:@"" NotifyUrl:self.payModel.notifyUrl jsfy:NO PassWord:_headerView.passwordView.textField.text FundsId:nil Attach:self.payModel.payType == CNLivePayCostTypeSHShop || self.payModel.payType == CNLivePayCostTypeHtml ?self.payModel.attach:nil FormVC:self.fromVC CompleterBlcok:^(NSInteger statue) { | 264 | [[CNLivePayCostNetwork sharePayCostNetWork] requestActiveGroupPayInfoWithGroupId:self.payModel.orderId CNLiveActiveGroupPayType:type CNLiveActiveGroupThreePayType:payType PriceId:priceString Desc:self.payModel.descStr Expand:@"" NotifyUrl:self.payModel.notifyUrl jsfy:NO PassWord:_headerView.passwordView.textField.text FundsId:nil Attach:self.payModel.payType == CNLivePayCostTypeSHShop || self.payModel.payType == CNLivePayCostTypeHtml ?self.payModel.attach:nil FormVC:self.fromVC CompleterBlcok:^(NSInteger statue) { |
| @@ -247,15 +267,13 @@ static NSString *const CNActiveContentPayViewIdentifier = @"CNActiveContentPayVi | @@ -247,15 +267,13 @@ static NSString *const CNActiveContentPayViewIdentifier = @"CNActiveContentPayVi | ||
| 247 | } | 267 | } |
| 248 | if (self.payModel.payType == CNLivePayCostTypeSweep | 268 | if (self.payModel.payType == CNLivePayCostTypeSweep |
| 249 | || self.payModel.payType == CNLivePayCostTypeTicke) { | 269 | || self.payModel.payType == CNLivePayCostTypeTicke) { |
| 250 | - | 270 | + |
| 251 | [[CNLivePayCostNetwork sharePayCostNetWork] requestActiveGroupPayInfoWithGroupId:self.payModel.orderId CNLiveActiveGroupPayType:type CNLiveActiveGroupThreePayType:self.payModel.payType == CNLivePayCostTypeTicke ? CNLivePayCostThreePayTypeTicke : CNLivePayCostThreePayTypeScren PriceId:[NSString stringWithFormat:@"%.2f",self.payModel.price] Desc:self.payModel.payType == CNLivePayCostTypeSweep?@"扫码支付":self.payModel.descStr Expand:@"" NotifyUrl:self.payModel.notifyUrl jsfy:self.payModel.payType == CNLivePayCostTypeTicke PassWord:_headerView.passwordView.textField.text FundsId:@"" Attach:nil FormVC:self.fromVC CompleterBlcok:^(NSInteger statue) { | 271 | [[CNLivePayCostNetwork sharePayCostNetWork] requestActiveGroupPayInfoWithGroupId:self.payModel.orderId CNLiveActiveGroupPayType:type CNLiveActiveGroupThreePayType:self.payModel.payType == CNLivePayCostTypeTicke ? CNLivePayCostThreePayTypeTicke : CNLivePayCostThreePayTypeScren PriceId:[NSString stringWithFormat:@"%.2f",self.payModel.price] Desc:self.payModel.payType == CNLivePayCostTypeSweep?@"扫码支付":self.payModel.descStr Expand:@"" NotifyUrl:self.payModel.notifyUrl jsfy:self.payModel.payType == CNLivePayCostTypeTicke PassWord:_headerView.passwordView.textField.text FundsId:@"" Attach:nil FormVC:self.fromVC CompleterBlcok:^(NSInteger statue) { |
| 252 | [weakSelf showPayStatue:statue]; | 272 | [weakSelf showPayStatue:statue]; |
| 253 | }]; | 273 | }]; |
| 254 | 274 | ||
| 255 | } | 275 | } |
| 256 | - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | ||
| 257 | - [weakSelf dismissAction:NULL]; | ||
| 258 | - }); | 276 | +// [self dismissAction:NULL]; |
| 259 | } | 277 | } |
| 260 | } | 278 | } |
| 261 | -(void)payAction:(NSString *)password | 279 | -(void)payAction:(NSString *)password |
| @@ -270,27 +288,27 @@ static NSString *const CNActiveContentPayViewIdentifier = @"CNActiveContentPayVi | @@ -270,27 +288,27 @@ static NSString *const CNActiveContentPayViewIdentifier = @"CNActiveContentPayVi | ||
| 270 | } | 288 | } |
| 271 | if (self.payModel.payType == CNLivePayCostTypeOrder) { | 289 | if (self.payModel.payType == CNLivePayCostTypeOrder) { |
| 272 | 290 | ||
| 273 | - [[CNLivePayCostNetwork sharePayCostNetWork] requestActiveGroupWjjPayMentWithFromId:CNUserShareModel.uid Toid:self.payModel.userId Price:self.payModel.price Expand:self.payModel.expand SourceId:self.payModel.orderId PayId:self.payModel.orderId PassWord:password CompleterBlock:^(NSInteger statue) { | 291 | + [[CNLivePayCostNetwork sharePayCostNetWork] requestActiveGroupWjjPayMentWithFromId:CNUserShareModel.uid Toid:self.payModel.userId Price:self.payModel.price Expand:self.payModel.expand SourceId:self.payModel.orderId PayId:self.payModel.orderId Desc:self.payModel.descStr NotifyUrl:self.payModel.notifyUrl PassWord:password CompleterBlock:^(NSInteger statue) { |
| 274 | [weakSelf showPayStatue:statue]; | 292 | [weakSelf showPayStatue:statue]; |
| 275 | }]; | 293 | }]; |
| 276 | } | 294 | } |
| 277 | if (self.payModel.payType == CNLivePayCostTypeSweep) { | 295 | if (self.payModel.payType == CNLivePayCostTypeSweep) { |
| 278 | - [[CNLivePayCostNetwork sharePayCostNetWork] requestActiveGroupWjjPayMentWithFromId:CNUserShareModel.uid Toid:self.payModel.toId Price:self.payModel.price Expand:self.payModel.expand SourceId:self.payModel.orderId PayId:self.payModel.orderId PassWord:password CompleterBlock:^(NSInteger statue) { | 296 | + [[CNLivePayCostNetwork sharePayCostNetWork] requestActiveGroupWjjPayMentWithFromId:CNUserShareModel.uid Toid:self.payModel.toId Price:self.payModel.price Expand:self.payModel.expand SourceId:self.payModel.orderId PayId:self.payModel.orderId Desc:self.payModel.descStr NotifyUrl:self.payModel.notifyUrl PassWord:password CompleterBlock:^(NSInteger statue) { |
| 279 | [weakSelf showPayStatue:statue]; | 297 | [weakSelf showPayStatue:statue]; |
| 280 | }]; | 298 | }]; |
| 281 | } | 299 | } |
| 282 | if (self.payModel.payType == CNLivePayCostTypeTicke) { | 300 | if (self.payModel.payType == CNLivePayCostTypeTicke) { |
| 283 | - [[CNLivePayCostNetwork sharePayCostNetWork] requestActiveGroupWjjPayMentWithFromId:CNUserShareModel.uid Toid:self.payModel.toId Price:self.payModel.price Expand:self.payModel.expand SourceId:self.payModel.orderId PayId:self.payModel.orderId PassWord:password CompleterBlock:^(NSInteger statue) { | 301 | + [[CNLivePayCostNetwork sharePayCostNetWork] requestActiveGroupWjjPayMentWithFromId:CNUserShareModel.uid Toid:self.payModel.toId Price:self.payModel.price Expand:self.payModel.expand SourceId:self.payModel.orderId PayId:self.payModel.orderId Desc:self.payModel.descStr NotifyUrl:self.payModel.notifyUrl PassWord:password CompleterBlock:^(NSInteger statue) { |
| 284 | [weakSelf showPayStatue:statue]; | 302 | [weakSelf showPayStatue:statue]; |
| 285 | }]; | 303 | }]; |
| 286 | } | 304 | } |
| 287 | if (self.payModel.payType == CNLivePayCostTypeSHShop) { | 305 | if (self.payModel.payType == CNLivePayCostTypeSHShop) { |
| 288 | - [[CNLivePayCostNetwork sharePayCostNetWork] requestActiveGroupWjjPayMentWithFromId:CNUserShareModel.uid Toid:self.payModel.toId Price:self.payModel.price Expand:self.payModel.expand SourceId:self.payModel.orderId PayId:self.payModel.orderId PassWord:password CompleterBlock:^(NSInteger statue) { | 306 | + [[CNLivePayCostNetwork sharePayCostNetWork] requestActiveGroupWjjPayMentWithFromId:CNUserShareModel.uid Toid:self.payModel.toId Price:self.payModel.price Expand:self.payModel.expand SourceId:self.payModel.orderId PayId:self.payModel.orderId Desc:self.payModel.descStr NotifyUrl:self.payModel.notifyUrl PassWord:password CompleterBlock:^(NSInteger statue) { |
| 289 | [weakSelf showPayStatue:statue]; | 307 | [weakSelf showPayStatue:statue]; |
| 290 | }]; | 308 | }]; |
| 291 | } | 309 | } |
| 292 | if (self.payModel.payType == CNLivePayCostTypeHtml) { | 310 | if (self.payModel.payType == CNLivePayCostTypeHtml) { |
| 293 | - [[CNLivePayCostNetwork sharePayCostNetWork] requestActiveGroupWjjPayMentWithFromId:CNUserShareModel.uid Toid:self.payModel.toId Price:self.payModel.price Expand:self.payModel.expand SourceId:self.payModel.orderId PayId:self.payModel.orderId PassWord:password CompleterBlock:^(NSInteger statue) { | 311 | + [[CNLivePayCostNetwork sharePayCostNetWork] requestActiveGroupWjjPayMentWithFromId:CNUserShareModel.uid Toid:self.payModel.toId Price:self.payModel.price Expand:self.payModel.expand SourceId:self.payModel.orderId PayId:self.payModel.orderId Desc:self.payModel.descStr NotifyUrl:self.payModel.notifyUrl PassWord:password CompleterBlock:^(NSInteger statue) { |
| 294 | [weakSelf showPayStatue:statue]; | 312 | [weakSelf showPayStatue:statue]; |
| 295 | }]; | 313 | }]; |
| 296 | } | 314 | } |
| @@ -310,12 +328,12 @@ static NSString *const CNActiveContentPayViewIdentifier = @"CNActiveContentPayVi | @@ -310,12 +328,12 @@ static NSString *const CNActiveContentPayViewIdentifier = @"CNActiveContentPayVi | ||
| 310 | resultView.moneryString = [NSString stringWithFormat:@"%.2f",weakSelf.payModel.price]; | 328 | resultView.moneryString = [NSString stringWithFormat:@"%.2f",weakSelf.payModel.price]; |
| 311 | resultView.fromVC = weakSelf.fromVC; | 329 | resultView.fromVC = weakSelf.fromVC; |
| 312 | resultView.remark = weakSelf.payModel.remark; | 330 | resultView.remark = weakSelf.payModel.remark; |
| 313 | - [weakSelf.viewController.navigationController pushViewController:resultView animated:YES]; | 331 | + [[CNLivePayCostNetwork paycost_navigationViewController] pushViewController:resultView animated:YES]; |
| 314 | }else if (weakSelf.payModel.payType == CNLivePayCostTypeGroup | 332 | }else if (weakSelf.payModel.payType == CNLivePayCostTypeGroup |
| 315 | || weakSelf.payModel.payType == CNLivePayCostTypeOrder) { | 333 | || weakSelf.payModel.payType == CNLivePayCostTypeOrder) { |
| 316 | CNLivePayCostResultViewController * payResultVC = [[CNLivePayCostResultViewController alloc] init]; | 334 | CNLivePayCostResultViewController * payResultVC = [[CNLivePayCostResultViewController alloc] init]; |
| 317 | payResultVC.fromVC = weakSelf.fromVC; | 335 | payResultVC.fromVC = weakSelf.fromVC; |
| 318 | - [weakSelf.viewController.navigationController pushViewController:payResultVC animated:YES]; | 336 | + [[CNLivePayCostNetwork paycost_navigationViewController] pushViewController:payResultVC animated:YES]; |
| 319 | }else{ | 337 | }else{ |
| 320 | if (weakSelf.completerBlock) weakSelf.completerBlock(CNLivePayCostTypeResultSucc); | 338 | if (weakSelf.completerBlock) weakSelf.completerBlock(CNLivePayCostTypeResultSucc); |
| 321 | } | 339 | } |
| @@ -352,6 +370,10 @@ static NSString *const CNActiveContentPayViewIdentifier = @"CNActiveContentPayVi | @@ -352,6 +370,10 @@ static NSString *const CNActiveContentPayViewIdentifier = @"CNActiveContentPayVi | ||
| 352 | [alertController addAction:actionSetting]; | 370 | [alertController addAction:actionSetting]; |
| 353 | [alertController showWithAnimated:YES]; | 371 | [alertController showWithAnimated:YES]; |
| 354 | if (self.completerBlock) self.completerBlock(CNLivePayCostTypeResultFail); | 372 | if (self.completerBlock) self.completerBlock(CNLivePayCostTypeResultFail); |
| 373 | + }else if (statue == 3) { | ||
| 374 | + [self dismiss:^{ | ||
| 375 | + if (weakSelf.completerBlock) weakSelf.completerBlock(CNLivePayCostTypeResultFail); | ||
| 376 | + }]; | ||
| 355 | } | 377 | } |
| 356 | } | 378 | } |
| 357 | -(void)checkWjjPayPasswordWithCompleterBlock:(void(^)(void))completerBlock | 379 | -(void)checkWjjPayPasswordWithCompleterBlock:(void(^)(void))completerBlock |
| @@ -438,6 +460,13 @@ static NSString *const CNActiveContentPayViewIdentifier = @"CNActiveContentPayVi | @@ -438,6 +460,13 @@ static NSString *const CNActiveContentPayViewIdentifier = @"CNActiveContentPayVi | ||
| 438 | } | 460 | } |
| 439 | return NO; | 461 | return NO; |
| 440 | } | 462 | } |
| 463 | +-(void)closeBtnAction | ||
| 464 | +{ | ||
| 465 | + self.indexPath = [NSIndexPath indexPathForRow:2 inSection:0]; | ||
| 466 | + [self.headerView.passwordView clearUpPassword]; | ||
| 467 | + [self.headerView.passwordView.textField resignFirstResponder]; | ||
| 468 | + [self.mainView setContentOffset:CGPointMake(0, 0) animated:YES]; | ||
| 469 | +} | ||
| 441 | #pragma mark - Lazy | 470 | #pragma mark - Lazy |
| 442 | -(NSMutableArray *)dataArray | 471 | -(NSMutableArray *)dataArray |
| 443 | { | 472 | { |
| @@ -535,6 +564,7 @@ static NSString *const CNActiveContentPayViewIdentifier = @"CNActiveContentPayVi | @@ -535,6 +564,7 @@ static NSString *const CNActiveContentPayViewIdentifier = @"CNActiveContentPayVi | ||
| 535 | [weakSelf payAction:password]; | 564 | [weakSelf payAction:password]; |
| 536 | } | 565 | } |
| 537 | }; | 566 | }; |
| 567 | + [_headerView.closeBtn addTarget:self action:@selector(closeBtnAction) forControlEvents:UIControlEventTouchUpInside]; | ||
| 538 | } | 568 | } |
| 539 | return _headerView; | 569 | return _headerView; |
| 540 | } | 570 | } |
CNLivePayCostModule/Classes/View/CNLivePayCostPasswordView.m
| @@ -118,8 +118,8 @@ | @@ -118,8 +118,8 @@ | ||
| 118 | { | 118 | { |
| 119 | if (!_closeBtn) { | 119 | if (!_closeBtn) { |
| 120 | _closeBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | 120 | _closeBtn = [UIButton buttonWithType:UIButtonTypeCustom]; |
| 121 | - [_closeBtn setImage:[UIImage imageNamed:@"tsq_guanbi"] forState:UIControlStateNormal]; | ||
| 122 | - [_closeBtn setImage:[UIImage imageNamed:@"tsq_guanbi"] forState:UIControlStateHighlighted]; | 121 | + [_closeBtn setImage:[CNLivePayCostNetwork payCost_setImageWithName:@"gz_shanchu"] forState:UIControlStateNormal]; |
| 122 | + [_closeBtn setImage:[CNLivePayCostNetwork payCost_setImageWithName:@"gz_shanchu"] forState:UIControlStateHighlighted]; | ||
| 123 | } | 123 | } |
| 124 | return _closeBtn; | 124 | return _closeBtn; |
| 125 | } | 125 | } |
| @@ -130,6 +130,7 @@ | @@ -130,6 +130,7 @@ | ||
| 130 | _nameLabel.font = [UIFont systemFontOfSize:16]; | 130 | _nameLabel.font = [UIFont systemFontOfSize:16]; |
| 131 | _nameLabel.textAlignment = NSTextAlignmentCenter; | 131 | _nameLabel.textAlignment = NSTextAlignmentCenter; |
| 132 | _nameLabel.text = @"请输入支付密码"; | 132 | _nameLabel.text = @"请输入支付密码"; |
| 133 | + _nameLabel.textColor = [UIColor blackColor]; | ||
| 133 | } | 134 | } |
| 134 | return _nameLabel; | 135 | return _nameLabel; |
| 135 | } | 136 | } |
CNLivePayCostModule/Classes/View/CNLivePayCostResultViewController.m
| @@ -60,14 +60,15 @@ | @@ -60,14 +60,15 @@ | ||
| 60 | -(void)backRootView | 60 | -(void)backRootView |
| 61 | { | 61 | { |
| 62 | self.navigationController.navigationBarHidden = NO; | 62 | self.navigationController.navigationBarHidden = NO; |
| 63 | - for (UIViewController * vc in self.navigationController.viewControllers) { | ||
| 64 | - | ||
| 65 | - if ([vc isKindOfClass:[_fromVC class]]) { | ||
| 66 | - [self.navigationController pushViewController:vc animated:YES]; | ||
| 67 | - return; | ||
| 68 | - } | ||
| 69 | - } | ||
| 70 | - [self.navigationController popToRootViewControllerAnimated:YES]; | 63 | +// for (UIViewController * vc in self.navigationController.viewControllers) { |
| 64 | +// | ||
| 65 | +// if ([vc isKindOfClass:[_fromVC class]]) { | ||
| 66 | +// [[CNLivePayCostNetwork paycost_navigationViewController] pushViewController:vc animated:YES]; | ||
| 67 | +// return; | ||
| 68 | +// } | ||
| 69 | +// } | ||
| 70 | +// [[CNLivePayCostNetwork paycost_navigationViewController] popToRootViewControllerAnimated:YES]; | ||
| 71 | + [[CNLivePayCostNetwork paycost_navigationViewController] popViewControllerAnimated:YES]; | ||
| 71 | } | 72 | } |
| 72 | -(void)setFromVC:(UIViewController *)fromVC | 73 | -(void)setFromVC:(UIViewController *)fromVC |
| 73 | { | 74 | { |
| @@ -89,8 +90,8 @@ | @@ -89,8 +90,8 @@ | ||
| 89 | _stutaButton.titleLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:20.0f]; | 90 | _stutaButton.titleLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:20.0f]; |
| 90 | [_stutaButton setTitle:@"支付成功!" forState:UIControlStateNormal]; | 91 | [_stutaButton setTitle:@"支付成功!" forState:UIControlStateNormal]; |
| 91 | [_stutaButton setTitle:@"支付成功!" forState: UIControlStateHighlighted]; | 92 | [_stutaButton setTitle:@"支付成功!" forState: UIControlStateHighlighted]; |
| 92 | - [_stutaButton setImage:UIImageMake(@"ye_zfcg") forState:UIControlStateNormal]; | ||
| 93 | - [_stutaButton setImage:UIImageMake(@"ye_zfcg") forState:UIControlStateHighlighted]; | 93 | + [_stutaButton setImage:[CNLivePayCostNetwork payCost_setImageWithName:@"ye_zfcg"] forState:UIControlStateNormal]; |
| 94 | + [_stutaButton setImage:[CNLivePayCostNetwork payCost_setImageWithName:@"ye_zfcg"] forState:UIControlStateHighlighted]; | ||
| 94 | } | 95 | } |
| 95 | return _stutaButton; | 96 | return _stutaButton; |
| 96 | } | 97 | } |
CNLivePayCostModule/Classes/View/CNLivePayCostScanResultViewController.m
| @@ -90,13 +90,14 @@ | @@ -90,13 +90,14 @@ | ||
| 90 | -(void)backAction:(UIButton *)backBtn | 90 | -(void)backAction:(UIButton *)backBtn |
| 91 | { | 91 | { |
| 92 | self.navigationController.navigationBarHidden = NO; | 92 | self.navigationController.navigationBarHidden = NO; |
| 93 | - for (UIViewController * vc in self.navigationController.viewControllers) { | ||
| 94 | - if ([vc isKindOfClass:[_fromVC class]]) { | ||
| 95 | - [self.navigationController popToViewController:vc animated:YES]; | ||
| 96 | - return; | ||
| 97 | - } | ||
| 98 | - } | ||
| 99 | - [self.navigationController popToRootViewControllerAnimated:YES]; | 93 | +// for (UIViewController * vc in self.navigationController.viewControllers) { |
| 94 | +// if ([vc isKindOfClass:[_fromVC class]]) { | ||
| 95 | +// [[CNLivePayCostNetwork paycost_navigationViewController] popToViewController:vc animated:YES]; | ||
| 96 | +// return; | ||
| 97 | +// } | ||
| 98 | +// } | ||
| 99 | +// [[CNLivePayCostNetwork paycost_navigationViewController] popToRootViewControllerAnimated:YES]; | ||
| 100 | + [[CNLivePayCostNetwork paycost_navigationViewController] popViewControllerAnimated:YES]; | ||
| 100 | } | 101 | } |
| 101 | - (void)setFromVC:(UIViewController *)fromVC | 102 | - (void)setFromVC:(UIViewController *)fromVC |
| 102 | { | 103 | { |
| @@ -118,8 +119,8 @@ | @@ -118,8 +119,8 @@ | ||
| 118 | [_successButton setTitleColor:CNLiveColorWithHexString(@"#333333") forState:UIControlStateNormal]; | 119 | [_successButton setTitleColor:CNLiveColorWithHexString(@"#333333") forState:UIControlStateNormal]; |
| 119 | [_successButton setTitleColor:CNLiveColorWithHexString(@"#333333") forState:UIControlStateHighlighted]; | 120 | [_successButton setTitleColor:CNLiveColorWithHexString(@"#333333") forState:UIControlStateHighlighted]; |
| 120 | [_successButton setTitle:@"支付成功!" forState: UIControlStateNormal]; | 121 | [_successButton setTitle:@"支付成功!" forState: UIControlStateNormal]; |
| 121 | - [_successButton setImage:UIImageMake(@"ye_zfcg") forState:UIControlStateNormal]; | ||
| 122 | - [_successButton setImage:UIImageMake(@"ye_zfcg") forState:UIControlStateHighlighted]; | 122 | + [_successButton setImage:[CNLivePayCostNetwork payCost_setImageWithName:@"ye_zfcg"] forState:UIControlStateNormal]; |
| 123 | + [_successButton setImage:[CNLivePayCostNetwork payCost_setImageWithName:@"ye_zfcg"] forState:UIControlStateHighlighted]; | ||
| 123 | } | 124 | } |
| 124 | return _successButton; | 125 | return _successButton; |
| 125 | } | 126 | } |
Example/CNLivePayCostModule.xcodeproj/project.pbxproj
| @@ -23,6 +23,13 @@ | @@ -23,6 +23,13 @@ | ||
| 23 | 6003F5BC195388D20070C39A /* Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5BB195388D20070C39A /* Tests.m */; }; | 23 | 6003F5BC195388D20070C39A /* Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5BB195388D20070C39A /* Tests.m */; }; |
| 24 | 71719F9F1E33DC2100824A3D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */; }; | 24 | 71719F9F1E33DC2100824A3D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */; }; |
| 25 | 7938ECBD2846EE480008FB99 /* CNLivePayCostProtocolImpl.m in Sources */ = {isa = PBXBuildFile; fileRef = 7938ECBC2846EE480008FB99 /* CNLivePayCostProtocolImpl.m */; }; | 25 | 7938ECBD2846EE480008FB99 /* CNLivePayCostProtocolImpl.m in Sources */ = {isa = PBXBuildFile; fileRef = 7938ECBC2846EE480008FB99 /* CNLivePayCostProtocolImpl.m */; }; |
| 26 | + 797F2D6328519B4000D5736C /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 797F2D6228519B2F00D5736C /* libc++.tbd */; }; | ||
| 27 | + 797F2D6528519B5400D5736C /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 797F2D6428519B4900D5736C /* libz.tbd */; }; | ||
| 28 | + 797F2D6728519B6000D5736C /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 797F2D6628519B6000D5736C /* SystemConfiguration.framework */; }; | ||
| 29 | + 797F2D6828519B6C00D5736C /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58F195388D20070C39A /* CoreGraphics.framework */; }; | ||
| 30 | + 797F2D6928519B7B00D5736C /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58F195388D20070C39A /* CoreGraphics.framework */; }; | ||
| 31 | + 797F2D6B28519B8800D5736C /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 797F2D6A28519B8800D5736C /* WebKit.framework */; }; | ||
| 32 | + 797F2D6D28519B9F00D5736C /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 797F2D6C28519B9F00D5736C /* CFNetwork.framework */; }; | ||
| 26 | 873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */; }; | 33 | 873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */; }; |
| 27 | F530AB2539E63072C2E93C4E /* Pods_CNLivePayCostModule_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 76A434486911C088D57DDC70 /* Pods_CNLivePayCostModule_Tests.framework */; }; | 34 | F530AB2539E63072C2E93C4E /* Pods_CNLivePayCostModule_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 76A434486911C088D57DDC70 /* Pods_CNLivePayCostModule_Tests.framework */; }; |
| 28 | /* End PBXBuildFile section */ | 35 | /* End PBXBuildFile section */ |
| @@ -64,6 +71,12 @@ | @@ -64,6 +71,12 @@ | ||
| 64 | 76A434486911C088D57DDC70 /* Pods_CNLivePayCostModule_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CNLivePayCostModule_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; | 71 | 76A434486911C088D57DDC70 /* Pods_CNLivePayCostModule_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CNLivePayCostModule_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; |
| 65 | 7938ECBB2846EE480008FB99 /* CNLivePayCostProtocolImpl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CNLivePayCostProtocolImpl.h; sourceTree = "<group>"; }; | 72 | 7938ECBB2846EE480008FB99 /* CNLivePayCostProtocolImpl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CNLivePayCostProtocolImpl.h; sourceTree = "<group>"; }; |
| 66 | 7938ECBC2846EE480008FB99 /* CNLivePayCostProtocolImpl.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CNLivePayCostProtocolImpl.m; sourceTree = "<group>"; }; | 73 | 7938ECBC2846EE480008FB99 /* CNLivePayCostProtocolImpl.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CNLivePayCostProtocolImpl.m; sourceTree = "<group>"; }; |
| 74 | + 797F2D6228519B2F00D5736C /* libc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "usr/lib/libc++.tbd"; sourceTree = SDKROOT; }; | ||
| 75 | + 797F2D6428519B4900D5736C /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; | ||
| 76 | + 797F2D6628519B6000D5736C /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; | ||
| 77 | + 797F2D6A28519B8800D5736C /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; | ||
| 78 | + 797F2D6C28519B9F00D5736C /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; }; | ||
| 79 | + 797F2D6E2851F67400D5736C /* CNLivePayCostModule_Example.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = CNLivePayCostModule_Example.entitlements; sourceTree = "<group>"; }; | ||
| 67 | 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Main.storyboard; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; }; | 80 | 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Main.storyboard; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; }; |
| 68 | 8DA7B240CDBA39A46D4DFA95 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; }; | 81 | 8DA7B240CDBA39A46D4DFA95 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; }; |
| 69 | A7C061FED03823CC85737DA1 /* Pods-CNLivePayCostModule_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CNLivePayCostModule_Example.debug.xcconfig"; path = "Target Support Files/Pods-CNLivePayCostModule_Example/Pods-CNLivePayCostModule_Example.debug.xcconfig"; sourceTree = "<group>"; }; | 82 | A7C061FED03823CC85737DA1 /* Pods-CNLivePayCostModule_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CNLivePayCostModule_Example.debug.xcconfig"; path = "Target Support Files/Pods-CNLivePayCostModule_Example/Pods-CNLivePayCostModule_Example.debug.xcconfig"; sourceTree = "<group>"; }; |
| @@ -77,7 +90,14 @@ | @@ -77,7 +90,14 @@ | ||
| 77 | isa = PBXFrameworksBuildPhase; | 90 | isa = PBXFrameworksBuildPhase; |
| 78 | buildActionMask = 2147483647; | 91 | buildActionMask = 2147483647; |
| 79 | files = ( | 92 | files = ( |
| 93 | + 797F2D6B28519B8800D5736C /* WebKit.framework in Frameworks */, | ||
| 94 | + 797F2D6D28519B9F00D5736C /* CFNetwork.framework in Frameworks */, | ||
| 80 | 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */, | 95 | 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */, |
| 96 | + 797F2D6728519B6000D5736C /* SystemConfiguration.framework in Frameworks */, | ||
| 97 | + 797F2D6528519B5400D5736C /* libz.tbd in Frameworks */, | ||
| 98 | + 797F2D6928519B7B00D5736C /* CoreGraphics.framework in Frameworks */, | ||
| 99 | + 797F2D6328519B4000D5736C /* libc++.tbd in Frameworks */, | ||
| 100 | + 797F2D6828519B6C00D5736C /* CoreGraphics.framework in Frameworks */, | ||
| 81 | 6003F592195388D20070C39A /* UIKit.framework in Frameworks */, | 101 | 6003F592195388D20070C39A /* UIKit.framework in Frameworks */, |
| 82 | 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */, | 102 | 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */, |
| 83 | 01C8E1692AE74160B42E3059 /* Pods_CNLivePayCostModule_Example.framework in Frameworks */, | 103 | 01C8E1692AE74160B42E3059 /* Pods_CNLivePayCostModule_Example.framework in Frameworks */, |
| @@ -112,6 +132,7 @@ | @@ -112,6 +132,7 @@ | ||
| 112 | 6003F581195388D10070C39A = { | 132 | 6003F581195388D10070C39A = { |
| 113 | isa = PBXGroup; | 133 | isa = PBXGroup; |
| 114 | children = ( | 134 | children = ( |
| 135 | + 797F2D6E2851F67400D5736C /* CNLivePayCostModule_Example.entitlements */, | ||
| 115 | 60FF7A9C1954A5C5007DD14C /* Podspec Metadata */, | 136 | 60FF7A9C1954A5C5007DD14C /* Podspec Metadata */, |
| 116 | 6003F593195388D20070C39A /* Example for CNLivePayCostModule */, | 137 | 6003F593195388D20070C39A /* Example for CNLivePayCostModule */, |
| 117 | 6003F5B5195388D20070C39A /* Tests */, | 138 | 6003F5B5195388D20070C39A /* Tests */, |
| @@ -133,6 +154,11 @@ | @@ -133,6 +154,11 @@ | ||
| 133 | 6003F58C195388D20070C39A /* Frameworks */ = { | 154 | 6003F58C195388D20070C39A /* Frameworks */ = { |
| 134 | isa = PBXGroup; | 155 | isa = PBXGroup; |
| 135 | children = ( | 156 | children = ( |
| 157 | + 797F2D6C28519B9F00D5736C /* CFNetwork.framework */, | ||
| 158 | + 797F2D6A28519B8800D5736C /* WebKit.framework */, | ||
| 159 | + 797F2D6628519B6000D5736C /* SystemConfiguration.framework */, | ||
| 160 | + 797F2D6428519B4900D5736C /* libz.tbd */, | ||
| 161 | + 797F2D6228519B2F00D5736C /* libc++.tbd */, | ||
| 136 | 6003F58D195388D20070C39A /* Foundation.framework */, | 162 | 6003F58D195388D20070C39A /* Foundation.framework */, |
| 137 | 6003F58F195388D20070C39A /* CoreGraphics.framework */, | 163 | 6003F58F195388D20070C39A /* CoreGraphics.framework */, |
| 138 | 6003F591195388D20070C39A /* UIKit.framework */, | 164 | 6003F591195388D20070C39A /* UIKit.framework */, |
| @@ -574,12 +600,13 @@ | @@ -574,12 +600,13 @@ | ||
| 574 | baseConfigurationReference = A7C061FED03823CC85737DA1 /* Pods-CNLivePayCostModule_Example.debug.xcconfig */; | 600 | baseConfigurationReference = A7C061FED03823CC85737DA1 /* Pods-CNLivePayCostModule_Example.debug.xcconfig */; |
| 575 | buildSettings = { | 601 | buildSettings = { |
| 576 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | 602 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; |
| 603 | + CODE_SIGN_ENTITLEMENTS = CNLivePayCostModule_Example.entitlements; | ||
| 577 | DEVELOPMENT_TEAM = 94X49GG3ZW; | 604 | DEVELOPMENT_TEAM = 94X49GG3ZW; |
| 578 | GCC_PRECOMPILE_PREFIX_HEADER = YES; | 605 | GCC_PRECOMPILE_PREFIX_HEADER = YES; |
| 579 | GCC_PREFIX_HEADER = "CNLivePayCostModule/CNLivePayCostModule-Prefix.pch"; | 606 | GCC_PREFIX_HEADER = "CNLivePayCostModule/CNLivePayCostModule-Prefix.pch"; |
| 580 | INFOPLIST_FILE = "CNLivePayCostModule/CNLivePayCostModule-Info.plist"; | 607 | INFOPLIST_FILE = "CNLivePayCostModule/CNLivePayCostModule-Info.plist"; |
| 581 | MODULE_NAME = ExampleApp; | 608 | MODULE_NAME = ExampleApp; |
| 582 | - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; | 609 | + PRODUCT_BUNDLE_IDENTIFIER = com.cnlive.CNLiveNetAdd.debug; |
| 583 | PRODUCT_NAME = "$(TARGET_NAME)"; | 610 | PRODUCT_NAME = "$(TARGET_NAME)"; |
| 584 | SWIFT_VERSION = 4.0; | 611 | SWIFT_VERSION = 4.0; |
| 585 | WRAPPER_EXTENSION = app; | 612 | WRAPPER_EXTENSION = app; |
| @@ -591,12 +618,13 @@ | @@ -591,12 +618,13 @@ | ||
| 591 | baseConfigurationReference = 3F31B47D5821EBC8F4E235F1 /* Pods-CNLivePayCostModule_Example.release.xcconfig */; | 618 | baseConfigurationReference = 3F31B47D5821EBC8F4E235F1 /* Pods-CNLivePayCostModule_Example.release.xcconfig */; |
| 592 | buildSettings = { | 619 | buildSettings = { |
| 593 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | 620 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; |
| 621 | + CODE_SIGN_ENTITLEMENTS = CNLivePayCostModule_Example.entitlements; | ||
| 594 | DEVELOPMENT_TEAM = 94X49GG3ZW; | 622 | DEVELOPMENT_TEAM = 94X49GG3ZW; |
| 595 | GCC_PRECOMPILE_PREFIX_HEADER = YES; | 623 | GCC_PRECOMPILE_PREFIX_HEADER = YES; |
| 596 | GCC_PREFIX_HEADER = "CNLivePayCostModule/CNLivePayCostModule-Prefix.pch"; | 624 | GCC_PREFIX_HEADER = "CNLivePayCostModule/CNLivePayCostModule-Prefix.pch"; |
| 597 | INFOPLIST_FILE = "CNLivePayCostModule/CNLivePayCostModule-Info.plist"; | 625 | INFOPLIST_FILE = "CNLivePayCostModule/CNLivePayCostModule-Info.plist"; |
| 598 | MODULE_NAME = ExampleApp; | 626 | MODULE_NAME = ExampleApp; |
| 599 | - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; | 627 | + PRODUCT_BUNDLE_IDENTIFIER = com.cnlive.CNLiveNetAdd.debug; |
| 600 | PRODUCT_NAME = "$(TARGET_NAME)"; | 628 | PRODUCT_NAME = "$(TARGET_NAME)"; |
| 601 | SWIFT_VERSION = 4.0; | 629 | SWIFT_VERSION = 4.0; |
| 602 | WRAPPER_EXTENSION = app; | 630 | WRAPPER_EXTENSION = app; |
Example/CNLivePayCostModule/CNLIVEAppDelegate.m
| @@ -7,14 +7,103 @@ | @@ -7,14 +7,103 @@ | ||
| 7 | // | 7 | // |
| 8 | 8 | ||
| 9 | #import "CNLIVEAppDelegate.h" | 9 | #import "CNLIVEAppDelegate.h" |
| 10 | - | 10 | +#import "CNLIVEViewController.h" |
| 11 | +#import <CNLivePayCostModule/CNLivePayCostHeader.h> | ||
| 12 | +#import <CNLivePayCostModule/CNLivePayCostModel.h> | ||
| 11 | @implementation CNLIVEAppDelegate | 13 | @implementation CNLIVEAppDelegate |
| 12 | 14 | ||
| 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | 15 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions |
| 14 | { | 16 | { |
| 15 | // Override point for customization after application launch. | 17 | // Override point for customization after application launch. |
| 18 | + [CNLivePayCostModule finishLaunchingWithPayPluginSettings]; | ||
| 19 | + | ||
| 20 | + [CNUserInfoManager manager].userInfoModel.uid = @"10458139"; | ||
| 21 | + | ||
| 22 | + UINavigationController *navCtrl = [[UINavigationController alloc] initWithRootViewController:[[CNLIVEViewController alloc] init]]; | ||
| 23 | + | ||
| 24 | + self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; | ||
| 25 | + self.window.rootViewController = navCtrl; | ||
| 26 | + self.window.backgroundColor = [UIColor whiteColor]; | ||
| 27 | + [self.window makeKeyAndVisible]; | ||
| 28 | + | ||
| 29 | + [self setParamNet]; | ||
| 30 | + | ||
| 16 | return YES; | 31 | return YES; |
| 17 | } | 32 | } |
| 33 | +-(void)setParamNet | ||
| 34 | +{ | ||
| 35 | + NSMutableDictionary * mDict = [[NSMutableDictionary alloc] init]; | ||
| 36 | + [mDict setValue:[CNUserInfoManager manager].userInfoModel.uid forKey:@"loginSid"]; | ||
| 37 | + [mDict setValue:@"com.cnlive.CNLiveNetAdd.debug" forKey:@"platform_id"]; | ||
| 38 | + [mDict setValue:[[[[UIDevice currentDevice] identifierForVendor] UUIDString] stringByReplacingOccurrencesOfString:@"-" withString:@""] forKey:@"uuid"]; | ||
| 39 | + [mDict setValue:@"i" forKey:@"plat"]; | ||
| 40 | + [mDict setValue:[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"] forKey:@"ver"]; | ||
| 41 | + [mDict setObject:AppId forKey:@"appId"]; | ||
| 42 | + [mDict setObject:[CNUserInfoManager manager].userInfoModel.uid forKey:@"sid"]; | ||
| 43 | + [CNLiveNetworking setupDefaultParam:mDict]; | ||
| 44 | + [CNLiveNetworking setupShowResult:NO]; | ||
| 45 | + [CNLiveNetworking setupSignKey:APPKey]; | ||
| 46 | + [CNLiveNetworking setAllowRequestDefaultArgument:YES]; | ||
| 47 | + [CNLiveNetworking setResponseSerializerType:CNLiveResponseSerializerJSON]; | ||
| 48 | +} | ||
| 49 | + | ||
| 50 | + | ||
| 51 | +- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url | ||
| 52 | +{ | ||
| 53 | + NSString *string =[url absoluteString]; | ||
| 54 | + if ([string hasPrefix:@"unifyPayDemo://"]) | ||
| 55 | + { | ||
| 56 | + return [UMSPPPayUnifyPayPlugin cloudPayHandleOpenURL:url]; | ||
| 57 | + } | ||
| 58 | + return [UMSPPPayUnifyPayPlugin handleOpenURL:url otherDelegate:[CNLivePayCostModel sharePayCostModel]]; | ||
| 59 | +} | ||
| 60 | + | ||
| 61 | +- (BOOL)application:(UIApplication *)application | ||
| 62 | + openURL:(NSURL *)url | ||
| 63 | + sourceApplication:(NSString *)sourceApplication | ||
| 64 | + annotation:(id)annotation { | ||
| 65 | + | ||
| 66 | + NSString *string =[url absoluteString]; | ||
| 67 | + if ([string hasPrefix:@"unifyPayDemo://"]) | ||
| 68 | + { | ||
| 69 | + return [UMSPPPayUnifyPayPlugin cloudPayHandleOpenURL:url]; | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + return [UMSPPPayUnifyPayPlugin handleOpenURL:url otherDelegate:[CNLivePayCostModel sharePayCostModel]]; | ||
| 73 | +} | ||
| 74 | + | ||
| 75 | + | ||
| 76 | +- (BOOL)application:(UIApplication *)app | ||
| 77 | + openURL:(NSURL *)url | ||
| 78 | + options:(NSDictionary<NSString *,id> *)options{ | ||
| 79 | + | ||
| 80 | + NSString *string =[url absoluteString]; | ||
| 81 | + if ([string hasPrefix:@"unifyPayDemo://"]) | ||
| 82 | + { | ||
| 83 | + return [UMSPPPayUnifyPayPlugin cloudPayHandleOpenURL:url]; | ||
| 84 | + } | ||
| 85 | + else if ([string hasPrefix:@"qmfpppay://"]) | ||
| 86 | + { | ||
| 87 | + [UMSPPPayUnifyPayPlugin aliMiniPayHandleOpenURL:url]; | ||
| 88 | + return YES; | ||
| 89 | + | ||
| 90 | + } | ||
| 91 | + [UMSPPPayUnifyPayPlugin aliMiniPayHandleOpenURL:url]; | ||
| 92 | + [WXApi handleOpenURL:url delegate:[CNLivePayCostModel sharePayCostModel]]; | ||
| 93 | + return [UMSPPPayUnifyPayPlugin handleOpenURL:url otherDelegate:[CNLivePayCostModel sharePayCostModel]]; | ||
| 94 | +}; | ||
| 95 | + | ||
| 96 | +- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler API_AVAILABLE(ios(8.0)){ | ||
| 97 | + if (@available(iOS 8.0, *)) { | ||
| 98 | + [WXApi handleOpenUniversalLink:userActivity delegate:[CNLivePayCostModel sharePayCostModel]]; | ||
| 99 | + return [UMSPPPayUnifyPayPlugin handleOpenUniversalLink:userActivity otherDelegate:[CNLivePayCostModel sharePayCostModel]]; | ||
| 100 | + } else { | ||
| 101 | + // Fallback on earlier versions | ||
| 102 | + return YES; | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | +} | ||
| 106 | + | ||
| 18 | 107 | ||
| 19 | - (void)applicationWillResignActive:(UIApplication *)application | 108 | - (void)applicationWillResignActive:(UIApplication *)application |
| 20 | { | 109 | { |
Example/CNLivePayCostModule/CNLIVEViewController.m
| @@ -8,6 +8,8 @@ | @@ -8,6 +8,8 @@ | ||
| 8 | 8 | ||
| 9 | #import "CNLIVEViewController.h" | 9 | #import "CNLIVEViewController.h" |
| 10 | #import <CNLivePayCostModule/CNLivePayCostModule.h> | 10 | #import <CNLivePayCostModule/CNLivePayCostModule.h> |
| 11 | +#import "WXApi.h" | ||
| 12 | + | ||
| 11 | @interface CNLIVEViewController () | 13 | @interface CNLIVEViewController () |
| 12 | 14 | ||
| 13 | @end | 15 | @end |
| @@ -18,18 +20,111 @@ | @@ -18,18 +20,111 @@ | ||
| 18 | { | 20 | { |
| 19 | [super viewDidLoad]; | 21 | [super viewDidLoad]; |
| 20 | // Do any additional setup after loading the view, typically from a nib. | 22 | // Do any additional setup after loading the view, typically from a nib. |
| 23 | + | ||
| 24 | + CGFloat kWidth = [UIScreen mainScreen].bounds.size.width; | ||
| 25 | + | ||
| 26 | + UIButton * requestBtn = [UIButton buttonWithType:UIButtonTypeSystem]; | ||
| 27 | + requestBtn.frame = CGRectMake(0, 100, kWidth, 70); | ||
| 28 | + requestBtn.backgroundColor = [UIColor cyanColor]; | ||
| 29 | + [requestBtn setTitle:@"拉起支付" forState: UIControlStateNormal]; | ||
| 30 | + [requestBtn setTitle:@"拉起支付" forState: UIControlStateHighlighted]; | ||
| 31 | + [requestBtn addTarget:self action:@selector(requestAction) forControlEvents:UIControlEventTouchUpInside]; | ||
| 32 | + [self.view addSubview:requestBtn]; | ||
| 33 | + | ||
| 34 | + UIButton * batchBtn = [UIButton buttonWithType:UIButtonTypeSystem]; | ||
| 35 | + batchBtn.frame = CGRectMake(0, CGRectGetMaxY(requestBtn.frame)+5, kWidth, 70); | ||
| 36 | + batchBtn.backgroundColor = [UIColor cyanColor]; | ||
| 37 | + [batchBtn setTitle:@"支付宝支付" forState: UIControlStateNormal]; | ||
| 38 | + [batchBtn setTitle:@"支付宝支付" forState: UIControlStateHighlighted]; | ||
| 39 | + [batchBtn addTarget:self action:@selector(batchRequestAction) forControlEvents:UIControlEventTouchUpInside]; | ||
| 40 | + [self.view addSubview:batchBtn]; | ||
| 41 | +} | ||
| 42 | +-(void)requestAction | ||
| 43 | +{ | ||
| 44 | +// [CNLivePayCostNetwork requestWithUMSPayForPrePayWithOrderId:[self generateTradeNO] Body:@"测试" Price:@"1" CouponFee:@"0" BalanceFee:@"0" NotifyUrl:@"http://unifypay.cnlive.com/test/notify_url" Type:CNLivePayCostPayTypeWeChatPay FrmId:@"debug"]; | ||
| 45 | + NSDictionary * paramDict = @{ | ||
| 46 | + @"orderId":[self generateTradeNO], | ||
| 47 | + @"userId":@"10458139", | ||
| 48 | + @"descStr":@"测试", | ||
| 49 | + @"price":@0.01, | ||
| 50 | + @"orderType":@"1", | ||
| 51 | + @"notifyUrl":@"http://unifypay.cnlive.com/test/notify_url" | ||
| 52 | + }; | ||
| 53 | + [CNLivePayCostModule showDefaultPayViwWithParamDict:paramDict PayCostType:CNLivePayCostTypeOrder FromVC:self ResultBlock:^(CNLivePayCostTypeResult resultType) { | ||
| 54 | + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:resultType == CNLivePayCostTypeResultSucc?@"支付成功":@"支付失败" message:nil delegate:self cancelButtonTitle:@"确认" otherButtonTitles:nil, nil]; | ||
| 55 | + [alert show]; | ||
| 56 | + }]; | ||
| 57 | + | ||
| 58 | +} | ||
| 59 | +-(void)batchRequestAction | ||
| 60 | +{ | ||
| 61 | +// [CNLivePayCostNetwork requestWithUMSPayForPrePayWithOrderId:[self generateTradeNO] Body:@"测试" Price:@"1" CouponFee:@"0" BalanceFee:@"0" NotifyUrl:@"http://unifypay.cnlive.com/test/notify_url" Type:CNLivePayCostPayTypeAliPay FrmId:@"debug" PassWord:@"" CompleterBlcok:^(NSInteger statue) { | ||
| 62 | +// | ||
| 63 | +// }]; | ||
| 64 | + | ||
| 65 | + NSDictionary * paramDict = @{ | ||
| 66 | + @"orderId":[self generateTradeNO], | ||
| 67 | + @"userId":@"10458139", | ||
| 68 | + @"descStr":@"测试", | ||
| 69 | + @"price":@0.01, | ||
| 70 | + @"orderType":@"1", | ||
| 71 | + @"notifyUrl":@"http://unifypay.cnlive.com/test/notify_url", | ||
| 72 | + @"password":@"123456" | ||
| 73 | + }; | ||
| 74 | + [CNLivePayCostModule showShopPayViwWithParamDict:paramDict PayType:CNLivePayCostPayTypeWeChatPay ResultBlock:^(CNLivePayCostTypeResult resultType) { | ||
| 75 | + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:resultType == CNLivePayCostTypeResultSucc?@"支付成功":@"支付失败" message:nil delegate:self cancelButtonTitle:@"确认" otherButtonTitles:nil, nil]; | ||
| 76 | + [alert show]; | ||
| 77 | + }]; | ||
| 21 | } | 78 | } |
| 22 | -(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event | 79 | -(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event |
| 23 | { | 80 | { |
| 24 | [super touchesBegan:touches withEvent:event]; | 81 | [super touchesBegan:touches withEvent:event]; |
| 25 | - [CNLivePayCostModule showDefaultPayViwWithParamDict:@{} PayCostType:CNLivePayCostTypeHtml FromVC:self ResultBlock:^(CNLivePayCostTypeResult resultType) { | ||
| 26 | - | ||
| 27 | - }]; | 82 | +// if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"alipays://"]]) { |
| 83 | +// [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"alipays://"]]; | ||
| 84 | +// } | ||
| 85 | + | ||
| 86 | +// NSDictionary * paramDict = @{ | ||
| 87 | +// @"miniuser": @"2019010762862511", | ||
| 88 | +// @"msgType": @"trade.appPreOrder", | ||
| 89 | +// @"package": @"Sign=ALI", | ||
| 90 | +// @"minipath": @"pages/appPay/test/test", | ||
| 91 | +// @"appScheme": @"iOS:qmfpppay;Android:qmfpppay", | ||
| 92 | +// @"sign": @"C8E269942EB13494ED6B9F81956606E7", | ||
| 93 | +// @"prepayid": @"ori=101720220609570858884356", | ||
| 94 | +// @"noncestr": @"VnwtNeidfwbGmNGlinLLBBSBmDmNxKnf", | ||
| 95 | +// @"timestamp": @"20220609144445" | ||
| 96 | +// }; | ||
| 97 | +// NSString *payDataJsonStr = [[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:paramDict options:NSJSONWritingPrettyPrinted error:nil] encoding:NSUTF8StringEncoding]; | ||
| 98 | +// [UMSPPPayUnifyPayPlugin payWithPayChannel:CHANNEL_ALIPAY payData:payDataJsonStr callbackBlock:^(NSString *resultCode, NSString *resultInfo) { | ||
| 99 | +// | ||
| 100 | +// }]; | ||
| 28 | } | 101 | } |
| 29 | - (void)didReceiveMemoryWarning | 102 | - (void)didReceiveMemoryWarning |
| 30 | { | 103 | { |
| 31 | [super didReceiveMemoryWarning]; | 104 | [super didReceiveMemoryWarning]; |
| 32 | // Dispose of any resources that can be recreated. | 105 | // Dispose of any resources that can be recreated. |
| 33 | } | 106 | } |
| 107 | +- (NSString *)generateTradeNO | ||
| 108 | +{ | ||
| 109 | + static int kNumber = 15; | ||
| 110 | + | ||
| 111 | + NSString *sourceStr = @"0123456789"; | ||
| 112 | + | ||
| 113 | + NSMutableString *resultStr = [[NSMutableString alloc] init]; | ||
| 114 | + | ||
| 115 | + srand((unsigned)time(0)); | ||
| 116 | + | ||
| 117 | + for (int i = 0; i < kNumber; i++) { | ||
| 118 | + | ||
| 119 | + unsigned index = rand() % [sourceStr length]; | ||
| 34 | 120 | ||
| 121 | + NSString *oneStr = [sourceStr substringWithRange:NSMakeRange(index, 1)]; | ||
| 122 | + | ||
| 123 | + [resultStr appendString:oneStr]; | ||
| 124 | + | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + return resultStr; | ||
| 128 | + | ||
| 129 | +} | ||
| 35 | @end | 130 | @end |
Example/CNLivePayCostModule/CNLivePayCostModule-Info.plist
| @@ -20,8 +20,60 @@ | @@ -20,8 +20,60 @@ | ||
| 20 | <string>1.0</string> | 20 | <string>1.0</string> |
| 21 | <key>CFBundleSignature</key> | 21 | <key>CFBundleSignature</key> |
| 22 | <string>????</string> | 22 | <string>????</string> |
| 23 | + <key>CFBundleURLTypes</key> | ||
| 24 | + <array> | ||
| 25 | + <dict> | ||
| 26 | + <key>CFBundleTypeRole</key> | ||
| 27 | + <string>Editor</string> | ||
| 28 | + <key>CFBundleURLName</key> | ||
| 29 | + <string>微信测试</string> | ||
| 30 | + <key>CFBundleURLSchemes</key> | ||
| 31 | + <array> | ||
| 32 | + <string>wx9b7f9443a8ccf15a</string> | ||
| 33 | + </array> | ||
| 34 | + </dict> | ||
| 35 | + <dict> | ||
| 36 | + <key>CFBundleTypeRole</key> | ||
| 37 | + <string>Editor</string> | ||
| 38 | + <key>CFBundleURLName</key> | ||
| 39 | + <string>微信正式</string> | ||
| 40 | + <key>CFBundleURLSchemes</key> | ||
| 41 | + <array> | ||
| 42 | + <string>wxed528fc749b7ee88</string> | ||
| 43 | + </array> | ||
| 44 | + </dict> | ||
| 45 | + <dict> | ||
| 46 | + <key>CFBundleTypeRole</key> | ||
| 47 | + <string>Editor</string> | ||
| 48 | + <key>CFBundleURLSchemes</key> | ||
| 49 | + <array> | ||
| 50 | + <string>qmfpppay</string> | ||
| 51 | + </array> | ||
| 52 | + </dict> | ||
| 53 | + <dict> | ||
| 54 | + <key>CFBundleTypeRole</key> | ||
| 55 | + <string>Editor</string> | ||
| 56 | + <key>CFBundleURLSchemes</key> | ||
| 57 | + <array> | ||
| 58 | + <string>netpppay</string> | ||
| 59 | + </array> | ||
| 60 | + </dict> | ||
| 61 | + </array> | ||
| 23 | <key>CFBundleVersion</key> | 62 | <key>CFBundleVersion</key> |
| 24 | <string>1.0</string> | 63 | <string>1.0</string> |
| 64 | + <key>LSApplicationQueriesSchemes</key> | ||
| 65 | + <array> | ||
| 66 | + <string>weixinULAPI</string> | ||
| 67 | + <string>weixin</string> | ||
| 68 | + <string>wechat</string> | ||
| 69 | + <string>alipays</string> | ||
| 70 | + <string>alipay</string> | ||
| 71 | + <string>uppaysdk</string> | ||
| 72 | + <string>uppaywallet</string> | ||
| 73 | + <string>uppayx1</string> | ||
| 74 | + <string>uppayx2</string> | ||
| 75 | + <string>uppayx3</string> | ||
| 76 | + </array> | ||
| 25 | <key>LSRequiresIPhoneOS</key> | 77 | <key>LSRequiresIPhoneOS</key> |
| 26 | <true/> | 78 | <true/> |
| 27 | <key>UILaunchStoryboardName</key> | 79 | <key>UILaunchStoryboardName</key> |
Example/CNLivePayCostModule/CNLivePayCostProtocolImpl.m
| @@ -18,4 +18,10 @@ | @@ -18,4 +18,10 @@ | ||
| 18 | //[[AppDelegate sharedAppDelegate] pushViewController:payCenterVC withBackTitle:@" "]; | 18 | //[[AppDelegate sharedAppDelegate] pushViewController:payCenterVC withBackTitle:@" "]; |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | +/// 改变支付调用方法 | ||
| 22 | +-(BOOL)pushActivePaymentNewPaycostWayWithModthod | ||
| 23 | +{ | ||
| 24 | + return YES; | ||
| 25 | +} | ||
| 26 | + | ||
| 21 | @end | 27 | @end |
Example/CNLivePayCostModule/main.m
| @@ -8,10 +8,11 @@ | @@ -8,10 +8,11 @@ | ||
| 8 | 8 | ||
| 9 | @import UIKit; | 9 | @import UIKit; |
| 10 | #import "CNLIVEAppDelegate.h" | 10 | #import "CNLIVEAppDelegate.h" |
| 11 | - | 11 | +#import <CNLiveEnvironment/CNLiveEnvironmentManager.h> |
| 12 | int main(int argc, char * argv[]) | 12 | int main(int argc, char * argv[]) |
| 13 | { | 13 | { |
| 14 | @autoreleasepool { | 14 | @autoreleasepool { |
| 15 | + [CNLiveEnvironmentManager setAppType:CNLiveAppTypeUser environmentType:CNLiveDebugAppStore];//CNLiveProductionAppStore//CNLiveDebugAppStore]; | ||
| 15 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([CNLIVEAppDelegate class])); | 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([CNLIVEAppDelegate class])); |
| 16 | } | 17 | } |
| 17 | } | 18 | } |
Example/CNLivePayCostModule_Example.entitlements
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
| 3 | +<plist version="1.0"> | ||
| 4 | +<dict> | ||
| 5 | + <key>com.apple.developer.associated-domains</key> | ||
| 6 | + <array> | ||
| 7 | + <string>applinks:apiwjjtest.cnlive.com</string> | ||
| 8 | + <string>applinks:applelinkstest.cnlive.com</string> | ||
| 9 | + <string>applinks:apiwjj.cnlive.com</string> | ||
| 10 | + </array> | ||
| 11 | +</dict> | ||
| 12 | +</plist> |