diff options
| author | Teddy Wing | 2015-06-07 11:53:32 -0400 |
|---|---|---|
| committer | Teddy Wing | 2015-06-07 11:53:32 -0400 |
| commit | 01186c52c83bccffad17dde5a24712b86dc3e68e (patch) | |
| tree | 41236c6cdbda65b0f452b75dae3af84717a0e417 /purchase | |
| parent | a890bc98c9e8a9b106ab97c2863d6dcef34e5e77 (diff) | |
| download | New-House-on-the-Block-01186c52c83bccffad17dde5a24712b86dc3e68e.tar.bz2 | |
Move `sendMoney` func to `purchase` package
Create a new package for sending money. Take API keys as args which
obviously is not a good idea but it's a hackathon.
* Add functions in main.go to initiate hard-coded transactions for house
buyer and seller
* Move from "com.teddywing" to "github.com/teddywing"
Diffstat (limited to 'purchase')
| -rw-r--r-- | purchase/purchase.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/purchase/purchase.go b/purchase/purchase.go new file mode 100644 index 0000000..0bce2a4 --- /dev/null +++ b/purchase/purchase.go @@ -0,0 +1,22 @@ +package purchase + +import ( + "github.com/teddywing/new-house-on-the-block/vendor/_nuts/github.com/fabioberger/coinbase-go" +) + +func SendMoney(from_key string, from_secret string, to string, amount string) (transaction_id string, err error) { + c := coinbase.ApiKeyClientSandbox(from_key, from_secret) + + params := &coinbase.TransactionParams{ + To: to, + Amount: amount, + Notes: "You just bought a house", + } + + confirmation, err := c.SendMoney(params) + if err != nil { + return "", err + } else { + return confirmation.Transaction.Id, nil + } +} |
