クラス
AmazonRedirectRouteGuards
Amazon route guards
ソース ソース
ファイル: src/Routing/AmazonRedirectRouteGuards.php
class AmazonRedirectRouteGuards { /** * Amazon Pay module object * * @var AmazonPay */ private $module; /** * Instantiates middleware * * @author Evan D Shaw <evandanielshaw@gmail.com> * @param AmazonPay $module */ public function __construct(AmazonPay $module) { $this->module = $module; } /** * Exits to home page if `amazonCheckoutSessionId` isn't in `$_REQUEST` * * @author Evan D Shaw <evandanielshaw@gmail.com> * @return Closure&#Function#1f4ed14 */ public function sessionIdExistsOrExit() { return function () { if (!isset($_REQUEST['amazonCheckoutSessionId'])) { header('location: ' . get_option('home')); exit; } else { $sessionId = $_REQUEST['amazonCheckoutSessionId']; $result = (new CheckoutSession\Get($this->module))->get($sessionId); if ($result instanceof GenericError) { header('location: ' . get_option('home')); exit; } } }; } }
- __construct — Instantiates middleware
- sessionIdExistsOrExit — Exits to home page if amazonCheckoutSessionId isn't in $_REQUEST