refactor: centralize receipt total logic on PlatformOrder
This commit is contained in:
@@ -62,13 +62,7 @@ class SiteSubscriptionController extends Controller
|
||||
foreach ($metaOrders as $o) {
|
||||
$meta = $o->meta ?? [];
|
||||
|
||||
$receiptTotal = (float) (data_get($meta, 'payment_summary.total_amount') ?? 0);
|
||||
if ($receiptTotal <= 0) {
|
||||
$receipts = (array) (data_get($meta, 'payment_receipts', []) ?? []);
|
||||
foreach ($receipts as $r) {
|
||||
$receiptTotal += (float) (data_get($r, 'amount') ?? 0);
|
||||
}
|
||||
}
|
||||
$receiptTotal = (float) $o->receiptTotal();
|
||||
|
||||
if ($receiptTotal > 0) {
|
||||
$receiptOrders++;
|
||||
|
||||
Reference in New Issue
Block a user