@@ -78,23 +78,29 @@ class PayPlanConnector extends RestGateway implements IRecurringService
78
78
*
79
79
* @var string
80
80
*/
81
- public $ developerId ;
81
+ protected $ devId ;
82
82
83
83
/**
84
84
* Version number for the application, as given during certification
85
85
*
86
86
* @var string
87
87
*/
88
- public $ versionNumber ;
88
+ protected $ versionNbr ;
89
89
90
90
public $ supportsRetrieval = true ;
91
91
public $ supportsUpdatePaymentDetails = false ;
92
92
93
+ protected $ integrationHeader = array ();
94
+
93
95
public function __get ($ name )
94
96
{
95
97
switch ($ name ) {
96
98
case 'secretApiKey ' :
97
99
return $ this ->apiKey ;
100
+ case 'developerId ' :
101
+ return $ this ->devId ;
102
+ case 'versionNumber ' :
103
+ return $ this ->versionNbr ;
98
104
default :
99
105
break ;
100
106
}
@@ -121,6 +127,16 @@ public function __set($name, $value)
121
127
$ auth = sprintf ('Basic %s ' , base64_encode ($ value ));
122
128
$ this ->headers ['Authorization ' ] = $ auth ;
123
129
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 ;
124
140
default :
125
141
break ;
126
142
}
@@ -677,4 +693,15 @@ protected function hasToken(IPaymentMethod $paymentMethod)
677
693
}
678
694
679
695
#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
+ }
680
707
}
0 commit comments