mirror of
https://gitlab.com/omair-personal/exchange.git
synced 2026-08-19 04:24:08 +00:00
added credit limit exceed check
This commit is contained in:
@@ -22,6 +22,7 @@ class BookingController extends Controller
|
||||
$user = Auth::user();
|
||||
$bookings = Booking::select('id', 'created_at', 'status', 'rate', 'term', 'amount', 'bia', 'verification_status')
|
||||
->where('user_id', $user->id)
|
||||
->orderby('updated_at','desc')
|
||||
->paginate(10);
|
||||
|
||||
|
||||
@@ -77,7 +78,8 @@ class BookingController extends Controller
|
||||
public function adminIndex(){
|
||||
$user = Auth::user();
|
||||
$bookings = Booking::select('id', 'created_at', 'admin_status', 'rate', 'term', 'amount', 'bia', 'verification_status')
|
||||
->get();
|
||||
->orderby('updated_at','desc')
|
||||
->get();
|
||||
|
||||
// reformat to fit frontend structure
|
||||
foreach ($bookings as $booking) {
|
||||
@@ -524,6 +526,16 @@ class BookingController extends Controller
|
||||
$term = $request->input('term');
|
||||
$china_beneficiary = $request->input('china_beneficiary');
|
||||
$rates = Rate::orderby('updated_at','desc')->first();
|
||||
|
||||
$creditLimit = SettingCredit::orderby('updated_at','desc')->first();
|
||||
|
||||
if (!$creditLimit){
|
||||
return response()->json("Credit limit not set, please contact admin", 405);
|
||||
}
|
||||
|
||||
if($amount > $creditLimit->rmb_credit_limit){
|
||||
return response()->json(["message" => "Exceed credit limit, please contact our sales team for larger quantitiy"], 400);
|
||||
}
|
||||
|
||||
// TODO : get marking
|
||||
$marking = "123X";
|
||||
|
||||
Reference in New Issue
Block a user