Skip to content

Commit cdf42b6

Browse files
committed
Only include the ReferrerID if it is set to a non-empty string.
1 parent 42a963f commit cdf42b6

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/Message/DirectAuthorizeRequest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ protected function getBaseAuthorizeData()
2626
$data['ClientIPAddress'] = $this->getClientIp();
2727
$data['ApplyAVSCV2'] = $this->getApplyAVSCV2() ?: 0;
2828
$data['Apply3DSecure'] = $this->getApply3DSecure() ?: 0;
29-
$data['ReferrerID'] = $this->getReferrerId();
29+
30+
if ($this->getReferrerId()) {
31+
$data['ReferrerID'] = $this->getReferrerId();
32+
}
3033

3134
// billing details
3235
$data['BillingFirstnames'] = $card->getBillingFirstName();

tests/Message/DirectAuthorizeRequestTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ public function testGetData()
5252
$this->assertSame('3F7A4119-8671-464F-A091-9E59EB47B80C', $data['ReferrerID']);
5353
}
5454

55+
public function testGetDataNoReferrerId()
56+
{
57+
// Default value is equivalent to this:
58+
$this->request->setReferrerId('');
59+
60+
$data = $this->request->getData();
61+
62+
$this->assertArrayNotHasKey('ReferrerID', $data);
63+
}
64+
5565
public function testGetDataCustomerDetails()
5666
{
5767
$card = $this->request->getCard();

0 commit comments

Comments
 (0)