クラス
Middleware
Middleware functions for Welcart routes
ソース ソース
ファイル: src/Routing/Middleware.php
class Middleware { /** * Saves order acting data with `amazonCheckoutSessionId` * * @author Evan D Shaw <evandanielshaw@gmail.com> * @return Closure&#Function#5abe872d */ public function saveOrderActingData() { return function ($res, $args) { if ($res instanceof GenericError) { return $res; } // save order data preprocessing usces_save_order_acting_data($args['id']); return $res; }; } /** * Updates `$_SESSION['usces_entry']` * * @author Evan D Shaw <evandanielshaw@gmail.com> * @return Closure&#Function#bea97561 */ public function updateWelcartEntries() { return function () { (new API\WelcartEntries())->setEntry(); }; } /** * Updates price data * * @author Evan D Shaw <evandanielshaw@gmail.com> * @return Closure&#Function#66087043 */ public function updateFees() { return function () { (new API\Fees())->setFees(); }; } /** * Sets order condition if not yet set. Also sets reserve pre-order ID. * * @author Evan D Shaw <evandanielshaw@gmail.com> * @return Closure&#Function#90bb46d6 */ public function setOrderConditions() { return function () { global $usces; if (!$usces->cart->is_order_condition()) { $order_conditions = $usces->get_condition(); $usces->cart->set_order_condition($order_conditions); } $usces->set_reserve_pre_order_id(); }; } /** * Sets `$_SESSION['usces_member']['point']` with member points if member is logged in * and Welcart point system is turned on * * @author Evan D Shaw <evandanielshaw@gmail.com> * @return Closure&#Function#54f1ed46 */ public function setMemberPoints() { return function () { global $usces, $wpdb; if (usces_is_member_system() && usces_is_member_system_point() && $usces->is_member_logged_in()) { $member_table = $wpdb->prefix . 'usces_member'; $query = $wpdb->prepare( "SELECT mem_point FROM $member_table WHERE ID = %d", $_SESSION['usces_member']['ID'] ); $mem_point = $wpdb->get_var($query); $_SESSION['usces_member']['point'] = $mem_point; } }; } }
- saveOrderActingData — Saves order acting data with amazonCheckoutSessionId
- setMemberPoints — Sets $_SESSION['usces_member']['point'] with member points if member is logged in and Welcart point system is turned on
- setOrderConditions — Sets order condition if not yet set. Also sets reserve pre-order ID.
- updateFees — Updates price data
- updateWelcartEntries — Updates $_SESSION['usces_entry']