plaidservice

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PlaidService

type PlaidService interface {
	GetSandboxToken(ctx context.Context) (plaid.ItemPublicTokenExchangeResponse, error)
	GetLinkToken(ctx context.Context, userID, webhookURL string) (string, error)
	GetLinkTokenForUpdateMode(ctx context.Context, userID, accessToken, webhookURL string) (string, error)
	GetAccessToken(ctx context.Context, publicToken string) (models.AccessResponse, error)
	InvalidateAccessToken(ctx context.Context, accessToken models.AccessResponse) (models.AccessResponse, error)
	GetAccounts(ctx context.Context, accessToken string) ([]plaid.AccountBase, string, error)
	GetItemInstitution(ctx context.Context, accessToken string) (string, error)
	GetBalances(ctx context.Context, accessToken string) (plaid.AccountsGetResponse, string, error)
	GetTransactions(ctx context.Context, accessToken, cursor string) (
		added, modified []plaid.Transaction, removed []plaid.RemovedTransaction, nextCursor, reqID string, err error)
	GetWebhookVerificationKey(ctx context.Context, keyID string) (plaid.JWKPublicKey, error)
	RemoveItem(ctx context.Context, accessToken string) error
}

Plaid interface

type Service

type Service struct {
	Client *plaid.APIClient
}

func NewPlaidService

func NewPlaidService(clientID, secret string) *Service

Creates a new APIClient for Plaid requests

func (*Service) GetAccessToken

func (p *Service) GetAccessToken(ctx context.Context, publicToken string) (models.AccessResponse, error)

Exchanges a public token received from client for a permanent access token for item from Plaid API

func (*Service) GetAccounts

func (p *Service) GetAccounts(ctx context.Context, accessToken string) ([]plaid.AccountBase, string, error)

Retrieves account data listed in a Plaid item

func (*Service) GetBalances

func (p *Service) GetBalances(ctx context.Context, accessToken string) (plaid.AccountsGetResponse, string, error)

Updates account balances for item

func (*Service) GetItemInstitution

func (p *Service) GetItemInstitution(ctx context.Context, accessToken string) (string, error)

Gets institution name for an item

func (*Service) GetLinkToken

func (p *Service) GetLinkToken(ctx context.Context, userID, webhookURL string) (string, error)

Requests Plaid API for a Link token for p.Client use

func (*Service) GetLinkTokenForUpdateMode

func (p *Service) GetLinkTokenForUpdateMode(ctx context.Context, userID, accessToken, webhookURL string) (string, error)

Requests Plaid API for a Link token configured with a user's access token, to initiate Update mode

func (*Service) GetSandboxToken added in v1.0.1

Sandbox access token generation

func (*Service) GetTransactions

func (p *Service) GetTransactions(ctx context.Context, accessToken, cursor string) (
	added, modified []plaid.Transaction, removed []plaid.RemovedTransaction, nextCursor, reqID string, err error,
)

Called by transactions/sync Plaid endpoint, getting all transaction data for a specific account. Returns last Plaid request ID in loop

func (*Service) GetWebhookVerificationKey

func (p *Service) GetWebhookVerificationKey(ctx context.Context, keyID string) (plaid.JWKPublicKey, error)

Gets the webhook verification key from Plaid

func (*Service) InvalidateAccessToken

func (p *Service) InvalidateAccessToken(ctx context.Context, accessToken models.AccessResponse) (models.AccessResponse, error)

Invalidates an item's access token, requesting a new one from Plaid API

func (*Service) RemoveItem

func (p *Service) RemoveItem(ctx context.Context, accessToken string) error

Deletes an item record on Plaid's database

Jump to

Keyboard shortcuts

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