| @@ 18-98 (lines=81) @@ | ||
| 15 | use Symfony\Component\Form\FormBuilderInterface; |
|
| 16 | use Symfony\Component\OptionsResolver\OptionsResolver; |
|
| 17 | ||
| 18 | class InvoiceSubForm extends AbstractPayoneSubForm |
|
| 19 | { |
|
| 20 | const PAYMENT_METHOD = 'invoice'; |
|
| 21 | ||
| 22 | /** |
|
| 23 | * @return string |
|
| 24 | */ |
|
| 25 | public function getName() |
|
| 26 | { |
|
| 27 | return PaymentTransfer::PAYONE_INVOICE; |
|
| 28 | } |
|
| 29 | ||
| 30 | /** |
|
| 31 | * @return string |
|
| 32 | */ |
|
| 33 | public function getPropertyPath() |
|
| 34 | { |
|
| 35 | return PaymentTransfer::PAYONE_INVOICE; |
|
| 36 | } |
|
| 37 | ||
| 38 | /** |
|
| 39 | * @return string |
|
| 40 | */ |
|
| 41 | public function getTemplatePath() |
|
| 42 | { |
|
| 43 | return PayoneConstants::PROVIDER_NAME . '/' . self::PAYMENT_METHOD; |
|
| 44 | } |
|
| 45 | ||
| 46 | /** |
|
| 47 | * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver |
|
| 48 | * |
|
| 49 | * @return void |
|
| 50 | */ |
|
| 51 | public function configureOptions(OptionsResolver $resolver) |
|
| 52 | { |
|
| 53 | $resolver->setDefaults([ |
|
| 54 | 'data_class' => PayonePaymentTransfer::class, |
|
| 55 | ])->setRequired(SubFormInterface::OPTIONS_FIELD_NAME); |
|
| 56 | } |
|
| 57 | ||
| 58 | /** |
|
| 59 | * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver |
|
| 60 | * |
|
| 61 | * @return void |
|
| 62 | */ |
|
| 63 | public function setDefaultOptions(OptionsResolver $resolver) |
|
| 64 | { |
|
| 65 | $this->configureOptions($resolver); |
|
| 66 | } |
|
| 67 | ||
| 68 | /** |
|
| 69 | * @param \Symfony\Component\Form\FormBuilderInterface $builder |
|
| 70 | * @param array $options |
|
| 71 | * |
|
| 72 | * @return void |
|
| 73 | */ |
|
| 74 | public function buildForm(FormBuilderInterface $builder, array $options) |
|
| 75 | { |
|
| 76 | $this->addLabel($builder); |
|
| 77 | } |
|
| 78 | ||
| 79 | /** |
|
| 80 | * @param \Symfony\Component\Form\FormBuilderInterface $builder |
|
| 81 | * |
|
| 82 | * @return $this |
|
| 83 | */ |
|
| 84 | protected function addLabel(FormBuilderInterface $builder) |
|
| 85 | { |
|
| 86 | $builder->add( |
|
| 87 | self::FIELD_PAYMENT_METHOD, |
|
| 88 | HiddenType::class, |
|
| 89 | [ |
|
| 90 | 'label' => false, |
|
| 91 | 'required' => false, |
|
| 92 | 'data' => [], |
|
| 93 | ] |
|
| 94 | ); |
|
| 95 | ||
| 96 | return $this; |
|
| 97 | } |
|
| 98 | } |
|
| 99 | ||
| @@ 18-98 (lines=81) @@ | ||
| 15 | use Symfony\Component\Form\FormBuilderInterface; |
|
| 16 | use Symfony\Component\OptionsResolver\OptionsResolver; |
|
| 17 | ||
| 18 | class PrePaymentForm extends AbstractPayoneSubForm |
|
| 19 | { |
|
| 20 | const PAYMENT_METHOD = 'prepayment'; |
|
| 21 | ||
| 22 | /** |
|
| 23 | * @return string |
|
| 24 | */ |
|
| 25 | public function getName() |
|
| 26 | { |
|
| 27 | return PaymentTransfer::PAYONE_PRE_PAYMENT; |
|
| 28 | } |
|
| 29 | ||
| 30 | /** |
|
| 31 | * @return string |
|
| 32 | */ |
|
| 33 | public function getPropertyPath() |
|
| 34 | { |
|
| 35 | return PaymentTransfer::PAYONE_PRE_PAYMENT; |
|
| 36 | } |
|
| 37 | ||
| 38 | /** |
|
| 39 | * @return string |
|
| 40 | */ |
|
| 41 | public function getTemplatePath() |
|
| 42 | { |
|
| 43 | return PayoneConstants::PROVIDER_NAME . '/' . self::PAYMENT_METHOD; |
|
| 44 | } |
|
| 45 | ||
| 46 | /** |
|
| 47 | * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver |
|
| 48 | * |
|
| 49 | * @return void |
|
| 50 | */ |
|
| 51 | public function configureOptions(OptionsResolver $resolver) |
|
| 52 | { |
|
| 53 | $resolver->setDefaults([ |
|
| 54 | 'data_class' => PayonePaymentTransfer::class, |
|
| 55 | ])->setRequired(SubFormInterface::OPTIONS_FIELD_NAME); |
|
| 56 | } |
|
| 57 | ||
| 58 | /** |
|
| 59 | * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver |
|
| 60 | * |
|
| 61 | * @return void |
|
| 62 | */ |
|
| 63 | public function setDefaultOptions(OptionsResolver $resolver) |
|
| 64 | { |
|
| 65 | $this->configureOptions($resolver); |
|
| 66 | } |
|
| 67 | ||
| 68 | /** |
|
| 69 | * @param \Symfony\Component\Form\FormBuilderInterface $builder |
|
| 70 | * @param array $options |
|
| 71 | * |
|
| 72 | * @return void |
|
| 73 | */ |
|
| 74 | public function buildForm(FormBuilderInterface $builder, array $options) |
|
| 75 | { |
|
| 76 | $this->addLabel($builder); |
|
| 77 | } |
|
| 78 | ||
| 79 | /** |
|
| 80 | * @param \Symfony\Component\Form\FormBuilderInterface $builder |
|
| 81 | * |
|
| 82 | * @return $this |
|
| 83 | */ |
|
| 84 | protected function addLabel(FormBuilderInterface $builder) |
|
| 85 | { |
|
| 86 | $builder->add( |
|
| 87 | self::FIELD_PAYMENT_METHOD, |
|
| 88 | HiddenType::class, |
|
| 89 | [ |
|
| 90 | 'label' => false, |
|
| 91 | 'required' => false, |
|
| 92 | 'data' => [], |
|
| 93 | ] |
|
| 94 | ); |
|
| 95 | ||
| 96 | return $this; |
|
| 97 | } |
|
| 98 | } |
|
| 99 | ||