Skip to content

Commit

Permalink
Merge pull request #11 from angelleye/PFWMA-54
Browse files Browse the repository at this point in the history
ERROR with Payflow Authorization Options : PFWMA-54
  • Loading branch information
kcppdevelopers authored Jul 12, 2019
2 parents c71e2b0 + 41f33eb commit d1ff715
Showing 1 changed file with 101 additions and 28 deletions.
129 changes: 101 additions & 28 deletions admin/class-paypal-for-woocommerce-multi-account-management-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -982,38 +982,74 @@ public function angelleye_get_multi_account_by_order_total_latest($gateways, $ga
}
}
}
foreach (WC()->cart->get_cart() as $cart_item_key => $cart_item) {
$_product = apply_filters('woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key);
$product_id = apply_filters('woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key);
// Categories
$woo_product_categories = wp_get_post_terms($product_id, 'product_cat', array('fields' => 'ids'));
$product_categories = get_post_meta($value->ID, 'product_categories', true);
if (!empty($product_categories)) {
if (!array_intersect($product_categories, $woo_product_categories)) {
unset($result[$key]);
unset($passed_rules);
continue;
if (is_null(WC()->cart) && WC()->cart->is_empty()) {
foreach ($order->get_items() as $cart_item_key => $values) {
$product = $order->get_product_from_item($values);
$product_id = $product->get_id();
// Categories
$woo_product_categories = wp_get_post_terms($product_id, 'product_cat', array('fields' => 'ids'));
$product_categories = get_post_meta($value->ID, 'product_categories', true);
if (!empty($product_categories)) {
if (!array_intersect($product_categories, $woo_product_categories)) {
unset($result[$key]);
unset($passed_rules);
continue;
}
}
}
// Tags
$woo_product_tag = wp_get_post_terms($product_id, 'product_tag', array('fields' => 'ids'));
$product_tags = get_post_meta($value->ID, 'product_tags', true);
if (!empty($product_tags)) {
if (!array_intersect($product_tags, $woo_product_tag)) {
unset($result[$key]);
unset($passed_rules);
continue;
// Tags
$woo_product_tag = wp_get_post_terms($product_id, 'product_tag', array('fields' => 'ids'));
$product_tags = get_post_meta($value->ID, 'product_tags', true);
if (!empty($product_tags)) {
if (!array_intersect($product_tags, $woo_product_tag)) {
unset($result[$key]);
unset($passed_rules);
continue;
}
}
}
$product_ids = get_post_meta($value->ID, 'woocommerce_paypal_express_api_product_ids', true);
if (!empty($product_ids)) {
if (!array_intersect((array) $product_id, $product_ids)) {
unset($result[$key]);
unset($passed_rules);
continue;
$product_ids = get_post_meta($value->ID, 'woocommerce_paypal_express_api_product_ids', true);
if (!empty($product_ids)) {
if (!array_intersect((array) $product_id, $product_ids)) {
unset($result[$key]);
unset($passed_rules);
continue;
}
}
}
} else {
foreach (WC()->cart->get_cart() as $cart_item_key => $cart_item) {
$product_id = apply_filters('woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key);
// Categories
$woo_product_categories = wp_get_post_terms($product_id, 'product_cat', array('fields' => 'ids'));
$product_categories = get_post_meta($value->ID, 'product_categories', true);
if (!empty($product_categories)) {
if (!array_intersect($product_categories, $woo_product_categories)) {
unset($result[$key]);
unset($passed_rules);
continue;
}
}
// Tags
$woo_product_tag = wp_get_post_terms($product_id, 'product_tag', array('fields' => 'ids'));
$product_tags = get_post_meta($value->ID, 'product_tags', true);
if (!empty($product_tags)) {
if (!array_intersect($product_tags, $woo_product_tag)) {
unset($result[$key]);
unset($passed_rules);
continue;
}
}
$product_ids = get_post_meta($value->ID, 'woocommerce_paypal_express_api_product_ids', true);
if (!empty($product_ids)) {
if (!array_intersect((array) $product_id, $product_ids)) {
unset($result[$key]);
unset($passed_rules);
continue;
}
}
}
}


}
unset($passed_rules);
}
Expand Down Expand Up @@ -1217,6 +1253,12 @@ public function angelleye_paypal_for_woocommerce_multi_account_api_paypal_expres
$gateway_setting->paypal_password = $microprocessing_value['woocommerce_paypal_pro_payflow_sandbox_api_password'];
$gateway_setting->paypal_vendor = $microprocessing_value['woocommerce_paypal_pro_payflow_sandbox_api_paypal_vendor'];
$gateway_setting->paypal_partner = $microprocessing_value['woocommerce_paypal_pro_payflow_sandbox_api_paypal_partner'];
if(isset($request->paypal_user)) {
$request->paypal_user = $microprocessing_value['woocommerce_paypal_pro_payflow_sandbox_api_paypal_user'];
$request->paypal_password = $microprocessing_value['woocommerce_paypal_pro_payflow_sandbox_api_password'];
$request->paypal_vendor = $microprocessing_value['woocommerce_paypal_pro_payflow_sandbox_api_paypal_vendor'];
$request->paypal_partner = $microprocessing_value['woocommerce_paypal_pro_payflow_sandbox_api_paypal_partner'];
}
if (class_exists('WooCommerce') && WC()->session ) {
WC()->session->set('multi_account_api_username', $gateway_setting->paypal_user);
}
Expand All @@ -1227,6 +1269,11 @@ public function angelleye_paypal_for_woocommerce_multi_account_api_paypal_expres
$gateway_setting->api_username = $microprocessing_value['woocommerce_paypal_express_sandbox_api_username'];
$gateway_setting->api_password = $microprocessing_value['woocommerce_paypal_express_sandbox_api_password'];
$gateway_setting->api_signature = $microprocessing_value['woocommerce_paypal_express_sandbox_api_signature'];
if(isset($request->api_username)) {
$request->api_username = $microprocessing_value['woocommerce_paypal_express_sandbox_api_username'];
$request->api_password = $microprocessing_value['woocommerce_paypal_express_sandbox_api_password'];
$request->api_signature = $microprocessing_value['woocommerce_paypal_express_sandbox_api_signature'];
}
if (class_exists('WooCommerce') && WC()->session ) {
WC()->session->set('multi_account_api_username', $gateway_setting->api_username);
}
Expand All @@ -1239,6 +1286,12 @@ public function angelleye_paypal_for_woocommerce_multi_account_api_paypal_expres
$gateway_setting->api_username = $microprocessing_value['woocommerce_paypal_express_api_username'];
$gateway_setting->api_password = $microprocessing_value['woocommerce_paypal_express_api_password'];
$gateway_setting->api_signature = $microprocessing_value['woocommerce_paypal_express_api_signature'];
if(isset($request->paypal_user)) {
$request->paypal_user = $microprocessing_value['woocommerce_paypal_pro_payflow_api_paypal_user'];
$request->paypal_password = $microprocessing_value['woocommerce_paypal_pro_payflow_api_password'];
$request->paypal_vendor = $microprocessing_value['woocommerce_paypal_pro_payflow_api_paypal_vendor'];
$request->paypal_partner = $microprocessing_value['woocommerce_paypal_pro_payflow_sandbox_api_paypal_partner'];
}
if (class_exists('WooCommerce') && WC()->session ) {
WC()->session->set('multi_account_api_username', $gateway_setting->api_username);
}
Expand All @@ -1249,6 +1302,11 @@ public function angelleye_paypal_for_woocommerce_multi_account_api_paypal_expres
$gateway_setting->api_username = $microprocessing_value['woocommerce_paypal_express_api_username'];
$gateway_setting->api_password = $microprocessing_value['woocommerce_paypal_express_api_password'];
$gateway_setting->api_signature = $microprocessing_value['woocommerce_paypal_express_api_signature'];
if(isset($request->api_username)) {
$request->api_username = $microprocessing_value['woocommerce_paypal_express_api_username'];
$request->api_password = $microprocessing_value['woocommerce_paypal_express_api_password'];
$request->api_signature = $microprocessing_value['woocommerce_paypal_express_api_signature'];
}
if (class_exists('WooCommerce') && WC()->session ) {
WC()->session->set('multi_account_api_username', $gateway_setting->api_username);
}
Expand All @@ -1262,8 +1320,11 @@ public function angelleye_paypal_for_woocommerce_multi_account_api_paypal_expres
public function angelleye_paypal_for_woocommerce_multi_account_api_paypal_payflow($gateways, $request = null, $order_id = null) {
if ($request == null) {
$gateway_setting = $gateways;
} elseif($gateways == null) {
$gateways = $request;
$gateway_setting = $gateways;
} else {
$gateway_setting = $request;
$gateway_setting = $gateways;
}

if ($order_id == null) {
Expand Down Expand Up @@ -1291,6 +1352,12 @@ public function angelleye_paypal_for_woocommerce_multi_account_api_paypal_payflo
$gateway_setting->paypal_password = $microprocessing_value['woocommerce_paypal_pro_payflow_sandbox_api_password'];
$gateway_setting->paypal_vendor = $microprocessing_value['woocommerce_paypal_pro_payflow_sandbox_api_paypal_vendor'];
$gateway_setting->paypal_partner = $microprocessing_value['woocommerce_paypal_pro_payflow_sandbox_api_paypal_partner'];
if(isset($request->paypal_user)) {
$request->paypal_user = $microprocessing_value['woocommerce_paypal_pro_payflow_sandbox_api_paypal_user'];
$request->paypal_password = $microprocessing_value['woocommerce_paypal_pro_payflow_sandbox_api_password'];
$request->paypal_vendor = $microprocessing_value['woocommerce_paypal_pro_payflow_sandbox_api_paypal_vendor'];
$request->paypal_partner = $microprocessing_value['woocommerce_paypal_pro_payflow_sandbox_api_paypal_partner'];
}
if (class_exists('WooCommerce') && WC()->session ) {
WC()->session->set('multi_account_api_username', $gateway_setting->paypal_user);
}
Expand All @@ -1302,6 +1369,12 @@ public function angelleye_paypal_for_woocommerce_multi_account_api_paypal_payflo
$gateway_setting->paypal_password = $microprocessing_value['woocommerce_paypal_pro_payflow_api_password'];
$gateway_setting->paypal_vendor = $microprocessing_value['woocommerce_paypal_pro_payflow_api_paypal_vendor'];
$gateway_setting->paypal_partner = $microprocessing_value['woocommerce_paypal_pro_payflow_sandbox_api_paypal_partner'];
if(isset($request->paypal_user)) {
$request->paypal_user = $microprocessing_value['woocommerce_paypal_pro_payflow_api_paypal_user'];
$request->paypal_password = $microprocessing_value['woocommerce_paypal_pro_payflow_api_password'];
$request->paypal_vendor = $microprocessing_value['woocommerce_paypal_pro_payflow_api_paypal_vendor'];
$request->paypal_partner = $microprocessing_value['woocommerce_paypal_pro_payflow_sandbox_api_paypal_partner'];
}
if (class_exists('WooCommerce') && WC()->session ) {
WC()->session->set('multi_account_api_username', $gateway_setting->paypal_user);
}
Expand Down

0 comments on commit d1ff715

Please sign in to comment.