Kipa Cuan Lib
Official cuan-kipa-lib API Wrapper. API end point known by decompile the web and android APK.
Documentation
============
Getting Started
npm i cuan-kipa-lib
Include Cuan Kipa module
var cuankipalib= require('cuan-kipa-lib');
Use token
for every request.
See how to get token with login API
Set token
By default the token is not set by this module. You can set token after you call a login API
cuankipalib.setToken('YOUR_TOKEN');
Account
List Account
cuankipalib.listAccount(query = null).then(body =>{
console.log(body);
});
Response
{
"status": true,
"total": 378,
"last_page": 1,
"per_page": 1000,
"current_page": 1,
"next_page_url": "",
"prev_page_url": "",
"from": 1,
"to": 1000,
"data": [
{
"id": 521,
"remoteId": 1,
"name": "Kas PT Maju Makmur Pusat",
"accountNumber": "1-10002",
"note": "",
"balance": "0.0000",
"category": {
"id": 1,
"name": "Kas & Bank"
}
}
]
}
Show Account
cuankipalib.showAccount(id).then(body =>{
console.log(body);
});
Example
cuankipalib.showAccount(1-10002).then(body =>{
console.log(body);
});
Response
{
"message": "",
"data": {
"id": 267,
"name": "Kas PT Maju Makmur Pusat",
"accountNumber": "1-10002",
"note": "",
"balance": "0.0000"
},
"status": true
}
Create Account
/*
name: string,
note: string,
credit: number,
debit: number
*/
cuankipalib.createAccount(name, note, credit, debit).then(body =>{
console.log(body);
});
Example
cuankipalib.createAccount("Anak muda", "Maju Lancar", 100000, 0).then(body =>{
console.log(body);
});
Response
{
"message": "Account berhasil ditambahkan",
"data": {
"id": 265,
"name": "Anak Muda",
"accountNumber": "1-10001",
"note": "Maju Lancar",
"balance": 100000,
"category": {
"id": 1,
"name": "Kas & Bank"
}
},
"status": true
}
Update Account
/*
id: number,
name: string,
note: string
*/
cuankipalib.updateAccount(id, name, note).then(body =>{
console.log(body);
});
Example
cuankipalib.updateAccount(261, "Pasutri", "Mundur Macet").then(body =>{
console.log(body);
});
Response
{
"message": "Account berhasil diupdate",
"data": {
"id": 261,
"name": "Pasutri",
"accountNumber": "1-10001",
"note": "Mundur Macet",
"balance": "100000.0000",
"category": {
"id": 1,
"name": "Kas & Bank"
},
"updatedAt": "2020-09-07T04:50:23.228Z"
},
"status": true
}
Delete Account
cuankipalib.delAccount(id).then(body =>{
console.log(body);
});
Generate Account
/*
data: array
*/
cuankipalib.generateAccount(data).then(body =>{
console.log(body);
});
Example
let data: [
{
"id": 1,
"type": "saldo",
"name": "Saldo Kipa",
"balance": 10000
},
{
"id": 1,
"type": "kas",
"name": "PT Maju Makmur Pusat",
"balance": 100000
},
{
"id": 1,
"type": "bank",
"name": "Bank BCA",
"balance": 0
}
]
cuankipalib.generateAccount(data).then(body =>{
console.log(body);
})
Reset Account
cuankipalib.resetAccount().then(body =>{
console.log(body);
});
Auth
Register
/*
name: string,
email: string
*/
cuankipalib.registerWithNameEmail(name, email).then(body =>{
console.log(body);
});
Example
cuankipalib.registerWithNameEmail("Akun", "akun@gmail.com").then(body =>{
console.log(body);
});
Respone
{
"message": "Register Berhasil",
"data": {
"id": 2,
"name": "Akun",
"email": "akun@gmail.com",
"token": "21804b9d-34e7-4ed3-b195-a38156f427ba"
},
"status": true
}
Category
List Category
cuankipalib.listCategory(query = null).then(body =>{
console.log(body);
});
Response
{
"status": true,
"last_page": null,
"per_page": 100,
"current_page": 1,
"next_page_url": "http://localhost:3001/v1/categories?page=2&per_page=100",
"prev_page_url": "",
"from": 1,
"to": 100,
"data": [
{
"id": 1,
"name": "Kas & Bank",
"code": "1-1",
"type": "activa"
}
]
}
Transaction Type
List Transaction Type
cuankipalib.listTransactionType(query = null).then(body =>{
console.log(body);
});
Response
{
"status": true,
"last_page": null,
"per_page": 100,
"current_page": 1,
"next_page_url": "http://localhost:3001/v1/transaction-type?page=2&per_page=100",
"prev_page_url": "",
"from": 1,
"to": 100,
"data": [
{
"id": 1,
"name": "Pemasukan"
},
{
"id": 2,
"name": "Pengeluaran"
},
{
"id": 3,
"name": "Hutang"
},
{
"id": 4,
"name": "Piutang"
},
{
"id": 5,
"name": "Tanam Modal"
},
{
"id": 6,
"name": "Tarik Modal"
},
{
"id": 7,
"name": "Transfer Uang"
}
]
}
Account Transaction Type
/*
id: number,
type: enum('debit', 'credit')
*/
cuankipalib.listAccountByTrxType(id, type).then(body =>{
console.log(body);
});
Example
cuankipalib.listAccountByTrxType(1, debit).then(body =>{
console.log(body);
});
Response
{
"message": "",
"data": [
{
"id": 1,
"name": "Kas & Bank",
"type": "debit",
"account": [
{
"id": 2,
"name": "Kas PT Maju Makmur Pusat",
"accountNumber": "1-10002"
},
{
"id": 3,
"name": "Bank BCA",
"accountNumber": "1-10003"
},
{
"id": 131,
"name": "Kas PT Maju Makmur Pusat",
"accountNumber": "1-10002"
},
{
"id": 132,
"name": "Bank BCA",
"accountNumber": "1-10003"
},
{
"id": 260,
"name": "Kas PT Maju Makmur Pusat",
"accountNumber": "1-10002"
},
{
"id": 261,
"name": "Bank BCA",
"accountNumber": "1-10003"
}
]
},
{
"id": 3,
"name": "Persediaan",
"type": "debit",
"account": [
{
"id": 6,
"name": "Persediaan Barang",
"accountNumber": "1-10200"
},
{
"id": 135,
"name": "Persediaan Barang",
"accountNumber": "1-10200"
},
{
"id": 264,
"name": "Persediaan Barang",
"accountNumber": "1-10200"
}
]
}
],
"status": true
}
Contact
List Contact
cuankipalib.listContact(query = null).then(body =>{
console.log(body);
});
Respone
{
"status": true,
"total": 5,
"last_page": 1,
"per_page": 10,
"current_page": 1,
"next_page_url": "",
"prev_page_url": "",
"from": 1,
"to": 10,
"data": [
{
"id": 14,
"userId": 3,
"remoteId": 1,
"name": "mek",
"email": "sigemoy@gmail.com",
"address": "malang kabupaten",
"phone": "099889",
"note": "Tambahkan Note",
"createdAt": "2020-09-14 15:17:17",
"updatedAt": "2020-09-14 15:17:17"
},
{
"id": 15,
"userId": 3,
"remoteId": 1,
"name": "slili",
"email": "simalakama@gmail.com",
"address": "malang kecamatan",
"phone": "989009",
"note": "Tambahkan Note",
"createdAt": "2020-09-14 15:17:17",
"updatedAt": "2020-09-14 15:17:17"
}
]
}
Create Contact
/*
name: string,
email: string,
email: string,
address: string,
phone: string,
note: string,
remoteId: number
*/
cuankipalib.createContact(name, email, address, phone, note, remoteId = 0).then(body =>{
console.log(body);
});
Example
cuankipalib.createContact("Orang", "orang@gmail.com", "Jl. Danau Ranau VI", "082290390929", "Kas Kelompok", 0).then(body =>{
console.log(body);
});
Response
{
"message": "Kontak berhasil ditambahkan",
"data": {
"id": 4,
"remoteId": 0,
"name": "Orang",
"email": "orang@gmail.com",
"address": "Jl. Danau Ranau VI",
"phone": "082290390929",
"note": "Kas Kelompok",
"userId": 2,
"updatedAt": "2020-09-14T03:23:59.863Z",
"createdAt": "2020-09-14T03:23:59.863Z"
},
"status": true
}
Update Contact
/*
name: string,
email: string,
email: string,
address: string,
phone: string,
note: string,
remoteId: number
*/
cuankipalib.updateContact(id, name, email, address, phone, note, remoteId = 0).then({
console.log(body);
});
Example
cuankipalib.updateContact(47, "Anjas", "anjays@gmail.com", "Jl. Aja Dulu", 098878876656, "Kas Kelas").then({
console.log(body);
});
Response
{
"message": "Kontak berhasil diupdate",
"data": {
"id": 47,
"userId": 33,
"remoteId": 0,
"name": "Anjas",
"email": "anjays@gmail.com",
"address": "Jl. Aja Dulu",
"phone": 098878876656,
"note": "Kas kelas",
"createdAt": "2020-09-30 12:01:45",
"updatedAt": "2020-09-30T05:02:28.498Z"
},
"status": true
}
Delete Contact
cuankipalib.delContact(id).then({
console.log(body);
});
Report
Report Journal
cuankipalib.reportJurnal(query = null).then({
console.log(body);
});
Example
{
"status": true,
"last_page": null,
"per_page": 100,
"current_page": 1,
"next_page_url": "http://localhost:3001/v1/report/jurnal?page=2&per_page=100",
"prev_page_url": "",
"from": 1,
"to": 100,
"data": [
{
"transactionDate": "2020-09-10 14:57:10",
"remoteId": 99,
"note": "Jual Permen subandrio",
"amount": "0.0000",
"id": 40,
"accountTransaction": [
{
"accountName": "Uang Muka Pembelian",
"subType": "debit",
"amount": "0.0000"
},
{
"accountName": "Saldo Kipa",
"subType": "credit",
"amount": "0.0000"
}
]
}
]
}
Report Buku Besar
cuankipalib.reportBukuBesar(id, query = null).then({
console.log(body);
});
Example
cuankipalib.reportBukuBesar(1-10001, query = null).then({
console.log(body);
});
Response
{
"status": true,
"total": 1,
"last_page": 1,
"per_page": 100,
"current_page": 1,
"next_page_url": "",
"prev_page_url": "",
"from": 1,
"to": 100,
"data": [
{
"transactionDate": "2020-09-08 16:35:16",
"note": "Jual Permen subandrio",
"type": "debit",
"amount": "2000.0000",
"subType": "credit",
"balance": "30000.0000"
}
]
}
Report Neraca
cuankipalib.reportNeraca(query = null).then({
console.log(body);
});
{
"message": "Account berhasil ditambahkan",
"data": {
"activa": [
{
"id": 3,
"name": "Persediaan",
"account": [
{
"name": "Persediaan Barang",
"accountNumber": "1-10200",
"balance": "0.0000"
},
{
"name": "Persediaan Barang",
"accountNumber": "1-10200",
"balance": "0.0000"
},
{
"name": "Persediaan Barang",
"accountNumber": "1-10200",
"balance": "0.0000"
}
]
}
]
},
"status": true
}
Transaction
Sync Saldo Kipa
/*
data: array,
type: enum('kipa', 'trx')
*/
cuankipalib.syncAccount(data, type).then(body => {
console.log(body);
});
Example
let data = [
{
"id": 1,
"type": "saldo",
"name": "Saldo Kipa"
},
{
"id": 1,
"type": "kas",
"name": "PT Maju Makmur Pusat"
},
{
"id": 1,
"type": "bank",
"name": "Bank BCA"
}
]
cuankipalib.syncAccount(data, 'kipa').then(body => {
console.log(body);
});
Create Transaction
cuankipalib.createTransaction(remoteId, accounts, amount, transactionDate = '', note = '', contactId = 0).then(body => {
console.log(body);
});
Example
let accounts = [
{
"accountNumber": "1-10003",
"type": "debit"
},
{
"accountNumber": "3-30998",
"type": "credit"
}
]
cuankipalib.createTransaction(0, accounts, 10000, '2020-09-12T03:25:57.000Z', 'Saldo Awal', 0).then(body => {
console.log(body
})
Response
{
"message": "Transaksi berhasil dilakukan",
"data": {
"remoteId": 0,
"amount": 10000,
"transactionDate": "2020-09-12T03:25:57.000Z",
"accounts": [
{
"accountId": 3,
"accountName": "Bank BCA",
"type": "credit",
"subType": "debit"
},
{
"accountId": 57,
"accountName": "Saldo Awal",
"type": "credit",
"subType": "credit"
}
]
},
"status": true
}
Create Transaction Seamless
cuankipalib.createTransactionSeamless(remoteId, type, status, accountNumber = '', amount, otherAmount = 0, hppAmount = 0, transactionDate = '', note = '').then(body =>{
console.log(body);
});
Example
cuankipalib.createTransactionSeamless(99, "purchase_cash", "ordered", "1-10001", 0, otherAmount = 0, 1000, "2020-09-10T08:00:59.000Z", "Tambahkan Note").then(body =>{
console.log(body);
Response
{
"message": "Transaksi berhasil dilakukan",
"data": {
"remoteId": 99,
"note": "Tambahkan Note",
"amount": 0,
"transactionDate": "2020-09-10T08:00:59.000Z",
"accounts": [
{
"accountId": 277,
"accountName": 277,
"type": "credit",
"subType": "debit"
},
{
"accountId": 266,
"accountName": "Saldo Kipa",
"type": "debit",
"subType": "credit"
}
]
},
"status": true
}
Delete Transaction
cuankipalib.delTransaction(id).then(body =>{
console.log(body);
});