diff --git a/admin/class-paypal-for-woocommerce-multi-account-management-admin-express-checkout.php b/admin/class-paypal-for-woocommerce-multi-account-management-admin-express-checkout.php index 13f20f9..a72e85e 100644 --- a/admin/class-paypal-for-woocommerce-multi-account-management-admin-express-checkout.php +++ b/admin/class-paypal-for-woocommerce-multi-account-management-admin-express-checkout.php @@ -49,6 +49,9 @@ class Paypal_For_Woocommerce_Multi_Account_Management_Admin_Express_Checkout { public $is_calculation_mismatch; public $final_refund_amt; public $send_items; + public $is_commission_enable; + public $global_ec_site_owner_commission; + public $global_ec_site_owner_commission_label; /** * Initialize the class and set its properties. @@ -62,7 +65,9 @@ public function __construct($plugin_name, $version) { $this->version = $version; $this->final_associate_account = array(); $this->map_item_with_account = array(); - + $this->is_commission_enable = false; + $this->global_ec_site_owner_commission = get_option('global_ec_site_owner_commission', 0); + $this->global_ec_site_owner_commission_label = get_option('global_ec_site_owner_commission_label', ''); $is_zdp_currency = in_array(get_woocommerce_currency(), $this->zdp_currencies); if ($is_zdp_currency) { $this->decimals = 0; @@ -294,7 +299,14 @@ public function angelleye_get_account_for_ec_parallel_payments($gateways, $gatew $this->map_item_with_account[$product_id]['multi_account_id'] = $value->ID; if (isset($microprocessing_array['ec_site_owner_commission'][0]) && !empty($microprocessing_array['ec_site_owner_commission'][0]) && $microprocessing_array['ec_site_owner_commission'][0] > 0) { $this->map_item_with_account[$product_id]['is_commission_enable'] = true; - $this->map_item_with_account[$product_id]['ec_site_owner_commission'] = $microprocessing_array['ec_site_owner_commission'][0]; + $this->is_commission_enable = true; + $this->map_item_with_account[$product_id]['ec_site_owner_commission_label'] = !empty($microprocessing_array['ec_site_owner_commission_label'][0]) ? $microprocessing_array['ec_site_owner_commission_label'][0] : __('Commission', 'paypal-for-woocommerce-multi-account-management'); + $this->map_item_with_account[$product_id]['ec_site_owner_commission'] = $microprocessing_array['ec_site_owner_commission'][0]; + } elseif($this->global_ec_site_owner_commission > 0) { + $this->map_item_with_account[$product_id]['is_commission_enable'] = true; + $this->is_commission_enable = true; + $this->map_item_with_account[$product_id]['ec_site_owner_commission_label'] = !empty($this->global_ec_site_owner_commission_label) ? $this->global_ec_site_owner_commission_label : __('Commission', 'paypal-for-woocommerce-multi-account-management'); + $this->map_item_with_account[$product_id]['ec_site_owner_commission'] = $this->global_ec_site_owner_commission; } else { $this->map_item_with_account[$product_id]['is_commission_enable'] = false; } @@ -385,9 +397,16 @@ public function angelleye_get_account_for_ec_parallel_payments($gateways, $gatew } } $this->map_item_with_account[$product_id]['multi_account_id'] = $value->ID; - if (isset($microprocessing_array['ec_site_owner_commission'][0]) && !empty($microprocessing_array['ec_site_owner_commission'][0]) && $microprocessing_array['ec_site_owner_commission'][0] > 0) { + if (isset($microprocessing_array['ec_site_owner_commission'][0]) && !empty($microprocessing_array['ec_site_owner_commission'][0]) && $microprocessing_array['ec_site_owner_commission'][0] > 0) { + $this->map_item_with_account[$product_id]['is_commission_enable'] = true; + $this->is_commission_enable = true; + $this->map_item_with_account[$product_id]['ec_site_owner_commission_label'] = !empty($microprocessing_array['ec_site_owner_commission_label'][0]) ? $microprocessing_array['ec_site_owner_commission_label'][0] : __('Commission', 'paypal-for-woocommerce-multi-account-management'); + $this->map_item_with_account[$product_id]['ec_site_owner_commission'] = $microprocessing_array['ec_site_owner_commission'][0]; + } elseif($this->global_ec_site_owner_commission > 0) { $this->map_item_with_account[$product_id]['is_commission_enable'] = true; - $this->map_item_with_account[$product_id]['ec_site_owner_commission'] = $microprocessing_array['ec_site_owner_commission'][0]; + $this->is_commission_enable = true; + $this->map_item_with_account[$product_id]['ec_site_owner_commission_label'] = !empty($this->global_ec_site_owner_commission_label) ? $this->global_ec_site_owner_commission_label : __('Commission', 'paypal-for-woocommerce-multi-account-management'); + $this->map_item_with_account[$product_id]['ec_site_owner_commission'] = $this->global_ec_site_owner_commission; } else { $this->map_item_with_account[$product_id]['is_commission_enable'] = false; } @@ -552,10 +571,12 @@ public function angelleye_modified_ec_parallel_parameter($request, $gateways, $o $default_shippingamt = 0; $default_taxamt = 0; $default_pal_id = ''; + $is_mismatch = false; if (!empty($order_id)) { $order = wc_get_order($order_id); $this->final_order_grand_total = $order->get_total(); foreach ($order->get_items() as $cart_item_key => $cart_item) { + $is_mismatch = false; $product = $order->get_product_from_item($cart_item); $product_exists = is_object( $product ); if($product_exists == false) { @@ -578,31 +599,66 @@ public function angelleye_modified_ec_parallel_parameter($request, $gateways, $o $sellerpaypalaccountid = $this->angelleye_get_email_address($this->map_item_with_account[$product_id], $gateways); } $this->map_item_with_account[$product_id]['sellerpaypalaccountid'] = $sellerpaypalaccountid; - $PaymentOrderItems = array(); $line_item = $this->angelleye_get_line_item_from_order($order, $cart_item); - $Item = array( - 'name' => $line_item['name'], - 'desc' => $line_item['desc'], - 'amt' => $line_item['amt'], - 'number' => $line_item['number'], - 'qty' => $line_item['qty'] - ); - $item_total = AngellEYE_Gateway_Paypal::number_format($item_total + ($line_item['amt'] * $line_item['qty'])); - array_push($PaymentOrderItems, $Item); + $item_total = AngellEYE_Gateway_Paypal::number_format($item_total + ($line_item['amt'] * $line_item['qty']), $order); if (!empty($this->discount_array[$product_id])) { + $item_total = $item_total - $this->discount_array[$product_id]; + } + $shippingamt = isset($this->shipping_array[$product_id]) ? $this->shipping_array[$product_id] : '0.00'; + $taxamt = isset($this->tax_array[$product_id]) ? $this->tax_array[$product_id] : '0.00'; + $final_total = AngellEYE_Gateway_Paypal::number_format($item_total + $shippingamt + $taxamt, $order); + $is_commission_not_enabled = false; + $PaymentOrderItems = array(); + if( isset($this->map_item_with_account[$product_id]['is_commission_enable']) && $this->map_item_with_account[$product_id]['is_commission_enable'] == true ) { + $is_commission_not_enabled = true; + $this->is_commission_enable = true; + $product_commission = AngellEYE_Gateway_Paypal::number_format( $item_total / 100 * $this->map_item_with_account[$product_id]['ec_site_owner_commission'], $order); + $default_final_total = $default_final_total + $product_commission; + $item_total = AngellEYE_Gateway_Paypal::number_format($item_total - $product_commission, $order); + $final_total = AngellEYE_Gateway_Paypal::number_format($final_total - $product_commission, $order); + $default_item_total = $default_item_total + $product_commission; + $Item = array( - 'name' => 'Discount', - 'desc' => 'Discount Amount', - 'amt' => isset($this->discount_array[$product_id]) ? '-' . AngellEYE_Gateway_Paypal::number_format($this->discount_array[$product_id]) : '0.00', + 'name' => $this->map_item_with_account[$product_id]['ec_site_owner_commission_label'], + 'desc' => $line_item['name'], + 'amt' => $product_commission, 'number' => '', 'qty' => 1 ); - $item_total = $item_total - $this->discount_array[$product_id]; + $default_new_payments_line_item[] = $Item; + if($item_total / $line_item['qty'] != AngellEYE_Gateway_Paypal::number_format($item_total / $line_item['qty'], $order)) { + $is_mismatch = true; + } + $Item = array( + 'name' => $line_item['name'], + 'desc' => $line_item['desc'], + 'amt' => AngellEYE_Gateway_Paypal::number_format($item_total / $line_item['qty'], $order), + 'number' => $line_item['number'], + 'qty' => $line_item['qty'] + ); + array_push($PaymentOrderItems, $Item); + } else { + if( !empty($line_item['amt'])) { + $Item = array( + 'name' => $line_item['name'], + 'desc' => $line_item['desc'], + 'amt' => $line_item['amt'], + 'number' => $line_item['number'], + 'qty' => $line_item['qty'] + ); + } array_push($PaymentOrderItems, $Item); + if (!empty($this->discount_array[$product_id])) { + $Item = array( + 'name' => 'Discount', + 'desc' => 'Discount Amount', + 'amt' => isset($this->discount_array[$product_id]) ? '-' . AngellEYE_Gateway_Paypal::number_format($this->discount_array[$product_id], $order) : '0.00', + 'number' => '', + 'qty' => 1 + ); + array_push($PaymentOrderItems, $Item); + } } - $shippingamt = isset($this->shipping_array[$product_id]) ? $this->shipping_array[$product_id] : '0.00'; - $taxamt = isset($this->tax_array[$product_id]) ? $this->tax_array[$product_id] : '0.00'; - $final_total = AngellEYE_Gateway_Paypal::number_format($item_total + $shippingamt + $taxamt); $custom_param = ''; if (isset($old_payments[0]['custom'])) { $custom_param = json_decode($old_payments[0]['custom'], true); @@ -632,9 +688,9 @@ public function angelleye_modified_ec_parallel_parameter($request, $gateways, $o 'sellerpaypalaccountid' => $sellerpaypalaccountid, 'paymentrequestid' => $cart_item_key . '-' . rand() ); - if( $this->send_items ) { + if( $this->send_items && $is_mismatch == false) { $Payment['order_items'] = $PaymentOrderItems; - $Payment['itemamt'] = AngellEYE_Gateway_Paypal::number_format($item_total); + $Payment['itemamt'] = AngellEYE_Gateway_Paypal::number_format($item_total, $order); $Payment['shippingamt'] = $shippingamt; $Payment['taxamt'] = $taxamt; } @@ -649,24 +705,28 @@ public function angelleye_modified_ec_parallel_parameter($request, $gateways, $o $default_pal_id = $sellerpaypalaccountid; $this->map_item_with_account[$product_id]['sellerpaypalaccountid'] = $sellerpaypalaccountid; $line_item = $this->angelleye_get_line_item_from_order($order, $cart_item); - $Item = array( - 'name' => $line_item['name'], - 'desc' => $line_item['desc'], - 'amt' => $line_item['amt'], - 'number' => $line_item['number'], - 'qty' => $line_item['qty'] - ); - $item_total = AngellEYE_Gateway_Paypal::number_format($item_total + ($line_item['amt'] * $line_item['qty'])); + $item_total = AngellEYE_Gateway_Paypal::number_format($item_total + ($line_item['amt'] * $line_item['qty']), $order); + if (!empty($this->discount_array[$product_id])) { + $item_total = $item_total - $this->discount_array[$product_id]; + } + if(!empty($line_item['amt'])) { + $Item = array( + 'name' => $line_item['name'], + 'desc' => $line_item['desc'], + 'amt' => $line_item['amt'], + 'number' => $line_item['number'], + 'qty' => $line_item['qty'] + ); + } $default_new_payments_line_item[] = $Item; if (!empty($this->discount_array[$product_id])) { $Item = array( 'name' => 'Discount', 'desc' => 'Discount Amount', - 'amt' => isset($this->discount_array[$product_id]) ? '-' . AngellEYE_Gateway_Paypal::number_format($this->discount_array[$product_id]) : '0.00', + 'amt' => isset($this->discount_array[$product_id]) ? '-' . AngellEYE_Gateway_Paypal::number_format($this->discount_array[$product_id], $order) : '0.00', 'number' => '', 'qty' => 1 ); - $item_total = $item_total - $this->discount_array[$product_id]; $default_new_payments_line_item[] = $Item; } $paymentrequestid_value = $cart_item_key . '-' . rand(); @@ -674,7 +734,7 @@ public function angelleye_modified_ec_parallel_parameter($request, $gateways, $o $default_shippingamt = $default_shippingamt + $shippingamt; $taxamt = isset($this->tax_array[$product_id]) ? $this->tax_array[$product_id] : '0.00'; $default_taxamt = $default_taxamt + $taxamt; - $default_final_total = $default_final_total + AngellEYE_Gateway_Paypal::number_format($item_total + $shippingamt + $taxamt); + $default_final_total = $default_final_total + AngellEYE_Gateway_Paypal::number_format($item_total + $shippingamt + $taxamt, $order); $default_item_total = $default_item_total + $item_total; $loop = $loop + 1; } @@ -686,6 +746,7 @@ public function angelleye_modified_ec_parallel_parameter($request, $gateways, $o foreach (WC()->cart->get_cart() as $cart_item_key => $cart_item) { $item_total = 0; $final_total = 0; + $is_mismatch = false; $product_id = $cart_item['product_id']; if (array_key_exists($product_id, $this->map_item_with_account)) { $multi_account_info = $this->map_item_with_account[$product_id]; @@ -697,34 +758,69 @@ public function angelleye_modified_ec_parallel_parameter($request, $gateways, $o } $PaymentOrderItems = array(); $line_item = $this->angelleye_get_line_item_from_cart($cart_item); - $Item = array( - 'name' => $line_item['name'], - 'desc' => $line_item['desc'], - 'amt' => $line_item['amt'], - 'number' => $line_item['number'], - 'qty' => $line_item['qty'] - ); $item_total = AngellEYE_Gateway_Paypal::number_format($item_total + ($line_item['amt'] * $line_item['qty'])); - array_push($PaymentOrderItems, $Item); if (!empty($this->discount_array[$product_id])) { + $item_total = $item_total - $this->discount_array[$product_id]; + } + $shippingamt = isset($this->shipping_array[$product_id]) ? $this->shipping_array[$product_id] : '0.00'; + $taxamt = isset($this->tax_array[$product_id]) ? $this->tax_array[$product_id] : '0.00'; + $final_total = AngellEYE_Gateway_Paypal::number_format($item_total + $shippingamt + $taxamt); + $is_commission_not_enabled = false; + if( isset($this->map_item_with_account[$product_id]['is_commission_enable']) && $this->map_item_with_account[$product_id]['is_commission_enable'] == true ) { + $is_commission_not_enabled = true; + $this->is_commission_enable = true; + $product_commission = AngellEYE_Gateway_Paypal::number_format( $item_total / 100 * $this->map_item_with_account[$product_id]['ec_site_owner_commission'], 2 ); + $default_final_total = $default_final_total + $product_commission; + $final_total = AngellEYE_Gateway_Paypal::number_format($final_total - $product_commission); + $item_total = AngellEYE_Gateway_Paypal::number_format($item_total - $product_commission); + $default_item_total = $default_item_total + $product_commission; + $Item = array( - 'name' => 'Discount', - 'desc' => 'Discount Amount', - 'amt' => isset($this->discount_array[$product_id]) ? '-' . AngellEYE_Gateway_Paypal::number_format($this->discount_array[$product_id]) : '0.00', + 'name' => $this->map_item_with_account[$product_id]['ec_site_owner_commission_label'], + 'desc' => $line_item['name'], + 'amt' => $product_commission, 'number' => '', 'qty' => 1 ); - $item_total = $item_total - $this->discount_array[$product_id]; + + $default_new_payments_line_item[] = $Item; + + if($item_total / $line_item['qty'] != AngellEYE_Gateway_Paypal::number_format($item_total / $line_item['qty'])) { + $is_mismatch = true; + } + + $Item = array( + 'name' => $line_item['name'], + 'desc' => $line_item['desc'], + 'amt' => AngellEYE_Gateway_Paypal::number_format($item_total / $line_item['qty']), + 'number' => $line_item['number'], + 'qty' => $line_item['qty'] + ); + array_push($PaymentOrderItems, $Item); + } else { + $Item = array( + 'name' => $line_item['name'], + 'desc' => $line_item['desc'], + 'amt' => $line_item['amt'], + 'number' => $line_item['number'], + 'qty' => $line_item['qty'] + ); array_push($PaymentOrderItems, $Item); + if (!empty($this->discount_array[$product_id])) { + $Item = array( + 'name' => 'Discount', + 'desc' => 'Discount Amount', + 'amt' => isset($this->discount_array[$product_id]) ? '-' . AngellEYE_Gateway_Paypal::number_format($this->discount_array[$product_id]) : '0.00', + 'number' => '', + 'qty' => 1 + ); + array_push($PaymentOrderItems, $Item); + } } - $shippingamt = isset($this->shipping_array[$product_id]) ? $this->shipping_array[$product_id] : '0.00'; - $taxamt = isset($this->tax_array[$product_id]) ? $this->tax_array[$product_id] : '0.00'; - $final_total = AngellEYE_Gateway_Paypal::number_format($item_total + $shippingamt + $taxamt); $this->final_grand_total = $this->final_grand_total + $final_total; $Payment = array( 'amt' => $final_total, 'currencycode' => isset($old_payments[0]['currencycode']) ? $old_payments[0]['currencycode'] : '', - 'custom' => isset($old_payments[0]['custom']) ? $old_payments[0]['custom'] : '', 'invnum' => isset($old_payments[0]['invnum']) ? $old_payments[0]['invnum'] : '', 'notifyurl' => isset($old_payments[0]['notifyurl']) ? $old_payments[0]['notifyurl'] : '', @@ -741,7 +837,7 @@ public function angelleye_modified_ec_parallel_parameter($request, $gateways, $o 'sellerpaypalaccountid' => $sellerpaypalaccountid, 'paymentrequestid' => isset($old_payments[0]['invnum']) ? $old_payments[0]['invnum'] : '' . $cart_item_key ); - if( $this->send_items ) { + if( $this->send_items && $is_mismatch == false) { $Payment['order_items'] = $PaymentOrderItems; $Payment['itemamt'] = AngellEYE_Gateway_Paypal::number_format($item_total); $Payment['shippingamt'] = $shippingamt; @@ -757,6 +853,10 @@ public function angelleye_modified_ec_parallel_parameter($request, $gateways, $o } $default_pal_id = $sellerpaypalaccountid; $line_item = $this->angelleye_get_line_item_from_cart($cart_item); + $item_total = AngellEYE_Gateway_Paypal::number_format($item_total + ($line_item['amt'] * $line_item['qty'])); + if (!empty($this->discount_array['$product_id'])) { + $item_total = $item_total - $this->discount_array[$product_id]; + } $Item = array( 'name' => $line_item['name'], 'desc' => $line_item['desc'], @@ -764,7 +864,6 @@ public function angelleye_modified_ec_parallel_parameter($request, $gateways, $o 'number' => $line_item['number'], 'qty' => $line_item['qty'] ); - $item_total = AngellEYE_Gateway_Paypal::number_format($item_total + ($line_item['amt'] * $line_item['qty'])); $default_new_payments_line_item[] = $Item; if (!empty($this->discount_array['$product_id'])) { $Item = array( @@ -774,7 +873,6 @@ public function angelleye_modified_ec_parallel_parameter($request, $gateways, $o 'number' => '', 'qty' => 1 ); - $item_total = $item_total - $this->discount_array[$product_id]; $default_new_payments_line_item[] = $Item; } $shippingamt = isset($this->shipping_array[$product_id]) ? $this->shipping_array[$product_id] : '0.00'; @@ -788,7 +886,11 @@ public function angelleye_modified_ec_parallel_parameter($request, $gateways, $o } } } - if (!empty($default_new_payments_line_item)) { + if ($default_final_total > 0) { + if( empty($default_pal_id) ) { + $map_item_with_account_array['multi_account_id'] = 'default'; + $default_pal_id = $this->angelleye_get_email_address($map_item_with_account_array, $gateways); + } $new_default_payment = array( 'amt' => AngellEYE_Gateway_Paypal::number_format($default_final_total), 'currencycode' => isset($old_payments[0]['currencycode']) ? $old_payments[0]['currencycode'] : '', @@ -810,13 +912,15 @@ public function angelleye_modified_ec_parallel_parameter($request, $gateways, $o ); $this->final_grand_total = $this->final_grand_total + $default_final_total; if( $this->send_items ) { - $new_default_payment['order_items'] = $default_new_payments_line_item; - $new_default_payment['itemamt'] = AngellEYE_Gateway_Paypal::number_format($default_item_total); - $new_default_payment['shippingamt'] = AngellEYE_Gateway_Paypal::number_format($default_shippingamt); - $new_default_payment['taxamt'] = AngellEYE_Gateway_Paypal::number_format($default_taxamt); + if( !empty($default_new_payments_line_item) ) { + $new_default_payment['order_items'] = $default_new_payments_line_item; + $new_default_payment['itemamt'] = AngellEYE_Gateway_Paypal::number_format($default_item_total); + $new_default_payment['shippingamt'] = AngellEYE_Gateway_Paypal::number_format($default_shippingamt); + $new_default_payment['taxamt'] = AngellEYE_Gateway_Paypal::number_format($default_taxamt); + } } array_push($new_payments, $new_default_payment); - } + } if ($this->final_grand_total != $this->final_order_grand_total) { $Difference = round($this->final_order_grand_total - $this->final_grand_total, $this->decimals); if (abs($Difference) > 0.000001 && 0.0 !== (float) $Difference) { @@ -1142,7 +1246,7 @@ public function own_angelleye_is_express_checkout_parallel_payment_not_used($boo public function own_angelleye_is_express_checkout_parallel_payment_handle($bool, $order_id, $gateway) { try { $processed_transaction_id = array(); - $refund_error_message_pre = __('We can not refund this order as the Express Checkout API keys are missing! Please go to multi-account setup and add API key to process the refund', ''); + $refund_error_message_pre = __('We can not refund this order as the Express Checkout API keys are missing! Please go to multi-account setup and add API key to process the refund', 'paypal-for-woocommerce-multi-account-management'); $refund_error_message_after = array(); $angelleye_multi_account_ec_parallel_data_map = get_post_meta($order_id, '_angelleye_multi_account_ec_parallel_data_map', true); foreach ($angelleye_multi_account_ec_parallel_data_map as $key => $value) { diff --git a/admin/class-paypal-for-woocommerce-multi-account-management-admin-paypal-standard.php b/admin/class-paypal-for-woocommerce-multi-account-management-admin-paypal-standard.php index b50252b..34d42e5 100644 --- a/admin/class-paypal-for-woocommerce-multi-account-management-admin-paypal-standard.php +++ b/admin/class-paypal-for-woocommerce-multi-account-management-admin-paypal-standard.php @@ -307,7 +307,7 @@ public function angelleye_woocommerce_paypal_refund_request($request, $order, $a $angelleye_multi_account_ec_parallel_data_map = get_post_meta($order_id, '_angelleye_multi_account_paypal_data_map', true); if (!empty($angelleye_multi_account_ec_parallel_data_map)) { if (empty($angelleye_multi_account_ec_parallel_data_map['is_api_set']) || $angelleye_multi_account_ec_parallel_data_map['is_api_set'] == false) { - return new WP_Error('invalid_refund', __('You can not refund this order, as the credentials are not present for the order', '')); + return new WP_Error('invalid_refund', __('You can not refund this order, as the credentials are not present for the order', 'paypal-for-woocommerce-multi-account-management')); } else { return $this->angelleye_set_api_details_refund($request, $angelleye_multi_account_ec_parallel_data_map); } diff --git a/admin/class-paypal-for-woocommerce-multi-account-management-admin.php b/admin/class-paypal-for-woocommerce-multi-account-management-admin.php index 3de771f..87eaeb4 100644 --- a/admin/class-paypal-for-woocommerce-multi-account-management-admin.php +++ b/admin/class-paypal-for-woocommerce-multi-account-management-admin.php @@ -111,7 +111,7 @@ public function angelleye_display_multi_account_list() { if ($this->gateway_key == 'paypal_express') { $microprocessing_new = array(); - $microprocessing_key_array = array('woocommerce_paypal_express_enable', 'woocommerce_paypal_express_testmode', 'woocommerce_paypal_express_account_name', 'woocommerce_paypal_express_sandbox_email', 'woocommerce_paypal_express_sandbox_api_username', 'woocommerce_paypal_express_sandbox_api_password', 'woocommerce_paypal_express_sandbox_api_signature', 'woocommerce_paypal_express_email', 'woocommerce_paypal_express_api_username', 'woocommerce_paypal_express_api_password', 'woocommerce_paypal_express_api_signature', 'woocommerce_paypal_express_api_condition_field', 'woocommerce_paypal_express_api_condition_sign', 'woocommerce_paypal_express_api_condition_value', 'woocommerce_paypal_express_api_user_role', 'woocommerce_paypal_express_api_product_ids', 'product_categories', 'product_tags', 'buyer_countries', 'woocommerce_priority', 'angelleye_multi_account_choose_payment_gateway', 'store_countries', 'currency_code', 'ec_site_owner_commission'); + $microprocessing_key_array = array('woocommerce_paypal_express_enable', 'woocommerce_paypal_express_testmode', 'woocommerce_paypal_express_account_name', 'woocommerce_paypal_express_sandbox_email', 'woocommerce_paypal_express_sandbox_api_username', 'woocommerce_paypal_express_sandbox_api_password', 'woocommerce_paypal_express_sandbox_api_signature', 'woocommerce_paypal_express_email', 'woocommerce_paypal_express_api_username', 'woocommerce_paypal_express_api_password', 'woocommerce_paypal_express_api_signature', 'woocommerce_paypal_express_api_condition_field', 'woocommerce_paypal_express_api_condition_sign', 'woocommerce_paypal_express_api_condition_value', 'woocommerce_paypal_express_api_user_role', 'woocommerce_paypal_express_api_product_ids', 'product_categories', 'product_tags', 'buyer_countries', 'woocommerce_priority', 'angelleye_multi_account_choose_payment_gateway', 'store_countries', 'currency_code', 'ec_site_owner_commission', 'ec_site_owner_commission_label'); foreach ($microprocessing_key_array as $key => $value) { $microprocessing_new[$value] = isset($microprocessing[$value]) ? $microprocessing[$value] : array(); @@ -152,6 +152,12 @@ public function angelleye_display_multi_account_list() { case 'woocommerce_paypal_express_api_signature': echo sprintf('
', __('API Signature', 'paypal-for-woocommerce-multi-account-management'), !empty($microprocessing_value[0]) ? $microprocessing_value[0] : ''); break; + case 'ec_site_owner_commission': + echo sprintf('
', __('Site Owner Commission %', 'paypal-for-woocommerce-multi-account-management'), !empty($microprocessing_value[0]) ? $microprocessing_value[0] : ''); + break; + case 'ec_site_owner_commission_label': + echo sprintf('
', __('Site Owner Commission Item Label', 'paypal-for-woocommerce-multi-account-management'), !empty($microprocessing_value[0]) ? $microprocessing_value[0] : ''); + break; case 'woocommerce_paypal_express_api_user_role': $selected_role = $microprocessing_value[0]; break; @@ -173,9 +179,6 @@ public function angelleye_display_multi_account_list() { case 'currency_code': $currency_code = empty($microprocessing_value[0]) ? '' : $microprocessing_value[0]; break; - case 'ec_site_owner_commission': - $ec_site_owner_commission = empty($microprocessing_value[0]) ? '' : $microprocessing_value[0]; - break; } } } else if ($this->gateway_key == 'paypal') { @@ -346,7 +349,7 @@ public function angelleye_display_multi_account_list() { $product_ids = maybe_unserialize($microprocessing['woocommerce_paypal_express_api_product_ids'][0]); } $option_seven = '

' . __('Buyer country', 'paypal-for-woocommerce-multi-account-management') . '

'; - $option_seven .= ''; $countries = WC()->countries->get_countries(); if(!isset($buyer_countries)) { $buyer_countries = array(); @@ -358,7 +361,7 @@ public function angelleye_display_multi_account_list() { } $option_seven .= ''; $option_fourteen = '

' . __('Store country', 'paypal-for-woocommerce-multi-account-management') . '

'; - $option_fourteen .= ''; if ($countries) { $store_countries = !empty($store_countries) ? $store_countries : ''; $option_fourteen .= ''; @@ -369,7 +372,7 @@ public function angelleye_display_multi_account_list() { $option_fourteen .= ''; $option_eight = '

' . apply_filters('angelleye_multi_account_display_category_label',__('Product categories', 'paypal-for-woocommerce-multi-account-management')) . '

'; - $option_eight .= ''; $categories = get_terms(apply_filters('angelleye_get_product_categories', array('product_cat')), array( 'hide_empty' => 1, @@ -392,7 +395,7 @@ public function angelleye_display_multi_account_list() { } $option_eight .= ''; $option_nine = '

' . __('Product tags', 'paypal-for-woocommerce-multi-account-management') . '

'; - $option_nine .= ''; if( empty($product_categories) ) { $tags = get_terms('product_tag', 'orderby=name&hide_empty=1'); if ($tags) { @@ -414,8 +417,8 @@ public function angelleye_display_multi_account_list() { $product_categories = array(); } $option_nine .= ''; - $option_six = '

' . apply_filters('angelleye_multi_account_display_products_label', __('Products', 'woocommerce')) . '

'; - $option_six .= ''; $product_list = $this->angelleye_get_list_product_using_tag_cat($product_tags, $product_categories); if (!empty($product_list)) { foreach ($product_list as $product_list_id => $product_list_name) { @@ -440,10 +443,6 @@ public function angelleye_display_multi_account_list() { } } $option_thirteen .= ''; - $option_thirteen .= '
'; - $option_thirteen .= '

' . __('Site Owner Commission % (percentage)', 'paypal-for-woocommerce-multi-account-management') .'

'; - $option_thirteen .= ''; - $option_thirteen .= '
'; if ($this->gateway_key == 'paypal_pro_payflow') { $option_twelve = '

' . __('Card Type', 'paypal-for-woocommerce-multi-account-management') . '

'; $option_twelve .= ' + + + + + + + + +
+ +
+ + + + + + +
+ + + +
+ + + + +