AopWapGatewayTest.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace Omnipay\Alipay\Tests;
  3. use Omnipay\Alipay\AopWapGateway;
  4. use Omnipay\Alipay\Common\Signer;
  5. use Omnipay\Alipay\Responses\AopCompletePurchaseResponse;
  6. use Omnipay\Alipay\Responses\AopCompleteRefundResponse;
  7. use Omnipay\Alipay\Responses\AopTradeWapPayResponse;
  8. class AopWapGatewayTest extends AbstractGatewayTestCase
  9. {
  10. /**
  11. * @var AopWapGateway $gateway
  12. */
  13. protected $gateway;
  14. protected $options;
  15. public function setUp()
  16. {
  17. parent::setUp();
  18. $this->gateway = new AopWapGateway($this->getHttpClient(), $this->getHttpRequest());
  19. $this->gateway->setAppId($this->appId);
  20. $this->gateway->setPrivateKey($this->appPrivateKey);
  21. $this->gateway->setNotifyUrl('https://www.example.com/notify');
  22. $this->gateway->setReturnUrl('https://www.example.com/return');
  23. }
  24. public function testPurchase()
  25. {
  26. /**
  27. * @var AopTradeWapPayResponse $response
  28. */
  29. $response = $this->gateway->purchase(
  30. [
  31. 'biz_content' => [
  32. 'out_trade_no' => date('YmdHis') . mt_rand(1000, 9999),
  33. 'total_amount' => 0.01,
  34. 'subject' => 'test',
  35. 'product_code' => 'QUICK_MSECURITY_PAY',
  36. ]
  37. ]
  38. )->send();
  39. $this->assertTrue($response->isSuccessful());
  40. $this->assertTrue($response->isRedirect());
  41. $this->assertNotEmpty($response->getRedirectUrl());
  42. }
  43. }