Skip to content

Instantly share code, notes, and snippets.

@h3llr4iser
Last active August 3, 2020 07:55
Show Gist options
  • Save h3llr4iser/07fc51e6124b7133d5c98842600fb840 to your computer and use it in GitHub Desktop.
Save h3llr4iser/07fc51e6124b7133d5c98842600fb840 to your computer and use it in GitHub Desktop.
redsys bundle configuration in sylius
sylius_payment:
gateways:
redsys: Redsys
<?php
namespace AppBundle\Form\Type\Payment;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints\NotBlank;
class RedsysGatewayConfigurationType extends AbstractType
{
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('merchant_code', TextType::class, [
'label' => 'Merchant Code',
'constraints' => [
new NotBlank([
'message' => 'sylius.gateway_config.redsys.merchant_code.not_blank',
'groups' => 'sylius',
])
],
])
->add('terminal', TextType::class, [
'label' => 'Terminal',
'constraints' => [
new NotBlank([
'message' => 'sylius.gateway_config.redsys.terminal.not_blank',
'groups' => 'sylius',
])
],
])
->add('secret_key', TextType::class, [
'label' => 'Secret Key',
'constraints' => [
new NotBlank([
'message' => 'sylius.gateway_config.redsys.secret_key.not_blank',
'groups' => 'sylius',
])
],
])
->add('sandbox', CheckboxType::class, [
'label' => 'Sandbox'
])
;
}
}
<service id="app.form_type_payment.redsys_gateway_configuration" class="AppBundle\Form\Type\Payment\RedsysGatewayConfigurationType">
<tag name="sylius.gateway_configuration_type" type="redsys" label="app.payum_gateway_factory.redsys" />
<tag name="form.type" />
</service>
<service id="payment.redsys.gateway_factory" class="Payum\Core\Bridge\Symfony\Builder\GatewayFactoryBuilder">
<tag name="payum.gateway_factory_builder" factory="redsys"/>
<argument>Crevillo\Payum\Redsys\RedsysGatewayFactory</argument>
</service>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment