RefundTest.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. use PHPUnit\Framework\TestCase;
  3. class RefundTest extends TestCase
  4. {
  5. public function testCreate()
  6. {
  7. $obj = new AdaPaySdk\Refund();
  8. $obj::$gateWayType = 'api';
  9. $obj_params = array(
  10. # 原交易支付对象ID
  11. 'payment_id'=> '002112019101519194610030140730621550592',
  12. # 退款订单号
  13. 'refund_order_no'=> '20190919071231283468359213',
  14. # 退款金额
  15. 'refund_amt'=> '0.01',
  16. # 退款描述
  17. 'reason'=> '退款描述',
  18. # 扩展域
  19. 'expend'=> '',
  20. # 设备静态信息
  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. $obj = new AdaPaySdk\Refund();
  31. $obj::$gateWayType = 'api';
  32. $obj_params = array(
  33. 'payment_id'=> '002112019101519194610030140730621550592'
  34. );
  35. $obj->query($obj_params);
  36. print("查询退款对象".$obj->isError().'=>'.json_encode($obj->result)."\n");
  37. $this->assertEquals('succeeded', $obj->result['status']);
  38. // $this->assertTrue($account->isError());
  39. }
  40. }