新版订单消耗系统

AopClientTest.php 2.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. require_once '../AopClient.php';
  3. require_once '../AopCertification.php';
  4. require_once '../request/AlipayTradeQueryRequest.php';
  5. require_once '../request/AlipayTradeWapPayRequest.php';
  6. require_once '../request/AlipayMerchantOrderSyncRequest.php';
  7. require_once '../request/AlipayMerchantItemFileUploadRequest.php';
  8. /**
  9. * 证书类型AopCertClient功能方法使用测试
  10. * 1、execute 证书模式调用示例
  11. * 2、sdkExecute 证书模式调用示例
  12. * 3、pageExecute 证书模式调用示例
  13. */
  14. //1、execute 使用
  15. $aop = new AopClient ();
  16. $aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';
  17. $aop->appId = '你的appid';
  18. $aop->rsaPrivateKey = '你的应用私钥';
  19. $aop->alipayrsaPublicKey = '你的支付宝公钥';
  20. $aop->apiVersion = '1.0';
  21. $aop->signType = 'RSA2';
  22. $aop->postCharset='utf-8';
  23. $aop->format='json';
  24. $request = new AlipayTradeQueryRequest ();
  25. $request->setBizContent("{" .
  26. "\"out_trade_no\":\"20150320010101001\"," .
  27. "\"trade_no\":\"2019101122001404060523103774\"," .
  28. "\"org_pid\":\"2088101117952222\"," .
  29. " \"query_options\":[" .
  30. " \"TRADE_SETTE_INFO\"" .
  31. " ]" .
  32. " }");
  33. $result = $aop->execute ( $request);
  34. var_dump($result);
  35. //2、sdkExecute 测试
  36. $aop = new AopClient ();
  37. $aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';
  38. $aop->appId = '你的appid';
  39. $aop->rsaPrivateKey = '你的应用私钥';
  40. $aop->alipayrsaPublicKey = '你的支付宝公钥';
  41. $aop->apiVersion = '1.0';
  42. $aop->signType = 'RSA2';
  43. $aop->postCharset='utf-8';
  44. $aop->format='json';
  45. $request = new AlipayOpenOperationOpenbizmockBizQueryRequest ();
  46. request.setBizContent("{\"status\":\"1001\",\"shop_id\":\"2001\"}");
  47. $result = $aop->sdkExecute($request);
  48. echo $result;
  49. //3、pageExecute 测试
  50. $aop = new AopClient ();
  51. $aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';
  52. $aop->appId = '你的appid';
  53. $aop->rsaPrivateKey = '你的应用私钥';
  54. $aop->alipayrsaPublicKey = '你的支付宝公钥';
  55. $aop->apiVersion = '1.0';
  56. $aop->signType = 'RSA2';
  57. $aop->postCharset='utf-8';
  58. $aop->format='json';
  59. $request = new AlipayTradeWapPayRequest ();
  60. $request->setBizContent("{" .
  61. " \"body\":\"对一笔交易的具体描述信息。如果是多种商品,请将商品描述字符串累加传给body。\"," .
  62. " \"subject\":\"测试\"," .
  63. " \"out_trade_no\":\"70501111111S001111119\"," .
  64. " \"timeout_express\":\"90m\"," .
  65. " \"total_amount\":9.00," .
  66. " \"product_code\":\"QUICK_WAP_WAY\"" .
  67. " }");
  68. $result = $aop->pageExecute ( $request);
  69. echo $result;