diff --git a/dev/apollo-federation/supergraph.graphql b/dev/apollo-federation/supergraph.graphql index ece2719c6..0b7a93596 100644 --- a/dev/apollo-federation/supergraph.graphql +++ b/dev/apollo-federation/supergraph.graphql @@ -240,19 +240,17 @@ type Bank type BankAccount @join__type(graph: PUBLIC) { - accountName: String! + accountName: String accountNumber: String! accountType: String! - - """Name of the bank institution""" - bank: String! - branchCode: String! + bankBranch: String! + bankName: String! """Account currency (e.g. JMD, USD)""" currency: String! """ERPNext bank account identifier""" - id: ID! + id: ID isDefault: Boolean! } diff --git a/dev/bruno/Flash GraphQL API/token/queries/latestAccountUpgradeRequest.bru b/dev/bruno/Flash GraphQL API/token/queries/latestAccountUpgradeRequest.bru new file mode 100644 index 000000000..e149097e8 --- /dev/null +++ b/dev/bruno/Flash GraphQL API/token/queries/latestAccountUpgradeRequest.bru @@ -0,0 +1,56 @@ +meta { + name: latestAccountUpgradeRequest + type: graphql + seq: 10 +} + +post { + url: {{flashGraphqlUrl}} + body: graphql + auth: inherit +} + +body:graphql { + query latestAccountUpgradeRequest { + latestAccountUpgradeRequest { + errors { + message + } + upgradeRequest { + name + fullName + email + phoneNumber + username + currentLevel + requestedLevel + status + idDocument + terminalsRequested + address { + title + line1 + line2 + city + state + postalCode + country + } + bankAccount { + id + accountName + bankName + bankBranch + accountNumber + accountType + currency + isDefault + } + } + } + } +} + +settings { + encodeUrl: true +} diff --git a/src/graphql/public/root/query/account-upgrade-request.ts b/src/graphql/public/root/query/account-upgrade-request.ts index 921e229e5..de6c36384 100644 --- a/src/graphql/public/root/query/account-upgrade-request.ts +++ b/src/graphql/public/root/query/account-upgrade-request.ts @@ -24,6 +24,7 @@ const LatestAccountUpgradeRequestQuery = GT.Field({ ) if (result instanceof UpgradeRequestQueryError) return apolloErrorResponse(new InternalServerError({ message: result.message })) if (result.length === 0) return apolloErrorResponse(new NotFoundError({ message: "No upgrade requests found for account." })) + console.log({ ...result }, "LatestAccountUpgradeRequestQuery result") return { upgradeRequest: result[0] } }, }) diff --git a/src/graphql/public/schema.graphql b/src/graphql/public/schema.graphql index ad0c95749..2935c0472 100644 --- a/src/graphql/public/schema.graphql +++ b/src/graphql/public/schema.graphql @@ -219,19 +219,17 @@ type Bank { } type BankAccount { - accountName: String! + accountName: String accountNumber: String! accountType: String! - - """Name of the bank institution""" - bank: String! - branchCode: String! + bankBranch: String! + bankName: String! """Account currency (e.g. JMD, USD)""" currency: String! """ERPNext bank account identifier""" - id: ID! + id: ID isDefault: Boolean! } diff --git a/src/graphql/public/types/object/bank-account.ts b/src/graphql/public/types/object/bank-account.ts index 8ce54ecab..01ee61761 100644 --- a/src/graphql/public/types/object/bank-account.ts +++ b/src/graphql/public/types/object/bank-account.ts @@ -6,26 +6,25 @@ const GraphQLBankAccount: GraphQLObjectType = GT.Object({ name: "BankAccount", fields: () => ({ id: { - type: GT.NonNullID, + type: GT.ID, description: "ERPNext bank account identifier", resolve: (o) => o.name, }, accountName: { - type: GT.NonNull(GT.String), + type: GT.String, resolve: (o) => o.account_name, }, - bank: { + bankName: { type: GT.NonNull(GT.String), - description: "Name of the bank institution", resolve: (o) => o.bank, }, - accountNumber: { + bankBranch: { type: GT.NonNull(GT.String), - resolve: (o) => o.bank_account_no, + resolve: (o) => o.branch_code, }, - branchCode: { + accountNumber: { type: GT.NonNull(GT.String), - resolve: (o) => o.branch_code, + resolve: (o) => o.bank_account_no, }, accountType: { type: GT.NonNull(GT.String), diff --git a/src/services/ibex/webhook-server/routes/on-pay.ts b/src/services/ibex/webhook-server/routes/on-pay.ts index f47d24d61..73576d544 100644 --- a/src/services/ibex/webhook-server/routes/on-pay.ts +++ b/src/services/ibex/webhook-server/routes/on-pay.ts @@ -47,11 +47,11 @@ router.get( if (account instanceof Error) { return resp.status(404).json({ error: "User not found" }) } - const wallet = await WalletsRepository().listByAccountId(account.id) - if (!wallet || wallet instanceof Error || wallet.length === 0) { + const wallet = await WalletsRepository().findById(account.defaultWalletId) + if (!wallet || wallet instanceof Error) { return resp.status(404).json({ error: "No wallet found for this user" }) } - const lnurlp = wallet[0].lnurlp + const lnurlp = wallet.lnurlp if (!lnurlp) return resp.status(404).json({ error: "No lnurlp found for this wallet" })