Commit bc443e346b42e3c1abe88cdf2ae7498055a9f645
1 parent
6d93e3ec
0.0.6
Showing
8 changed files
with
133 additions
and
36 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.5' | 11 | + s.version = '0.0.6' |
| 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. |
CNLivePayCostModule/Classes/Core/CNLivePayCostModule.m
| @@ -117,7 +117,7 @@ | @@ -117,7 +117,7 @@ | ||
| 117 | payModel.isHiddenWjjpay = ![paramDict boolValueForKey:@"wjj" default:NO]; | 117 | payModel.isHiddenWjjpay = ![paramDict boolValueForKey:@"wjj" default:NO]; |
| 118 | payModel.isHiddenAlipay = ![paramDict boolValueForKey:@"ali" default:NO]; | 118 | payModel.isHiddenAlipay = ![paramDict boolValueForKey:@"ali" default:NO]; |
| 119 | payModel.isHiddenWechat = ![paramDict boolValueForKey:@"wechat" default:NO]; | 119 | payModel.isHiddenWechat = ![paramDict boolValueForKey:@"wechat" default:NO]; |
| 120 | - payModel.isHiddenUnionpay = [paramDict boolValueForKey:@"union" default:NO]; | 120 | + payModel.isHiddenUnionpay = ![paramDict boolValueForKey:@"union" default:NO]; |
| 121 | payModel.price = [paramDict floatValueForKey:@"price" default:0.00]; | 121 | payModel.price = [paramDict floatValueForKey:@"price" default:0.00]; |
| 122 | payModel.descStr = [paramDict stringValueForKey:@"title" default:@"网家家"]; | 122 | payModel.descStr = [paramDict stringValueForKey:@"title" default:@"网家家"]; |
| 123 | 123 | ||
| @@ -212,9 +212,9 @@ | @@ -212,9 +212,9 @@ | ||
| 212 | { | 212 | { |
| 213 | NSString * orderId = [paramDict stringValueForKey:@"orderId" default:@""]; | 213 | NSString * orderId = [paramDict stringValueForKey:@"orderId" default:@""]; |
| 214 | NSString * body = [paramDict stringValueForKey:@"body" 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"]; | 215 | + NSString * price = [paramDict stringValueForKey:@"price" default:@""]; |
| 216 | + NSString * couponFee = [paramDict stringValueForKey:@"coupon_fee" default:@""]; | ||
| 217 | + NSString * balanceFee = [paramDict stringValueForKey:@"balance_fee" default:@""]; | ||
| 218 | NSString * notifyUrl = [paramDict stringValueForKey:@"notifyUrl" default:@""]; | 218 | NSString * notifyUrl = [paramDict stringValueForKey:@"notifyUrl" default:@""]; |
| 219 | NSString * password = [paramDict stringValueForKey:@"password" default:@""]; | 219 | NSString * password = [paramDict stringValueForKey:@"password" default:@""]; |
| 220 | 220 |
CNLivePayCostModule/Classes/Core/CNLivePayCostNetwork.h
| @@ -56,6 +56,7 @@ NS_ASSUME_NONNULL_BEGIN | @@ -56,6 +56,7 @@ NS_ASSUME_NONNULL_BEGIN | ||
| 56 | -(void)requestActiveGroupPayInfoWithGroupId:(NSString *)groupId | 56 | -(void)requestActiveGroupPayInfoWithGroupId:(NSString *)groupId |
| 57 | CNLiveActiveGroupPayType:(CNLivePayCostPayType)payType | 57 | CNLiveActiveGroupPayType:(CNLivePayCostPayType)payType |
| 58 | CNLiveActiveGroupThreePayType:(CNLivePayCostThreePayType)threeType | 58 | CNLiveActiveGroupThreePayType:(CNLivePayCostThreePayType)threeType |
| 59 | + Type:(CNLivePayCostType)type | ||
| 59 | PriceId:(NSString *)price | 60 | PriceId:(NSString *)price |
| 60 | Desc:(NSString *)desc | 61 | Desc:(NSString *)desc |
| 61 | Expand:(NSString *)expand | 62 | Expand:(NSString *)expand |
CNLivePayCostModule/Classes/Core/CNLivePayCostNetwork.m
| @@ -63,8 +63,7 @@ static NSString *const CNLiveWillBecomeActivePaycostForSHShopNotification = @"CN | @@ -63,8 +63,7 @@ static NSString *const CNLiveWillBecomeActivePaycostForSHShopNotification = @"CN | ||
| 63 | 63 | ||
| 64 | if (type == CNLivePayCostPayTypeWeChatPay) { | 64 | if (type == CNLivePayCostPayTypeWeChatPay) { |
| 65 | 65 | ||
| 66 | - 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,notifyUrls,notify_url]; | ||
| 67 | - NSLog(@"===>%@",path); | 66 | + 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=%@&&balance_fee=%@",AppId,body,orderId,CNUserShareModel.uid?CNUserShareModel.uid:@"",price,notifyUrls,notify_url,coupon_fee,balance_fee]; |
| 68 | WXLaunchMiniProgramReq *launchMiniProgramReq = [WXLaunchMiniProgramReq object]; | 67 | WXLaunchMiniProgramReq *launchMiniProgramReq = [WXLaunchMiniProgramReq object]; |
| 69 | launchMiniProgramReq.userName = @"gh_061b347b32c1"; //拉起的小程序的username | 68 | launchMiniProgramReq.userName = @"gh_061b347b32c1"; //拉起的小程序的username |
| 70 | launchMiniProgramReq.path = path; | 69 | launchMiniProgramReq.path = path; |
| @@ -109,11 +108,7 @@ static NSString *const CNLiveWillBecomeActivePaycostForSHShopNotification = @"CN | @@ -109,11 +108,7 @@ static NSString *const CNLiveWillBecomeActivePaycostForSHShopNotification = @"CN | ||
| 109 | } | 108 | } |
| 110 | }]; | 109 | }]; |
| 111 | 110 | ||
| 112 | - }else{ | ||
| 113 | - NSString * index = @""; | ||
| 114 | - if (type == CNLivePayCostPayTypeAliPay) index = @"3"; | ||
| 115 | - if (type == CNLivePayCostPayTypeUnionPay) index = @"9"; | ||
| 116 | - if (type == CNLivePayCostPayTypeWjjPay) index = @"4"; | 111 | + }else if (type == CNLivePayCostPayTypeAliPay) { |
| 117 | 112 | ||
| 118 | NSString * desc = threeType == CNLivePayCostThreePayTypeScren?@"扫码支付":body; | 113 | NSString * desc = threeType == CNLivePayCostThreePayTypeScren?@"扫码支付":body; |
| 119 | 114 | ||
| @@ -127,7 +122,7 @@ static NSString *const CNLiveWillBecomeActivePaycostForSHShopNotification = @"CN | @@ -127,7 +122,7 @@ static NSString *const CNLiveWillBecomeActivePaycostForSHShopNotification = @"CN | ||
| 127 | @"balance_fee":balance_fee, | 122 | @"balance_fee":balance_fee, |
| 128 | @"notify_url":notifyUrls, | 123 | @"notify_url":notifyUrls, |
| 129 | @"page_url":@"", | 124 | @"page_url":@"", |
| 130 | - @"type":index, | 125 | + @"type":@"3", |
| 131 | @"frmId":frmId | 126 | @"frmId":frmId |
| 132 | }; | 127 | }; |
| 133 | [CNLiveNetworking setupShowResult:YES]; | 128 | [CNLiveNetworking setupShowResult:YES]; |
| @@ -147,6 +142,38 @@ static NSString *const CNLiveWillBecomeActivePaycostForSHShopNotification = @"CN | @@ -147,6 +142,38 @@ static NSString *const CNLiveWillBecomeActivePaycostForSHShopNotification = @"CN | ||
| 147 | } | 142 | } |
| 148 | }]; | 143 | }]; |
| 149 | }]; | 144 | }]; |
| 145 | + }else if (type == CNLivePayCostPayTypeUnionPay) { | ||
| 146 | + NSString * desc = threeType == CNLivePayCostThreePayTypeScren?@"扫码支付":body; | ||
| 147 | + | ||
| 148 | + NSDictionary * paramDict = @{ | ||
| 149 | + @"appId":AppId, | ||
| 150 | + @"user_id":CNUserShareModel.uid?CNUserShareModel.uid:@"", | ||
| 151 | + @"out_trade_no":orderId, | ||
| 152 | + @"body":desc, | ||
| 153 | + @"total_fee":price, | ||
| 154 | + @"coupon_fee":coupon_fee, | ||
| 155 | + @"balance_fee":balance_fee, | ||
| 156 | + @"notify_url":notifyUrls, | ||
| 157 | + @"page_url":@"", | ||
| 158 | + @"type":@"9", | ||
| 159 | + @"frmId":frmId | ||
| 160 | + }; | ||
| 161 | + [CNLiveNetworking setupShowResult:YES]; | ||
| 162 | + [CNLiveNetworking setupShowDataResult:NO]; | ||
| 163 | + [CNLiveNetworking setAllowRequestDefaultArgument:YES]; | ||
| 164 | + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNUMSPayWithPrePayApiContentURL Param:paramDict CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | ||
| 165 | + [CNLivePayCostNetwork payCost_chooseRequestWithResponseObject:responseObject Error:error isData:YES CompleterBlock:^(id responseObject, NSInteger errorCode) { | ||
| 166 | + if (responseObject) { | ||
| 167 | + NSString *payDataJsonStr = [[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:responseObject options:NSJSONWritingPrettyPrinted error:nil] encoding:NSUTF8StringEncoding]; | ||
| 168 | + [UMSPPPayUnifyPayPlugin cloudPayWithURLSchemes:TestEnvironment?@"CNLiveNetAddTestUnionPaySchems":@"CNLiveNetAddUnionPaySchems" payData:payDataJsonStr viewController:[CNLivePayCostNetwork paycost_navigationViewController] callbackBlock:^(NSString *resultCode, NSString *resultInfo) { | ||
| 169 | + if (completerBlock) { | ||
| 170 | + if ([resultCode isEqualToString:@"0000"]) completerBlock(0); | ||
| 171 | + if ([resultCode isEqualToString:@"1000"]) completerBlock(3);//余额支付取消支付 code1000 | ||
| 172 | + } | ||
| 173 | + }]; | ||
| 174 | + } | ||
| 175 | + }]; | ||
| 176 | + }]; | ||
| 150 | } | 177 | } |
| 151 | } | 178 | } |
| 152 | 179 | ||
| @@ -164,6 +191,7 @@ static NSString *const CNLiveWillBecomeActivePaycostForSHShopNotification = @"CN | @@ -164,6 +191,7 @@ static NSString *const CNLiveWillBecomeActivePaycostForSHShopNotification = @"CN | ||
| 164 | -(void)requestActiveGroupPayInfoWithGroupId:(NSString *)groupId | 191 | -(void)requestActiveGroupPayInfoWithGroupId:(NSString *)groupId |
| 165 | CNLiveActiveGroupPayType:(CNLivePayCostPayType)payType | 192 | CNLiveActiveGroupPayType:(CNLivePayCostPayType)payType |
| 166 | CNLiveActiveGroupThreePayType:(CNLivePayCostThreePayType)threeType | 193 | CNLiveActiveGroupThreePayType:(CNLivePayCostThreePayType)threeType |
| 194 | + Type:(CNLivePayCostType)type | ||
| 167 | PriceId:(NSString *)price | 195 | PriceId:(NSString *)price |
| 168 | Desc:(NSString *)desc | 196 | Desc:(NSString *)desc |
| 169 | Expand:(NSString *)expand | 197 | Expand:(NSString *)expand |
| @@ -190,7 +218,7 @@ static NSString *const CNLiveWillBecomeActivePaycostForSHShopNotification = @"CN | @@ -190,7 +218,7 @@ static NSString *const CNLiveWillBecomeActivePaycostForSHShopNotification = @"CN | ||
| 190 | NSString * accountString = payType == CNLivePayCostPayTypeWeChatPay ? WXAccount : payType == CNLivePayCostPayTypeAliPay ? @"ztsx" : @"ztyl"; | 218 | NSString * accountString = payType == CNLivePayCostPayTypeWeChatPay ? WXAccount : payType == CNLivePayCostPayTypeAliPay ? @"ztsx" : @"ztyl"; |
| 191 | 219 | ||
| 192 | 220 | ||
| 193 | - if ([[CNLivePayCostModel sharePayCostModel].protocol pushActivePaymentNewPaycostWayWithModthod]) { | 221 | + if ([[CNLivePayCostModel sharePayCostModel].protocol pushActivePaymentNewPaycostWayWithModthod] && type != CNLivePayCostTypeHtml) { |
| 194 | 222 | ||
| 195 | NSString * p = [NSString stringWithFormat:@"%d",(NSInteger)([price floatValue]*100)]; | 223 | NSString * p = [NSString stringWithFormat:@"%d",(NSInteger)([price floatValue]*100)]; |
| 196 | 224 | ||
| @@ -216,7 +244,7 @@ static NSString *const CNLiveWillBecomeActivePaycostForSHShopNotification = @"CN | @@ -216,7 +244,7 @@ static NSString *const CNLiveWillBecomeActivePaycostForSHShopNotification = @"CN | ||
| 216 | } | 244 | } |
| 217 | }else{ | 245 | }else{ |
| 218 | 246 | ||
| 219 | - if ([[CNLivePayCostModel sharePayCostModel].protocol pushActivePaymentNewPaycostWayWithModthod]) { | 247 | + if ([[CNLivePayCostModel sharePayCostModel].protocol pushActivePaymentNewPaycostWayWithModthod] && type != CNLivePayCostTypeHtml) { |
| 220 | 248 | ||
| 221 | NSString * p = [NSString stringWithFormat:@"%d",(NSInteger)([price floatValue]*100)]; | 249 | NSString * p = [NSString stringWithFormat:@"%d",(NSInteger)([price floatValue]*100)]; |
| 222 | 250 | ||
| @@ -225,7 +253,7 @@ static NSString *const CNLiveWillBecomeActivePaycostForSHShopNotification = @"CN | @@ -225,7 +253,7 @@ static NSString *const CNLiveWillBecomeActivePaycostForSHShopNotification = @"CN | ||
| 225 | @"user_id":CNUserShareModel.uid?CNUserShareModel.uid:@"", | 253 | @"user_id":CNUserShareModel.uid?CNUserShareModel.uid:@"", |
| 226 | @"out_trade_no":groupId, | 254 | @"out_trade_no":groupId, |
| 227 | @"body":desc, | 255 | @"body":desc, |
| 228 | - @"coupon_fee":@"0", | 256 | + @"coupon_fee":@"", |
| 229 | @"balance_fee":p, | 257 | @"balance_fee":p, |
| 230 | @"notify_url":notifyUrl, | 258 | @"notify_url":notifyUrl, |
| 231 | @"page_url":@"", | 259 | @"page_url":@"", |
CNLivePayCostModule/Classes/View/CNLivePayCostContentView.m
| @@ -253,7 +253,7 @@ static NSString *const CNActiveContentPayViewIdentifier = @"CNActiveContentPayVi | @@ -253,7 +253,7 @@ static NSString *const CNActiveContentPayViewIdentifier = @"CNActiveContentPayVi | ||
| 253 | 253 | ||
| 254 | if (self.payModel.payType == CNLivePayCostTypeGroup) { | 254 | if (self.payModel.payType == CNLivePayCostTypeGroup) { |
| 255 | 255 | ||
| 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) { | 256 | + [[CNLivePayCostNetwork sharePayCostNetWork] requestActiveGroupPayInfoWithGroupId:self.payModel.orderId CNLiveActiveGroupPayType:type CNLiveActiveGroupThreePayType:CNLivePayCostThreePayTypePayment Type:self.payModel.payType 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) { |
| 257 | [weakSelf showPayStatue:statue]; | 257 | [weakSelf showPayStatue:statue]; |
| 258 | }]; | 258 | }]; |
| 259 | } | 259 | } |
| @@ -261,14 +261,14 @@ static NSString *const CNActiveContentPayViewIdentifier = @"CNActiveContentPayVi | @@ -261,14 +261,14 @@ static NSString *const CNActiveContentPayViewIdentifier = @"CNActiveContentPayVi | ||
| 261 | 261 | ||
| 262 | NSString * priceString = [NSString stringWithFormat:@"%.2f",self.payModel.price]; | 262 | NSString * priceString = [NSString stringWithFormat:@"%.2f",self.payModel.price]; |
| 263 | CNLivePayCostThreePayType payType = self.payModel.payType == CNLivePayCostTypeOrder?CNLivePayCostThreePayTypeOrder:CNLivePayCostThreePayTypeSHSop; | 263 | CNLivePayCostThreePayType payType = self.payModel.payType == CNLivePayCostTypeOrder?CNLivePayCostThreePayTypeOrder:CNLivePayCostThreePayTypeSHSop; |
| 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) { | 264 | + [[CNLivePayCostNetwork sharePayCostNetWork] requestActiveGroupPayInfoWithGroupId:self.payModel.orderId CNLiveActiveGroupPayType:type CNLiveActiveGroupThreePayType:payType Type:self.payModel.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) { |
| 265 | [weakSelf showPayStatue:statue]; | 265 | [weakSelf showPayStatue:statue]; |
| 266 | }]; | 266 | }]; |
| 267 | } | 267 | } |
| 268 | if (self.payModel.payType == CNLivePayCostTypeSweep | 268 | if (self.payModel.payType == CNLivePayCostTypeSweep |
| 269 | || self.payModel.payType == CNLivePayCostTypeTicke) { | 269 | || self.payModel.payType == CNLivePayCostTypeTicke) { |
| 270 | 270 | ||
| 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) { | 271 | + [[CNLivePayCostNetwork sharePayCostNetWork] requestActiveGroupPayInfoWithGroupId:self.payModel.orderId CNLiveActiveGroupPayType:type CNLiveActiveGroupThreePayType:self.payModel.payType == CNLivePayCostTypeTicke ? CNLivePayCostThreePayTypeTicke : CNLivePayCostThreePayTypeScren Type:self.payModel.payType 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) { |
| 272 | [weakSelf showPayStatue:statue]; | 272 | [weakSelf showPayStatue:statue]; |
| 273 | }]; | 273 | }]; |
| 274 | 274 | ||
| @@ -282,7 +282,7 @@ static NSString *const CNActiveContentPayViewIdentifier = @"CNActiveContentPayVi | @@ -282,7 +282,7 @@ static NSString *const CNActiveContentPayViewIdentifier = @"CNActiveContentPayVi | ||
| 282 | [QMUITips showLoading:@"支付中..." inView:AppKeyWindow]; | 282 | [QMUITips showLoading:@"支付中..." inView:AppKeyWindow]; |
| 283 | if (self.payModel.payType == CNLivePayCostTypeGroup) { | 283 | if (self.payModel.payType == CNLivePayCostTypeGroup) { |
| 284 | 284 | ||
| 285 | - [[CNLivePayCostNetwork sharePayCostNetWork] requestActiveGroupPayInfoWithGroupId:self.payModel.orderId CNLiveActiveGroupPayType:CNLivePayCostPayTypeWjjPay CNLiveActiveGroupThreePayType:CNLivePayCostThreePayTypePayment PriceId:[NSString stringWithFormat:@"%.2f",self.payModel.price] Desc:self.payModel.descStr Expand:self.payModel.expand NotifyUrl:self.payModel.notifyUrl jsfy:NO PassWord:password FundsId:self.payModel.fundsId Attach:nil FormVC:self.fromVC CompleterBlcok:^(NSInteger statue) { | 285 | + [[CNLivePayCostNetwork sharePayCostNetWork] requestActiveGroupPayInfoWithGroupId:self.payModel.orderId CNLiveActiveGroupPayType:CNLivePayCostPayTypeWjjPay CNLiveActiveGroupThreePayType:CNLivePayCostThreePayTypePayment Type:self.payModel.payType PriceId:[NSString stringWithFormat:@"%.2f",self.payModel.price] Desc:self.payModel.descStr Expand:self.payModel.expand NotifyUrl:self.payModel.notifyUrl jsfy:NO PassWord:password FundsId:self.payModel.fundsId Attach:nil FormVC:self.fromVC CompleterBlcok:^(NSInteger statue) { |
| 286 | [weakSelf showPayStatue:statue]; | 286 | [weakSelf showPayStatue:statue]; |
| 287 | }]; | 287 | }]; |
| 288 | } | 288 | } |
Example/CNLivePayCostModule/CNLIVEAppDelegate.m
| @@ -51,7 +51,7 @@ | @@ -51,7 +51,7 @@ | ||
| 51 | - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url | 51 | - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url |
| 52 | { | 52 | { |
| 53 | NSString *string =[url absoluteString]; | 53 | NSString *string =[url absoluteString]; |
| 54 | - if ([string hasPrefix:@"unifyPayDemo://"]) | 54 | + if ([string hasPrefix:@"CNLiveNetAddTestUnionPaySchems://"] || [string hasPrefix:@"CNLiveNetAddUnionPaySchems://"]) |
| 55 | { | 55 | { |
| 56 | return [UMSPPPayUnifyPayPlugin cloudPayHandleOpenURL:url]; | 56 | return [UMSPPPayUnifyPayPlugin cloudPayHandleOpenURL:url]; |
| 57 | } | 57 | } |
| @@ -64,7 +64,7 @@ | @@ -64,7 +64,7 @@ | ||
| 64 | annotation:(id)annotation { | 64 | annotation:(id)annotation { |
| 65 | 65 | ||
| 66 | NSString *string =[url absoluteString]; | 66 | NSString *string =[url absoluteString]; |
| 67 | - if ([string hasPrefix:@"unifyPayDemo://"]) | 67 | + if ([string hasPrefix:@"CNLiveNetAddTestUnionPaySchems://"] || [string hasPrefix:@"CNLiveNetAddUnionPaySchems://"]) |
| 68 | { | 68 | { |
| 69 | return [UMSPPPayUnifyPayPlugin cloudPayHandleOpenURL:url]; | 69 | return [UMSPPPayUnifyPayPlugin cloudPayHandleOpenURL:url]; |
| 70 | } | 70 | } |
| @@ -78,7 +78,7 @@ | @@ -78,7 +78,7 @@ | ||
| 78 | options:(NSDictionary<NSString *,id> *)options{ | 78 | options:(NSDictionary<NSString *,id> *)options{ |
| 79 | 79 | ||
| 80 | NSString *string =[url absoluteString]; | 80 | NSString *string =[url absoluteString]; |
| 81 | - if ([string hasPrefix:@"unifyPayDemo://"]) | 81 | + if ([string hasPrefix:@"CNLiveNetAddTestUnionPaySchems://"] || [string hasPrefix:@"CNLiveNetAddUnionPaySchems://"]) |
| 82 | { | 82 | { |
| 83 | return [UMSPPPayUnifyPayPlugin cloudPayHandleOpenURL:url]; | 83 | return [UMSPPPayUnifyPayPlugin cloudPayHandleOpenURL:url]; |
| 84 | } | 84 | } |
Example/CNLivePayCostModule/CNLIVEViewController.m
| @@ -63,19 +63,75 @@ | @@ -63,19 +63,75 @@ | ||
| 63 | // | 63 | // |
| 64 | // }]; | 64 | // }]; |
| 65 | 65 | ||
| 66 | - NSDictionary * paramDict = @{ | ||
| 67 | - @"orderId":[self generateTradeNO], | ||
| 68 | - @"userId":@"10458139", | ||
| 69 | - @"descStr":@"测试", | ||
| 70 | - @"price":@0.01, | ||
| 71 | - @"orderType":@"1", | ||
| 72 | - @"notifyUrl":@"http://unifypay.cnlive.com/test/notify_url", | ||
| 73 | - @"password":@"123456" | ||
| 74 | - }; | ||
| 75 | - [CNLivePayCostModule showShopPayViwWithParamDict:paramDict PayType:CNLivePayCostPayTypeWeChatPay ResultBlock:^(NSInteger resultCode) { | ||
| 76 | - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:resultCode == 0?@"支付成功":@"支付失败" message:nil delegate:self cancelButtonTitle:@"确认" otherButtonTitles:nil, nil]; | ||
| 77 | - [alert show]; | 66 | + UIAlertController *alertVc = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; |
| 67 | + UIAlertAction *cancelBtn = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:NULL]; | ||
| 68 | + UIAlertAction *btn1 = [UIAlertAction actionWithTitle:@"网家家支付" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) { | ||
| 69 | + NSDictionary * paramDict = @{ | ||
| 70 | + @"orderId":[self generateTradeNO], | ||
| 71 | + @"userId":@"10458139", | ||
| 72 | + @"descStr":@"测试", | ||
| 73 | + @"price":@0.01, | ||
| 74 | + @"orderType":@"1", | ||
| 75 | + @"notifyUrl":@"http://unifypay.cnlive.com/test/notify_url", | ||
| 76 | + @"password":@"123456" | ||
| 77 | + }; | ||
| 78 | + [CNLivePayCostModule showShopPayViwWithParamDict:paramDict PayType:CNLivePayCostPayTypeWjjPay ResultBlock:^(NSInteger resultCode) { | ||
| 79 | + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:resultCode == 0?@"支付成功":@"支付失败" message:nil delegate:self cancelButtonTitle:@"确认" otherButtonTitles:nil, nil]; | ||
| 80 | + [alert show]; | ||
| 81 | + }]; | ||
| 82 | + }]; | ||
| 83 | + UIAlertAction *btn2 = [UIAlertAction actionWithTitle:@"银联支付" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) { | ||
| 84 | + NSDictionary * paramDict = @{ | ||
| 85 | + @"orderId":[self generateTradeNO], | ||
| 86 | + @"userId":@"10458139", | ||
| 87 | + @"descStr":@"测试", | ||
| 88 | + @"price":@0.01, | ||
| 89 | + @"orderType":@"1", | ||
| 90 | + @"notifyUrl":@"http://unifypay.cnlive.com/test/notify_url", | ||
| 91 | + @"password":@"123456" | ||
| 92 | + }; | ||
| 93 | + [CNLivePayCostModule showShopPayViwWithParamDict:paramDict PayType:CNLivePayCostPayTypeUnionPay ResultBlock:^(NSInteger resultCode) { | ||
| 94 | + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:resultCode == 0?@"支付成功":@"支付失败" message:nil delegate:self cancelButtonTitle:@"确认" otherButtonTitles:nil, nil]; | ||
| 95 | + [alert show]; | ||
| 96 | + }]; | ||
| 97 | + }]; | ||
| 98 | + UIAlertAction *btn3 = [UIAlertAction actionWithTitle:@"微信支付" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) { | ||
| 99 | + NSDictionary * paramDict = @{ | ||
| 100 | + @"orderId":[self generateTradeNO], | ||
| 101 | + @"userId":@"10458139", | ||
| 102 | + @"descStr":@"测试", | ||
| 103 | + @"price":@0.01, | ||
| 104 | + @"orderType":@"1", | ||
| 105 | + @"notifyUrl":@"http://unifypay.cnlive.com/test/notify_url", | ||
| 106 | + @"password":@"123456" | ||
| 107 | + }; | ||
| 108 | + [CNLivePayCostModule showShopPayViwWithParamDict:paramDict PayType:CNLivePayCostPayTypeWeChatPay ResultBlock:^(NSInteger resultCode) { | ||
| 109 | + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:resultCode == 0?@"支付成功":@"支付失败" message:nil delegate:self cancelButtonTitle:@"确认" otherButtonTitles:nil, nil]; | ||
| 110 | + [alert show]; | ||
| 111 | + }]; | ||
| 112 | + }]; | ||
| 113 | + UIAlertAction *btn4 = [UIAlertAction actionWithTitle:@"支付宝支付" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) { | ||
| 114 | + NSDictionary * paramDict = @{ | ||
| 115 | + @"orderId":[self generateTradeNO], | ||
| 116 | + @"userId":@"10458139", | ||
| 117 | + @"descStr":@"测试", | ||
| 118 | + @"price":@0.01, | ||
| 119 | + @"orderType":@"1", | ||
| 120 | + @"notifyUrl":@"http://unifypay.cnlive.com/test/notify_url", | ||
| 121 | + @"password":@"123456" | ||
| 122 | + }; | ||
| 123 | + [CNLivePayCostModule showShopPayViwWithParamDict:paramDict PayType:CNLivePayCostPayTypeAliPay ResultBlock:^(NSInteger resultCode) { | ||
| 124 | + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:resultCode == 0?@"支付成功":@"支付失败" message:nil delegate:self cancelButtonTitle:@"确认" otherButtonTitles:nil, nil]; | ||
| 125 | + [alert show]; | ||
| 126 | + }]; | ||
| 78 | }]; | 127 | }]; |
| 128 | + //将action添加到控制器 | ||
| 129 | + [alertVc addAction:cancelBtn]; | ||
| 130 | + [alertVc addAction:btn1]; | ||
| 131 | + [alertVc addAction:btn2]; | ||
| 132 | + [alertVc addAction:btn3]; | ||
| 133 | + [alertVc addAction:btn4]; | ||
| 134 | + [self presentViewController:alertVc animated:YES completion:nil]; | ||
| 79 | } | 135 | } |
| 80 | -(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event | 136 | -(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event |
| 81 | { | 137 | { |
Example/CNLivePayCostModule/CNLivePayCostModule-Info.plist
| @@ -53,9 +53,21 @@ | @@ -53,9 +53,21 @@ | ||
| 53 | <dict> | 53 | <dict> |
| 54 | <key>CFBundleTypeRole</key> | 54 | <key>CFBundleTypeRole</key> |
| 55 | <string>Editor</string> | 55 | <string>Editor</string> |
| 56 | + <key>CFBundleURLName</key> | ||
| 57 | + <string>银联测试</string> | ||
| 58 | + <key>CFBundleURLSchemes</key> | ||
| 59 | + <array> | ||
| 60 | + <string>CNLiveNetAddTestUnionPaySchems</string> | ||
| 61 | + </array> | ||
| 62 | + </dict> | ||
| 63 | + <dict> | ||
| 64 | + <key>CFBundleTypeRole</key> | ||
| 65 | + <string>Editor</string> | ||
| 66 | + <key>CFBundleURLName</key> | ||
| 67 | + <string>银联正式</string> | ||
| 56 | <key>CFBundleURLSchemes</key> | 68 | <key>CFBundleURLSchemes</key> |
| 57 | <array> | 69 | <array> |
| 58 | - <string>netpppay</string> | 70 | + <string>CNLiveNetAddUnionPaySchems</string> |
| 59 | </array> | 71 | </array> |
| 60 | </dict> | 72 | </dict> |
| 61 | </array> | 73 | </array> |