|
1
|
|
|
<?php |
|
2
|
|
|
declare(strict_types=1); |
|
3
|
|
|
|
|
4
|
|
|
namespace PTS\SyliusPayseraPlugin\Form; |
|
5
|
|
|
|
|
6
|
|
|
use Symfony\Component\Form\AbstractType; |
|
7
|
|
|
use Symfony\Component\Form\Extension\Core\Type\CheckboxType; |
|
8
|
|
|
use Symfony\Component\Form\Extension\Core\Type\HiddenType; |
|
9
|
|
|
use Symfony\Component\Form\Extension\Core\Type\PasswordType; |
|
10
|
|
|
use Symfony\Component\Form\Extension\Core\Type\TextType; |
|
11
|
|
|
use Symfony\Component\Form\FormBuilderInterface; |
|
12
|
|
|
use Symfony\Component\Form\FormEvent; |
|
13
|
|
|
use Symfony\Component\Form\FormEvents; |
|
14
|
|
|
use Symfony\Component\Validator\Constraints\NotBlank; |
|
15
|
|
|
|
|
16
|
|
|
final class PayseraGatewayConfigurationType extends AbstractType |
|
17
|
|
|
{ |
|
18
|
|
|
/** |
|
19
|
|
|
* {@inheritdoc} |
|
20
|
|
|
*/ |
|
21
|
|
|
public function buildForm(FormBuilderInterface $builder, array $options): void |
|
22
|
|
|
{ |
|
23
|
|
|
$builder |
|
24
|
|
|
->add('projectid', TextType::class, [ |
|
25
|
|
|
'label' => 'sylius.form.gateway_configuration.paysera.project_id', |
|
26
|
|
|
'constraints' => [ |
|
27
|
|
|
new NotBlank([ |
|
28
|
|
|
'message' => 'sylius.gateway_config.paysera.username.not_blank', |
|
29
|
|
|
'groups' => 'sylius', |
|
30
|
|
|
]), |
|
31
|
|
|
], |
|
32
|
|
|
]) |
|
33
|
|
|
->add('sign_password', TextType::class, [ |
|
34
|
|
|
'label' => 'sylius.form.gateway_configuration.paysera.sign_password', |
|
35
|
|
|
'constraints' => [ |
|
36
|
|
|
new NotBlank([ |
|
37
|
|
|
'message' => 'sylius.gateway_config.paysera.password.not_blank', |
|
38
|
|
|
'groups' => 'sylius', |
|
39
|
|
|
]), |
|
40
|
|
|
], |
|
41
|
|
|
]) |
|
42
|
|
|
->add('test', CheckboxType::class, [ |
|
43
|
|
|
'label' => 'sylius.form.gateway_configuration.paysera.test', |
|
44
|
|
|
]) |
|
45
|
|
|
->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) { |
|
46
|
|
|
$data = $event->getData(); |
|
47
|
|
|
$data['payum.http_client'] = '@sylius.payum.http_client'; |
|
48
|
|
|
}); |
|
49
|
|
|
} |
|
50
|
|
|
} |