Skip to content

Commit

Permalink
fix gateways regression
Browse files Browse the repository at this point in the history
  • Loading branch information
kilbot committed Dec 20, 2023
1 parent 768fb15 commit 8db99ed
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
29 changes: 17 additions & 12 deletions includes/Gateways.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,13 @@ public function payment_gateways( array $gateways ) {
}

// All other cases, the default POS gateways are added
return array_merge($gateways, array(
'WCPOS\WooCommercePOS\Gateways\Cash',
'WCPOS\WooCommercePOS\Gateways\Card',
));
return array_merge(
$gateways,
array(
'WCPOS\WooCommercePOS\Gateways\Cash',
'WCPOS\WooCommercePOS\Gateways\Card',
)
);
}

/**
Expand All @@ -58,8 +61,7 @@ public function available_payment_gateways( ?array $gateways ): ?array {
}

// use POS settings
$settings_service = new Services\Settings();
$settings = $settings_service->get_payment_gateways_settings();
$settings = woocommerce_pos_get_settings( 'payment_gateways' );

// Get all payment gateways
$all_gateways = WC()->payment_gateways->payment_gateways;
Expand All @@ -75,9 +77,9 @@ public function available_payment_gateways( ?array $gateways ): ?array {
* There is an issue over-writing the description field because some gateways use this for info,
* eg: Account Funds uses it to show the current balance.
*/
// if ( isset( $settings['gateways'][ $gateway->id ]['description'] ) ) {
// $gateway->description = $settings['gateways'][ $gateway->id ]['description'];
// }
// if ( isset( $settings['gateways'][ $gateway->id ]['description'] ) ) {
// $gateway->description = $settings['gateways'][ $gateway->id ]['description'];
// }

$gateway->icon = '';
$gateway->enabled = 'yes';
Expand All @@ -88,9 +90,12 @@ public function available_payment_gateways( ?array $gateways ): ?array {
}

// Order the available gateways according to the settings
uksort( $_available_gateways, function ( $a, $b ) use ( $settings ) {
return $settings['gateways'][ $a ]['order'] <=> $settings['gateways'][ $b ]['order'];
});
uksort(
$_available_gateways,
function ( $a, $b ) use ( $settings ) {
return $settings['gateways'][ $a ]['order'] <=> $settings['gateways'][ $b ]['order'];
}
);

return $_available_gateways;
}
Expand Down
2 changes: 1 addition & 1 deletion includes/Services/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static function instance(): Auth {

/**
* Constructor is private to prevent direct instantiation.
* Or Settings::instance() instead.
* Or Auth::instance() instead.
*/
public function __construct() {
}
Expand Down

0 comments on commit 8db99ed

Please sign in to comment.