diff options
Diffstat (limited to 'packages')
-rw-r--r-- | packages/demobank-ui/src/pages/account/ShowAccountDetails.tsx | 18 | ||||
-rw-r--r-- | packages/taler-util/src/http-client/bank-core.ts | 3 | ||||
-rw-r--r-- | packages/taler-util/src/http-client/types.ts | 17 | ||||
-rw-r--r-- | packages/taler-util/src/taler-error-codes.ts | 16 |
4 files changed, 39 insertions, 15 deletions
diff --git a/packages/demobank-ui/src/pages/account/ShowAccountDetails.tsx b/packages/demobank-ui/src/pages/account/ShowAccountDetails.tsx index cb03ae2a1..1f2d67c49 100644 --- a/packages/demobank-ui/src/pages/account/ShowAccountDetails.tsx +++ b/packages/demobank-ui/src/pages/account/ShowAccountDetails.tsx @@ -71,12 +71,6 @@ export function ShowAccountDetails({ description: resp.detail.hint as TranslatedString, debug: resp.detail, }) - case "admin-cant-be-exchange": return notify({ - type: "error", - title: i18n.str`This is an administration account, changing to exchange account is denied.`, - description: resp.detail.hint as TranslatedString, - debug: resp.detail, - }) case "user-cant-change-name": return notify({ type: "error", title: i18n.str`You can't change the legal name, please contact the your account administrator.`, @@ -89,6 +83,18 @@ export function ShowAccountDetails({ description: resp.detail.hint as TranslatedString, debug: resp.detail, }) + case "user-cant-change-cashout": return notify({ + type: "error", + title: i18n.str`You can't change the cashout address, please contact the your account administrator.`, + description: resp.detail.hint as TranslatedString, + debug: resp.detail, + }) + case "user-cant-change-contact": return notify({ + type: "error", + title: i18n.str`You can't change the contact info, please contact the your account administrator.`, + description: resp.detail.hint as TranslatedString, + debug: resp.detail, + }) default: assertUnreachable(resp) } } diff --git a/packages/taler-util/src/http-client/bank-core.ts b/packages/taler-util/src/http-client/bank-core.ts index 2b67fc638..51d6d7c96 100644 --- a/packages/taler-util/src/http-client/bank-core.ts +++ b/packages/taler-util/src/http-client/bank-core.ts @@ -160,9 +160,10 @@ export class TalerCoreBankHttpClient { const body = await resp.json() const details = codecForTalerErrorDetail().decode(body) switch (details.code) { - case TalerErrorCode.BANK_PATCH_ADMIN_EXCHANGE: return opKnownFailure("admin-cant-be-exchange", resp); case TalerErrorCode.BANK_NON_ADMIN_PATCH_LEGAL_NAME: return opKnownFailure("user-cant-change-name", resp); case TalerErrorCode.BANK_NON_ADMIN_PATCH_DEBT_LIMIT: return opKnownFailure("user-cant-change-debt", resp); + case TalerErrorCode.BANK_NON_ADMIN_PATCH_CASHOUT: return opKnownFailure("user-cant-change-cashout", resp); + case TalerErrorCode.BANK_NON_ADMIN_PATCH_CONTACT: return opKnownFailure("user-cant-change-contact", resp); default: return opUnknownFailure(resp, body) } } diff --git a/packages/taler-util/src/http-client/types.ts b/packages/taler-util/src/http-client/types.ts index efff7bb0a..b0d4deca1 100644 --- a/packages/taler-util/src/http-client/types.ts +++ b/packages/taler-util/src/http-client/types.ts @@ -1477,22 +1477,23 @@ export namespace TalerCorebankApi { // If missing, cashouts will fail. // In the future, might be used for other transactions // as well. + // Only admin can change this property. contact_data?: ChallengeContactData; - // 'payto' address pointing a bank account - // external to the libeufin-bank. + // 'payto' URI of a fiat bank account. // Payments will be sent to this bank account - // when the user wants to convert the local currency - // back to fiat currency outside libeufin-bank. + // when the user wants to convert the regional currency + // back to fiat currency outside bank. + // Only admin can change this property if not allowed in config cashout_payto_uri?: PaytoString; + // If present, change the legal name associated with $username. + // Only admin can change this property if not allowed in config + name?: string; + // Make this account visible to anyone? is_public?: boolean; - // Legal name associated with $username. - // When missing, the old name is kept. - name?: string; - // If present, change the max debit allowed for this user // Only admin can change this property. debit_threshold?: AmountString; diff --git a/packages/taler-util/src/taler-error-codes.ts b/packages/taler-util/src/taler-error-codes.ts index 694adff8f..5b72ae7ec 100644 --- a/packages/taler-util/src/taler-error-codes.ts +++ b/packages/taler-util/src/taler-error-codes.ts @@ -3473,6 +3473,22 @@ export enum TalerErrorCode { /** + * A non-admin user has tried to change their cashout account. + * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). + * (A value of 0 indicates that the error is generated client-side). + */ + BANK_NON_ADMIN_PATCH_CASHOUT = 5140, + + + /** + * A non-admin user has tried to change their contact info. + * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). + * (A value of 0 indicates that the error is generated client-side). + */ + BANK_NON_ADMIN_PATCH_CONTACT = 5141, + + + /** * The sync service failed find the account in its database. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). * (A value of 0 indicates that the error is generated client-side). |