128 lines
5.4 KiB
HTTP
128 lines
5.4 KiB
HTTP
|
|
# ============================================================
|
|
# FILE : PurchaseInvoiceInstallment.http
|
|
# MODUL : Scheduler — Generate Purchase Invoice Cicilan Aset
|
|
# ============================================================
|
|
#
|
|
# DESKRIPSI
|
|
# ---------
|
|
# File ini berisi kumpulan HTTP request untuk menguji endpoint
|
|
# scheduler yang secara otomatis membuat Purchase Invoice (PI)
|
|
# cicilan bulanan berdasarkan kontrak aset aktif.
|
|
#
|
|
# CARA PAKAI
|
|
# ----------
|
|
# 1. Gunakan ekstensi "REST Client" di VS Code (humao.rest-client)
|
|
# atau tool sejenis (IntelliJ HTTP Client, Postman, dll).
|
|
# 2. Ganti nilai @host sesuai environment (local / staging / prod).
|
|
# 3. Klik "Send Request" di atas tiap blok ### untuk menjalankan
|
|
# request tersebut secara individual.
|
|
# 4. Jalankan request secara BERURUTAN sesuai urutan yang disarankan
|
|
# (lihat keterangan tiap endpoint di bawah).
|
|
#
|
|
# ALUR PENGGUNAAN YANG DISARANKAN
|
|
# --------------------------------
|
|
# [1] ListEligibleContracts → Lihat kontrak mana saja yang akan diproses
|
|
# [2] GenerateMonthlyInvoices → Jalankan proses generate PI cicilan sekaligus
|
|
# [3] InsertSupplierInvoice → (Opsional) Insert manual 1 PI jika diperlukan
|
|
#
|
|
# CATATAN
|
|
# -------
|
|
# - startDate & endDate menentukan periode bulan yang diproses.
|
|
# Biasanya diisi dengan tanggal awal dan akhir bulan berjalan.
|
|
# - Scheduler ini AMAN dijalankan ulang (idempotent). Kontrak yang
|
|
# sudah punya PI di bulan yang sama akan dilewati otomatis.
|
|
# - userID pada InsertSupplierInvoice akan diabaikan; sistem
|
|
# mengambil userID dari PurchaseOrderAssetContractCreatedUserID.
|
|
# ============================================================
|
|
|
|
@host = https://accone.aplikasi.web.id/one-api
|
|
|
|
# ============================================================
|
|
# [1] LIST KONTRAK ELIGIBLE
|
|
# ============================================================
|
|
# Gunakan endpoint ini SEBELUM generate untuk melihat preview
|
|
# kontrak mana saja yang akan dibuatkan PI pada periode ini.
|
|
#
|
|
# Response berisi daftar kontrak beserta detail cicilan,
|
|
# status GRNI, dan apakah PI bulan ini sudah ada atau belum.
|
|
# ============================================================
|
|
|
|
### [1] List kontrak cicilan eligible yang belum diproses bulan ini
|
|
POST {{host}}/mockup/scheduler/PurchaseInvoiceInstallment/ListEligibleContracts
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"startDate": "2026-07-01",
|
|
"endDate": "2026-07-31"
|
|
}
|
|
|
|
# ============================================================
|
|
# [2] GENERATE PI CICILAN BULANAN (MAIN ENDPOINT)
|
|
# ============================================================
|
|
# Endpoint utama scheduler. Satu request ini akan:
|
|
# 1. Mengambil semua kontrak aset aktif yang eligible.
|
|
# 2. Mengecek duplikasi — melewati kontrak yang sudah ada PI-nya.
|
|
# 3. Membuat nomor PI via fn_penomoran() berdasarkan user
|
|
# pembuat kontrak (PurchaseOrderAssetContractCreatedUserID).
|
|
# 4. Insert supplier_invoice + supplier_invoice_detail.
|
|
#
|
|
# Response berisi:
|
|
# - berhasil : daftar PI yang berhasil dibuat (dengan nomorPI, supplierInvoiceID, dll)
|
|
# - dilewati : daftar kontrak yang dilewati beserta alasannya
|
|
# ============================================================
|
|
|
|
### [2] Generate PI cicilan untuk semua kontrak pada periode ini
|
|
POST {{host}}/mockup/scheduler/PurchaseInvoiceInstallment/GenerateMonthlyInvoices
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"startDate": "2026-07-01",
|
|
"endDate": "2026-07-31"
|
|
}
|
|
|
|
# ============================================================
|
|
# [3] INSERT MANUAL SATU PI (INTERNAL / DEBUG)
|
|
# ============================================================
|
|
# Endpoint ini dipanggil INTERNAL oleh GenerateMonthlyInvoices
|
|
# via cURL. Gunakan hanya untuk debugging atau insert manual
|
|
# satu PI tertentu tanpa menjalankan proses batch.
|
|
#
|
|
# FIELD WAJIB:
|
|
# - nomorPI : Nomor PI (format dari fn_penomoran)
|
|
# - tanggalPI : Tanggal invoice (YYYY-MM-DD)
|
|
# - tanggalJatuhTempo : Tanggal jatuh tempo (YYYY-MM-DD)
|
|
# - jumlahCicilan : Nominal cicilan (angka, dalam Rupiah)
|
|
# - catatan : Catatan singkat pada header invoice
|
|
# - deskripsi : Deskripsi baris detail invoice
|
|
# - userID : ID user pembuat (ambil dari kontrak)
|
|
# - purchaseOrderAssetContractID : ID kontrak aset
|
|
# - purchaseOrderID : ID Purchase Order
|
|
# - receiveOrderPoID : ID Receive Order PO (GRNI)
|
|
# - supplierID : ID Supplier
|
|
# - purchaseOrderSummaryID : ID summary item PO
|
|
# - purchaseOrderSummaryItemID : ID item (barang/aset)
|
|
# - purchaseOrderSummaryItemUnitID: ID satuan item
|
|
# ============================================================
|
|
|
|
### [3] Insert satu supplier_invoice cicilan secara manual (debug)
|
|
POST {{host}}/mockup/scheduler/PurchaseInvoiceInstallmentInsert/InsertSupplierInvoice
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"nomorPI": "PI-2026-07-0001",
|
|
"tanggalPI": "2026-07-31",
|
|
"tanggalJatuhTempo": "2026-08-14",
|
|
"jumlahCicilan": 15000000,
|
|
"catatan": "PI Cicilan Otomatis — Kontrak Aset ID 123 periode 2026-07",
|
|
"deskripsi": "Cicilan Kontrak Aset — Kendaraan Operasional periode 2026-07",
|
|
"userID": 1,
|
|
"purchaseOrderAssetContractID": 123,
|
|
"purchaseOrderID": 456,
|
|
"receiveOrderPoID": 789,
|
|
"supplierID": 12,
|
|
"purchaseOrderSummaryID": 111,
|
|
"purchaseOrderSummaryItemID": 222,
|
|
"purchaseOrderSummaryItemUnitID": 333
|
|
}
|