| Conditions | 5 |
| Paths | 4 |
| Total Lines | 24 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 30 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 29 | public static function woocommerce_available_payment_gateways( $gateways ) { |
||
| 30 | // Do not filter gateways in admin. |
||
| 31 | if ( \is_admin() ) { |
||
| 32 | return $gateways; |
||
| 33 | } |
||
| 34 | |||
| 35 | // Check Santander gateway. |
||
| 36 | $santander_id = 'pronamic_pay_santander'; |
||
| 37 | |||
| 38 | if ( \array_key_exists( $santander_id, $gateways ) ) { |
||
| 39 | // Check MultiSafepay gateway. |
||
| 40 | $gateway = $gateways[ $santander_id ]; |
||
| 41 | |||
| 42 | $gateway_id = \get_post_meta( (int) $gateway->settings['config_id'], '_pronamic_gateway_id', true ); |
||
| 43 | |||
| 44 | $total = new Money( \WC()->cart->get_total( 'raw' ) ); |
||
|
|
|||
| 45 | |||
| 46 | // Unset gateway if cart amount minimum not met. |
||
| 47 | if ( 'multisafepay-connect' === $gateway_id && $total->get_value() < 250 ) { |
||
| 48 | unset( $gateways[ $santander_id ] ); |
||
| 49 | } |
||
| 50 | } |
||
| 51 | |||
| 52 | return $gateways; |
||
| 53 | } |
||
| 55 |