Jurnal Client written in Go. Un-official Jurnal API Wrapper.
go get github.com/hipcar/go-jurnal-client
Environment | Code |
---|---|
Sandbox | jurnal.NewClient(jurnal.Sandbox) |
Production | jurnal.NewClient(jurnal.Production) |
package main
import (
"github.com/hipcar/go-jurnal-client"
)
func main() {
jurnalClient := jurnal.NewClient(jurnal.Sandbox)
jurnalClient.APIKey = "YOUR_JURNAL_API_KEY"
}
res, err := jurnalClient.JournalEntry.GetJournalEntries()
res, err := jurnalClient.JournalEntry.GetJournalEntryById("1")
journalEntry := jurnal.JournalEntryRequest {
TransactionDate: "17/09/2018",
TransactionNo: "TEST-CREATE-1",
Memo: "test creating journal entry",
TransactionAccountLinesAttributes: []jurnal.TransactionAccountLinesAttributeRequest{
{
AccountName: "Account Name 1",
Description: "Desc",
Debit: 100000,
},
{
AccountName: "Account Name 2",
Description: "Desc",
Credit: 100000,
},
},
}
data := jurnal.CreateJournalEntryRequest{
JournalEntry: journalEntry,
}
result, err := jurnalApiClient.JournalEntry.CreateJournalEntry(data)
journalEntry := jurnal.JournalEntryRequest {
TransactionDate: "17/09/2018",
TransactionNo: "TEST-CREATE-1",
Memo: "test creating journal entry",
TransactionAccountLinesAttributes: []jurnal.TransactionAccountLinesAttributeRequest{
{
AccountName: "Account Name 1",
Description: "Desc",
Debit: 100000,
},
{
AccountName: "Account Name 2",
Description: "Desc",
Credit: 100000,
},
},
}
data := jurnal.CreateJournalEntryRequest{
JournalEntry: journalEntry,
}
result, err := jurnalApiClient.JournalEntry.UpdateJournalEntry("TEST-CREATE-1", data)
_, err := jurnalApiClient.JournalEntry.DeleteJournalEntry("1")