1 | <?php |
||||||
2 | |||||||
3 | namespace ByTIC\Payments\Stripe\Tests; |
||||||
4 | |||||||
5 | /** |
||||||
6 | * Class GatewayTest |
||||||
7 | * @package ByTIC\Payments\Stripe\Tests |
||||||
8 | */ |
||||||
9 | class GatewayTest extends AbstractTest |
||||||
10 | { |
||||||
11 | public function test_purchase_redirect() |
||||||
12 | { |
||||||
13 | $gateway = new \ByTIC\Payments\Stripe\Gateway(); |
||||||
14 | $gateway->initialize(require TEST_FIXTURE_PATH . '/enviromentParams.php'); |
||||||
15 | |||||||
16 | $parameters = require TEST_FIXTURE_PATH . '/requests/Purchase/baseRequest.php'; |
||||||
17 | |||||||
18 | $parameters['returnUrl'] = 'http://test.com'; |
||||||
19 | $request = $gateway->purchase($parameters); |
||||||
20 | $response = $request->send(); |
||||||
21 | |||||||
22 | $sessionId = $response->getSessionID(); |
||||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||||
23 | $content = $response->getViewContent(); |
||||||
0 ignored issues
–
show
The method
getViewContent() does not exist on Omnipay\Common\Message\ResponseInterface . It seems like you code against a sub-type of Omnipay\Common\Message\ResponseInterface such as ByTIC\Payments\Stripe\Message\PurchaseResponse or ByTIC\Payments\Stripe\Me...ompletePurchaseResponse or ByTIC\Omnipay\Twispay\Me...ompletePurchaseResponse or ByTIC\Omnipay\Twispay\Message\PurchaseResponse or ByTIC\Omnipay\Payu\Messa...ompletePurchaseResponse or ByTIC\Omnipay\Payu\Message\PurchaseResponse or ByTIC\Omnipay\Paylike\Message\PurchaseResponse or ByTIC\Omnipay\Paylike\Me...ompletePurchaseResponse or ByTIC\Omnipay\Euplatesc\Message\PurchaseResponse or ByTIC\Omnipay\Euplatesc\...ompletePurchaseResponse or ByTIC\Omnipay\Romcard\Message\PurchaseResponse or ByTIC\Omnipay\Romcard\Me...ompletePurchaseResponse or ByTIC\Omnipay\PlatiOnlin...ompletePurchaseResponse or ByTIC\Omnipay\PlatiOnline\Message\PurchaseResponse or ByTIC\Omnipay\Euplatesc\Message\PurchaseResponse or ByTIC\Payments\Stripe\Message\PurchaseResponse or ByTIC\Omnipay\Romcard\Message\PurchaseResponse or ByTIC\Omnipay\PlatiOnline\Message\PurchaseResponse or ByTIC\Omnipay\Twispay\Message\PurchaseResponse or ByTIC\Omnipay\Payu\Message\PurchaseResponse .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
24 | self::assertContains('stripe.redirectToCheckout({', $content); |
||||||
25 | self::assertContains('sessionId:', $content); |
||||||
26 | self::assertContains($sessionId, $content); |
||||||
27 | } |
||||||
28 | |||||||
29 | public function test_purchase_connected_account() |
||||||
30 | { |
||||||
31 | $gateway = new \ByTIC\Payments\Stripe\Gateway(); |
||||||
32 | $gateway->initialize(require TEST_FIXTURE_PATH . '/enviromentParams.php'); |
||||||
33 | |||||||
34 | $parameters = require TEST_FIXTURE_PATH . '/requests/Purchase/baseRequest.php'; |
||||||
35 | $parameters['returnUrl'] = 'http://test.com'; |
||||||
36 | |||||||
37 | $parameters['application_fee_amount'] = '3.0'; |
||||||
38 | $accountId = getenv('STRIPE_CONNECTED_ID'); |
||||||
39 | $parameters['on_behalf_of'] = $accountId; |
||||||
40 | |||||||
41 | $request = $gateway->purchase($parameters); |
||||||
42 | $response = $request->send(); |
||||||
43 | |||||||
44 | $sessionId = $response->getSessionID(); |
||||||
45 | $content = $response->getViewContent(); |
||||||
46 | self::assertContains('stripe.redirectToCheckout({', $content); |
||||||
47 | self::assertContains('sessionId:', $content); |
||||||
48 | self::assertContains($sessionId, $content); |
||||||
49 | } |
||||||
50 | } |
||||||
51 |