added reject time from 7pm and 11pm,Furthermore, fix 5cent in create transaction
This commit is contained in:
@@ -25,8 +25,7 @@ class TransactionOnlineController extends Controller
|
||||
{
|
||||
public function getTransactionOnline(Request $request)
|
||||
{
|
||||
$transactionOnline = TransactionOnline::on('mysql7')->where('billplz_id', $request->billplz_id)->first();
|
||||
|
||||
$transactionOnline = TransactionOnline::on('mysql7')->where('norujukan',$request->norujukan)->where('billplz_id', $request->billplz_id)->first();
|
||||
return response()->json($transactionOnline);
|
||||
}
|
||||
|
||||
@@ -117,6 +116,13 @@ class TransactionOnlineController extends Controller
|
||||
$transactions = TransactionOnline::on('mysql7')->where([['status', '=', 'PAID'], ['update_status', 0]])->get();
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon();
|
||||
|
||||
$checkTime = $this->checkTime();
|
||||
|
||||
if($checkTime == 'rejected'){
|
||||
return response()->json('rejected-time');
|
||||
}
|
||||
|
||||
foreach ($transactions as $index => $transaction) {
|
||||
$cawangan = Cawangan::on('mysql7')
|
||||
->where('kodcaw', '=', $transaction['kodcaw'])
|
||||
@@ -451,8 +457,10 @@ class TransactionOnlineController extends Controller
|
||||
$ujrah_calculation = $this->getUjrah($kodcaw, $norujukan);
|
||||
|
||||
$onepercent = new Calculation();
|
||||
$ujrahasal = $onepercent->getRoundedMethod($ujrahasal);
|
||||
$onepercentasal = $onepercent->getRoundedMethod($onepercentasal);
|
||||
$ujrah = $onepercent->getRoundedMethod($ujrahasal * $bilang_bln);
|
||||
$ujrah_rebate = $onepercent->getRoundedMethod($ujrah_calculation['ujrah_sebenar'] - $ujrah_calculation['ujrah_rebet']);
|
||||
$ujrah_rebate = $onepercent->getRoundedMethod($keuntungan['ujrah'] * $bilang_bln);
|
||||
$keun = $onepercent->getRoundedMethod($onepercentasal * $bilang_bln);
|
||||
$keuntungan_rebate = $onepercent->getRoundedMethod($keuntungan['onepercent'] * $bilang_bln);
|
||||
|
||||
@@ -745,5 +753,21 @@ class TransactionOnlineController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
private function checkTime(){
|
||||
$current = Carbon::now();
|
||||
|
||||
$startRange1 = Carbon::today()->setTime(19, 0);
|
||||
$endRange1 = Carbon::today()->setTime(19, 30);
|
||||
|
||||
$startRange2 = Carbon::today()->setTime(23, 0);
|
||||
$endRange2 = Carbon::today()->setTime(23, 30);
|
||||
|
||||
if ($current->between($startRange1, $endRange1) || $current->between($startRange2, $endRange2)) {
|
||||
return 'rejected';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user