Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
 into PFW-672
  • Loading branch information
kcppdevelopers committed Aug 20, 2020
2 parents f151355 + 9f9acb5 commit f5ca74f
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 45 deletions.
39 changes: 7 additions & 32 deletions angelleye-includes/angelleye-admin-order-payment-process.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class AngellEYE_Admin_Order_Payment_Process {
public $utility;
public $gateway_calculation;
public $gateway_settings;
public $confirm_order_id;

public function __construct() {
if (is_admin() && !defined('DOING_AJAX')) {
Expand Down Expand Up @@ -164,7 +165,7 @@ public function angelleye_admin_order_process_payment($post_id, $post) {

public function angelleye_admin_create_reference_order_action($order) {
$this->payment_method = version_compare( WC_VERSION, '3.0', '<' ) ? $order->payment_method : $order->get_payment_method();
if (in_array($this->payment_method, array('paypal_express', 'braintree', 'paypal_credit_card_rest', 'paypal_advanced', 'paypal_pro', 'paypal_pro_payflow'))) {
if (in_array($this->payment_method, array('paypal_express', 'paypal_pro', 'paypal_pro_payflow'))) {
$this->angelleye_admin_create_new_order($order);
}
remove_action('woocommerce_process_shop_order_meta', 'WC_Meta_Box_Order_Data::save', 40, 2);
Expand All @@ -178,18 +179,6 @@ public function angelleye_admin_order_process_payment_action($order) {
$this->angelleye_ec_pp_pf_reference_transaction($order);
}
break;
case 'braintree': {
$this->angelleye_braintree_reference_transaction($order);
}
break;
case 'paypal_credit_card_rest': {
$this->angelleye_paypal_credit_card_rest_reference_transaction($order);
}
break;
case 'paypal_advanced': {
$this->angelleye_paypal_advanced_reference_transaction($order);
}
break;
case 'paypal_pro': {
$this->angelleye_ec_pp_pf_reference_transaction($order);
}
Expand Down Expand Up @@ -330,7 +319,7 @@ public function angelleye_is_order_payment_method_selected($order) {

public function angelleye_is_admin_order_payment_method_available($order) {
$this->payment_method = version_compare( WC_VERSION, '3.0', '<' ) ? $order->payment_method : $order->get_payment_method();
if (in_array($this->payment_method, array('paypal_express', 'braintree', 'paypal_credit_card_rest', 'paypal_advanced', 'paypal_pro', 'paypal_pro_payflow'))) {
if (in_array($this->payment_method, array('paypal_express', 'paypal_pro', 'paypal_pro_payflow'))) {
return true;
} else {
return false;
Expand Down Expand Up @@ -393,14 +382,14 @@ public function angelleye_is_usable_reference_transaction_avilable($order) {
public function get_usable_reference_transaction($order) {
$this->payment_method = version_compare( WC_VERSION, '3.0', '<' ) ? $order->payment_method : $order->get_payment_method();
$user_id = $order->get_user_id();
if (in_array($this->payment_method, array('paypal_express', 'braintree', 'paypal_credit_card_rest', 'paypal_advanced', 'paypal_pro', 'paypal_pro_payflow'))) {
if (in_array($this->payment_method, array('paypal_express', 'paypal_pro', 'paypal_pro_payflow'))) {
return $this->angelleye_get_payment_token($user_id, $order);
}
}

public function angelleye_get_payment_token($user_id, $order) {
$this->payment_method = version_compare( WC_VERSION, '3.0', '<' ) ? $order->payment_method : $order->get_payment_method();
if (in_array($this->payment_method, array('paypal_pro', 'paypal_pro_payflow', 'paypal_advanced'))) {
if (in_array($this->payment_method, array('paypal_pro', 'paypal_pro_payflow'))) {
$order_transaction_ids = $this->angelleye_get_transaction_id_by_order_id($order);
if (!empty($order_transaction_ids)) {
return $order_transaction_ids;
Expand All @@ -413,9 +402,7 @@ public function angelleye_get_payment_token($user_id, $order) {
return $customer_billing_agreement_id;
}
return $this->angelleye_get_customer_or_order_tokens($user_id, $order);
} elseif (in_array($this->payment_method, array('braintree', 'paypal_credit_card_rest'))) {
return $this->angelleye_get_customer_or_order_tokens($user_id, $order);
}
}
}

public function angelleye_get_customer_or_order_tokens($user_id, $order) {
Expand Down Expand Up @@ -525,18 +512,6 @@ public function angelleye_load_payment_method_setting($order) {
$this->paypal = $this->utility->paypal;
}
break;
case 'braintree' : {

}
break;
case 'paypal_advanced': {

}
break;
case 'paypal_credit_card_rest': {

}
break;
}
}

Expand Down Expand Up @@ -586,7 +561,7 @@ public function angelleye_ec_pp_pf_reference_transaction($order) {

public function angelleye_reference_transaction_request_ec_pp_pf($order, $referenceid) {
$this->angelleye_load_calculation();
$order_id = version_compare(WC_VERSION, '3.0', '<') ? $order->id : $order->get_id();
$this->confirm_order_id = $order_id = version_compare(WC_VERSION, '3.0', '<') ? $order->id : $order->get_id();
$PayPalRequestData = array();
$DRTFields = array(
'referenceid' => $referenceid,
Expand Down
2 changes: 1 addition & 1 deletion classes/wc-gateway-braintree-angelleye.php
Original file line number Diff line number Diff line change
Expand Up @@ -2305,7 +2305,7 @@ public function angelleye_reload_gateway_credentials_for_woo_subscription_renewa
$order_id = version_compare(WC_VERSION, '3.0', '<') ? $order->id : $order->get_id();
if ($this->is_subscription($order_id)) {
foreach ($order->get_items() as $cart_item_key => $values) {
$product = $order->get_product_from_item($values);
$product = version_compare( WC_VERSION, '3.0', '<' ) ? $order->get_product_from_item( $values ) : $values->get_product();
$product_id = $product->get_id();
if (!empty($product_id)) {
$product_type = get_post_type($product_id);
Expand Down
2 changes: 1 addition & 1 deletion classes/wc-gateway-calculations-angelleye.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public function order_calculation($order_id) {
}
$desc = '';
foreach ($order->get_items() as $cart_item_key => $values) {
$product = $order->get_product_from_item($values);
$product = version_compare( WC_VERSION, '3.0', '<' ) ? $order->get_product_from_item( $values ) : $values->get_product();
$product_sku = null;
if (is_object($product)) {
$product_sku = $product->get_sku();
Expand Down
4 changes: 2 additions & 2 deletions classes/wc-gateway-paypal-advanced-angelleye.php
Original file line number Diff line number Diff line change
Expand Up @@ -1347,7 +1347,7 @@ public function create_reference_transaction($token, $order) {
if (sizeof($order->get_items()) > 0 && $order->get_subtotal() > 0) {
foreach ($order->get_items() as $item) {
if ($item['qty']) {
$product = $order->get_product_from_item($item);
$product = version_compare( WC_VERSION, '3.0', '<' ) ? $order->get_product_from_item( $item ) : $item->get_product();
$item_name = $item['name'];
$paypal_args['L_NAME' . $item_loop . '[' . strlen($item_name) . ']'] = $item_name;
if ($product->get_sku()) {
Expand Down Expand Up @@ -1553,7 +1553,7 @@ public function angelleye_reload_gateway_credentials_for_woo_subscription_renewa
$order_id = version_compare(WC_VERSION, '3.0', '<') ? $order->id : $order->get_id();
if( $this->is_subscription($order_id) ) {
foreach ($order->get_items() as $cart_item_key => $values) {
$product = $order->get_product_from_item($values);
$product = version_compare( WC_VERSION, '3.0', '<' ) ? $order->get_product_from_item( $values ) : $values->get_product();
$product_id = $product->get_id();
$product_type = get_post_type($product_id);
if($product_type == 'product_variation') {
Expand Down
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 @@ -380,7 +380,7 @@ public function angelleye_reload_gateway_credentials_for_woo_subscription_renewa
$order_id = version_compare(WC_VERSION, '3.0', '<') ? $order->id : $order->get_id();
if( $this->is_subscription($order_id) ) {
foreach ($order->get_items() as $cart_item_key => $values) {
$product = $order->get_product_from_item($values);
$product = version_compare( WC_VERSION, '3.0', '<' ) ? $order->get_product_from_item( $values ) : $values->get_product();
$product_id = $product->get_id();
if( !empty($product_id) ) {
$product_type = get_post_type($product_id);
Expand Down
2 changes: 1 addition & 1 deletion classes/wc-gateway-paypal-express-angelleye.php
Original file line number Diff line number Diff line change
Expand Up @@ -2729,7 +2729,7 @@ public function angelleye_reload_gateway_credentials_for_woo_subscription_renewa
$order_id = version_compare(WC_VERSION, '3.0', '<') ? $order->id : $order->get_id();
if( $this->is_subscription($order_id) ) {
foreach ($order->get_items() as $cart_item_key => $values) {
$product = $order->get_product_from_item($values);
$product = version_compare( WC_VERSION, '3.0', '<' ) ? $order->get_product_from_item( $values ) : $values->get_product();
$product_id = $product->get_id();
if( !empty($product_id) ) {
$product_type = get_post_type($product_id);
Expand Down
2 changes: 1 addition & 1 deletion classes/wc-gateway-paypal-pro-angelleye.php
Original file line number Diff line number Diff line change
Expand Up @@ -2091,7 +2091,7 @@ public function angelleye_reload_gateway_credentials_for_woo_subscription_renewa
$order_id = version_compare(WC_VERSION, '3.0', '<') ? $order->id : $order->get_id();
if( $this->is_subscription($order_id) ) {
foreach ($order->get_items() as $cart_item_key => $values) {
$product = $order->get_product_from_item($values);
$product = version_compare( WC_VERSION, '3.0', '<' ) ? $order->get_product_from_item( $values ) : $values->get_product();
$product_id = $product->get_id();
if( !empty($product_id) ) {
$product_type = get_post_type($product_id);
Expand Down
8 changes: 4 additions & 4 deletions paypal-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
* Plugin Name: PayPal for WooCommerce
* Plugin URI: http://www.angelleye.com/product/paypal-for-woocommerce-plugin/
* Description: Easily enable PayPal Express Checkout, PayPal Pro, PayPal Advanced, PayPal REST, and PayPal Braintree. Each option is available separately so you can enable them individually.
* Version: 2.3.4
* Version: 2.3.5
* Author: Angell EYE
* Author URI: http://www.angelleye.com/
* License: GNU General Public License v3.0
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
* Text Domain: paypal-for-woocommerce
* Domain Path: /i18n/languages/
* GitHub Plugin URI: https://github.com/angelleye/paypal-woocommerce
* Requires at least: 5.0
* Requires at least: 5.2
* Tested up to: 5.5
* WC requires at least: 3.0.0
* WC tested up to: 4.3.3
* WC tested up to: 4.4.1
*
*************
* Attribution
Expand All @@ -39,7 +39,7 @@
define('PAYPAL_FOR_WOOCOMMERCE_ASSET_URL', plugin_dir_url(__FILE__));
}
if (!defined('VERSION_PFW')) {
define('VERSION_PFW', '2.3.4');
define('VERSION_PFW', '2.3.5');
}
if ( ! defined( 'PAYPAL_FOR_WOOCOMMERCE_PLUGIN_FILE' ) ) {
define( 'PAYPAL_FOR_WOOCOMMERCE_PLUGIN_FILE', __FILE__ );
Expand Down
8 changes: 6 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Contributors: angelleye, angelleyesupport, Umangvaghela
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=SG9SQU2GBXJNA
Tags: woocommerce, paypal, express checkout, payments pro, angelleye, payflow, dodirectpayment, apple pay, google play, braintree, payments advanced, rest, credit cards, credit card payments, payments, payment
Requires at least: 5.0
Requires at least: 5.2
Tested up to: 5.5
Stable tag: 2.3.4
Stable tag: 2.3.5
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -127,6 +127,10 @@ Automatic updates should work great for you. As always, though, we recommend ba

== Changelog ==

= 2.3.5 - 08.20.2020 =
* Fix - Resolves a PHP error, Reference Transaction from admin side. ([PFW-674](https://github.com/angelleye/paypal-woocommerce/pull/1485))
* Tweak - Adds WooCommerce 4.4.0 Compatibility. ([PFW-675](https://github.com/angelleye/paypal-woocommerce/pull/1486))

= 2.3.4 - 08.17.2020 =
* Fix - Adds WooCommerce 3.6.3 Compatibility. ([PFW-673](https://github.com/angelleye/paypal-woocommerce/pull/1484))

Expand Down

0 comments on commit f5ca74f

Please sign in to comment.