CheckoutTest.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. namespace app\api\controller\tests;
  3. use AdaPay;
  4. use AdaPaySdk;
  5. use PHPUnit\Framework\TestCase;
  6. class CheckoutTest extends TestCase
  7. {
  8. public function testCreate()
  9. {
  10. $adaPay = new AdaPay\AdaPay();
  11. $adaPay->gateWayType = 'page';
  12. $obj = new AdaPaySdk\Checkout();
  13. $obj_params = array(
  14. # 应用ID
  15. 'app_id' => 'app_7d87c043-aae3-4357-9b2c-269349a980d6',
  16. # 用户ID
  17. 'member_id' => 'user_00013',
  18. # IP
  19. 'order_no' => "CK_" . date("YmdHis") . rand(100000, 999999),
  20. 'pay_amt' => '0.01',
  21. 'goods_title' => '收银台测试',
  22. 'goods_desc' => '收银台测试',
  23. 'div_members' => [],
  24. 'currency' => '',
  25. 'time_expire' => '',
  26. 'description' => '',
  27. 'notify_url' => '',
  28. 'callback_url' => ''
  29. );
  30. $obj->create($obj_params);
  31. print("创建收银台对象" . $obj->isError() . '=>' . json_encode($obj->result) . "\n");
  32. $this->assertEquals($obj_params['app_id'], $obj->result['app_id']);
  33. // $this->assertTrue($obj->isError());
  34. }
  35. public function testQueryList()
  36. {
  37. $adaPay = new AdaPay\AdaPay();
  38. $adaPay->gateWayType = 'page';
  39. $obj = new AdaPaySdk\Checkout();
  40. $obj_params = array(
  41. # 商户的应用 id
  42. 'app_id' => 'app_7d87c043-aae3-4357-9b2c-269349a980d6',
  43. # 用户ID
  44. 'order_no' => "WL_" . date("YmdHis") . rand(100000, 999999),
  45. # 商户用户id
  46. 'member_id' => 'hf_prod_member_20190920',
  47. "page_index" => "",
  48. "page_size" => "",
  49. "created_gte" => "",
  50. "created_lte" => ""
  51. );
  52. $obj->queryList($obj_params);
  53. print("查询收银台对象列表" . $obj->isError() . '=>' . json_encode($obj->result) . "\n");
  54. $this->assertEquals('succeeded', $obj->result['status']);
  55. // $this->assertTrue($account->isError());
  56. }
  57. }