Skip to content

Commit

Permalink
Code Review tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
George Pattichis committed Jul 24, 2024
1 parent b660c16 commit b4b8057
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ Check out our extensive [knowledgebase](https://evnt.is/18wm) for articles on us

= [TBD] TBD =

* Fix - Ensure that users fill in all required billing address fields when Stripes advanced peyment methods are available. [ETP-934]
* Fix - Ensure that users fill in all required billing address fields when Stripe advanced payment methods are available. [ETP-934]
* Fix - Added missing global property for javascript undefined error `Uncaught TypeError: format is undefined`. This happened during ticket checkout.

= [5.13.0] 2024-07-22 =
Expand Down
4 changes: 2 additions & 2 deletions src/resources/js/commerce/gateway/stripe/checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -668,8 +668,8 @@ tribe.tickets.commerce.gateway.stripe.checkout = {};
* @since 5.3.0
*/
obj.bindEvents = () => {
$( obj.selectors.renderButton ).on( 'click', obj.renderPayment );
$( obj.selectors.submitButton ).on( 'click', obj.handlePayment );
$( document ).on( 'click', obj.selectors.renderButton, obj.renderPayment );
$( document ).on( 'click', obj.selectors.submitButton, obj.handlePayment );
};

/**
Expand Down
2 changes: 1 addition & 1 deletion src/views/v2/commerce/checkout/gateways.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
}

// Bail if user needs to login, but is not logged in.
if ( ! is_user_logged_in() && $must_login ) {
if ( $must_login && ! is_user_logged_in() ) {
return;
}

Expand Down
16 changes: 13 additions & 3 deletions src/views/v2/commerce/checkout/purchaser-info.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,28 @@
}

// Bail if user needs to login, but is not logged in.
if ( ! is_user_logged_in() && $must_login ) {
if ( $must_login && ! is_user_logged_in() ) {
return;
}

$info_title = __( 'Purchaser info', 'event-tickets' );
$show_address = false;
foreach ( $gateways as $gateway ) {
// Check if Stripe is active and enabled.
if ( 'stripe' === $gateway::get_key() && $gateway::is_enabled() && $gateway::is_active() ) {
if (
'stripe' === $gateway::get_key()
&& $gateway::is_enabled()
&& $gateway::is_active()
) {
$payment_methods = ( new TEC\Tickets\Commerce\Gateways\Stripe\Merchant() )->get_payment_method_types();
// If more than one payment method, or if only one but not a card, we need to show the address fields.
if ( 1 < count( $payment_methods ) || ( 1 === count( $payment_methods ) && 'card' !== $payment_methods[0] ) ) {
if (
1 < count( $payment_methods )
|| (
1 === count( $payment_methods )
&& 'card' !== $payment_methods[0]
)
) {
$info_title = __( 'Billing info', 'event-tickets' );
$show_address = true;
}
Expand Down

0 comments on commit b4b8057

Please sign in to comment.