Documentation
¶
Index ¶
- func CreateResponse(payment *domain.Payment, cfg config.Config) map[string]any
- func FromRecord(record *core.Record) *domain.Payment
- func PublicPayment(payment *domain.Payment) map[string]any
- type CapacityPool
- type CapacitySnapshot
- type CreateInput
- type MatchResult
- type Service
- func (s *Service) Cancel(id string) (*domain.Payment, error)
- func (s *Service) Capacity() (CapacitySnapshot, error)
- func (s *Service) Create(input CreateInput) (*domain.Payment, bool, error)
- func (s *Service) ExpireDue() (int, error)
- func (s *Service) ExpireDueInApp(tx core.App, now time.Time) (int, error)
- func (s *Service) Get(id string) (*domain.Payment, error)
- func (s *Service) ManualMatchInApp(tx core.App, paymentID string, parsed domain.ParsedSMS, now time.Time) (*core.Record, string, bool, error)
- func (s *Service) Match(parsed domain.ParsedSMS) (*MatchResult, error)
- func (s *Service) MatchInApp(tx core.App, parsed domain.ParsedSMS, now time.Time) (*core.Record, string, bool, error)
- func (s *Service) Stats() (map[string]int64, error)
- func (s *Service) WakeWebhooks()
- type WebhookScheduler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateResponse ¶
Types ¶
type CapacityPool ¶
type CapacityPool struct {
RequestedAmountPaise int64 `json:"requestedAmountPaise"`
RequestedAmount string `json:"requestedAmount"`
Pending int64 `json:"pending"`
Quarantined int64 `json:"quarantined"`
Blocked int64 `json:"blocked"`
Available int64 `json:"available"`
UtilizationPercent float64 `json:"utilizationPercent"`
Level string `json:"level"`
}
type CapacitySnapshot ¶
type CapacitySnapshot struct {
Pools []CapacityPool `json:"pools"`
WarningPools int `json:"warningPools"`
CriticalPools int `json:"criticalPools"`
}
type CreateInput ¶
type MatchResult ¶
type Service ¶
type Service struct {
App core.App
Config config.Config
Webhooks WebhookScheduler
Now func() time.Time
// SuffixStart is injectable for deterministic tests. Production uses crypto/rand.
SuffixStart func() (int64, error)
}
func NewService ¶
func (*Service) Capacity ¶
func (s *Service) Capacity() (CapacitySnapshot, error)
func (*Service) ExpireDueInApp ¶
ExpireDueInApp changes only currently pending records whose persisted expiry timestamp is due. Existing reuse_after is retained because it was fixed at creation as expires_at + quarantine.
func (*Service) ManualMatchInApp ¶
func (s *Service) ManualMatchInApp(tx core.App, paymentID string, parsed domain.ParsedSMS, now time.Time) (*core.Record, string, bool, error)
ManualMatchInApp explicitly links reviewed bank evidence to one payment. It still enforces exact amount equality and global RRN uniqueness; the operator chooses the payment, but cannot override those monetary invariants.
func (*Service) MatchInApp ¶
func (s *Service) MatchInApp(tx core.App, parsed domain.ParsedSMS, now time.Time) (*core.Record, string, bool, error)
MatchInApp applies exact-amount matching inside the caller's transaction. It returns whether outgoing webhook work was queued so the caller can wake the delivery loop only after the transaction commits.
func (*Service) WakeWebhooks ¶
func (s *Service) WakeWebhooks()
Click to show internal directories.
Click to hide internal directories.