-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract Tpay Apple Pay as a separate payment method
- Loading branch information
1 parent
fba6100
commit 253d10d
Showing
14 changed files
with
170 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
use CommerceWeavers\SyliusTpayPlugin\ApplePayPayment\Controller\InitApplePayPaymentAction; | ||
|
||
return function(ContainerConfigurator $container): void { | ||
$services = $container->services(); | ||
|
||
$services->set(InitApplePayPaymentAction::class) | ||
->args([ | ||
service('payum'), | ||
service('sylius.context.cart.composite'), | ||
]) | ||
->tag('controller.service_arguments') | ||
; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
return function(ContainerConfigurator $container): void { | ||
$container->import('form/**/*.php'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
|
||
use CommerceWeavers\SyliusTpayPlugin\ApplePayPayment\Form\Type\GatewayConfigurationType; | ||
use CommerceWeavers\SyliusTpayPlugin\ApplePayPayment\Payum\Factory\GatewayFactory; | ||
|
||
return function(ContainerConfigurator $container): void { | ||
$services = $container->services(); | ||
|
||
$services->set('commerce_weavers_sylius_tpay.apple_pay_payment.form.type.gateway_configuration', GatewayConfigurationType::class) | ||
->parent('commerce_weavers_sylius_tpay.form.type.abstract_tpay_gateway_configuration') | ||
->tag('sylius.gateway_configuration_type', ['label' => 'commerce_weavers_sylius_tpay.admin.gateway_name.tpay_apple_pay', 'type' => GatewayFactory::NAME]) | ||
->tag('form.type') | ||
; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
return function(ContainerConfigurator $container): void { | ||
$container->import('payum/**/*.php'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
use CommerceWeavers\SyliusTpayPlugin\ApplePayPayment\Payum\Factory\GatewayFactory as ApplePayGatewayFactory; | ||
use CommerceWeavers\SyliusTpayPlugin\Payum\Action\Api\CreateApplePayTransactionAction; | ||
use CommerceWeavers\SyliusTpayPlugin\Payum\Action\Api\InitializeApplePayPaymentAction; | ||
|
||
return function(ContainerConfigurator $container): void { | ||
$services = $container->services(); | ||
|
||
$services->defaults() | ||
->public() | ||
; | ||
|
||
$services->set(CreateApplePayTransactionAction::class) | ||
->args([ | ||
service('commerce_weavers_sylius_tpay.tpay.factory.create_apple_pay_payment_payload'), | ||
service('commerce_weavers_sylius_tpay.payum.factory.token.notify'), | ||
]) | ||
->tag('payum.action', ['factory' => ApplePayGatewayFactory::NAME, 'alias' => 'cw.tpay_apple_pay.create_apple_pay_transaction']) | ||
; | ||
|
||
$services->set(InitializeApplePayPaymentAction::class) | ||
->args([ | ||
service('commerce_weavers_sylius_tpay.tpay.factory.create_initialize_apple_pay_payment_payload'), | ||
]) | ||
->tag('payum.action', ['factory' => ApplePayGatewayFactory::NAME, 'alias' => 'cw.tpay_apple_pay.initialize_apple_pay_payment']) | ||
; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
use CommerceWeavers\SyliusTpayPlugin\ApplePayPayment\Payum\Factory\GatewayFactory; | ||
use Payum\Core\Bridge\Symfony\Builder\GatewayFactoryBuilder; | ||
|
||
return function(ContainerConfigurator $container): void { | ||
$services = $container->services(); | ||
|
||
$services->set('commerce_weavers_sylius_tpay.apple_pay_payment.payum.factory.gateway', GatewayFactoryBuilder::class) | ||
->args([ | ||
GatewayFactory::class, | ||
]) | ||
->tag('payum.gateway_factory_builder', ['factory' => GatewayFactory::NAME]) | ||
; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/ApplePayPayment/Form/Type/GatewayConfigurationType.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CommerceWeavers\SyliusTpayPlugin\ApplePayPayment\Form\Type; | ||
|
||
use CommerceWeavers\SyliusTpayPlugin\Form\Type\AbstractTpayGatewayConfigurationType; | ||
use Symfony\Component\Form\Extension\Core\Type\TextType; | ||
use Symfony\Component\Form\FormBuilderInterface; | ||
|
||
final class GatewayConfigurationType extends AbstractTpayGatewayConfigurationType | ||
{ | ||
public function buildForm(FormBuilderInterface $builder, array $options): void | ||
{ | ||
parent::buildForm($builder, $options); | ||
|
||
$builder | ||
->add( | ||
'apple_pay_merchant_id', | ||
TextType::class, | ||
[ | ||
'empty_data' => '', | ||
'label' => 'commerce_weavers_sylius_tpay.admin.gateway_configuration.apple_pay_merchant_id', | ||
'required' => true, | ||
], | ||
) | ||
; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CommerceWeavers\SyliusTpayPlugin\ApplePayPayment\Payum\Factory; | ||
|
||
use CommerceWeavers\SyliusTpayPlugin\Payum\Factory\TpayGatewayFactory; | ||
|
||
final class GatewayFactory extends TpayGatewayFactory | ||
{ | ||
public const NAME = 'tpay_apple_pay'; | ||
|
||
public function getName(): string | ||
{ | ||
return self::NAME; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters