tambah notifikasi wasap pembida billplz paid

This commit is contained in:
BTMS2
2025-05-06 16:13:34 +08:00
parent 791ca8dd84
commit 2c579e4327
4 changed files with 276 additions and 213 deletions
+52 -47
View File
@@ -40,6 +40,7 @@ use Http\Client\Common\HttpMethodsClient;
use Http\Adapter\Guzzle7\Client as GuzzleHttpClient;
use Http\Message\MessageFactory\GuzzleMessageFactory;
use App\Models\LogUser;
use App\Jobs\WhatsappPembidaFPXPaid;
class ApiController extends Controller
{
@@ -648,63 +649,67 @@ class ApiController extends Controller
// BillplzService.php atau ApiController.php
public function processPaidResit(array $data)
{
$currentdate = Carbon::now();
$currentdate = $currentdate->toDateTimeString();
$loguser = new LogUser;
$loguser->user_id = User::where('name','System')->first()->id;
$loguser->date = $currentdate;
$loguser->username = 'System';
$loguser->nama_user = 'System';
$loguser->norujukan = $data['billplz']['id'];
$loguser->nota = 'Callback Resit Billplz Telah Bayar : Billplz_id -'.$data['billplz']['id'];
$loguser->save();
$resit = Resit::where('billplz_id', '=', $data['billplz']['id'])->first();
public function processPaidResit(array $data)
{
$currentdate = Carbon::now();
$currentdate = $currentdate->toDateTimeString();
$loguser = new LogUser;
$loguser->user_id = User::where('name','System')->first()->id;
$loguser->date = $currentdate;
$loguser->username = 'System';
$loguser->nama_user = 'System';
$loguser->norujukan = $data['billplz']['id'];
$loguser->nota = 'Callback Resit Billplz Telah Bayar : Billplz_id -'.$data['billplz']['id'];
$loguser->save();
$resit = Resit::where('billplz_id', '=', $data['billplz']['id'])->first();
if (!$resit) {
return false;
}
if (!$resit) {
return false;
}
$resit->status = 'PAID';
$resit->paid_at = $data['billplz']['paid_at'];
$resit->save();
$resit->status = 'PAID';
$resit->paid_at = $data['billplz']['paid_at'];
$resit->save();
$resitoriginal = Resit::where('user_id', $resit->user_id)
->where('lelong_id', $resit->lelong_id)
->where('resit_type', 2)
->first();
$resitoriginal = Resit::where('user_id', $resit->user_id)
->where('lelong_id', $resit->lelong_id)
->where('resit_type', 2)
->first();
$payment = Payment::where('lelong_id', $resit->lelong_id)
->where('user_id', $resit->user_id)
->where('resit_id', $resit->id)
->get();
$payment = Payment::where('lelong_id', $resit->lelong_id)
->where('user_id', $resit->user_id)
->where('resit_id', $resit->id)
->get();
foreach ($payment as $index) {
$index->status = 2;
$index->remark = "BERJAYA BAYARAN ONLINE";
$index->update();
foreach ($payment as $index) {
$index->status = 2;
$index->remark = "BERJAYA BAYARAN ONLINE";
$index->update();
$updateTagBid = LelongBid::where('norujukan', $index->norujukan)->first();
if ($updateTagBid) {
$updateTagBid->status_payment = 2;
$updateTagBid->save();
$updateTagBid = LelongBid::where('norujukan', $index->norujukan)->first();
if ($updateTagBid) {
$updateTagBid->status_payment = 2;
$updateTagBid->save();
$updateTagBidder = LelongBidder::where('lelongbid_id', $updateTagBid->id)
->where('user_id', $resit->user_id)->first();
if ($updateTagBidder) {
$updateTagBidder->status_payment = 2;
$updateTagBidder->payment_id = $index->id;
$updateTagBidder->save();
$updateTagBidder = LelongBidder::where('lelongbid_id', $updateTagBid->id)
->where('user_id', $resit->user_id)->first();
if ($updateTagBidder) {
$updateTagBidder->status_payment = 2;
$updateTagBidder->payment_id = $index->id;
$updateTagBidder->save();
}
}
}
event(new PaymentNotify('PAID', $resit->user_id, $payment));
//notifikasi wasap kepada pembida//
WhatsappPembidaFPXPaid::dispatch($resit->user_id,
$resit->id,
$resit->total_payment);
return true;
}
event(new PaymentNotify('PAID', $resit->user_id, $payment));
return true;
}
}