関数
AmazonCheckoutDetails::template()
Amazonチェックアウト詳細コンポーネントテンプレート
戻り値 戻り値
ファイル: src/Components/AmazonCheckoutDetails/AmazonCheckoutDetails.php
public function template() {
$details = $this->checkoutSessionDetails;
$payAndShip = $details['productType'] === 'PayAndShip';
$paymentDescriptor = $details['paymentPreferences'][0]['paymentDescriptor'];
$btnclass = AmazonPay::getThemeConfig()['btnprimary'];
/**
* Filters the CSS class name that wraps `amazon-checkout-details-component`
*
* @param string $classname Default: ''
*/
$wrapperClass = apply_filters('wcexaap_filter_amazon_checkout_details_wrapper_class', '');
$wrapperClass = !empty($wrapperClass) ? ' ' . $wrapperClass : '';
$entries = isset($_SESSION['usces_entry']) ? $_SESSION['usces_entry'] : [];
$customer = isset($entries['customer']) ? $entries['customer'] : [];
$propsAndEvents = [];
if ($this->controlledComponent === true) {
$propsAndEvents[] = 'v-bind:gift-shipping="giftShipping"';
$propsAndEvents[] = '@update-hard-decline-errors="updateHardDeclineErrors"';
} else {
$propsAndEvents[] = 'v-bind:gift-shipping="\'false\'"';
}
$allPropsAndEvents = join(' ', $propsAndEvents);
?>
<amazon-checkout-details-component
checkout-session-id="<?php echo $this->checkoutSessionId; ?>"
address-error="<?php echo $this->addressError; ?>"
v-bind:pay-and-ship="<?php echo $payAndShip ? 'true' : 'false'; ?>"
v-bind:logged-in="<?php echo usces_is_login() ? 'true' : 'false'; ?>"
<?php echo $allPropsAndEvents; ?>
inline-template
>
<div class="amazon-details-container<?php echo esc_attr($wrapperClass); ?>">
<?php ob_start(); ?>
<table id="confirm_table">
<template v-if="!hideCustomerInfo">
<tr class="ttl">
<td colspan="2"><h3><?php _e('Customer Information', 'usces'); ?></h3></td>
</tr>
<tr>
<th><?php _e('e-mail adress', 'usces'); ?></th>
<td><?php echo esc_html($customer['mailaddress1']); ?></td>
</tr>
</template>
<?php $this->confirmAddressTable($entries); ?>
<tr class="ttl">
<td colspan="2"><h3><?php _e('Others', 'usces'); ?></h3></td>
</tr>
<tr>
<th class="paymentMethod-th">
<div class="change-container">
<div><?php _e('payment method', 'usces'); ?></div>
<button
id="updatePaymentMethodButton"
class="ui mini <?php echo $btnclass; ?> button"
>
<?php _e('Change', 'wcexaap'); ?>
</button>
</div>
</th>
<td id="paymentMethodTd">
<img id="amazonPayLogo" src="<?php echo WCEXAAP_PLUGIN_URL . '/assets/logo-pay.png'; ?>" height="20px" />
<span><?php echo esc_html($paymentDescriptor); ?></span>
</td>
</tr>
</table>
<?php $vuehtml = ob_get_clean(); ?>
<?php
/**
* Filters the `amazon-checkout-details-component` Vue HTML
*
* @param string $vuehtml
* @param \Aivec\Welcart\SettlementModules\AmazonPay\Components\AmazonCheckoutDetails\AmazonCheckoutDetails $instance
* @param string $btnclass
* @param string $paymentDescriptor
*/
echo apply_filters('wcexaap_filter_amazon_checkout_details_component', $vuehtml, $this, $btnclass, $paymentDescriptor);
?>
</div>
</amazon-checkout-details-component>
<?php
}