Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions app/graphql/front-end-mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,16 @@ gql`
}
}

mutation bankAccountUpdateRequest($input: BankAccountUpdateRequestInput!) {
bankAccountUpdateRequest(input: $input) {
errors {
message
code
}
status
}
}

mutation IdDocumentUploadUrlGenerate($input: IdDocumentUploadUrlGenerateInput!) {
idDocumentUploadUrlGenerate(input: $input) {
errors {
Expand Down
9 changes: 9 additions & 0 deletions app/graphql/front-end-queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,15 @@ gql`
currency
id
isDefault
pendingUpdate {
status
bankName
bankBranch
accountType
accountNumber
currency
rejectionReason
}
}
}
}
Expand Down
22 changes: 22 additions & 0 deletions app/graphql/generated.gql
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,18 @@ mutation accountUpdateDisplayCurrency($input: AccountUpdateDisplayCurrencyInput!
}
}

mutation bankAccountUpdateRequest($input: BankAccountUpdateRequestInput!) {
bankAccountUpdateRequest(input: $input) {
errors {
message
code
__typename
}
status
__typename
}
}

mutation businessAccountUpgradeRequest($input: BusinessAccountUpgradeRequestInput!) {
businessAccountUpgradeRequest(input: $input) {
errors {
Expand Down Expand Up @@ -1002,6 +1014,16 @@ query BankAccounts {
currency
id
isDefault
pendingUpdate {
status
bankName
bankBranch
accountType
accountNumber
currency
rejectionReason
__typename
}
__typename
}
__typename
Expand Down
100 changes: 99 additions & 1 deletion app/graphql/generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@ export type BankAccount = {
/** ERPNext bank account identifier */
readonly id?: Maybe<Scalars['ID']['output']>;
readonly isDefault: Scalars['Boolean']['output'];
/** An open request to change this account's details, awaiting review. Null when none is pending. */
readonly pendingUpdate?: Maybe<BankAccountUpdateRequest>;
};

export type BankAccountInput = {
Expand All @@ -322,6 +324,43 @@ export type BankAccountInput = {
readonly currency: Scalars['String']['input'];
};

/** A pending request to change the details of an approved bank account, awaiting admin review. */
export type BankAccountUpdateRequest = {
readonly __typename: 'BankAccountUpdateRequest';
/** Proposed new account number */
readonly accountNumber: Scalars['String']['output'];
/** Proposed new account type */
readonly accountType: Scalars['String']['output'];
/** Proposed new bank branch */
readonly bankBranch: Scalars['String']['output'];
/** Proposed new bank name */
readonly bankName: Scalars['String']['output'];
/** Account currency (unchanged from the current account) */
readonly currency: Scalars['String']['output'];
/** Reviewer note, set when status is Rejected */
readonly rejectionReason?: Maybe<Scalars['String']['output']>;
/** Pending | Approved | Rejected | Closed */
readonly status: Scalars['String']['output'];
};

export type BankAccountUpdateRequestInput = {
readonly accountNumber: Scalars['AccountNumber']['input'];
readonly accountType: Scalars['String']['input'];
/** ERPNext identifier of the account to update */
readonly bankAccountId: Scalars['ID']['input'];
readonly bankBranch: Scalars['String']['input'];
readonly bankName: Scalars['String']['input'];
/** Must match the account's current currency (currency is locked) */
readonly currency: Scalars['String']['input'];
};

export type BankAccountUpdateRequestPayload = {
readonly __typename: 'BankAccountUpdateRequestPayload';
readonly errors?: Maybe<ReadonlyArray<Maybe<Error>>>;
/** Status of the created request (Pending on success) */
readonly status?: Maybe<Scalars['String']['output']>;
};

export type BridgeAddExternalAccountPayload = {
readonly __typename: 'BridgeAddExternalAccountPayload';
readonly errors: ReadonlyArray<Error>;
Expand Down Expand Up @@ -1022,6 +1061,7 @@ export type Mutation = {
readonly accountEnableNotificationChannel: AccountUpdateNotificationSettingsPayload;
readonly accountUpdateDefaultWalletId: AccountUpdateDefaultWalletIdPayload;
readonly accountUpdateDisplayCurrency: AccountUpdateDisplayCurrencyPayload;
readonly bankAccountUpdateRequest: BankAccountUpdateRequestPayload;
readonly bridgeAddExternalAccount: BridgeAddExternalAccountPayload;
readonly bridgeCancelWithdrawalRequest: BridgeCancelWithdrawalRequestPayload;
readonly bridgeCreateExternalAccount: BridgeCreateExternalAccountPayload;
Expand Down Expand Up @@ -1188,6 +1228,11 @@ export type MutationAccountUpdateDisplayCurrencyArgs = {
};


export type MutationBankAccountUpdateRequestArgs = {
input: BankAccountUpdateRequestInput;
};


export type MutationBridgeCancelWithdrawalRequestArgs = {
input: BridgeCancelWithdrawalRequestInput;
};
Expand Down Expand Up @@ -2609,6 +2654,13 @@ export type BusinessAccountUpgradeRequestMutationVariables = Exact<{

export type BusinessAccountUpgradeRequestMutation = { readonly __typename: 'Mutation', readonly businessAccountUpgradeRequest: { readonly __typename: 'AccountUpgradePayload', readonly id?: string | null, readonly status?: string | null, readonly errors?: ReadonlyArray<{ readonly __typename: 'GraphQLApplicationError', readonly message: string, readonly code?: string | null } | null> | null } };

export type BankAccountUpdateRequestMutationVariables = Exact<{
input: BankAccountUpdateRequestInput;
}>;


export type BankAccountUpdateRequestMutation = { readonly __typename: 'Mutation', readonly bankAccountUpdateRequest: { readonly __typename: 'BankAccountUpdateRequestPayload', readonly status?: string | null, readonly errors?: ReadonlyArray<{ readonly __typename: 'GraphQLApplicationError', readonly message: string, readonly code?: string | null } | null> | null } };

export type IdDocumentUploadUrlGenerateMutationVariables = Exact<{
input: IdDocumentUploadUrlGenerateInput;
}>;
Expand Down Expand Up @@ -2789,7 +2841,7 @@ export type BridgeVirtualAccountQuery = { readonly __typename: 'Query', readonly
export type BankAccountsQueryVariables = Exact<{ [key: string]: never; }>;


export type BankAccountsQuery = { readonly __typename: 'Query', readonly me?: { readonly __typename: 'User', readonly id: string, readonly bankAccounts: ReadonlyArray<{ readonly __typename: 'BankAccount', readonly accountName?: string | null, readonly accountNumber: string, readonly accountType: string, readonly bankBranch: string, readonly bankName: string, readonly currency: string, readonly id?: string | null, readonly isDefault: boolean }> } | null };
export type BankAccountsQuery = { readonly __typename: 'Query', readonly me?: { readonly __typename: 'User', readonly id: string, readonly bankAccounts: ReadonlyArray<{ readonly __typename: 'BankAccount', readonly accountName?: string | null, readonly accountNumber: string, readonly accountType: string, readonly bankBranch: string, readonly bankName: string, readonly currency: string, readonly id?: string | null, readonly isDefault: boolean, readonly pendingUpdate?: { readonly __typename: 'BankAccountUpdateRequest', readonly status: string, readonly bankName: string, readonly bankBranch: string, readonly accountType: string, readonly accountNumber: string, readonly currency: string, readonly rejectionReason?: string | null } | null }> } | null };

export type BridgeExternalAccountsQueryVariables = Exact<{ [key: string]: never; }>;

Expand Down Expand Up @@ -4346,6 +4398,43 @@ export function useBusinessAccountUpgradeRequestMutation(baseOptions?: Apollo.Mu
export type BusinessAccountUpgradeRequestMutationHookResult = ReturnType<typeof useBusinessAccountUpgradeRequestMutation>;
export type BusinessAccountUpgradeRequestMutationResult = Apollo.MutationResult<BusinessAccountUpgradeRequestMutation>;
export type BusinessAccountUpgradeRequestMutationOptions = Apollo.BaseMutationOptions<BusinessAccountUpgradeRequestMutation, BusinessAccountUpgradeRequestMutationVariables>;
export const BankAccountUpdateRequestDocument = gql`
mutation bankAccountUpdateRequest($input: BankAccountUpdateRequestInput!) {
bankAccountUpdateRequest(input: $input) {
errors {
message
code
}
status
}
}
`;
export type BankAccountUpdateRequestMutationFn = Apollo.MutationFunction<BankAccountUpdateRequestMutation, BankAccountUpdateRequestMutationVariables>;

/**
* __useBankAccountUpdateRequestMutation__
*
* To run a mutation, you first call `useBankAccountUpdateRequestMutation` within a React component and pass it any options that fit your needs.
* When your component renders, `useBankAccountUpdateRequestMutation` returns a tuple that includes:
* - A mutate function that you can call at any time to execute the mutation
* - An object with fields that represent the current status of the mutation's execution
*
* @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
*
* @example
* const [bankAccountUpdateRequestMutation, { data, loading, error }] = useBankAccountUpdateRequestMutation({
* variables: {
* input: // value for 'input'
* },
* });
*/
export function useBankAccountUpdateRequestMutation(baseOptions?: Apollo.MutationHookOptions<BankAccountUpdateRequestMutation, BankAccountUpdateRequestMutationVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useMutation<BankAccountUpdateRequestMutation, BankAccountUpdateRequestMutationVariables>(BankAccountUpdateRequestDocument, options);
}
export type BankAccountUpdateRequestMutationHookResult = ReturnType<typeof useBankAccountUpdateRequestMutation>;
export type BankAccountUpdateRequestMutationResult = Apollo.MutationResult<BankAccountUpdateRequestMutation>;
export type BankAccountUpdateRequestMutationOptions = Apollo.BaseMutationOptions<BankAccountUpdateRequestMutation, BankAccountUpdateRequestMutationVariables>;
export const IdDocumentUploadUrlGenerateDocument = gql`
mutation IdDocumentUploadUrlGenerate($input: IdDocumentUploadUrlGenerateInput!) {
idDocumentUploadUrlGenerate(input: $input) {
Expand Down Expand Up @@ -5651,6 +5740,15 @@ export const BankAccountsDocument = gql`
currency
id
isDefault
pendingUpdate {
status
bankName
bankBranch
accountType
accountNumber
currency
rejectionReason
}
}
}
}
Expand Down
52 changes: 52 additions & 0 deletions app/graphql/public-schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,11 @@ type BankAccount {
"""ERPNext bank account identifier"""
id: ID
isDefault: Boolean!

"""
An open request to change this account's details, awaiting review. Null when none is pending.
"""
pendingUpdate: BankAccountUpdateRequest
}

input BankAccountInput {
Expand All @@ -241,6 +246,52 @@ input BankAccountInput {
currency: String!
}

"""
A pending request to change the details of an approved bank account, awaiting admin review.
"""
type BankAccountUpdateRequest {
"""Proposed new account number"""
accountNumber: String!

"""Proposed new account type"""
accountType: String!

"""Proposed new bank branch"""
bankBranch: String!

"""Proposed new bank name"""
bankName: String!

"""Account currency (unchanged from the current account)"""
currency: String!

"""Reviewer note, set when status is Rejected"""
rejectionReason: String

"""Pending | Approved | Rejected | Closed"""
status: String!
}

input BankAccountUpdateRequestInput {
accountNumber: AccountNumber!
accountType: String!

"""ERPNext identifier of the account to update"""
bankAccountId: ID!
bankBranch: String!
bankName: String!

"""Must match the account's current currency (currency is locked)"""
currency: String!
}

type BankAccountUpdateRequestPayload {
errors: [Error]

"""Status of the created request (Pending on success)"""
status: String
}

type BridgeAddExternalAccountPayload {
errors: [Error!]!
externalAccount: BridgeExternalAccountLink
Expand Down Expand Up @@ -1030,6 +1081,7 @@ type Mutation {
bridgeInitiateKyc(input: BridgeInitiateKycInput!): BridgeInitiateKycPayload!
bridgeInitiateWithdrawal(input: BridgeInitiateWithdrawalInput!): BridgeInitiateWithdrawalPayload!
bridgeRequestWithdrawal(input: BridgeRequestWithdrawalInput!): BridgeRequestWithdrawalPayload!
bankAccountUpdateRequest(input: BankAccountUpdateRequestInput!): BankAccountUpdateRequestPayload!
businessAccountUpgradeRequest(input: BusinessAccountUpgradeRequestInput!): AccountUpgradePayload!
callbackEndpointAdd(input: CallbackEndpointAddInput!): CallbackEndpointAddPayload!
callbackEndpointDelete(input: CallbackEndpointDeleteInput!): SuccessPayload!
Expand Down
12 changes: 12 additions & 0 deletions app/i18n/en/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,18 @@ const en: BaseTranslation = {
removingAccountsComingSoon: "Removing accounts is coming soon",
accountEnding: "Account ending {last4: string}",
defaultUpdated: "Default account updated",
updateDetails: "Update details",
editTitle: "Update bank account",
editSubtitle:
"Changes are reviewed before they take effect. Cash-outs keep going to your current details until then.",
currencyLocked:
"Currency can't be changed here. To use a different currency, add a new account.",
submitUpdate: "Submit for review",
confirmTitle: "Submit changes?",
confirmMessage:
"Cash-outs keep going to your current account until the new details are approved.",
updateSubmitted: "Update submitted for review",
lastRequestDeclined: "Your last request was declined: {reason: string}",
},
BridgeAddExternalAccount: {
title: "Add Bank Account",
Expand Down
Loading
Loading