PaymentReverseTest.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. namespace app\api\controller\tests;
  3. use AdaPay;
  4. use AdaPaySdk;
  5. use PHPUnit\Framework\TestCase;
  6. class PaymentReverseTest extends TestCase
  7. {
  8. public function testCreate()
  9. {
  10. $adaPay = new AdaPay\AdaPay();
  11. $adaPay->gateWayType = 'api';
  12. $obj = new AdaPaySdk\PaymentReverse();
  13. $obj_params = array(
  14. 'payment_id' => '002112020102614582910166695202499047424',
  15. 'app_id' => 'app_7d87c043-aae3-4357-9b2c-269349a980d6',
  16. 'order_no' => "R" . date("YmdHis") . rand(100000, 999999),
  17. 'reverse_amt' => '0.01',
  18. 'notify_url' => '',
  19. 'reason' => '订单支金额错误',
  20. 'expand' => '',
  21. 'device_info' => '',
  22. );
  23. $obj->create($obj_params);
  24. print("创建支付撤销对象" . $obj->isError() . '=>' . json_encode($obj->result) . "\n");
  25. $this->assertEquals('succeeded', $obj->result['status']);
  26. // $this->assertTrue($obj->isError());
  27. }
  28. public function testQuery()
  29. {
  30. $adaPay = new AdaPay\AdaPay();
  31. $adaPay->gateWayType = 'api';
  32. $obj = new AdaPaySdk\PaymentReverse();
  33. $obj_params = array(
  34. 'reverse_id' => '1000000000001123333333'
  35. );
  36. $obj->query($obj_params);
  37. print("查询支付撤销对象" . $obj->isError() . '=>' . json_encode($obj->result) . "\n");
  38. $this->assertEquals('succeeded', $obj->result['status']);
  39. // $this->assertTrue($account->isError());
  40. }
  41. public function testQueryList()
  42. {
  43. $adaPay = new AdaPay\AdaPay();
  44. $adaPay->gateWayType = 'api';
  45. $obj = new AdaPaySdk\PaymentReverse();
  46. $obj_params = array(
  47. "app_id" => "app_7d87c043-aae3-4357-9b2c-269349a980d6",
  48. "payment_id" => "002112020102614582910166695202499047424",
  49. "page_index" => "",
  50. "page_size" => "",
  51. "created_gte" => "",
  52. "created_lte" => ""
  53. );
  54. $obj->queryList($obj_params);
  55. print("查询支付撤销对象列表" . $obj->isError() . '=>' . json_encode($obj->result) . "\n");
  56. $this->assertEquals('succeeded', $obj->result['status']);
  57. // $this->assertTrue($account->isError());
  58. }
  59. }