Skip to content

hipcar/go-jurnal-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

go-jurnal-client

Jurnal Client written in Go. Un-official Jurnal API Wrapper.

Documentation

Getting Started

go get github.com/hipcar/go-jurnal-client

Environment Variable

Environment Code
Sandbox jurnal.NewClient(jurnal.Sandbox)
Production jurnal.NewClient(jurnal.Production)

Init

package main

import (
	"github.com/hipcar/go-jurnal-client"
)

func main() {
  jurnalClient := jurnal.NewClient(jurnal.Sandbox)
  jurnalClient.APIKey = "YOUR_JURNAL_API_KEY"
}

Journal Entry

Get Journal Entries

res, err := jurnalClient.JournalEntry.GetJournalEntries()

Get Journal Entry By Id / Transaction No

res, err := jurnalClient.JournalEntry.GetJournalEntryById("1")

Create Journal Entry

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)

Update Journal Entry

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)

Delete Journal Entry By Id / Transaction No

_, err := jurnalApiClient.JournalEntry.DeleteJournalEntry("1")

Releases

No releases published

Packages

No packages published

Languages