Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions assets/js/paystack.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ jQuery( function( $ ) {

let paystack_submit = false;

$( '#wc-paystack-form' ).hide();

wcPaystackFormHandler();

jQuery( '#paystack-payment-button' ).click( function() {
return wcPaystackFormHandler();
} );
Expand Down Expand Up @@ -138,6 +142,8 @@ jQuery( function( $ ) {

function wcPaystackFormHandler() {

$( '#wc-paystack-form' ).hide();

if ( paystack_submit ) {
paystack_submit = false;
return true;
Expand Down Expand Up @@ -197,6 +203,7 @@ jQuery( function( $ ) {
custom_fields: wcPaystackCustomFields(),
},
onClose: function() {
$( '#wc-paystack-form' ).show();
$( this.el ).unblock();
}
};
Expand Down
2 changes: 1 addition & 1 deletion assets/js/paystack.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions includes/class-wc-gateway-paystack.php
Original file line number Diff line number Diff line change
Expand Up @@ -1109,6 +1109,8 @@ public function receipt_page( $order_id ) {

$order = wc_get_order( $order_id );

echo '<div id="wc-paystack-form">';

echo '<p>' . __( 'Thank you for your order, please click the button below to pay with Paystack.', 'woo-paystack' ) . '</p>';

echo '<div id="paystack_form"><form id="order_review" method="post" action="' . WC()->api_request_url( 'WC_Gateway_Paystack' ) . '"></form><button class="button" id="paystack-payment-button">' . __( 'Pay Now', 'woo-paystack' ) . '</button>';
Expand All @@ -1117,6 +1119,8 @@ public function receipt_page( $order_id ) {
echo ' <a class="button cancel" id="paystack-cancel-payment-button" href="' . esc_url( $order->get_cancel_order_url() ) . '">' . __( 'Cancel order &amp; restore cart', 'woo-paystack' ) . '</a></div>';
}

echo '</div>';

}

/**
Expand Down