Skip to content

Commit

Permalink
refactor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Kachit committed Jun 16, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 540038a commit c2e0c18
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 20 deletions.
10 changes: 5 additions & 5 deletions accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import (

//GetBalancesRequest struct
type GetBalancesRequest struct {
*RequestParams
RequestParams
Balances []CurrencyCode `xml:"balance" json:"balances"`
}

//GetBalancesResponse struct
type GetBalancesResponse struct {
*ResponseBody
ResponseBody
Balances *GetBalancesResponseParams `xml:"balance,omitempty" json:"balances,omitempty"`
}

Expand All @@ -27,13 +27,13 @@ type GetBalancesResponseParams struct {

//GetAccountsRequest struct
type GetAccountsRequest struct {
*RequestParams
RequestParams
Accounts []string `xml:"account" json:"accounts"`
}

//GetAccountsResponse struct
type GetAccountsResponse struct {
*ResponseBody
ResponseBody
Accounts []*GetAccountsResponseParams `xml:"account,omitempty" json:"accounts,omitempty"`
}

Expand All @@ -47,7 +47,7 @@ type GetAccountsResponseParams struct {

//AccountsResource struct
type AccountsResource struct {
*ResourceAbstract
ResourceAbstract
}

//GetBalances method - allow you to check your FasaPay account balance.
Expand Down
9 changes: 4 additions & 5 deletions resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ func (ra *ResourceAbstract) buildAuthRequestParams(dt time.Time) *RequestAuthPar
}

//BuildParams method
func (ra *ResourceAbstract) buildRequestParams(attributes *RequestParamsAttributes) *RequestParams {
func (ra *ResourceAbstract) buildRequestParams(attributes *RequestParamsAttributes) RequestParams {
if attributes == nil {
dt := time.Now().UTC()
attributes = &RequestParamsAttributes{Id: fmt.Sprint(dt.Unix()), DateTime: dt}
}
params := &RequestParams{Id: attributes.Id, Auth: ra.buildAuthRequestParams(attributes.DateTime)}
return params
return RequestParams{Id: attributes.Id, Auth: ra.buildAuthRequestParams(attributes.DateTime)}
}

//MarshalRequestParams method
Expand All @@ -58,6 +57,6 @@ func (ra *ResourceAbstract) unmarshalResponse(resp *http.Response, v interface{}
}

//NewResourceAbstract Create new resource abstract
func NewResourceAbstract(transport *Transport, config *Config) *ResourceAbstract {
return &ResourceAbstract{tr: transport, cfg: config}
func NewResourceAbstract(transport *Transport, config *Config) ResourceAbstract {
return ResourceAbstract{tr: transport, cfg: config}
}
2 changes: 1 addition & 1 deletion resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
type ResourceAbstractTestSuite struct {
suite.Suite
cfg *Config
testable *ResourceAbstract
testable ResourceAbstract
}

func (suite *ResourceAbstractTestSuite) SetupTest() {
Expand Down
4 changes: 2 additions & 2 deletions stubs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ func BuildStubDateTime() time.Time {
}

//BuildStubRequest method
func BuildStubRequest() *RequestParams {
func BuildStubRequest() RequestParams {
auth := &RequestAuthParams{ApiKey: TestableApiKey, Token: TestableApiAuthToken}
return &RequestParams{Auth: auth, Id: "1234567"}
return RequestParams{Auth: auth, Id: "1234567"}
}

//LoadStubResponseData method
Expand Down
14 changes: 7 additions & 7 deletions transfers.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ func (ctr *CreateTransferRequestParams) isValid() error {

//CreateTransferRequest struct
type CreateTransferRequest struct {
*RequestParams
RequestParams
Transfers []*CreateTransferRequestParams `xml:"transfer" json:"transfers"`
}

//CreateTransferResponse struct
type CreateTransferResponse struct {
*ResponseBody
ResponseBody
Transfers []*CreateTransferResponseParams `xml:"transfer,omitempty" json:"transfers,omitempty"`
}

Expand All @@ -67,7 +67,7 @@ type CreateTransferResponseParams struct {

//GetHistoryRequest struct
type GetHistoryRequest struct {
*RequestParams
RequestParams
History *GetHistoryRequestParams `xml:"history" json:"history"`
}

Expand All @@ -84,7 +84,7 @@ type GetHistoryRequestParams struct {

//GetHistoryResponse struct
type GetHistoryResponse struct {
*ResponseBody
ResponseBody
History *GetHistoryResponseHistoryParams `xml:"history" json:"history"`
}

Expand Down Expand Up @@ -118,7 +118,7 @@ type GetHistoryResponseDetailParams struct {

//GetDetailsRequest struct
type GetDetailsRequest struct {
*RequestParams
RequestParams
Details []GetDetailsDetailParamsInterface `xml:"detail" json:"details"`
}

Expand Down Expand Up @@ -149,7 +149,7 @@ func (f *GetDetailsRequestDetailParamsString) GetDetailType() string {

//GetDetailsResponse struct
type GetDetailsResponse struct {
*ResponseBody
ResponseBody
Details []*GetDetailsResponseDetailParams `xml:"detail,omitempty" json:"details,omitempty"`
}

Expand All @@ -176,7 +176,7 @@ type GetDetailsResponseDetailParams struct {

//TransfersResource struct
type TransfersResource struct {
*ResourceAbstract
ResourceAbstract
}

//CreateTransfer method - allow you to transfer fund from one account to another.
Expand Down

0 comments on commit c2e0c18

Please sign in to comment.