bankset

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2026 License: MIT Imports: 7 Imported by: 0

README

Go-BankSet

Parse Indonesian bank statement PDFs and CSVs into structured Go data.

Supported: Bank Jago (PDF) and BCA Personal/Bisnis (CSV).

Install

go get github.com/kankburhan/go-bankset

Usage

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"log"

	"github.com/kankburhan/go-bankset"
)

func main() {
	statement, err := bankstatement.ParseFile(context.Background(), "statement.pdf")
	if err != nil {
		log.Fatal(err)
	}

	output, _ := json.MarshalIndent(statement, "", "  ")
	fmt.Println(string(output))
}

Output example

{
  "bank": "JAGO",
  "account_name": "JOHN DOE",
  "account_no": "100000000001",
  "period": "April 2026",
  "currency": "IDR",
  "pockets": [
    {
      "name": "Main Pocket",
      "transactions": [
        {
          "date": "2026-04-13",
          "time": "11:33",
          "source_destination": "JOHN DOE — Jago 100000000002",
          "transaction_detail": "RDN Disbursement",
          "transaction_id": "260413-ABCD-EFGH01",
          "mutation_type": "CR",
          "notes": "WD jago",
          "amount": {
            "currency": "IDR",
            "display": "+Rp221.861",
            "value": 221861
          },
          "balance": {
            "currency": "IDR",
            "display": "Rp245.210",
            "value": 245210
          }
        }
      ]
    }
  ]
}

Supported banks

Bank Format Status
Bank Jago Monthly Statement PDF ✅ Supported
Bank Jago Pockets Transactions History PDF ✅ Supported
BCA Personal CSV e-statement (KlikBCA) ✅ Supported
BCA Bisnis CSV e-statement (KlikBCA Bisnis) ✅ Supported
Mandiri PDF / e-statement Planned
BRI PDF / e-statement Planned
BNI PDF / e-statement Planned
SeaBank PDF / e-statement Planned
Blu PDF / e-statement Planned

API

Parse a file (PDF or CSV, auto-detected)
statement, err := bankstatement.ParseFile(ctx, "statement.pdf")
statement, err := bankstatement.ParseFile(ctx, "statement.csv")
Parse extracted text
statement, err := bankstatement.ParseText(ctx, text)
Use custom parsers
import (
	"github.com/kankburhan/go-bankset"
	"github.com/kankburhan/go-bankset/banks/jago"
)

statement, err := bankstatement.ParseTextWithParsers(ctx, text, jago.NewJagoParser())

Model Structure (core package)

type Statement struct {
	Bank        BankCode      `json:"bank"`
	AccountName string        `json:"account_name,omitempty"`
	AccountNo   string        `json:"account_no,omitempty"`
	Period      string        `json:"period,omitempty"`
	Currency    string        `json:"currency,omitempty"`
	Pockets     []PocketGroup `json:"pockets"`
}

type PocketGroup struct {
	Name         string        `json:"name"`
	Transactions []Transaction `json:"transactions"`
}

type Transaction struct {
	Date              string `json:"date"`
	Time              string `json:"time"`
	SourceDestination string `json:"source_destination"`
	TransactionDetail string `json:"transaction_detail"`
	TransactionID     string `json:"transaction_id,omitempty"`
	MutationType      string `json:"mutation_type"`
	Notes             string `json:"notes,omitempty"`
	Amount            Money  `json:"amount"`
	Balance           Money  `json:"balance"`
	Raw               string `json:"raw,omitempty"`
}

Project structure

bankstatement.go       — Public facade API (ParseFile, ParseText, ParseCSVFile)
extractor.go           — PDF text extraction
core/              — Domain models and core logic
  model.go         — Statement, PocketGroup, Transaction, Money
  errors.go        — Error definitions
  parser.go        — Parser interface and Registry
  utils.go         — Shared utilities (IDR + BCA money parsing)
banks/             — Bank-specific parsers
  jago/
    jago.go        — Bank Jago parser
    jago_test.go   — Bank Jago tests
  bca/
    personal.go    — BCA Personal parser
    bisnis.go      — BCA Bisnis parser
    helpers.go     — Shared BCA CSV helpers
    bca_test.go    — BCA parser tests
examples/          — Usage examples

Changelog

v0.2.0
  • Unified date/time format across all banks: Transaction.Date is now always YYYY-MM-DD and Transaction.Time is always HH:mm (empty string if unavailable). Previously each bank used its own format — Jago returned "28 Mar 2022", BCA returned "02/05/2026", BCA time used "-" as a placeholder. Callers can now do time.Parse("2006-01-02", tx.Date) directly without branching on bank type.
v0.1.0
  • Initial release: Bank Jago (monthly statement + history PDF) and BCA Personal/Bisnis (CSV e-statement) parsing.

Privacy

Do not commit real bank statements into this repository. Use anonymized fixtures for tests.

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultRegistry

func DefaultRegistry() *core.Registry

DefaultRegistry returns a registry with all built-in bank parsers.

func ExtractPDFText

func ExtractPDFText(path string) (string, error)

ExtractPDFText extracts plain text from a PDF file.

func ParseCSVFile

func ParseCSVFile(ctx context.Context, path string) (*core.Statement, error)

ParseCSVFile reads a CSV file and parses the bank statement.

func ParseFile

func ParseFile(ctx context.Context, path string) (*core.Statement, error)

ParseFile reads a file (PDF or CSV), extracts the text, and parses the bank statement.

func ParseText

func ParseText(ctx context.Context, text string) (*core.Statement, error)

ParseText parses extracted text from a bank statement using the default registry.

func ParseTextWithParsers

func ParseTextWithParsers(ctx context.Context, text string, parsers ...core.Parser) (*core.Statement, error)

ParseTextWithParsers parses extracted text using the provided parsers.

Types

This section is empty.

Directories

Path Synopsis
banks
bca
examples
parse_pdf command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL