Skip to content

Commit

Permalink
Merge branch 'fix/63' into smoke-testing
Browse files Browse the repository at this point in the history
  • Loading branch information
dkotter committed Feb 26, 2024
2 parents c2831c6 + de14918 commit 31d8788
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
3 changes: 3 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
*** WooCommerce Square Changelog ***

= 4.5.1 - TBD =
* Fix - Issue with Square payment gateway being shown for unsupported currencies.

= 4.5.0 - 2024-01-31 =
* Add - Support for the Cash App Pay payment method.
* Dev - Added end-to-end (E2E) tests for the Cash App Pay payment method.
Expand Down
14 changes: 11 additions & 3 deletions includes/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -1203,17 +1203,25 @@ public function wc_ajax_square_checkout_handler() {
* @return array
*/
public function filter_available_gateways( $gateways ) {
$allowed_gateways = array();
$location_id = $this->get_plugin()->get_settings_handler()->get_location_id();

foreach ( $this->get_plugin()->get_settings_handler()->get_locations() as $location ) {
if ( $location_id === $location->getId() && get_woocommerce_currency() !== $location->getCurrency() ) {
unset( $gateways[ Plugin::GATEWAY_ID ] );
}
}

if ( ! Gift_Card::cart_contains_gift_card() ) {
return $gateways;
}

if ( array_key_exists( Plugin::GATEWAY_ID, $gateways ) ) {
$allowed_gateways[ Plugin::GATEWAY_ID ] = $gateways[ Plugin::GATEWAY_ID ];
return array( $gateways[ Plugin::GATEWAY_ID ] );
} else {
return array();
}

return $allowed_gateways;
return $gateways;
}

/**
Expand Down
3 changes: 3 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o

== Changelog ==

= 4.5.1 - TBD =
* Fix - Issue with Square payment gateway being shown for unsupported currencies.

= 4.5.0 - 2024-01-31 =
* Add - Support for the Cash App Pay payment method.
* Dev - Added end-to-end (E2E) tests for the Cash App Pay payment method.
Expand Down

0 comments on commit 31d8788

Please sign in to comment.