CorpMemberTest.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. namespace app\api\controller\tests;
  3. use AdaPay;
  4. use AdaPaySdk;
  5. use PHPUnit\Framework\TestCase;
  6. class CorpMemberTest extends TestCase
  7. {
  8. public function testCreate()
  9. {
  10. $adaPay = new AdaPay\AdaPay();
  11. $adaPay->gateWayType = 'api';
  12. $obj = new AdaPaySdk\CorpMember();
  13. $file_real_path = realpath('../src/123.zip');
  14. print_r($file_real_path);
  15. $obj_params = array(
  16. # app_id
  17. 'app_id' => 'app_7d87c043-aae3-4357-9b2c-269349a980d6',
  18. # 商户用户id
  19. 'member_id' => 'hf_prod_member_20190920',
  20. # 订单号
  21. 'order_no' => date("YmdHis") . rand(100000, 999999),
  22. # 企业名称
  23. 'name' => '测试企业',
  24. # 省份
  25. 'prov_code' => '0031',
  26. # 地区
  27. 'area_code' => '3100',
  28. # 统一社会信用码
  29. 'social_credit_code' => 'social_credit_code',
  30. 'social_credit_code_expires' => '20301109',
  31. # 经营范围
  32. 'business_scope' => '123123',
  33. # 法人姓名
  34. 'legal_person' => 'frname',
  35. # 法人身份证号码
  36. 'legal_cert_id' => '1234567890',
  37. # 法人身份证有效期
  38. 'legal_cert_id_expires' => '20301010',
  39. # 法人手机号
  40. 'legal_mp' => '13333333333',
  41. # 企业地址
  42. 'address' => '1234567890',
  43. # 邮编
  44. 'zip_code' => '企业地址测试',
  45. # 企业电话
  46. 'telphone' => '1234567890',
  47. # 企业邮箱
  48. 'email' => '1234567890@126.com',
  49. # 上传附件
  50. 'attach_file' => new CURLFile($file_real_path),
  51. # 银行代码
  52. 'bank_code' => '1001',
  53. # 银行账户类型
  54. 'bank_acct_type' => '1',
  55. );
  56. $obj->create($obj_params);
  57. print("创建企业用户" . $obj->isError() . '=>' . json_encode($obj->result) . "\n");
  58. // $this->assertEquals($obj_params['app_id'], $obj->result['app_id']);
  59. $this->assertTrue($obj->isError());
  60. }
  61. public function testQuery()
  62. {
  63. $adaPay = new AdaPay\AdaPay();
  64. $adaPay->gateWayType = 'api';
  65. $obj = new AdaPaySdk\CorpMember();
  66. $obj_params = [
  67. 'app_id' => 'app_7d87c043-aae3-4357-9b2c-269349a980d6',
  68. 'member_id' => 'hf_prod_member_20190920'
  69. ];
  70. $obj->query($obj_params);
  71. print("查询企业用户" . $obj->isError() . '=>' . json_encode($obj->result) . "\n");
  72. $this->assertEquals('succeeded', $obj->result['status']);
  73. // $this->assertTrue($account->isError());
  74. }
  75. }