NASER add setting controller & dynamic fee in settings & add send transactions to tahesab in settings
This commit is contained in:
@@ -21,6 +21,7 @@ use Rooyesh\Wallet\models\Wallet;
|
||||
use App\Models\TransactionsAdmin;
|
||||
use Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use App\Models\Setting;
|
||||
|
||||
|
||||
class SingleOrderController extends Controller
|
||||
@@ -36,8 +37,10 @@ class SingleOrderController extends Controller
|
||||
$data['all_price'] = $latestPrice;
|
||||
$data['price'] = $latestPrice->price;
|
||||
$data['price_id'] = $latestPrice->id;
|
||||
$data['difference'] = config('fee.cash');
|
||||
$data['service_charge_percentage'] = config('fee.service_charge_percentage');
|
||||
// $data['difference'] = config('fee.cash');
|
||||
$data['difference'] = Setting::where('key', 'fee_cash')->first()->value;
|
||||
// $data['service_charge_percentage'] = config('fee.service_charge_percentage');
|
||||
$data['service_charge_percentage'] = Setting::where('key', 'fee_service_charge_percentage')->first()->value;
|
||||
$data['pay_at'] = (new \DateTime())->format('Y-m-d H:i:s');
|
||||
} else if (auth('user')->id()) {//admin
|
||||
$data['service_charge_percentage'] = 0;
|
||||
@@ -103,13 +106,14 @@ class SingleOrderController extends Controller
|
||||
$response['sell'] = $this->processSellTransaction($data, $wallet, $wallet_interface);
|
||||
}
|
||||
}
|
||||
try {
|
||||
$tahesab = new TahesabController();
|
||||
$data['tahesab'] = $tahesab->storeTrade($data);
|
||||
}catch (\Exception $e){
|
||||
return response($e->getMessage(), 500);
|
||||
if(Setting::where('key', 'send_to_tahesab')->first()->value == "true"){
|
||||
try {
|
||||
$tahesab = new TahesabController();
|
||||
$data['tahesab'] = $tahesab->storeTrade($data);
|
||||
}catch (\Exception $e){
|
||||
return response($e->getMessage(), 500);
|
||||
}
|
||||
}
|
||||
|
||||
// $response['reward'] = $this->give_order_reward($data, $wallet, $wallet_interface);
|
||||
$response['Notifications'] = $this->sendTransactionNotifications($data, $transactionType);
|
||||
return response()->json([$response, $data]);
|
||||
|
||||
Reference in New Issue
Block a user