V2MerchantComplaintSubmitCertificatesRequestDemo.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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/V2MerchantComplaintSubmitCertificatesRequest.php";
  12. use BsPaySdk\core\BsPayClient;
  13. use BsPaySdk\request\V2MerchantComplaintSubmitCertificatesRequest;
  14. // 2.组装请求参数
  15. $request = new V2MerchantComplaintSubmitCertificatesRequest();
  16. // 请求汇付流水号
  17. $request->setReqSeqId(date("YmdHis").mt_rand());
  18. // 请求汇付时间
  19. $request->setReqDate(date("Ymd"));
  20. // 支付宝推送流水号
  21. $request->setRiskBizId("b1e11c97badf1ba025399ee0332d8fb1-ISV");
  22. // 申诉解限的唯一ID
  23. $request->setRelievingId("653739ab36362810b7203b304d6f3883");
  24. // 解限风险类型
  25. $request->setRelieveRiskType("SMID_MERCHANT");
  26. // 提交的凭证数据
  27. $request->setRelieveCertDataList(getRelieveCertDataList());
  28. // 设置非必填字段
  29. $extendInfoMap = getExtendInfos();
  30. $request->setExtendInfo($extendInfoMap);
  31. // 3. 发起API调用
  32. $client = new BsPayClient();
  33. $result = $client->postRequest($request);
  34. if (!$result || $result->isError()) { //失败处理
  35. var_dump($result -> getErrorInfo());
  36. } else { //成功处理
  37. var_dump($result);
  38. }
  39. /**
  40. * 非必填字段
  41. *
  42. */
  43. function getExtendInfos() {
  44. // 设置非必填字段
  45. $extendInfoMap = array();
  46. return $extendInfoMap;
  47. }
  48. function getRelieveCertDataList() {
  49. $dto = array();
  50. // 凭证的唯一ID
  51. $dto["request_id"] = "1efc8c73afd64fc1b1fc50a834a54be0";
  52. // 凭证类型
  53. $dto["type"] = "IMAGE";
  54. // 凭证code
  55. $dto["code"] = "904";
  56. // 凭证的内容
  57. $dto["info_data"] = "edd2d893-d3c2-342b-9ded-993913effce9";
  58. $dtoList = array();
  59. array_push($dtoList, $dto);
  60. return json_encode($dtoList,JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);
  61. }