V2MerchantBusiConfigRequestDemo.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. using System;
  2. using System.Collections.Generic;
  3. using BasePaySdk;
  4. using BasePaySdk.Request;
  5. using Newtonsoft.Json;
  6. using Newtonsoft.Json.Linq;
  7. namespace BasePayDemo
  8. {
  9. /**
  10. * 微信商户配置 - 示例
  11. *
  12. * @author sdk-generator
  13. * @Description
  14. */
  15. public class V2MerchantBusiConfigRequestDemo
  16. {
  17. public static void V2MerchantBusiConfigRequestDemoTest()
  18. {
  19. // 1. 数据初始化
  20. InitMerConfig.init();
  21. // 2.组装请求参数
  22. V2MerchantBusiConfigRequest request = new V2MerchantBusiConfigRequest();
  23. // 请求流水号
  24. request.setReqSeqId(DateTime.Now.ToString("yyy-MM-dd HH.mm.ss.fff"));
  25. // 请求日期
  26. request.setReqDate(DateTime.Now.ToString("yyyyMMdd"));
  27. // 汇付客户Id
  28. request.setHuifuId("6666000108854952");
  29. // 业务开通类型
  30. request.setFeeType("02");
  31. // 公众号支付Appid条件必填,<font color="green">示例值:wx3767c5bd01df5061</font> ;wx_woa_app_id 、wx_woa_path、micro_sub_appid和 wx_applet_app_id四者不能同时为空
  32. request.setWxWoaAppId("wx3767c5bd01df5061");
  33. // 微信公众号授权目录条件必填,<font color="green">示例值:https://paas.huifu.com/shouyintai/demo/h5/</font>;wx_woa_app_id 、wx_woa_path、micro_sub_appid和 wx_applet_app_id四者不能同时为空
  34. request.setWxWoaPath("https://paas.huifu.com/shouyin/demo/h5/");
  35. // 微信小程序APPID条件必填,<font color="green">示例值:wx8523175fea790f10</font> ;wx_woa_app_id 、wx_woa_path、micro_sub_appid和 wx_applet_app_id四者不能同时为空
  36. request.setWxAppletAppId("wx8523175fea790f10");
  37. // 设置非必填字段
  38. Dictionary<string, object> extendInfoMap = getExtendInfos();
  39. request.setExtendInfo(extendInfoMap);
  40. try {
  41. // 3. 发起API调用
  42. // 调用接口,使用默认商户配置时可省略配置key
  43. Dictionary<string, Object> result = null;
  44. result = BasePayClient.postRequest(request,null);
  45. // 使用指定配置调用接口
  46. // result = BasePayClient.postRequest(request,null,"merchantKey2");
  47. Console.WriteLine(JsonConvert.SerializeObject(result));
  48. }
  49. catch (Exception ex) {
  50. Console.WriteLine(ex);
  51. }
  52. }
  53. /**
  54. * 非必填字段
  55. * @return
  56. */
  57. private static Dictionary<string, object> getExtendInfos() {
  58. // 设置非必填字段
  59. Dictionary<string, object> extendInfoMap = new Dictionary<string, object>();
  60. // 微信公众号APPID对应的秘钥
  61. extendInfoMap.Add("wx_woa_secret", "64afb60bef3a22ac282aa7880cdaca98");
  62. // 微信反扫类交易APPID
  63. // extendInfoMap.Add("micro_sub_appid", "");
  64. // 微信小程序APPID对应的秘钥
  65. extendInfoMap.Add("wx_applet_secret", "1323a4165a662d6e4f9f51b3f7a58e3f");
  66. // 渠道号
  67. extendInfoMap.Add("bank_channel_no", "JQF00001");
  68. // 异步消息接收地址
  69. // extendInfoMap.Add("async_return_url", "");
  70. return extendInfoMap;
  71. }
  72. }
  73. }