Documentation
¶
Index ¶
- func AddPhone(token, countryCode, phone string) error
- func AuthorizeClientCredentials(scope string) (*string, error)
- func CreateDocument(token, documentType string, value interface{}) error
- func WebAuthorizationAllScopesURL() string
- func WebAuthorizationURL(scope string) string
- type APIClient
- func (c *APIClient) Delete(uri string) (status int, err error)
- func (c *APIClient) Get(uri string, params map[string]interface{}, response interface{}) (status int, err error)
- func (c *APIClient) Post(uri string, params map[string]interface{}, response interface{}) (status int, err error)
- func (c *APIClient) PostWWWFormURLEncoded(uri string, params map[string]interface{}, response interface{}) (status int, err error)
- func (c *APIClient) Put(uri string, params map[string]interface{}, response interface{}) (status int, err error)
- type Denomination
- type Destination
- type Fee
- type Normalized
- type OAuthResponse
- type Origin
- type Transaction
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthorizeClientCredentials ¶
AuthorizeClientCredentials synchronously authorizes an uphold API user using the environment-configured client id and secret
func CreateDocument ¶
CreateDocument upserts a document on behalf of an uphold account holder
func WebAuthorizationAllScopesURL ¶
func WebAuthorizationAllScopesURL() string
WebAuthorizationAllScopesURL returns the webapp authorization URL requesting all supported scopes
func WebAuthorizationURL ¶
WebAuthorizationURL returns the webapp authorization URL for the given scope
Types ¶
type APIClient ¶
type APIClient struct {
Host string
Path string
Scheme string
Token *string
Username *string
Password *string
}
APIClient is a generic base class for calling the uphold API
func NewUnauthorizedAPIClient ¶
NewUnauthorizedAPIClient initializes an APIClient without API credentials
func NewUpholdAPIClient ¶
NewUpholdAPIClient initializes an APIClient using the environment-configured client id and secret to construct an HTTP basic authorization header, unless a non-nil bearer access token is provided.
func (*APIClient) Get ¶
func (c *APIClient) Get(uri string, params map[string]interface{}, response interface{}) (status int, err error)
Get constructs and synchronously sends an API GET request
func (*APIClient) Post ¶
func (c *APIClient) Post(uri string, params map[string]interface{}, response interface{}) (status int, err error)
Post constructs and synchronously sends an API POST request
type Denomination ¶
type Denomination struct {
Amount float64 `json:"amount"`
Currency string `json:"currency"`
Pair *string `json:"pair"`
Rate *string `json:"rate"`
}
Denomination describes the value being transacted, in terms of a specific currency
type Destination ¶
type Destination struct {
CardID string `json:"CardId"` // the ID of the card credited. Only visible to the user who receives the transaction.
Amount float64 `json:"amount"` // the amount credited, including commissions and fees.
Base float64 `json:"base"` // the amount to credit, before commissions or fees.
Comission float64 `json:"comission"` // the commission charged by Uphold to process the transaction. Commissions are only charged when currency is converted into a different denomination.
Currency string `json:"currency"` // the denomination of the funds at the time they were sent/received.
Description *string `json:"description"` // the name of the recipient. In the case where money is sent via email, the description will contain the email address of the recipient.
Fee float64 `json:"fee"` // the Bitcoin network Fee, if destination is a BTC address but origin is not.
IsMember *bool `json:"isMember"` // a boolean signaling if the destination user has completed the membership process.
Node *string `json:"node"` // the details about the transaction destination node.
Rate *string `json:"rate"` // the rate for conversion between origin and destination, as expressed in the currency at destination (the inverse of origin.rate).
Type *string `json:"type"` // the type of endpoint. Possible values are 'email’, 'card’ and 'external’.
}
Destination contains properites regarding how the transaction affects the destination of the funds
type Fee ¶
type Fee struct {
Amount float64 `json:"amount"`
Currency string `json:"currency"`
Percentage *string `json:"percentage"`
Target *string `json:"target"`
Type *string `json:"type"`
}
Fee describes an applied transaction fee
type Normalized ¶
type Normalized struct {
Amount float64 `json:"amount"` // the amount to be transacted.
Comission float64 `json:"comission"` // the total commission taken on this transaction, either at origin or at destination.
Currency string `json:"currency"` // the currency in which the amount and commission are expressed. The value is always USD.
Fee float64 `json:"fee"` // the normalized fee amount.
Rate *string `json:"rate"` // the exchange rate for this pair.
Target *string `json:"type"` // can be origin or destination and determines where the fee was applied.
}
Normalized tx property contains the normalized amount and commission values in USD
type OAuthResponse ¶
type OAuthResponse struct {
AccessToken *string `json:"access_token"`
ExpiresIn *string `json:"expires_in"`
TokenType *string `json:"token_type"`
RefreshToken *string `json:"refresh_token"`
Scope *string `json:"scope"`
}
OAuthResponse is the API response returned when an authorization code has been successfully upgraded to an access token
func AuthorizeBearerToken ¶
func AuthorizeBearerToken(code string) (*OAuthResponse, error)
AuthorizeBearerToken synchronously authorizes a managed uphold API user using the environment-configured client id/secret and the given authorization code; note that it is the responsibility of the calling package to verify the provided state parameter, which should be a cryptographically secure random string used to protect against cross-site request forgery attacks. Packages which fail to verify the integrity of the state parameter provided alongside the code parameter passed into this function are vulnerable.
type Origin ¶
type Origin struct {
CardID string `json:"CardId"` // the ID of the card debited. Only visible to the user who sends the transaction.
Amount float64 `json:"amount"` // the amount debited, including commissions and fees.
Base float64 `json:"base"` // the amount to debit, before commissions or fees.
Comission float64 `json:"comission"` // the commission charged by Uphold to process the transaction.
Currency string `json:"currency"` // the currency of the funds at the origin.
Description *string `json:"description"` // the name of the sender.
Fee float64 `json:"fee"` // the Bitcoin network Fee, if origin is in BTC but destination is not, or is a non-Uphold Bitcoin Address.
IsMember *bool `json:"isMember"` // a boolean signaling if the origin user has completed the membership process.
Node *string `json:"node"` // the details about the transaction origin node.
Rate *string `json:"rate"` // the rate for conversion between origin and destination, as expressed in the currency at origin (the inverse of destination.rate).
Type *string `json:"type"` // the type of endpoint. Possible values are 'card’ and 'external’.
Sources []map[string]string `json:"sources"` // the transactions where the value was originated from (id and amount).
Username string `json:"username"` // the username from the user that performed the transaction.
}
Origin contains properties regarding how the transaction affects the origin of the funds
type Transaction ¶
type Transaction struct {
ID *uuid.UUID `json:"id"` // a unique ID on the Uphold Network associated with the transaction.
CreatedAt *time.Time `json:"createdAt"` // the date and time the transaction was initiated.
Application *string `json:"application"` // the application that created the transaction.
Denomination *Denomination `json:"denomination"` // a message or note provided by the user at the time the transaction was initiated, with the intent of communicating additional information and context about the nature/purpose of the transaction.
Destination *Destination `json:"destination"` // the funds to be transferred, as originally requested.
Origin *Origin `json:"origin"` // the fees that were applied to the transaction.
Normalized *Normalized `json:"normalized"` // the transaction details in USD.
Fees []*Fee `json:"fees"` // the fees that were applied to the transaction.
Message *string `json:"message"` // other parameters of this transaction.
Network *string `json:"network"` // the network of the transaction (uphold for internal transactions).
Priority *string `json:"priority"` // the priority of the transaction. Possible values are normal and fast.
Reference *string `json:"reference"` // A reference assigned to the transaction.
Params *json.RawMessage `json:"params"` // other parameters of this transaction.
Status *string `json:"status"` // the current status of the transaction. Possible values are: pending, waiting, cancelled or completed.
Type *string `json:"type"` // the nature of the transaction. Possible values are deposit, transfer and withdrawal.
}
Transaction represents an uphold card transaction
func CommitTransaction ¶
func CommitTransaction(token, cardID, transactionID string) (*Transaction, error)
CommitTransaction commits a previously quoted transaction
func CreateTransaction ¶
func CreateTransaction(token, cardID, currency, destination string, amount float64) (*Transaction, error)
CreateTransaction submits a transaction to the Uphold platform but does not commit it for settlement
type User ¶
type User struct {
ID *string `json:"id"`
Email *string `json:"email"`
Username *string `json:"username"`
FirstName *string `json:"firstName"`
LastName *string `json:"lastName"`
Name *string `json:"name"`
Birthdate *string `json:"birthdate"`
Currencies []string `json:"currencies"`
Address map[string]interface{} `json:"address"`
State *string `json:"state"`
Country *string `json:"country"`
Settings map[string]interface{} `json:"settings"`
Status *string `json:"status"`
MemberAt *string `json:"memberAt"`
Balances map[string]interface{} `json:"balances"`
Verifications map[string]interface{} `json:"verifications"` // the transactions where the value was originated from (id and amount).
}
User represents an uphold user
func CreateUser ¶
CreateUser creates a new Uphold user