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\RadioType; |
|
|
|
|
16
|
|
|
use Symfony\Component\Form\FormBuilderInterface; |
|
|
|
|
17
|
|
|
use Symfony\Component\OptionsResolver\OptionsResolver; |
|
|
|
|
18
|
|
|
|
19
|
|
|
class PrepaidSubForm extends AbstractSubFormType implements SubFormInterface, SubFormProviderNameInterface |
20
|
|
|
{ |
21
|
|
|
protected const PAYMENT_METHOD = 'prepaid'; |
22
|
|
|
protected const FORM_FIELD_PAYMENT_METHOD = 'paymentMethod'; |
23
|
|
|
protected const FORM_FIELD_PAYMENT_METHOD_DATA = 'PREPAID'; |
24
|
|
|
protected const FORM_FIELD_PAYMENT_METHOD_CLASSES = 'crefopay-payment-method is_hidden'; |
25
|
|
|
protected const FORM_FIELD_ATTRIBUTE_DATA_CREFO_PAY_NAME = 'data-crefopay'; |
26
|
|
|
protected const FORM_FIELD_ATTRIBUTE_DATA_CREFO_PAY_VALUE = 'paymentMethod'; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @return string |
30
|
|
|
*/ |
31
|
|
|
public function getProviderName(): string |
32
|
|
|
{ |
33
|
|
|
return CrefoPayConfig::PROVIDER_NAME; |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @return string |
38
|
|
|
*/ |
39
|
|
|
public function getName(): string |
40
|
|
|
{ |
41
|
|
|
return CrefoPayConfig::CREFO_PAY_PAYMENT_METHOD_PREPAID; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @return string |
46
|
|
|
*/ |
47
|
|
|
public function getPropertyPath(): string |
48
|
|
|
{ |
49
|
|
|
return CrefoPayConfig::CREFO_PAY_PAYMENT_METHOD_PREPAID; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @return string |
54
|
|
|
*/ |
55
|
|
|
public function getTemplatePath(): string |
56
|
|
|
{ |
57
|
|
|
return CrefoPayConfig::PROVIDER_NAME . DIRECTORY_SEPARATOR . static::PAYMENT_METHOD; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver |
62
|
|
|
* |
63
|
|
|
* @return void |
64
|
|
|
*/ |
65
|
|
|
public function configureOptions(OptionsResolver $resolver): void |
66
|
|
|
{ |
67
|
|
|
$resolver->setDefaults([ |
68
|
|
|
'data_class' => CrefoPayPaymentTransfer::class, |
69
|
|
|
])->setRequired(static::OPTIONS_FIELD_NAME); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @param \Symfony\Component\Form\FormBuilderInterface $builder |
74
|
|
|
* @param array $options |
75
|
|
|
* |
76
|
|
|
* @return void |
77
|
|
|
*/ |
78
|
|
|
public function buildForm(FormBuilderInterface $builder, array $options): void |
79
|
|
|
{ |
80
|
|
|
$this->addPaymentMethod($builder); |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @param \Symfony\Component\Form\FormBuilderInterface $builder |
85
|
|
|
* |
86
|
|
|
* @return $this |
87
|
|
|
*/ |
88
|
|
|
protected function addPaymentMethod(FormBuilderInterface $builder) |
89
|
|
|
{ |
90
|
|
|
$builder->add( |
91
|
|
|
static::FORM_FIELD_PAYMENT_METHOD, |
92
|
|
|
RadioType::class, |
93
|
|
|
[ |
94
|
|
|
'label' => false, |
95
|
|
|
'value' => static::FORM_FIELD_PAYMENT_METHOD_DATA, |
96
|
|
|
'attr' => [ |
97
|
|
|
'class' => static::FORM_FIELD_PAYMENT_METHOD_CLASSES, |
98
|
|
|
static::FORM_FIELD_ATTRIBUTE_DATA_CREFO_PAY_NAME => static::FORM_FIELD_ATTRIBUTE_DATA_CREFO_PAY_VALUE, |
99
|
|
|
], |
100
|
|
|
] |
101
|
|
|
); |
102
|
|
|
|
103
|
|
|
return $this; |
104
|
|
|
} |
105
|
|
|
} |
106
|
|
|
|
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