Skip to content

Commit aa20cdf

Browse files
20201112 deployment
1 parent 6ebd404 commit aa20cdf

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

src/Gateways/PayPlanConnector.php

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,23 +78,29 @@ class PayPlanConnector extends RestGateway implements IRecurringService
7878
*
7979
* @var string
8080
*/
81-
public $developerId;
81+
protected $devId;
8282

8383
/**
8484
* Version number for the application, as given during certification
8585
*
8686
* @var string
8787
*/
88-
public $versionNumber;
88+
protected $versionNbr;
8989

9090
public $supportsRetrieval = true;
9191
public $supportsUpdatePaymentDetails = false;
9292

93+
protected $integrationHeader = array();
94+
9395
public function __get($name)
9496
{
9597
switch ($name) {
9698
case 'secretApiKey':
9799
return $this->apiKey;
100+
case 'developerId':
101+
return $this->devId;
102+
case 'versionNumber':
103+
return $this->versionNbr;
98104
default:
99105
break;
100106
}
@@ -121,6 +127,16 @@ public function __set($name, $value)
121127
$auth = sprintf('Basic %s', base64_encode($value));
122128
$this->headers['Authorization'] = $auth;
123129
return;
130+
case 'developerId':
131+
$this->devId = $value;
132+
$this->integrationHeader['DeveloperId'] = $value;
133+
$this->updateIntegrationHeader();
134+
return;
135+
case 'versionNumber':
136+
$this->versionNbr = $value;
137+
$this->integrationHeader['VersionNbr'] = $value;
138+
$this->updateIntegrationHeader();
139+
return;
124140
default:
125141
break;
126142
}
@@ -677,4 +693,15 @@ protected function hasToken(IPaymentMethod $paymentMethod)
677693
}
678694

679695
#endregion
696+
697+
protected function updateIntegrationHeader()
698+
{
699+
$pairs = array();
700+
701+
foreach ($this->integrationHeader as $key => $value) {
702+
$pairs[] = sprintf('%s=%s', $key, $value);
703+
}
704+
705+
$this->headers['HPS-Integration'] = implode(',', $pairs);
706+
}
680707
}

0 commit comments

Comments
 (0)