SettleAccountTest.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <?php
  2. namespace app\api\controller\tests;
  3. use AdaPay;
  4. use AdaPaySdk;
  5. use PHPUnit\Framework\TestCase;
  6. class SettleAccountTest extends TestCase
  7. {
  8. public function testBalance()
  9. {
  10. $adaPay = new AdaPay\AdaPay();
  11. $adaPay->gateWayType = 'api';
  12. // 查询账户余额
  13. $obj = new \AdaPaySdk\SettleAccount();
  14. $account_params = array(
  15. 'app_id' => 'app_7d87c043-aae3-4357-9b2c-269349a980d6',
  16. 'member_id' => 'user_00008',
  17. 'settle_account_id' => '0035172521665088'
  18. );
  19. $obj->balance($account_params);
  20. // var_dump($account->result);
  21. print($obj->isError() . '=>' . json_encode($obj->result));
  22. // $this->assertArrayHasKey('error', $account->result);
  23. // $this->assertTrue($account->isError()==true);
  24. $this->assertEquals('succeeded', $obj->result['status']);
  25. }
  26. public function testCreate()
  27. {
  28. $adaPay = new AdaPay\AdaPay();
  29. $adaPay->gateWayType = 'api';
  30. $obj = new AdaPaySdk\SettleAccount();
  31. $obj_params = array(
  32. 'app_id' => 'app_7d87c043-aae3-4357-9b2c-269349a980d6',
  33. 'member_id' => 'hf_prod_member_20191013',
  34. 'channel' => 'bank_account',
  35. 'account_info' => [
  36. 'card_id' => '622202170300169222',
  37. 'card_name' => '余益兰',
  38. 'cert_id' => '310109200006068391',
  39. 'cert_type' => '00',
  40. 'tel_no' => '18888818881',
  41. 'bank_code' => '03060000',
  42. 'bank_name' => '建hua',
  43. 'bank_acct_type' => 1,
  44. 'prov_code' => '0031',
  45. 'area_code' => '3100'
  46. ]
  47. );
  48. $obj->create($obj_params);
  49. print("创建结算账户" . $obj->isError() . '=>' . json_encode($obj->result) . "\n");
  50. $this->assertEquals('succeeded', $obj->result['status']);
  51. // $this->assertTrue($obj->isError());
  52. }
  53. public function testQuery()
  54. {
  55. $adaPay = new AdaPay\AdaPay();
  56. $adaPay->gateWayType = 'api';
  57. $obj = new AdaPaySdk\SettleAccount();
  58. $obj_params = array(
  59. 'app_id' => 'app_f8b14a77-dc24-433b-864f-98a62209d6c4',
  60. 'member_id' => 'hf_test_member_id_account5',
  61. 'settle_account_id' => '0006017543466816'
  62. );
  63. $obj->query($obj_params);
  64. print("查询结算账户" . $obj->isError() . '=>' . json_encode($obj->result) . "\n");
  65. $this->assertEquals('succeeded', $obj->result['status']);
  66. // $this->assertTrue($account->isError());
  67. }
  68. public function testDetail()
  69. {
  70. $adaPay = new AdaPay\AdaPay();
  71. $adaPay->gateWayType = 'api';
  72. $obj = new AdaPaySdk\SettleAccount();
  73. $obj_params = array(
  74. 'app_id' => 'app_f8b14a77-dc24-433b-864f-98a62209d6c4',
  75. 'member_id' => 'hf_test_member_id_account5',
  76. 'settle_account_id' => '0006017543466816',
  77. 'begin_date' => '20190705',
  78. 'end_date' => '20190806'
  79. );
  80. $obj->detail($obj_params);
  81. print("查询结算账户明细列表" . $obj->isError() . '=>' . json_encode($obj->result) . "\n");
  82. $this->assertEquals('succeeded', $obj->result['status']);
  83. // $this->assertTrue($account->isError());
  84. }
  85. public function testDelete()
  86. {
  87. $adaPay = new AdaPay\AdaPay();
  88. $adaPay->gateWayType = 'api';
  89. $obj = new AdaPaySdk\SettleAccount();
  90. $obj_params = array(
  91. 'app_id' => 'app_f8b14a77-dc24-433b-864f-98a62209d6c4',
  92. 'member_id' => 'hf_test_member_id_account5',
  93. 'settle_account_id' => '0006017543466816'
  94. );
  95. $obj->delete($obj_params);
  96. print("删除结算账户" . $obj->isError() . '=>' . json_encode($obj->result) . "\n");
  97. $this->assertEquals('succeeded', $obj->result['status']);
  98. // $this->assertTrue($account->isError());
  99. }
  100. public function testUpdate()
  101. {
  102. $adaPay = new AdaPay\AdaPay();
  103. $adaPay->gateWayType = 'api';
  104. $obj = new AdaPaySdk\SettleAccount();
  105. $obj_params = array(
  106. 'app_id' => 'app_7d87c043-aae3-4357-9b2c-269349a980d6',
  107. 'member_id' => 'hf_test_201999999999',
  108. 'settle_account_id' => '0006124815051328',
  109. 'min_amt' => '',
  110. 'remained_amt' => '',
  111. 'channel_remark' => '123'
  112. );
  113. $obj->update($obj_params);
  114. print("修改结算账户配置" . $obj->isError() . '=>' . json_encode($obj->result) . "\n");
  115. $this->assertEquals('succeeded', $obj->result['status']);
  116. // $this->assertTrue($account->isError());
  117. }
  118. }