visa

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2023 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExchangeRate added in v0.3.0

func ExchangeRate(from, to string) (v float64, err error)

Types

type OriginalValues

type OriginalValues struct {
	FromCurrency              string        `json:"fromCurrency"`
	FromCurrencyName          string        `json:"fromCurrencyName"`
	ToCurrency                string        `json:"toCurrency"`
	ToCurrencyName            string        `json:"toCurrencyName"`
	AsOfDate                  int           `json:"asOfDate"`
	FromAmount                string        `json:"fromAmount"`
	ToAmountWithVisaRate      string        `json:"toAmountWithVisaRate"`
	ToAmountWithAdditionalFee string        `json:"toAmountWithAdditionalFee"`
	FxRateVisa                string        `json:"fxRateVisa"`
	FxRateWithAdditionalFee   string        `json:"fxRateWithAdditionalFee"`
	LastUpdatedVisaRate       int           `json:"lastUpdatedVisaRate"`
	Benchmarks                []interface{} `json:"benchmarks"`
}

type RatesRequest

type RatesRequest struct {
	Amount           float64   `json:"amount"`
	Fee              float64   `json:"fee,omitempty"`
	UTCConvertedDate time.Time `json:"utcConvertedDate,omitempty"`
	ExchangeDate     time.Time `json:"exchangedate,omitempty"`
	FromCurr         string    `json:"fromCurr"`
	ToCurr           string    `json:"toCurr"`
}

func (*RatesRequest) Values

func (o *RatesRequest) Values() url.Values

type RatesResponse

type RatesResponse struct {
	OriginalValues          OriginalValues `json:"originalValues"`
	ConversionAmountValue   string         `json:"conversionAmountValue"`
	ConversionBankFee       string         `json:"conversionBankFee"`
	ConversionInputDate     string         `json:"conversionInputDate"`
	ConversionFromCurrency  string         `json:"conversionFromCurrency"`
	ConversionToCurrency    string         `json:"conversionToCurrency"`
	FromCurrencyName        string         `json:"fromCurrencyName"`
	ToCurrencyName          string         `json:"toCurrencyName"`
	ConvertedAmount         string         `json:"convertedAmount"`
	BenchMarkAmount         string         `json:"benchMarkAmount"`
	FxRateWithAdditionalFee string         `json:"fxRateWithAdditionalFee"`
	ReverseAmount           string         `json:"reverseAmount"`
	DisclaimerDate          string         `json:"disclaimerDate"`
	Status                  string         `json:"status"`
}
{
	"originalValues":{
	   "fromCurrency":"USD",
	   "fromCurrencyName":"United States Dollar",
	   "toCurrency":"TWD",
	   "toCurrencyName":"New Taiwan Dollar",
	   "asOfDate":1682899200,
	   "fromAmount":"100000",
	   "toAmountWithVisaRate":"3074900",
	   "toAmountWithAdditionalFee":"3074900",
	   "fxRateVisa":"30.749",
	   "fxRateWithAdditionalFee":"30.749",
	   "lastUpdatedVisaRate":1682725860,
	   "benchmarks":[]
	},
	"conversionAmountValue":"100000",
	"conversionBankFee":"0.0",
	"conversionInputDate":"05/01/2023",
	"conversionFromCurrency":"TWD",
	"conversionToCurrency":"USD",
	"fromCurrencyName":"United States Dollar",
	"toCurrencyName":"New Taiwan Dollar",
	"convertedAmount":"3,074,900.000000",
	"benchMarkAmount":"",
	"fxRateWithAdditionalFee":"30.749",
	"reverseAmount":"0.032521",
	"disclaimerDate":"May 1, 2023",
	"status":"success"
}

type RestClient

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

func NewRestClient

func NewRestClient() *RestClient

func (*RestClient) AskPrice added in v0.3.0

func (c *RestClient) AskPrice(ctx context.Context, baseCurrency string, quoteCurrency string) (float64, error)

func (*RestClient) BidPrice added in v0.3.0

func (c *RestClient) BidPrice(ctx context.Context, baseCurrency string, quoteCurrency string) (float64, error)

func (*RestClient) ExchangeRate added in v0.2.3

func (c *RestClient) ExchangeRate(ctx context.Context, from, to string) (v float64, err error)

func (*RestClient) NewRequest

func (c *RestClient) NewRequest(ctx context.Context, method string, refURL string, params url.Values) (*http.Request, error)

Jump to

Keyboard shortcuts

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