1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ByTIC\Omnipay\PlatiOnline\Tests\Message; |
4
|
|
|
|
5
|
|
|
use ByTIC\Omnipay\PlatiOnline\Message\PurchaseRequest; |
6
|
|
|
use ByTIC\Omnipay\PlatiOnline\Message\PurchaseResponse; |
7
|
|
|
use ByTIC\Omnipay\PlatiOnline\Message\AuthorizeRequest; |
8
|
|
|
use ByTIC\Omnipay\PlatiOnline\Message\AuthorizeResponse; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Class AuthorizeRequestTest |
12
|
|
|
* @package ByTIC\Omnipay\PlatiOnline\Tests\Message |
13
|
|
|
*/ |
14
|
|
|
class AuthorizeRequestTest extends AbstractRequestTest |
15
|
|
|
{ |
16
|
|
|
public function testSend() |
17
|
|
|
{ |
18
|
|
|
$data = require TEST_FIXTURE_PATH . '/enviromentParams.php'; |
19
|
|
|
$data = array_merge($data, require TEST_FIXTURE_PATH . '/requests/Purchase/baseRequest.php'); |
20
|
|
|
$data['lang'] = 'en'; |
21
|
|
|
$request = $this->newRequestWithInitTest(AuthorizeRequest::class, $data); |
22
|
|
|
|
23
|
|
|
/** @var AuthorizeResponse $response */ |
24
|
|
|
$response = $request->send(); |
25
|
|
|
self::assertInstanceOf(AuthorizeResponse::class, $response); |
26
|
|
|
|
27
|
|
|
$data = $response->getData(); |
28
|
|
|
self::assertInstanceOf(\SimpleXMLElement::class, $data); |
29
|
|
|
|
30
|
|
|
$url = $response->getRedirectUrl(); |
31
|
|
|
self::assertIsString($url); |
32
|
|
|
|
33
|
|
|
$client = $this->getHttpClientReal(); |
34
|
|
|
$gatewayResponse = $client->request('GET', $url); |
35
|
|
|
self::assertSame(200, $gatewayResponse->getStatusCode()); |
36
|
|
|
// self::assertStringEndsWith('mobilpay.ro/en', $gatewayResponse->getU()); |
37
|
|
|
|
38
|
|
|
//Validate first Response |
39
|
|
|
$body = $gatewayResponse->getBody()->__toString(); |
40
|
|
|
self::assertStringContainsString('[email protected]', $body); |
41
|
|
|
self::assertStringContainsString('name="tranzID"', $body); |
42
|
|
|
} |
43
|
|
|
} |
44
|
|
|
|