payRequsestHandler.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #import <Foundation/Foundation.h>
  2. #import "WXUtil.h"
  3. #import "ApiXml.h"
  4. /*
  5. // 签名实例
  6. // 更新时间:2015年3月3日
  7. // 负责人:李启波(marcyli)
  8. // 该Demo用于ios sdk 1.4
  9. //微信支付服务器签名支付请求请求类
  10. //============================================================================
  11. //api说明:
  12. //初始化商户参数,默认给一些参数赋值,如cmdno,date等。
  13. -(BOOL) init:(NSString *)app_id (NSString *)mch_id;
  14. //设置商户API密钥
  15. -(void) setKey:(NSString *)key;
  16. //生成签名
  17. -(NSString*) createMd5Sign:(NSMutableDictionary*)dict;
  18. //获取XML格式的数据
  19. -(NSString *) genPackage:(NSMutableDictionary*)packageParams;
  20. //提交预支付交易,获取预支付交易会话标识
  21. -(NSString *) sendPrepay:(NSMutableDictionary *);
  22. //签名实例测试
  23. - ( NSMutableDictionary *)sendPay_demo;
  24. //获取debug信息日志
  25. -(NSString *) getDebugifo;
  26. //获取最后返回的错误代码
  27. -(long) getLasterrCode;
  28. //============================================================================
  29. */
  30. // 账号帐户资料
  31. //更改商户把相关参数后可测试
  32. #define APP_ID @"wx432d7835b0f260d7" //APPID
  33. #define APP_SECRET @"99b535f8e17282f247e8eae4ba57df1b" //appsecret
  34. //商户号,填写商户对应参数
  35. #define MCH_ID @"1359812902"
  36. //商户API密钥,填写相应参数
  37. #define PARTNER_ID @"sparkesparkesparkesparkesparke12"
  38. //支付结果回调页面
  39. #define NOTIFY_URL @"http://wxpay.weixin.qq.com/pub_v2/pay/notify.v2.php"
  40. //获取服务器端支付数据地址(商户自定义)
  41. #define SP_URL @"http://wxpay.weixin.qq.com/pub_v2/app/app_pay.php"
  42. @interface payRequsestHandler : NSObject{
  43. //预支付网关url地址
  44. NSString *payUrl;
  45. //lash_errcode;
  46. long last_errcode;
  47. //debug信息
  48. NSMutableString *debugInfo;
  49. NSString *appid,*mchid,*spkey;
  50. }
  51. //初始化函数
  52. -(BOOL) init:(NSString *)app_id mch_id:(NSString *)mch_id;
  53. -(NSString *) getDebugifo;
  54. -(long) getLasterrCode;
  55. //设置商户密钥
  56. -(void) setKey:(NSString *)key;
  57. //创建package签名
  58. -(NSString*) createMd5Sign:(NSMutableDictionary*)dict;
  59. //获取package带参数的签名包
  60. -(NSString *)genPackage:(NSMutableDictionary*)packageParams;
  61. //提交预支付
  62. -(NSString *)sendPrepay:(NSMutableDictionary *)prePayParams;
  63. //签名实例测试
  64. - ( NSMutableDictionary *)sendPay_demo;
  65. //签名实例测试
  66. - ( NSMutableDictionary *)sendPay:(NSString *)txtTitle money:(NSString *)money orderNo:(NSString *)orderNo notifyURL:(NSString *)notifyURL;
  67. @end