ClientTest.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace Alipay\EasySDK\Test\payment\facetoface;
  3. use Alipay\EasySDK\Kernel\Factory;
  4. use Alipay\EasySDK\Test\TestAccount;
  5. use PHPUnit\Framework\TestCase;
  6. class ClientTest extends TestCase
  7. {
  8. public function __construct($name = null, array $data = [], $dataName = '')
  9. {
  10. parent::__construct($name, $data, $dataName);
  11. $account = new TestAccount();
  12. Factory::setOptions($account->getTestAccount());
  13. }
  14. public function testPay()
  15. {
  16. $create =Factory::payment()->common()->create("Iphone6 16G",
  17. microtime(), "88.88", "2088002656718920");
  18. $result = Factory::payment()->faceToFace()->pay("Iphone6 16G", $create->outTradeNo, "0.10",
  19. "1234567890");
  20. $this->assertEquals('40004', $result->code);
  21. $this->assertEquals('Business Failed', $result->msg);
  22. $this->assertEquals('ACQ.PAYMENT_AUTH_CODE_INVALID', $result->subCode);
  23. $this->assertEquals('支付失败,获取顾客账户信息失败,请顾客刷新付款码后重新收款,如再次收款失败,请联系管理员处理。[SOUNDWAVE_PARSER_FAIL]', $result->subMsg);
  24. }
  25. public function testPrecreate(){
  26. $create =Factory::payment()->common()->create("Iphone6 16G",
  27. microtime(), "88.88", "2088002656718920");
  28. $result = Factory::payment()->faceToFace()->precreate("Iphone6 16G", $create->outTradeNo, "0.10");
  29. $this->assertEquals('10000', $result->code);
  30. $this->assertEquals('Success', $result->msg);
  31. }
  32. }