PaymentConfirmTest.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. namespace app\api\controller\tests;
  3. use AdaPay;
  4. use AdaPaySdk;
  5. use PHPUnit\Framework\TestCase;
  6. class PaymentConfirmTest extends TestCase
  7. {
  8. public function testCreate()
  9. {
  10. $adaPay = new AdaPay\AdaPay();
  11. $adaPay->gateWayType = 'api';
  12. $obj = new AdaPaySdk\PaymentConfirm();
  13. $obj_params = array(
  14. 'payment_id' => '002112020102614582910166695202499047424',
  15. 'order_no' => date("YmdHis") . rand(100000, 999999),
  16. 'confirm_amt' => '0.01',
  17. 'description' => '附件说明',
  18. 'div_members' => '' //分账参数列表 默认是数组List
  19. );
  20. $obj->create($obj_params);
  21. print("创建支付确认对象" . $obj->isError() . '=>' . json_encode($obj->result) . "\n");
  22. $this->assertEquals('succeeded', $obj->result['status']);
  23. // $this->assertTrue($obj->isError());
  24. }
  25. public function testQuery()
  26. {
  27. $adaPay = new AdaPay\AdaPay();
  28. $adaPay->gateWayType = 'api';
  29. $obj = new AdaPaySdk\PaymentConfirm();
  30. $obj_params = array(
  31. "payment_confirm_id" => "100000000000012312344"
  32. );
  33. $obj->query($obj_params);
  34. print("查询支付确认对象" . $obj->isError() . '=>' . json_encode($obj->result) . "\n");
  35. $this->assertEquals('succeeded', $obj->result['status']);
  36. // $this->assertTrue($account->isError());
  37. }
  38. public function testQueryList()
  39. {
  40. $adaPay = new AdaPay\AdaPay();
  41. $adaPay->gateWayType = 'api';
  42. $obj = new AdaPaySdk\PaymentConfirm();
  43. $obj_params = array(
  44. "app_id" => "app_7d87c043-aae3-4357-9b2c-269349a980d6",
  45. "payment_id" => "10023123123101",
  46. "page_index" => "",
  47. "page_size" => "",
  48. "created_gte" => "",
  49. "created_lte" => ""
  50. );
  51. $obj->queryList($obj_params);
  52. print("查询支付确认对象列表" . $obj->isError() . '=>' . json_encode($obj->result) . "\n");
  53. $this->assertEquals($obj_params['app_id'], $obj->result['app_id']);
  54. // $this->assertEquals('succeeded', $obj->result['status']);
  55. // $this->assertTrue($account->isError());
  56. }
  57. }