Fix api bidresults, return status by cawangan
This commit is contained in:
@@ -625,9 +625,38 @@ class LelongMobileController extends Controller
|
||||
$namaCawangan = $getCawangan->caw_name;
|
||||
$kodCawangan = $getCawangan->caw_code;
|
||||
|
||||
|
||||
$status_payment_cawangan['status'] = 1;
|
||||
|
||||
$payment = Payment::where('norujukan', $groupBycaw[0]->norujukan)
|
||||
->where(function ($query) {
|
||||
$query->where('status', '=', 1)
|
||||
->orWhere('status', '=', 2);
|
||||
})
|
||||
->first();
|
||||
if ($payment != null) {
|
||||
if ($payment->status == 2) {
|
||||
$checkPayMethod = Resit::find($payment->resit_id);
|
||||
$date_convert = strtotime($checkPayMethod->created_at);
|
||||
$checkPayMethod['pay_time'] = date("H:i:s", $date_convert);
|
||||
$status_payment_cawangan['resit'] = $checkPayMethod->toArray();
|
||||
if ($checkPayMethod->billplz_id == "") {
|
||||
$status_payment_cawangan['payment_method'] = "TUNAI";
|
||||
$status_payment_cawangan['payment_method_opt'] = 1;
|
||||
} elseif (str_starts_with($checkPayMethod->billplz_id, 'CDM')) {
|
||||
$status_payment_cawangan['payment_method'] = "CDM";
|
||||
$status_payment_cawangan['payment_method_opt'] = 3;
|
||||
} else {
|
||||
$status_payment_cawangan['payment_method'] = "ONLINE";
|
||||
$status_payment_cawangan['payment_method_opt'] = 2;
|
||||
}
|
||||
} else {
|
||||
$status_payment_cawangan['status'] = 9; // status pending tunggu pengesahan
|
||||
}
|
||||
} else {
|
||||
$status_payment_cawangan['status'] = null;
|
||||
}
|
||||
|
||||
$total_hargabida = 0;
|
||||
$status_payment_cawangan = 1;
|
||||
foreach ($groupBycaw as $index => $hargabida) {
|
||||
$fileMarhun = FileMarhun::where('lelongbid_id', $hargabida->id)->get();
|
||||
if ($fileMarhun->isNotEmpty()) {
|
||||
@@ -641,9 +670,6 @@ class LelongMobileController extends Controller
|
||||
->first();
|
||||
$groupBycaw[$index]['hargabida'] = number_format($totalbida['hargabida'], 2, '.', ',');
|
||||
$total_hargabida = $total_hargabida + $totalbida['hargabida'];
|
||||
if($hargabida->status_payment == null) {
|
||||
$status_payment_cawangan = null;
|
||||
}
|
||||
}
|
||||
$sag = $groupBycaw;
|
||||
array_push($data, [
|
||||
|
||||
Reference in New Issue
Block a user