fix(wa): notifikasi LUNAS lewat gateway aktif + approve APK
All checks were successful
CI / test (push) Successful in 2m26s

- isConnected GOWA: tangani /devices array (state connected)
- app-customer payment-notif: pakai waNotify, bukan Baileys
- customerAPI approve kolektor + payment-unmatched: kirim WA lunas
- versi 0.5.13
This commit is contained in:
oxpoe
2026-11-05 17:32:31 +07:00
parent 310e91ed97
commit 7db4cb81a3
8 changed files with 73 additions and 8 deletions

View File

@@ -4925,6 +4925,29 @@ router.post('/payment-unmatched/:id/match', requireAdminSession, express.urlenco
if (!unpaid) await customerSvc.activateCustomer(inv.customer_id);
}
} catch (e) {}
// Notifikasi WA lunas ke pelanggan
try {
const cust = customerSvc.getCustomerById(inv.customer_id);
if (cust && cust.phone) {
const pkg = cust.package_id ? customerSvc.getPackageById(cust.package_id) : null;
await sendPaymentSuccessWA(
cust.phone,
cust.name,
`${inv.period_month}/${inv.period_year}`,
Number(inv.amount || 0).toLocaleString('id-ID'),
'Manual (Webhook)',
{
customerId: cust.id,
invoiceId: inv.id,
username: cust.pppoe_username || cust.id,
customerCode: cust.customer_code || '',
packageName: pkg?.name || cust.package_name || '-',
paidAt: new Date(), method: 'Manual (Webhook)'
}
);
}
} catch (e) {}
req.session._msg = { type: 'success', text: 'Invoice #' + invId + ' ditandai LUNAS & notif dicocokkan.' };
} catch (e) {
req.session._msg = { type: 'error', text: 'Gagal cocokkan: ' + e.message };