123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- #import "TestSign.h"
- @implementation TestSign
- +(void)sendPay_demo {
-
- payRequsestHandler *req = [payRequsestHandler alloc];
-
- [req init:APP_ID mch_id:MCH_ID];
-
- [req setKey:PARTNER_ID];
-
-
-
-
- NSMutableDictionary *dict = [req sendPay_demo];
-
- if(dict == nil){
-
- NSString *debug = [req getDebugifo];
-
-
- NSLog(@"%@\n\n",debug);
- }else{
- NSLog(@"%@\n\n",[req getDebugifo]);
-
-
- NSMutableString *stamp = [dict objectForKey:@"timestamp"];
-
-
- PayReq* req = [[PayReq alloc] init];
- req.openID = [dict objectForKey:@"appid"];
- req.partnerId = [dict objectForKey:@"partnerid"];
- req.prepayId = [dict objectForKey:@"prepayid"];
- req.nonceStr = [dict objectForKey:@"noncestr"];
- req.timeStamp = stamp.intValue;
- req.package = [dict objectForKey:@"package"];
- req.sign = [dict objectForKey:@"sign"];
- [WXApi sendReq:req];
- }
- }
- +(BOOL)pay_demo:(NSDictionary*)dict {
-
- NSLog(@"%@",dict);
-
- NSMutableString *stamp = [dict objectForKey:@"timestamp"];
-
- PayReq* req = [[PayReq alloc] init];
- req.openID = [dict objectForKey:@"appid"];
- req.partnerId = [dict objectForKey:@"partnerid"];
- req.prepayId = [dict objectForKey:@"prepayid"];
- req.nonceStr = [dict objectForKey:@"noncestr"];
- req.timeStamp = stamp.intValue;
- req.package = [dict objectForKey:@"packageValue"];
- req.sign = [dict objectForKey:@"sign"];
- return [WXApi sendReq:req];
- }
- +(BOOL)pay_money:(NSString *)txtTitle money:(NSString *)money orderNo:(NSString *)orderNo notifyURL:(NSString *)notifyURL{
-
- payRequsestHandler *req = [payRequsestHandler alloc];
-
- [req init:APP_ID mch_id:MCH_ID];
-
- [req setKey:PARTNER_ID];
-
-
-
-
- NSMutableDictionary *dict = [req sendPay:txtTitle money:money orderNo:orderNo notifyURL:notifyURL];
-
- if(dict == nil){
-
- NSString *debug = [req getDebugifo];
-
-
-
- NSLog(@"%@\n\n",debug);
-
- return false;
- }else{
- NSLog(@"%@\n\n",[req getDebugifo]);
-
-
- NSMutableString *stamp = [dict objectForKey:@"timestamp"];
-
-
- PayReq* req = [[PayReq alloc] init];
- req.nonceStr = [dict objectForKey:@"noncestr"];
- req.openID = [dict objectForKey:@"appid"];
- req.package = [dict objectForKey:@"package"];
- req.partnerId = [dict objectForKey:@"partnerid"];
- req.prepayId = [dict objectForKey:@"prepayid"];
- req.sign = [dict objectForKey:@"sign"];
- req.timeStamp = stamp.intValue;
- [WXApi sendReq:req];
- }
-
- return true;
- }
- @end
|