Skip to content

Commit

Permalink
Merge pull request #44 from angelleye/PFWMA-56
Browse files Browse the repository at this point in the history
LIVE API Active in PFW and same details in Multi-Account, PFWMA-56
  • Loading branch information
kcppdevelopers authored Mar 27, 2020
2 parents 4785ba1 + 5a0134c commit 488ed08
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -427,27 +427,6 @@ public function angelleye_get_multi_account_by_order_total($gateways, $gateway_s
}
}

public function angelleye_get_closest_amount($array, $value) {
$size = count($array);
$index_key = 0;
if ($size > 0) {
$diff = abs($array[0]['woocommerce_paypal_express_api_condition_value'] - $value);
$ret = $array[0]['woocommerce_paypal_express_api_condition_value'];
$index_key = 0;
for ($i = 1; $i < $size; $i) {
$temp = abs($array[$i]['woocommerce_paypal_express_api_condition_value'] - $value);
if ($temp < $diff) {
$diff = $temp;
$ret = $array[$i]['woocommerce_paypal_express_api_condition_value'];
$index_key = $i;
}
}
return $array[$index_key];
} else {
return array();
}
}

public function angelleye_paypal_for_woocommerce_multi_account_api_paypal_payflow($gateways, $request = null, $order_id = null) {
if ($request == null) {
$gateway_setting = $gateways;
Expand Down
21 changes: 21 additions & 0 deletions includes/angelleye-multi-account-function.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,24 @@ function angelleye_get_product_cat($categories) {
}
return $categories;
}

function angelleye_get_closest_amount($array, $value) {
$size = count($array);
$index_key = 0;
if ($size > 0) {
$diff = abs($array[0]['woocommerce_paypal_express_api_condition_value'] - $value);
$ret = $array[0]['woocommerce_paypal_express_api_condition_value'];
$index_key = 0;
for ($i = 1; $i < $size; $i++) {
$temp = abs($array[$i]['woocommerce_paypal_express_api_condition_value'] - $value);
if ($temp < $diff) {
$diff = $temp;
$ret = $array[$i]['woocommerce_paypal_express_api_condition_value'];
$index_key = $i;
}
}
return $array[$index_key];
} else {
return array();
}
}

0 comments on commit 488ed08

Please sign in to comment.