3737 */
3838class PayconiqCallbackSignatureVerifier
3939{
40- // Legacy endpoints
41- public const CERTIFICATES_PRODUCTION_URL_LEGACY = 'https://payconiq.com/certificates ' ;
42- public const CERTIFICATES_STAGING_URL_LEGACY = 'https://ext.payconiq.com/certificates ' ;
43-
44- // New endpoints
45- public const CERTIFICATES_PRODUCTION_URL_NEW = 'https://jwks.bancontact.net ' ;
46- public const CERTIFICATES_STAGING_URL_NEW = 'https://jwks.preprod.bancontact.net ' ;
40+ public const CERTIFICATES_PRODUCTION_URL = 'https://jwks.bancontact.net ' ;
41+ public const CERTIFICATES_STAGING_URL = 'https://jwks.preprod.bancontact.net ' ;
4742
4843 private const TIMEOUT = 10 ;
4944 private const CONNECT_TIMEOUT = 2 ;
5045
5146 private ClientInterface $ httpClient ;
5247 private AdapterInterface $ cache ;
5348 private bool $ useProd ;
54- private bool $ useNewPreProductionEnv ; // only used for the new pre-production testing
5549 private JWSLoader $ jwsLoader ;
5650
5751 public function __construct (
5852 string $ paymentProfileId ,
5953 ClientInterface $ httpClient = null ,
6054 AdapterInterface $ cache = null ,
6155 bool $ useProd = true ,
62- bool $ useNewPreProductionEnv = false ,
6356 ) {
64- if (
65- true === $ useProd
66- && true === $ useNewPreProductionEnv
67- && false === MigrationHelper::switchToNewEndpoints ()
68- ) {
69- throw new \InvalidArgumentException ('You can not use the new pre production env in production mode yet ' );
70- }
71-
7257 if (null === $ httpClient ) {
7358 $ httpClient = new Client ([
7459 RequestOptions::TIMEOUT => self ::TIMEOUT ,
@@ -83,20 +68,13 @@ public function __construct(
8368 $ this ->httpClient = $ httpClient ;
8469 $ this ->cache = $ cache ;
8570 $ this ->useProd = $ useProd ;
86- $ this ->useNewPreProductionEnv = $ useNewPreProductionEnv ;
8771
8872 $ this ->jwsLoader = $ this ->initializeJwsLoader ($ paymentProfileId );
8973 }
9074
9175 private function getCertificatesUrl (): string
9276 {
93- if (true === $ this ->useNewPreProductionEnv || true === MigrationHelper::switchToNewEndpoints ()) {
94- // new endpoints
95- return ($ this ->useProd ? self ::CERTIFICATES_PRODUCTION_URL_NEW : self ::CERTIFICATES_STAGING_URL_NEW );
96- }
97-
98- // legacy endpoints
99- return ($ this ->useProd ? self ::CERTIFICATES_PRODUCTION_URL_LEGACY : self ::CERTIFICATES_STAGING_URL_LEGACY );
77+ return $ this ->useProd ? self ::CERTIFICATES_PRODUCTION_URL : self ::CERTIFICATES_STAGING_URL ;
10078 }
10179
10280 public function isValid (string $ token , ?string $ payload = null , ?int $ signature = 0 ): bool
@@ -185,12 +163,12 @@ private static function normalizeEcdsaSigIfNeeded(string $compactJws, int $partL
185163
186164 // Try DER → raw using phpseclib helpers
187165 try {
188- $ rs = EcdsaAsn1::load ($ sig ); // ['r'=>BigInteger,'s'=>BigInteger]
166+ $ rs = EcdsaAsn1::load ($ sig ); // ['r'=>BigInteger,'s'=>BigInteger]
189167 $ raw = EcdsaP1363::save ($ rs ['r ' ], $ rs ['s ' ], null , $ partLen ); // fixed-length P-1363
190168 $ sB64u = rtrim (strtr (base64_encode ($ raw ), '+/ ' , '-_ ' ), '= ' );
191169 return "$ h. $ p. $ sB64u " ;
192170 } catch (\Throwable ) {
193- // Not DER / not parseable — leave as-is and let the verifier decide
171+ // Not DER / not parseable - leave as-is and let the verifier decide
194172 return $ compactJws ;
195173 }
196174 }
0 commit comments