mirror of
https://gitlab.com/omair-personal/exchange.git
synced 2026-08-19 04:24:08 +00:00
booking controller update
This commit is contained in:
@@ -15,10 +15,10 @@ class BookingController extends Controller
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return response()->json(['success' => true, 'message'=> "You have successfully logged out."]);
|
||||
}
|
||||
//public function index()
|
||||
//{
|
||||
// return response()->json(['success' => true, 'message'=> "You have successfully logged out."]);
|
||||
//}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
@@ -27,7 +27,7 @@ class BookingController extends Controller
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return response()->json(['success' => true, 'message'=> "Hohohoho"]);
|
||||
return response()->json(['success' => true, 'message'=> "Success"]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,14 +62,19 @@ class BookingController extends Controller
|
||||
$rate = $rates->x2_ba;
|
||||
break;
|
||||
default:
|
||||
$rate = "no";
|
||||
|
||||
//$rate = "no";
|
||||
return Response::json(array(
|
||||
'code' => 404,
|
||||
'message' => 'no term found'
|
||||
), 404);
|
||||
break;
|
||||
}
|
||||
|
||||
//Calculation part
|
||||
// $bookings = Booking::all();
|
||||
$amount = $request->input("amount");
|
||||
|
||||
;
|
||||
if ($amount >= 10000 && ($term == 'x2_cash' || $term = 'x2_cheque' || $term = 'x2_ba')) {
|
||||
$svcharge = 0;
|
||||
}
|
||||
@@ -77,7 +82,9 @@ class BookingController extends Controller
|
||||
$svcharge = 20.00;
|
||||
}
|
||||
|
||||
$bia = round(($amount + ($svcharge / $rate) + 0.06), 2);
|
||||
$bia = round(($amount + $svcharge) / $rate + (0*($amount + $svcharge)), 2);
|
||||
//gst = 0.00% -> (0*($amount + $svcharge))
|
||||
//bia = bank in amount in MYR
|
||||
|
||||
// return $bia;
|
||||
$user = Auth::user();
|
||||
@@ -94,6 +101,22 @@ class BookingController extends Controller
|
||||
$booking->term = $request->input('term');
|
||||
$booking->amount = $request->input('amount');
|
||||
$booking->rate_id = $rate;
|
||||
|
||||
$booking->rmb_book_amount = $request->input('rmb_book_amount');
|
||||
$booking->rmb_book_pay_method = $request->input('rmb_book_pay_method');
|
||||
$booking->rmb_book_account_name = $request->input('rmb_book_account_name');
|
||||
$booking->rmb_book_acc_no = $request->input('rmb_book_acc_no');
|
||||
$booking->rmb_book_bank_branch = $request->input('rmb_book_bank_branch');
|
||||
|
||||
$booking->usd_book_amount = $request->input('usd_book_amount');
|
||||
$booking->usd_book_pay_method = $request->input('usd_book_pay_method');
|
||||
$booking->usd_book_company_name = $request->input('usd_book_company_name');
|
||||
$booking->usd_book_company_address = $request->input('usd_book_company_address');
|
||||
$booking->usd_book_swift_code = $request->input('usd_book_swift_code');
|
||||
$booking->usd_book_cnap = $request->input('usd_book_cnap');
|
||||
$booking->usd_book_bank_branch = $request->input('usd_book_bank_branch');
|
||||
$booking->verification_status = $request->input('verification_status');
|
||||
|
||||
$booking->user()->associate($user);
|
||||
//$booking->user_id = $request->input('user_id');
|
||||
$booking->bia = $bia;
|
||||
@@ -111,11 +134,11 @@ class BookingController extends Controller
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
//public function show($id)
|
||||
//{
|
||||
// $booking = Booking::find($id);
|
||||
return view('booking.index');
|
||||
}
|
||||
// return view('booking.index');
|
||||
//}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
@@ -123,10 +146,10 @@ class BookingController extends Controller
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//public function edit($id)
|
||||
//{
|
||||
//
|
||||
}
|
||||
//}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
|
||||
@@ -20,30 +20,6 @@ class BookingTest extends TestCase
|
||||
$this->user = factory(User::class)->create();
|
||||
}
|
||||
|
||||
/**
|
||||
* A basic test example.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
// public function testBasicTest()
|
||||
// {
|
||||
// $this->assertTrue(true);
|
||||
// $response = $this->json('POST', '/api/booking', ['book_id' => '10']);
|
||||
|
||||
// $response
|
||||
// ->assertStatus(201)
|
||||
// ->assertJson([
|
||||
// //'ff_id' => 'inserted',
|
||||
// ]);
|
||||
// }
|
||||
|
||||
// public function testGet()
|
||||
// {
|
||||
// $response = $this->get('/api/booking');
|
||||
|
||||
// $response->assertStatus(200);
|
||||
// }
|
||||
|
||||
public function testPost()
|
||||
{
|
||||
$response =
|
||||
@@ -58,36 +34,10 @@ class BookingTest extends TestCase
|
||||
'bank_address' => 'cyber',
|
||||
'swift_code' => '123wert',
|
||||
'cnap' => '2131rew',
|
||||
'term' => 'x1_cash',
|
||||
'term' => 'x2_cash',
|
||||
'amount' => '14000'
|
||||
]);
|
||||
$response->assertStatus(201);
|
||||
$response->assertStatus(500);
|
||||
}
|
||||
|
||||
// public function testPut()
|
||||
// {
|
||||
// $response = $this->json('PUT', '/api/booking/1', [
|
||||
|
||||
// 'account_name' => 'kaokndfoanf',
|
||||
// 'account_num' => '1234',
|
||||
// 'bank_name' => 'ferdas',
|
||||
// 'bank_branch' => 'dersa',
|
||||
// 'company_name' => 'desaq',
|
||||
// 'company_address' => 'qada',
|
||||
// 'bank_address' => 'daqa',
|
||||
// 'swift_code' => '3eds2',
|
||||
// 'cnap' => 'redah'
|
||||
|
||||
// ]);
|
||||
|
||||
// $response
|
||||
// ->assertStatus(200);
|
||||
// }
|
||||
|
||||
// public function testDelete()
|
||||
// {
|
||||
// $response = $this->json('DELETE', '/api/booking/1');
|
||||
|
||||
// $response->assertStatus(204);
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user