クラス
ConfirmPageLogin
Confirm page html and checkout operations
ソース ソース
ファイル: src/Views/ConfirmPageLogin/ConfirmPageLogin.php
class ConfirmPageLogin extends ConfirmPageDI { /** * AmazonPay module instance * * @var AmazonPay */ protected $module; /** * Enqueues necessary assets for this View * * @author Evan D Shaw <evandanielshaw@gmail.com> * @return void */ public function onFeesSet() { wp_enqueue_style( 'checkout_review', WCEXAAP_PLUGIN_URL . '/src/Views/ConfirmPageLogin/ConfirmPageLogin.css', [], WCEXAAP_VERSION ); $theme = AmazonPay::getThemeConfig()['name']; if (file_exists(__DIR__ . '/ConfirmPage.' . $theme . '.css')) { wp_enqueue_style( 'wcexaap-confirmpage-' . $theme, WCEXAAP_PLUGIN_URL . '/src/Views/ConfirmPage/ConfirmPage.' . $theme . '.css', [], WCEXAAP_VERSION ); } $params = $this->getCheckoutParams(); (new Checkout($this->module))->load( $this->module->restRoutes->createQueryUrl($params['url']), 'Cart', $params['productType'] ); } /** * Returns create session URL for Amazon Pay checkout session * * @author Evan D Shaw <evandanielshaw@gmail.com> * @return string */ public function getCheckoutParams() { $chargetype = 'once'; $amzproducttype = 'PayAndShip'; if (defined('WCEX_DLSELLER')) { if (!dlseller_have_shipped()) { $amzproducttype = 'PayOnly'; } } // override Amazon address if Welcart address is preferred in settings $whichAddress = $this->module->getActingOpts()['address_priority']; if ($whichAddress === 'welcart') { $amzproducttype = 'PayOnly'; } $urlpt = strtolower($amzproducttype); return [ 'url' => "/checkout/welcart/{$urlpt}/{$chargetype}/createSession", 'productType' => $amzproducttype, ]; } /** * Displays Amazon Pay login button and widgets. * * @author Evan D Shaw <evandanielshaw@gmail.com> * @param string $html * @param array $payments * @param string $acting_flag * @param int $rand * @param string $purchase_disabled * @return string */ protected function filterConfirmPagePayButton($html, $payments, $acting_flag, $rand, $purchase_disabled) { /** * Mirrored Welcart filter * * @ignore */ $backbuttontext = apply_filters('usces_filter_confirm_prebutton_value', __('Back', 'usces')); ob_start(); ?> <!-- login container --> <div id="checkout_review"> <?php ob_start(); ?> <p class="note"> <?php /** * Filters the message text shown above the Amazon Pay button displayed on the Welcart 通常フロー 内容確認 page * * @important * @param string $text Default: 'Amazon Payでお支払いいただくには、下記のボタンからAmazonへログインしてください。' */ echo apply_filters( 'wcexaap_filter_confirm_page_login_note', esc_html__('To make a purchase with Amazon, click the button below and login.', 'wcexaap') ); ?> </p> <?php $note = ob_get_clean(); /** * Filters the message HTML shown above the Amazon Pay button displayed on the Welcart 通常フロー 内容確認 page * * @param string $note * @param \Aivec\Welcart\SettlementModules\AmazonPay\AmazonPay $module * @param array $payments * @param string $acting_flag * @param int $rand * @param string $purchase_disabled */ $note = apply_filters( 'wcexaap_filter_confirm_page_login_note_html', $note, $this->module, $payments, $acting_flag, $rand, $purchase_disabled ); echo $note; ?> <div class="login-btn-container"> <form action="<?php echo esc_url(USCES_CART_URL); ?>" method="post" onKeyDown="if (event.keyCode == 13) {return false;}" > <input name="backDelivery" type="submit" class="back_button" value="<?php echo esc_attr($backbuttontext); ?>" /> </form> <?php echo Checkout::getAmazonPayButton(); ?> </div> </div> <?php $html = ob_get_clean(); return $html; } }
- filterConfirmPagePayButton — Displays Amazon Pay login button and widgets.
- getCheckoutParams — Returns create session URL for Amazon Pay checkout session
- onFeesSet — Enqueues necessary assets for this View