diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml deleted file mode 100644 index e69de29b..00000000 diff --git a/spec/Action/CaptureActionSpec.php b/spec/Action/CaptureActionSpec.php deleted file mode 100644 index c2679fc3..00000000 --- a/spec/Action/CaptureActionSpec.php +++ /dev/null @@ -1,124 +0,0 @@ -beConstructedWith($logger, $translator, $abortPaymentProcessor, $requestStack, $payplugCardRepository); - } - - public function it_is_initializable(): void - { - $this->shouldHaveType(CaptureAction::class); - } - - public function it_implements_action_interface(): void - { - $this->shouldHaveType(ActionInterface::class); - } - - public function it_implements_api_aware_interface(): void - { - $this->shouldHaveType(ApiAwareInterface::class); - } - - public function it_implements_gateway_aware_interface(): void - { - $this->shouldHaveType(GatewayAwareInterface::class); - } - - public function it_executes( - Capture $request, - ArrayObject $arrayObject, - TokenInterface $token, - GatewayInterface $gateway, - PayPlugApiClientInterface $payPlugApiClient, - GenericTokenFactory $genericTokenFactory, - TokenInterface $notifyToken, - PaymentInterface $payment, - RequestStack $requestStack - ): void { - $requestStack->getSession()->willReturn(new Session()); - $payplugPayment = \Mockery::mock('payment', Payment::class); - - $payplugPayment->id = 1; - $payplugPayment->is_live = true; - $payplugPayment->hosted_payment = (object) [ - 'payment_url' => 'test', - ]; - - $this->setGateway($gateway); - $this->setApi($payPlugApiClient); - $this->setGenericTokenFactory($genericTokenFactory); - - $arrayObject->getArrayCopy()->willReturn([]); - $request->getModel()->willReturn($arrayObject); - - $request->getFirstModel()->willReturn($payment); - $payment->getDetails()->willReturn(['status' => PayPlugApiClientInterface::STATUS_CREATED]); - - $request->getToken()->willReturn($token); - $token->getTargetUrl()->willReturn('url'); - $token->getAfterUrl()->willReturn('url'); - $token->getGatewayName()->willReturn('test'); - $token->getDetails()->willReturn([]); - $genericTokenFactory->createNotifyToken('test', [])->willReturn($notifyToken); - $notifyToken->getTargetUrl()->willReturn('url'); - $notifyToken->getHash()->willReturn('test'); - $payPlugApiClient->createPayment([])->willReturn($payplugPayment); - $arrayObject->offsetGet('order_number')->willReturn('000001'); - $arrayObject->offsetGet('initiator')->shouldBeCalled(); - - $arrayObject->offsetExists('payment_id')->shouldBeCalled(); - $arrayObject->offsetExists('status')->shouldBeCalled(); - $arrayObject->offsetSet('hosted_payment', ['return_url' => 'url', 'cancel_url' => 'url?&status=canceled'])->shouldBeCalled(); - $arrayObject->offsetSet('notification_url', 'url')->shouldBeCalled(); - $arrayObject->offsetSet('payment_id', 1)->shouldBeCalled(); - $arrayObject->offsetSet('is_live', true)->shouldBeCalled(); - $arrayObject->offsetSet('status', PayPlugApiClientInterface::STATUS_CREATED)->shouldBeCalled(); - - $this - ->shouldThrow(HttpRedirect::class) - ->during('execute', [$request]) - ; - } - - public function it_supports_only_capture_request_and_array_access( - Capture $request, - \ArrayAccess $arrayAccess - ): void { - $request->getModel()->willReturn($arrayAccess); - $this->supports($request)->shouldReturn(true); - } -} diff --git a/src/Action/CaptureAction.php b/src/Action/CaptureAction.php index 080c21b7..3179190d 100644 --- a/src/Action/CaptureAction.php +++ b/src/Action/CaptureAction.php @@ -12,6 +12,8 @@ use PayPlug\SyliusPayPlugPlugin\ApiClient\PayPlugApiClientInterface; use PayPlug\SyliusPayPlugPlugin\Entity\Card; use PayPlug\SyliusPayPlugPlugin\Exception\UnknownApiErrorException; +use PayPlug\SyliusPayPlugPlugin\Gateway\ApplePayGatewayFactory; +use PayPlug\SyliusPayPlugPlugin\Gateway\OneyGatewayFactory; use PayPlug\SyliusPayPlugPlugin\Gateway\PayPlugGatewayFactory; use PayPlug\SyliusPayPlugPlugin\PaymentProcessing\AbortPaymentProcessor; use Payum\Core\Action\ActionInterface; @@ -79,8 +81,19 @@ public function execute($request): void Assert::isInstanceOf($this->tokenFactory, GenericTokenFactoryInterface::class); RequestNotSupportedException::assertSupports($this, $request); + $paymentModel = $request->getFirstModel(); + Assert::isInstanceOf($paymentModel, PaymentInterface::class); + $details = ArrayObject::ensureArrayObject($request->getModel()); + if (isset($details['payment_method']) && + ApplePayGatewayFactory::PAYMENT_METHOD_APPLE_PAY === $details['payment_method']) { + $this->abortPaymentProcessor->process($paymentModel); + $details['status'] = PayPlugApiClientInterface::STATUS_CANCELED; + + return; + } + if (isset($details['status']) && PayPlugApiClientInterface::FAILED === $details['status']) { // Unset current status to allow to use payplug to change payment method unset($details['status']); @@ -93,12 +106,9 @@ public function execute($request): void return; } - $paymentModel = $request->getFirstModel(); - Assert::isInstanceOf($paymentModel, PaymentInterface::class); - - /** @var Capture $request */ + /* @var Capture $request */ if (array_key_exists('status', $paymentModel->getDetails()) - && $paymentModel->getDetails()['status'] === PayPlugApiClientInterface::STATUS_CAPTURED) { + && PayPlugApiClientInterface::STATUS_CAPTURED === $paymentModel->getDetails()['status']) { return; } @@ -118,6 +128,24 @@ public function execute($request): void unset($details['status']); } + if (!in_array( + $details['payment_method'], + array_merge( + [ApplePayGatewayFactory::PAYMENT_METHOD_APPLE_PAY], + OneyGatewayFactory::PAYMENT_CHOICES + ), + true + )) { + // clean other detail values + if ($details->offsetExists('payment_context')) { + unset($details['payment_context']); + } + + if ($details->offsetExists('merchant_session')) { + unset($details['merchant_session']); + } + } + try { // gateway payplug case: open many browsers and pay by save card in any of these browsers $cardId = $this->requestStack->getSession()->get('payplug_payment_method'); @@ -233,7 +261,9 @@ private function createPayment(ArrayObject $details, PaymentInterface $paymentMo { try { if ($details->offsetExists('payment_id') - && $details->offsetExists('status')) { + && $details->offsetExists('status') + && $details->offsetExists('is_live') + ) { $this->abortPaymentProcessor->process($paymentModel); unset($details['status'], $details['payment_id'], $details['is_live']); // the parameter allow_save_card must be false when payment_method parameter is provided diff --git a/src/Controller/IpnAction.php b/src/Controller/IpnAction.php index 476f32c3..96476050 100644 --- a/src/Controller/IpnAction.php +++ b/src/Controller/IpnAction.php @@ -67,6 +67,11 @@ public function __invoke(Request $request): JsonResponse $content = json_decode($input, true); $details = ArrayObject::ensureArrayObject($content); + // if we are too fast canceling a payment before we got an answer from PayPlug gateway + if (null === $details['payment_id']) { + return new JsonResponse(null, Response::HTTP_UNAUTHORIZED); + } + $payment = $this->paymentRepository->findOneByPayPlugPaymentId($details['payment_id']); $paymentMethod = $payment->getMethod(); diff --git a/src/Controller/OrderController.php b/src/Controller/OrderController.php index f64070f3..51a1adff 100644 --- a/src/Controller/OrderController.php +++ b/src/Controller/OrderController.php @@ -24,7 +24,9 @@ use Sylius\Bundle\ResourceBundle\Controller\ViewHandlerInterface; use Sylius\Bundle\ResourceBundle\Event\ResourceControllerEvent; use Sylius\Component\Core\Model\OrderInterface; +use Sylius\Component\Core\OrderCheckoutStates; use Sylius\Component\Core\OrderCheckoutTransitions; +use Sylius\Component\Core\OrderPaymentStates; use Sylius\Component\Payment\Model\PaymentInterface; use Sylius\Component\Resource\Exception\UpdateHandlingException; use Sylius\Component\Resource\Factory\FactoryInterface; @@ -36,6 +38,7 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\Lock\LockFactory; +use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Webmozart\Assert\Assert; final class OrderController extends BaseOrderController @@ -105,6 +108,10 @@ public function initiateApplePaySessionAction(Request $request): Response /** @var OrderInterface $resource */ $resource = $this->findOr404($configuration); + if (OrderPaymentStates::STATE_PAID === $resource->getPaymentState()) { + throw new AccessDeniedException(); + } + /** @var ResourceControllerEvent $event */ $event = $this->eventDispatcher->dispatchPreEvent(ResourceActions::UPDATE, $configuration, $resource); @@ -173,7 +180,7 @@ public function initiateApplePaySessionAction(Request $request): Response ]); } - $this->addFlash('error', 'sylius.payment.cancelled'); + $request->getSession()->getFlashBag()->add('error', 'sylius.payment.cancelled'); $dataResponse = []; $redirect = $this->redirectToRoute('sylius_shop_checkout_select_payment'); $dataResponse['returnUrl'] = $redirect->getTargetUrl(); @@ -231,7 +238,7 @@ public function confirmApplePayPaymentAction(Request $request): Response ]); } - $this->addFlash('error', 'sylius.payment.cancelled'); + $request->getSession()->getFlashBag()->add('error', 'sylius.payment.cancelled'); $redirect = $this->redirectToRoute('sylius_shop_checkout_select_payment'); $dataResponse = []; $dataResponse['returnUrl'] = $redirect->getTargetUrl(); @@ -351,12 +358,12 @@ public function cancelApplePaySessionAction(Request $request): Response $this->manager->flush(); - $this->addFlash('error', 'sylius.payment.cancelled'); + $request->getSession()->getFlashBag()->add('error', 'sylius.payment.cancelled'); $dataResponse = []; $redirect = $this->redirectToRoute('sylius_shop_checkout_select_payment', ['_locale' => $resource->getLocaleCode()]); - if (OrderInterface::STATE_NEW === $resource->getState()) { + if (OrderCheckoutStates::STATE_COMPLETED === $resource->getCheckoutState()) { $redirect = $this->redirectToRoute('sylius_shop_order_show', [ 'tokenValue' => $resource->getTokenValue(), '_locale' => $resource->getLocaleCode(), @@ -391,7 +398,7 @@ public function cancelApplePaySessionAction(Request $request): Response 'trace' => $exception->getTraceAsString(), ]); - $this->addFlash('error', 'sylius.payment.cancelled'); + $request->getSession()->getFlashBag()->add('error', 'sylius.payment.cancelled'); $dataResponse = []; diff --git a/src/PayPlugSyliusPayPlugPlugin.php b/src/PayPlugSyliusPayPlugPlugin.php index 4d46f939..a2a8a400 100644 --- a/src/PayPlugSyliusPayPlugPlugin.php +++ b/src/PayPlugSyliusPayPlugPlugin.php @@ -9,7 +9,7 @@ final class PayPlugSyliusPayPlugPlugin extends Bundle { - public const VERSION = '1.9.0'; + public const VERSION = '1.9.1'; use SyliusPluginTrait; } diff --git a/src/Provider/Payment/ApplePayPaymentProvider.php b/src/Provider/Payment/ApplePayPaymentProvider.php index 9cf7e366..e16a5040 100644 --- a/src/Provider/Payment/ApplePayPaymentProvider.php +++ b/src/Provider/Payment/ApplePayPaymentProvider.php @@ -22,6 +22,10 @@ use Sylius\Component\Core\Model\OrderInterface; use Sylius\Component\Core\Model\PaymentInterface; use Sylius\Component\Core\Model\PaymentMethodInterface; +use Sylius\Component\Core\OrderCheckoutStates; +use Sylius\Component\Core\OrderCheckoutTransitions; +use Sylius\Component\Core\OrderPaymentStates; +use Sylius\Component\Core\OrderPaymentTransitions; use Sylius\Component\Core\Payment\Exception\NotProvidedOrderPaymentException; use Sylius\Component\Core\TokenAssigner\OrderTokenAssignerInterface; use Sylius\Component\Payment\Factory\PaymentFactoryInterface; @@ -70,7 +74,16 @@ public function provide(Request $request, OrderInterface $order): PaymentInterfa throw new LogicException('Apple Pay is not enabled'); } - $payment = $this->initApplePaySyliusPaymentState($order, PaymentInterface::STATE_NEW); + $state = PaymentInterface::STATE_CART; + + /** @phpstan-ignore-next-line */ + if ($order->getPayments()->filter(function (PaymentInterface $payment): bool { + return PaymentInterface::STATE_FAILED === $payment->getState() || PaymentInterface::STATE_CANCELLED === $payment->getState(); + })->count() > 0) { + $state = PaymentInterface::STATE_NEW; + } + + $payment = $this->initApplePaySyliusPaymentState($order, $state); Assert::notNull($order->getBillingAddress()); if (null !== $customer = $order->getBillingAddress()->getCustomer()) { @@ -105,7 +118,10 @@ public function provide(Request $request, OrderInterface $order): PaymentInterfa $details['is_live'] = $paymentResource->is_live; $payment->setDetails($details); - $this->applyRequiredTransition($payment, PaymentInterface::STATE_NEW); + $this->applyRequiredPaymentTransition($payment, PaymentInterface::STATE_NEW); + $this->applyRequiredOrderPaymentTransition($order, OrderPaymentStates::STATE_AWAITING_PAYMENT); + $this->applyRequiredOrderCheckoutTransition($order, OrderCheckoutStates::STATE_COMPLETED); + $this->entityManager->flush(); return $payment; @@ -116,32 +132,39 @@ public function provide(Request $request, OrderInterface $order): PaymentInterfa */ private function initApplePaySyliusPaymentState(OrderInterface $order, string $targetState): PaymentInterface { - $order->getPayments()->clear(); - Assert::notNull($order->getCurrencyCode()); - /** @var PaymentInterface $payment */ - $payment = $this->paymentFactory->createWithAmountAndCurrencyCode($order->getTotal(), $order->getCurrencyCode()); + + $payment = $this->getPayment($order); + $paymentMethod = $this->paymentMethodRepository->findOneByGatewayName(ApplePayGatewayFactory::FACTORY_NAME); + $payment->setMethod($paymentMethod); + $order->addPayment($payment); + $this->entityManager->flush(); - $lastPayment = $this->getLastPayment($order); + return $payment; + } - if (null !== $lastPayment) { - $paymentMethod = $lastPayment->getMethod(); + private function getPayment(OrderInterface $order): PaymentInterface + { + $lastPayment = $order->getLastPayment(); + + if ($lastPayment instanceof PaymentInterface && + PaymentInterface::STATE_CART === $lastPayment->getState()) { + return $lastPayment; } - if (null === $paymentMethod) { - throw new NotProvidedOrderPaymentException(); + if ($lastPayment instanceof PaymentInterface && OrderInterface::STATE_NEW === $order->getState() && + PaymentInterface::STATE_NEW === $lastPayment->getState()) { + return $lastPayment; } - $payment->setMethod($paymentMethod); - $this->applyRequiredTransition($payment, $targetState); - $order->addPayment($payment); - $this->entityManager->flush(); + Assert::string($order->getCurrencyCode()); - return $payment; + /** @phpstan-ignore-next-line */ + return $this->paymentFactory->createWithAmountAndCurrencyCode($order->getTotal(), $order->getCurrencyCode()); } - public function applyRequiredTransition(PaymentInterface $payment, string $targetState): void + public function applyRequiredPaymentTransition(PaymentInterface $payment, string $targetState): void { if ($targetState === $payment->getState()) { return; @@ -158,6 +181,40 @@ public function applyRequiredTransition(PaymentInterface $payment, string $targe } } + public function applyRequiredOrderPaymentTransition(OrderInterface $order, string $targetState): void + { + if ($targetState === $order->getPaymentState()) { + return; + } + + /** @var StateMachineInterface $stateMachine */ + $stateMachine = $this->stateMachineFactory->get($order, OrderPaymentTransitions::GRAPH); + + /** @phpstan-ignore-next-line */ + $targetTransition = $stateMachine->getTransitionToState($targetState); + + if (null !== $targetTransition) { + $stateMachine->apply($targetTransition); + } + } + + public function applyRequiredOrderCheckoutTransition(OrderInterface $order, string $targetState): void + { + if ($targetState === $order->getPaymentState()) { + return; + } + + /** @var StateMachineInterface $stateMachine */ + $stateMachine = $this->stateMachineFactory->get($order, OrderCheckoutTransitions::GRAPH); + + /** @phpstan-ignore-next-line */ + $targetTransition = $stateMachine->getTransitionToState($targetState); + + if (null !== $targetTransition) { + $stateMachine->apply($targetTransition); + } + } + private function getLastPayment(OrderInterface $order): ?PaymentInterface { $lastCancelledPayment = $order->getLastPayment(PaymentInterface::STATE_CANCELLED); @@ -201,7 +258,7 @@ public function patch(Request $request, OrderInterface $order): PaymentInterface $details = $lastPayment->getDetails(); if (!$response->is_paid) { - $this->applyRequiredTransition($lastPayment, PaymentInterface::STATE_FAILED); + $this->applyRequiredPaymentTransition($lastPayment, PaymentInterface::STATE_FAILED); throw new PaymentNotCompletedException(); } @@ -216,7 +273,7 @@ public function patch(Request $request, OrderInterface $order): PaymentInterface $this->entityManager->flush(); - $this->applyRequiredTransition($lastPayment, PaymentInterface::STATE_COMPLETED); + $this->applyRequiredPaymentTransition($lastPayment, PaymentInterface::STATE_COMPLETED); if ($this->isResourceIsAuthorized($response)) { $details['status'] = PayPlugApiClientInterface::STATUS_AUTHORIZED; @@ -227,7 +284,7 @@ public function patch(Request $request, OrderInterface $order): PaymentInterface return $lastPayment; } catch (\Exception $exception) { $paymentResource->abort(); - $this->applyRequiredTransition($lastPayment, PaymentInterface::STATE_FAILED); + $this->applyRequiredPaymentTransition($lastPayment, PaymentInterface::STATE_FAILED); throw new PaymentNotCompletedException(); } @@ -275,7 +332,7 @@ public function cancel(OrderInterface $order): void throw new LogicException(); } - $this->applyRequiredTransition($lastPayment, PaymentInterface::STATE_CANCELLED); + $this->applyRequiredPaymentTransition($lastPayment, PaymentInterface::STATE_CANCELLED); $this->entityManager->flush(); } } diff --git a/src/Resources/config/ui.yaml b/src/Resources/config/ui.yaml index 7596cba1..1b8b9db7 100644 --- a/src/Resources/config/ui.yaml +++ b/src/Resources/config/ui.yaml @@ -17,10 +17,14 @@ sylius_ui: template: '@PayPlugSyliusPayPlugPlugin/javascripts/webfont_loader.html.twig' oney_common: template: '@PayPlugSyliusPayPlugPlugin/javascripts/oney_common.html.twig' + select_payment_js: + template: '@PayPlugSyliusPayPlugPlugin/javascripts/select_payment_js.html.twig' sylius.shop.layout.stylesheets: blocks: oney_common: template: '@PayPlugSyliusPayPlugPlugin/stylesheets/oney_common.html.twig' + select_payment_css: + template: '@PayPlugSyliusPayPlugPlugin/stylesheets/select_payment_css.html.twig' sylius.shop.account.saved_cards.index.header.content: blocks: legacy: @@ -49,3 +53,8 @@ sylius_ui: priority: 5 context: event: sylius.shop.account.order.index.after_grid + sylius.admin.payment_method.create.stylesheets: &cssEvt + blocks: + payment_methods_css: + template: '@PayPlugSyliusPayPlugPlugin/stylesheets/payment_method_css.html.twig' + sylius.admin.payment_method.update.stylesheets: *cssEvt diff --git a/src/Resources/dev/admin/payment_method/index.scss b/src/Resources/dev/admin/payment_method/index.scss new file mode 100644 index 00000000..9f3cf3a1 --- /dev/null +++ b/src/Resources/dev/admin/payment_method/index.scss @@ -0,0 +1,8 @@ +.ui.label > a { + opacity: 1; + color: black; + + &:hover { + text-decoration: underline; + } +} \ No newline at end of file diff --git a/src/Resources/dev/package.json b/src/Resources/dev/package.json index d7377ba8..2f92e08e 100644 --- a/src/Resources/dev/package.json +++ b/src/Resources/dev/package.json @@ -1,11 +1,13 @@ { "name": "sylius-payplug-plugin", - "version": "1.9.0", + "version": "1.9.1", "description": "Sylius Payplug Plugin", "source": "src/index.js", "scripts": { - "build": "parcel build pages/**/* --dist-dir ../public/assets/oney --no-source-maps", - "dev": "parcel watch pages/**/* --dist-dir ../public/assets/oney --no-hmr", + "build": "parcel build shop/**/* --dist-dir ../public/assets/shop --no-source-maps", + "build:admin": "parcel build admin/**/* --dist-dir ../public/assets/admin --no-source-maps", + "dev": "parcel watch shop/**/* --dist-dir ../public/assets/shop --no-hmr", + "dev:admin": "parcel watch admin/**/* --dist-dir ../public/assets/admin --no-hmr", "eslint": "eslint -c .eslintrc ./", "fix-eslint": "eslint -c .eslintrc ./ --fix", "test": "echo \"Error: no test specified\" && exit 1" diff --git a/src/Resources/dev/pages/account/index.scss b/src/Resources/dev/shop/account/index.scss similarity index 100% rename from src/Resources/dev/pages/account/index.scss rename to src/Resources/dev/shop/account/index.scss diff --git a/src/Resources/dev/pages/cart/index.js b/src/Resources/dev/shop/oney_cart/index.js similarity index 100% rename from src/Resources/dev/pages/cart/index.js rename to src/Resources/dev/shop/oney_cart/index.js diff --git a/src/Resources/dev/pages/common/index.js b/src/Resources/dev/shop/oney_common/index.js similarity index 100% rename from src/Resources/dev/pages/common/index.js rename to src/Resources/dev/shop/oney_common/index.js diff --git a/src/Resources/dev/pages/common/index.scss b/src/Resources/dev/shop/oney_common/index.scss similarity index 93% rename from src/Resources/dev/pages/common/index.scss rename to src/Resources/dev/shop/oney_common/index.scss index 2b1d7226..c4dbc21e 100644 --- a/src/Resources/dev/pages/common/index.scss +++ b/src/Resources/dev/shop/oney_common/index.scss @@ -2,7 +2,7 @@ [class*=oney] * { font: { - family: Poppins, Arial, sans-serif; + family: Poppins, Arial, sans-serif !important; } line-height: 1.25; diff --git a/src/Resources/dev/pages/popin/index.js b/src/Resources/dev/shop/oney_popin/index.js similarity index 100% rename from src/Resources/dev/pages/popin/index.js rename to src/Resources/dev/shop/oney_popin/index.js diff --git a/src/Resources/dev/pages/popin/index.scss b/src/Resources/dev/shop/oney_popin/index.scss similarity index 100% rename from src/Resources/dev/pages/popin/index.scss rename to src/Resources/dev/shop/oney_popin/index.scss diff --git a/src/Resources/dev/pages/payment/index.js b/src/Resources/dev/shop/payment/index.js similarity index 100% rename from src/Resources/dev/pages/payment/index.js rename to src/Resources/dev/shop/payment/index.js diff --git a/src/Resources/dev/pages/payment/index.scss b/src/Resources/dev/shop/payment/index.scss similarity index 92% rename from src/Resources/dev/pages/payment/index.scss rename to src/Resources/dev/shop/payment/index.scss index e7862c25..bf3f1bac 100644 --- a/src/Resources/dev/pages/payment/index.scss +++ b/src/Resources/dev/shop/payment/index.scss @@ -144,35 +144,14 @@ .apple-pay-method, .american-express-method { label { - display: flex !important; - align-items: flex-start; - } - } - - .bancontact-method { - .bancontact-logo { - margin-left: 0.5em; - position: relative; - top: -12px; - } - } - - .american-express-method { - .american-express-logo { - margin-left: 0.5em; position: relative; - top: -12px; - } - } - - .apple-pay-method { - label { - height: 45px; - } - .apple-pay-logo { - margin-left: 0.5em; - transform: translateY(-12px); + img { + position: absolute; + left: 100%; + margin-left: 0.5em; + top: -12px; + } } } } diff --git a/src/Resources/public/assets/admin/payment_method/index.css b/src/Resources/public/assets/admin/payment_method/index.css new file mode 100644 index 00000000..e3f88634 --- /dev/null +++ b/src/Resources/public/assets/admin/payment_method/index.css @@ -0,0 +1 @@ +.ui.label>a{opacity:1;color:#000}.ui.label>a:hover{text-decoration:underline} \ No newline at end of file diff --git a/src/Resources/public/assets/apple-pay/logo.svg b/src/Resources/public/assets/apple-pay/logo.svg index ca4777cd..1240e7d4 100644 --- a/src/Resources/public/assets/apple-pay/logo.svg +++ b/src/Resources/public/assets/apple-pay/logo.svg @@ -1 +1,5 @@ - + + + + + \ No newline at end of file diff --git a/src/Resources/public/assets/oney/common/index.css b/src/Resources/public/assets/oney/common/index.css deleted file mode 100644 index 9330684b..00000000 --- a/src/Resources/public/assets/oney/common/index.css +++ /dev/null @@ -1 +0,0 @@ -[class*=oney] *{font-family:Poppins,Arial,sans-serif;line-height:1.25}[class*=oney] * p{color:#66727f;margin:0}[class*=oney] * small{font-size:90%}.oney-info{margin:1em auto .5em;display:inline-block;position:relative}.oney-info span{vertical-align:text-bottom;text-transform:uppercase;font-size:16px}.oney-info>img{cursor:pointer;vertical-align:middle;margin:0 4px}.oney-info.loading{pointer-events:none}.oney-logo[src*=without-fees]{max-width:190px}@media screen and (max-width:768px){.oney-logo{max-width:230px}} \ No newline at end of file diff --git a/src/Resources/public/assets/oney/payment/index.css b/src/Resources/public/assets/oney/payment/index.css deleted file mode 100644 index adfe5822..00000000 --- a/src/Resources/public/assets/oney/payment/index.css +++ /dev/null @@ -1 +0,0 @@ -.oney-payment-choice__item label,.payplug-payment-choice__item label{margin-top:0!important;padding:1em!important;display:flex!important}.oney-payment-choice,.payplug-payment-choice{display:none}.oney-payment-choice__container,.payplug-payment-choice__container{margin:1rem 0;display:flex}.oney-payment-choice__header p,.payplug-payment-choice__header p{color:#000;margin:.5em 0!important}.oney-payment-choice__item,.payplug-payment-choice__item{flex:auto}.oney-payment-choice__item--oney_x3_with_fees,.oney-payment-choice__item--oney_x3_without_fees,.payplug-payment-choice__item--oney_x3_with_fees,.payplug-payment-choice__item--oney_x3_without_fees{margin-right:1em}.oney-payment-choice__item input,.payplug-payment-choice__item input{display:none}.oney-payment-choice__item input:checked+label,.payplug-payment-choice__item input:checked+label{background-color:#81bc0021;border-color:#81bc00}.oney-payment-choice__item input:checked+label.payplug-payment-choice__label,.payplug-payment-choice__item input:checked+label.payplug-payment-choice__label{background-color:#8fd2b821;border-color:#8fd2b8}.oney-payment-choice__item label,.payplug-payment-choice__item label{width:100%;height:100%;cursor:pointer;border:1px solid #ccc;border-radius:.285714rem;flex-direction:column;transition:border-color,background-color .3s ease-in-out;position:relative;box-shadow:0 1px 2px #22242626}.oney-payment-choice__item label img,.payplug-payment-choice__item label img{vertical-align:text-bottom}.oney-payment-choice__content,.payplug-payment-choice__content{display:contents}.oney-payment-choice__content p,.payplug-payment-choice__content p{color:#000;border-bottom:1px solid #ccc;flex-wrap:wrap;justify-content:space-between;display:flex;margin:0!important;padding:.75rem 0!important}.oney-payment-choice__content p:nth-last-of-type(2),.payplug-payment-choice__content p:nth-last-of-type(2){margin-bottom:1rem!important}.oney-payment-choice__content p:last-of-type,.payplug-payment-choice__content p:last-of-type{border:none;margin-top:auto!important;margin-bottom:0!important}.oney-payment-choice__content p.oney-without-fees-financing,.payplug-payment-choice__content p.oney-without-fees-financing{display:inline-block}.oney-payment-choice__content small,.payplug-payment-choice__content small{margin-top:.5rem;font-size:80%}.oney-payment-choice__tab{display:none}.oney-payment-choice__header{text-align:center;margin:0 auto}[data-gateway=oney]{margin-top:10px!important;padding:0!important}.payment-item .oney-logo[src*=without-fees]{max-width:200px}.payment-item apple-pay-button{--apple-pay-button-width:222px;--apple-pay-button-height:40px;--apple-pay-button-border-radius:4px;--apple-pay-button-padding:4px 4px;--apple-pay-button-box-sizing:border-box;min-width:140px;max-width:100%;transition:background-color .3s ease-in-out;display:none}.payment-item apple-pay-button.enabled{display:block}.payment-item label{cursor:pointer}.payment-item .bancontact-method label,.payment-item .apple-pay-method label,.payment-item .american-express-method label{align-items:flex-start;display:flex!important}.payment-item .bancontact-method .bancontact-logo,.payment-item .american-express-method .american-express-logo{margin-left:.5em;position:relative;top:-12px}.payment-item .apple-pay-method label{height:45px}.payment-item .apple-pay-method .apple-pay-logo{margin-left:.5em;transform:translateY(-12px)}.payplug-payment-choice__container{flex-direction:column}.payplug-payment-choice__item{margin-bottom:1em}.payplug-payment-choice__header{justify-content:space-between;align-items:center;display:flex}.payplug-payment-choice__header .card-expiry span{font-weight:700}.oney-complete-info-popin{text-align:center;max-width:480px;z-index:4;top:50%;left:0;right:0;transform:translateY(-50%);margin:auto!important;position:fixed!important}.oney-complete-info-popin__header{text-align:right}.oney-complete-info-popin__header a.close>span{width:15px;height:2px;background-color:#0000000d;border-radius:0;margin:0;position:absolute;top:1em;right:.5em}.oney-complete-info-popin__header a.close>span:first-of-type{transform:rotate(45deg)}.oney-complete-info-popin__header a.close>span:last-of-type{transform:rotate(-45deg)}.oney-complete-info-popin__content{text-align:left}.oney-complete-info-popin__content ul{padding:0;list-style:none}.oney-complete-info-popin__content ul li{color:#fff;background-color:#db2828;border-color:#db2828;border-radius:.285714rem;margin:0 .142857em;padding:.5833em .833em;font-size:.857143rem;font-weight:700;display:inline-block}.oney-complete-info-popin__success{display:none}.oney-complete-info-popin__success i.icon{color:#21ba45;display:inline-block!important}.ui.container{position:relative}.inactive{pointer-events:none}.overlay{width:100%;height:100%;z-index:3;background:#00000040;display:block;position:absolute}@media screen and (max-width:991px){.oney-payment-choice__container,.payplug-payment-choice__container{display:block}.oney-payment-choice__content small,.payplug-payment-choice__content small{width:100%}.oney-payment-choice__tab{justify-content:space-between;display:flex}.oney-payment-choice__tab .tablink{text-align:center;border:1px solid #ccc;border-bottom:0;flex:1;padding:1rem 0}.oney-payment-choice__tab .tablink.active{border-bottom:5px solid #81bc00}.oney-payment-choice__tab .tablink p{color:#000}.oney-payment-choice__tab .tablink:first-of-type{border-right:0}.oney-payment-choice__tab .tablink>.oney-payment__image{max-width:120px}.oney-payment-choice__header,.oney-payment-choice__item{display:none}.oney-payment-choice__item input:checked+label{background-color:#fff;border-color:#ccc}.oney-payment-choice__item label{border-top-left-radius:0;border-top-right-radius:0}.oney-payment-choice__item--oney_x3_with_fees,.oney-payment-choice__item--oney_x3_without_fees{margin-bottom:1rem;margin-right:0;display:block}}@media screen and (max-width:480px){.payplug-payment-choice__header,.payplug-payment-choice__header .card-type,.payplug-payment-choice__header .card-expiry{display:block}} \ No newline at end of file diff --git a/src/Resources/public/assets/oney/account/index.css b/src/Resources/public/assets/shop/account/index.css similarity index 100% rename from src/Resources/public/assets/oney/account/index.css rename to src/Resources/public/assets/shop/account/index.css diff --git a/src/Resources/public/assets/oney/cart/index.js b/src/Resources/public/assets/shop/oney_cart/index.js similarity index 100% rename from src/Resources/public/assets/oney/cart/index.js rename to src/Resources/public/assets/shop/oney_cart/index.js diff --git a/src/Resources/public/assets/shop/oney_common/index.css b/src/Resources/public/assets/shop/oney_common/index.css new file mode 100644 index 00000000..84b84648 --- /dev/null +++ b/src/Resources/public/assets/shop/oney_common/index.css @@ -0,0 +1 @@ +[class*=oney] *{line-height:1.25;font-family:Poppins,Arial,sans-serif!important}[class*=oney] * p{color:#66727f;margin:0}[class*=oney] * small{font-size:90%}.oney-info{margin:1em auto .5em;display:inline-block;position:relative}.oney-info span{vertical-align:text-bottom;text-transform:uppercase;font-size:16px}.oney-info>img{cursor:pointer;vertical-align:middle;margin:0 4px}.oney-info.loading{pointer-events:none}.oney-logo[src*=without-fees]{max-width:190px}@media screen and (max-width:768px){.oney-logo{max-width:230px}} \ No newline at end of file diff --git a/src/Resources/public/assets/oney/common/index.js b/src/Resources/public/assets/shop/oney_common/index.js similarity index 100% rename from src/Resources/public/assets/oney/common/index.js rename to src/Resources/public/assets/shop/oney_common/index.js diff --git a/src/Resources/public/assets/oney/popin/index.css b/src/Resources/public/assets/shop/oney_popin/index.css similarity index 100% rename from src/Resources/public/assets/oney/popin/index.css rename to src/Resources/public/assets/shop/oney_popin/index.css diff --git a/src/Resources/public/assets/oney/popin/index.js b/src/Resources/public/assets/shop/oney_popin/index.js similarity index 100% rename from src/Resources/public/assets/oney/popin/index.js rename to src/Resources/public/assets/shop/oney_popin/index.js diff --git a/src/Resources/public/assets/shop/payment/index.css b/src/Resources/public/assets/shop/payment/index.css new file mode 100644 index 00000000..1ca41c46 --- /dev/null +++ b/src/Resources/public/assets/shop/payment/index.css @@ -0,0 +1 @@ +.oney-payment-choice__item label,.payplug-payment-choice__item label{margin-top:0!important;padding:1em!important;display:flex!important}.oney-payment-choice,.payplug-payment-choice{display:none}.oney-payment-choice__container,.payplug-payment-choice__container{margin:1rem 0;display:flex}.oney-payment-choice__header p,.payplug-payment-choice__header p{color:#000;margin:.5em 0!important}.oney-payment-choice__item,.payplug-payment-choice__item{flex:auto}.oney-payment-choice__item--oney_x3_with_fees,.oney-payment-choice__item--oney_x3_without_fees,.payplug-payment-choice__item--oney_x3_with_fees,.payplug-payment-choice__item--oney_x3_without_fees{margin-right:1em}.oney-payment-choice__item input,.payplug-payment-choice__item input{display:none}.oney-payment-choice__item input:checked+label,.payplug-payment-choice__item input:checked+label{background-color:#81bc0021;border-color:#81bc00}.oney-payment-choice__item input:checked+label.payplug-payment-choice__label,.payplug-payment-choice__item input:checked+label.payplug-payment-choice__label{background-color:#8fd2b821;border-color:#8fd2b8}.oney-payment-choice__item label,.payplug-payment-choice__item label{width:100%;height:100%;cursor:pointer;border:1px solid #ccc;border-radius:.285714rem;flex-direction:column;transition:border-color,background-color .3s ease-in-out;position:relative;box-shadow:0 1px 2px #22242626}.oney-payment-choice__item label img,.payplug-payment-choice__item label img{vertical-align:text-bottom}.oney-payment-choice__content,.payplug-payment-choice__content{display:contents}.oney-payment-choice__content p,.payplug-payment-choice__content p{color:#000;border-bottom:1px solid #ccc;flex-wrap:wrap;justify-content:space-between;display:flex;margin:0!important;padding:.75rem 0!important}.oney-payment-choice__content p:nth-last-of-type(2),.payplug-payment-choice__content p:nth-last-of-type(2){margin-bottom:1rem!important}.oney-payment-choice__content p:last-of-type,.payplug-payment-choice__content p:last-of-type{border:none;margin-top:auto!important;margin-bottom:0!important}.oney-payment-choice__content p.oney-without-fees-financing,.payplug-payment-choice__content p.oney-without-fees-financing{display:inline-block}.oney-payment-choice__content small,.payplug-payment-choice__content small{margin-top:.5rem;font-size:80%}.oney-payment-choice__tab{display:none}.oney-payment-choice__header{text-align:center;margin:0 auto}[data-gateway=oney]{margin-top:10px!important;padding:0!important}.payment-item .oney-logo[src*=without-fees]{max-width:200px}.payment-item apple-pay-button{--apple-pay-button-width:222px;--apple-pay-button-height:40px;--apple-pay-button-border-radius:4px;--apple-pay-button-padding:4px 4px;--apple-pay-button-box-sizing:border-box;min-width:140px;max-width:100%;transition:background-color .3s ease-in-out;display:none}.payment-item apple-pay-button.enabled{display:block}.payment-item label{cursor:pointer}.payment-item .bancontact-method label,.payment-item .apple-pay-method label,.payment-item .american-express-method label{position:relative}.payment-item .bancontact-method label img,.payment-item .apple-pay-method label img,.payment-item .american-express-method label img{margin-left:.5em;position:absolute;top:-12px;left:100%}.payplug-payment-choice__container{flex-direction:column}.payplug-payment-choice__item{margin-bottom:1em}.payplug-payment-choice__header{justify-content:space-between;align-items:center;display:flex}.payplug-payment-choice__header .card-expiry span{font-weight:700}.oney-complete-info-popin{text-align:center;max-width:480px;z-index:4;top:50%;left:0;right:0;transform:translateY(-50%);margin:auto!important;position:fixed!important}.oney-complete-info-popin__header{text-align:right}.oney-complete-info-popin__header a.close>span{width:15px;height:2px;background-color:#0000000d;border-radius:0;margin:0;position:absolute;top:1em;right:.5em}.oney-complete-info-popin__header a.close>span:first-of-type{transform:rotate(45deg)}.oney-complete-info-popin__header a.close>span:last-of-type{transform:rotate(-45deg)}.oney-complete-info-popin__content{text-align:left}.oney-complete-info-popin__content ul{padding:0;list-style:none}.oney-complete-info-popin__content ul li{color:#fff;background-color:#db2828;border-color:#db2828;border-radius:.285714rem;margin:0 .142857em;padding:.5833em .833em;font-size:.857143rem;font-weight:700;display:inline-block}.oney-complete-info-popin__success{display:none}.oney-complete-info-popin__success i.icon{color:#21ba45;display:inline-block!important}.ui.container{position:relative}.inactive{pointer-events:none}.overlay{width:100%;height:100%;z-index:3;background:#00000040;display:block;position:absolute}@media screen and (max-width:991px){.oney-payment-choice__container,.payplug-payment-choice__container{display:block}.oney-payment-choice__content small,.payplug-payment-choice__content small{width:100%}.oney-payment-choice__tab{justify-content:space-between;display:flex}.oney-payment-choice__tab .tablink{text-align:center;border:1px solid #ccc;border-bottom:0;flex:1;padding:1rem 0}.oney-payment-choice__tab .tablink.active{border-bottom:5px solid #81bc00}.oney-payment-choice__tab .tablink p{color:#000}.oney-payment-choice__tab .tablink:first-of-type{border-right:0}.oney-payment-choice__tab .tablink>.oney-payment__image{max-width:120px}.oney-payment-choice__header,.oney-payment-choice__item{display:none}.oney-payment-choice__item input:checked+label{background-color:#fff;border-color:#ccc}.oney-payment-choice__item label{border-top-left-radius:0;border-top-right-radius:0}.oney-payment-choice__item--oney_x3_with_fees,.oney-payment-choice__item--oney_x3_without_fees{margin-bottom:1rem;margin-right:0;display:block}}@media screen and (max-width:480px){.payplug-payment-choice__header,.payplug-payment-choice__header .card-type,.payplug-payment-choice__header .card-expiry{display:block}} \ No newline at end of file diff --git a/src/Resources/public/assets/oney/payment/index.js b/src/Resources/public/assets/shop/payment/index.js similarity index 100% rename from src/Resources/public/assets/oney/payment/index.js rename to src/Resources/public/assets/shop/payment/index.js diff --git a/src/Resources/translations/messages.en.yml b/src/Resources/translations/messages.en.yml index 267fb8e6..d816a39d 100644 --- a/src/Resources/translations/messages.en.yml +++ b/src/Resources/translations/messages.en.yml @@ -105,7 +105,8 @@ payplug_sylius_payplug_plugin: submit: Confirm and continue base_currency_not_euro: | Channel #channel_code#: #payment_method# is only available on channels with EURO as a currency - only_one_gateway_allowed: Please note that the %gateway_title% payment method has already been set. To change it, go to your payment methods. + only_one_gateway_allowed: | + Please note that the %gateway_title% payment method has already been set. To change it, go to your payment methods. one_click_enable: Enable One click one_click_help: | Allow your customers to save their credit card details for later diff --git a/src/Resources/translations/messages.fr.yml b/src/Resources/translations/messages.fr.yml index adb4f43e..a0e35e54 100644 --- a/src/Resources/translations/messages.fr.yml +++ b/src/Resources/translations/messages.fr.yml @@ -123,7 +123,8 @@ payplug_sylius_payplug_plugin: submit: Valider et continuer base_currency_not_euro: | Canal #channel_code# : #payment_method# n’est disponible que sur des canaux dont la devise est l’EURO - only_one_gateway_allowed: Attention, le moyen de paiement %gateway_title% existe déjà. Pour le modifier, rendez-vous sur vos moyens de paiement. + only_one_gateway_allowed: | + Attention, le moyen de paiement %gateway_title% existe déjà. Pour le modifier, rendez-vous sur vos moyens de paiement. one_click_enable: Activer le One click one_click_help: | Permettez à vos clients d'enregistrer leurs coordonnées de carte de paiement pour effectuer ultérieurement diff --git a/src/Resources/translations/messages.it.yml b/src/Resources/translations/messages.it.yml index b11445bf..e83d2456 100644 --- a/src/Resources/translations/messages.it.yml +++ b/src/Resources/translations/messages.it.yml @@ -105,7 +105,8 @@ payplug_sylius_payplug_plugin: submit: Convalida e continua base_currency_not_euro: | Il canale #channel_code# : #payment_method# è disponibile solo per i canali la cui valuta è in EURO - only_one_gateway_allowed: 'Attenzione: il metodo di pagamento %gateway_title% è già definito. Per modificarlo, vai ai tuoi metodi di pagamento.' + only_one_gateway_allowed: | + Attenzione: il metodo di pagamento %gateway_title% è già definito. Per modificarlo, vai ai tuoi metodi di pagamento. one_click_enable: Attiva un clic one_click_help: | Consenti ai tuoi clienti di salvare i dettagli della loro carta di credito per dopo diff --git a/src/Resources/translations/validators.en.yml b/src/Resources/translations/validators.en.yml index 24b1d8f9..86aa248c 100644 --- a/src/Resources/translations/validators.en.yml +++ b/src/Resources/translations/validators.en.yml @@ -10,7 +10,7 @@ payplug_sylius_payplug_plugin: one_click: can_not_save_cards: | You do not have access to this feature. For more information, - please contact us at: support@payplug.com + please contact us at: support@payplug.com bancontact: can_not_save_method_with_test_key: | The Bancontact payment method is not available for the TEST mode. @@ -18,7 +18,7 @@ payplug_sylius_payplug_plugin: can_not_save_method_no_access: | You don't have access to this feature yet. To activate Bancontact, please fill in - this form + this form and activate the LIVE mode. apple_pay: can_not_save_method_with_test_key: | @@ -26,7 +26,7 @@ payplug_sylius_payplug_plugin: can_not_save_method_no_access: | You don't have access to this feature yet. To activate Apple Pay, please fill in - this form + this form and activate the LIVE mode. american_express: can_not_save_method_with_test_key: | @@ -34,5 +34,5 @@ payplug_sylius_payplug_plugin: can_not_save_method_no_access: | You don't have access to this feature yet. To activate American Express, please fill in - this form + this form and activate the LIVE mode. diff --git a/src/Resources/translations/validators.fr.yml b/src/Resources/translations/validators.fr.yml index 7088c59e..a56c8b87 100644 --- a/src/Resources/translations/validators.fr.yml +++ b/src/Resources/translations/validators.fr.yml @@ -26,7 +26,7 @@ payplug_sylius_payplug_plugin: can_not_save_method_no_access: | Vous n'avez pas accès à cette fonctionnalité. Pour activer Apple Pay, rendez-vous sur - ce formulaire + ce formulaire et activez le mode LIVE. american_express: can_not_save_method_with_test_key: | @@ -34,5 +34,5 @@ payplug_sylius_payplug_plugin: can_not_save_method_no_access: | Vous n'avez pas accès à cette fonctionnalité. Pour activer American Express, rendez-vous sur - ce formulaire + ce formulaire et activez le mode LIVE. diff --git a/src/Resources/translations/validators.it.yml b/src/Resources/translations/validators.it.yml index f68b71a0..90eb31d8 100644 --- a/src/Resources/translations/validators.it.yml +++ b/src/Resources/translations/validators.it.yml @@ -18,7 +18,7 @@ payplug_sylius_payplug_plugin: can_not_save_method_no_access: | Non puoi ancora accedere a questa funzionalità. Per attivare Bancontact, compila - questo modulo + questo modulo e attiva la modalità LIVE. apple_pay: can_not_save_method_with_test_key: | @@ -26,7 +26,7 @@ payplug_sylius_payplug_plugin: can_not_save_method_no_access: | Non puoi ancora accedere a questa funzionalità. Per attivare Apple Pay, compila - questo modulo + questo modulo e attiva la modalità LIVE. american_express: can_not_save_method_with_test_key: | @@ -34,5 +34,5 @@ payplug_sylius_payplug_plugin: can_not_save_method_no_access: | Non puoi ancora accedere a questa funzionalità. Per attivare American Express, compila - questo modulo + questo modulo e attiva la modalità LIVE. diff --git a/src/Resources/views/SyliusShopBundle/_scripts.html.twig b/src/Resources/views/SyliusShopBundle/_scripts.html.twig deleted file mode 100644 index db8d4a8d..00000000 --- a/src/Resources/views/SyliusShopBundle/_scripts.html.twig +++ /dev/null @@ -1,3 +0,0 @@ -{% include '@SyliusUi/_javascripts.html.twig' with {'path': 'assets/shop/js/app.js'} %} -{% include '@SyliusUi/_javascripts.html.twig' with {'path': 'bundles/payplugsyliuspayplugplugin/assets/oney/payment/index.js'} %} - diff --git a/src/Resources/views/SyliusShopBundle/_styles.html.twig b/src/Resources/views/SyliusShopBundle/_styles.html.twig deleted file mode 100644 index 75c68235..00000000 --- a/src/Resources/views/SyliusShopBundle/_styles.html.twig +++ /dev/null @@ -1,2 +0,0 @@ -{% include '@SyliusUi/_stylesheets.html.twig' with {'path': 'assets/shop/css/style.css'} %} -{% include '@SyliusUi/_stylesheets.html.twig' with {'path': 'bundles/payplugsyliuspayplugplugin/assets/oney/payment/index.css'} %} diff --git a/src/Resources/views/javascripts/oney_common.html.twig b/src/Resources/views/javascripts/oney_common.html.twig index d40a7e8e..6370e61a 100644 --- a/src/Resources/views/javascripts/oney_common.html.twig +++ b/src/Resources/views/javascripts/oney_common.html.twig @@ -1 +1 @@ -{% include '@SyliusUi/_javascripts.html.twig' with {'path': 'bundles/payplugsyliuspayplugplugin/assets/oney/common/index.js'} %} +{% include '@SyliusUi/_javascripts.html.twig' with {'path': 'bundles/payplugsyliuspayplugplugin/assets/shop/oney_common/index.js'} %} diff --git a/src/Resources/views/javascripts/select_payment_js.html.twig b/src/Resources/views/javascripts/select_payment_js.html.twig new file mode 100644 index 00000000..84d44572 --- /dev/null +++ b/src/Resources/views/javascripts/select_payment_js.html.twig @@ -0,0 +1 @@ +{% include '@SyliusUi/_javascripts.html.twig' with {'path': 'bundles/payplugsyliuspayplugplugin/assets/shop/payment/index.js'} %} diff --git a/src/Resources/views/oney/cart/pay_with_oney.html.twig b/src/Resources/views/oney/cart/pay_with_oney.html.twig index e9dbc142..f22394dd 100644 --- a/src/Resources/views/oney/cart/pay_with_oney.html.twig +++ b/src/Resources/views/oney/cart/pay_with_oney.html.twig @@ -34,8 +34,8 @@ {% endfor %} {% endif %} - - + + - + {% endif %} diff --git a/src/Resources/views/oney/product/pay_with_oney.html.twig b/src/Resources/views/oney/product/pay_with_oney.html.twig index cc16e5b4..fc01aa50 100644 --- a/src/Resources/views/oney/product/pay_with_oney.html.twig +++ b/src/Resources/views/oney/product/pay_with_oney.html.twig @@ -23,8 +23,8 @@ data-popin-url="{{ path('payplug_sylius_oney_simulation_popin') }}"> - - + +
{% for variantCodes in sylius_product_variant_codes(product, sylius.channel) %}
diff --git a/src/Resources/views/stylesheets/oney_common.html.twig b/src/Resources/views/stylesheets/oney_common.html.twig index cee58d85..c55ea177 100644 --- a/src/Resources/views/stylesheets/oney_common.html.twig +++ b/src/Resources/views/stylesheets/oney_common.html.twig @@ -1 +1 @@ -{% include '@SyliusUi/_stylesheets.html.twig' with {'path': 'bundles/payplugsyliuspayplugplugin/assets/oney/common/index.css'} %} +{% include '@SyliusUi/_stylesheets.html.twig' with {'path': 'bundles/payplugsyliuspayplugplugin/assets/shop/oney_common/index.css'} %} diff --git a/src/Resources/views/stylesheets/payment_method_css.html.twig b/src/Resources/views/stylesheets/payment_method_css.html.twig new file mode 100644 index 00000000..a3a71c36 --- /dev/null +++ b/src/Resources/views/stylesheets/payment_method_css.html.twig @@ -0,0 +1 @@ +{% include '@SyliusUi/_stylesheets.html.twig' with {'path': 'bundles/payplugsyliuspayplugplugin/assets/admin/payment_method/index.css'} %} diff --git a/src/Resources/views/stylesheets/saved_cards.html.twig b/src/Resources/views/stylesheets/saved_cards.html.twig index c793b091..f027c015 100644 --- a/src/Resources/views/stylesheets/saved_cards.html.twig +++ b/src/Resources/views/stylesheets/saved_cards.html.twig @@ -1 +1 @@ -{% include '@SyliusUi/_stylesheets.html.twig' with {'path': 'bundles/payplugsyliuspayplugplugin/assets/oney/account/index.css'} %} \ No newline at end of file +{% include '@SyliusUi/_stylesheets.html.twig' with {'path': 'bundles/payplugsyliuspayplugplugin/assets/shop/account/index.css'} %} \ No newline at end of file diff --git a/src/Resources/views/stylesheets/select_payment_css.html.twig b/src/Resources/views/stylesheets/select_payment_css.html.twig new file mode 100644 index 00000000..55cfa340 --- /dev/null +++ b/src/Resources/views/stylesheets/select_payment_css.html.twig @@ -0,0 +1 @@ +{% include '@SyliusUi/_stylesheets.html.twig' with {'path': 'bundles/payplugsyliuspayplugplugin/assets/shop/payment/index.css'} %} diff --git a/tests/Behat/Context/Ui/Shop/CheckoutContext.php b/tests/Behat/Context/Ui/Shop/CheckoutContext.php index f10c5c2f..20ea7e36 100644 --- a/tests/Behat/Context/Ui/Shop/CheckoutContext.php +++ b/tests/Behat/Context/Ui/Shop/CheckoutContext.php @@ -57,10 +57,12 @@ public function iConfirmMyOrderWithPayPlugPayment(): void */ public function iSignInToPayPlugAndPaySuccessfully(): void { - $this->payPlugApiMocker->mockPayPlugApiGetGatewayFactoryName(function () { - $this->payPlugApiMocker->mockApiSuccessfulPayment(function () { - $this->paymentPage->notify(['id' => 1]); - $this->paymentPage->capture(); + $this->payPlugApiMocker->mockMultipleApiCancelledPayment(function () { + $this->payPlugApiMocker->mockPayPlugApiGetGatewayFactoryName(function () { + $this->payPlugApiMocker->mockApiSuccessfulPayment(function () { + $this->paymentPage->notify(['id' => 1]); + $this->paymentPage->capture(); + }); }); }); } @@ -70,7 +72,7 @@ public function iSignInToPayPlugAndPaySuccessfully(): void */ public function iHaveFailedPayPlugPayment() { - $this->payPlugApiMocker->mockApiCancelledPayment(function () { + $this->payPlugApiMocker->mockMultipleApiCancelledPayment(function () { $this->payPlugApiMocker->mockApiFailedPayment(function () { $this->paymentPage->notify(['id' => 1]); $this->paymentPage->capture(); @@ -84,7 +86,7 @@ public function iHaveFailedPayPlugPayment() */ public function iCancelMyPayPlugPayment(): void { - $this->payPlugApiMocker->mockApiCancelledPayment(function () { + $this->payPlugApiMocker->mockMultipleApiCancelledPayment(function () { $this->paymentPage->capture(['status' => PayPlugApiClientInterface::STATUS_CANCELED]); }); } @@ -115,7 +117,7 @@ public function PayPlugExpiredThePayment(): void */ public function iTryToPayAgainPayPlugPayment(): void { - $this->payPlugApiMocker->mockApiCancelledPayment(function () { + $this->payPlugApiMocker->mockMultipleApiCancelledPayment(function () { $this->payPlugApiMocker->mockPayPlugApiGetGatewayFactoryName(function () { $this->payPlugApiMocker->mockApiCreatePayment(function () { $this->orderDetails->pay(); diff --git a/tests/Behat/Mocker/PayPlugApiMocker.php b/tests/Behat/Mocker/PayPlugApiMocker.php index f79a569e..5911e536 100644 --- a/tests/Behat/Mocker/PayPlugApiMocker.php +++ b/tests/Behat/Mocker/PayPlugApiMocker.php @@ -157,6 +157,7 @@ public function mockApiFailedPayment(callable $action): void ->shouldReceive('initialise') ; $payment = \Mockery::mock('payment', Payment::class); + $payment->id = 'pay_1'; $payment->is_paid = false; $mock ->shouldReceive('treat') @@ -173,6 +174,7 @@ public function mockApiExpiredPayment(callable $action): void ->shouldReceive('initialise') ; $payment = \Mockery::mock('payment', Payment::class); + $payment->id = 'pay_1'; $payment->status = 'failure'; $payment->is_paid = false; $failure = new \stdClass(); @@ -213,12 +215,35 @@ public function mockApiCancelledPayment(callable $action): void ; $payment = \Mockery::mock('payment', Payment::class); + $payment->id = 'pay_1'; $payment->state = 'abort'; $payment->is_paid = false; $mock ->shouldReceive('abortPayment')->once() - ->withArgs(['123456']) + ->withArgs(['pay_1']) + ->andReturn($payment) + ; + + $action(); + $this->mocker->unmockAll(); + } + + public function mockMultipleApiCancelledPayment(callable $action): void + { + $mock = $this->mocker->mockService('payplug_sylius_payplug_plugin.api_client.payplug', PayPlugApiClientInterface::class); + $mock + ->shouldReceive('initialise') + ; + + $payment = \Mockery::mock('payment', Payment::class); + $payment->id = 'pay_1'; + $payment->state = 'abort'; + $payment->is_paid = false; + + $mock + ->shouldReceive('abortPayment') + ->withArgs(['pay_1']) ->andReturn($payment) ;