swervpay

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: MIT Imports: 10 Imported by: 0

README

Go Client for Swervpay

Coverage Status Go Report Card GoDoc License


Explore the docs »

X (Twitter) · Linkedin · Changelog

Installation

Use go get.

$ go get github.com/Swerv-Ltd/swervpay-go

Documentation

See docs for Go here

Documentation

Overview

Package swervpay provides a set of APIs to interact with the Swervpay service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateURLPath

func GenerateURLPath(path string, query interface{}) string

Types

type AuthResponse

type AuthResponse struct {
	AccessToken string      `json:"access_token"`
	Token       TokenDetail `json:"token"`
}

type Bank

type Bank struct {
	Code string `json:"code"` // Code is the unique identifier for the bank.
	Name string `json:"name"` // Name is the name of the bank.
}

Bank represents a bank in the Swervpay system.

type Business

type Business struct {
	Address   string `json:"address"`    // Address of the business
	Name      string `json:"name"`       // Name of the business
	Country   string `json:"country"`    // Country where the business is located
	CreatedAt string `json:"created_at"` // Time when the business was created
	Email     string `json:"email"`      // Email of the business
	ID        string `json:"id"`         // Unique identifier of the business
	Slug      string `json:"slug"`       // Slug of the business
	Type      string `json:"type"`       // Type of the business
	UpdatedAt string `json:"updated_at"` // Time when the business was last updated
}

Business represents a business entity in the Swervpay system. It includes various properties like address, name, country, etc.

type BusinessInt

type BusinessInt interface {
	// Get retrieves the Business information from the Swervpay system.
	Get(ctx context.Context) (*Business, error)
}

BusinessInt is an interface that defines the methods a Business must have.

type BusinessIntImpl

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

BusinessIntImpl is a concrete implementation of the BusinessInt interface.

func (*BusinessIntImpl) Get

func (b *BusinessIntImpl) Get(ctx context.Context) (*Business, error)

Get is a method on BusinessIntImpl that retrieves the Business information from the Swervpay system. https://docs.swervpay.co/api-reference/business/get

type Card

type Card struct {
	AddressCity       string  `json:"address_city"`        // City of the card holder's address.
	AddressCountry    string  `json:"address_country"`     // Country of the card holder's address.
	AddressPostalCode string  `json:"address_postal_code"` // Postal code of the card holder's address.
	AddressState      string  `json:"address_state"`       // State of the card holder's address.
	AddressStreet     string  `json:"address_street"`      // Street of the card holder's address.
	Balance           float64 `json:"balance"`             // Balance on the card.
	CardNumber        string  `json:"card_number"`         // Card number.
	CreatedAt         string  `json:"created_at"`          // Creation date of the card.
	Currency          string  `json:"currency"`            // Currency of the card.
	Cvv               string  `json:"cvv"`                 // CVV of the card.
	Expiry            string  `json:"expiry"`              // Expiry date of the card.
	Freeze            bool    `json:"freeze"`              // Freeze status of the card.
	ID                string  `json:"id"`                  // ID of the card.
	Issuer            string  `json:"issuer"`              // Issuer of the card.
	MaskedPan         string  `json:"masked_pan"`          // Masked PAN of the card.
	NameOnCard        string  `json:"name_on_card"`        // Name on the card.
	Status            string  `json:"status"`              // Status of the card.
	TotalFunded       float64 `json:"total_funded"`        // Total funded amount on the card.
	Type              string  `json:"type"`                // Type of the card.
	UpdatedAt         string  `json:"updated_at"`          // Last update date of the card.
}

Card represents a card with its details.

type CardCreationResponse

type CardCreationResponse struct {
	CardID  string `json:"card_id"` // ID of the created card.
	Message string `json:"message"` // Message of the response.
}

CardCreationResponse represents the response of a card creation request.

type CardInt

type CardInt interface {
	Gets(ctx context.Context, query *PageAndLimitQuery) (*[]Card, error)                                      // Gets multiple cards.
	Get(ctx context.Context, id string) (*Card, error)                                                        // Gets a single card.
	Create(ctx context.Context, body *CreateCardBody) (*CardCreationResponse, error)                          // Creates a card.
	Fund(ctx context.Context, id string, body *FundOrWithdrawCardBody) (*DefaultResponse, error)              // Funds a card.
	Withdraw(ctx context.Context, id string, body *FundOrWithdrawCardBody) (*DefaultResponse, error)          // Withdraws from a card.
	Terminate(ctx context.Context, id string) (*DefaultResponse, error)                                       // Terminates a card.
	Freeze(ctx context.Context, id string) (*DefaultResponse, error)                                          // Freezes a card.
	Transactions(ctx context.Context, id string, query *PageAndLimitQuery) (*[]CardTransactionHistory, error) // Gets multiple transactions of a card.
	Transaction(ctx context.Context, id string, transactionId string) (*CardTransactionHistory, error)        // Gets a single transaction of a card.
}

CardInt is the interface for card operations.

type CardIntImpl

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

CardIntImpl is the implementation of the CardInt interface.

func (CardIntImpl) Create

Create creates a card. https://docs.swervpay.co/api-reference/cards/create

func (CardIntImpl) Freeze

func (c CardIntImpl) Freeze(ctx context.Context, id string) (*DefaultResponse, error)

Freeze freezes a card. https://docs.swervpay.co/api-reference/cards/freeze

func (CardIntImpl) Get

func (c CardIntImpl) Get(ctx context.Context, id string) (*Card, error)

Get gets a single card. https://docs.swervpay.co/api-reference/cards/get

func (CardIntImpl) Gets

func (c CardIntImpl) Gets(ctx context.Context, query *PageAndLimitQuery) (*[]Card, error)

Gets gets multiple cards. https://docs.swervpay.co/api-reference/cards/get-all-cards

func (CardIntImpl) Terminate

func (c CardIntImpl) Terminate(ctx context.Context, id string) (*DefaultResponse, error)

Terminate terminates a card. https://docs.swervpay.co/api-reference/cards/terminate

func (CardIntImpl) Transaction

func (c CardIntImpl) Transaction(ctx context.Context, id string, transactionId string) (*CardTransactionHistory, error)

Transaction get transactions of a card. https://docs.swervpay.co/api-reference/cards/get-transaction

func (CardIntImpl) Transactions

func (c CardIntImpl) Transactions(ctx context.Context, id string, query *PageAndLimitQuery) (*[]CardTransactionHistory, error)

Transactions gets multiple transactions of a card. https://docs.swervpay.co/api-reference/cards/transactions

func (CardIntImpl) Withdraw

Withdraw withdraws from a card. https://docs.swervpay.co/api-reference/cards/withdraw-from-card

type CardTransactionHistory

type CardTransactionHistory struct {
	Amount             float64 `json:"amount"`               // Transaction amount.
	Category           string  `json:"category"`             // Category of the transaction.
	Charges            float64 `json:"charges"`              // Charges of the transaction.
	CreatedAt          string  `json:"created_at"`           // Creation date of the transaction.
	Currency           string  `json:"currency"`             // Currency of the transaction.
	ID                 string  `json:"id"`                   // ID of the transaction.
	MerchantCity       string  `json:"merchant_city"`        // City of the merchant.
	MerchantCountry    string  `json:"merchant_country"`     // Country of the merchant.
	MerchantMcc        string  `json:"merchant_mcc"`         // MCC of the merchant.
	MerchantMid        string  `json:"merchant_mid"`         // MID of the merchant.
	MerchantName       string  `json:"merchant_name"`        // Name of the merchant.
	MerchantPostalCode string  `json:"merchant_postal_code"` // Postal code of the merchant.
	MerchantState      string  `json:"merchant_state"`       // State of the merchant.
	Reference          string  `json:"reference"`            // Reference of the transaction.
	Report             bool    `json:"report"`               // Report status of the transaction.
	ReportMessage      string  `json:"report_message"`       // Report message of the transaction.
	Status             string  `json:"status"`               // Status of the transaction.
	Type               string  `json:"type"`                 // Type of the transaction.
	UpdatedAt          string  `json:"updated_at"`           // Last update date of the transaction.
}

CardTransactionHistory represents a card's transaction history.

type CollectionHistory

type CollectionHistory struct {
	Amount        float64 `json:"amount"`         // The amount of the collection.
	Charges       float64 `json:"charges"`        // The charges associated with the collection.
	CreatedAt     string  `json:"created_at"`     // The creation date of the collection.
	Currency      string  `json:"currency"`       // The currency of the collection.
	ID            string  `json:"id"`             // The ID of the collection.
	PaymentMethod string  `json:"payment_method"` // The payment method used for the collection.
	Reference     string  `json:"reference"`      // The reference of the collection.
	UpdatedAt     string  `json:"updated_at"`     // The last update date of the collection.
}

CollectionHistory represents the history of a collection.

type CollectionInt

type CollectionInt interface {
	Gets(ctx context.Context, query *PageAndLimitQuery) (*[]Wallet, error)                               // Gets a list of wallets.
	Get(ctx context.Context, id string) (*Wallet, error)                                                 // Gets a specific wallet.
	Create(ctx context.Context, body *CreateCollectionBody) (*Wallet, error)                             // Creates a new wallet.
	Transactions(ctx context.Context, id string, query *PageAndLimitQuery) (*[]CollectionHistory, error) // Gets the transactions of a specific wallet.
}

CollectionInt is an interface that defines the operations that can be performed on collections.

type CollectionIntImpl

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

CollectionIntImpl is an implementation of the CollectionInt interface.

func (CollectionIntImpl) Create

Create creates a new wallet. https://docs.swervpay.co/api-reference/collections/create

func (CollectionIntImpl) Get

func (c CollectionIntImpl) Get(ctx context.Context, id string) (*Wallet, error)

Get retrieves a specific wallet. https://docs.swervpay.co/api-reference/collections/get

func (CollectionIntImpl) Gets

func (c CollectionIntImpl) Gets(ctx context.Context, query *PageAndLimitQuery) (*[]Wallet, error)

Gets retrieves a list of wallets. https://docs.swervpay.co/api-reference/collections/get-all-collections

func (CollectionIntImpl) Transactions

func (c CollectionIntImpl) Transactions(ctx context.Context, id string, query *PageAndLimitQuery) (*[]CollectionHistory, error)

Transactions retrieves the transactions of a specific wallet. https://docs.swervpay.co/api-reference/collections/transaction

type CreateCardBody

type CreateCardBody struct {
	Amount     float64 `json:"amount"`       // Amount to be loaded on the card.
	CustomerId string  `json:"customer_id"`  // ID of the customer.
	Provider   string  `json:"provider"`     // Provider of the card.
	NameOnCard string  `json:"name_on_card"` // Name to be printed on the card.
	Currency   string  `json:"currency"`     // Currency of the card.
	Type       string  `json:"type"`         // Type of the card.
}

CreateCardBody represents the body of a card creation request.

type CreateCollectionBody

type CreateCollectionBody struct {
	CustomerID   string  `json:"customer_id"`   // The ID of the customer.
	Currency     string  `json:"currency"`      // The currency of the collection.
	MerchantName string  `json:"merchant_name"` // The name of the merchant.
	Amount       float64 `json:"amount"`        // The amount of the collection.
	Type         string  `json:"type"`          // The type of the collection.
}

CreateCollectionBody represents the body of a create collection request.

type CreateCustomerBody

type CreateCustomerBody struct {
	Country    string `json:"country"`    // The country of the new customer.
	Email      string `json:"email"`      // The email of the new customer.
	Firstname  string `json:"firstname"`  // The first name of the new customer.
	Lastname   string `json:"lastname"`   // The last name of the new customer.
	Middlename string `json:"middlename"` // The middle name of the new customer.
}

CreateCustomerBody represents the body of a request to create a new customer.

type CreatePayoutBody

type CreatePayoutBody struct {
	Reference     string `json:"reference"`      // Unique reference for the payout
	AccountNumber string `json:"account_number"` // Account number to send the payout to
	Narration     string `json:"narration"`      // Description of the payout
	BankCode      string `json:"bank_code"`      // Code of the bank for the account
	Currency      string `json:"currency"`       // Currency of the payout
	Amount        int64  `json:"amount"`         // Amount of the payout
}

CreatePayoutBody represents the request body for creating a payout.

type CreatePayoutResponse

type CreatePayoutResponse struct {
	Reference string `json:"reference"` // Unique reference for the payout
	Message   string `json:"message"`   // Message indicating the status of the payout
}

CreatePayoutResponse represents the response from creating a payout.

type Customer

type Customer struct {
	Country       string `json:"country"`        // The country of the customer.
	CreatedAt     string `json:"created_at"`     // The creation date of the customer.
	Email         string `json:"email"`          // The email of the customer.
	FirstName     string `json:"first_name"`     // The first name of the customer.
	ID            string `json:"id"`             // The ID of the customer.
	IsBlacklisted bool   `json:"is_blacklisted"` // Whether the customer is blacklisted.
	LastName      string `json:"last_name"`      // The last name of the customer.
	MiddleName    string `json:"middle_name"`    // The middle name of the customer.
	PhoneNumber   string `json:"phone_number"`   // The phone number of the customer.
	Status        string `json:"status"`         // The status of the customer.
	UpdatedAt     string `json:"updated_at"`     // The last update date of the customer.
}

Customer represents a customer in the Swervpay system.

type CustomerInt

type CustomerInt interface {
	Gets(ctx context.Context, query *PageAndLimitQuery) (*[]Customer, error)             // Gets a list of customers.
	Get(ctx context.Context, id string) (*Customer, error)                               // Gets a specific customer.
	Create(ctx context.Context, body *CreateCustomerBody) (*Customer, error)             // Creates a new customer.
	Update(ctx context.Context, id string, body *UpdateustomerBody) (*Customer, error)   // Updates a specific customer.
	Kyc(ctx context.Context, id string, body *CustomerKycBody) (*DefaultResponse, error) // Updates the KYC information of a specific customer.
	Blacklist(ctx context.Context, id string) (*DefaultResponse, error)                  // Blacklists a specific customer.
}

CustomerInt is an interface that defines the methods for interacting with customers in the Swervpay system.

type CustomerIntImpl

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

CustomerIntImpl is an implementation of the CustomerInt interface.

func (CustomerIntImpl) Blacklist

func (c CustomerIntImpl) Blacklist(ctx context.Context, id string) (*DefaultResponse, error)

Blacklist blacklists a specific customer. https://docs.swervpay.co/api-reference/customers/blacklist

func (CustomerIntImpl) Create

Create creates a new customer. https://docs.swervpay.co/api-reference/customers/create

func (CustomerIntImpl) Get

func (c CustomerIntImpl) Get(ctx context.Context, id string) (*Customer, error)

Get retrieves a specific customer. https://docs.swervpay.co/api-reference/customers/get

func (CustomerIntImpl) Gets

func (c CustomerIntImpl) Gets(ctx context.Context, query *PageAndLimitQuery) (*[]Customer, error)

Gets retrieves a list of customers. https://docs.swervpay.co/api-reference/customers/get-all-customers

func (CustomerIntImpl) Kyc

Kyc updates the KYC information of a specific customer. https://docs.swervpay.co/api-reference/customers/kyc

func (CustomerIntImpl) Update

func (c CustomerIntImpl) Update(ctx context.Context, id string, body *UpdateustomerBody) (*Customer, error)

Update updates a specific customer. https://docs.swervpay.co/api-reference/customers/update

type CustomerKycBody

type CustomerKycBody struct {
	Tier  string        `json:"tier"`        // The tier of the KYC information.
	Tier1 Tier1KycInput `json:"information"` // The tier 1 KYC information.
	Tier2 Tier2KycInput `json:"document"`    // The tier 2 KYC information.
}

CustomerKycBody represents the body of a request to update a customer's KYC information.

type DefaultResponse

type DefaultResponse struct {
	Message string `json:"message"`
}

DefaultResponse represents the default response from the Swervpay API.

type FromOrTo

type FromOrTo struct {
	Amount   string `json:"amount"`   // Amount is the amount in the currency.
	Currency string `json:"currency"` // Currency is the currency code.
}

FromOrTo represents a currency and amount in a foreign exchange operation.

type FundOrWithdrawCardBody

type FundOrWithdrawCardBody struct {
	Amount float64 `json:"amount"` // Amount to be funded or withdrawn.
}

FundOrWithdrawCardBody represents the body of a fund or withdraw request.

type FxBody

type FxBody struct {
	Amount float64 `json:"amount"` // Amount is the amount to be converted.
	From   string  `json:"from"`   // From is the currency to convert from.
	To     string  `json:"to"`     // To is the currency to convert to.
}

FxBody represents the body of a foreign exchange request.

type FxInt

type FxInt interface {
	// Rate gets the conversion rate for a foreign exchange operation.
	Rate(ctx context.Context, body FxBody) (*FxRateResponse, error)
	// Exchange performs a foreign exchange operation.
	Exchange(ctx context.Context, body FxBody) (*Transaction, error)
}

FxInt is an interface for foreign exchange operations.

type FxIntImpl

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

FxIntImpl is an implementation of the FxInt interface.

func (FxIntImpl) Exchange

func (f FxIntImpl) Exchange(ctx context.Context, body FxBody) (*Transaction, error)

Exchange performs a foreign exchange operation. https://docs.swervpay.co/api-reference/fx/create

func (FxIntImpl) Rate

func (f FxIntImpl) Rate(ctx context.Context, body FxBody) (*FxRateResponse, error)

Rate gets the conversion rate for a foreign exchange operation. https://docs.swervpay.co/api-reference/fx/get

type FxRateResponse

type FxRateResponse struct {
	Rate float64  `json:"rate"` // Rate is the conversion rate.
	From FromOrTo `json:"from"` // From represents the original currency and amount.
	To   FromOrTo `json:"to"`   // To represents the converted currency and amount.
}

FxRateResponse represents the response from a foreign exchange rate request.

type InvalidRequestError

type InvalidRequestError struct {
	StatusCode int    `json:"statusCode,omitempty"`
	Name       string `json:"name,omitempty"`
	Message    string `json:"message"`
}

InvalidRequestError represents an error caused by the client.

type OtherInt

type OtherInt interface {
	// Banks retrieves a list of all banks in the Swervpay system.
	Banks(ctx context.Context) (*[]Bank, error)
	// ResolveAccountNumber resolves an account number in the Swervpay system.
	ResolveAccountNumber(ctx context.Context, body ResolveAccountNumberBody) (*ResolveAccountNumber, error)
}

OtherInt is an interface for interacting with the Swervpay API.

type OtherIntImpl

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

OtherIntImpl is an implementation of the OtherInt interface.

func (OtherIntImpl) Banks

func (o OtherIntImpl) Banks(ctx context.Context) (*[]Bank, error)

Banks retrieves a list of all banks in the Swervpay system. https://docs.swervpay.co/api-reference/others/get-banks

func (OtherIntImpl) ResolveAccountNumber

func (o OtherIntImpl) ResolveAccountNumber(ctx context.Context, body ResolveAccountNumberBody) (*ResolveAccountNumber, error)

ResolveAccountNumber resolves an account number in the Swervpay system. https://docs.swervpay.co/api-reference/others/resolve-account-number

type PageAndLimitQuery

type PageAndLimitQuery struct {
	Page  int `json:"page"`
	Limit int `json:"limit"`
}

type PayoutInt

type PayoutInt interface {
	// Get retrieves a payout by its ID.
	Get(ctx context.Context, id string) (*Transaction, error)
	// Create creates a new payout with the provided body.
	Create(ctx context.Context, body *CreatePayoutBody) (*CreatePayoutResponse, error)
}

PayoutInt is an interface for managing payouts.

type PayoutIntImpl

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

PayoutIntImpl is an implementation of the PayoutInt interface.

func (PayoutIntImpl) Create

Create creates a new payout with the provided body. https://docs.swervpay.co/api-reference/payouts/create

func (PayoutIntImpl) Get

func (p PayoutIntImpl) Get(ctx context.Context, id string) (*Transaction, error)

Get retrieves a payout by its ID. https://docs.swervpay.co/api-reference/payouts/get

type ResolveAccountNumber

type ResolveAccountNumber struct {
	AccountNumber string `json:"account_number"` // AccountNumber is the account number that was resolved.
	BankCode      string `json:"bank_code"`      // BankCode is the code of the bank the account belongs to.
	BankName      string `json:"bank_name"`      // BankName is the name of the bank the account belongs to.
	AccountName   string `json:"account_name"`   // AccountName is the name of the account holder.
}

ResolveAccountNumber represents the response from the Swervpay API when resolving an account number.

type ResolveAccountNumberBody

type ResolveAccountNumberBody struct {
	AccountNumber string `json:"account_number"` // AccountNumber is the account number to resolve.
	BankCode      string `json:"bank_code"`      // BankCode is the code of the bank the account belongs to.
}

ResolveAccountNumberBody represents the request body when resolving an account number.

type SwervpayClient

type SwervpayClient struct {
	Config      *SwervpayClientOption
	AccessToken string

	BaseURL *url.URL

	Customer    CustomerInt
	Card        CardInt
	Business    BusinessInt
	Fx          FxInt
	Payout      PayoutInt
	Wallet      WalletInt
	Webhook     WebhookInt
	Transaction TransactionInt
	Other       OtherInt
	Collection  CollectionInt
	// contains filtered or unexported fields
}

SwervpayClient represents a client for interacting with Swervpay API Client.

func NewSwervpayClient

func NewSwervpayClient(config *SwervpayClientOption) *SwervpayClient

NewSwervpayClient creates a new SwervpayClient with the given options.

func (*SwervpayClient) NewRequest

func (c *SwervpayClient) NewRequest(ctx context.Context, method, path string, params interface{}) (*http.Request, error)

NewRequest creates a new request to the Swervpay API.

func (*SwervpayClient) Perform

func (c *SwervpayClient) Perform(req *http.Request, ret interface{}) (*http.Response, error)

Perform sends the request to the Resend API

type SwervpayClientOption

type SwervpayClientOption struct {
	BusinessID string
	SecretKey  string
	Sandbox    bool
	Timeout    int
	Version    string
	BaseURL    string
}

SwervpayClientOption represents the options for SwervpayClient.

type Tier1KycInput

type Tier1KycInput struct {
	Bvn        string `json:"bvn"`         // The BVN of the customer.
	State      string `json:"state"`       // The state of the customer.
	City       string `json:"city"`        // The city of the customer.
	Country    string `json:"country"`     // The country of the customer.
	Address    string `json:"address"`     // The address of the customer.
	PostalCode string `json:"postal_code"` // The postal code of the customer.
}

Tier1KycInput represents the tier 1 KYC information of a customer.

type Tier2KycInput

type Tier2KycInput struct {
	DocumentType   string `json:"document_type"`   // The type of the document.
	Document       string `json:"document"`        // The document.
	Passport       string `json:"passport"`        // The passport of the customer.
	DocumentNumber string `json:"document_number"` // The document number.
}

Tier2KycInput represents the tier 2 KYC information of a customer.

type TokenDetail

type TokenDetail struct {
	Type      string `json:"type"`
	ExpiresAt int64  `json:"expires_at"`
	IssuedAt  int64  `json:"issued_at"`
}

type Transaction

type Transaction struct {
	AccountName   string  `json:"account_name"`   // The name of the account
	AccountNumber string  `json:"account_number"` // The number of the account
	Amount        float64 `json:"amount"`         // The amount of the transaction
	BankCode      string  `json:"bank_code"`      // The code of the bank
	BankName      string  `json:"bank_name"`      // The name of the bank
	Category      string  `json:"category"`       // The category of the transaction
	Charges       float64 `json:"charges"`        // The charges of the transaction
	CreatedAt     string  `json:"created_at"`     // The creation date of the transaction
	Detail        string  `json:"detail"`         // The detail of the transaction
	FiatRate      float64 `json:"fiat_rate"`      // The fiat rate of the transaction
	ID            string  `json:"id"`             // The ID of the transaction
	Reference     string  `json:"reference"`      // The reference of the transaction
	Report        bool    `json:"report"`         // The report status of the transaction
	ReportMessage string  `json:"report_message"` // The report message of the transaction
	SessionID     string  `json:"session_id"`     // The session ID of the transaction
	Status        string  `json:"status"`         // The status of the transaction
	Type          string  `json:"type"`           // The type of the transaction
	UpdatedAt     string  `json:"updated_at"`     // The update date of the transaction
}

Transaction represents a transaction with all its details.

type TransactionInt

type TransactionInt interface {
	Gets(ctx context.Context, query *PageAndLimitQuery) (*[]Transaction, error) // Gets a list of transactions
	Get(ctx context.Context, id string) (*Transaction, error)                   // Gets a single transaction
}

TransactionInt is an interface that defines the methods for transactions.

type TransactionIntImpl

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

TransactionIntImpl is the implementation of the TransactionInt interface.

func (TransactionIntImpl) Get

Get retrieves a single transaction. https://docs.swervpay.co/api-reference/transactions/get

func (TransactionIntImpl) Gets

Gets retrieves a list of transactions. https://docs.swervpay.co/api-reference/transactions/get-all-transactions

type UpdateustomerBody

type UpdateustomerBody struct {
	Email       string `json:"email"`        // The new email of the customer.
	PhoneNumber string `json:"phone_number"` // The new phone number of the customer.
}

UpdateustomerBody represents the body of a request to update a customer.

type Wallet

type Wallet struct {
	AccountName    string  `json:"account_name"`    // The name of the account.
	AccountNumber  string  `json:"account_number"`  // The number of the account.
	AccountType    string  `json:"account_type"`    // The type of the account.
	Balance        float64 `json:"balance"`         // The current balance of the wallet.
	BankAddress    string  `json:"bank_address"`    // The address of the bank.
	BankCode       string  `json:"bank_code"`       // The code of the bank.
	BankName       string  `json:"bank_name"`       // The name of the bank.
	CreatedAt      string  `json:"created_at"`      // The creation date of the wallet.
	ID             string  `json:"id"`              // The unique identifier of the wallet.
	IsBlocked      bool    `json:"is_blocked"`      // Indicates if the wallet is blocked.
	Label          string  `json:"label"`           // The label of the wallet.
	PendingBalance float64 `json:"pending_balance"` // The pending balance of the wallet.
	Reference      string  `json:"reference"`       // The reference of the wallet.
	RoutingNumber  string  `json:"routing_number"`  // The routing number of the bank.
	TotalReceived  float64 `json:"total_received"`  // The total amount received in the wallet.
	UpdatedAt      string  `json:"updated_at"`      // The last update date of the wallet.
}

Wallet represents a user's wallet in the system.

type WalletInt

type WalletInt interface {
	Gets(ctx context.Context, query *PageAndLimitQuery) (*[]Wallet, error) // Gets a list of wallets.
	Get(ctx context.Context, id string) (*Wallet, error)                   // Gets a specific wallet by its ID.
}

WalletInt is an interface that defines the methods for managing wallets.

type WalletIntImpl

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

WalletIntImpl is an implementation of the WalletInt interface.

func (WalletIntImpl) Get

func (w WalletIntImpl) Get(ctx context.Context, id string) (*Wallet, error)

Get retrieves a specific wallet by its ID. https://docs.swervpay.co/api-reference/wallets/get

func (WalletIntImpl) Gets

func (w WalletIntImpl) Gets(ctx context.Context, query *PageAndLimitQuery) (*[]Wallet, error)

Gets retrieves a list of wallets. https://docs.swervpay.co/api-reference/wallets/get-all-wallets

type WebhookInt

type WebhookInt interface {
	// Test sends a test webhook request.
	// It takes a context and an id as parameters.
	// It returns a pointer to a DefaultResponse and an error.
	Test(ctx context.Context, id string) (*DefaultResponse, error)

	// Retry retries a failed webhook request.
	// It takes a context and a logId as parameters.
	// It returns a pointer to a DefaultResponse and an error.
	Retry(ctx context.Context, logId string) (*DefaultResponse, error)
}

WebhookInt is an interface that defines two methods: Test and Retry.

type WebhookIntImpl

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

WebhookIntImpl is a struct that implements the WebhookInt interface. It contains a client of type *SwervpayClient.

func (WebhookIntImpl) Retry

func (w WebhookIntImpl) Retry(ctx context.Context, logId string) (*DefaultResponse, error)

Retry is a method of WebhookIntImpl that retries a failed webhook request. It prepares a new request and performs it. If there is an error during these operations, it returns the error. Otherwise, it returns the response and nil. https://docs.swervpay.co/api-reference/webhook/retry

func (WebhookIntImpl) Test

Test is a method of WebhookIntImpl that sends a test webhook request. It prepares a new request and performs it. If there is an error during these operations, it returns the error. Otherwise, it returns the response and nil. https://docs.swervpay.co/api-reference/webhook/test

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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