Skip to content

Commit

Permalink
add uusd for vouchers
Browse files Browse the repository at this point in the history
  • Loading branch information
UtopistMan committed Oct 29, 2021
1 parent a41b07c commit 43c1376
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions utopia.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,10 @@ func (c *UtopiaClient) GetUUSDBalance() (float64, error) {
return result, nil
}

// CreateVoucher requests the creation of a new voucher. it returns referenceNumber
func (c *UtopiaClient) CreateVoucher(amount float64) (string, error) {
func (c *UtopiaClient) createCoinVoucher(amount float64, coin string) (string, error) {
params := map[string]interface{}{
"amount": amount,
"amount": amount,
"currency": coin,
}
result, err := c.queryResultToString("createVoucher", params)
if err != nil {
Expand All @@ -235,6 +235,16 @@ func (c *UtopiaClient) CreateVoucher(amount float64) (string, error) {
return result, nil
}

// CreateVoucher requests the creation of a new Crypton voucher. it returns referenceNumber
func (c *UtopiaClient) CreateVoucher(amount float64) (string, error) {
return c.createCoinVoucher(amount, "CRP")
}

// CreateUUSDVoucher requests the creation of a new UUSD voucher. it returns referenceNumber
func (c *UtopiaClient) CreateUUSDVoucher(amount float64) (string, error) {
return c.createCoinVoucher(amount, "UUSD")
}

// SetWebSocketState - set WSS Notification state
func (c *UtopiaClient) SetWebSocketState(enabled bool, port int) error {
var enabledStr string
Expand Down

0 comments on commit 43c1376

Please sign in to comment.