Skip to content

Commit

Permalink
Fix virtual account transaction payload
Browse files Browse the repository at this point in the history
  • Loading branch information
odetolakehinde committed Oct 1, 2023
1 parent e1b5dd0 commit 81eb17d
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 31 deletions.
12 changes: 0 additions & 12 deletions api/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,3 @@ func (c *Call) GetVirtualAccountTransaction(ctx context.Context, txID string) (*
}
return response, err
}

// GetAccunts makes the request to get a virtual account transaction on by its ID
func (c *Call) GetAccounts(ctx context.Context, txID string) (*model.Transaction, error) {
response := &model.Transaction{}

//path := fmt.Sprintf("/virtual-accounts/transactions/%s", txID)
err := c.makeRequest(ctx, http.MethodGet, "/accounts\n", nil, response)
if err != nil {
return nil, err
}
return response, err
}
14 changes: 13 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func main() {
//logger.Info().Interface("response", vendors).Msg("success")

/*
// ---------------GetBillVendorByID---------------
vendor, err := api.GetBillVendorByID(ctx, "f46c9b9f-ddc1-4466-9cf2-dda59d18b84f")
if err != nil {
Expand All @@ -74,6 +75,7 @@ func main() {
*/

/*
// ---------------GetBillProducts---------------
products, err := api.GetBillProducts(ctx, "", "")
if err != nil {
Expand Down Expand Up @@ -153,11 +155,21 @@ func main() {
// //Start: "2021-01-01",
// //End: "2023-07-23"
//})

//if err != nil {
// logger.Err(err).Msg("failed")
// return
//}
//logger.Info().Interface("response", bills).Msg("success")
//
//fmt.Printf("-----------%v--------", len(bills))

// ---------------GetVirtualAccountTransaction---------------
/*
virtualAccTrx, err := api.GetVirtualAccountTransaction(context.Background(), "72754087-7caa-4a57-9e77-d8b22c89e799")
if err != nil {
logger.Err(err).Msg("failed")
return
}
logger.Info().Interface("response", virtualAccTrx).Msg("success")
*/
}
4 changes: 2 additions & 2 deletions model/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ type (
const (
// VirtualAccountTypeStatic string representation of static virtual account
VirtualAccountTypeStatic VirtualAccountType = "Static Virtual Account"
// DynamicAccountTypeStatic string representation of dynamic virtual account
DynamicAccountTypeStatic VirtualAccountType = "Dynamic Virtual Account"
// VirtualAccountTypeDynamic string representation of dynamic virtual account
VirtualAccountTypeDynamic VirtualAccountType = "Dynamic Virtual Account"

// StatusActive string
StatusActive = "active"
Expand Down
32 changes: 16 additions & 16 deletions model/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ package model
type (
// Transaction object schema
Transaction struct {
ID string `json:"id"`
Amount string `json:"amount"`
Fee string `json:"fee"`
Narration string `json:"narration"`
Type string `json:"type"`
InitiatedAt *string `json:"initiatedAt,omitempty"`
CompletedAt *string `json:"completedAt,omitempty"`
FailedAt *string `json:"failedAt,omitempty"`
AccountID string `json:"accountId"`
Details *BankAccount `json:"details,omitempty"`
VirtualAccount *VirtualAccount `json:"virtualAccount,omitempty"`
Status string `json:"status"`
ReasonForFailure string `json:"reasonForFailure"`
ClientReference string `json:"clientReference"`
TransactionReference string `json:"transactionReference"`
NipSessionID *string `json:"nipSessionId,omitempty"`
ID string `json:"id" mapstructure:""`
TransactionAmount string `json:"transactionAmount" mapstructure:""`
Fee string `json:"fee" mapstructure:""`
StampDuty string `json:"stampDuty" mapstructure:""`
SettledAmount string `json:"settledAmount" mapstructure:""`
Currency string `json:"currency" mapstructure:""`
Type string `json:"type" mapstructure:""`
Status string `json:"status" mapstructure:""`
Narration string `json:"narration" mapstructure:""`
Details BankAccount `json:"details" mapstructure:""`
VirtualAccount VirtualAccount `json:"virtualAccount" mapstructure:""`
AccountReference string `json:"accountReference" mapstructure:""`
SettledAccountID string `json:"settledAccountId" mapstructure:""`
Datetime string `json:"datetime" mapstructure:""`
NipSessionID string `json:"nipSessionId" mapstructure:""`
TransactionReference string `json:"transactionReference" mapstructure:""`
}
)

0 comments on commit 81eb17d

Please sign in to comment.