Server IP : 66.29.132.124 / Your IP : 3.145.105.199 Web Server : LiteSpeed System : Linux business141.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : wavevlvu ( 1524) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/wavevlvu/book24.ng/vendor/omnipay/migs/tests/Message/ |
Upload File : |
<?php namespace Omnipay\Migs\Message; use Omnipay\Tests\TestCase; class TwoPartyPurchaseRequestTest extends TestCase { public function setUp() { $this->request = new TwoPartyPurchaseRequest($this->getHttpClient(), $this->getHttpRequest()); } public function testCalculateHash() { $data = array( 'vpc_Merchant' => '123', 'vpc_AccessCode' => '123', 'vpc_Version' => '1', 'vpc_Locale' => 'en', 'vpc_Command' => 'pay', 'vpc_Amount' => '1200', 'vpc_MerchTxnRef' => '123', 'vpc_OrderInfo' => '', 'vpc_ReturnURL' => 'https://www.example.com/return', 'vpc_CardNum' => '4111111111111111', 'vpc_CardExp' => '1305', 'vpc_CardSecurityCode' => '123', ); $this->request->setSecureHash('123'); $hash = $this->request->calculateHash($data); $this->assertSame('C3CC125E94B18DBC5C45BBB9606B969854571B4D0A0BFF1940B4A603B3E50417', $hash); } public function testPurchase() { $this->setMockHttpResponse('TwoPartyPurchaseSuccess.txt'); $this->request->initialize( array( 'amount' => '12.00', 'transactionId' => 123, 'card' => $this->getValidCard(), 'merchantId' => '123', 'merchantAccessCode' => '123', 'secureHash' => '123', 'returnUrl' => 'https://www.example.com/return' ) ); $response = $this->request->send(); $this->assertInstanceOf('Omnipay\Migs\Message\Response', $response); $this->assertTrue($response->isSuccessful()); $this->assertFalse($response->isRedirect()); $this->assertEquals('12345', $response->getTransactionReference()); $this->assertSame('Approved', $response->getMessage()); $this->assertSame('0', $response->getCode()); $this->assertArrayHasKey('vpc_SecureHash', $response->getData()); } }