- Complete mail-in payment gateway for Event Tickets Commerce - Support for check payments with collapsible checkout interface - Admin interface for managing check payments and order status - Professional asset organization with proper WordPress enqueuing - Order management with status tracking (pending, received, bounced) - Template system with responsive design and accessibility features - Integration with Event Tickets Commerce order system - Settings page for configuring payment instructions and addresses
124 lines
No EOL
5.2 KiB
PHP
124 lines
No EOL
5.2 KiB
PHP
<?php
|
|
/**
|
|
* Mail-In Payment checkout container template
|
|
*
|
|
* @since 1.0.0
|
|
* @var array $args Template arguments
|
|
* @var \ET_Mail_In_Payment\Gateway $gateway Gateway instance
|
|
* @var string $instructions Payment instructions
|
|
* @var string $mailing_address Mailing address
|
|
* @var string $payable_to Check payable to
|
|
*/
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit;
|
|
}
|
|
|
|
// Variables are extracted from $context in the Gateway class
|
|
// If not available directly, try to get from $args (fallback)
|
|
if ( ! isset( $gateway ) ) {
|
|
$gateway = $args['gateway'] ?? null;
|
|
}
|
|
if ( ! isset( $instructions ) ) {
|
|
$instructions = $args['instructions'] ?? '';
|
|
}
|
|
if ( ! isset( $mailing_address ) ) {
|
|
$mailing_address = $args['mailing_address'] ?? '';
|
|
}
|
|
if ( ! isset( $payable_to ) ) {
|
|
$payable_to = $args['payable_to'] ?? '';
|
|
}
|
|
|
|
// Get class name for static method calls
|
|
$gateway_class = $gateway ? get_class( $gateway ) : '';
|
|
?>
|
|
|
|
<div class="tribe-tickets-commerce-gateway-mail-in">
|
|
<!-- Toggle Button -->
|
|
<div class="tribe-tickets-commerce-gateway-mail-in__toggle">
|
|
<button type="button" id="mail-in-toggle-button" class="tribe-tickets-commerce-gateway-mail-in__toggle-button">
|
|
<span class="toggle-icon">▶</span>
|
|
<?php esc_html_e( 'Click here to pay by mail (check)', 'event-tickets-mail-in' ); ?>
|
|
</button>
|
|
</div>
|
|
|
|
<!-- Hidden Content (Payment Instructions and Form) -->
|
|
<div class="tribe-tickets-commerce-gateway-mail-in__content" id="mail-in-content" style="display: none;">
|
|
<div class="tribe-tickets-commerce-gateway-mail-in__header">
|
|
<h4><?php echo esc_html( $gateway_class ? $gateway_class::get_label() : __( 'Mail-In Payment', 'event-tickets-mail-in' ) ); ?></h4>
|
|
<p class="tribe-tickets-commerce-gateway-mail-in__description">
|
|
<?php echo esc_html( $gateway_class ? $gateway_class::get_description() : __( 'Pay by mailing a check', 'event-tickets-mail-in' ) ); ?>
|
|
</p>
|
|
</div>
|
|
|
|
<div class="tribe-tickets-commerce-gateway-mail-in__instructions">
|
|
<?php if ( $instructions ) : ?>
|
|
<div class="tribe-tickets-commerce-gateway-mail-in__instructions-text">
|
|
<strong><?php esc_html_e( 'Payment Instructions:', 'event-tickets-mail-in' ); ?></strong>
|
|
<p><?php echo wp_kses_post( nl2br( $instructions ) ); ?></p>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="tribe-tickets-commerce-gateway-mail-in__details">
|
|
<?php if ( $payable_to ) : ?>
|
|
<div class="tribe-tickets-commerce-gateway-mail-in__payable-to">
|
|
<strong><?php esc_html_e( 'Make Check Payable To:', 'event-tickets-mail-in' ); ?></strong>
|
|
<p class="tribe-tickets-commerce-gateway-mail-in__payable-to-name">
|
|
<?php echo esc_html( $payable_to ); ?>
|
|
</p>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if ( $mailing_address ) : ?>
|
|
<div class="tribe-tickets-commerce-gateway-mail-in__address">
|
|
<strong><?php esc_html_e( 'Mail Your Check To:', 'event-tickets-mail-in' ); ?></strong>
|
|
<div class="tribe-tickets-commerce-gateway-mail-in__address-block">
|
|
<?php echo wp_kses_post( nl2br( $mailing_address ) ); ?>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<div class="tribe-tickets-commerce-gateway-mail-in__important-note">
|
|
<strong><?php esc_html_e( 'Important Notes:', 'event-tickets-mail-in' ); ?></strong>
|
|
<ul>
|
|
<li><?php esc_html_e( 'Please include your order number in the check memo line.', 'event-tickets-mail-in' ); ?></li>
|
|
<li><?php esc_html_e( 'Your tickets will be reserved while we wait for your payment to arrive.', 'event-tickets-mail-in' ); ?></li>
|
|
<li><?php esc_html_e( 'You will receive a confirmation email once your payment is processed.', 'event-tickets-mail-in' ); ?></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Gateway Selection Form -->
|
|
<form class="tribe-tickets__commerce-checkout-form tribe-tickets__commerce-checkout-form--mail-in" method="post">
|
|
<?php wp_nonce_field( 'tec_tickets_commerce_checkout', 'tec_tickets_commerce_checkout_nonce' ); ?>
|
|
<input type="hidden" name="tec_tc_gateway" value="mail-in" />
|
|
|
|
<!-- Purchaser Information -->
|
|
<div class="tribe-tickets__commerce-checkout-purchaser-info">
|
|
<h4><?php esc_html_e( 'Contact Information', 'event-tickets-mail-in' ); ?></h4>
|
|
|
|
<div class="tribe-tickets__commerce-checkout-form-field">
|
|
<label for="purchaser_name"><?php esc_html_e( 'Full Name', 'event-tickets-mail-in' ); ?> <span class="required">*</span></label>
|
|
<input type="text" id="purchaser_name" name="purchaser_name" required class="tribe-common-form-control-text__input" />
|
|
</div>
|
|
|
|
<div class="tribe-tickets__commerce-checkout-form-field">
|
|
<label for="purchaser_email"><?php esc_html_e( 'Email Address', 'event-tickets-mail-in' ); ?> <span class="required">*</span></label>
|
|
<input type="email" id="purchaser_email" name="purchaser_email" required class="tribe-common-form-control-text__input" />
|
|
</div>
|
|
</div>
|
|
|
|
<div class="tribe-tickets__commerce-checkout-form-submit">
|
|
<button
|
|
id="tec-tc-gateway-mail-in-checkout-button"
|
|
type="submit"
|
|
class="tribe-common-c-btn tribe-tickets__commerce-checkout-form-submit-button"
|
|
data-gateway="mail-in"
|
|
>
|
|
<?php esc_html_e( 'Place Order (Pay by Check)', 'event-tickets-mail-in' ); ?>
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div> <!-- End .tribe-tickets-commerce-gateway-mail-in__content -->
|
|
</div>
|