-
Notifications
You must be signed in to change notification settings - Fork 1
Add senegal placeholder #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| <?php | ||
|
|
||
| namespace Bow\Payment\Gateway\Senegal\OrangeMoney; | ||
|
|
||
| use Bow\Payment\Gateway\IvoryCost\OrangeMoney\OrangeMoneyGateway as BaseOrangeMoneyGateway; | ||
|
|
||
| /** | ||
| * Orange Money Gateway for Senegal | ||
| * Orange Money operates across multiple countries | ||
| * This class extends the base Orange Money implementation | ||
| * | ||
| * The API endpoints and authentication methods are the same | ||
| * but may use different credentials and regional configurations | ||
| */ | ||
| class OrangeMoneyGateway extends BaseOrangeMoneyGateway | ||
| { | ||
| // Inherits all functionality from the base Orange Money gateway | ||
| // Orange Money API is the same for Senegal and Ivory Coast | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <?php | ||
|
|
||
| namespace Bow\Payment\Gateway\Senegal\Wave; | ||
|
|
||
| use Bow\Payment\Gateway\IvoryCost\Wave\WaveGateway as BaseWaveGateway; | ||
|
|
||
| /** | ||
| * Wave Gateway for Senegal | ||
| * Wave operates across multiple countries with the same API | ||
| * This class extends the base Wave implementation | ||
| * | ||
| * @link https://docs.wave.com/checkout | ||
| */ | ||
| class WaveGateway extends BaseWaveGateway | ||
| { | ||
| // Inherits all functionality from the base Wave gateway | ||
| // Wave API is the same for Senegal and Ivory Coast | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,6 +42,12 @@ class Payment implements ProcessorGatewayInterface | |
| */ | ||
| public const CI = 'ivory_coast'; | ||
|
|
||
| /** | ||
| * Senegal country identifier | ||
| * ISO 3166-1 alpha-2 country code for Senegal | ||
| */ | ||
| public const SN = 'senegal'; | ||
|
Comment on lines
+45
to
+49
|
||
|
|
||
| /** | ||
| * Ivory Coast payment provider mapping | ||
| * Maps payment provider identifiers to their respective service classes | ||
|
|
@@ -50,11 +56,23 @@ class Payment implements ProcessorGatewayInterface | |
| * @var array<string, class-string> | ||
| */ | ||
| public const CI_PROVIDER = [ | ||
| Payment::ORANGE => \Bow\Payment\IvoryCost\OrangeMoney\OrangeMoneyGateway::class, | ||
| Payment::MTN => \Bow\Payment\IvoryCost\MTNMobileMoney\MTNMobileMoneyGateway::class, | ||
| Payment::MOOV => \Bow\Payment\IvoryCost\MoovFlooz\MoovFloozGateway::class, | ||
| Payment::WAVE => \Bow\Payment\IvoryCost\Wave\WaveGateway::class, | ||
| Payment::DJAMO => \Bow\Payment\IvoryCost\Djamo\DjamoGateway::class, | ||
| Payment::ORANGE => \Bow\Payment\Gateway\IvoryCost\OrangeMoney\OrangeMoneyGateway::class, | ||
| Payment::MTN => \Bow\Payment\Gateway\IvoryCost\MTNMobileMoney\MTNMobileMoneyGateway::class, | ||
| Payment::MOOV => \Bow\Payment\Gateway\IvoryCost\MoovFlooz\MoovFloozGateway::class, | ||
| Payment::WAVE => \Bow\Payment\Gateway\IvoryCost\Wave\WaveGateway::class, | ||
| Payment::DJAMO => \Bow\Payment\Gateway\IvoryCost\Djamo\DjamoGateway::class, | ||
| ]; | ||
|
|
||
| /** | ||
| * Senegal payment provider mapping | ||
| * Maps payment provider identifiers to their respective service classes | ||
| * for payment processing in Senegal (SN) | ||
| * | ||
| * @var array<string, class-string> | ||
| */ | ||
| public const SN_PROVIDER = [ | ||
| Payment::ORANGE => \Bow\Payment\Gateway\Senegal\OrangeMoney\OrangeMoneyGateway::class, | ||
| Payment::WAVE => \Bow\Payment\Gateway\Senegal\Wave\WaveGateway::class, | ||
| ]; | ||
|
|
||
| /** | ||
|
|
@@ -104,6 +122,14 @@ private function resolveGateway(string $country, string $provider) | |
| $config = $this->resolveConfig('ivory_coast', $provider); | ||
| static::$providerGateway = new $provider($config); | ||
| break; | ||
| case self::SN: | ||
| $provider = self::SN_PROVIDER[$provider] ?? null; | ||
| if ($provider === null) { | ||
| throw new \InvalidArgumentException("The payment gateway [{$provider}] is not supported in country [{$country}]."); | ||
|
Comment on lines
+126
to
+128
|
||
| } | ||
| $config = $this->resolveConfig('senegal', $provider); | ||
| static::$providerGateway = new $provider($config); | ||
| break; | ||
|
Comment on lines
+125
to
+132
|
||
| // Other gateways can be added here | ||
| default: | ||
| throw new \InvalidArgumentException("The payment gateway [{$provider}] is not supported."); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment on line 66 mentions Wave API keys starting with 'wave_sn_prod_' or 'wave_sn_sandbox_', where 'sn' stands for Senegal. However, this same comment also appears in the Ivory Coast configuration (line 44, not changed in this PR). If Wave uses the same API across countries, consider clarifying the comment to indicate this. If Ivory Coast should use different key prefixes (e.g., wave_ci_), the comment should be updated accordingly.