Skip to content

Commit 0102b7d

Browse files
committed
Support retrieving merchant reference from CompletePurchaseResponse (#3)
1 parent 69e2526 commit 0102b7d

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/Message/CompletePurchaseResponse.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,16 @@ public function getTransactionReference()
6464
return $this->getKey('transaction_id');
6565
}
6666

67+
/**
68+
* Get the merchant-supplied transaction identifier if available.
69+
*
70+
* @return null|string
71+
*/
72+
public function getTransactionId()
73+
{
74+
return $this->getKey('req_reference_number');
75+
}
76+
6777
/**
6878
* Get the authorisation code if available.
6979
*

tests/Message/CompletePurchaseResponseTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ public function testCompletePurchaseSuccess()
131131
$this->assertTrue($this->response->isSuccessful());
132132
$this->assertFalse($this->response->isRedirect());
133133
$this->assertSame('1234567890123456789012', $this->response->getTransactionReference());
134+
$this->assertSame('123abc', $this->response->getTransactionId());
134135
$this->assertSame('831000', $this->response->getAuthCode());
135136
$this->assertSame('100', $this->response->getReasonCode());
136137
$this->assertSame('Request was processed successfully.', $this->response->getMessage());

0 commit comments

Comments
 (0)