AccountTest.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace app\api\controller\tests;
  3. use AdaPay;
  4. use AdaPaySdk;
  5. use PHPUnit\Framework\TestCase;
  6. class AccountTest extends TestCase
  7. {
  8. // public function testOne()
  9. // {
  10. // $this->assertTrue(false);
  11. // }
  12. public function testPayment()
  13. {
  14. // 查询账户余额
  15. $adaPay = new AdaPay\AdaPay();
  16. $adaPay->gateWayType = 'page';
  17. $obj = new AdaPaySdk\Account();
  18. $account_params = array(
  19. # 商户的应用 id
  20. 'app_id' => 'app_7d87c043-aae3-4357-9b2c-269349a980d6',
  21. # 用户ID
  22. 'order_no' => "WL_" . date("YmdHis") . rand(100000, 999999),
  23. # 订单总金额(必须大于0)
  24. 'pay_amt' => '0.10',
  25. # 3 位 ISO 货币代码,小写字母
  26. 'currency' => 'cny',
  27. # 商品标题
  28. 'goods_title' => '12314',
  29. # 商品描述信息
  30. 'goods_desc' => '123122123',
  31. );
  32. $obj->payment($account_params);
  33. // var_dump($account->result);
  34. print($obj->isError() . '=>' . json_encode($obj->result));
  35. $this->assertEquals('succeeded', $obj->result['status']);
  36. // $this->assertTrue($account->isError());
  37. }
  38. }