⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.1
Server IP:
185.238.29.86
Server:
Linux server2 6.8.12-6-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.12-6 (2024-12-19T19:05Z) x86_64
Server Software:
nginx/1.18.0
PHP Version:
8.1.31
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
var
/
www
/
work
/
vendor
/
omnipay
/
migs
/
tests
/
Message
/
View File Name :
TwoPartyPurchaseRequestTest.php
<?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()); } }