1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* MIT License |
5
|
|
|
* For full license information, please view the LICENSE file that was distributed with this source code. |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace SprykerEco\Yves\CrefoPay\Form; |
9
|
|
|
|
10
|
|
|
use Generated\Shared\Transfer\CrefoPayPaymentTransfer; |
|
|
|
|
11
|
|
|
use Spryker\Yves\StepEngine\Dependency\Form\AbstractSubFormType; |
|
|
|
|
12
|
|
|
use Spryker\Yves\StepEngine\Dependency\Form\SubFormInterface; |
|
|
|
|
13
|
|
|
use Spryker\Yves\StepEngine\Dependency\Form\SubFormProviderNameInterface; |
|
|
|
|
14
|
|
|
use SprykerEco\Shared\CrefoPay\CrefoPayConfig; |
15
|
|
|
use Symfony\Component\Form\Extension\Core\Type\HiddenType; |
|
|
|
|
16
|
|
|
use Symfony\Component\Form\Extension\Core\Type\RadioType; |
|
|
|
|
17
|
|
|
use Symfony\Component\Form\FormBuilderInterface; |
|
|
|
|
18
|
|
|
use Symfony\Component\OptionsResolver\OptionsResolver; |
|
|
|
|
19
|
|
|
|
20
|
|
|
class BillSubForm extends AbstractSubFormType implements SubFormInterface, SubFormProviderNameInterface |
21
|
|
|
{ |
22
|
|
|
protected const PAYMENT_METHOD = 'bill'; |
23
|
|
|
protected const FORM_FIELD_PAYMENT_METHOD = 'paymentMethod'; |
24
|
|
|
protected const FORM_FIELD_PAYMENT_METHOD_DATA = 'BILL'; |
25
|
|
|
protected const FORM_FIELD_PAYMENT_METHOD_CLASSES = 'crefopay-payment-method is_hidden'; |
26
|
|
|
protected const FORM_FIELD_ATTRIBUTE_DATA_CREFO_PAY_NAME = 'data-crefopay'; |
27
|
|
|
protected const FORM_FIELD_ATTRIBUTE_DATA_CREFO_PAY_VALUE = 'paymentMethod'; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @return string |
31
|
|
|
*/ |
32
|
|
|
public function getProviderName(): string |
33
|
|
|
{ |
34
|
|
|
return CrefoPayConfig::PROVIDER_NAME; |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @return string |
39
|
|
|
*/ |
40
|
|
|
public function getName(): string |
41
|
|
|
{ |
42
|
|
|
return CrefoPayConfig::CREFO_PAY_PAYMENT_METHOD_BILL; |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @return string |
47
|
|
|
*/ |
48
|
|
|
public function getPropertyPath(): string |
49
|
|
|
{ |
50
|
|
|
return CrefoPayConfig::CREFO_PAY_PAYMENT_METHOD_BILL; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @return string |
55
|
|
|
*/ |
56
|
|
|
public function getTemplatePath(): string |
57
|
|
|
{ |
58
|
|
|
return CrefoPayConfig::PROVIDER_NAME . DIRECTORY_SEPARATOR . static::PAYMENT_METHOD; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver |
63
|
|
|
* |
64
|
|
|
* @return void |
65
|
|
|
*/ |
66
|
|
|
public function configureOptions(OptionsResolver $resolver): void |
67
|
|
|
{ |
68
|
|
|
$resolver->setDefaults([ |
69
|
|
|
'data_class' => CrefoPayPaymentTransfer::class, |
70
|
|
|
])->setRequired(static::OPTIONS_FIELD_NAME); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @param \Symfony\Component\Form\FormBuilderInterface $builder |
75
|
|
|
* @param array $options |
76
|
|
|
* |
77
|
|
|
* @return void |
78
|
|
|
*/ |
79
|
|
|
public function buildForm(FormBuilderInterface $builder, array $options): void |
80
|
|
|
{ |
81
|
|
|
$this->addPaymentMethod($builder); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @param \Symfony\Component\Form\FormBuilderInterface $builder |
86
|
|
|
* |
87
|
|
|
* @return $this |
88
|
|
|
*/ |
89
|
|
|
protected function addPaymentMethod(FormBuilderInterface $builder) |
90
|
|
|
{ |
91
|
|
|
$builder->add( |
92
|
|
|
static::FORM_FIELD_PAYMENT_METHOD, |
93
|
|
|
RadioType::class, |
94
|
|
|
[ |
95
|
|
|
'label' => false, |
96
|
|
|
'value' => static::FORM_FIELD_PAYMENT_METHOD_DATA, |
97
|
|
|
'attr' => [ |
98
|
|
|
'class' => static::FORM_FIELD_PAYMENT_METHOD_CLASSES, |
99
|
|
|
static::FORM_FIELD_ATTRIBUTE_DATA_CREFO_PAY_NAME => static::FORM_FIELD_ATTRIBUTE_DATA_CREFO_PAY_VALUE, |
100
|
|
|
], |
101
|
|
|
] |
102
|
|
|
); |
103
|
|
|
|
104
|
|
|
return $this; |
105
|
|
|
} |
106
|
|
|
} |
107
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths