CheckoutTest.php 1.8 KB

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