diff --git a/angelleye-includes/angelleye-utility.php b/angelleye-includes/angelleye-utility.php index dacb5fa38..1e3c1399b 100644 --- a/angelleye-includes/angelleye-utility.php +++ b/angelleye-includes/angelleye-utility.php @@ -251,7 +251,7 @@ public function pfw_do_capture($order, $transaction_id = null, $capture_total = $DataArray = array( 'AUTHORIZATIONID' => $transaction_id, 'AMT' => $AMT, - 'CURRENCYCODE' => get_woocommerce_currency(), + 'CURRENCYCODE' => $order->get_order_currency(), 'COMPLETETYPE' => 'NotComplete', ); $PayPalRequest = array( @@ -412,7 +412,7 @@ public function call_do_reauthorization($order) { $DRFields = array( 'authorizationid' => $transaction_id, // Required. The value of a previously authorized transaction ID returned by PayPal. 'amt' => $AMT, // Required. Must have two decimal places. Decimal separator must be a period (.) and optional thousands separator must be a comma (,) - 'currencycode' => get_woocommerce_currency(), // Three-character currency code. + 'currencycode' => $order->get_order_currency(), // Three-character currency code. 'msgsubid' => '' // A message ID used for idempotence to uniquely identify a message. ); $PayPalRequestData = array('DRFields' => $DRFields); @@ -484,7 +484,7 @@ public function call_do_authorization($order) { $DRFields = array( 'TRANSACTIONID' => $transaction_id, // Required. The value of a previously authorized transaction ID returned by PayPal. 'AMT' => $_POST['_regular_price'], // Required. Must have two decimal places. Decimal separator must be a period (.) and optional thousands separator must be a comma (,) - 'CURRENCYCODE' => get_woocommerce_currency() + 'CURRENCYCODE' => $order->get_order_currency() ); $PayPalRequestData = array('DAFields' => $DRFields); $do_authorization_result = $this->paypal->DoAuthorization($PayPalRequestData); @@ -1196,7 +1196,7 @@ 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' ) ) ); + public static function is_valid_for_use_paypal_express() { + return in_array( get_woocommerce_currency(), apply_filters( 'woocommerce_paypal_express_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' ) ) ); } } diff --git a/angelleye-includes/paypal-rest-api-utility.php b/angelleye-includes/paypal-rest-api-utility.php index 17051ee84..4fe24e6ea 100644 --- a/angelleye-includes/paypal-rest-api-utility.php +++ b/angelleye-includes/paypal-rest-api-utility.php @@ -192,7 +192,7 @@ public function set_item($order) { foreach ($this->payment_data['order_items'] as $item) { $this->item = new Item(); $this->item->setName($item['name']); - $this->item->setCurrency(get_woocommerce_currency()); + $this->item->setCurrency($order->get_order_currency()); $this->item->setQuantity($item['qty']); $this->item->setPrice($item['amt']); array_push($this->order_item, $this->item); @@ -229,7 +229,7 @@ public function set_detail_values() { */ public function set_amount_values($order) { $this->amount = new Amount(); - $this->amount->setCurrency(get_woocommerce_currency()); + $this->amount->setCurrency($order->get_order_currency()); $this->amount->setTotal($this->number_format($order->get_total(), $order)); $this->amount->setDetails($this->details); } @@ -461,7 +461,7 @@ public function payment_Refund($order_id, $amount = null, $reason = '') { } $sale = Sale::get($order->get_transaction_id(), $this->getAuth()); $this->amount = new Amount(); - $this->amount->setCurrency(get_woocommerce_currency()); + $this->amount->setCurrency($order->get_order_currency()); $this->amount->setTotal($this->number_format($amount, $order)); $refund = new Refund(); $refund->setAmount($this->amount); diff --git a/classes/wc-gateway-paypal-advanced-angelleye.php b/classes/wc-gateway-paypal-advanced-angelleye.php index 8f4ccd8b5..239a11099 100644 --- a/classes/wc-gateway-paypal-advanced-angelleye.php +++ b/classes/wc-gateway-paypal-advanced-angelleye.php @@ -419,7 +419,7 @@ function get_secure_token($order) { 'AMT' => number_format($order->get_total(), 2, '.', ''), 'FREIGHTAMT' => '', 'COMPANYNAME[' . strlen($order->billing_company) . ']' => $order->billing_company, - 'CURRENCY' => get_woocommerce_currency(), + 'CURRENCY' => $order->get_order_currency(), 'EMAIL' => $order->billing_email, 'BILLTOFIRSTNAME[' . strlen($order->billing_first_name) . ']' => $order->billing_first_name, 'BILLTOLASTNAME[' . strlen($order->billing_last_name) . ']' => $order->billing_last_name, @@ -629,7 +629,7 @@ public function is_available() { //if enabled checkbox is checked if ($this->enabled == 'yes') { - if (!in_array(get_woocommerce_currency(), apply_filters('woocommerce_paypal_advanced_allowed_currencies', array('USD', 'CAD')))) { + if (!in_array(get_woocommerce_currency(), apply_filters('woocommerce_paypal_advanced_supported_currencies', array('USD', 'CAD')))) { return false; } if (!$this->user || !$this->loginid ) { @@ -1092,7 +1092,7 @@ public function create_reference_transaction($token, $order) { 'AMT' => number_format($order->get_total(), 2, '.', ''), 'FREIGHTAMT' => '', 'COMPANYNAME[' . strlen($order->billing_company) . ']' => $order->billing_company, - 'CURRENCY' => get_woocommerce_currency(), + 'CURRENCY' => $order->get_order_currency(), 'EMAIL' => $order->billing_email, 'BILLTOFIRSTNAME[' . strlen($order->billing_first_name) . ']' => $order->billing_first_name, 'BILLTOLASTNAME[' . strlen($order->billing_last_name) . ']' => $order->billing_last_name, diff --git a/classes/wc-gateway-paypal-credit-cards-rest-angelleye.php b/classes/wc-gateway-paypal-credit-cards-rest-angelleye.php index 6035a6fb7..d05751ce5 100644 --- a/classes/wc-gateway-paypal-credit-cards-rest-angelleye.php +++ b/classes/wc-gateway-paypal-credit-cards-rest-angelleye.php @@ -66,7 +66,7 @@ public function init_form_fields() { * @since 1.2 */ public function admin_options() { - if ($this->is_valid_for_use()) { + if ($this->is_valid_for_use_paypal_credit_card_rest()) { ?>

method_title) ) ? $this->method_title : __('Settings', 'paypal-for-woocommerce'); ?>

method_description) ) ? wpautop($this->method_description) : ''; ?> @@ -112,7 +112,7 @@ public function is_available() { if (!$this->rest_client_id || !$this->rest_secret_id) { return false; } - if (!in_array(get_woocommerce_currency(), apply_filters('paypal_rest_api_supported_currencies', $this->woocommerce_paypal_supported_currencies))) { + if (!in_array(get_woocommerce_currency(), apply_filters('woocommerce_paypal_rest_api_supported_currencies', $this->woocommerce_paypal_supported_currencies))) { return false; } return true; @@ -135,8 +135,8 @@ public function payment_fields() { * @since 1.2 * @return type */ - public function is_valid_for_use() { - return in_array(get_woocommerce_currency(), apply_filters('paypal_rest_api_supported_currencies', $this->woocommerce_paypal_supported_currencies)); + public function is_valid_for_use_paypal_credit_card_rest() { + return in_array(get_woocommerce_currency(), apply_filters('woocommerce_paypal_rest_api_supported_currencies', $this->woocommerce_paypal_supported_currencies)); } /** diff --git a/classes/wc-gateway-paypal-express-angelleye.php b/classes/wc-gateway-paypal-express-angelleye.php index d5708a199..317aa31ef 100644 --- a/classes/wc-gateway-paypal-express-angelleye.php +++ b/classes/wc-gateway-paypal-express-angelleye.php @@ -221,7 +221,7 @@ function is_available() { if(!$this->is_express_checkout_credentials_is_set()) { return false; } - if(!AngellEYE_Utility::is_valid_for_use()) { + if(!AngellEYE_Utility::is_valid_for_use_paypal_express()) { return false; } if( $this->show_on_checkout == 'regular' || $this->show_on_checkout == 'both') { @@ -678,7 +678,7 @@ function checkout_message() { if(!$this->is_express_checkout_credentials_is_set()) { return false; } - if(!AngellEYE_Utility::is_valid_for_use()) { + if(!AngellEYE_Utility::is_valid_for_use_paypal_express()) { return false; } if (WC()->cart->total > 0) { @@ -2072,7 +2072,7 @@ function ConfirmPayment($FinalPaymentAmt) { $Payments = array(); $Payment = array( 'amt' => AngellEYE_Gateway_Paypal::number_format($FinalPaymentAmt), // Required. The total cost of the transaction to the customer. If shipping cost and tax charges are known, include them in this value. If not, this value should be the current sub-total of the order. - 'currencycode' => get_woocommerce_currency(), // A three-character currency code. Default is USD. + 'currencycode' => $order->get_order_currency(), // A three-character currency code. Default is USD. 'shippingdiscamt' => '', // Total shipping discount for this order, specified as a negative number. 'insuranceoptionoffered' => '', // If true, the insurance drop-down on the PayPal review page displays the string 'Yes' and the insurance amount. If true, the total shipping insurance for this order must be a positive number. 'handlingamt' => '', // Total handling costs for this order. If you specify HANDLINGAMT you mut also specify a value for ITEMAMT. @@ -2371,7 +2371,7 @@ static function woocommerce_before_cart() { */ static function woocommerce_paypal_express_checkout_button_angelleye() { global $pp_settings; - if(!AngellEYE_Utility::is_valid_for_use()) { + if(!AngellEYE_Utility::is_valid_for_use_paypal_express()) { return false; } if (@$pp_settings['enabled'] == 'yes' && (empty($pp_settings['show_on_cart']) || $pp_settings['show_on_cart'] == 'yes') && 0 < WC()->cart->total) { @@ -2783,7 +2783,7 @@ public function DoReferenceTransaction($order_id) { $PayPalRequestData['DRTFields'] = $DRTFields; $PaymentDetails = array( 'amt' => AngellEYE_Gateway_Paypal::number_format($order->order_total), // Required. Total amount of the order, including shipping, handling, and tax. - 'currencycode' => get_woocommerce_currency(), // A three-character currency code. Default is USD. + 'currencycode' => $order->get_order_currency(), // A three-character currency code. Default is USD. 'itemamt' => '', // Required if you specify itemized L_AMT fields. Sum of cost of all items in this order. 'shippingamt' => '', // Total shipping costs for this order. If you specify SHIPPINGAMT you mut also specify a value for ITEMAMT. 'insuranceamt' => '', diff --git a/classes/wc-gateway-paypal-pro-angelleye.php b/classes/wc-gateway-paypal-pro-angelleye.php index 70bbe433a..2648e3125 100644 --- a/classes/wc-gateway-paypal-pro-angelleye.php +++ b/classes/wc-gateway-paypal-pro-angelleye.php @@ -344,7 +344,7 @@ function is_available() if ($this->enabled == "yes") : if ($this->testmode == "no" && get_option('woocommerce_force_ssl_checkout') == 'no' && !class_exists('WordPressHTTPS')) return false; // Currency check - if (!in_array(get_woocommerce_currency(), apply_filters('woocommerce_paypal_pro_allowed_currencies', array('AUD', 'CAD', 'CZK', 'DKK', 'EUR', 'HUF', 'JPY', 'NOK', 'NZD', 'PLN', 'GBP', 'SGD', 'SEK', 'CHF', 'USD')))) return false; + if (!in_array(get_woocommerce_currency(), apply_filters('woocommerce_paypal_pro_supported_currencies', array('AUD', 'CAD', 'CZK', 'DKK', 'EUR', 'HUF', 'JPY', 'NOK', 'NZD', 'PLN', 'GBP', 'SGD', 'SEK', 'CHF', 'USD')))) return false; // Required fields check if (!$this->api_username || !$this->api_password || !$this->api_signature) return false; return isset($this->available_card_types[WC()->countries->get_base_country()]); @@ -848,7 +848,7 @@ function do_payment($order, $card_number, $card_type, $card_exp_month, $card_exp $PaymentDetails = array( 'amt' => AngellEYE_Gateway_Paypal::number_format($order->get_total()), // Required. Total amount of order, including shipping, handling, and tax. - 'currencycode' => get_woocommerce_currency(), // Required. Three-letter currency code. Default is USD. + 'currencycode' => $order->get_order_currency(), // Required. Three-letter currency code. Default is USD. 'insuranceamt' => '', // Total shipping insurance costs for this order. 'shipdiscamt' => '0.00', // Shipping discount for the order, specified as a negative number. 'handlingamt' => '0.00', // Total handling costs for the order. If you specify handlingamt, you must also specify itemamt. diff --git a/classes/wc-gateway-paypal-pro-payflow-angelleye.php b/classes/wc-gateway-paypal-pro-payflow-angelleye.php index 6a1e94bd0..ff6eee779 100644 --- a/classes/wc-gateway-paypal-pro-payflow-angelleye.php +++ b/classes/wc-gateway-paypal-pro-payflow-angelleye.php @@ -21,7 +21,7 @@ function __construct() { $this->has_fields = true; $this->liveurl = 'https://payflowpro.paypal.com'; $this->testurl = 'https://pilot-payflowpro.paypal.com'; - $this->allowed_currencies = apply_filters( 'woocommerce_paypal_pro_allowed_currencies', array( 'USD', 'EUR', 'GBP', 'CAD', 'JPY', 'AUD', 'NZD' ) ); + $this->allowed_currencies = apply_filters( 'woocommerce_paypal_pro_payflow_supported_currencies', array( 'USD', 'EUR', 'GBP', 'CAD', 'JPY', 'AUD', 'NZD' ) ); // Load the form fields $this->init_form_fields(); @@ -397,7 +397,7 @@ function do_payment( $order, $card_number, $card_exp, $card_csc, $centinelPAResS 'acct'=>$card_number, // Required for credit card transaction. Credit card or purchase card number. 'expdate'=>$card_exp, // Required for credit card transaction. Expiration date of the credit card. Format: MMYY 'amt'=> AngellEYE_Gateway_Paypal::number_format($order->get_total()), // Required. Amount of the transaction. Must have 2 decimal places. - 'currency'=>get_woocommerce_currency(), // + 'currency'=>$order->get_order_currency(), // 'dutyamt'=>'', // 'freightamt'=>'', // 'taxamt'=>'', // diff --git a/paypal-for-woocommerce.php b/paypal-for-woocommerce.php index 5c5fa129a..9b8808acf 100644 --- a/paypal-for-woocommerce.php +++ b/paypal-for-woocommerce.php @@ -494,7 +494,7 @@ function woocommerce_paypal_express_review_order_page_angelleye() { */ function buy_now_button() { global $pp_settings, $post, $product; - if(!AngellEYE_Utility::is_valid_for_use()) { + if(!AngellEYE_Utility::is_valid_for_use_paypal_express()) { return false; } if(!AngellEYE_Utility::is_express_checkout_credentials_is_set()) { @@ -576,7 +576,7 @@ function donate_message() { } function mini_cart_button(){ global $pp_settings, $pp_pro, $pp_payflow; - if(!AngellEYE_Utility::is_valid_for_use()) { + if(!AngellEYE_Utility::is_valid_for_use_paypal_express()) { return false; } if(!AngellEYE_Utility::is_express_checkout_credentials_is_set()) {