Skip to content

Commit 27e57c1

Browse files
authored
[Admin][PaymentMethod] Add validation to sandbox paypal fields (#409)
| Q | A | --------------- | ----- | Branch? | 1.7 | Bug fix? | kinda | New feature? | no | Related tickets | -
2 parents feaafce + 2c49392 commit 27e57c1

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/Form/Type/PayPalConfigurationType.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use Symfony\Component\Form\FormBuilderInterface;
2020
use Symfony\Component\Form\FormEvent;
2121
use Symfony\Component\Form\FormEvents;
22+
use Symfony\Component\Validator\Constraints\NotBlank;
2223

2324
final class PayPalConfigurationType extends AbstractType
2425
{
@@ -48,9 +49,18 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
4849
$form
4950
->add('sylius_merchant_id', HiddenType::class, ['data' => self::SANDBOX_SYLIUS_MERCHANT_ID, 'attr' => ['readonly' => true]])
5051
->add('partner_attribution_id', HiddenType::class, ['data' => self::SANDBOX_ATTRIBUTION_ID, 'attr' => ['readonly' => true]])
51-
->add('client_id', TextType::class, ['label' => 'sylius.pay_pal.client_id'])
52-
->add('client_secret', TextType::class, ['label' => 'sylius.pay_pal.client_secret'])
53-
->add('merchant_id', TextType::class, ['label' => 'sylius.pay_pal.merchant_id'])
52+
->add('client_id', TextType::class, [
53+
'label' => 'sylius.pay_pal.client_id',
54+
'constraints' => [new NotBlank(['groups' => 'sylius'])],
55+
])
56+
->add('client_secret', TextType::class, [
57+
'label' => 'sylius.pay_pal.client_secret',
58+
'constraints' => [new NotBlank(['groups' => 'sylius'])],
59+
])
60+
->add('merchant_id', TextType::class, [
61+
'label' => 'sylius.pay_pal.merchant_id',
62+
'constraints' => [new NotBlank(['groups' => 'sylius'])],
63+
])
5464
;
5565
} else {
5666
$form

0 commit comments

Comments
 (0)