Documentation ¶
Overview ¶
Package starling provides a client for using the Starling API.
Usage:
import "github.com/billglover/starling"
Construct a new Starling client, then call various methods on the API to access different functions of the Starling API. For example:
client := starling.NewClient(nil) // retrieve transactions for the current user txns, _, err := client.Transactions(ctx, nil)
The majority of the API calls will require you to pass in an access token:
ts := oauth2.StaticTokenSource( &oauth2.Token{AccessToken: "TOKEN"}, ) ctx := context.Background() tc := oauth2.NewClient(ctx, ts) client := starling.NewClient(tc)
The Starling API documentation is available at https://developer.starlingbank.com/docs.
Example (Live) ¶
package main import ( "context" "fmt" "net/url" "github.com/billglover/starling" "golang.org/x/oauth2" ) func main() { ts := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: "{{ACCESS_TOKEN}}"}) ctx := context.Background() tc := oauth2.NewClient(ctx, ts) baseURL, _ := url.Parse(starling.ProdURL) opts := starling.ClientOptions{BaseURL: baseURL} client := starling.NewClientWithOptions(tc, opts) txns, _, _ := client.Transactions(ctx, nil) for _, txn := range txns { fmt.Println(txn.Created, txn.Amount, txn.Currency, txn.Narrative) } }
Output:
Example (Sandbox) ¶
package main import ( "context" "fmt" "github.com/billglover/starling" "golang.org/x/oauth2" ) func main() { ts := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: "{{ACCESS_TOKEN}}"}) ctx := context.Background() tc := oauth2.NewClient(ctx, ts) client := starling.NewClient(tc) txns, _, _ := client.Transactions(ctx, nil) for _, txn := range txns { fmt.Println(txn.Created, txn.Amount, txn.Currency, txn.Narrative) } }
Output:
Index ¶
- Constants
- func Validate(r *http.Request, secret string) (bool, error)
- type Account
- type AccountID
- type AccountSummary
- type Address
- type AddressHistory
- type Amount
- type AuthError
- type Balance
- type Card
- type Client
- func (c *Client) Account(ctx context.Context) (*Account, *http.Response, error)
- func (c *Client) AccountBalance(ctx context.Context) (*Balance, *http.Response, error)
- func (c *Client) AccountID(ctx context.Context, uid string) (*AccountID, *http.Response, error)
- func (c *Client) Accounts(ctx context.Context) ([]AccountSummary, *http.Response, error)
- func (c *Client) AddressHistory(ctx context.Context) (*AddressHistory, *http.Response, error)
- func (c *Client) Card(ctx context.Context) (*Card, *http.Response, error)
- func (c *Client) Contact(ctx context.Context, uid string) (*Contact, *http.Response, error)
- func (c *Client) ContactAccount(ctx context.Context, cUID, aUID string) (*ContactAccount, *http.Response, error)
- func (c *Client) ContactAccounts(ctx context.Context, uid string) ([]ContactAccount, *http.Response, error)
- func (c *Client) Contacts(ctx context.Context) ([]Contact, *http.Response, error)
- func (c *Client) CreateContactAccount(ctx context.Context, ca ContactAccount) (string, *http.Response, error)
- func (c *Client) CreateReceipt(ctx context.Context, txnUID string, r Receipt) (*http.Response, error)
- func (c *Client) CreateRecurringTransfer(ctx context.Context, uid string, rtr RecurringTransferRequest) (string, *http.Response, error)
- func (c *Client) CreateSavingsGoal(ctx context.Context, uid string, sgReq SavingsGoalRequest) (*http.Response, error)
- func (c *Client) CreateScheduledPayment(ctx context.Context, p ScheduledPayment) (string, *http.Response, error)
- func (c *Client) CurrentUser(ctx context.Context) (*Identity, *http.Response, error)
- func (c *Client) Customer(ctx context.Context) (*Customer, *http.Response, error)
- func (c *Client) DDTransaction(ctx context.Context, uid string) (*DDTransaction, *http.Response, error)
- func (c *Client) DDTransactions(ctx context.Context, dr *DateRange) ([]DDTransaction, *http.Response, error)
- func (c *Client) DeleteContact(ctx context.Context, uid string) (*http.Response, error)
- func (c *Client) DeleteDirectDebitMandate(ctx context.Context, uid string) (*http.Response, error)
- func (c *Client) DeleteRecurringTransfer(ctx context.Context, uid string) (*http.Response, error)
- func (c *Client) DeleteSavingsGoal(ctx context.Context, uid string) (*http.Response, error)
- func (c *Client) DirectDebitMandate(ctx context.Context, uid string) (*DirectDebitMandate, *http.Response, error)
- func (c *Client) DirectDebitMandates(ctx context.Context) ([]DirectDebitMandate, *http.Response, error)
- func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*http.Response, error)
- func (c *Client) FPSTransactionIn(ctx context.Context, uid string) (*Transaction, *http.Response, error)
- func (c *Client) FPSTransactionOut(ctx context.Context, uid string) (*Transaction, *http.Response, error)
- func (c *Client) FPSTransactionsIn(ctx context.Context, dr *DateRange) ([]Transaction, *http.Response, error)
- func (c *Client) FPSTransactionsOut(ctx context.Context, dr *DateRange) ([]Transaction, *http.Response, error)
- func (c *Client) Feed(ctx context.Context, act, cat string, opts *FeedOpts) ([]Item, *http.Response, error)
- func (c *Client) FeedItem(ctx context.Context, act, cat, itm string) (*Item, *http.Response, error)
- func (c *Client) MakeLocalPayment(ctx context.Context, p LocalPayment) (*http.Response, error)
- func (c *Client) MastercardTransaction(ctx context.Context, uid string) (*MastercardTransaction, *http.Response, error)
- func (c *Client) MastercardTransactions(ctx context.Context, dr *DateRange) ([]MastercardTransaction, *http.Response, error)
- func (c *Client) Merchant(ctx context.Context, uid string) (*Merchant, *http.Response, error)
- func (c *Client) MerchantLocation(ctx context.Context, mUID, lUID string) (*MerchantLocation, *http.Response, error)
- func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)
- func (c *Client) RecurringTransfer(ctx context.Context, uid string) (*RecurringTransferRequest, *http.Response, error)
- func (c *Client) SavingsGoal(ctx context.Context, uid string) (*SavingsGoal, *http.Response, error)
- func (c *Client) SavingsGoalPhoto(ctx context.Context, uid string) (*Photo, *http.Response, error)
- func (c *Client) SavingsGoals(ctx context.Context) ([]SavingsGoal, *http.Response, error)
- func (c *Client) ScheduledPayments(ctx context.Context) ([]PaymentOrder, *http.Response, error)
- func (c *Client) SetDDSpendingCategory(ctx context.Context, uid, cat string) (*http.Response, error)
- func (c *Client) SetMastercardSpendingCategory(ctx context.Context, uid, cat string) (*http.Response, error)
- func (c *Client) Transaction(ctx context.Context, uid string) (*Transaction, *http.Response, error)
- func (c *Client) Transactions(ctx context.Context, dr *DateRange) ([]Transaction, *http.Response, error)
- func (c *Client) TransferFromSavingsGoal(ctx context.Context, goalUID string, a Amount) (string, *http.Response, error)
- func (c *Client) TransferToSavingsGoal(ctx context.Context, goalUID string, a Amount) (string, *http.Response, error)
- type ClientOptions
- type Contact
- type ContactAccount
- type Customer
- type DDTransaction
- type DateRange
- type DirectDebitMandate
- type Error
- type ErrorDetail
- type Errors
- type FeedOpts
- type Identity
- type Item
- type LocalPayment
- type MastercardTransaction
- type Merchant
- type MerchantLocation
- type PaymentAmount
- type PaymentOrder
- type Photo
- type Receipt
- type ReceiptItem
- type ReceiptNote
- type RecurrenceRule
- type RecurringTransferRequest
- type SavingsGoal
- type SavingsGoalRequest
- type ScheduledPayment
- type SpendingCategory
- type Transaction
- type WebHookContent
- type WebHookPayload
Examples ¶
Constants ¶
const ( // ProdURL for the production instance of the Starling API ProdURL = "https://api.starlingbank.com/" // SandboxURL for the sandbox instance of the Starling API SandboxURL = "https://api-sandbox.starlingbank.com/" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Account ¶
type Account struct { UID string `json:"id"` Name string `json:"name"` AccountNumber string `json:"accountNumber"` SortCode string `json:"sortCode"` Currency string `json:"currency"` IBAN string `json:"iban"` BIC string `json:"bic"` CreatedAt string `json:"createdAt"` }
Account represents bank account details
type AccountID ¶
type AccountID struct { ID string `json:"accountIdentifier"` BankID string `json:"bankIdentifier"` IBAN string `json:"iban"` BIC string `json:"bic"` }
AccountID represents the identifiers for an individual account
type AccountSummary ¶
type AccountSummary struct { UID string `json:"accountUid"` DefaultCategory string `json:"defaultCategory"` Currency string `json:"currency"` CreatedAt string `json:"createdAt"` }
AccountSummary represents the basic account details
type Address ¶
type Address struct { Street string `json:"streetAddress"` City string `json:"city"` Country string `json:"country"` Postcode string `json:"postcode"` }
Address is the physical address of the customer
type AddressHistory ¶
type AddressHistory struct { Current Address `json:"current"` Previous []Address `json:"previous"` }
AddressHistory are the current and previous physical addresses
type Amount ¶
type Amount struct { Currency string `json:"currency"` // ISO-4217 3 character currency code MinorUnits int64 `json:"minorUnits"` // Amount in the minor units of the given currency; eg pence in GBP, cents in EUR }
Amount represents the value and currency of a monetary amount
type Balance ¶
type Balance struct { Cleared float64 `json:"clearedBalance"` Effective float64 `json:"effectiveBalance"` PendingTxns float64 `json:"pendingTransactions"` Available float64 `json:"availableToSpend"` Overdraft float64 `json:"acceptedOverdraft"` Currency string `json:"currency"` Amount float64 `json:"amount"` }
Balance represents the balance on an account
type Card ¶
type Card struct { UID string `json:"id"` NameOnCard string `json:"nameOnCard"` Type string `json:"type"` Enabled bool `json:"enabled"` Cancelled bool `json:"cancelled"` ActivationRequested bool `json:"activationRequested"` Activated bool `json:"activated"` DispatchDate string `json:"dispatchDate"` LastFourDigits string `json:"lastFourDigits"` }
Card represents card details
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client holds configuration items for the Starling client and provides methods that interact with the Starling API.
func NewClient ¶
NewClient returns a new Starling API client. If a nil httpClient is provided, http.DefaultClient will be used. To use API methods which require authentication, provide an http.Client that will perform the authentication for you (such as that provided by the golang.org/x/oauth2 library). Inspiration: https://github.com/google/go-github/blob/master/github/github.go
func NewClientWithOptions ¶
func NewClientWithOptions(cc *http.Client, opts ClientOptions) *Client
NewClientWithOptions takes ClientOptions, configures and returns a new client.
func (*Client) AccountBalance ¶
AccountBalance returns the the account balance for the current customer.
func (*Client) AddressHistory ¶
AddressHistory returns the the customer details for the current customer.
func (*Client) ContactAccount ¶
func (c *Client) ContactAccount(ctx context.Context, cUID, aUID string) (*ContactAccount, *http.Response, error)
ContactAccount returns the specified account for a given contact.
func (*Client) ContactAccounts ¶
func (c *Client) ContactAccounts(ctx context.Context, uid string) ([]ContactAccount, *http.Response, error)
ContactAccounts returns the accounts for a given contact.
func (*Client) CreateContactAccount ¶
func (c *Client) CreateContactAccount(ctx context.Context, ca ContactAccount) (string, *http.Response, error)
CreateContactAccount creates the specified account for a given contact.
func (*Client) CreateReceipt ¶
func (c *Client) CreateReceipt(ctx context.Context, txnUID string, r Receipt) (*http.Response, error)
CreateReceipt creates a receipt for a given mastercard transaction.
func (*Client) CreateRecurringTransfer ¶
func (c *Client) CreateRecurringTransfer(ctx context.Context, uid string, rtr RecurringTransferRequest) (string, *http.Response, error)
CreateRecurringTransfer sets up the recurring transfer for a savings goal. It takes the UID of the savings goal, along with a RecurringTransferRequest and returns the UID of the recurring transfer. It also returns the http response in case this is required for further processing. An error is returned on failure.
func (*Client) CreateSavingsGoal ¶
func (c *Client) CreateSavingsGoal(ctx context.Context, uid string, sgReq SavingsGoalRequest) (*http.Response, error)
CreateSavingsGoal creates an individual savings goal based on a UID. It returns the http response in case this is required for further processing. An error will be returned if the API is unable to create the goal.
func (*Client) CreateScheduledPayment ¶
func (c *Client) CreateScheduledPayment(ctx context.Context, p ScheduledPayment) (string, *http.Response, error)
CreateScheduledPayment creates a scheduled payment. It returns the UID for the scheduled payment.
func (*Client) CurrentUser ¶
CurrentUser returns the identity of the current user.
func (*Client) DDTransaction ¶
func (c *Client) DDTransaction(ctx context.Context, uid string) (*DDTransaction, *http.Response, error)
DDTransaction returns an individual transaction for the current customer.
func (*Client) DDTransactions ¶
func (c *Client) DDTransactions(ctx context.Context, dr *DateRange) ([]DDTransaction, *http.Response, error)
DDTransactions returns a list of direct debit transactions for the current user. It accepts optional time.Time values to request transactions within a given date range. If these values are not provided the API returns the last 100 transactions.
func (*Client) DeleteContact ¶
DeleteContact deletes an individual contact for the current customer. It returns http.StatusNoContent on success. No payload is returned.
func (*Client) DeleteDirectDebitMandate ¶
DeleteDirectDebitMandate deletes an individual DirectDebitMandate for the current customer.
func (*Client) DeleteRecurringTransfer ¶
DeleteRecurringTransfer deletes the recurring transfer for a savings goal. It takes the UID of the savings goal and returns no content. It returns the http response in case this is required for further processing. An error is returned on failure.
func (*Client) DeleteSavingsGoal ¶
DeleteSavingsGoal deletes a savings goal for the current customer. It returns http.StatusNoContent on success. No payload is returned.
func (*Client) DirectDebitMandate ¶
func (c *Client) DirectDebitMandate(ctx context.Context, uid string) (*DirectDebitMandate, *http.Response, error)
DirectDebitMandate returns a single DirectDebitMandate for the current customer.
func (*Client) DirectDebitMandates ¶
func (c *Client) DirectDebitMandates(ctx context.Context) ([]DirectDebitMandate, *http.Response, error)
DirectDebitMandates returns the DirectDebitMandates for the current customer.
func (*Client) Do ¶
Do sends a request and returns the response. An error is returned if the request cannot be sent or if the API returns an error. If a response is received, the body response body is decoded and stored in the value pointed to by v. Inspiration: https://github.com/google/go-github/blob/master/github/github.go
func (*Client) FPSTransactionIn ¶
func (c *Client) FPSTransactionIn(ctx context.Context, uid string) (*Transaction, *http.Response, error)
FPSTransactionIn returns an individual transaction for the current customer.
func (*Client) FPSTransactionOut ¶
func (c *Client) FPSTransactionOut(ctx context.Context, uid string) (*Transaction, *http.Response, error)
FPSTransactionOut returns an individual transaction for the current customer.
func (*Client) FPSTransactionsIn ¶
func (c *Client) FPSTransactionsIn(ctx context.Context, dr *DateRange) ([]Transaction, *http.Response, error)
FPSTransactionsIn returns a list of inbound Faster Payments transaction summaries for the current user. It accepts optional time.Time values to request transactions within a given date range. If these values are not provided the API returns the last 100 transactions.
func (*Client) FPSTransactionsOut ¶
func (c *Client) FPSTransactionsOut(ctx context.Context, dr *DateRange) ([]Transaction, *http.Response, error)
FPSTransactionsOut returns a list of inbound Faster Payments transaction summaries for the current user. It accepts optional time.Time values to request transactions within a given date range. If these values are not provided the API returns the last 100 transactions.
func (*Client) Feed ¶
func (c *Client) Feed(ctx context.Context, act, cat string, opts *FeedOpts) ([]Item, *http.Response, error)
Feed returns a slice of Items for a given account and category. It returns an error if unable to retrieve the feed. Note: Feed uses the v2 API which is still under active development.
func (*Client) FeedItem ¶
FeedItem returns a feed Item for a given account and category. It returns an error if unable to retrieve the feed Item. Note: FeedItem uses the v2 API which is still under active development.
func (*Client) MakeLocalPayment ¶
MakeLocalPayment creates a local payment.
func (*Client) MastercardTransaction ¶
func (c *Client) MastercardTransaction(ctx context.Context, uid string) (*MastercardTransaction, *http.Response, error)
MastercardTransaction returns an individual mastercard transaction for the current customer.
func (*Client) MastercardTransactions ¶
func (c *Client) MastercardTransactions(ctx context.Context, dr *DateRange) ([]MastercardTransaction, *http.Response, error)
MastercardTransactions returns a list of transaction summaries for the current user. It accepts optional time.Time values to request transactions within a given date range. If these values are not provided the API returns the last 100 transactions.
func (*Client) MerchantLocation ¶
func (c *Client) MerchantLocation(ctx context.Context, mUID, lUID string) (*MerchantLocation, *http.Response, error)
MerchantLocation returns an individual merchant location based on the merchant UID and location UID.
func (*Client) NewRequest ¶
NewRequest creates an HTTP Request. The client baseURL is checked to confirm that it has a trailing slash. A relative URL should be provided without the leading slash. If a non-nil body is provided it will be JSON encoded and included in the request. Inspiration: https://github.com/google/go-github/blob/master/github/github.go
func (*Client) RecurringTransfer ¶
func (c *Client) RecurringTransfer(ctx context.Context, uid string) (*RecurringTransferRequest, *http.Response, error)
RecurringTransfer returns the recurring savings for savings goal based on a UID. It also returns the http response in case this is required for further processing. An error will be returned if unable to retrieve the recurring savings set-up from the API.
func (*Client) SavingsGoal ¶
SavingsGoal returns an individual savings goal based on a UID. It also returns the http response in case this is required for further processing. An error will be returned if unable to retrieve goals from the API.
func (*Client) SavingsGoalPhoto ¶
SavingsGoalPhoto returns the photo for savings goal based on a UID. It also returns the http response in case this is required for further processing. An error will be returned if unable to retrieve the photo from the API.
func (*Client) SavingsGoals ¶
SavingsGoals returns the savings goals for the current user. It also returns the http response in case this is required for further processing. It is possible that the user has no savings goals in which case a nil value will be returned. An error will be returned if unable to retrieve goals from the API.
func (*Client) ScheduledPayments ¶
ScheduledPayments retrieves a list of all the payment orders on the customer account. These may be orders for previous immediate payments or scheduled payment orders for future or on-going payments.
func (*Client) SetDDSpendingCategory ¶
func (c *Client) SetDDSpendingCategory(ctx context.Context, uid, cat string) (*http.Response, error)
SetDDSpendingCategory updates the spending category for a given direct debit.
func (*Client) SetMastercardSpendingCategory ¶
func (c *Client) SetMastercardSpendingCategory(ctx context.Context, uid, cat string) (*http.Response, error)
SetMastercardSpendingCategory updates the spending category for a given mastercard transaction.
func (*Client) Transaction ¶
Transaction returns an individual transaction for the current customer.
func (*Client) Transactions ¶
func (c *Client) Transactions(ctx context.Context, dr *DateRange) ([]Transaction, *http.Response, error)
Transactions returns a list of transaction summaries for the current user. It accepts optional time.Time values to request transactions within a given date range. If these values are not provided the API returns the last 100 transactions.
func (*Client) TransferFromSavingsGoal ¶
func (c *Client) TransferFromSavingsGoal(ctx context.Context, goalUID string, a Amount) (string, *http.Response, error)
TransferFromSavingsGoal transfers money out of a savings goal. It returns the http response in case this is required for further processing. An error will be returned if the API is unable to transfer the amount out of the savings goal.
func (*Client) TransferToSavingsGoal ¶
func (c *Client) TransferToSavingsGoal(ctx context.Context, goalUID string, a Amount) (string, *http.Response, error)
TransferToSavingsGoal transfers money into a savings goal. It returns the http response in case this is required for further processing. An error will be returned if the API is unable to transfer the amount into the savings goal.
type ClientOptions ¶
ClientOptions is a set of options that can be specified when creating a Starling client
type ContactAccount ¶
type ContactAccount struct { UID string `json:"id"` Type string `json:"type"` Name string `json:"name"` AccountNumber string `json:"accountNumber"` SortCode string `json:"sortCode"` }
ContactAccount holds payee account details
type Customer ¶
type Customer struct { UID string `json:"customerUid"` FirstName string `json:"firstName"` LastName string `json:"lastName"` DateOfBirth string `json:"dateOfBirth"` Email string `json:"email"` Phone string `json:"phone"` AccountHolderType string `json:"accountHolderType"` }
Customer represents the personal details of a customer
type DDTransaction ¶
type DDTransaction struct { UID string `json:"id"` Currency string `json:"currency"` Amount float64 `json:"amount"` Direction string `json:"direction"` Created string `json:"created"` Narrative string `json:"narrative"` Source string `json:"source"` MandateUID string `json:"mandateId"` Type string `json:"type"` MerchantUID string `json:"merchantId"` MerchantLocationUID string `json:"merchantLocationId"` SpendingCategory string `json:"spendingCategory"` }
DDTransaction represents the details of a direct debit transaction.
type DateRange ¶
DateRange holds two dates that represent a range. It is typically used when providing a range when querying the API.
type DirectDebitMandate ¶
type DirectDebitMandate struct { UID string `json:"uid"` Reference string `json:"reference"` Status string `json:"status"` Source string `json:"source"` Created string `json:"created"` Cancelled string `json:"cancelled"` OriginatorName string `json:"originatorName"` OriginatorUID string `json:"originatorUid"` }
DirectDebitMandate represents a single mandate
type ErrorDetail ¶
type ErrorDetail struct {
Message string `json:"message"`
}
ErrorDetail holds the details of an error message
type Identity ¶
type Identity struct { UID string `json:"customerUid"` ExpiresAt string `json:"expiresAt"` Authenticated bool `json:"authenticated"` ExpiresInSeconds int64 `json:"expiresInSeconds"` Scopes []string `json:"scopes"` }
Identity is the identity of the current user
type Item ¶
type Item struct { FeedItemUID string `json:"feedItemUid"` CategoryUID string `json:"categoryUid"` Amount Amount `json:"amount"` SourceAmount Amount `json:"sourceAmount"` Direction string `json:"direction"` TransactionTime time.Time `json:"transactionTime"` Source string `json:"source"` SourceSubType string `json:"sourceSubType"` Status string `json:"status"` CounterPartyType string `json:"counterPartyType"` CounterPartyUID string `json:"counterPartyUid"` CounterPartySubEntityUID string `json:"counterPartySubEntityUid"` Reference string `json:"reference"` Country string `json:"country"` SpendingCategory string `json:"spendingCategory"` }
Item is a single customer transaction in their feed
type LocalPayment ¶
type LocalPayment struct { Payment PaymentAmount `json:"payment"` DestinationAccountUID string `json:"destinationAccountUid"` Reference string `json:"reference"` }
LocalPayment represents a local payment
type MastercardTransaction ¶
type MastercardTransaction struct { Transaction Method string `json:"mastercardTransactionMethod"` Status string `json:"status"` SourceAmount float64 `json:"sourceAmount"` SourceCurrency string `json:"sourceCurrency"` MerchantUID string `json:"merchantId"` SpendingCategory string `json:"spendingCategory"` Country string `json:"country"` POSTimestamp string `json:"posTimestamp"` AuthorisationCode string `json:"authorisationCode"` EventUID string `json:"eventUid"` Receipt Receipt `json:"receipt"` CardLast4 string `json:"cardLast4"` }
MastercardTransaction represents the details of a card transaction
type Merchant ¶
type Merchant struct { UID string `json:"merchantUid"` Name string `json:"name"` Website string `json:"website"` PhoneNumber string `json:"phoneNumber"` TwitterUsername string `json:"twitterUsername"` }
Merchant represents details of a merchant
type MerchantLocation ¶
type MerchantLocation struct { UID string `json:"merchantLocationUid"` MerchantUID string `json:"merchantUid"` MerchantName string `json:"merchantName"` LocationName string `json:"locationName"` Address string `json:"address"` PhoneNumber string `json:"phoneNUmber"` GooglePlaceID string `json:"googlePlaceId"` MastercardMerchantCategoryCode int32 `json:"mastercardMerchantCategoryCode"` }
MerchantLocation represents details of a merchant location
type PaymentAmount ¶
PaymentAmount represents the currency and amount of a payment
type PaymentOrder ¶
type PaymentOrder struct { UID string `json:"paymentOrderId"` Currency string `json:"currency"` Amount float64 `json:"amount"` Reference string `json:"reference"` ReceivingContactAccountUID string `json:"receivingContactAccountId"` RecipientName string `json:"recipientName"` Immediate bool `json:"immediate"` RecurrenceRule RecurrenceRule `json:"recurrenceRule"` StartDate string `json:"startDate"` NextDate string `json:"nextDate"` CancelledAt string `json:"cancelledAt"` PaymentType string `json:"paymentType"` MandateUID string `json:"mandateId"` }
PaymentOrder is a single PaymentOrder
type Photo ¶
type Photo struct {
Base64EncodedPhoto string `json:"base64EncodedPhoto"` // A text (base 64) encoded picture to associate with the savings goal
}
Photo is a photo associated to a savings goal
type Receipt ¶
type Receipt struct { UID string `json:"receiptUid"` EventUID string `json:"eventUid"` MetadataSource string `json:"metadataSource"` ReceiptIdentifier string `json:"receiptIdentifier"` MerchantIdentifier string `json:"merchantIdentifier"` MerchantAddress string `json:"merchantAddress"` TotalAmount float64 `json:"totalAmount"` TotalTax float64 `json:"totalTax"` TaxReference string `json:"taxNumber"` AuthCode string `json:"authCode"` CardLast4 string `json:"cardLast4"` ProviderName string `json:"providerName"` Items []ReceiptItem `json:"items"` Notes []ReceiptNote `json:"notes"` }
Receipt is a receipt for a transaction
type ReceiptItem ¶
type ReceiptItem struct { UID string `json:"receiptItemUid"` Description string `json:"description"` Quantity int32 `json:"quantity"` Amount float64 `json:"amount"` Tax float64 `json:"tax"` URL string `json:"url"` }
ReceiptItem is a single item on a Receipt
type ReceiptNote ¶
type ReceiptNote struct { UID string `json:"noteUid"` Description string `json:"description"` URL string `json:"url"` }
ReceiptNote is a single item on a Receipt
type RecurrenceRule ¶
type RecurrenceRule struct { StartDate string `json:"startDate"` Frequency string `json:"frequency"` Interval int32 `json:"interval,omitempty"` Count int32 `json:"count,omitempty"` UntilDate string `json:"untilDate,omitempty"` WeekStart string `json:"weekStart"` }
RecurrenceRule defines the pattern for recurring events
type RecurringTransferRequest ¶
type RecurringTransferRequest struct { UID string `json:"transferUid,omitempty"` RecurrenceRule RecurrenceRule `json:"recurrenceRule"` Amount `json:"currencyAndAmount"` }
RecurringTransferRequest represents a request to create scheduled payment into a savings goal
type SavingsGoal ¶
type SavingsGoal struct { UID string `json:"uid"` // Unique identifier of the savings goal Name string `json:"name"` // Name of the savings goal Target Amount `json:"target"` TotalSaved Amount `json:"totalSaved"` SavedPercentage int32 `json:"savedPercentage"` // Percentage of target currently deposited in the savings goal }
SavingsGoal is a goal defined by a customer to hold savings
type SavingsGoalRequest ¶
type SavingsGoalRequest struct { Name string `json:"name"` // Name of the savings goal Currency string `json:"currency"` // ISO-4217 3 character currency code of the savings goal Target Amount `json:"target"` Base64EncodedPhoto string `json:"base64EncodedPhoto"` // A text (base 64) encoded picture to associate with the savings goal }
SavingsGoalRequest is a request to create a new savings goal
type ScheduledPayment ¶
type ScheduledPayment struct { LocalPayment Schedule RecurrenceRule `json:"recurrenceRule"` }
ScheduledPayment represents a scheduled payment
type SpendingCategory ¶
type SpendingCategory struct {
SpendingCategory string `json:"spendingCategory"`
}
SpendingCategory is the category associated with a transaction
type Transaction ¶
type Transaction struct { UID string `json:"id"` Currency string `json:"currency"` Amount float64 `json:"amount"` Direction string `json:"direction"` Created string `json:"created"` Narrative string `json:"narrative"` Source string `json:"source"` Balance float64 `json:"balance,omitempty"` }
Transaction represents the details of a transaction.
type WebHookContent ¶
type WebHookContent struct { Class string `json:"class"` TransactionUID string `json:"transactionUid"` Amount float64 `json:"amount"` SourceCurrency string `json:"sourceCurrency"` SourceAmount float64 `json:"sourceAmount"` CounterParty string `json:"counterParty"` Reference string `json:"reference"` Type string `json:"type"` ForCustomer string `json:"forCustomer"` }
WebHookContent defines the structure of the Starling web hook content
type WebHookPayload ¶
type WebHookPayload struct { WebhookNotificationUID string `json:"webhookNotificationUid"` Timestamp time.Time `json:"timestamp"` Content WebHookContent `json:"content"` AccountHolderUID string `json:"accountHolderUid"` WebhookType string `json:"webhookType"` CustomerUID string `json:"customerUid"` UID string `json:"uid"` }
WebHookPayload defines the structure of the Starling web hook payload