refactor: platform order show uses model receiptTotal
This commit is contained in:
@@ -49,16 +49,10 @@
|
|||||||
$refundReceiptsRaw = (array) (data_get($order->meta, 'refund_receipts', []) ?? []);
|
$refundReceiptsRaw = (array) (data_get($order->meta, 'refund_receipts', []) ?? []);
|
||||||
|
|
||||||
$receiptCount = (int) (data_get($order->meta, 'payment_summary.count') ?? 0);
|
$receiptCount = (int) (data_get($order->meta, 'payment_summary.count') ?? 0);
|
||||||
$receiptTotal = (float) (data_get($order->meta, 'payment_summary.total_amount') ?? 0);
|
$receiptTotal = (float) $order->receiptTotal();
|
||||||
if ($receiptCount <= 0) {
|
if ($receiptCount <= 0) {
|
||||||
$receiptCount = count($paymentReceiptsRaw);
|
$receiptCount = count($paymentReceiptsRaw);
|
||||||
}
|
}
|
||||||
if ($receiptTotal <= 0) {
|
|
||||||
$receiptTotal = 0.0;
|
|
||||||
foreach ($paymentReceiptsRaw as $r) {
|
|
||||||
$receiptTotal += (float) (data_get($r, 'amount') ?? 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$refundCount = (int) (data_get($order->meta, 'refund_summary.count') ?? 0);
|
$refundCount = (int) (data_get($order->meta, 'refund_summary.count') ?? 0);
|
||||||
$refundTotal = (float) $order->refundTotal();
|
$refundTotal = (float) $order->refundTotal();
|
||||||
|
|||||||
Reference in New Issue
Block a user