Skip to content

Commit

Permalink
Add control to see that correct currency is used through out the enti…
Browse files Browse the repository at this point in the history
…re order
  • Loading branch information
NiklasHogefjord committed Oct 29, 2021
1 parent 62b5fe4 commit a0e796e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/classes/class-bco-ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,11 @@ public static function bco_wc_update_checkout() {
// Set empty return array for errors.
$return = array();

// Check if we have a Billmate checkout hash.
if ( empty( $bco_wc_hash ) ) {
wc_add_notice( 'Billmate checkout hash is missing.', 'error' );
wp_send_json_error();
// Check if we have a Billmate checkout hash and that the currency is correct.
if ( empty( $bco_wc_hash ) || get_woocommerce_currency() !== WC()->session->get( 'bco_currency' ) ) {
bco_wc_unset_sessions();
$return['redirect_url'] = wc_get_checkout_url();
wp_send_json_error( $return );
wp_die();
} else {

Expand Down
2 changes: 1 addition & 1 deletion src/classes/class-bco-gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public function process_payment( $order_id ) {

// 1. Process the payment.
// 2. Redirect to confirmation page.
if ( $this->process_payment_handler( $order_id ) ) {
if ( get_woocommerce_currency() === WC()->session->get( 'bco_currency' ) && $this->process_payment_handler( $order_id ) ) {
$confirmation_url = add_query_arg(
array(
'bco_confirm' => 'yes',
Expand Down

0 comments on commit a0e796e

Please sign in to comment.