add-bank-account.rst (1718B)
1 .. ts:op:: addBankAccount 2 3 Add a bank account to the wallet's list of known bank accounts. 4 5 **Request:** 6 7 The request must be an `AddBankAccountRequest` object. 8 9 **Response:** 10 11 On success, the result is an `AddBankAccountResponse` object. 12 13 **Side effects:** 14 15 Adds the bank account to the wallet's database, or updates the 16 existing account with the same ``paytoUri``. A 17 ``bank-account-change`` notification is emitted. 18 19 **Expected errors:** 20 21 The caller can handle the following errors inline: 22 ``GENERIC_PAYTO_URI_MALFORMED``, ``WALLET_BANK_ACCOUNT_NOT_FOUND``. 23 24 **Details:** 25 26 If an account with the same ``paytoUri`` is already known, it is 27 updated (the supported currencies are merged) and its identifier 28 is returned. When ``replaceBankAccountId`` is specified, the 29 account with that identifier is replaced and keeps its 30 identifier; the request fails with 31 ``WALLET_BANK_ACCOUNT_NOT_FOUND`` when no such account exists. 32 33 In all cases the stored account is rewritten with the values from 34 the request, so updating or replacing an account resets its 35 ``kycCompleted`` flag to ``false``. 36 37 .. ts:def:: AddBankAccountRequest 38 39 interface AddBankAccountRequest { 40 // Payto URI of the bank account that should be added. 41 paytoUri: string; 42 43 // Human-readable label for the account. 44 label: string; 45 46 // Currencies supported by the bank (if known). 47 currencies?: string[] | undefined; 48 49 // Bank account that this new account should replace. 50 replaceBankAccountId?: string; 51 } 52 53 .. ts:def:: AddBankAccountResponse 54 55 interface AddBankAccountResponse { 56 // Identifier of the added bank account. 57 bankAccountId: string; 58 }