Skip to content

Commit

Permalink
fix(payments): missing connectorID in transfer response (#1018)
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-nicolas authored Dec 15, 2023
1 parent 69b93cc commit ae27932
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type transferInitiationResponse struct {
Description string `json:"description"`
SourceAccountID string `json:"sourceAccountID"`
DestinationAccountID string `json:"destinationAccountID"`
ConnectorID string `json:"connectorID"`
Provider string `json:"provider"`
Type string `json:"type"`
Amount *big.Int `json:"amount"`
Expand Down Expand Up @@ -65,6 +66,7 @@ func readTransferInitiationHandler(b backend.Backend) http.HandlerFunc {
Description: ret.Description,
SourceAccountID: ret.SourceAccountID.String(),
DestinationAccountID: ret.DestinationAccountID.String(),
ConnectorID: ret.ConnectorID.String(),
Provider: ret.Provider.String(),
Type: ret.Type.String(),
Amount: ret.Amount,
Expand Down Expand Up @@ -120,6 +122,7 @@ func listTransferInitiationsHandler(b backend.Backend) http.HandlerFunc {
SourceAccountID: ret[i].SourceAccountID.String(),
DestinationAccountID: ret[i].DestinationAccountID.String(),
Provider: ret[i].Provider.String(),
ConnectorID: ret[i].ConnectorID.String(),
Type: ret[i].Type.String(),
Amount: ret[i].Amount,
Asset: ret[i].Asset.String(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ func TestListTransferInitiations(t *testing.T) {
Amount: listTFsResponse[0].Amount,
Asset: listTFsResponse[0].Asset.String(),
Status: listTFsResponse[0].Status.String(),
ConnectorID: listTFsResponse[0].ConnectorID.String(),
Error: listTFsResponse[0].Error,
},
{
Expand All @@ -251,6 +252,7 @@ func TestListTransferInitiations(t *testing.T) {
Type: listTFsResponse[1].Type.String(),
Amount: listTFsResponse[1].Amount,
Asset: listTFsResponse[1].Asset.String(),
ConnectorID: listTFsResponse[1].ConnectorID.String(),
Status: listTFsResponse[1].Status.String(),
Error: listTFsResponse[1].Error,
},
Expand Down Expand Up @@ -445,6 +447,7 @@ func TestGetTransferInitiation(t *testing.T) {
Provider: getTransferInitiationResponse.Provider.String(),
Type: getTransferInitiationResponse.Type.String(),
Amount: getTransferInitiationResponse.Amount,
ConnectorID: getTransferInitiationResponse.ConnectorID.String(),
Asset: getTransferInitiationResponse.Asset.String(),
Status: getTransferInitiationResponse.Status.String(),
Error: getTransferInitiationResponse.Error,
Expand Down Expand Up @@ -497,6 +500,7 @@ func TestGetTransferInitiation(t *testing.T) {
Provider: getTransferInitiationResponse.Provider.String(),
Type: getTransferInitiationResponse.Type.String(),
Amount: getTransferInitiationResponse.Amount,
ConnectorID: getTransferInitiationResponse.ConnectorID.String(),
Asset: getTransferInitiationResponse.Asset.String(),
Status: getTransferInitiationResponse.Status.String(),
Error: getTransferInitiationResponse.Error,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func (s *Storage) GetTransferInitiation(ctx context.Context, id models.TransferI
var transferInitiation models.TransferInitiation

query := s.db.NewSelect().
Column("id", "created_at", "scheduled_at", "updated_at", "description", "type", "source_account_id", "destination_account_id", "provider", "amount", "asset", "status", "error").
Column("id", "connector_id", "created_at", "scheduled_at", "updated_at", "description", "type", "source_account_id", "destination_account_id", "provider", "amount", "asset", "status", "error").
Model(&transferInitiation).
Where("id = ?", id)

Expand Down Expand Up @@ -71,7 +71,7 @@ func (s *Storage) ListTransferInitiations(ctx context.Context, pagination Pagina
var tfs []*models.TransferInitiation

query := s.db.NewSelect().
Column("id", "created_at", "scheduled_at", "updated_at", "description", "type", "source_account_id", "destination_account_id", "provider", "amount", "asset", "status", "error").
Column("id", "connector_id", "created_at", "scheduled_at", "updated_at", "description", "type", "source_account_id", "destination_account_id", "provider", "amount", "asset", "status", "error").
Model(&tfs)

if pagination.queryBuilder != nil {
Expand Down Expand Up @@ -113,7 +113,7 @@ func (s *Storage) ListTransferInitiations(ctx context.Context, pagination Pagina
lastReference = tfs[len(tfs)-1].CreatedAt.Format(time.RFC3339Nano)

query = s.db.NewSelect().
Column("id", "created_at", "updated_at", "description", "type", "source_account_id", "destination_account_id", "provider", "amount", "asset", "status", "error").
Column("id", "connector_id", "created_at", "updated_at", "description", "type", "source_account_id", "destination_account_id", "provider", "amount", "asset", "status", "error").
Model(&tfs)

hasPrevious, err = pagination.hasPrevious(ctx, query, "transfer_initiation.created_at", firstReference)
Expand Down

1 comment on commit ae27932

@vercel
Copy link

@vercel vercel bot commented on ae27932 Dec 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.