riainvoice/vendor_old/omnipay/paymentexpress/tests/Message/PxPayAuthorizeResponseTest.php
2021-10-01 23:56:38 +05:30

33 lines
1.6 KiB
PHP

<?php
namespace Omnipay\PaymentExpress\Message;
use Omnipay\Tests\TestCase;
class PxPayAuthorizeResponseTest extends TestCase
{
public function testPurchaseSuccess()
{
$httpResponse = $this->getMockHttpResponse('PxPayPurchaseSuccess.txt');
$response = new PxPayAuthorizeResponse($this->getMockRequest(), $httpResponse->xml());
$this->assertFalse($response->isSuccessful());
$this->assertTrue($response->isRedirect());
$this->assertNull($response->getTransactionReference());
$this->assertNull($response->getMessage());
$this->assertSame('https://sec.paymentexpress.com/pxpay/pxpay.aspx?userid=Developer&request=v5H7JrBTzH-4Whs__1iQnz4RGSb9qxRKNR4kIuDP8kIkQzIDiIob9GTIjw_9q_AdRiR47ViWGVx40uRMu52yz2mijT39YtGeO7cZWrL5rfnx0Mc4DltIHRnIUxy1EO1srkNpxaU8fT8_1xMMRmLa-8Fd9bT8Oq0BaWMxMquYa1hDNwvoGs1SJQOAJvyyKACvvwsbMCC2qJVyN0rlvwUoMtx6gGhvmk7ucEsPc_Cyr5kNl3qURnrLKxINnS0trdpU4kXPKOlmT6VacjzT1zuj_DnrsWAPFSFq-hGsow6GpKKciQ0V0aFbAqECN8rl_c-aZWFFy0gkfjnUM4qp6foS0KMopJlPzGAgMjV6qZ0WfleOT64c3E-FRLMP5V_-mILs8a', $response->getRedirectUrl());
$this->assertSame('GET', $response->getRedirectMethod());
}
public function testPurchaseFailure()
{
$httpResponse = $this->getMockHttpResponse('PxPayPurchaseFailure.txt');
$response = new PxPayAuthorizeResponse($this->getMockRequest(), $httpResponse->xml());
$this->assertFalse($response->isSuccessful());
$this->assertFalse($response->isRedirect());
$this->assertNull($response->getTransactionReference());
$this->assertSame('Invalid Key', $response->getMessage());
}
}