関数
RedirectRoutes::declareRoutes( WCEXAAP\Aivec\WordPress\Routing\WordPressRouteCollector $r )
Declares request key routes
パラメータ パラメータ
- $r
(WCEXAAP\Aivec\WordPress\Routing\WordPressRouteCollector) (必須)
ファイル: src/Routing/RedirectRoutes.php
public function declareRoutes(WordPressRouteCollector $r) { $login = new LoginWithAmazon($this->module); $r->addPublicRoute('GET', '/loginWithAmazon', [$login, 'memberPageLogin']); // Welcart normal checkout redirect routes $r->addGroup('/checkout/welcart', function (WordPressRouteCollector $r) { // middleware $middleware = new Middleware(); $amazonMiddleware = new AmazonMiddleware($this->module); // route guards $routeGuards = new RedirectRouteGuards($this->module, new RestRouteGuards($this->module)); $amazonRouteGuards = new AmazonRedirectRouteGuards($this->module); $r->addPublicRoute( ['POST', 'GET'], '/payandship/once/review', function () { (new Views\ConfirmPageReview\Factory())->getInstance($this->module)->init()->addHooks(); }, [ $amazonRouteGuards->sessionIdExistsOrExit(), $amazonMiddleware->putGetCheckoutSessionResponseInSession(), $amazonMiddleware->setDeliveryDataWithCheckoutSession(true), $middleware->updateWelcartEntries(), $routeGuards->addressCheck(), ] ); $r->addPublicRoute( ['POST', 'GET'], '/payonly/once/review', function () { (new Views\ConfirmPageReview\Factory())->getInstance($this->module)->init()->addHooks(); }, [ $amazonRouteGuards->sessionIdExistsOrExit(), $amazonMiddleware->putGetCheckoutSessionResponseInSession(), ] ); }); // QuickPay redirect routes $r->addGroup('/checkout/quickpay', function (WordPressRouteCollector $r) use ($login) { // handlers $payAndShipCartReview = (new Views\CheckoutReview\PayAndShip\Factory())->getInstance($this->module); $payOnlyCartReview = (new Views\CheckoutReview\PayOnly\Factory())->getInstance($this->module); $dlsellerLogin = (new Views\CustomerPage\Factory())->getInstance($this->module); // route guards $routeGuards = new RedirectRouteGuards($this->module, new RestRouteGuards($this->module)); $amazonRouteGuards = new AmazonRedirectRouteGuards($this->module); // middleware $middleware = new Middleware(); $amazonMiddleware = new AmazonMiddleware($this->module); $payAndShipOnceMiddlewares = [ $amazonRouteGuards->sessionIdExistsOrExit(), $routeGuards->cartNotEmptyOrExit(), $routeGuards->itemsInStockOrCartRedirect(), $login->loginWithAmazonCheckoutSession(), $amazonMiddleware->setPaymentMethodToAmazonPay(), $amazonMiddleware->putGetCheckoutSessionResponseInSession(), $amazonMiddleware->setCustomerDataWithCheckoutSession(true), $amazonMiddleware->setDeliveryDataWithCheckoutSession(), $middleware->updateWelcartEntries(), $routeGuards->addressCheck(), $middleware->updateFees(), $middleware->setOrderConditions(), $middleware->setMemberPoints(), $routeGuards->dlsellerLoginRedirect(), ]; $payOnlyOnceMiddlewares = [ $amazonRouteGuards->sessionIdExistsOrExit(), $routeGuards->cartNotEmptyOrExit(), $routeGuards->itemsInStockOrCartRedirect(), $login->loginWithAmazonCheckoutSession(), $amazonMiddleware->setPaymentMethodToAmazonPay(), $amazonMiddleware->putGetCheckoutSessionResponseInSession(), $amazonMiddleware->setCustomerDataWithCheckoutSession(false), $amazonMiddleware->payOnlyClearDeliverySession(), $middleware->updateWelcartEntries(), $middleware->updateFees(), $middleware->setOrderConditions(), $middleware->setMemberPoints(), $routeGuards->dlsellerLoginRedirect(), ]; $r->addPublicRoute( ['POST', 'GET'], '/dlsellerLogin', [$dlsellerLogin, 'loadPage'], [$routeGuards->quickPayRedirectOnLoginSuccess()] ); $r->addPublicRoute( ['POST', 'GET'], '/payandship/once/review', [$payAndShipCartReview, 'loadPage'], $payAndShipOnceMiddlewares ); $r->addPublicRoute( ['POST', 'GET'], '/payonly/once/review', [$payOnlyCartReview, 'loadPage'], $payOnlyOnceMiddlewares ); }); }