PRE-3603: Overload scalapay min/max amounts from API - #317
PRE-3603: Overload scalapay min/max amounts from API#317adumont-payplug wants to merge 1 commit into
Conversation
hdelaforce-payplug
left a comment
There was a problem hiding this comment.
Automated review pass — 7 findings, most severe first. #1 is the one I'd block merge on: it's a config the admin form actively allows the merchant to save, and it silently disables Scalapay at checkout with zero diagnostic.
b3e80fc to
c1d700f
Compare
There was a problem hiding this comment.
Claude Code Review
Claude Code Review is paused for this repository. To reconnect it, an admin of this repository's GitHub organization (or the account owner, for personal repositories) who can also manage your Claude organization's Code Review settings needs to re-link GitHub in Code Review settings. This is a one-time step.
Tip: disable this comment in your organization's Code Review settings.
85ed560 to
d8dcc57
Compare
Review1 medium design gap, 1 medium robustness gap, 2 low/nits — no blockers, solid feature overall. Summary of the change
Findings[MEDIUM] The min/max override isn't actually scoped to Scalapay
The problem: the safety net — Suggested fix — make the coupling explicit: private function resolveAmountBounds(
GatewayConfigInterface $gatewayConfig,
string $activeCurrencyCode,
array $authorizedRange,
): array {
if ('EUR' !== $activeCurrencyCode || ScalapayGatewayFactory::FACTORY_NAME !== $gatewayConfig->getFactoryName()) {
return [$authorizedRange['min_amount'], $authorizedRange['max_amount']];
}
...[MEDIUM] Malformed config would crash checkout, not just fail validation Both
Cheap fix — treat assertion failure the same as "not configured": try {
Assert::nullOrInteger($minAmount);
Assert::nullOrInteger($maxAmount);
} catch (InvalidArgumentException) {
return [$authorizedRange['min_amount'], $authorizedRange['max_amount']];
}[LOW] Fail-open on API error skips the "effective range inversion" check silently In [NIT] Unrelated formatting change bundled in
[NIT] Violation message amounts render without decimals
Positive notes
|
d8dcc57 to
760553c
Compare
There was a problem hiding this comment.
Claude Code Review
Claude Code Review is paused for this repository. To reconnect it, an admin of this repository's GitHub organization (or the account owner, for personal repositories) who can also manage your Claude organization's Code Review settings needs to re-link GitHub in Code Review settings. This is a one-time step.
Tip: disable this comment in your organization's Code Review settings.
Description
Scalapay currently shows at checkout for any cart amount within the limits reported by the PayPlug API, with no way for the merchant to tighten that range. This adds merchant-configurable min/max amount limits for Scalapay, mirroring the existing amount-filtering mechanism already used for the other PPRO gateways.
min_amount,max_amount) on the Scalapay gateway admin config, rendered asMoneyType(EUR) inputs. Left blank, they fall back to whatever the PayPlug API reports for the account.SupportedMethodsProvidernow applies the merchant's configured bounds (when set) instead of the raw API bounds when filtering Scalapay at checkout.IsScalapayAmountRangeValid) rejects configs where min > max, or where either value falls outside the live API-reported range — the merchant can only narrow the range, never widen it beyond what PayPlug authorizes.Motivation: Merchants want to control which cart sizes see Scalapay as a payment option (UX and fee control), similar to existing carve-outs for other financing/BNPL methods.
Related issue(s): Closes [PRE-3603](https://payplug-prod.atlassian.net/browse/PRE-3603)
Type of Change
Checklist
Code Quality
Testing
SupportedMethodsProviderTest,PaymentMethodValidatorTest, newScalapayGatewayConfigurationTypeExtensionTest, newIsScalapayAmountRangeValidValidatorTest)Security & Ops