diff options
author | Sebastian <sebasjm@gmail.com> | 2024-06-10 15:25:51 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2024-06-10 15:46:23 -0300 |
commit | 689d58a5c79e98fec733c3cda31146620d8bde1d (patch) | |
tree | 6f37b175ffde2c8460ea35cb13d2f5496412c600 /packages/taler-util/src | |
parent | 034d6bd1aa4fe155accc889831f711bc985cd280 (diff) | |
download | wallet-core-689d58a5c79e98fec733c3cda31146620d8bde1d.tar.xz |
fix #8886
Diffstat (limited to 'packages/taler-util/src')
-rw-r--r-- | packages/taler-util/src/http-client/bank-integration.ts | 2 | ||||
-rw-r--r-- | packages/taler-util/src/http-client/types.ts | 64 | ||||
-rw-r--r-- | packages/taler-util/src/wallet-types.ts | 13 |
3 files changed, 58 insertions, 21 deletions
diff --git a/packages/taler-util/src/http-client/bank-integration.ts b/packages/taler-util/src/http-client/bank-integration.ts index 08dab58e2..e07b6c5fa 100644 --- a/packages/taler-util/src/http-client/bank-integration.ts +++ b/packages/taler-util/src/http-client/bank-integration.ts @@ -50,7 +50,7 @@ export type TalerBankIntegrationErrorsByMethod< * The API is used by the wallets. */ export class TalerBankIntegrationHttpClient { - public readonly PROTOCOL_VERSION = "2:0:2"; + public readonly PROTOCOL_VERSION = "2:0:0"; httpLib: HttpRequestLibrary; diff --git a/packages/taler-util/src/http-client/types.ts b/packages/taler-util/src/http-client/types.ts index 94f2c7518..f05bbc91a 100644 --- a/packages/taler-util/src/http-client/types.ts +++ b/packages/taler-util/src/http-client/types.ts @@ -1312,6 +1312,7 @@ export const codecForBankWithdrawalOperationStatus = ), ) .property("amount", codecOptional(codecForAmountString())) + .property("suggested_amount", codecOptional(codecForAmountString())) .property("card_fees", codecOptional(codecForAmountString())) .property("sender_wire", codecOptional(codecForPaytoString())) .property("suggested_exchange", codecOptional(codecForString())) @@ -2029,12 +2030,23 @@ export namespace TalerBankIntegrationApi { // confirmed: the transfer has been confirmed and registered by the bank status: WithdrawalOperationStatus; + // Currency used for the withdrawal. + // MUST be present when amount is absent. + // @since v2, may become mandatory in the future. + currency?: string; + // Amount that will be withdrawn with this operation // (raw amount without fee considerations). Only // given once the amount is fixed and cannot be changed. // Optional since **vC2EC**. amount?: AmountString | undefined; + // Suggestion for the amount to be withdrawn with this + // operation. Given if a suggestion was made but the + // user may still change the amount. + // Optional since **vC2EC**. + suggested_amount?: AmountString | undefined; + // Maximum amount that the wallet can choose to withdraw. // Only applicable when the amount is not fixed. // @since **vC2EC**. @@ -2046,17 +2058,13 @@ export namespace TalerBankIntegrationApi { // @since **vC2EC** card_fees?: AmountString | undefined; - // Bank account of the customer that is withdrawing, as a - // payto URI. + // Bank account of the customer that is debiting, as an + // RFC 8905 payto URI. sender_wire?: PaytoString; - // Suggestion for the amount to be withdrawn with this - // operation. Given if a suggestion was made but the - // user may still change the amount. - // Optional since **vC2EC**. - suggested_amount?: AmountString | undefined; - - // Suggestion for an exchange given by the bank. + // Base URL of the suggested exchange. The bank may have + // neither a suggestion nor a requirement for the exchange. + // This value is typically set in the bank's configuration. suggested_exchange?: string; // Base URL of an exchange that must be used. Optional, @@ -2067,7 +2075,8 @@ export namespace TalerBankIntegrationApi { // URL that the user needs to navigate to in order to // complete some final confirmation (e.g. 2FA). - // It may contain withdrawal operation id + // Only applicable when status is selected or pending. + // It may contain the withdrawal operation id. confirm_transfer_url?: string; // Wire transfer types supported by the bank. @@ -2077,13 +2086,15 @@ export namespace TalerBankIntegrationApi { // only non-null if status is selected or confirmed. selected_reserve_pub?: string; - // Exchange account selected by the wallet + // Exchange account selected by the wallet; // only non-null if status is selected or confirmed. + // @since **v1** selected_exchange_account?: string; } export interface BankWithdrawalOperationPostRequest { - // Reserve public key. + // Reserve public key that should become the wire transfer + // subject to fund the withdrawal. reserve_pub: string; // Payto address of the exchange selected for the withdrawal. @@ -2106,7 +2117,7 @@ export namespace TalerBankIntegrationApi { // URL that the user needs to navigate to in order to // complete some final confirmation (e.g. 2FA). // - // Only applicable when status is selected. + // Only applicable when status is selected or pending. // It may contain withdrawal operation id confirm_transfer_url?: string; } @@ -2181,12 +2192,31 @@ export namespace TalerCorebankApi { // Default to 'iban' is missing // @since v4, may become mandatory in the future. wire_type: string; + + // Wire transfer execution fees. + // @since v4, will become mandatory in the next version. + wire_transfer_fees?: AmountString; } export interface BankAccountCreateWithdrawalRequest { - // Amount to withdraw. - amount: AmountString; + // Amount to withdraw. If given, the wallet + // cannot change the amount. + // Optional since **vC2EC**. + amount?: AmountString; + + // Suggested amount to withdraw. The wallet can + // still change the suggestion. + // @since **vC2EC** + suggested_amount?: AmountString; + + // The non-Taler card fees the customer will have + // to pay to the account owner, bank and/or + // payment service provider + // they are using to make this withdrawal. + // @since **vC2EC** + card_fees?: AmountString; } + export interface BankAccountCreateWithdrawalResponse { // ID of the withdrawal, can be used to view/modify the withdrawal operation. withdrawal_id: string; @@ -2529,10 +2559,6 @@ export namespace TalerCorebankApi { export interface CashoutInfo { cashout_id: number; - /** - * @deprecated since 4, use new 2fa - */ - status?: "pending" | "aborted" | "confirmed"; } export interface GlobalCashouts { // Every string represents a cash-out operation ID. diff --git a/packages/taler-util/src/wallet-types.ts b/packages/taler-util/src/wallet-types.ts index 66b1e9769..a7aa4f863 100644 --- a/packages/taler-util/src/wallet-types.ts +++ b/packages/taler-util/src/wallet-types.ts @@ -988,9 +988,12 @@ export interface BankWithdrawDetails { status: WithdrawalOperationStatus; currency: string; amount: AmountJson | undefined; + editableAmount: boolean; + maxAmount: AmountJson | undefined; wireFee: AmountJson | undefined; senderWire?: string; - suggestedExchange?: string; + exchange?: string; + editableExchange: boolean; confirmTransferUrl?: string; wireTypes: string[]; operationId: string; @@ -2364,7 +2367,11 @@ export interface WithdrawUriInfoResponse { confirmTransferUrl?: string; currency: string; amount: AmountString | undefined; + editableAmount: boolean; + maxAmount: AmountString | undefined; + wireFee: AmountString | undefined; defaultExchangeBaseUrl?: string; + editableExchange: boolean; possibleExchanges: ExchangeListItem[]; } @@ -2383,7 +2390,11 @@ export const codecForWithdrawUriInfoResponse = ), ) .property("amount", codecOptional(codecForAmountString())) + .property("maxAmount", codecOptional(codecForAmountString())) + .property("wireFee", codecOptional(codecForAmountString())) .property("currency", codecForString()) + .property("editableAmount", codecForBoolean()) + .property("editableExchange", codecForBoolean()) .property("defaultExchangeBaseUrl", codecOptional(codecForCanonBaseUrl())) .property("possibleExchanges", codecForList(codecForExchangeListItem())) .build("WithdrawUriInfoResponse"); |