File tree Expand file tree Collapse file tree 4 files changed +40
-0
lines changed
Expand file tree Collapse file tree 4 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ public function getDefaultParameters()
2020 'vendor ' => '' ,
2121 'testMode ' => false ,
2222 'simulatorMode ' => false ,
23+ 'referrerId ' => '' ,
2324 );
2425 }
2526
@@ -43,6 +44,16 @@ public function setSimulatorMode($value)
4344 return $ this ->setParameter ('simulatorMode ' , $ value );
4445 }
4546
47+ public function getReferrerId ()
48+ {
49+ return $ this ->getParameter ('referrerId ' );
50+ }
51+
52+ public function setReferrerId ($ value )
53+ {
54+ return $ this ->setParameter ('referrerId ' , $ value );
55+ }
56+
4657 public function authorize (array $ parameters = array ())
4758 {
4859 return $ this ->createRequest ('\Omnipay\SagePay\Message\DirectAuthorizeRequest ' , $ parameters );
Original file line number Diff line number Diff line change @@ -55,6 +55,19 @@ public function setAccountType($value)
5555 return $ this ->setParameter ('accountType ' , $ value );
5656 }
5757
58+ public function getReferrerId ()
59+ {
60+ return $ this ->getParameter ('referrerId ' );
61+ }
62+
63+ /**
64+ * Set the referrer ID for PAYMENT, DEFERRED and AUTHENTICATE transactions.
65+ */
66+ public function setReferrerId ($ value )
67+ {
68+ return $ this ->setParameter ('referrerId ' , $ value );
69+ }
70+
5871 public function getApplyAVSCV2 ()
5972 {
6073 return $ this ->getParameter ('applyAVSCV2 ' );
Original file line number Diff line number Diff line change @@ -27,6 +27,10 @@ protected function getBaseAuthorizeData()
2727 $ data ['ApplyAVSCV2 ' ] = $ this ->getApplyAVSCV2 () ?: 0 ;
2828 $ data ['Apply3DSecure ' ] = $ this ->getApply3DSecure () ?: 0 ;
2929
30+ if ($ this ->getReferrerId ()) {
31+ $ data ['ReferrerID ' ] = $ this ->getReferrerId ();
32+ }
33+
3034 // billing details
3135 $ data ['BillingFirstnames ' ] = $ card ->getBillingFirstName ();
3236 $ data ['BillingSurname ' ] = $ card ->getBillingLastName ();
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ public function testGetData()
3737 $ this ->request ->setApply3DSecure (3 );
3838 $ this ->request ->setDescription ('food ' );
3939 $ this ->request ->setClientIp ('127.0.0.1 ' );
40+ $ this ->request ->setReferrerId ('3F7A4119-8671-464F-A091-9E59EB47B80C ' );
4041
4142 $ data = $ this ->request ->getData ();
4243
@@ -48,6 +49,17 @@ public function testGetData()
4849 $ this ->assertSame ('127.0.0.1 ' , $ data ['ClientIPAddress ' ]);
4950 $ this ->assertSame (2 , $ data ['ApplyAVSCV2 ' ]);
5051 $ this ->assertSame (3 , $ data ['Apply3DSecure ' ]);
52+ $ this ->assertSame ('3F7A4119-8671-464F-A091-9E59EB47B80C ' , $ data ['ReferrerID ' ]);
53+ }
54+
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 );
5163 }
5264
5365 public function testGetDataCustomerDetails ()
You can’t perform that action at this time.
0 commit comments