Skip to content

Commit

Permalink
feat(payments): add provider in bank account response and search (#936)
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-nicolas authored Dec 1, 2023
1 parent a9f7385 commit d18dde6
Show file tree
Hide file tree
Showing 35 changed files with 42 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ data:
"id": this.payload.id,
"createdAt": this.payload.createdAt,
"connectorId": this.payload.connectorId,
"provider": this.payload.provider,
"name": this.payload.name,
"accountNumber": this.payload.accountNumber,
"iban": this.payload.iban,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ data:
"id": this.payload.id,
"createdAt": this.payload.createdAt,
"connectorId": this.payload.connectorId,
"provider": this.payload.provider,
"name": this.payload.name,
"accountNumber": this.payload.accountNumber,
"iban": this.payload.iban,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ data:
"id": this.payload.id,
"createdAt": this.payload.createdAt,
"connectorId": this.payload.connectorId,
"provider": this.payload.provider,
"name": this.payload.name,
"accountNumber": this.payload.accountNumber,
"iban": this.payload.iban,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ data:
"id": this.payload.id,
"createdAt": this.payload.createdAt,
"connectorId": this.payload.connectorId,
"provider": this.payload.provider,
"name": this.payload.name,
"accountNumber": this.payload.accountNumber,
"iban": this.payload.iban,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ data:
"id": this.payload.id,
"createdAt": this.payload.createdAt,
"connectorId": this.payload.connectorId,
"provider": this.payload.provider,
"name": this.payload.name,
"accountNumber": this.payload.accountNumber,
"iban": this.payload.iban,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ data:
"id": this.payload.id,
"createdAt": this.payload.createdAt,
"connectorId": this.payload.connectorId,
"provider": this.payload.provider,
"name": this.payload.name,
"accountNumber": this.payload.accountNumber,
"iban": this.payload.iban,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ data:
"id": this.payload.id,
"createdAt": this.payload.createdAt,
"connectorId": this.payload.connectorId,
"provider": this.payload.provider,
"name": this.payload.name,
"accountNumber": this.payload.accountNumber,
"iban": this.payload.iban,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
template:
metadata:
annotations:
stack.formance.cloud/volumes-hash: NeqZuKzHHkxy17D5tfZq6ND-r2DaIN0o3EXCTeFaIB4=
stack.formance.cloud/volumes-hash: XAoeNRyNlYPVHlXqJ9489fdaUDa9XjgtcUy5DM54PZc=
creationTimestamp: null
labels:
app.kubernetes.io/name: search-benthos
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ data:
"id": this.payload.id,
"createdAt": this.payload.createdAt,
"connectorId": this.payload.connectorId,
"provider": this.payload.provider,
"name": this.payload.name,
"accountNumber": this.payload.accountNumber,
"iban": this.payload.iban,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
template:
metadata:
annotations:
stack.formance.cloud/volumes-hash: NeqZuKzHHkxy17D5tfZq6ND-r2DaIN0o3EXCTeFaIB4=
stack.formance.cloud/volumes-hash: XAoeNRyNlYPVHlXqJ9489fdaUDa9XjgtcUy5DM54PZc=
creationTimestamp: null
labels:
app.kubernetes.io/name: search-benthos
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ data:
"id": this.payload.id,
"createdAt": this.payload.createdAt,
"connectorId": this.payload.connectorId,
"provider": this.payload.provider,
"name": this.payload.name,
"accountNumber": this.payload.accountNumber,
"iban": this.payload.iban,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
template:
metadata:
annotations:
stack.formance.cloud/volumes-hash: hdtY4C73B31q1uEWDgyd6xny2JcUlh_Opd7Ox2AzpwU=
stack.formance.cloud/volumes-hash: Gj-h7gOkMA05Tg6wEUlsr0AZ4Oas1ZxidQY2WySK7J8=
creationTimestamp: null
labels:
app.kubernetes.io/name: search-benthos
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ data:
"id": this.payload.id,
"createdAt": this.payload.createdAt,
"connectorId": this.payload.connectorId,
"provider": this.payload.provider,
"name": this.payload.name,
"accountNumber": this.payload.accountNumber,
"iban": this.payload.iban,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
template:
metadata:
annotations:
stack.formance.cloud/volumes-hash: NeqZuKzHHkxy17D5tfZq6ND-r2DaIN0o3EXCTeFaIB4=
stack.formance.cloud/volumes-hash: XAoeNRyNlYPVHlXqJ9489fdaUDa9XjgtcUy5DM54PZc=
creationTimestamp: null
labels:
app.kubernetes.io/name: search-benthos
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ data:
"id": this.payload.id,
"createdAt": this.payload.createdAt,
"connectorId": this.payload.connectorId,
"provider": this.payload.provider,
"name": this.payload.name,
"accountNumber": this.payload.accountNumber,
"iban": this.payload.iban,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
template:
metadata:
annotations:
stack.formance.cloud/volumes-hash: NeqZuKzHHkxy17D5tfZq6ND-r2DaIN0o3EXCTeFaIB4=
stack.formance.cloud/volumes-hash: XAoeNRyNlYPVHlXqJ9489fdaUDa9XjgtcUy5DM54PZc=
creationTimestamp: null
labels:
app.kubernetes.io/name: search-benthos
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ data:
"id": this.payload.id,
"createdAt": this.payload.createdAt,
"connectorId": this.payload.connectorId,
"provider": this.payload.provider,
"name": this.payload.name,
"accountNumber": this.payload.accountNumber,
"iban": this.payload.iban,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
template:
metadata:
annotations:
stack.formance.cloud/volumes-hash: NeqZuKzHHkxy17D5tfZq6ND-r2DaIN0o3EXCTeFaIB4=
stack.formance.cloud/volumes-hash: XAoeNRyNlYPVHlXqJ9489fdaUDa9XjgtcUy5DM54PZc=
creationTimestamp: null
labels:
app.kubernetes.io/name: search-benthos
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ data:
"id": this.payload.id,
"createdAt": this.payload.createdAt,
"connectorId": this.payload.connectorId,
"provider": this.payload.provider,
"name": this.payload.name,
"accountNumber": this.payload.accountNumber,
"iban": this.payload.iban,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
template:
metadata:
annotations:
stack.formance.cloud/volumes-hash: NeqZuKzHHkxy17D5tfZq6ND-r2DaIN0o3EXCTeFaIB4=
stack.formance.cloud/volumes-hash: XAoeNRyNlYPVHlXqJ9489fdaUDa9XjgtcUy5DM54PZc=
creationTimestamp: null
labels:
app.kubernetes.io/name: search-benthos
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ data:
"id": this.payload.id,
"createdAt": this.payload.createdAt,
"connectorId": this.payload.connectorId,
"provider": this.payload.provider,
"name": this.payload.name,
"accountNumber": this.payload.accountNumber,
"iban": this.payload.iban,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
template:
metadata:
annotations:
stack.formance.cloud/volumes-hash: hdtY4C73B31q1uEWDgyd6xny2JcUlh_Opd7Ox2AzpwU=
stack.formance.cloud/volumes-hash: Gj-h7gOkMA05Tg6wEUlsr0AZ4Oas1ZxidQY2WySK7J8=
creationTimestamp: null
labels:
app.kubernetes.io/name: search-benthos
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ data:
"id": this.payload.id,
"createdAt": this.payload.createdAt,
"connectorId": this.payload.connectorId,
"provider": this.payload.provider,
"name": this.payload.name,
"accountNumber": this.payload.accountNumber,
"iban": this.payload.iban,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
template:
metadata:
annotations:
stack.formance.cloud/volumes-hash: ZfCuMGQfh-rJxVRAMiZgcFAX6YGuJTDmlkhAcqgjeGw=
stack.formance.cloud/volumes-hash: HwuOZshluD9ZlUDdE6Qjdk6WThO5yki7neGzghRew50=
creationTimestamp: null
labels:
app.kubernetes.io/name: search-benthos
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ data:
"id": this.payload.id,
"createdAt": this.payload.createdAt,
"connectorId": this.payload.connectorId,
"provider": this.payload.provider,
"name": this.payload.name,
"accountNumber": this.payload.accountNumber,
"iban": this.payload.iban,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
template:
metadata:
annotations:
stack.formance.cloud/volumes-hash: ZfCuMGQfh-rJxVRAMiZgcFAX6YGuJTDmlkhAcqgjeGw=
stack.formance.cloud/volumes-hash: HwuOZshluD9ZlUDdE6Qjdk6WThO5yki7neGzghRew50=
creationTimestamp: null
labels:
app.kubernetes.io/name: search-benthos
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ data:
"id": this.payload.id,
"createdAt": this.payload.createdAt,
"connectorId": this.payload.connectorId,
"provider": this.payload.provider,
"name": this.payload.name,
"accountNumber": this.payload.accountNumber,
"iban": this.payload.iban,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
template:
metadata:
annotations:
stack.formance.cloud/volumes-hash: hdtY4C73B31q1uEWDgyd6xny2JcUlh_Opd7Ox2AzpwU=
stack.formance.cloud/volumes-hash: Gj-h7gOkMA05Tg6wEUlsr0AZ4Oas1ZxidQY2WySK7J8=
creationTimestamp: null
labels:
app.kubernetes.io/name: search-benthos
Expand Down
3 changes: 3 additions & 0 deletions components/payments/cmd/api/internal/api/bank_accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type bankAccountResponse struct {
CreatedAt time.Time `json:"createdAt"`
Country string `json:"country"`
ConnectorID string `json:"connectorID"`
Provider string `json:"provider,omitempty"`
AccountID string `json:"accountId,omitempty"`
Iban string `json:"iban,omitempty"`
AccountNumber string `json:"accountNumber,omitempty"`
Expand Down Expand Up @@ -47,6 +48,7 @@ func listBankAccountsHandler(b backend.Backend) http.HandlerFunc {
Country: ret[i].Country,
ConnectorID: ret[i].ConnectorID.String(),
AccountID: ret[i].AccountID.String(),
Provider: ret[i].ConnectorID.Provider.String(),
}
}

Expand Down Expand Up @@ -93,6 +95,7 @@ func readBankAccountHandler(b backend.Backend) http.HandlerFunc {
Country: account.Country,
ConnectorID: account.ConnectorID.String(),
AccountID: account.AccountID.String(),
Provider: account.ConnectorID.Provider.String(),
Iban: account.IBAN,
AccountNumber: account.AccountNumber,
SwiftBicCode: account.SwiftBicCode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,15 @@ func TestListBankAccounts(t *testing.T) {
Country: listBankAccountsResponse[0].Country,
ConnectorID: listBankAccountsResponse[0].ConnectorID.String(),
AccountID: listBankAccountsResponse[0].AccountID.String(),
Provider: listBankAccountsResponse[0].ConnectorID.Provider.String(),
},
{
ID: listBankAccountsResponse[1].ID.String(),
CreatedAt: listBankAccountsResponse[1].CreatedAt,
Country: listBankAccountsResponse[1].Country,
ConnectorID: listBankAccountsResponse[1].ConnectorID.String(),
AccountID: listBankAccountsResponse[1].AccountID.String(),
Provider: listBankAccountsResponse[1].ConnectorID.Provider.String(),
},
}
expectedPaginationDetails := storage.PaginationDetails{
Expand Down Expand Up @@ -333,6 +335,7 @@ func TestGetBankAccount(t *testing.T) {
CreatedAt: getBankAccountResponse.CreatedAt,
Country: getBankAccountResponse.Country,
ConnectorID: getBankAccountResponse.ConnectorID.String(),
Provider: getBankAccountResponse.ConnectorID.Provider.String(),
AccountID: getBankAccountResponse.AccountID.String(),
Iban: "FR76*******************0188",
AccountNumber: "13************300",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type bankAccountResponse struct {
CreatedAt time.Time `json:"createdAt"`
Country string `json:"country"`
ConnectorID string `json:"connectorID"`
Provider string `json:"provider,omitempty"`
AccountID string `json:"accountId,omitempty"`
Iban string `json:"iban,omitempty"`
AccountNumber string `json:"accountNumber,omitempty"`
Expand Down Expand Up @@ -50,6 +51,7 @@ func createBankAccountHandler(
CreatedAt: bankAccount.CreatedAt,
Country: bankAccount.Country,
ConnectorID: bankAccountRequest.ConnectorID,
Provider: bankAccount.ConnectorID.Provider.String(),
}

err = json.NewEncoder(w).Encode(api.BaseResponse[bankAccountResponse]{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ func TestCreateBankAccounts(t *testing.T) {
Country: createBankAccountResponse.Country,
ConnectorID: createBankAccountResponse.ConnectorID.String(),
AccountID: createBankAccountResponse.AccountID.String(),
Provider: createBankAccountResponse.ConnectorID.Provider.String(),
}

backend, mockService := newServiceTestingBackend(t)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type bankAccountMessagePayload struct {
ID string `json:"id"`
CreatedAt time.Time `json:"createdAt"`
ConnectorID string `json:"connectorId"`
Provider string `json:"provider"`
Name string `json:"name"`
AccountNumber string `json:"accountNumber"`
IBAN string `json:"iban"`
Expand All @@ -26,6 +27,7 @@ func NewEventSavedBankAccounts(bankAccount *models.BankAccount) events.EventMess
ID: bankAccount.ID.String(),
CreatedAt: bankAccount.CreatedAt,
ConnectorID: bankAccount.ConnectorID.String(),
Provider: bankAccount.ConnectorID.Provider.String(),
Name: bankAccount.Name,
AccountNumber: bankAccount.AccountNumber,
IBAN: bankAccount.IBAN,
Expand Down
2 changes: 2 additions & 0 deletions components/payments/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1335,6 +1335,8 @@ components:
type: string
connectorID:
type: string
provider:
type: string
iban:
type: string
accountNumber:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ pipeline:
"id": this.payload.id,
"createdAt": this.payload.createdAt,
"connectorId": this.payload.connectorId,
"provider": this.payload.provider,
"name": this.payload.name,
"accountNumber": this.payload.accountNumber,
"iban": this.payload.iban,
Expand Down

1 comment on commit d18dde6

@vercel
Copy link

@vercel vercel bot commented on d18dde6 Dec 1, 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.