Commit 7154e14496069e4f8c6c6ecfb3f904c61277005b

Authored by 张旭
1 parent d7d83fa5

修改元码 苹果内购功能

修改 元码  微信支付为微信小程序支付(新支付 )
CNLivePayCostModule.podspec
... ... @@ -8,7 +8,7 @@
8 8  
9 9 Pod::Spec.new do |s|
10 10 s.name = 'CNLivePayCostModule'
11   - s.version = '0.1.8'
  11 + s.version = '0.1.9'
12 12 s.summary = 'A short description of CNLivePayCostModule.'
13 13  
14 14 # This description is used to generate tags and improve search results.
... ...
CNLivePayCostModule/Classes/Core/CNLivePayCostModule.m
... ... @@ -34,7 +34,8 @@
34 34 [UMSPPPayPluginSettings sharedInstance].umspEnviroment = UMSP_PROD;
35 35  
36 36 //注册微信支付
37   - [UMSPPPayUnifyPayPlugin registerApp:wxAppId universalLink:[NSString stringWithFormat:@"%@/",hostURL]];
  37 + BOOL isSucc = [UMSPPPayUnifyPayPlugin registerApp:wxAppId universalLink:[NSString stringWithFormat:@"%@/",hostURL]];
  38 + NSLog(@"%d",isSucc);
38 39 }
39 40  
40 41 /// 拉起网家家支付功能
... ... @@ -180,17 +181,22 @@
180 181 NSString * total_fee = [paramDict stringValueForKey:@"total_fee" default:@""];
181 182 NSString * body = [paramDict stringValueForKey:@"body" default:@""];
182 183 NSString * productId = [paramDict stringValueForKey:@"prdId" default:@""];
  184 + NSString * orderId = [paramDict stringValueForKey:@"orderId" default:@""];
  185 +
183 186 int moneyInt = [total_fee intValue];
184 187 if (((int)moneyInt/100)<=0) {
185 188 [QMUITips showWithText:@"付款金额不正确" inView:formVC.view hideAfterDelay:1.5f];
186 189 return;
187 190 }
188 191 NSString *appleProductId = [NSString stringWithFormat:@"%@%d",CNLiveWjjApplePayAVProductIdBase,(int)moneyInt/100];
  192 + if (((int)moneyInt/100) == 1 || ((int)moneyInt/100) == 3 || ((int)moneyInt/100) == 78){
  193 + appleProductId = [NSString stringWithFormat:@"%@new.%d",CNLiveWjjApplePayAVProductIdBase,(int)moneyInt/100];
  194 + }
189 195  
190 196 CNLivePayArg *arg = [[CNLivePayArg alloc] init];
191 197 arg.account = @"";
192 198 arg.type = CNLivePayTypeInAppPurchase;
193   - arg.out_trade_no = [CNLivePayCostModel payCost_getRandomOrderId];
  199 + arg.out_trade_no = [CNLivePayCostModel payCost_getRandomOrderId];//orderId;//
194 200 arg.total_fee = moneyInt;
195 201 arg.notify_url = notify_url;
196 202 arg.user_id = CNUserShareModel.uid?CNUserShareModel.uid:@"";
... ... @@ -201,7 +207,8 @@
201 207 };
202 208 arg.body = [body isNotBlank]?body:[NSString stringWithFormat:@"您购买了付费服务"];
203 209 [QMUITips showLoadingInView:formVC.view];
204   - [[CNLivePaySDK sharedCNLivePayManager] pay:arg isDebug:TestEnvironment productId:appleProductId completion:^(CNLivePayResult *cnlivePayResult) {
  210 + NSLog(@"%@,%@,%d,%@,%@,%@,%@,%@",arg.account,arg.out_trade_no,arg.total_fee,arg.notify_url,arg.user_id,arg.attach,arg.body,appleProductId);
  211 + [[CNLivePaySDK sharedCNLivePayManager] pay:arg isDebug:false productId:appleProductId completion:^(CNLivePayResult *cnlivePayResult) {
205 212 dispatch_async(dispatch_get_main_queue(), ^{
206 213 [QMUITips hideAllTipsInView:formVC.view];
207 214 if ([cnlivePayResult.channelBackCode isEqualToString:@"0"]) {
... ...
CNLivePayCostModule/Classes/Core/CNLivePayCostNetwork.m
... ... @@ -65,26 +65,26 @@ static NSString *const CNLiveWillBecomeActivePaycostForSHShopNotification = @&quot;CN
65 65 && (threeType == CNLivePayCostThreePayTypeSHSop || threeType == CNLivePayCostThreePayTypeShop)) notifyUrls = notify_url;
66 66  
67 67 if (type == CNLivePayCostPayTypeWeChatPay) {
68   -
69   -// NSString * path = [NSString stringWithFormat:@"pages/pays/pay/pay?appId=%@&body=%@&out_trade_no=%@&user_id=%@&total_fee=%@&notify_url=%@&type=1&&frmId=ios&&page_url=%@&&coupon_fee=%@&&balance_fee=%@",AppId,body,orderId,userId?userId:CNUserShareModel.uid,price,notifyUrls,notify_url,coupon_fee,balance_fee];
70   -// WXLaunchMiniProgramReq *launchMiniProgramReq = [WXLaunchMiniProgramReq object];
71   -// launchMiniProgramReq.userName = @"gh_061b347b32c1"; //拉起的小程序的username
72   -// launchMiniProgramReq.path = path;
73   -// launchMiniProgramReq.miniProgramType = [CNLiveEnvironmentManager manager].isTestEnvironment?WXMiniProgramTypePreview:WXMiniProgramTypeRelease;
74   -// [WXApi sendReq:launchMiniProgramReq completion:^(BOOL success) {
75   -//
76   -// }];
77   -
78   -
79   - NSString * accountString = WXAccount;
80   - float pri = [price floatValue];
81   - // notifyUrls CNWeChatPayUrl
82   - [[CNLivePayCostNetwork sharePayCostNetWork] requestPayFromWXAndAliPay:CNLivePayTypeWeChatPay OrderId:orderId Account:accountString PriceId:pri Desc:body Attach:@{@"plat":@"i"} CNLiveActiveGroupThreePayType:CNLivePayCostThreePayTypeShop NotifyUrl:notify_url NetAddUrlSchems:nil FormVC:nil CompleterBlock:^{
83   - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
84   - if (completerBlock) completerBlock(0);
85   - });
  68 + ////新支付 微信小程序支付
  69 + NSString * path = [NSString stringWithFormat:@"pages/pays/pay/pay?appId=%@&body=%@&out_trade_no=%@&user_id=%@&total_fee=%@&notify_url=%@&type=1&&frmId=ios&&page_url=%@&&coupon_fee=%@&&balance_fee=%@",AppId,body,orderId,userId?userId:CNUserShareModel.uid,price,notifyUrls,notify_url,coupon_fee,balance_fee];
  70 + WXLaunchMiniProgramReq *launchMiniProgramReq = [WXLaunchMiniProgramReq object];
  71 + launchMiniProgramReq.userName = @"gh_061b347b32c1"; //拉起的小程序的username
  72 + launchMiniProgramReq.path = path;
  73 + launchMiniProgramReq.miniProgramType = [CNLiveEnvironmentManager manager].isTestEnvironment?WXMiniProgramTypePreview:WXMiniProgramTypeRelease;
  74 + [WXApi sendReq:launchMiniProgramReq completion:^(BOOL success) {
86 75  
87 76 }];
  77 +
  78 +
  79 + ////老支付 微信支付
  80 +// NSString * accountString = @"ym_app";//WXAccount;
  81 +// float pri = [price floatValue];
  82 +// // notifyUrls CNWeChatPayUrl
  83 +// [[CNLivePayCostNetwork sharePayCostNetWork] requestPayFromWXAndAliPay:CNLivePayTypeWeChatPay OrderId:orderId Account:accountString PriceId:pri Desc:body Attach:@{@"plat":@"i"} CNLiveActiveGroupThreePayType:CNLivePayCostThreePayTypeShop NotifyUrl:notify_url NetAddUrlSchems:nil FormVC:nil CompleterBlock:^{
  84 +// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  85 +// if (completerBlock) completerBlock(0);
  86 +// });
  87 +// }];
88 88 }else if (type == CNLivePayCostPayTypeWjjPay) {
89 89  
90 90 NSString * desc = threeType == CNLivePayCostThreePayTypeScren?@"扫码支付":body;
... ... @@ -126,6 +126,7 @@ static NSString *const CNLiveWillBecomeActivePaycostForSHShopNotification = @&quot;CN
126 126  
127 127 NSString * accountString = @"ztsx";
128 128 float pri = [price floatValue];
  129 +// NSString * notifyUrl = @"https://apiwjj.cnlive.com/Daren/pay/notifyAliPay.action";
129 130  
130 131 [[CNLivePayCostNetwork sharePayCostNetWork] requestPayFromWXAndAliPay:CNLivePayTypeAliPay OrderId:orderId Account:accountString PriceId:pri Desc:body Attach:@{@"plat":@"i"} CNLiveActiveGroupThreePayType:CNLivePayCostThreePayTypeShop NotifyUrl:notify_url NetAddUrlSchems:nil FormVC:nil CompleterBlock:^{
131 132 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
... ...