meta { name: pph21-edit type: http seq: 2 } post { url: https://ifswit-solutax-ctas-dev.spt.co.id/ifs/api/wit/bulanan/edit body: json auth: none } headers { tokens: {{accessToken}} } body:json { { "idPel": {{idpel}}, "requestID": "{{requestID}}", "monthlyIncome": { "npwpPemotong": "1091031210912281", "idTkuPemotong": "1091031210912281000000", "masaPajak": "01", "tahunPajak": 2025, "npwpDipotong": "3171065903840003", "idTkuDipotong": "3171065903840003000000", "nama": "NAMA3171065903840003", "nomorBupot": "{{nomorBupot}}", "idBupot": "{{idBupot}}", "fgJnsBupot": "21", "tglPemotongan": "2025-01-01", "npwpNikPenandatangan": "3174061502560010", "namaPenandatangan": "NAMA3174061502560010", "passphrasePenandatangan": "Pajak123@@", "userId": "3174061502560010", "dataBp21": { "sertifikatInsentifDipotong": "N/A", "nomorSertifikatInsentif": "", "kodeObjekPajak": "21-100-35", "statusPtkp": "TK/2", "penghasilanKotorSebelumnya": 0, "penghasilanKotor": 10010000, "normaPenghasilan": 100, "tarif": 1.5, "pphDipotong": 150150, "dokReferensi": [ { "dokReferensi": "ANNOUNCEMENT", "nomorDokumen": "Inv/Apr-008", "tanggal_Dokumen": "2025-01-01" } ] } } } } script:pre-request { // Generate new UUID for requestID function generateUUID() { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { const r = Math.random() * 16 | 0; const v = c === 'x' ? r : (r & 0x3 | 0x8); return v.toString(16); }); } const newUUID = generateUUID(); bru.setEnvVar("requestID", newUUID); console.log("New requestID generated: " + newUUID); } script:post-response { // Parse response JSON const responseJson = res.body; // Extract nomorBupot and idBupot from taxSlipResponse.result const nomorBupot = responseJson?.taxSlipResponse?.result?.nomorBupot; const idBupot = responseJson?.taxSlipResponse?.result?.idBupot; // Set environment variables if values exist if (nomorBupot) { bru.setEnvVar("nomorBupot", nomorBupot); console.log("nomorBupot set: " + nomorBupot); } if (idBupot) { bru.setEnvVar("idBupot", idBupot); console.log("idBupot set: " + idBupot); } }