Skip to content

Conversation

@papac
Copy link
Member

@papac papac commented Dec 18, 2025

No description provided.

@papac papac requested a review from Copilot December 18, 2025 01:08
@papac papac merged commit 2c55947 into master Dec 18, 2025
6 checks passed
@papac papac deleted the code-formatting branch December 18, 2025 01:12
Copy link

Copilot AI left a 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 Gateway level, 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.

Comment on lines +45 to +49
/**
* Senegal country identifier
* ISO 3166-1 alpha-2 country code for Senegal
*/
public const SN = 'senegal';
Copy link

Copilot AI Dec 18, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines +126 to +128
$provider = self::SN_PROVIDER[$provider] ?? null;
if ($provider === null) {
throw new \InvalidArgumentException("The payment gateway [{$provider}] is not supported in country [{$country}].");
Copy link

Copilot AI Dec 18, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines +125 to +132
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;
Copy link

Copilot AI Dec 18, 2025

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.

Copilot uses AI. Check for mistakes.
],

'wave' => [
'api_key' => '', // Your Wave API key (starts with wave_sn_prod_ or wave_sn_sandbox_)
Copy link

Copilot AI Dec 18, 2025

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants