Skip to content

Commit

Permalink
Resolves merge conflict, ref #285
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Angell committed Aug 6, 2016
2 parents 05328df + 616795d commit dfe0d62
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
3 changes: 3 additions & 0 deletions angelleye-includes/angelleye-utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -1178,5 +1178,8 @@ public function angelleye_is_display_paypal_transaction_details($post_id) {
return false;
}
}
public static function is_valid_for_use() {
return in_array( get_woocommerce_currency(), apply_filters( 'paypal_for_woocommerce_supported_currencies', array( 'AUD', 'BRL', 'CAD', 'MXN', 'NZD', 'HKD', 'SGD', 'USD', 'EUR', 'JPY', 'NOK', 'CZK', 'DKK', 'HUF', 'ILS', 'MYR', 'PHP', 'PLN', 'SEK', 'CHF', 'TWD', 'THB', 'GBP' ) ) );
}

}
2 changes: 1 addition & 1 deletion classes/wc-gateway-paypal-credit-cards-rest-angelleye.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function __construct() {
$this->icon = apply_filters('woocommerce_braintree_icon', plugins_url('/assets/images/cards.png', plugin_basename(dirname(__FILE__))));
$this->has_fields = true;
$this->method_title = 'PayPal Credit Card (REST)';
$this->woocommerce_paypal_supported_currencies = array('AUD', 'BRL', 'CAD', 'CZK', 'DKK', 'EUR', 'HKD', 'HUF', 'ILS', 'JPY', 'MYR', 'MXN', 'TWD', 'NZD', 'NOK', 'PHP', 'PLN', 'GBP', 'RUB', 'SGD', 'SEK', 'CHF', 'THB', 'TRY', 'USD');
$this->woocommerce_paypal_supported_currencies = array( 'AUD', 'BRL', 'CAD', 'MXN', 'NZD', 'HKD', 'SGD', 'USD', 'EUR', 'JPY', 'NOK', 'CZK', 'DKK', 'HUF', 'ILS', 'MYR', 'PHP', 'PLN', 'SEK', 'CHF', 'TWD', 'THB', 'GBP' );
$this->method_description = __('PayPal direct credit card payments using the REST API. This allows you to accept credit cards directly on the site without the need for the full Payments Pro.', 'paypal-for-woocommerce');
$this->supports = array(
'products',
Expand Down
9 changes: 9 additions & 0 deletions classes/wc-gateway-paypal-express-angelleye.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ function is_available() {
if(!$this->is_express_checkout_credentials_is_set()) {
return false;
}
if(!AngellEYE_Utility::is_valid_for_use()) {
return false;
}
if( $this->show_on_checkout == 'regular' || $this->show_on_checkout == 'both') {
return true;
}
Expand Down Expand Up @@ -585,6 +588,9 @@ function checkout_message() {
if(!$this->is_express_checkout_credentials_is_set()) {
return false;
}
if(!AngellEYE_Utility::is_valid_for_use()) {
return false;
}
if (WC()->cart->total > 0) {
wp_enqueue_script('angelleye_button');
$payment_gateways = WC()->payment_gateways->get_available_payment_gateways();
Expand Down Expand Up @@ -2234,6 +2240,9 @@ static function woocommerce_before_cart() {
*/
static function woocommerce_paypal_express_checkout_button_angelleye() {
global $pp_settings;
if(!AngellEYE_Utility::is_valid_for_use()) {
return false;
}
if (@$pp_settings['enabled'] == 'yes' && (empty($pp_settings['show_on_cart']) || $pp_settings['show_on_cart'] == 'yes') && 0 < WC()->cart->total) {
if (empty($pp_settings['checkout_with_pp_button_type'])) {
$pp_settings['checkout_with_pp_button_type'] = 'paypalimage';
Expand Down
13 changes: 11 additions & 2 deletions paypal-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ public function __construct()
exit( __('PayPal for WooCommerce requires WooCommerce version 2.1 or higher. Please backup your site files and database, update WooCommerce, and try again.','paypal-for-woocommerce'));
}

require_once plugin_dir_path(__FILE__) . 'angelleye-includes/angelleye-utility.php';
$plugin_admin = new AngellEYE_Utility($this->plugin_slug, self::VERSION_PFW);
add_filter( 'woocommerce_paypal_args', array($this,'ae_paypal_standard_additional_parameters'));
add_action( 'plugins_loaded', array($this, 'init'));
register_activation_hook( __FILE__, array($this, 'activate_paypal_for_woocommerce' ));
Expand Down Expand Up @@ -108,8 +110,7 @@ public function __construct()
add_action( 'woocommerce_checkout_process', array( $this, 'angelleye_paypal_express_checkout_process_checkout_fields' ) );
add_filter('body_class', array($this, 'add_body_classes'));
add_action('http_api_curl', array($this, 'http_api_curl_ex_add_curl_parameter'), 10, 3);
require_once plugin_dir_path(__FILE__) . 'angelleye-includes/angelleye-utility.php';
$plugin_admin = new AngellEYE_Utility($this->plugin_slug, self::VERSION_PFW);

}

/*
Expand Down Expand Up @@ -269,6 +270,8 @@ function init(){
load_plugin_textdomain( 'paypal-for-woocommerce', FALSE, basename( dirname( __FILE__ ) ) . '/i18n/languages/' );
add_filter( 'woocommerce_payment_gateways', array($this, 'angelleye_add_paypal_pro_gateway'),1000 );
//remove_action( 'woocommerce_proceed_to_checkout', 'woocommerce_paypal_express_checkout_button', 12 );


if(AngellEYE_Utility::is_express_checkout_credentials_is_set()) {
if( isset($pp_settings['button_position']) && ($pp_settings['button_position'] == 'bottom' || $pp_settings['button_position'] == 'both')){
add_action( 'woocommerce_proceed_to_checkout', array( 'WC_Gateway_PayPal_Express_AngellEYE', 'woocommerce_paypal_express_checkout_button_angelleye'), 22 );
Expand Down Expand Up @@ -497,6 +500,9 @@ function woocommerce_paypal_express_review_order_page_angelleye() {
*/
function buy_now_button() {
global $pp_settings, $post, $product;
if(!AngellEYE_Utility::is_valid_for_use()) {
return false;
}
if(!AngellEYE_Utility::is_express_checkout_credentials_is_set()) {
return false;
}
Expand Down Expand Up @@ -576,6 +582,9 @@ function donate_message() {
}
function mini_cart_button(){
global $pp_settings, $pp_pro, $pp_payflow;
if(!AngellEYE_Utility::is_valid_for_use()) {
return false;
}
if(!AngellEYE_Utility::is_express_checkout_credentials_is_set()) {
return false;
}
Expand Down

0 comments on commit dfe0d62

Please sign in to comment.