|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace ByTIC\Omnipay\PlatiOnline\Tests\Message; |
|
4
|
|
|
|
|
5
|
|
|
use ByTIC\Omnipay\PlatiOnline\Message\ServerCompletePurchaseRequest; |
|
6
|
|
|
use ByTIC\Omnipay\PlatiOnline\Message\ServerCompletePurchaseResponse; |
|
7
|
|
|
use Symfony\Component\HttpFoundation\Request as HttpRequest; |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* Class CompletePurchaseRequestTest |
|
11
|
|
|
* @package ByTIC\Omnipay\PlatiOnline\Tests\Message |
|
12
|
|
|
*/ |
|
13
|
|
|
class ServerCompletePurchaseRequestTest extends AbstractRequestTest |
|
14
|
|
|
{ |
|
15
|
|
|
public function test_isValidNotification() |
|
16
|
|
|
{ |
|
17
|
|
|
$httpRequest = HttpRequest::createFromGlobals(); |
|
18
|
|
|
$httpRequest->request->add(require TEST_FIXTURE_PATH . '/requests/ServerCompletePurchase/authorised.php'); |
|
19
|
|
|
|
|
20
|
|
|
/** @var ServerCompletePurchaseRequest $request */ |
|
21
|
|
|
$request = $this->newRequestWithInitTest(ServerCompletePurchaseRequest::class, [], $httpRequest); |
|
22
|
|
|
|
|
23
|
|
|
self::assertTrue($request->isValidNotification()); |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
public function test_send() |
|
27
|
|
|
{ |
|
28
|
|
|
$httpRequest = HttpRequest::createFromGlobals(); |
|
29
|
|
|
$httpRequest->request->add(require TEST_FIXTURE_PATH . '/requests/ServerCompletePurchase/authorised.php'); |
|
30
|
|
|
$data = require TEST_FIXTURE_PATH . '/enviromentParams.php'; |
|
31
|
|
|
|
|
32
|
|
|
/** @var ServerCompletePurchaseRequest $request */ |
|
33
|
|
|
$request = $this->newRequestWithInitTest(ServerCompletePurchaseRequest::class, $data, $httpRequest); |
|
34
|
|
|
$response = $request->send(); |
|
35
|
|
|
|
|
36
|
|
|
self::assertInstanceOf(ServerCompletePurchaseResponse::class, $response); |
|
37
|
|
|
|
|
38
|
|
|
self::assertFalse($response->isSuccessful()); |
|
39
|
|
|
self::assertFalse($response->isPending()); |
|
40
|
|
|
self::assertFalse($response->isCancelled()); |
|
41
|
|
|
|
|
42
|
|
|
self::assertSame('6917422', $response->getTransactionReference()); |
|
43
|
|
|
self::assertSame('172315', $response->getTransactionId()); |
|
44
|
|
|
} |
|
45
|
|
|
} |