-
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
Conversation
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.
Pull request overview
This pull request adds support for Senegal as a new country in the payment gateway system, while also refactoring the namespace structure from Bow\Payment\IvoryCost to Bow\Payment\Gateway\IvoryCost to better accommodate multi-country support. The PR introduces placeholder gateway implementations for Senegal's Orange Money and Wave payment providers that extend the existing Ivory Coast implementations.
Key changes:
- Refactored namespace structure to include a
Gatewaylevel, organizing payment providers by country - Added Senegal country constant and provider mappings (Orange Money and Wave)
- Created Senegal-specific gateway classes that extend Ivory Coast implementations
- Updated configuration to include Senegal payment provider settings
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Payment.php | Added Senegal country constant (SN), provider mapping (SN_PROVIDER), and gateway resolution logic; refactored namespace references for Ivory Coast providers |
| src/Gateway/Senegal/OrangeMoney/OrangeMoneyGateway.php | New Senegal Orange Money gateway extending the Ivory Coast implementation |
| src/Gateway/Senegal/Wave/WaveGateway.php | New Senegal Wave gateway extending the Ivory Coast implementation |
| src/Gateway/IvoryCost/*/*.php | Updated namespace from Bow\Payment\IvoryCost to Bow\Payment\Gateway\IvoryCost (17 files) |
| tests/PaymentTest.php | Updated namespace references to match refactored gateway structure |
| tests/OrangeMoneyTest.php | Updated namespace references to match refactored gateway structure |
| docs/en.md | Updated code examples with refactored namespace references |
| docs/fr.md | Updated code examples with refactored namespace references |
| config/payment.php | Added Senegal payment provider configuration section with Orange Money and Wave settings |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /** | ||
| * Senegal country identifier | ||
| * ISO 3166-1 alpha-2 country code for Senegal | ||
| */ | ||
| public const SN = 'senegal'; |
Copilot
AI
Dec 18, 2025
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 states "ISO 3166-1 alpha-2 country code for Senegal", but the constant value is 'senegal' (a descriptive string), not 'SN' (the actual ISO code). While the constant name SN represents the ISO code, the comment could be misleading. Consider clarifying the comment to: "Senegal country identifier (constant name follows ISO 3166-1 alpha-2: SN)" to match the pattern used elsewhere in the codebase.
| $provider = self::SN_PROVIDER[$provider] ?? null; | ||
| if ($provider === null) { | ||
| throw new \InvalidArgumentException("The payment gateway [{$provider}] is not supported in country [{$country}]."); |
Copilot
AI
Dec 18, 2025
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 error message on line 128 will not display the original provider name correctly. The variable $provider is reassigned on line 126 to either a gateway class or null. When null, the error message will show an empty string instead of the original provider identifier (e.g., 'orange', 'wave') that the user attempted to use. Store the original provider value before the reassignment to ensure the error message is informative.
| 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}]."); | ||
| } | ||
| $config = $this->resolveConfig('senegal', $provider); | ||
| static::$providerGateway = new $provider($config); | ||
| break; |
Copilot
AI
Dec 18, 2025
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 new Senegal payment support lacks test coverage. The repository has comprehensive tests for Ivory Coast payment providers (see tests/PaymentTest.php and tests/OrangeMoneyTest.php). Consider adding similar tests for Senegal, including tests for Payment::SN constant, Payment::SN_PROVIDER mapping, and the gateway resolution logic for Senegal.
| ], | ||
|
|
||
| 'wave' => [ | ||
| 'api_key' => '', // Your Wave API key (starts with wave_sn_prod_ or wave_sn_sandbox_) |
Copilot
AI
Dec 18, 2025
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.
No description provided.