Originally Posted by
Spikenzie
Yes, all the captured amounts are now correct. Yay, thanks!
A side effect of this change that I noticed, but is no a big deal, on the admin side (and the note sent to Square) all transactions now say "Converted from: n.nn CAD" or "Converted from: n.nn USD" even when no conversion "math" is required (eg. CAD -> CAD).
Okay, looking again around line 274, let's test one more change, to get rid of the CAD->CAD message.
Add the extra condition, as shown, including the { } braces:
Code:
// force conversion to Square Account's currency:
if ($order->info['currency'] != $location->currency || $order->info['currency'] != DEFAULT_CURRENCY) {
global $currencies;
$payment_amount = round($order->info['total'] * $currencies->get_value($location->currency), 2);
$currency_code = $location->currency;
if ($order->info['currency'] != $location->currency) {
$this->currency_comment = '(Converted from: ' . round($order->info['total'] * $order->info['currency_value'], 2) . ' ' . $order->info['currency'] . ')';
}
// @TODO - if Square adds support for transmission of tax and shipping amounts, these may need recalculation here too
}
While you're at it, do you mind testing another optimization I'd like to use. Does this still give the same converted price correctly for the actual payment collected?
Code:
// force conversion to Square Account's currency:
if ($order->info['currency'] != $location->currency || $order->info['currency'] != DEFAULT_CURRENCY) {
global $currencies;
$payment_amount = $currencies->rateAdjusted($order->info['total'], true, $location->currency);
$currency_code = $location->currency;
if ($order->info['currency'] != $location->currency) {
$this->currency_comment = '(Converted from: ' . round($order->info['total'] * $order->info['currency_value'], 2) . ' ' . $order->info['currency'] . ')';
}
// @TODO - if Square adds support for transmission of tax and shipping amounts, these may need recalculation here too
}
Bookmarks