fix(copper): update conditional orders and accounting doc units to kilogram
This commit is contained in:
@@ -144,7 +144,7 @@ class ConditionalOrderController extends Controller
|
|||||||
$number = isset($data['number']) ? (float) $data['number'] : null;
|
$number = isset($data['number']) ? (float) $data['number'] : null;
|
||||||
|
|
||||||
if (! $partial && ($amount === null || $amount <= 0) && ($number === null || $number <= 0)) {
|
if (! $partial && ($amount === null || $amount <= 0) && ($number === null || $number <= 0)) {
|
||||||
throw new UnprocessableEntityHttpException('مقدار گرم یا تعداد را وارد کنید.');
|
throw new UnprocessableEntityHttpException('مقدار کیلوگرم یا تعداد را وارد کنید.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($data['expires_at'])) {
|
if (! empty($data['expires_at'])) {
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ class AccountingProductDocMapper
|
|||||||
'group_type' => (string) ($data['product']['group_type'] ?? 'آبشده'),
|
'group_type' => (string) ($data['product']['group_type'] ?? 'آبشده'),
|
||||||
'metal_id' => (int) ($data['product']['metal_id'] ?? 1),
|
'metal_id' => (int) ($data['product']['metal_id'] ?? 1),
|
||||||
'amount' => (float) ($data['product']['amount'] ?? 0),
|
'amount' => (float) ($data['product']['amount'] ?? 0),
|
||||||
'unit' => (string) ($data['product']['unit'] ?? 'گرم'),
|
'unit' => (string) ($data['product']['unit'] ?? 'کیلوگرم'),
|
||||||
'trade_by_quantity' => (bool) ($data['product']['trade_by_quantity'] ?? false),
|
'trade_by_quantity' => (bool) ($data['product']['trade_by_quantity'] ?? false),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ class ConditionalOrderService
|
|||||||
$payload['abshode_id'] = (int) $product->id;
|
$payload['abshode_id'] = (int) $product->id;
|
||||||
$payload['amount'] = (float) ($order->amount ?? 0);
|
$payload['amount'] = (float) ($order->amount ?? 0);
|
||||||
if ($payload['amount'] <= 0) {
|
if ($payload['amount'] <= 0) {
|
||||||
$this->markFailed($order, $currentPrice, 'مقدار گرم نامعتبر است');
|
$this->markFailed($order, $currentPrice, 'مقدار کیلوگرم نامعتبر است');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user