Skip to content

Commit 1c53f1c

Browse files
author
Camille Islasse
committed
Addition of a field to allow adding a personalized url. Because endpoints can change and it's hard to have endpoints hard-coded in the code
1 parent 2724498 commit 1c53f1c

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

Diff for: src/Api/Api.php

+11-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class Api
2121
const HASH_MODE_SHA256 = 'SHA256';
2222

2323
const ENDPOINT_SYSTEMPAY = 'SYSTEMPAY';
24+
const ENDPOINT_SOGECOMMERCE = 'SOGECOMMERCE';
2425
const ENDPOINT_SCELLIUS = 'SCELLIUS';
2526
const ENDPOINT_CLICANDPAY = 'CLICANDPAY';
2627
const ENDPOINT_OSB = 'OSB';
@@ -250,13 +251,15 @@ private function getConfigResolver(): OptionsResolver
250251
])
251252
->setDefaults([
252253
'endpoint' => null,
254+
'endpoint_url' => null,
253255
'hash_mode' => self::HASH_MODE_SHA256,
254256
'debug' => false,
255257
])
256258
->setAllowedTypes('site_id', 'string')
257259
->setAllowedTypes('certificate', 'string')
258260
->setAllowedValues('ctx_mode', $this->getModes())
259261
->setAllowedTypes('directory', 'string')
262+
->setAllowedTypes('endpoint_url', 'string')
260263
->setAllowedValues('endpoint', $this->getEndPoints())
261264
->setAllowedValues('hash_mode', $this->getHashModes())
262265
->setAllowedTypes('debug', 'bool')
@@ -469,7 +472,7 @@ private function getModes(): array
469472

470473
private function getEndPoints(): array
471474
{
472-
return [null, self::ENDPOINT_SYSTEMPAY, self::ENDPOINT_SCELLIUS, self::ENDPOINT_CLICANDPAY, self::ENDPOINT_OSB];
475+
return [null, self::ENDPOINT_SYSTEMPAY, self::ENDPOINT_SOGECOMMERCE, self::ENDPOINT_SCELLIUS, self::ENDPOINT_CLICANDPAY, self::ENDPOINT_OSB];
473476
}
474477

475478
private function getHashModes(): array
@@ -479,6 +482,10 @@ private function getHashModes(): array
479482

480483
private function getUrl(): string
481484
{
485+
486+
if ($this->config['endpoint_url'] !== null) {
487+
return $this->config['endpoint_url'];
488+
}
482489
if (self::ENDPOINT_SYSTEMPAY === $this->config['endpoint']) {
483490
return 'https://paiement.systempay.fr/vads-payment/';
484491
}
@@ -494,6 +501,9 @@ private function getUrl(): string
494501
if (self::ENDPOINT_OSB === $this->config['endpoint']) {
495502
return 'https://secure.osb.pf/vads-payment/';
496503
}
504+
if (self::ENDPOINT_SOGECOMMERCE === $this->config['endpoint']) {
505+
return 'https://sogecommerce.societegenerale.eu/vads-payment/';
506+
}
497507

498508
return 'https://secure.payzen.eu/vads-payment/';
499509
}

Diff for: src/PayzenGatewayFactory.php

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ protected function populateConfig(ArrayObject $config)
5353
'ctx_mode' => null,
5454
'directory' => null,
5555
'endpoint' => null,
56+
'endpoint_url' => null,
5657
'hash_mode' => Api\Api::HASH_MODE_SHA256,
5758
'debug' => false,
5859
];
@@ -66,6 +67,7 @@ protected function populateConfig(ArrayObject $config)
6667

6768
$payzenConfig = [
6869
'endpoint' => $config['endpoint'],
70+
'endpoint_url'=> $config['endpoint_url'],
6971
'site_id' => $config['site_id'],
7072
'certificate' => $config['certificate'],
7173
'ctx_mode' => $config['ctx_mode'],

0 commit comments

Comments
 (0)