Skip to content

Commit 52ea33e

Browse files
committed
Fix Migs gateway tests
1 parent 39c7db2 commit 52ea33e

File tree

2 files changed

+19
-36
lines changed

2 files changed

+19
-36
lines changed

tests/Omnipay/Migs/Message/TwoPartyPurchaseRequestTest.php

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,27 @@ public function setUp()
2121
$this->request = new TwoPartyPurchaseRequest($this->getHttpClient(), $this->getHttpRequest());
2222
}
2323

24-
public function testSignature()
24+
public function testCalculateHash()
2525
{
26-
$this->request->initialize(
27-
array(
28-
'amount' => 1200,
29-
'transactionId' => 123,
30-
'card' => new CreditCard(
31-
array(
32-
'number' => '4111111111111111',
33-
'expiryMonth' => '05',
34-
'expiryYear' => '2013',
35-
'cvv' => '123',
36-
)
37-
),
38-
'merchantId' => '123',
39-
'merchantAccessCode' => '123',
40-
'secureHash' => '123',
41-
'returnUrl' => 'https://www.example.com/return'
42-
)
26+
$data = array(
27+
'vpc_Merchant' => '123',
28+
'vpc_AccessCode' => '123',
29+
'vpc_Version' => '1',
30+
'vpc_Locale' => 'en',
31+
'vpc_Command' => 'pay',
32+
'vpc_Amount' => '1200',
33+
'vpc_MerchTxnRef' => '123',
34+
'vpc_OrderInfo' => '',
35+
'vpc_ReturnURL' => 'https://www.example.com/return',
36+
'vpc_CardNum' => '4111111111111111',
37+
'vpc_CardExp' => '1305',
38+
'vpc_CardSecurityCode' => '123',
4339
);
4440

45-
$data = $this->request->getData();
41+
$this->request->setSecureHash('123');
42+
$hash = $this->request->calculateHash($data);
4643

47-
$this->assertSame('2624B4BABED7CCA98665238D75560600', $data['vpc_SecureHash']);
44+
$this->assertSame('2624B4BABED7CCA98665238D75560600', $hash);
4845
}
4946

5047
public function testPurchase()
@@ -55,14 +52,7 @@ public function testPurchase()
5552
array(
5653
'amount' => 1200,
5754
'transactionId' => 123,
58-
'card' => new CreditCard(
59-
array(
60-
'number' => '4111111111111111',
61-
'expiryMonth' => '05',
62-
'expiryYear' => '2013',
63-
'cvv' => '123',
64-
)
65-
),
55+
'card' => $this->getValidCard(),
6656
'merchantId' => '123',
6757
'merchantAccessCode' => '123',
6858
'secureHash' => '123',

tests/Omnipay/Migs/TwoPartyGatewayTest.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,7 @@ public function setUp()
2727
$this->options = array(
2828
'amount' => 1000,
2929
'transactionId' => 12345,
30-
'card' => new CreditCard(
31-
array(
32-
'number' => '4111111111111111',
33-
'expiryMonth' => '05',
34-
'expiryYear' => '2013',
35-
'cvv' => '123',
36-
)
37-
),
30+
'card' => $this->getValidCard(),
3831
);
3932
}
4033

0 commit comments

Comments
 (0)