fix table bug
This commit is contained in:
@@ -70,15 +70,13 @@ class SingleOrderController extends Controller
|
||||
$data['all_price'] = $latestPrice;
|
||||
$data['price'] = $latestPrice->price;
|
||||
$data['price_id'] = $latestPrice->id;
|
||||
// $data['difference'] = config('fee.cash');
|
||||
$feeCash = Setting::where('key', 'fee_cash')->first();
|
||||
$feeServiceCharge = Setting::where('key', 'fee_service_charge_percentage')->first();
|
||||
if (!$feeCash || !$feeServiceCharge) {
|
||||
throw new UnprocessableEntityHttpException('تنظیمات کارمزد یافت نشد.');
|
||||
}
|
||||
$data['difference'] = $feeCash->value;
|
||||
// $data['service_charge_percentage'] = config('fee.service_charge_percentage');
|
||||
$data['service_charge_percentage'] = $feeServiceCharge->value;
|
||||
$data['difference'] = (float) $feeCash->value;
|
||||
$data['service_charge_percentage'] = (float) $feeServiceCharge->value;
|
||||
|
||||
$fee_free = Setting::where('key', 'fee_free')->where('is_active', true)->value('value');
|
||||
|
||||
@@ -151,12 +149,20 @@ class SingleOrderController extends Controller
|
||||
} else {
|
||||
// Calculate total price and fee for non-product (gold) transaction
|
||||
$data['total_price_original'] = $data['amount'] * ($data['price_original'] ?? 0);
|
||||
$data['total_fee'] = $data['amount'] * $data['difference'];
|
||||
$mainProductId = Cnt::where('key', 'main_product')->value('value');
|
||||
$data['product'] = $mainProductId ? Product::find($mainProductId) : null;
|
||||
$productId = $data['abshode_id'] ?? $data['product_id'] ?? $mainProductId;
|
||||
$data['product'] = $productId ? Product::find($productId) : null;
|
||||
if (!$data['product']) {
|
||||
throw new UnprocessableEntityHttpException('محصول آبشده یافت نشد.');
|
||||
}
|
||||
if ($data['direction'] == 1) {
|
||||
$data['difference'] = $data['product']['cash_fee_buy'];
|
||||
$data['service_charge_percentage'] = $data['product']['percent_fee_buy'];
|
||||
} elseif ($data['direction'] == 2) {
|
||||
$data['difference'] = $data['product']['cash_fee_sell'];
|
||||
$data['service_charge_percentage'] = $data['product']['percent_fee_sell'];
|
||||
}
|
||||
$data['total_fee'] = $data['amount'] * $data['difference'];
|
||||
$data['product_id'] = $data['product']->id;
|
||||
// Check if the user wants to buy
|
||||
if ($data['direction'] == 1) {
|
||||
@@ -172,7 +178,7 @@ class SingleOrderController extends Controller
|
||||
$response['sell'] = $this->processSellTransaction($data, $wallet, $wallet_interface);
|
||||
}
|
||||
}
|
||||
if (Setting::where('key', 'send_to_tahesab')->first()->value == "true") {
|
||||
if ($config->getString('send_to_tahesab', 'false') === 'true') {
|
||||
try {
|
||||
$tahesab = new TahesabController();
|
||||
$data['tahesab'] = $tahesab->storeTrade($data);
|
||||
|
||||
Reference in New Issue
Block a user