V2MerchantBusiConfigQueryRequestDemo.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * 微信配置查询 - 示例
  4. *
  5. * @author sdk-generator
  6. * @Description
  7. */
  8. namespace BsPayDemo;
  9. // 1. 资源及配置加载
  10. require_once dirname(__FILE__) . "/loader.php";
  11. require_once dirname(__FILE__). "/../BsPaySdk/request/V2MerchantBusiConfigQueryRequest.php";
  12. use BsPaySdk\core\BsPayClient;
  13. use BsPaySdk\request\V2MerchantBusiConfigQueryRequest;
  14. // 2.组装请求参数
  15. $request = new V2MerchantBusiConfigQueryRequest();
  16. // 请求流水号
  17. $request->setReqSeqId(date("YmdHis").mt_rand());
  18. // 请求时间
  19. $request->setReqDate(date("Ymd"));
  20. // 汇付客户Id
  21. $request->setHuifuId("6666000108854952");
  22. // 设置非必填字段
  23. $extendInfoMap = getExtendInfos();
  24. $request->setExtendInfo($extendInfoMap);
  25. // 3. 发起API调用
  26. $client = new BsPayClient();
  27. $result = $client->postRequest($request);
  28. if (!$result || $result->isError()) { //失败处理
  29. var_dump($result -> getErrorInfo());
  30. } else { //成功处理
  31. var_dump($result);
  32. }
  33. /**
  34. * 非必填字段
  35. *
  36. */
  37. function getExtendInfos() {
  38. // 设置非必填字段
  39. $extendInfoMap = array();
  40. // 渠道号
  41. $extendInfoMap["bank_channel_no"]= "";
  42. return $extendInfoMap;
  43. }