diff --git a/iris.go b/iris.go index c2415f1..bbd5ded 100644 --- a/iris.go +++ b/iris.go @@ -13,13 +13,13 @@ type IrisGateway struct { } // Call : base method to call Core API -func (gateway *IrisGateway) Call(method, path string, body io.Reader, v interface{}) error { +func (gateway *IrisGateway) Call(method, path string, body io.Reader, v interface{}, key string) error { if !strings.HasPrefix(path, "/") { path = "/" + path } path = gateway.Client.APIEnvType.IrisURL() + path - req, err := gateway.Client.NewRequest(method, path, body, gateway.Client.ApproverKey) + req, err := gateway.Client.NewRequest(method, path, body, key) if err != nil { return err } @@ -32,7 +32,7 @@ func (gateway *IrisGateway) CreateBeneficiaries(req *BeneficiariesReq) (map[stri var resp map[string]interface{} jsonReq, _ := json.Marshal(req) - err := gateway.Call("POST", "api/v1/beneficiaries", bytes.NewBuffer(jsonReq), &resp) + err := gateway.Call("POST", "api/v1/beneficiaries", bytes.NewBuffer(jsonReq), &resp, gateway.Client.ApproverKey) if err != nil { gateway.Client.Logger.Println("Error create beneficiaries: ", err) return resp, err @@ -45,7 +45,7 @@ func (gateway *IrisGateway) CreateBeneficiaries(req *BeneficiariesReq) (map[stri func (gateway *IrisGateway) ValidateBankAccount(bankName string, account string) (map[string]interface{}, error) { var resp map[string]interface{} - err := gateway.Call("GET", "api/v1/account_validation?bank="+bankName+"&account="+account, nil, &resp) + err := gateway.Call("GET", "api/v1/account_validation?bank="+bankName+"&account="+account, nil, &resp, gateway.Client.ApproverKey) if err != nil { gateway.Client.Logger.Println("Error approving: ", err) return resp, err @@ -60,7 +60,7 @@ func (gateway *IrisGateway) CreatePayouts(req *PayoutReq) (Payout, error) { jsonReq, _ := json.Marshal(req) - err := gateway.Call("POST", "api/v1/payouts", bytes.NewBuffer(jsonReq), &resp) + err := gateway.Call("POST", "api/v1/payouts", bytes.NewBuffer(jsonReq), &resp, gateway.Client.CreatorKey) if err != nil { gateway.Client.Logger.Println("Error create payouts: ", err) return resp, err