Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/Issue-587' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Angell committed Dec 9, 2016
2 parents 0ac7e4f + a1584b5 commit b944006
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 26 deletions.
10 changes: 5 additions & 5 deletions angelleye-includes/angelleye-utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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' ) ) );
}
}
6 changes: 3 additions & 3 deletions angelleye-includes/paypal-rest-api-utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions classes/wc-gateway-paypal-advanced-angelleye.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 ) {
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions classes/wc-gateway-paypal-credit-cards-rest-angelleye.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
?>
<h3><?php echo (!empty($this->method_title) ) ? $this->method_title : __('Settings', 'paypal-for-woocommerce'); ?></h3>
<?php echo (!empty($this->method_description) ) ? wpautop($this->method_description) : ''; ?>
Expand Down Expand Up @@ -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;
Expand All @@ -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));
}

/**
Expand Down
10 changes: 5 additions & 5 deletions classes/wc-gateway-paypal-express-angelleye.php
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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' => '',
Expand Down
4 changes: 2 additions & 2 deletions classes/wc-gateway-paypal-pro-angelleye.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()]);
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions classes/wc-gateway-paypal-pro-payflow-angelleye.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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'=>'', //
Expand Down
4 changes: 2 additions & 2 deletions paypal-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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()) {
Expand Down

0 comments on commit b944006

Please sign in to comment.