Skip to content

Commit 2ded7ec

Browse files
Add support for referrer code to Rest Gateway
Referrer code is otherwise called BNCode or partner attribution id in paypal-land. I chose referrer code as something generic https://developer.paypal.com/docs/integration/direct/payments/#
1 parent 344d545 commit 2ded7ec

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/Message/AbstractRestRequest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,22 @@ abstract class AbstractRestRequest extends \Omnipay\Common\Message\AbstractReque
6262
*/
6363
protected $payerId = null;
6464

65+
protected $referrerCode = 'CiviCRM_SP';
66+
67+
/**
68+
* @return string
69+
*/
70+
public function getReferrerCode() {
71+
return $this->referrerCode;
72+
}
73+
74+
/**
75+
* @param string $referrerCode
76+
*/
77+
public function setReferrerCode($referrerCode) {
78+
$this->referrerCode = $referrerCode;
79+
}
80+
6581
public function getClientId()
6682
{
6783
return $this->getParameter('clientId');
@@ -146,6 +162,7 @@ public function sendData($data)
146162
'Accept' => 'application/json',
147163
'Authorization' => 'Bearer ' . $this->getToken(),
148164
'Content-type' => 'application/json',
165+
'PayPal-Partner-Attribution-Id' => $this->getReferrerCode(),
149166
),
150167
$body
151168
);

src/Message/RestCreateCardRequest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ public function getData()
122122
]
123123
];
124124
}
125+
125126
return $data;
126127
}
127128

0 commit comments

Comments
 (0)