FastPayTest.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace app\api\controller\tests;
  3. use AdaPay;
  4. use PHPUnit\Framework\TestCase;
  5. class FastPayTest extends TestCase
  6. {
  7. public function testPayConfirm()
  8. {
  9. $adaPay = new AdaPay\AdaPay();
  10. $adaPay->gateWayType = 'api';
  11. # 初始化快捷支付对象
  12. $obj = new \AdaPaySdk\FastPay();
  13. $fp_params = array(
  14. 'app_id' => 'app_7d87c043-aae3-4357-9b2c-269349a980d6',
  15. 'payment_id' => '002112020012010545810065165317376983040',
  16. 'sms_code' => '123456'
  17. );
  18. # 创建快捷支付确认
  19. $obj->payConfirm($fp_params);
  20. print("创建快捷支付对象" . $obj->isError() . '=>' . json_encode($obj->result) . "\n");
  21. $this->assertTrue($obj->isError());
  22. }
  23. public function testSmsCode()
  24. {
  25. $adaPay = new AdaPay\AdaPay();
  26. $adaPay->gateWayType = 'api';
  27. # 初始化快捷支付对象
  28. $obj = new \AdaPaySdk\FastPay();
  29. $fp_params = array(
  30. 'payment_id' => '20190912'
  31. );
  32. # 创建快捷支付短信发送
  33. $obj->paySmsCode($fp_params);
  34. print("创建快捷支付对象" . $obj->isError() . '=>' . json_encode($obj->result) . "\n");
  35. $this->assertTrue($obj->isError());
  36. }
  37. }