Skip to content

Commit 88fb22e

Browse files
authored
Merge pull request #24 from Korri/patch-1
Send CVV2 with card reference transactions
2 parents deeeaf3 + 086cd47 commit 88fb22e

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/Message/AuthorizeRequest.php

+3
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,9 @@ public function getData()
239239

240240
if ($this->getCardReference()) {
241241
$data['ORIGID'] = $this->getCardReference();
242+
if ($this->getCard()) {
243+
$data['CVV2'] = $this->getCard()->getCvv();
244+
}
242245
} else {
243246
$this->validate('card');
244247
$this->getCard()->validate();

tests/ProGatewayTest.php

+20
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,26 @@ public function testReferencePurchaseSuccess()
8686
$this->assertEquals('A10A6AE7042E', $response->getTransactionReference());
8787
}
8888

89+
public function testReferencePurchaseWithCvvSuccess()
90+
{
91+
$options = array(
92+
'amount' => '10.00',
93+
'cardReference' => 'abc123',
94+
'card' => new CreditCard(array(
95+
'cvv' => '123',
96+
)),
97+
);
98+
99+
$this->setMockHttpResponse('PurchaseSuccess.txt');
100+
101+
$request = $this->gateway->purchase($options);
102+
$response = $request->send();
103+
104+
$this->assertArrayHasKey('CVV2', $request->getData());
105+
$this->assertTrue($response->isSuccessful());
106+
$this->assertEquals('A10A6AE7042E', $response->getTransactionReference());
107+
}
108+
89109
public function testPurchaseError()
90110
{
91111
$this->setMockHttpResponse('PurchaseFailure.txt');

0 commit comments

Comments
 (0)