santander

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AnomalyAdjustmentDetail is the detail text for anomaly adjustment movements
	AnomalyAdjustmentDetail = "WARNING: AJUSTE POR FILA DESALINEADA - DECIMALES PERDIDOS"
)

Variables

This section is empty.

Functions

func ConvertRawWithMonthToMovement

func ConvertRawWithMonthToMovement(row pdftable.Row, cuotasSubDetailRegex *regexp.Regexp) (pdfcardsummary.Movement, error)

func ConvertRawWithoutMonthToMovement

func ConvertRawWithoutMonthToMovement(row pdftable.Row, cuotasSubDetailRegex *regexp.Regexp, lastMovementDate time.Time) (pdfcardsummary.Movement, error)

func ConvertToSaldoAnteriorMovement

func ConvertToSaldoAnteriorMovement(rawMovement pdftable.Row) (pdfcardsummary.Movement, error)

func ExtendPreviousMovementDetail

func ExtendPreviousMovementDetail(prevMov *pdfcardsummary.Movement, movExtension pdfcardsummary.MovementExtension) error

Types

type AnomalyAdjustment

type AnomalyAdjustment struct {
	Amount      decimal.Decimal
	Currency    Currency
	ShouldApply bool
}

AnomalyAdjustment represents a calculated anomaly adjustment

type AnomalyDetectionInfo

type AnomalyDetectionInfo struct {
	// HasAmountOnlyRowWithoutDecimals indicates if an amount-only row without decimals was detected
	HasAmountOnlyRowWithoutDecimals bool
	// AffectedCardIndex is the index of the card that had the glitched movement
	AffectedCardIndex int
	// AffectedMovementIndex is the index of the movement within the card that was glitched
	AffectedMovementIndex int
}

AnomalyDetectionInfo tracks when an amount-only row without decimals is detected

type Currency

type Currency string

Currency represents a currency type

const (
	CurrencyARS Currency = "ARS"
	CurrencyUSD Currency = "USD"
)

type SantanderExtractor

type SantanderExtractor struct {
	// contains filtered or unexported fields
}

SantanderExtractor extracts the Card Summary from Santander PDFs The inspection is ignored because having the name in the structs helps to disambiguate the files between different extractors

func NewSantanderExtractorFromDefaultCfg

func NewSantanderExtractorFromDefaultCfg() *SantanderExtractor

func (*SantanderExtractor) ExtractFromBytes

func (r *SantanderExtractor) ExtractFromBytes(rawBytes []byte) (pdfcardsummary.CardSummary, error)

func (*SantanderExtractor) ExtractFromDocument

func (r *SantanderExtractor) ExtractFromDocument(pdfDoc pdfwrapper.Document) (pdfcardsummary.CardSummary, error)

type SantanderExtractorConfig

type SantanderExtractorConfig struct {
	ClosingDateRegex             *regexp.Regexp
	ExpirationDateRegex          *regexp.Regexp
	SaldoAnteriorRegex           *regexp.Regexp
	EndOfPastPaymentsRegex       *regexp.Regexp
	TotalConsumosTarjetaRegex    *regexp.Regexp
	CuotasSubDetailRegex         *regexp.Regexp
	AmountOnlyRowRegex           *regexp.Regexp
	TableColumnPositions         pdftable.PDFTablePositions
	TableFirstRowPositionInPage  int
	TotalAmountsPage             int
	TotalAmountsRow              int
	TotalAmountsSanityCheckRegex *regexp.Regexp
}

func DefaultConfig

func DefaultConfig() SantanderExtractorConfig

type SantanderTableExtractor

type SantanderTableExtractor struct {
	// contains filtered or unexported fields
}

func (*SantanderTableExtractor) Extract

TODO: Add unit test for Extract method - test complete table extraction with mock iterator Test cases: empty iterator, only SALDO ANTERIOR, complete table with cards and taxes

func (*SantanderTableExtractor) GetAnomalyInfo

func (te *SantanderTableExtractor) GetAnomalyInfo() AnomalyDetectionInfo

GetAnomalyInfo returns the anomaly detection information

Jump to

Keyboard shortcuts

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