V2MerchantComplaintUpdateRefundprogressRequestDemo.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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/V2MerchantComplaintUpdateRefundprogressRequest.php";
  12. use BsPaySdk\core\BsPayClient;
  13. use BsPaySdk\request\V2MerchantComplaintUpdateRefundprogressRequest;
  14. // 2.组装请求参数
  15. $request = new V2MerchantComplaintUpdateRefundprogressRequest();
  16. // 请求流水号
  17. $request->setReqSeqId(date("YmdHis").mt_rand());
  18. // 请求时间
  19. $request->setReqDate(date("Ymd"));
  20. // 投诉单号
  21. $request->setComplaintId("200000020221020220032600930");
  22. // 审批动作
  23. $request->setAction("APPROVE");
  24. // 微信商户号
  25. $request->setMchId("1502074862");
  26. // 设置非必填字段
  27. $extendInfoMap = getExtendInfos();
  28. $request->setExtendInfo($extendInfoMap);
  29. // 3. 发起API调用
  30. $client = new BsPayClient();
  31. $result = $client->postRequest($request);
  32. if (!$result || $result->isError()) { //失败处理
  33. var_dump($result -> getErrorInfo());
  34. } else { //成功处理
  35. var_dump($result);
  36. }
  37. /**
  38. * 非必填字段
  39. *
  40. */
  41. function getExtendInfos() {
  42. // 设置非必填字段
  43. $extendInfoMap = array();
  44. // 预计发起退款时间
  45. $extendInfoMap["launch_refund_day"]= "";
  46. // 拒绝退款原因
  47. $extendInfoMap["reject_reason"]= "";
  48. // 备注
  49. $extendInfoMap["remark"]= "我是备注1111101";
  50. // 文件列表
  51. $extendInfoMap["file_info"]= getFileInfo();
  52. return $extendInfoMap;
  53. }
  54. function getFileInfo() {
  55. $dto = array();
  56. // 拒绝退款的举证图片1
  57. $dto["reject_media_pic1"] = "a8a096a3-0dd4-3b0e-886c-9afb20d23b1a";
  58. // 拒绝退款的举证图片2
  59. $dto["reject_media_pic2"] = "a8a096a3-0dd4-3b0e-886c-9afb20d23b2a";
  60. // 拒绝退款的举证图片3
  61. $dto["reject_media_pic3"] = "a8a096a3-0dd4-3b0e-886c-9afb20d23b3a";
  62. // 拒绝退款的举证图片4
  63. $dto["reject_media_pic4"] = "a8a096a3-0dd4-3b0e-886c-9afb20d23b4a";
  64. return json_encode($dto,JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);
  65. }