Documentation ¶
Overview ¶
Package synapse is a wrapper library for the Synapse API (https://docs.synapsefi.com)
Instantiate client
// credentials used to set headers for each method request var client = synapse.New( "CLIENT_ID", "CLIENT_SECRET", "IP_ADDRESS", "FINGERPRINT", )
Examples ¶
Enable logging & turn off developer mode (developer mode is true by default)
var client = synapse.New( "CLIENT_ID", "CLIENT_SECRET", "IP_ADDRESS", "FINGERPRINT", true, false, )
Register Fingerprint
// payload response { "error": { "en": "Fingerprint not registered. Please perform the MFA flow." }, "error_code": "10", "http_code": "202", "phone_numbers": [ "developer@email.com", "901-111-2222" ], "success": false } // Submit a valid email address or phone number from "phone_numbers" list res, err := user.Select2FA("developer@email.com") // MFA sent to developer@email.com res, err := user.VerifyPIN("123456")
Set an `IDEMPOTENCY_KEY` (for `POST` requests only)
scopeSettings := `{ "scope": [ "USERS|POST", "USER|PATCH", "NODES|POST", "NODE|PATCH", "TRANS|POST", "TRAN|PATCH" ], "url": "https://requestb.in/zp216zzp" }` idempotencyKey := `1234567890` data, err := client.CreateSubscription(scopeSettings, idempotencyKey)
Submit optional query parameters
params := "per_page=3&page=2" data, err := client.GetUsers(params)
Index ¶
- type ActionNotAllowed
- type ActionPending
- type Client
- func (c *Client) CreateSubscription(data string, idempotencyKey ...string) (map[string]interface{}, error)
- func (c *Client) CreateUser(data, fingerprint, ipAddress string, idempotencyKey ...string) (*User, error)
- func (c *Client) GetCryptoMarketData() (map[string]interface{}, error)
- func (c *Client) GetCryptoQuotes(queryParams ...string) (map[string]interface{}, error)
- func (c *Client) GetInstitutions() (map[string]interface{}, error)
- func (c *Client) GetNodes(queryParams ...string) (map[string]interface{}, error)
- func (c *Client) GetPublicKey(scope ...string) (map[string]interface{}, error)
- func (c *Client) GetSubscription(subscriptionID string) (map[string]interface{}, error)
- func (c *Client) GetSubscriptions(queryParams ...string) (map[string]interface{}, error)
- func (c *Client) GetTradeMarketData(tickerSymbol string) (map[string]interface{}, error)
- func (c *Client) GetTransactions(queryParams ...string) (map[string]interface{}, error)
- func (c *Client) GetUser(userID, fingerprint, ipAddress string, queryParams ...string) (*User, error)
- func (c *Client) GetUsers(queryParams ...string) (map[string]interface{}, error)
- func (c *Client) GetWebhookLogs() (map[string]interface{}, error)
- func (c *Client) LocateATMs(queryParams ...string) (map[string]interface{}, error)
- func (c *Client) UpdateSubscription(subscriptionID string, data string) (map[string]interface{}, error)
- func (c *Client) VerifyAddress(data string) (map[string]interface{}, error)
- func (c *Client) VerifyRoutingNumber(data string) (map[string]interface{}, error)
- type DefaultError
- type IdempotencyConflict
- type IncorrectClientCredentials
- type IncorrectUserCredentials
- type IncorrectValues
- type ObjectNotFound
- type PayloadError
- type Request
- type RequestFailed
- type ResponseError
- type ServerError
- type ServerTimeout
- type ServiceUnavailable
- type TooManyRequests
- type UnauthorizedAction
- type UnauthorizedFingerprint
- type User
- func (u *User) Authenticate(data, fingerprint, ipAddress string) (map[string]interface{}, error)
- func (u *User) CancelTransaction(nodeID, transactionID string) (map[string]interface{}, error)
- func (u *User) CommentOnTransactionStatus(nodeID, transactionID, data string, idempotencyKey ...string) (map[string]interface{}, error)
- func (u *User) CreateDummyTransaction(nodeID string, queryParams ...string) (map[string]interface{}, error)
- func (u *User) CreateNode(data string, idempotencyKey ...string) (map[string]interface{}, error)
- func (u *User) CreateNodeStatements(nodeID, data string, idempotencyKey ...string) (map[string]interface{}, error)
- func (u *User) CreateSubnet(nodeID, data string, idempotencyKey ...string) (map[string]interface{}, error)
- func (u *User) CreateTransaction(nodeID, data string, idempotencyKey ...string) (map[string]interface{}, error)
- func (u *User) CreateUBO(data string) (map[string]interface{}, error)
- func (u *User) DeleteNode(nodeID string) (map[string]interface{}, error)
- func (u *User) DisputeTransaction(nodeID, transactionID, data string) (map[string]interface{}, error)
- func (u *User) GetApplePayToken(nodeID, data string) (map[string]interface{}, error)
- func (u *User) GetCardShipment(nodeID, subnetID string) (map[string]interface{}, error)
- func (u *User) GetNode(nodeID string) (map[string]interface{}, error)
- func (u *User) GetNodeStatements(nodeID string, queryParams ...string) (map[string]interface{}, error)
- func (u *User) GetNodeSubnets(nodeID string, queryParams ...string) (map[string]interface{}, error)
- func (u *User) GetNodeTransactions(nodeID string, queryParams ...string) (map[string]interface{}, error)
- func (u *User) GetNodes(queryParams ...string) (map[string]interface{}, error)
- func (u *User) GetRefreshToken() (map[string]interface{}, error)
- func (u *User) GetStatements(queryParams ...string) (map[string]interface{}, error)
- func (u *User) GetSubnet(nodeID, subnetID string, queryParams ...string) (map[string]interface{}, error)
- func (u *User) GetSubnets(queryParams ...string) (map[string]interface{}, error)
- func (u *User) GetTransaction(nodeID, transactionID string) (map[string]interface{}, error)
- func (u *User) GetTransactions(queryParams ...string) (map[string]interface{}, error)
- func (u *User) RegisterFingerprint(fp string) (map[string]interface{}, error)
- func (u *User) ReinitiateMicroDeposits(nodeID string) (map[string]interface{}, error)
- func (u *User) ResetCardNode(nodeID string) (map[string]interface{}, error)
- func (u *User) Select2FA(device string) (map[string]interface{}, error)
- func (u *User) ShipCard(nodeID, subnetID, data string) (map[string]interface{}, error)
- func (u *User) ShipCardNode(nodeID, data string) (map[string]interface{}, error)
- func (u *User) SubmitMFA(data string) (map[string]interface{}, error)
- func (u *User) Update(data string) (*User, error)
- func (u *User) UpdateNode(nodeID, data string) (map[string]interface{}, error)
- func (u *User) UpdateSubnet(nodeID, subnetID, data string) (map[string]interface{}, error)
- func (u *User) VerifyMicroDeposit(nodeID, data string) (map[string]interface{}, error)
- func (u *User) VerifyPIN(pin string) (map[string]interface{}, error)
- type Users
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionNotAllowed ¶
type ActionNotAllowed struct { ErrorCode string `json:"errorCode"` HTTPCode string `json:"httpCode"` Message string `json:"message"` }
ActionNotAllowed represents ERROR_CODE 410 Action Not Allowed on the object (either you do not have permissions or the action on this object is not supported)
func (*ActionNotAllowed) Error ¶
func (e *ActionNotAllowed) Error() string
type ActionPending ¶
type ActionPending struct { ErrorCode string `json:"errorCode"` HTTPCode string `json:"httpCode"` Message string `json:"message"` }
ActionPending represents ERROR_CODE 10 Accepted, but action pending
func (*ActionPending) Error ¶
func (e *ActionPending) Error() string
type Client ¶
type Client struct { ClientID string ClientSecret string Fingerprint string IP string // contains filtered or unexported fields }
Client represents the credentials used by the developer to instantiate a client
func (*Client) CreateSubscription ¶
func (c *Client) CreateSubscription(data string, idempotencyKey ...string) (map[string]interface{}, error)
CreateSubscription creates a subscription and returns the subscription data
func (*Client) CreateUser ¶
func (c *Client) CreateUser(data, fingerprint, ipAddress string, idempotencyKey ...string) (*User, error)
CreateUser creates a single user and returns the new user data
func (*Client) GetCryptoMarketData ¶
GetCryptoMarketData returns market data for cryptocurrencies
func (*Client) GetCryptoQuotes ¶
GetCryptoQuotes returns all of the quotes for crypto currencies
func (*Client) GetInstitutions ¶
GetInstitutions returns a list of all available banking institutions
func (*Client) GetPublicKey ¶
GetPublicKey returns a public key as a token representing client credentials
func (*Client) GetSubscription ¶
GetSubscription returns a single subscription
func (*Client) GetSubscriptions ¶
GetSubscriptions returns all of the nodes associated with a user
func (*Client) GetTradeMarketData ¶
GetTradeMarketData returns data on a stock based on its ticker symbol
func (*Client) GetTransactions ¶
GetTransactions returns all client transactions
func (*Client) GetUser ¶
func (c *Client) GetUser(userID, fingerprint, ipAddress string, queryParams ...string) (*User, error)
GetUser returns a single user
func (*Client) GetWebhookLogs ¶
GetWebhookLogs returns all of the webhooks sent to a specific client
func (*Client) LocateATMs ¶
LocateATMs returns a list of nearby ATMs
func (*Client) UpdateSubscription ¶
func (c *Client) UpdateSubscription(subscriptionID string, data string) (map[string]interface{}, error)
UpdateSubscription updates an existing subscription
func (*Client) VerifyAddress ¶
VerifyAddress checks if an address if valid
type DefaultError ¶
type DefaultError struct { ErrorCode string "000" HTTPCode string "000" Message string "Error code not found" }
DefaultError represents an unhandled HTTP error Pass this instead of nil
func (*DefaultError) Error ¶
func (e *DefaultError) Error() string
type IdempotencyConflict ¶
type IdempotencyConflict struct { ErrorCode string `json:"errorCode"` HTTPCode string `json:"httpCode"` Message string `json:"message"` }
IdempotencyConflict represents ERROR_CODE 450 Idempotency key already in use
func (*IdempotencyConflict) Error ¶
func (e *IdempotencyConflict) Error() string
type IncorrectClientCredentials ¶
type IncorrectClientCredentials struct { ErrorCode string `json:"errorCode"` HTTPCode string `json:"httpCode"` Message string `json:"message"` }
IncorrectClientCredentials represents ERROR_CODE 100 Incorrect Client Credentials
func (*IncorrectClientCredentials) Error ¶
func (e *IncorrectClientCredentials) Error() string
type IncorrectUserCredentials ¶
type IncorrectUserCredentials struct { ErrorCode string `json:"errorCode"` HTTPCode string `json:"httpCode"` Message string `json:"message"` }
IncorrectUserCredentials represents ERROR_CODE 110 Incorrect User Credentials
func (*IncorrectUserCredentials) Error ¶
func (e *IncorrectUserCredentials) Error() string
type IncorrectValues ¶
type IncorrectValues struct { ErrorCode string `json:"errorCode"` HTTPCode string `json:"httpCode"` Message string `json:"message"` }
IncorrectValues represents ERROR_CODE 400 Incorrect Values Supplied (eg. Insufficient balance, wrong MFA response, incorrect micro deposits)
func (*IncorrectValues) Error ¶
func (e *IncorrectValues) Error() string
type ObjectNotFound ¶
type ObjectNotFound struct { ErrorCode string `json:"errorCode"` HTTPCode string `json:"httpCode"` Message string `json:"message"` }
ObjectNotFound represents ERROR_CODE 404 Object not found
func (*ObjectNotFound) Error ¶
func (e *ObjectNotFound) Error() string
type PayloadError ¶
type PayloadError struct { ErrorCode string `json:"errorCode"` HTTPCode string `json:"httpCode"` Message string `json:"message"` }
PayloadError represents ERROR_CODE 200 Error in Payload (Error in payload formatting)
func (*PayloadError) Error ¶
func (e *PayloadError) Error() string
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
Request represents the http request client
type RequestFailed ¶
type RequestFailed struct { ErrorCode string `json:"errorCode"` HTTPCode string `json:"httpCode"` Message string `json:"message"` }
RequestFailed represents ERROR_CODE 460 Request Failed but not due to server error
func (*RequestFailed) Error ¶
func (e *RequestFailed) Error() string
type ResponseError ¶
type ResponseError struct { ErrorCode string `json:"errorCode"` HTTPCode string `json:"httpCode"` Message string `json:"message"` }
ResponseError represents an error returned by the SynapseFI API
type ServerError ¶
type ServerError struct { ErrorCode string `json:"errorCode"` HTTPCode string `json:"httpCode"` Message string `json:"message"` }
ServerError represents ERROR_CODE 500 Server Error
func (*ServerError) Error ¶
func (e *ServerError) Error() string
type ServerTimeout ¶
type ServerTimeout struct { ErrorCode string `json:"errorCode"` HTTPCode string `json:"httpCode"` Message string `json:"message"` }
ServerTimeout represents ERROR_CODE 504 Server Timeout
func (*ServerTimeout) Error ¶
func (e *ServerTimeout) Error() string
type ServiceUnavailable ¶
type ServiceUnavailable struct {}
ServiceUnavailable represents ERROR_CODE 503 Service Unavailable. The server is currently unable to handle the request due to a temporary overload or scheduled maintenance.
func (*ServiceUnavailable) Error ¶
func (e *ServiceUnavailable) Error() string
type TooManyRequests ¶
type TooManyRequests struct { ErrorCode string `json:"errorCode"` HTTPCode string `json:"httpCode"` Message string `json:"message"` }
TooManyRequests represents ERROR_CODE 429 Too many requests hit the API too quickly.
func (*TooManyRequests) Error ¶
func (e *TooManyRequests) Error() string
type UnauthorizedAction ¶
type UnauthorizedAction struct {}
UnauthorizedAction represents ERROR_CODE 300 Unauthorized action (User/Client not allowed to perform this action)
func (*UnauthorizedAction) Error ¶
func (e *UnauthorizedAction) Error() string
type UnauthorizedFingerprint ¶
type UnauthorizedFingerprint struct {}
UnauthorizedFingerprint represents ERROR_CODE 120 Unauthorized Fingerprint
func (*UnauthorizedFingerprint) Error ¶
func (e *UnauthorizedFingerprint) Error() string
type User ¶
type User struct { AuthKey string UserID string `mapstructure:"_id"` RefreshToken string `mapstructure:"refresh_token"` Response interface{} // contains filtered or unexported fields }
User represents a single user object
func (*User) Authenticate ¶
Authenticate returns an oauth key and sets it to the user object If the refresh token is expired the API will automatically send a new one Capture refresh token every time
func (*User) CancelTransaction ¶
CancelTransaction deletes/cancels a transaction
func (*User) CommentOnTransactionStatus ¶
func (u *User) CommentOnTransactionStatus(nodeID, transactionID, data string, idempotencyKey ...string) (map[string]interface{}, error)
CommentOnTransactionStatus adds comment to the transaction status
func (*User) CreateDummyTransaction ¶
func (u *User) CreateDummyTransaction(nodeID string, queryParams ...string) (map[string]interface{}, error)
CreateDummyTransaction triggers external dummy transactions on internal accounts
func (*User) CreateNode ¶
CreateNode creates a node depending on the type of node specified
func (*User) CreateNodeStatements ¶
func (u *User) CreateNodeStatements(nodeID, data string, idempotencyKey ...string) (map[string]interface{}, error)
CreateNodeStatements creates ad-hoc statements for the specified node
func (*User) CreateSubnet ¶
func (u *User) CreateSubnet(nodeID, data string, idempotencyKey ...string) (map[string]interface{}, error)
CreateSubnet creates a subnet object
func (*User) CreateTransaction ¶
func (u *User) CreateTransaction(nodeID, data string, idempotencyKey ...string) (map[string]interface{}, error)
CreateTransaction creates a transaction for the specified node
func (*User) CreateUBO ¶
CreateUBO creates and uploads an Ultimate Beneficial Ownership (UBO) and REG GG form as a physical document under the Business’s base document
func (*User) DeleteNode ¶
DeleteNode deletes a node
func (*User) DisputeTransaction ¶
func (u *User) DisputeTransaction(nodeID, transactionID, data string) (map[string]interface{}, error)
DisputeTransaction disputes a transaction for a user
func (*User) GetApplePayToken ¶
GetApplePayToken generates tokenized info for Apple Wallet
func (*User) GetCardShipment ¶
GetCardShipment gets card shipment details
func (*User) GetNodeStatements ¶
func (u *User) GetNodeStatements(nodeID string, queryParams ...string) (map[string]interface{}, error)
GetNodeStatements gets all of the node statements
func (*User) GetNodeSubnets ¶
GetNodeSubnets gets all subnets associated with a node
func (*User) GetNodeTransactions ¶
func (u *User) GetNodeTransactions(nodeID string, queryParams ...string) (map[string]interface{}, error)
GetNodeTransactions returns transactions associated with a node
func (*User) GetRefreshToken ¶
GetRefreshToken performs a GET request and returns a new refresh token
func (*User) GetStatements ¶
GetStatements gets all of the user statements
func (*User) GetSubnet ¶
func (u *User) GetSubnet(nodeID, subnetID string, queryParams ...string) (map[string]interface{}, error)
GetSubnet gets a single subnet object
func (*User) GetSubnets ¶
GetSubnets gets all subnets associated with a user
func (*User) GetTransaction ¶
GetTransaction returns a specific transaction associated with a node
func (*User) GetTransactions ¶
GetTransactions returns transactions associated with a user
func (*User) RegisterFingerprint ¶
RegisterFingerprint submits a new fingerprint and triggers the MFA flow
func (*User) ReinitiateMicroDeposits ¶
ReinitiateMicroDeposits reinitiates micro-deposits for an ACH-US node with AC/RT
func (*User) ResetCardNode ¶
ResetCardNode resets the debit card number, card cvv, and expiration date
func (*User) ShipCardNode ¶
ShipCardNode ships a physical debit card out to the user
func (*User) UpdateNode ¶
UpdateNode updates a node
func (*User) UpdateSubnet ¶
UpdateSubnet updates a subnet object
func (*User) VerifyMicroDeposit ¶
VerifyMicroDeposit verifies micro-deposit amounts for a node