public function testPurchase() { /** * @var PurchaseResponse $response */ $response = $this->gateway->purchase($this->options)->send(); $this->assertFalse($response->isSuccessful()); $this->assertTrue($response->isRedirect()); $this->assertNotEmpty($response->getRedirectUrl()); $redirectData = $response->getRedirectData(); $this->assertSame('https://www.example.com/return', $redirectData['return_url']); }
/** * @param array|null $config * @return \Omnipay\Alipay\ExpressGateway */ public function alipay(array $config = null) { $returnUrl = url('pay/alipay/return'); $notifyUrl = url('pay/alipay/notify'); $gateway = new AlipayExpressGateway(); if (is_null($config)) { $config = Config::get('payments.alipay'); } $gateway->setPartner(array_get($config, 'id')); $gateway->setKey(array_get($config, 'key')); $gateway->setSellerEmail(array_get($config, 'email')); $gateway->setNotifyUrl($notifyUrl); $gateway->setReturnUrl($returnUrl); return $gateway; }