business

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountDetailResp

type AccountDetailResp struct {
	// IBAN
	Iban string `json:"iban,omitempty"`
	// BIC
	Bic string `json:"bic,omitempty"`
	// the account number
	AccountNo string `json:"account_no,omitempty"`
	// the sort code
	SortCode string `json:"sort_code,omitempty"`
	// the routing number
	RoutingNumber string `json:"routing_number,omitempty"`
	// the beneficiary name
	Beneficiary        string             `json:"beneficiary,omitempty"`
	BeneficiaryAddress BeneficiaryAddress `json:"beneficiary_address,omitempty"`
	// the country of the bank
	BankCountry string `json:"bank_country,omitempty"`
	// determines if this account address is pooled or unique
	Pooled bool `json:"pooled,omitempty"`
	// the reference of the pooled account
	UniqueReference string `json:"unique_reference,omitempty"`
	// the list of supported schemes, possible values: chaps, bacs, faster_payments, sepa, swift, ach
	Schemes       []AccountSchema `json:"schemes,omitempty"`
	EstimatedTime EstimatedTime   `json:"estimated_time,omitempty"`
}

type AccountResp

type AccountResp struct {
	// the account ID
	Id string `json:"id,omitempty"`
	// the account name
	Name string `json:"name,omitempty"`
	// the available balance
	Balance float64 `json:"balance,omitempty"`
	// the account currency
	Currency string `json:"currency,omitempty"`
	// the account state, one of active, inactive
	State AccountState `json:"state,omitempty"`
	// determines if the account is visible to other businesses on Revolut
	Public bool `json:"public,omitempty"`
	// the instant when the account was created
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// the instant when the account was last updated
	CreatedAt time.Time `json:"created_at,omitempty"`
}

type AccountSchema

type AccountSchema string
const (
	AccountSchema_CHAPS           AccountSchema = "chaps"
	AccountSchema_BACS            AccountSchema = "bacs"
	AccountSchema_FASTER_PAYMENTS AccountSchema = "faster_payments"
	AccountSchema_SEPA            AccountSchema = "sepa"
	AccountSchema_SWIFT           AccountSchema = "swift"
	AccountSchema_ACH             AccountSchema = "ach"
)

type AccountService

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

func (*AccountService) DetailWithId

func (a *AccountService) DetailWithId(id string) ([]*AccountDetailResp, error)

DetailWithId: This endpoint retrieves individual account details. doc: https://revolut-engineering.github.io/api-docs/business-api/#accounts-get-account-details

func (*AccountService) List

func (a *AccountService) List() ([]*AccountResp, error)

List: This endpoint retrieves your accounts. doc: https://revolut-engineering.github.io/api-docs/#business-api-business-api-accounts-get-accounts

func (*AccountService) WithId

func (a *AccountService) WithId(id string) (*AccountResp, error)

WithId: This endpoint retrieves one of your accounts by ID. doc: https://revolut-engineering.github.io/api-docs/#business-api-business-api-accounts-get-account

type AccountState

type AccountState string
const (
	AccountState_ACTIVE   AccountState = "active"
	AccountState_INACTIVE AccountState = "inactive"
)

type AccountUnit

type AccountUnit string
const (
	AccountUnit_DAYS  AccountUnit = "days"
	AccountUnit_HOURS AccountUnit = "hours"
)

type Amount

type Amount struct {
	Amount   float64 `json:"amount,omitempty"`
	Currency string  `json:"currency,omitempty"`
}

type AuthorizationCodeResp

type AuthorizationCodeResp struct {
	// the account ID
	Id string
	// the user authorisation code (if granted)
	Code string
}

type BeneficiaryAddress

type BeneficiaryAddress struct {
	// the address line 1 of the beneficiary
	StreetLine1 string `json:"street_line1,omitempty"`
	// the address line 2 of the beneficiary
	StreetLine2 string `json:"street_line2,omitempty"`
	// the region of the beneficiary
	Region string `json:"region,omitempty"`
	// the city of the beneficiary
	City string `json:"city,omitempty"`
	// the country of the beneficiary
	Country string `json:"country,omitempty"`
	// the postal code of the beneficiary
	Postcode string `json:"postcode,omitempty"`
}

type Client

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

func NewClient

func NewClient(clientId, refreshToken string, privateKey *rsa.PrivateKey, issuer string, sandbox bool) (*Client, error)

func (*Client) Account

func (b *Client) Account() *AccountService

func (*Client) Counterparty

func (b *Client) Counterparty() *CounterpartyService

func (*Client) Exchange

func (b *Client) Exchange() *ExchangeService

func (*Client) Payment

func (b *Client) Payment() *PaymentService

func (*Client) PaymentDraft

func (b *Client) PaymentDraft() *PaymentDraftService

func (*Client) Transfer

func (b *Client) Transfer() *TransferService

func (*Client) Webhook

func (b *Client) Webhook() *WebhookService

type CounterpartyProfileType

type CounterpartyProfileType string
const (
	CounterpartyProfileType_BUSINESS CounterpartyProfileType = "business"
	CounterpartyProfileType_PERSONAL CounterpartyProfileType = "personal"
)

type CounterpartyRecipientCharges

type CounterpartyRecipientCharges string
const (
	CounterpartyRecipientCharges_NO       CounterpartyRecipientCharges = "no"
	CounterpartyRecipientCharges_EXPECTED CounterpartyRecipientCharges = "expected"
)

type CounterpartyResp

type CounterpartyResp struct {
	// the ID of the counterparty
	Id string `json:"id,omitempty"`
	// the name of the counterparty
	Name string `json:"name,omitempty"`
	// the phone number of the counterparty
	Phone string `json:"phone,omitempty"`
	// the type of the Revolut profile, business or personal
	ProfileType CounterpartyProfileType `json:"profile_type,omitempty"`
	// the country of the bank
	Country string `json:"country,omitempty"`
	// the state of the counterparty, one of created, deleted
	State CounterpartyState `json:"state,omitempty"`
	// the instant when the counterparty was created
	CreatedAt time.Time `json:"created_at,omitempty"`
	// the instant when the counterparty was last updated
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// the list of public accounts of this counterparty
	Accounts []CounterpartyRespAccount `json:"accounts,omitempty"`
}

type CounterpartyRespAccount

type CounterpartyRespAccount struct {
	// the ID of a counterparty's account
	Id string `json:"id,omitempty"`
	// the currency of a counterparty's account
	Currency string `json:"currency,omitempty"`
	// the type of account, revolut or external
	Type string `json:"type,omitempty"`
	// bank account number
	AccountNo string `json:"account_no,omitempty"`
	// IBAN
	Iban string `json:"iban,omitempty"`
	// sort code
	SortCode    string `json:"sort_code,omitempty"`
	Email       string `json:"email,omitempty"`
	Name        string `json:"name,omitempty"`
	BankCountry string `json:"bank_country,omitempty"`
	// routing transit number
	RoutingNumber string `json:"routing_number,omitempty"`
	// BIC
	Bic string `json:"bic,omitempty"`
	// indicates the possibility of the recipient charges: no or expected
	RecipientCharges CounterpartyRecipientCharges `json:"recipient_charges,omitempty"`
}

type CounterpartyService

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

func (*CounterpartyService) AddNonRevolut

func (c *CounterpartyService) AddNonRevolut(nonRevolutCounterparty *NonRevolutCounterpartyReq) (*CounterpartyResp, error)

AddNonRevolut: You can create a counterparty for an non-Revolut bank account. doc: https://revolut-engineering.github.io/api-docs/#business-api-business-api-counterparties-add-non-revolut-counterparty

func (*CounterpartyService) AddRevolut

func (c *CounterpartyService) AddRevolut(revolutCounterparty *RevolutCounterpartyReq) (*CounterpartyResp, error)

AddRevolut: You can create a counterparty for an existing Revolut user. doc: https://revolut-engineering.github.io/api-docs/#business-api-business-api-counterparties-add-revolut-counterparty

func (*CounterpartyService) Delete

func (c *CounterpartyService) Delete(id string) error

Delete: This endpoint deletes a counterparty with the given ID. Once a counterparty is deleted no payments can be made to it. doc: https://revolut-engineering.github.io/api-docs/#business-api-business-api-counterparties-delete-counterparty

func (*CounterpartyService) List

func (c *CounterpartyService) List() ([]*CounterpartyResp, error)

List: This endpoint retrieves all your counterparties. doc: https://revolut-engineering.github.io/api-docs/#business-api-business-api-counterparties-get-counterparties

func (*CounterpartyService) WithId

WithId: This endpoint retrieves a counterparty by ID. doc https://revolut-engineering.github.io/api-docs/#business-api-business-api-counterparties-get-counterparty

type CounterpartyState

type CounterpartyState string
const (
	CounterpartyState_ACTIVE   CounterpartyState = "created"
	CounterpartyState_INACTIVE CounterpartyState = "deleted"
)

type CounterpartyType

type CounterpartyType string
const (
	CounterpartyType_SELF     CounterpartyType = "self"
	CounterpartyType_REVOLUT  CounterpartyType = "revolut"
	CounterpartyType_EXTERNAL CounterpartyType = "external"
)

type EstimatedTime

type EstimatedTime struct {
	// the unit of the inbound transfer time estimate, possible values: days, hours
	Unit AccountUnit `json:"unit,omitempty"`
	// the maximum estimate
	Min int `json:"min,omitempty"`
	// the minimum estimate
	Max int `json:"max,omitempty"`
}

type ExchangeAmount

type ExchangeAmount struct {
	// the account ID
	AccountId string  `json:"account_id,omitempty"`
	Amount    float64 `json:"amount,omitempty,omitempty"`
	Currency  string  `json:"currency,omitempty"`
}

type ExchangeRateReq

type ExchangeRateReq struct {
	// the currency you would like to exchange from
	From string
	// the currency you would like to exchange to
	To string
	// exchange amount, default is 1.00
	Amount float64
}

type ExchangeRateResp

type ExchangeRateResp struct {
	// information about the currency to exchange from
	From Amount `json:"from,omitempty"`
	// information about the currency to exchange to
	To Amount `json:"to,omitempty"`
	// exchange rate
	Rate float64 `json:"rate,omitempty"`
	// fee for the operation
	Fee Amount `json:"fee,omitempty"`
	// date of proposed exchange rate
	RateDate time.Time `json:"rate_date,omitempty"`
}

type ExchangeReq

type ExchangeReq struct {
	// information about the account you want to exchange from
	From ExchangeAmount `json:"from,omitempty"`
	// information about the account you want to exchange to
	To ExchangeAmount `json:"to,omitempty"`
	// a user-provided exchange reference
	Reference string `json:"reference,omitempty"`
	// a unique value used to handle duplicates submitted as a result of lost connection or another client error (40 characters max)
	RequestId string `json:"request_id,omitempty"`
}

type ExchangeResp

type ExchangeResp struct {
	// the ID of transaction
	Id string `json:"id,omitempty"`
	// is always exchange
	State string `json:"state,omitempty"`
	// reason code for declined or failed transaction state
	ReasonCode string `json:"reason_code,omitempty"`
	// the instant when the transaction was created
	CreatedAt time.Time `json:"created_at,omitempty"`
	// the instant when the transaction was completed
	CompletedAt time.Time `json:"completed_at,omitempty"`
}

type ExchangeService

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

func (*ExchangeService) Exchange

func (e *ExchangeService) Exchange(exchangeReq *ExchangeReq) (*ExchangeResp, error)

Exchange: To check the exchange rate and fees for the operation, please use the /rate endpoint. doc: https://revolut-engineering.github.io/api-docs/business-api/#exchanges-exchange-currency

type LegCounterparty

type LegCounterparty struct {
	// the counterparty ID
	Id string `json:"id,omitempty"`
	// the type of account: self, revolut, external
	Type CounterpartyType `json:"type,omitempty"`
	// the counterparty account ID
	AccountId string `json:"account_id,omitempty"`
}

type NonRevolutCounterpartyReq

type NonRevolutCounterpartyReq struct {
	// an optional name of the external company counterparty, this field must exist when individual_name does not
	CompanyName  string                                `json:"company_name,omitempty,omitempty"`
	InvidualName NonRevolutCounterpartyReqInvidualName `json:"invidual_name,omitempty,omitempty"`
	// the country of the bank
	BankCountry string `json:"bank_country,omitempty"`
	// the currency of a counterparty's account
	Currency string `json:"currency,omitempty"`
	// bank account number
	AccountNo string `json:"account_no,omitempty"`
	// sort code
	SortCode string `json:"sort_code,omitempty"`
	// routing transit number
	RoutingNumber string `json:"routing_number,omitempty"`
	// an optional email address of the beneficiary
	Email string `json:"email,omitempty,omitempty"`
	// an optional phone number of the beneficiary
	Phone   string                           `json:"phone,omitempty,omitempty"`
	Address NonRevolutCounterpartyReqAddress `json:"address,omitempty"`
}

type NonRevolutCounterpartyReqAddress

type NonRevolutCounterpartyReqAddress struct {
	// an optional address line 1 of the counterparty
	StreetLine1 string `json:"street_line1,omitempty,omitempty"`
	// an optional address line 2 of the counterparty
	StreetLine2 string `json:"street_line2,omitempty,omitempty"`
	// an optional region of the counterparty
	Region string `json:"region,omitempty,omitempty"`
	// an optional postal code of the counterparty
	Postcode string `json:"postcode,omitempty,omitempty"`
	// an optional city of the counterparty
	City string `json:"city,omitempty,omitempty"`
	// an optional the bankCountry of the counterparty
	Country string `json:"country,omitempty,omitempty"`
}

type NonRevolutCounterpartyReqInvidualName

type NonRevolutCounterpartyReqInvidualName struct {
	// an optional first name of the external individual counterparty, this field must exist when company_name does not
	FirstName string `json:"first_name,omitempty,omitempty"`
	// an optional last name of the external individual counterparty, this field must exist when company_name does not
	LastName string `json:"last_name,omitempty,omitempty"`
}

type OAuthResp

type OAuthResp struct {
	// the access token
	AccessToken string `json:"access_token,omitempty"`
	// "bearer" means that this token is valid to access the API
	TokenType string `json:"token_type,omitempty"`
	// token expiration time in seconds
	ExpiresIn int32 `json:"expires_in,omitempty"`
	// A token to be used to request a new access token
	RefreshToken string `json:"refresh_token,omitempty"`
}

type OAuthService

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

func NewOAuth

func NewOAuth(clientId string, privateKey *rsa.PrivateKey, issuer string, sandbox bool) *OAuthService

func (*OAuthService) ExchangeAuthorisationCode

func (oa *OAuthService) ExchangeAuthorisationCode(code string) (*OAuthResp, error)

ExchangeAuthorisationCode: This endpoint is used to exchange an authorisation code with an access token. doc: https://revolut-engineering.github.io/api-docs/#business-api-business-api-oauth-get-authorisation-code

func (*OAuthService) GetAuthorisationCode

func (oa *OAuthService) GetAuthorisationCode(clientId, redirectUri string) ([]*AuthorizationCodeResp, error)

GetAuthorisationCode: Navigate the user to this address to request an authorisation code doc: https://revolut-engineering.github.io/api-docs/business-api/#oauth-get-authorisation-code

func (*OAuthService) RefreshAccessToken

func (oa *OAuthService) RefreshAccessToken(refreshToken string) (*OAuthResp, error)

RefreshAccessToken: This endpoint is used to request a new user access token after the expiration date. doc: https://revolut-engineering.github.io/api-docs/#business-api-business-api-oauth-refresh-access-token

type PaymentDraftDetail

type PaymentDraftDetail struct {
	// an optional future date/time
	ScheduledFor string `json:"scheduled_for,omitempty"`
	// an optional title of payment
	Title string `json:"title,omitempty"`
	// a list of payments
	Payments []PaymentDraftDetailPayment `json:"payments,omitempty"`
}

type PaymentDraftDetailPayment

type PaymentDraftDetailPayment struct {
	Id     string           `json:"id,omitempty"`
	Amount ExchangeRateResp `json:"amount,omitempty"`
	// the ID of the account to pay from
	AccountId string `json:"account_id,omitempty"`
	// an optional textual reference shown on the transaction
	Reference string                      `json:"reference,omitempty,omitempty"`
	Receiver  PaymentDraftPaymentReceiver `json:"receiver,omitempty"`
	// the state of the transaction, one of CREATED, PENDING, COMPLETED, REVERTED, DECLINED, CANCELLED, FAILED, DELETED
	State PaymentDraftState `json:"state,omitempty"`
	// an optional textual description of state reason
	Reason string `json:"reason,omitempty,omitempty"`
	// an optional textual description of error
	ErrorMessage string `json:"error_message,omitempty,omitempty"`
	// explanation of conversation process
	CurrentChargeOptions ExchangeRateResp `json:"current_charge_options,omitempty"`
}

type PaymentDraftPayment

type PaymentDraftPayment struct {
	// the transaction currency
	Currency string `json:"currency,omitempty"`
	// the transaction amount
	Amount int `json:"amount,omitempty"`
	// the ID of the account to pay from (must be the same for all payments json)
	AccountId string                      `json:"account_id,omitempty"`
	Receiver  PaymentDraftPaymentReceiver `json:"receiver,omitempty,omitempty"`
	// a mandatory textual reference shown on the transaction
	Reference string `json:"reference,omitempty"`
}

type PaymentDraftPaymentReceiver

type PaymentDraftPaymentReceiver struct {
	// the ID of the receiving counterparty
	CounterpartyId string `json:"counterparty_id,omitempty"`
	// an optional ID of the receiving counterparty's account, can be own account (only for internal counterparties)
	AccountId string `json:"account_id,optional,omitempty"`
}

type PaymentDraftReq

type PaymentDraftReq struct {
	// an optional title of payment
	Title string `json:"title,omitempty"`
	// an optional future date/time
	ScheduleFor string `json:"schedule_for,omitempty"`
	// a list of planned transactions
	Payments []PaymentDraftPayment `json:"payments,omitempty"`
}

type PaymentDraftResp

type PaymentDraftResp struct {
	// the ID of the created draft payment
	Id string `json:"id,omitempty"`
}

type PaymentDraftState

type PaymentDraftState string
const (
	PaymentDraftState_PENDING   PaymentDraftState = "PENDING"
	PaymentDraftState_COMPLETE  PaymentDraftState = "COMPLETED"
	PaymentDraftState_DECLINE   PaymentDraftState = "DECLINED"
	PaymentDraftState_FAILED    PaymentDraftState = "FAILED"
	PaymentDraftState_CREATED   PaymentDraftState = "CREATED"
	PaymentDraftState_REVERTED  PaymentDraftState = "REVERTED"
	PaymentDraftState_CANCELLED PaymentDraftState = "CANCELLED"
	PaymentDraftState_DELETED   PaymentDraftState = "DELETED"
)

type PaymentDrafts

type PaymentDrafts struct {
	// a list of payments
	PaymentOrders []PaymentOrder `json:"payment_orders,omitempty"`
}

type PaymentOrder

type PaymentOrder struct {
	// the ID of the draft payment
	Id string `json:"id,omitempty"`
	// an optional future date/time
	ScheduledFor string `json:"scheduled_for,optional,omitempty"`
	// an optional title of payment
	Title string `json:"title,optional,omitempty"`
	// count of payments in current draft
	PaymentsCount int `json:"payments_count,omitempty"`
}

type PaymentReceiver

type PaymentReceiver struct {
	// the ID of the receiving counterparty
	CounterpartyId string `json:"counterparty_id,omitempty"`
	// the ID of the receiving counterparty's account, provide only for payments to business counterparties,
	//can be own account (only for internal counterparties)
	AccountId string `json:"account_id,omitempty"`
}

type PaymentReq

type PaymentReq struct {
	// the client provided ID of the transaction (40 characters max)
	RequestId string `json:"request_id,omitempty"`
	// the ID of the account to pay from
	AccountId string          `json:"account_id,omitempty"`
	Receiver  PaymentReceiver `json:"receiver,omitempty"`
	// the transaction amount
	Amount float64 `json:"amount,omitempty"`
	// the transaction currency
	Currency string `json:"currency,omitempty"`
	// an optional textual reference shown on the transaction
	Reference string `json:"reference,omitempty,omitempty"`
	// a future date/time
	// doc: https://revolut-engineering.github.io/api-docs/business-api/#payments-schedule-payment
	ScheduleFor string `json:"schedule_for,omitempty,omitempty"`
}

type PaymentService

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

func (*PaymentService) Cancel

func (p *PaymentService) Cancel(id string) error

Cancel: This endpoint allows to cancel a scheduled transaction that was initiated by you, via API. doc: https://revolut-engineering.github.io/api-docs/business-api/#payments-get-transaction

func (*PaymentService) Create

func (p *PaymentService) Create(paymentReq *PaymentReq) (*TransactionResp, error)

Create: This endpoint creates a new payment. If the payment is for another Revolut account, business or personal, the transaction may be processed synchronously. doc: https://revolut-engineering.github.io/api-docs/business-api/#payments-create-payment

func (*PaymentService) List

func (p *PaymentService) List(transactionReq *TransactionReq) ([]*TransactionResp, error)

List: This endpoint retrieves historical transactions based on the provided query criteria. doc: https://revolut-engineering.github.io/api-docs/business-api/#payments-get-transaction

func (*PaymentService) WithId

func (p *PaymentService) WithId(id string) (*TransactionResp, error)

WithId: To retrieve a transaction by ID doc: https://revolut-engineering.github.io/api-docs/business-api/#payments-get-transaction

func (*PaymentService) WithRequestId

func (p *PaymentService) WithRequestId(requestId string) (*TransactionResp, error)

WithRequestId: To retrieve a transaction by request ID doc: https://revolut-engineering.github.io/api-docs/business-api/#payments-get-transaction

type PaymentState

type PaymentState string
const (
	PaymentState_PENDING  PaymentState = "pending"
	PaymentState_COMPLETE PaymentState = "completed"
	PaymentState_DECLINE  PaymentState = "declined"
	PaymentState_FAILED   PaymentState = "failed"
)

type PaymentType

type PaymentType string
const (
	PaymentType_ATM             PaymentType = "atm"
	PaymentType_CARD_PAYMENT    PaymentType = "card_payment"
	PaymentType_CARD_REFUND     PaymentType = "card_refund"
	PaymentType_CARD_CHARGEBACK PaymentType = "card_chargeback"
	PaymentType_CARD_CREDIT     PaymentType = "card_credit"
	PaymentType_EXCHANGE        PaymentType = "exchange"
	PaymentType_TRANSFER        PaymentType = "transfer"
	PaymentType_LOAN            PaymentType = "loan"
	PaymentType_FEE             PaymentType = "fee"
	PaymentType_REFUND          PaymentType = "refund"
	PaymentType_TOPUP           PaymentType = "topup"
	PaymentType_TOPUP_RETURN    PaymentType = "topup_return"
	PaymentType_TAX             PaymentType = "tax"
	PaymentType_TAX_REFUND      PaymentType = "tax_refund"
)

type RevolutCounterpartyReq

type RevolutCounterpartyReq struct {
	// the type of the Revolut profile, business or personal
	ProfileType CounterpartyProfileType `json:"profile_type,omitempty"`
	// an optional name. Provide only with personal profile_type
	Name string `json:"name,omitempty,omitempty"`
	// an optional phone number of the counterparty. Provide only with personal profile_type.
	Phone string `json:"phone,omitempty,omitempty"`
	// an optional email address of an admin of a public Revolut Business account. Provide only with business profile_type.
	Email string `json:"email,omitempty,omitempty"`
}

type TransactionCard

type TransactionCard struct {
	// the masked card number
	CardNumber string `json:"card_number,omitempty"`
	// the cardholder's first name
	FirstName string `json:"first_name,omitempty"`
	// the cardholder's last name
	LastName string `json:"last_name,omitempty"`
	// the cardholder's phone number
	Phone string `json:"phone,omitempty"`
}

type TransactionCreatedEvent

type TransactionCreatedEvent struct {
	// the event name
	Event string `json:"event,omitempty"`
	// the event time
	Timestamp time.Time                   `json:"timestamp,omitempty"`
	Data      TransactionCreatedEventData `json:"data,omitempty"`
}

type TransactionCreatedEventData

type TransactionCreatedEventData struct {
	// the ID of transaction
	Id   string `json:"id,omitempty"`
	Type string `json:"type,omitempty"`
	// the client provided request ID
	RequestId string `json:"request_id,omitempty"`
	// the transction state: pending, completed, declined or failed
	State PaymentState `json:"state,omitempty"`
	// an optional reason code for declined or failed transaction state
	ReasonCode string `json:"reason_code,omitempty"`
	// the instant when the transaction was created
	CreatedAt time.Time `json:"created_at,omitempty"`
	// the instant when the transaction was last updated
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// the instant when the transaction was completed, mandatory for completed state only
	CompletedAt time.Time `json:"completed_at,omitempty"`
	// an optional date when the transaction was scheduled for
	ScheduledFor string `json:"scheduled_for,omitempty"`
	// a user provided payment reference
	Reference string `json:"reference,omitempty"`
	// the legs of transaction, there'll be 2 legs between your Revolut accounts and 1 leg in other cases
	Legs []TransactionLeg `json:"legs,omitempty"`
}

type TransactionLeg

type TransactionLeg struct {
	// the ID of the leg
	LegId string `json:"leg_id,omitempty"`
	// the ID of the account the transaction is associated with
	AccountId    string          `json:"account_id,omitempty"`
	Counterparty LegCounterparty `json:"counterparty,omitempty"`
	// the transaction amount
	Amount float64 `json:"amount,omitempty"`
	// the transaction currency
	Currency string `json:"currency,omitempty"`
	// the billing amount for cross-currency payments
	BillAmount float64 `json:"bill_amount,omitempty"`
	// the billing currency for cross-currency payments
	BillCurrency string `json:"bill_currency,omitempty"`
	// the transaction leg purpose
	Description string `json:"description,omitempty"`
	// a total balance of the account the transaction is associated with (optional)
	Balance float64 `json:"balance,omitempty,omitempty"`
}

type TransactionMerchant

type TransactionMerchant struct {
	// the merchant name
	Name string `json:"name,omitempty"`
	// the merchant city
	City string `json:"city,omitempty"`
	// the merchant category code
	CategoryCode string `json:"category_code,omitempty"`
	// 3-letter ISO bankCountry code
	Country string `json:"country,omitempty"`
}

type TransactionReq

type TransactionReq struct {
	// an optional timestamp to query from, filtering on the created_at field
	From string
	// an optional timestamp to query to, filtering on the created_at field. Default is now
	To string
	// an optional counterparty id
	Counterparty string
	// an optional number of records to return (1000 max, default is 100)
	Count int32
	// the transaction type, one of atm, card_payment, card_refund, card_chargeback, card_credit,
	//exchange, transfer, loan, fee, refund, topup, topup_return, tax, tax_refund
	Type PaymentType
}

type TransactionResp

type TransactionResp struct {
	// the ID of transaction
	Id string `json:"id,omitempty"`
	// he transaction type, one of atm, card_payment, card_refund, card_chargeback,
	//card_credit, exchange, transfer, loan, fee, refund, topup, topup_return, tax, tax_refund
	Type PaymentType `json:"type,omitempty"`
	// the client provided request ID
	RequestId string `json:"request_id,omitempty,omitempty"`
	// the transction state: pending, completed, declined or failed
	State PaymentState `json:"state,omitempty"`
	// the instant when the transaction was created
	CreatedAt time.Time `json:"created_at,omitempty"`
	// the instant when the transaction was last updated
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// the instant when the transaction was completed, mandatory for completed state only
	CompletedAt time.Time `json:"completed_at,omitempty,omitempty"`
	// an optional date when the transaction was scheduled for
	ScheduledFor string `json:"scheduled_for,omitempty"`
	// a user provided payment reference
	Reference string `json:"reference,omitempty,omitempty"`
	// the legs of transaction, there'll be 2 legs between your Revolut accounts and 1 leg in other cases
	Legs []TransactionLeg `json:"legs,omitempty"`
	// reason code for declined or failed transaction state
	ReasonCode string `json:"reason_code,omitempty,omitempty"`
	// the merchant info (only for card payments)
	Merchant TransactionMerchant `json:"merchant,omitempty,omitempty"`
	// the card information (only for card payments)
	Card TransactionCard `json:"card,omitempty,omitempty"`
	// the ID of the original transaction which has been refunded (only for refunds)
	RelatedTransactionId string `json:"related_transaction_id,omitempty,omitempty"`
}

type TransactionStateChangedEvent

type TransactionStateChangedEvent struct {
	// the event name
	Event string `json:"event,omitempty"`
	// the event time
	Timestamp time.Time                        `json:"timestamp,omitempty"`
	Data      TransactionStateChangedEventData `json:"data,omitempty"`
}

type TransactionStateChangedEventData

type TransactionStateChangedEventData struct {
	// the ID of the transaction
	ID string `json:"id,omitempty"`
	// previous state of the transaction
	OldState string `json:"old_state,omitempty"`
	// new state of the transaction
	NewState string `json:"new_state,omitempty"`
}

type TransferReq

type TransferReq struct {
	// a unique value used to handle duplicates submitted as a
	// result of lost connection or another client error (40 characters max)
	RequestId string `json:"request_id,omitempty"`
	// the ID of a source account
	SourceAccountId string `json:"source_account_id,omitempty"`
	// the ID of a target account
	TargetAccountId string `json:"target_account_id,omitempty"`
	// the transaction amount
	Amount float64 `json:"amount,omitempty"`
	// the transaction currency, both source and target accounts should be in this currency
	Currency string `json:"currency,omitempty"`
	// an optional textual reference shown on the transaction
	Reference string `json:"reference,omitempty,omitempty"`
}

type TransferResp

type TransferResp struct {
	// the ID of the created transaction
	Id string `json:"id,omitempty"`
	// the transction state: pending, completed, declined or failed
	State string `json:"state,omitempty"`
	// the instant when the transaction was created
	CreatedAt time.Time `json:"created_at,omitempty"`
	// the instant when the transaction was completed
	CompletedAt time.Time `json:"completed_at,omitempty"`
}

type TransferService

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

func (*TransferService) Create

func (t *TransferService) Create(transferReq *TransferReq) (*TransferResp, error)

Create: This endpoint processes transfers between accounts of the business with the same currency. doc: https://revolut-engineering.github.io/api-docs/business-api/#transfers-create-transfer

type TransferState

type TransferState string
const (
	TransferState_PENDING  TransferState = "pending"
	TransferState_COMPLETE TransferState = "completed"
	TransferState_DECLINE  TransferState = "declined"
	TransferState_FAILED   TransferState = "failed"
)

type WebhookService

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

func (*WebhookService) Delete

func (p *WebhookService) Delete() error

Delete: Use this API request to delete a web-hook doc: https://revolut-engineering.github.io/api-docs/business-api/#web-hooks-setting-up-a-web-hook

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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