wallet handling
This commit is contained in:
@@ -33,14 +33,14 @@ class WalletController extends Controller
|
||||
if ($data['value'] > 0) {
|
||||
$deposit = true;
|
||||
}
|
||||
$wallet = Wallet::where('owner', $data['customer_id'])->whereNull('fund_id')->first();
|
||||
$wallet_interface = new WalletInterface($data['customer_id'], (int) $customer->type);
|
||||
$wallet = $wallet_interface->wallet;
|
||||
if (is_null($wallet) && !$deposit) {
|
||||
throw new UnprocessableEntityHttpException('مقدار موجودی کمتر از درخواست شماست');
|
||||
}
|
||||
if (!is_null($wallet) && $wallet->cash < abs($data['value']) && !$deposit) {
|
||||
throw new UnprocessableEntityHttpException('مقدار موجودی کمتر از درخواست شماست');
|
||||
}
|
||||
$wallet_interface = new WalletInterface($data['customer_id'], $customer->type);
|
||||
$orders = Order::where('customer_id', $data['customer_id'])->where('sts', 1)->get();
|
||||
$gold_block = 0;
|
||||
if (count($orders) > 0) {
|
||||
@@ -91,14 +91,14 @@ class WalletController extends Controller
|
||||
if ($data['value'] > 0) {
|
||||
$deposit = true;
|
||||
}
|
||||
$wallet = Wallet::where('owner', $data['customer_id'])->whereNull('fund_id')->first();
|
||||
$wallet_interface = new WalletInterface($data['customer_id'], (int) $customer->type);
|
||||
$wallet = $wallet_interface->wallet;
|
||||
if (is_null($wallet) && !$deposit) {
|
||||
throw new UnprocessableEntityHttpException('مقدار موجودی کمتر از درخواست شماست');
|
||||
}
|
||||
if (!is_null($wallet) && $wallet->cash < abs($data['value']) && !$deposit) {
|
||||
throw new UnprocessableEntityHttpException('مقدار موجودی کمتر از درخواست شماست');
|
||||
}
|
||||
$wallet_interface = new WalletInterface($data['customer_id'], $customer->type);
|
||||
$orders = Order::where('customer_id', $data['customer_id'])->where('sts', 1)->get();
|
||||
$gold_block = 0;
|
||||
|
||||
@@ -160,14 +160,14 @@ class WalletController extends Controller
|
||||
$deposit = true;
|
||||
|
||||
}
|
||||
$wallet = Wallet::where('owner', $data['customer_id'])->whereNull('fund_id')->first();
|
||||
$wallet_interface = new WalletInterface($data['customer_id'], (int) $customer->type);
|
||||
$wallet = $wallet_interface->wallet;
|
||||
// if (is_null($wallet) && !$deposit) {
|
||||
// throw new UnprocessableEntityHttpException('مقدار موجودی کمتر از درخواست شماست');
|
||||
// }
|
||||
// if (!is_null($wallet) && $wallet->cash < abs($data['value']) && !$deposit) {
|
||||
// throw new UnprocessableEntityHttpException('مقدار موجودی کمتر از درخواست شماست');
|
||||
// }
|
||||
$wallet_interface = new WalletInterface($data['customer_id'], $customer->type);
|
||||
$gold_block = 0;
|
||||
$user = auth()->user();
|
||||
$customer = Customer::findOrFail($data["customer_id"]);
|
||||
|
||||
Reference in New Issue
Block a user