Skip to content

Commit

Permalink
Merge pull request #24 from Korri/patch-1
Browse files Browse the repository at this point in the history
 Send CVV2 with card reference transactions
  • Loading branch information
delatbabel authored Apr 11, 2018
2 parents deeeaf3 + 086cd47 commit 88fb22e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Message/AuthorizeRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,9 @@ public function getData()

if ($this->getCardReference()) {
$data['ORIGID'] = $this->getCardReference();
if ($this->getCard()) {
$data['CVV2'] = $this->getCard()->getCvv();
}
} else {
$this->validate('card');
$this->getCard()->validate();
Expand Down
20 changes: 20 additions & 0 deletions tests/ProGatewayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,26 @@ public function testReferencePurchaseSuccess()
$this->assertEquals('A10A6AE7042E', $response->getTransactionReference());
}

public function testReferencePurchaseWithCvvSuccess()
{
$options = array(
'amount' => '10.00',
'cardReference' => 'abc123',
'card' => new CreditCard(array(
'cvv' => '123',
)),
);

$this->setMockHttpResponse('PurchaseSuccess.txt');

$request = $this->gateway->purchase($options);
$response = $request->send();

$this->assertArrayHasKey('CVV2', $request->getData());
$this->assertTrue($response->isSuccessful());
$this->assertEquals('A10A6AE7042E', $response->getTransactionReference());
}

public function testPurchaseError()
{
$this->setMockHttpResponse('PurchaseFailure.txt');
Expand Down

0 comments on commit 88fb22e

Please sign in to comment.