fix profit value after each order

This commit is contained in:
2026-07-18 16:38:46 +03:30
parent 45f2d8bf70
commit b66cd5e8f9
5 changed files with 56 additions and 6 deletions
@@ -176,6 +176,7 @@ class PargarInboundController extends Controller
// direction اپ: 1=خرید مشتری، 2=فروش مشتری
// OrderType پرگار از دید فروشگاه است: خرید مشتری = فروش فروشگاه (-1)، فروش مشتری = خرید فروشگاه (1)
$isCustomerBuy = (int) ($order->direction ?? 1) === 1;
$customerDirection = (int) ($order->direction ?? 0);
return [
'OrderId' => (string) $order->id,
@@ -192,7 +193,7 @@ class PargarInboundController extends Controller
'Weight' => (float) ($order->amount ?? 0),
'Price' => (float) ($order->total_price ?? 0),
'Carat' => 750,
'Description' => (string) ($order->description ?? ''),
'Description' => self::accountingShopTradeDesc($customerDirection, $this->isCartOrder($order)),
];
})->values();
@@ -481,7 +482,7 @@ class PargarInboundController extends Controller
}
return PargarSyncLog::where('order_id', $order->id)
->where('desc', 'سبد خرید')
->whereIn('desc', ['سبد خرید', 'فروش سبد به مشتری'])
->exists();
}
}