Skip to content

Commit

Permalink
Fix payment gateway validation.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsegura committed Feb 5, 2025
1 parent d1ceac8 commit 6cb7a84
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/Validator/Constraints/IsActivableRestaurantValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,10 @@ public function validate($object, Constraint $constraint)

if (!$this->cashEnabled) {

foreach (['mercadopago', 'paygreen', 'stripe'] as $gateway) {

$supportsAtLeastOneGateway = false;
$violations = [];
$supportsAtLeastOneGateway = false;
$violations = [];

foreach (['mercadopago', 'paygreen', 'stripe'] as $gateway) {
if ($this->gatewayResolver->supports($gateway)) {
switch ($gateway) {
case 'mercadopago':
Expand Down Expand Up @@ -117,13 +116,13 @@ public function validate($object, Constraint $constraint)
break;
}
}
}

if (!$supportsAtLeastOneGateway) {
foreach ($violations as $path => $message) {
$this->context->buildViolation($message)
->atPath($path)
->addViolation();
}
if (!$supportsAtLeastOneGateway) {
foreach ($violations as $path => $message) {
$this->context->buildViolation($message)
->atPath($path)
->addViolation();
}
}
}
Expand Down

0 comments on commit 6cb7a84

Please sign in to comment.