Skip to content

Instantly share code, notes, and snippets.

@rabinshr
Created May 6, 2014 00:22
Show Gist options
  • Save rabinshr/5d689f3fba218dfd3632 to your computer and use it in GitHub Desktop.
Save rabinshr/5d689f3fba218dfd3632 to your computer and use it in GitHub Desktop.
for($orderlines as $ol_id=>$ol_amount) {
if ($ol_amount <= $available) {
identify_and_add_refund_detail($refund_id, $ol_amount, $ol_id);
unset($orderlines[$ol_id]);
} else {
identify_and_add_refund_detail($refund_id, $available, $ol_id);
$leftover = $ol_amount - $available;
$orderlines[$ol_id] = $leftover;
}
$available -= $ol_amount;
if ($available <= 0) {
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment