-
Notifications
You must be signed in to change notification settings - Fork 12
/
class-pay4pay-woo-multi-currency.php
45 lines (38 loc) · 1.2 KB
/
class-pay4pay-woo-multi-currency.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/**
* Handle integration with WooCommerce Multi-Currency
*
* @see https://woocommerce.com/products/multi-currency/
* @package Pay4Pay
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Pay4Pay_Woo_Multi_Currency' ) ) :
/**
* * Pay4Pay_Woo_Multi_Currency Class
*/
class Pay4Pay_Woo_Multi_Currency {
/**
* Hook actions and filters
*/
public static function init() {
add_filter( 'woocommerce_pay4pay_charges_fixed', array( __CLASS__, 'get_converted_price' ) );
add_filter( 'woocommerce_pay4pay_charges_minimum', array( __CLASS__, 'get_converted_price' ) );
add_filter( 'woocommerce_pay4pay_charges_maximum', array( __CLASS__, 'get_converted_price' ) );
}
/**
* Return the gateway fee by the exchange rate.
*
* @param float $fee The gateway fee.
*/
public static function get_converted_price( $fee ) {
return wmc_get_price( $fee );
}
}
// Check PBoC version and init the integration.
if ( defined('WOOMULTI_CURRENCY_F_VERSION') && version_compare( WOOMULTI_CURRENCY_F_VERSION, '2.1.5', '>=' ) ||
defined('WOOMULTI_CURRENCY_VERSION') && version_compare(WOOMULTI_CURRENCY_VERSION, '2.1.9', '>=') ) {
Pay4Pay_Woo_Multi_Currency::init();
}
endif;