diff --git a/juice.go b/juice.go index 95839df..9e83cf0 100644 --- a/juice.go +++ b/juice.go @@ -101,8 +101,8 @@ func (cl *Client) UpdateAccount(webhook, businessAddress, domain string) (Accoun // TopUpFloat allows an integrator to top up float balance. //This endpoint is only available in the sandbox environment. -func (cl *Client) TopUpFloat(amount int) (TopUpFloatResp, error) { - var res TopUpFloatResp +func (cl *Client) TopUpFloat(amount int) (Resp, error) { + var res Resp err := cl.patch("/card-integrators/top-up-float", &TopUpFloatData{amount}, &res) return res, err } @@ -191,6 +191,13 @@ func (cl *Client) GetTransaction(trxId string) (TransactionResp, error) { return res, err } +//MockTransaction mocks card transaction. This endpoint is only available in the sandbox environment. +func (cl *Client) MockTransaction(data MockTransactionData, cardId string) (Resp, error) { + var res Resp + err := cl.post(fmt.Sprintf("/cards/%s/mock-transaction", cardId), data, &res) + return res, err +} + func (cl Client) Health() (string, error) { resp, err := http.Get(fmt.Sprintf("%s/health/live", cl.baseURL)) body, _ := ioutil.ReadAll(resp.Body) diff --git a/req_resp.go b/req_resp.go index ca627bd..616689f 100644 --- a/req_resp.go +++ b/req_resp.go @@ -56,6 +56,11 @@ type PaymentData struct { CardId string `json:"card_id"` } +type MockTransactionData struct { + Amount int `json:"amount"` + Type string `json:"type"` +} + type AccountResp struct { Data Account `json:"data"` } @@ -108,6 +113,6 @@ type BalanceResp struct { Id string `json:"id"` } -type TopUpFloatResp struct { +type Resp struct { Message string `json:"message"` }