Skip to content

Commit

Permalink
1. Finished approve payouts
Browse files Browse the repository at this point in the history
2. Finished reject payouts
  • Loading branch information
andhikamaheva committed Oct 9, 2018
1 parent 4f124f5 commit 3dcfe08
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
30 changes: 30 additions & 0 deletions iris.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,33 @@ func (gateway *IrisGateway) CreatePayouts(req *PayoutReq) (Payout, error) {

return resp, nil
}

// ApprovePayouts : Approve Payout(s) with single or multiple payouts
func (gateway *IrisGateway) ApprovePayouts(req *ApprovePayoutReq) (map[string]interface{}, error) {
var resp map[string]interface{}

jsonReq, _ := json.Marshal(req)

err := gateway.Call("POST", "api/v1/payouts/approve", bytes.NewBuffer(jsonReq), &resp, gateway.Client.ApproverKey)
if err != nil {
gateway.Client.Logger.Println("Error approve payouts: ", err)
return resp, err
}

return resp, nil
}

// RejectPayouts : Reject Payout(s) with single or multiple payouts
func (gateway *IrisGateway) RejectPayouts(req *RejectPayoutReq) (map[string]interface{}, error) {
var resp map[string]interface{}

jsonReq, _ := json.Marshal(req)

err := gateway.Call("POST", "api/v1/payouts/reject", bytes.NewBuffer(jsonReq), &resp, gateway.Client.ApproverKey)
if err != nil {
gateway.Client.Logger.Println("Error reject payouts: ", err)
return resp, err
}

return resp, nil
}
12 changes: 12 additions & 0 deletions request.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,15 @@ type PayoutDetails struct {
Notes string `json:"notes"`
BankAccountID string `json:"bank_account_id,omitempty"`
}

// ApprovePayoutReq : Represent Approve Payout Requests
type ApprovePayoutReq struct {
ReferenceNos []string `json:"reference_nos"`
OTP string `json:"otp"`
}

// RejectPayoutReq : Represent Reject Payout Requests
type RejectPayoutReq struct {
ReferenceNos []string `json:"reference_nos"`
RejectReason string `json:"reject_reason"`
}

0 comments on commit 3dcfe08

Please sign in to comment.