GetRandomDemo.php 880 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. use llianpay\accp\client\LLianPayClient;
  3. use llianpay\accp\params\GetRandomParams;
  4. require '../vendor/autoload.php';
  5. require '../src/cfg.php';
  6. require '../src/client/LLianPayClient.php';
  7. require '../src/params/GetRandomParams.php';
  8. // 测试“随机因子获取”接口https://open.lianlianpay.com/docs/accp/accpstandard/get-random.html
  9. function test_getRandom()
  10. {
  11. // 构建请求参数
  12. $params = new GetRandomParams();
  13. $params->timestamp = date("YmdHis");
  14. $params->oid_partner = OID_PARTNER;
  15. $params->user_id = 'LLianPayTest-In-User-12345';
  16. $params->flag_chnl = 'H5';
  17. $params->pkg_name = 'test';
  18. $params->app_name = 'test';
  19. // 测试环境地址
  20. $url = 'https://accpapi-ste.lianlianpay-inc.com/v1/acctmgr/get-random';
  21. $result = LLianPayClient::sendRequest($url, json_encode($params));
  22. echo $result;
  23. }
  24. test_getRandom();