クラス
PayAndShip
Checkout review page for shipped
division item(s)
ソース ソース
ファイル: src/Views/CheckoutReview/PayAndShip/PayAndShip.php
class PayAndShip extends Container { /** * Amazon checkout details component instance * * @var AmazonCheckoutDetails */ private $checkoutDetailsComp; /** * Unloads `deliveryForm` component if an address error exists * * @author Evan D Shaw <evandanielshaw@gmail.com> * @param bool $load * @return bool */ protected function filterLoadDeliveryForm($load) { if (!empty($this->checkoutDetailsComp->getAddressError())) { return false; } return $load; } /** * Returns `AmazonCheckoutDetails` component with appropriate checkout session ID * * @author Evan D Shaw <evandanielshaw@gmail.com> * @return AmazonCheckoutDetails */ protected function getAmazonCheckoutDetailsComponent() { $this->checkoutDetailsComp = new AmazonCheckoutDetails($this->module, $_REQUEST['amazonCheckoutSessionId']); return $this->checkoutDetailsComp; } /** * Returns `PurchaseButton` component * * @author Evan D Shaw <evandanielshaw@gmail.com> * @return PurchaseButton */ protected function getPurchaseButtonComponent() { return new PurchaseButton('payandship', $this->module->getChargeType(), 'quickpay'); } /** * Includes `delivery_info_script.php` if no address error * * @author Evan D Shaw <evandanielshaw@gmail.com> * @return void */ protected function afterTemplateInclude() { if (empty($this->checkoutDetailsComp->getAddressError())) { wcexaap_include_delivery_info_script(); } } /** * Displays address error at top of page * * @author Evan D Shaw <evandanielshaw@gmail.com> * @param string $emessage * @return string */ public function filterTemplateTopErrorMessage($emessage) { if (!empty($this->checkoutDetailsComp->getAddressError())) { $emessage = $this->checkoutDetailsComp->getAddressErrorMessageBox( 'updateShippingAddressButton1', 'template-top' ); } return $emessage; } /** * Displays address error at bottom of page * * @author Evan D Shaw <evandanielshaw@gmail.com> * @param string $emessage * @return string */ public function filterTemplateBottomErrorMessage($emessage) { if (!empty($this->checkoutDetailsComp->getAddressError())) { $emessage = $this->checkoutDetailsComp->getAddressErrorMessageBox( 'updateShippingAddressButton2', 'template-bottom' ); } return $emessage; } /** * Binds address change to our custom address error buttons * * @author Evan D Shaw <evandanielshaw@gmail.com> * @return void */ protected function loadCustomAssets() { if (!empty($this->checkoutDetailsComp->getAddressError())) { (new ChangeActions($this->module))->load( $this->checkoutDetailsComp->getCheckoutSessionId(), ['updateShippingAddressButton1', 'updateShippingAddressButton2'] ); } } }
- afterTemplateInclude — Includes delivery_info_script.php if no address error
- filterLoadDeliveryForm — Unloads deliveryForm component if an address error exists
- filterTemplateBottomErrorMessage — Displays address error at bottom of page
- filterTemplateTopErrorMessage — Displays address error at top of page
- getAmazonCheckoutDetailsComponent — Returns AmazonCheckoutDetails component with appropriate checkout session ID
- getPurchaseButtonComponent — Returns PurchaseButton component
- loadCustomAssets — Binds address change to our custom address error buttons