Skip to content

Commit

Permalink
Add Pro support
Browse files Browse the repository at this point in the history
  • Loading branch information
vyskoczilova committed Oct 15, 2020
1 parent 42e5474 commit 9b1a982
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 7 deletions.
12 changes: 7 additions & 5 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://paypal.me/KarolinaVyskocilova
Tags: ecommerce, woocommerce, payment gateway, fee
Requires at least: 4.6
Tested up to: 5.5
Stable tag: 2.0.16
Stable tag: 2.0.17
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand All @@ -29,10 +29,9 @@ Requires at least WooCommerce 2.6, compatible with WooCommerce 3.2+ (recommended
- **Plugin API**. See [GitHub](https://github.com/vyskoczilova/woocommerce-payforpayment) for details.

= Compatibility =
- PHP 5.6 & PHP 7 compatible
- Compatibility with **WPML** (see [FAQ](https://wordpress.org/plugins/woocommerce-pay-for-payment#faq))
- Compatibility with **[WooCommerce Price Based on Country PRO](https://www.pricebasedcountry.com)** as stated [here](https://wordpress.org/support/topic/how-to-make-my-plugin-compatible/)
- Compatibility with **[Price Based on Country for WooCommerce](https://wordpress.org/plugins/woocommerce-product-price-based-on-countries/)**
- **WPML** (see [FAQ](https://wordpress.org/plugins/woocommerce-pay-for-payment#faq))
- [WooCommerce Price Based on Country for WooCommerce](https://wordpress.org/plugins/woocommerce-product-price-based-on-countries/) - free & PRO
- [Multi Currency for WooCommerce](https://wordpress.org/plugins/woo-multi-currency/) - free & PRO
- [WooCommerce Multi-Currency](https://woocommerce.com/products/multi-currency/) when the store currency is USD

= Limitations =
Expand Down Expand Up @@ -101,6 +100,9 @@ Either post it on [GitHub](https://github.com/vyskoczilova/woocommerce-payforpay

== Changelog ==

= 2.0.17 (2020-10-15) =
* Added compatibility with [Multi Currency for WooCommerce](https://wordpress.org/plugins/woo-multi-currency/)

= 2.0.16 (2020-08-10) =
* FIX: `Unsupported operand types` when adding settings to a payment (fixes Mercadopago fatal error)
* FIX: Escape tax related settings.
Expand Down
45 changes: 45 additions & 0 deletions inc/class-pay4pay-woo-multi-currency.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,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;
5 changes: 3 additions & 2 deletions woocommerce-payforpayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
Plugin Name: WooCommerce Pay for Payment
Plugin URI: https://kybernaut.cz/pluginy/woocommerce-pay-for-payment/
Description: Setup individual charges for each payment method in WooCommerce.
Version: 2.0.16
Version: 2.0.17
Author: Karolína Vyskočilová
Author URI: https://kybernaut.cz
License: GPL-2.0+
License URI: http://www.gnu.org/licenses/gpl-2.0.txt
Text Domain: woocommerce-pay-for-payment
Domain Path: /languages
WC requires at least: 2.6
WC tested up to: 4.3.1
WC tested up to: 4.4.0
*/

/**
Expand All @@ -35,6 +35,7 @@ function pay4payment_plugin_init() {
// Integrations.
include_once plugin_dir_path( __FILE__ ) . '/inc/class-pay4pay-price-based-country.php';
include_once plugin_dir_path( __FILE__ ) . '/inc/class-pay4pay-woocommerce-multicurrency.php';
include_once plugin_dir_path( __FILE__ ) . '/inc/class-pay4pay-woo-multi-currency.php';

if ( is_admin() )
require_once plugin_dir_path( __FILE__ ) . '/inc/class-pay4pay-admin.php';
Expand Down

0 comments on commit 9b1a982

Please sign in to comment.