diff --git a/stripe/controllers/FrmTransLiteActionsController.php b/stripe/controllers/FrmTransLiteActionsController.php index ad2d4355ee..ebe004130d 100755 --- a/stripe/controllers/FrmTransLiteActionsController.php +++ b/stripe/controllers/FrmTransLiteActionsController.php @@ -43,7 +43,8 @@ public static function actions_js() { 'frmtrans_admin', 'frm_trans_vars', array( - 'nonce' => wp_create_nonce( 'frm_trans_ajax' ), + 'nonce' => wp_create_nonce( 'frm_trans_ajax' ), + 'refunded' => FrmTransLiteAppHelper::show_status( 'refunded' ), ) ); } diff --git a/stripe/js/frmtrans_admin.js b/stripe/js/frmtrans_admin.js index 9e83c6574e..5502b89c8a 100755 --- a/stripe/js/frmtrans_admin.js +++ b/stripe/js/frmtrans_admin.js @@ -5,6 +5,10 @@ slideOpts( this, show, '.frm_trans_sub_opts' ); toggleOpts( this, ! show, '.frm_gateway_no_recur' ); + if ( ! show ) { + hideOtherGatewayRows( jQuery( this ).closest( '.frm_form_action_settings' ) ); + } + // Hiding the selected gateway would leave the tablist without a Tab stop. const tablist = this.closest( '.frm_form_action_settings' ).querySelector( '.frm-long-icon-buttons[role="tablist"]' ); if ( tablist ) { @@ -32,6 +36,18 @@ } } + function hideOtherGatewayRows( settings ) { + const selected = settings.find( 'input[name$="[gateway]"]:checked' ).val(); + + settings.find( '.frm_gateway_no_recur' ).each( + ( i, row ) => { + if ( /\bshow_(stripe|square|paypal)\b/.test( row.className ) && ! row.classList.contains( `show_${ selected }` ) ) { + row.style.display = 'none'; + } + } + ); + } + function toggleGateway() { const gateway = this.value; const { checked } = this; @@ -133,6 +149,11 @@ }, success( html ) { jQuery( loadingImage ).replaceWith( html ); + + const status = document.querySelector( '.frm-payment-status' ); + if ( status && href.includes( 'action=frm_trans_refund' ) && html.includes( 'frm_updated_message' ) ) { + status.textContent = frm_trans_vars.refunded; + } } } ); }; diff --git a/stripe/views/action-settings/capture-payments-upsell.php b/stripe/views/action-settings/capture-payments-upsell.php index a3e8cb5fd3..4ee84459a6 100755 --- a/stripe/views/action-settings/capture-payments-upsell.php +++ b/stripe/views/action-settings/capture-payments-upsell.php @@ -11,7 +11,7 @@ $upgrade_params ); -if ( isset( $selected_gateway ) && 'stripe' !== $selected_gateway ) { +if ( isset( $selected_gateway ) && ! in_array( 'stripe', (array) $selected_gateway, true ) ) { $wrapper_atts['style'] = 'display: none;'; } ?> diff --git a/stripe/views/payments/show.php b/stripe/views/payments/show.php index 3eeb19e518..ad1a904133 100755 --- a/stripe/views/payments/show.php +++ b/stripe/views/payments/show.php @@ -31,7 +31,7 @@