-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/hugmouse/gocapitalist.git
- Loading branch information
Showing
52 changed files
with
1,646 additions
and
83 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package addPaymentNotification | ||
|
||
import ( | ||
"github.com/hugmouse/gocapitalist/requests" | ||
"github.com/hugmouse/gocapitalist/responses" | ||
"github.com/hugmouse/gocapitalist/internal" | ||
) | ||
|
||
type AddPaymentNotification struct { | ||
*internal.BaseClient | ||
} | ||
|
||
// https://capitalist.net/developers/api/page/add_payment_notification | ||
func (b *AddPaymentNotification) Get(request requests.AddPaymentNotification) (*responses.AddPaymentNotification, error) { | ||
data, errResponse := new(responses.AddPaymentNotification), new(responses.ErrorResponse) | ||
|
||
httpParams, logParams := request.Params() | ||
for k, v := range b.Auth.ParamsForAuth { | ||
httpParams[k] = v | ||
} | ||
|
||
b.Logger.Debug("make request", httpParams["operation"], logParams, nil) | ||
|
||
resp, err := b.R(). | ||
SetFormData(httpParams). | ||
EnableTrace(). | ||
SetResult(data). | ||
SetError(errResponse). | ||
SetHeader("x-response-format", "json"). | ||
Post("/") | ||
|
||
if err != nil { | ||
b.Logger.Error("http error", httpParams["operation"], logParams, err) | ||
return nil, err | ||
} | ||
|
||
b.Metrics.Collect(httpParams["operation"], resp.StatusCode(), errResponse.Code, resp.Time()) | ||
|
||
if resp.Error() != nil { | ||
b.Logger.Error("app error", httpParams["operation"], errResponse.ErrLogParams(logParams), errResponse) | ||
return nil, errResponse | ||
} | ||
|
||
b.Logger.Debug("success request", httpParams["operation"], logParams, nil) | ||
|
||
return data, nil | ||
|
||
} |
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package createAccount | ||
|
||
import ( | ||
"github.com/hugmouse/gocapitalist/internal" | ||
"github.com/hugmouse/gocapitalist/requests" | ||
"github.com/hugmouse/gocapitalist/responses" | ||
) | ||
|
||
type CreateAccount struct { | ||
*internal.BaseClient | ||
} | ||
|
||
// https://capitalist.net/developers/api/page/create_account | ||
func (b *CreateAccount) New(request requests.CreateAccount) (*responses.CreateAccount, error) { | ||
data, errResponse := new(responses.CreateAccount), new(responses.ErrorResponse) | ||
|
||
httpParams, logParams := request.Params() | ||
for k, v := range b.Auth.ParamsForAuth { | ||
httpParams[k] = v | ||
} | ||
|
||
b.Logger.Debug("make request", httpParams["operation"], logParams, nil) | ||
|
||
resp, err := b.R(). | ||
SetFormData(httpParams). | ||
EnableTrace(). | ||
SetResult(data). | ||
SetError(errResponse). | ||
SetHeader("x-response-format", "json"). | ||
Post("/") | ||
|
||
if err != nil { | ||
b.Logger.Error("http error", httpParams["operation"], logParams, err) | ||
return nil, err | ||
} | ||
|
||
b.Metrics.Collect(httpParams["operation"], resp.StatusCode(), errResponse.Code, resp.Time()) | ||
|
||
if resp.Error() != nil { | ||
b.Logger.Error("app error", httpParams["operation"], errResponse.ErrLogParams(logParams), errResponse) | ||
return nil, errResponse | ||
} | ||
|
||
b.Logger.Debug("success request", httpParams["operation"], logParams, nil) | ||
|
||
return data, nil | ||
|
||
} |
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package documentsSearch | ||
|
||
import ( | ||
"github.com/hugmouse/gocapitalist/internal" | ||
"github.com/hugmouse/gocapitalist/requests" | ||
"github.com/hugmouse/gocapitalist/responses" | ||
) | ||
|
||
type DocumentsSearch struct { | ||
*internal.BaseClient | ||
} | ||
|
||
// https://capitalist.net/developers/api/page/documents_search | ||
func (b *DocumentsSearch) Get(request requests.DocumentsSearch) (*responses.DocumentsSearch, error) { | ||
data, errResponse := new(responses.DocumentsSearch), new(responses.ErrorResponse) | ||
|
||
httpParams, logParams := request.Params() | ||
for k, v := range b.Auth.ParamsForAuth { | ||
httpParams[k] = v | ||
} | ||
|
||
b.Logger.Debug("make request", httpParams["operation"], logParams, nil) | ||
|
||
resp, err := b.R(). | ||
SetFormData(httpParams). | ||
EnableTrace(). | ||
SetResult(data). | ||
SetError(errResponse). | ||
SetHeader("x-response-format", "json"). | ||
Post("/") | ||
|
||
if err != nil { | ||
b.Logger.Error("http error", httpParams["operation"], logParams, err) | ||
return nil, err | ||
} | ||
|
||
b.Metrics.Collect(httpParams["operation"], resp.StatusCode(), errResponse.Code, resp.Time()) | ||
|
||
if resp.Error() != nil { | ||
b.Logger.Error("app error", httpParams["operation"], errResponse.ErrLogParams(logParams), errResponse) | ||
return nil, errResponse | ||
} | ||
|
||
b.Logger.Debug("success request", httpParams["operation"], logParams, nil) | ||
|
||
return data, nil | ||
|
||
} |
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package getAccounts | ||
|
||
import ( | ||
"github.com/hugmouse/gocapitalist/internal" | ||
"github.com/hugmouse/gocapitalist/requests" | ||
"github.com/hugmouse/gocapitalist/responses" | ||
) | ||
|
||
type GetAccounts struct { | ||
*internal.BaseClient | ||
} | ||
|
||
// https://capitalist.net/developers/api/page/get_accounts | ||
func (b *GetAccounts) Get() (*responses.GetAccounts, error) { | ||
data, errResponse := new(responses.GetAccounts), new(responses.ErrorResponse) | ||
|
||
httpParams, logParams := (&requests.GetAccounts{}).Params() | ||
for k, v := range b.Auth.ParamsForAuth { | ||
httpParams[k] = v | ||
} | ||
|
||
b.Logger.Debug("make request", httpParams["operation"], logParams, nil) | ||
|
||
resp, err := b.R(). | ||
SetFormData(httpParams). | ||
EnableTrace(). | ||
SetResult(data). | ||
SetError(errResponse). | ||
SetHeader("x-response-format", "json"). | ||
Post("/") | ||
|
||
if err != nil { | ||
b.Logger.Error("http error", httpParams["operation"], logParams, err) | ||
return nil, err | ||
} | ||
|
||
b.Metrics.Collect(httpParams["operation"], resp.StatusCode(), errResponse.Code, resp.Time()) | ||
|
||
if resp.Error() != nil { | ||
b.Logger.Error("app error", httpParams["operation"], errResponse.ErrLogParams(logParams), errResponse) | ||
return nil, errResponse | ||
} | ||
|
||
b.Logger.Debug("success request", httpParams["operation"], logParams, nil) | ||
|
||
return data, nil | ||
|
||
} |
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package getBatchInfo | ||
|
||
import ( | ||
"github.com/hugmouse/gocapitalist/internal" | ||
"github.com/hugmouse/gocapitalist/requests" | ||
"github.com/hugmouse/gocapitalist/responses" | ||
) | ||
|
||
type BatchInfo struct { | ||
*internal.BaseClient | ||
} | ||
|
||
// https://capitalist.net/developers/api/page/get_batch_info | ||
func (b *BatchInfo) Get(request requests.GetBatchInfo) (*responses.GetBatchInfo, error) { | ||
data, errResponse := new(responses.GetBatchInfo), new(responses.ErrorResponse) | ||
|
||
httpParams, logParams := request.Params() | ||
for k, v := range b.Auth.ParamsForAuth { | ||
httpParams[k] = v | ||
} | ||
|
||
b.Logger.Debug("make request", httpParams["operation"], logParams, nil) | ||
|
||
resp, err := b.R(). | ||
SetFormData(httpParams). | ||
EnableTrace(). | ||
SetResult(data). | ||
SetError(errResponse). | ||
SetHeader("x-response-format", "json"). | ||
Post("/") | ||
|
||
if err != nil { | ||
b.Logger.Error("http error", httpParams["operation"], logParams, err) | ||
return nil, err | ||
} | ||
|
||
b.Metrics.Collect(httpParams["operation"], resp.StatusCode(), errResponse.Code, resp.Time()) | ||
|
||
if resp.Error() != nil { | ||
b.Logger.Error("app error", httpParams["operation"], errResponse.ErrLogParams(logParams), errResponse) | ||
return nil, errResponse | ||
} | ||
|
||
b.Logger.Debug("success request", httpParams["operation"], logParams, nil) | ||
|
||
return data, nil | ||
|
||
} |
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package getCashinRequisites | ||
|
||
import ( | ||
"github.com/hugmouse/gocapitalist/internal" | ||
"github.com/hugmouse/gocapitalist/requests" | ||
"github.com/hugmouse/gocapitalist/responses" | ||
) | ||
|
||
type GetCashinRequisites struct { | ||
*internal.BaseClient | ||
} | ||
|
||
// https://capitalist.net/developers/api/page/get_cashin_requisites | ||
func (b *GetCashinRequisites) Get() (*responses.GetCashinRequisites, error) { | ||
data, errResponse := new(responses.GetCashinRequisites), new(responses.ErrorResponse) | ||
|
||
httpParams, logParams := (&requests.GetCashinRequisites{}).Params() | ||
for k, v := range b.Auth.ParamsForAuth { | ||
httpParams[k] = v | ||
} | ||
|
||
b.Logger.Debug("make request", httpParams["operation"], logParams, nil) | ||
|
||
resp, err := b.R(). | ||
SetFormData(httpParams). | ||
EnableTrace(). | ||
SetResult(data). | ||
SetError(errResponse). | ||
SetHeader("x-response-format", "json"). | ||
Post("/") | ||
|
||
if err != nil { | ||
b.Logger.Error("http error", httpParams["operation"], logParams, err) | ||
return nil, err | ||
} | ||
|
||
b.Metrics.Collect(httpParams["operation"], resp.StatusCode(), errResponse.Code, resp.Time()) | ||
|
||
if resp.Error() != nil { | ||
b.Logger.Error("app error", httpParams["operation"], errResponse.ErrLogParams(logParams), errResponse) | ||
return nil, errResponse | ||
} | ||
|
||
b.Logger.Debug("success request", httpParams["operation"], logParams, nil) | ||
|
||
return data, nil | ||
|
||
} |
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package getDocumentHistoryExt | ||
|
||
import ( | ||
"github.com/hugmouse/gocapitalist/internal" | ||
"github.com/hugmouse/gocapitalist/requests" | ||
"github.com/hugmouse/gocapitalist/responses" | ||
) | ||
|
||
type GetDocumentHistoryExt struct { | ||
*internal.BaseClient | ||
} | ||
|
||
// https://capitalist.net/developers/api/page/get_documents_history_ext | ||
func (b *GetDocumentHistoryExt) Get(request requests.DocumentHistory) (*responses.DocumentHistory, error) { | ||
data, errResponse := new(responses.DocumentHistory), new(responses.ErrorResponse) | ||
|
||
httpParams, logParams := request.Params() | ||
for k, v := range b.Auth.ParamsForAuth { | ||
httpParams[k] = v | ||
} | ||
|
||
b.Logger.Debug("make request", httpParams["operation"], logParams, nil) | ||
|
||
resp, err := b.R(). | ||
SetFormData(httpParams). | ||
EnableTrace(). | ||
SetResult(data). | ||
SetError(errResponse). | ||
SetHeader("x-response-format", "json"). | ||
Post("/") | ||
|
||
if err != nil { | ||
b.Logger.Error("http error", httpParams["operation"], logParams, err) | ||
return nil, err | ||
} | ||
|
||
b.Metrics.Collect(httpParams["operation"], resp.StatusCode(), errResponse.Code, resp.Time()) | ||
|
||
if resp.Error() != nil { | ||
b.Logger.Error("app error", httpParams["operation"], errResponse.ErrLogParams(logParams), errResponse) | ||
return nil, errResponse | ||
} | ||
|
||
b.Logger.Debug("success request", httpParams["operation"], logParams, nil) | ||
|
||
return data, nil | ||
|
||
} |
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package importBatchAdvanced | ||
|
||
import ( | ||
"github.com/hugmouse/gocapitalist/internal" | ||
"github.com/hugmouse/gocapitalist/requests" | ||
"github.com/hugmouse/gocapitalist/responses" | ||
) | ||
|
||
type ImportBatchAdvanced struct { | ||
*internal.BaseClient | ||
} | ||
|
||
// https://capitalist.net/developers/api/page/import_batch_advanced | ||
func (b *ImportBatchAdvanced) Import(request requests.ImportBatchAdvanced) (*responses.ImportBatchAdvanced, error) { | ||
data, errResponse := new(responses.ImportBatchAdvanced), new(responses.ErrorResponse) | ||
|
||
httpParams, logParams, err := request.Params() | ||
if err != nil { | ||
return nil, err | ||
} | ||
for k, v := range b.Auth.ParamsForAuth { | ||
httpParams[k] = v | ||
} | ||
|
||
b.Logger.Debug("make request", httpParams["operation"], logParams, nil) | ||
|
||
resp, err := b.R(). | ||
SetFormData(httpParams). | ||
EnableTrace(). | ||
SetResult(data). | ||
SetError(errResponse). | ||
SetHeader("x-response-format", "json"). | ||
Post("/") | ||
|
||
if err != nil { | ||
b.Logger.Error("http error", httpParams["operation"], logParams, err) | ||
return nil, err | ||
} | ||
|
||
b.Metrics.Collect(httpParams["operation"], resp.StatusCode(), errResponse.Code, resp.Time()) | ||
|
||
if resp.Error() != nil { | ||
b.Logger.Error("app error", httpParams["operation"], errResponse.ErrLogParams(logParams), errResponse) | ||
return nil, errResponse | ||
} | ||
|
||
b.Logger.Debug("success request", httpParams["operation"], logParams, nil) | ||
|
||
return data, nil | ||
|
||
} |
Oops, something went wrong.