forked from jeffwalsh/go-coinpayments
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Alessandro Sanino <[email protected]>
- Loading branch information
Showing
2 changed files
with
8 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
package coinpayments_test | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/tryvium-travels/go-coinpayments" | ||
|
@@ -13,26 +12,28 @@ func TestCallGetTxInfo(t *testing.T) { | |
t.Fatal("should have instantiated a new client with valid configuration") | ||
} | ||
|
||
resp, err := client.CallGetTxInfo(&coinpayments.TxInfoRequest{TxID: "CPCH3A2HBY7R92IOCQNYPL1G8X", Full: "0"}) | ||
resp, err := client.CallGetTxInfo(&coinpayments.TxInfoRequest{TxID: "CPHB0ZYSLG1TRNVDGKPMINAYFW", Full: "0"}) | ||
if err != nil { | ||
t.Fatal("error getting tx info ", err) | ||
} | ||
|
||
fmt.Printf("%+v\n", resp) | ||
if coin, exists := resp.Result["coin"].(string); !exists || coin != "SYS" { | ||
t.Fatalf("error in tx: Expected coin to be SYS, found %s", coin) | ||
} | ||
} | ||
|
||
func TestCallCreateTransaction(t *testing.T) { | ||
client, err := testClient() | ||
if err != nil { | ||
t.Fatalf("Should have instantiated a new client with valid config and http client, but it threw error: %s", err.Error()) | ||
} | ||
|
||
resp, err := client.CallCreateTransaction(&coinpayments.TransactionRequest{Amount: "100", Currency1: "USD", Currency2: "BTC", BuyerEmail: "[email protected]"}) | ||
resp, err := client.CallCreateTransaction(&coinpayments.TransactionRequest{Amount: "100", Currency1: "USD", Currency2: "BTC", BuyerEmail: "[email protected]"}) | ||
if err != nil { | ||
t.Fatalf("Could not call create transaction: %s", err.Error()) | ||
} | ||
|
||
_, err = client.CallGetTxInfo(&coinpayments.TxInfoRequest{TxID: resp.TxnID}) | ||
|
||
if err != nil { | ||
t.Fatalf("Could not call get tx info: %s", err.Error()) | ||
} | ||
|
@@ -59,7 +60,7 @@ func TestCallGetDepositAddress(t *testing.T) { | |
t.Fatalf("Should have instantiated a new client with valid config and http client, but it threw error: %s", err.Error()) | ||
} | ||
|
||
_, err = client.CallGetDepositAddress(&coinpayments.DepositAddressRequest{Currency: "BTC"}) | ||
_, err = client.CallGetDepositAddress(&coinpayments.DepositAddressRequest{Currency: "SYS"}) | ||
|
||
if err != nil { | ||
t.Fatalf("Could not call get callback address: %s", err.Error()) | ||
|