1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file was created by developers working at BitBag |
5
|
|
|
* Do you need more information about us and what we do? Visit our https://bitbag.io website! |
6
|
|
|
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
declare(strict_types=1); |
10
|
|
|
|
11
|
|
|
namespace BitBag\SyliusCoinbasePlugin\Form\Type; |
12
|
|
|
|
13
|
|
|
use Symfony\Component\Form\AbstractType; |
14
|
|
|
use Symfony\Component\Form\Extension\Core\Type\HiddenType; |
15
|
|
|
use Symfony\Component\Form\Extension\Core\Type\TextType; |
16
|
|
|
use Symfony\Component\Form\FormBuilderInterface; |
17
|
|
|
use Symfony\Component\Form\FormEvent; |
18
|
|
|
use Symfony\Component\Form\FormEvents; |
19
|
|
|
use Symfony\Component\Validator\Constraints\NotBlank; |
20
|
|
|
|
21
|
|
|
final class CoinbaseGatewayConfigurationType extends AbstractType |
22
|
|
|
{ |
23
|
|
|
public function buildForm(FormBuilderInterface $builder, array $options): void |
24
|
|
|
{ |
25
|
|
|
$builder |
26
|
|
|
->add('apiKey', TextType::class, [ |
27
|
|
|
'label' => 'bitbag_sylius_coinbase_plugin.ui.api_key', |
28
|
|
|
'constraints' => [ |
29
|
|
|
new NotBlank([ |
30
|
|
|
'message' => 'bitbag_sylius_coinbase_plugin.api_key.not_blank', |
31
|
|
|
'groups' => 'sylius', |
32
|
|
|
]), |
33
|
|
|
], |
34
|
|
|
]) |
35
|
|
|
->add('webhookSecretKey', TextType::class, [ |
36
|
|
|
'label' => 'bitbag_sylius_coinbase_plugin.ui.webhook_secret_key', |
37
|
|
|
'constraints' => [ |
38
|
|
|
new NotBlank([ |
39
|
|
|
'message' => 'bitbag_sylius_coinbase_plugin.webhook_secret_key.not_blank', |
40
|
|
|
'groups' => 'sylius', |
41
|
|
|
]), |
42
|
|
|
], |
43
|
|
|
]) |
44
|
|
|
->add('factoryName', HiddenType::class, [ |
45
|
|
|
'empty_data' => 'coinbase', |
46
|
|
|
]) |
47
|
|
|
->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) { |
48
|
|
|
$data = $event->getData(); |
49
|
|
|
|
50
|
|
|
$data['payum.http_client'] = '@bitbag_sylius_coinbase_plugin.api_client.coinbase'; |
51
|
|
|
|
52
|
|
|
$event->setData($data); |
53
|
|
|
}) |
54
|
|
|
; |
55
|
|
|
} |
56
|
|
|
} |
57
|
|
|
|