Skip to content

Commit

Permalink
Routes refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
lruozzi9 committed Aug 5, 2024
1 parent a966bea commit 669a018
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 14 deletions.
13 changes: 13 additions & 0 deletions config/shop_ajax_routing.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;

return static function (RoutingConfigurator $routes): void {
$routes->add('webgriffe_sylius_klarna_plugin_payment_status', '/payment/{paymentId}/klarna-status')
->controller(['webgriffe_sylius_klarna.controller.payment', 'statusAction'])
->methods(['GET'])
->requirements(['paymentId' => '\d+'])
;
};
10 changes: 1 addition & 9 deletions config/shop_routing.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,8 @@
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;

return static function (RoutingConfigurator $routes): void {
$routes->import('@PayumBundle/Resources/config/routing/cancel.xml');

$routes->add('webgriffe_sylius_klarna_plugin_payment_process', '/order/{tokenValue}/payment/process')
$routes->add('webgriffe_sylius_klarna_plugin_payment_process', '/order/{tokenValue}/payment/klarna-process')
->controller(['webgriffe_sylius_klarna.controller.payment', 'processAction'])
->methods(['GET'])
;

$routes->add('webgriffe_sylius_klarna_plugin_payment_status', '/payment/{paymentId}/status')
->controller(['webgriffe_sylius_klarna.controller.payment', 'statusAction'])
->methods(['GET'])
->requirements(['paymentId' => '\d+'])
;
};
5 changes: 0 additions & 5 deletions tests/Application/config/routes.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +0,0 @@
webgriffe_sylius_klarna_shop:
resource: "@WebgriffeSyliusKlarnaPlugin/config/shop_routing.php"
prefix: /{_locale}
requirements:
_locale: ^[a-z]{2}(?:_[A-Z]{2})?$
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
webgriffe_sylius_klarna_shop:
resource: "@WebgriffeSyliusKlarnaPlugin/config/shop_routing.php"
prefix: /{_locale}
requirements:
_locale: ^[A-Za-z]{2,4}(_([A-Za-z]{4}|[0-9]{3}))?(_([A-Za-z]{2}|[0-9]{3}))?$

webgriffe_sylius_klarna_plugin_ajax:
resource: "@WebgriffeSyliusKlarnaPlugin/config/shop_ajax_routing.php"

sylius_shop_payum_cancel:
resource: "@PayumBundle/Resources/config/routing/cancel.xml"

0 comments on commit 669a018

Please sign in to comment.