diff options
Diffstat (limited to 'packages/taler-util/src/http-client/types.ts')
-rw-r--r-- | packages/taler-util/src/http-client/types.ts | 185 |
1 files changed, 112 insertions, 73 deletions
diff --git a/packages/taler-util/src/http-client/types.ts b/packages/taler-util/src/http-client/types.ts index 77004cf5b..f6542abcd 100644 --- a/packages/taler-util/src/http-client/types.ts +++ b/packages/taler-util/src/http-client/types.ts @@ -357,13 +357,13 @@ export const codecForBankAccountTransactionsResponse = export const codecForBankAccountTransactionInfo = (): Codec<TalerCorebankApi.BankAccountTransactionInfo> => buildCodecForObject<TalerCorebankApi.BankAccountTransactionInfo>() - .property("amount", codecForAmountString()) .property("creditor_payto_uri", codecForPaytoString()) - .property("date", codecForTimestamp) .property("debtor_payto_uri", codecForPaytoString()) + .property("amount", codecForAmountString()) .property("direction", codecForEither(codecForConstString("debit"), codecForConstString("credit"))) - .property("row_id", codecForNumber()) .property("subject", codecForString()) + .property("row_id", codecForNumber()) + .property("date", codecForTimestamp) .build("TalerCorebankApi.BankAccountTransactionInfo"); export const codecForBankAccountCreateWithdrawalResponse = @@ -376,8 +376,8 @@ export const codecForBankAccountCreateWithdrawalResponse = export const codecForBankAccountGetWithdrawalResponse = (): Codec<TalerCorebankApi.BankAccountGetWithdrawalResponse> => buildCodecForObject<TalerCorebankApi.BankAccountGetWithdrawalResponse>() - .property("aborted", codecForBoolean()) .property("amount", codecForAmountString()) + .property("aborted", codecForBoolean()) .property("confirmation_done", codecForBoolean()) .property("selected_exchange_account", codecOptional(codecForPaytoString())) .property("selected_reserve_pub", codecOptional(codecForString())) @@ -397,6 +397,13 @@ export const codecForCashoutConversionResponse = .property("amount_debit", codecForAmountString()) .build("TalerCorebankApi.CashoutConversionResponse"); +export const codecForCashinConversionResponse = + (): Codec<TalerCorebankApi.CashinConversionResponse> => + buildCodecForObject<TalerCorebankApi.CashinConversionResponse>() + .property("amount_credit", codecForAmountString()) + .property("amount_debit", codecForAmountString()) + .build("TalerCorebankApi.CashinConversionResponse"); + export const codecForCashouts = (): Codec<TalerCorebankApi.Cashouts> => buildCodecForObject<TalerCorebankApi.Cashouts>() @@ -407,7 +414,7 @@ export const codecForCashoutInfo = (): Codec<TalerCorebankApi.CashoutInfo> => buildCodecForObject<TalerCorebankApi.CashoutInfo>() .property("cashout_id", codecForString()) - .property("status", codecForEither(codecForConstString("pending"), codecForConstString("confirmed"),)) + .property("status", codecForEither(codecForConstString("pending"), codecForConstString("aborted"), codecForConstString("confirmed"),)) .build("TalerCorebankApi.CashoutInfo"); export const codecForGlobalCashouts = @@ -421,7 +428,7 @@ export const codecForGlobalCashoutInfo = buildCodecForObject<TalerCorebankApi.GlobalCashoutInfo>() .property("cashout_id", codecForString()) .property("username", codecForString()) - .property("status", codecForEither(codecForConstString("pending"), codecForConstString("confirmed"),)) + .property("status", codecForEither(codecForConstString("pending"), codecForConstString("aborted"), codecForConstString("confirmed"),)) .build("TalerCorebankApi.GlobalCashoutInfo"); export const codecForCashoutStatusResponse = @@ -431,8 +438,8 @@ export const codecForCashoutStatusResponse = .property("amount_debit", codecForAmountString()) .property("confirmation_time", codecForTimestamp) .property("creation_time", codecForTimestamp) - .property("credit_payto_uri", codecForPaytoString()) - .property("status", codecForEither(codecForConstString("pending"), codecForConstString("confirmed"))) + // .property("credit_payto_uri", codecForPaytoString()) + .property("status", codecForEither(codecForConstString("pending"), codecForConstString("aborted"), codecForConstString("confirmed"))) .property("subject", codecForString()) .build("TalerCorebankApi.CashoutStatusResponse"); @@ -448,28 +455,34 @@ export const codecForConversionRatesResponse = export const codecForMonitorResponse = (): Codec<TalerCorebankApi.MonitorResponse> => buildCodecForUnion<TalerCorebankApi.MonitorResponse>() .discriminateOn("type") - .alternative("just-payouts", codecForMonitorResponseJustPayout()) - .alternative("with-cashout", codecForMonitorResponseWithCashout()) + .alternative("no-conversions", codecForMonitorNoConversion()) + .alternative("with-conversions", codecForMonitorWithCashout()) .build("TalerWireGatewayApi.IncomingBankTransaction"); -export const codecForMonitorResponseJustPayout = - (): Codec<TalerCorebankApi.MonitorJustPayouts> => - buildCodecForObject<TalerCorebankApi.MonitorJustPayouts>() - .property("type", codecForConstString("just-payouts")) - .property("talerPayoutCount", codecForNumber()) - .property("talerPayoutInternalVolume", codecForAmountString()) +export const codecForMonitorNoConversion = + (): Codec<TalerCorebankApi.MonitorNoConversion> => + buildCodecForObject<TalerCorebankApi.MonitorNoConversion>() + .property("type", codecForConstString("no-conversions")) + .property("talerInCount", codecForNumber()) + .property("talerInVolume", codecForAmountString()) + .property("talerOutCount", codecForNumber()) + .property("talerOutVolume", codecForAmountString()) .build("TalerCorebankApi.MonitorJustPayouts"); -export const codecForMonitorResponseWithCashout = - (): Codec<TalerCorebankApi.MonitorWithCashout> => - buildCodecForObject<TalerCorebankApi.MonitorWithCashout>() - .property("type", codecForConstString("with-cashout")) - .property("cashinCount", (codecForNumber())) - .property("cashinExternalVolume", (codecForAmountString())) - .property("cashoutCount", (codecForNumber())) - .property("cashoutExternalVolume", (codecForAmountString())) - .property("talerPayoutCount", codecForNumber()) - .property("talerPayoutInternalVolume", codecForAmountString()) +export const codecForMonitorWithCashout = + (): Codec<TalerCorebankApi.MonitorWithConversion> => + buildCodecForObject<TalerCorebankApi.MonitorWithConversion>() + .property("type", codecForConstString("with-conversions")) + .property("cashinCount", codecForNumber()) + .property("cashinFiatVolume", codecForAmountString()) + .property("cashinRegionalVolume", codecForAmountString()) + .property("cashoutCount", codecForNumber()) + .property("cashoutFiatVolume", codecForAmountString()) + .property("cashoutRegionalVolume", codecForAmountString()) + .property("talerInCount", codecForNumber()) + .property("talerInVolume", codecForAmountString()) + .property("talerOutCount", codecForNumber()) + .property("talerOutVolume", codecForAmountString()) .build("TalerCorebankApi.MonitorWithCashout"); export const codecForBankVersion = @@ -697,7 +710,6 @@ const codecForDecimalNumber = codecForNumber enum TanChannel { SMS = "sms", EMAIL = "email", - FILE = "file" } export namespace TalerWireGatewayApi { @@ -1174,7 +1186,7 @@ export namespace TalerCorebankApi { // If present, change the is_exchange configuration. // See RegisterAccountRequest - is_exchange?: boolean; + is_taler_exchange?: boolean; // If present, change the max debit allowed for this user // Only admin can change this property. @@ -1252,10 +1264,15 @@ export namespace TalerCorebankApi { export interface CashoutRequest { + // Nonce to make the request idempotent. Requests with the same + // request_uid that differ in any of the other fields + // are rejected. + request_uid: ShortHashCode; + // Optional subject to associate to the // cashout operation. This data will appear // as the incoming wire transfer subject in - // the user's external bank account. + // the user's fiat bank account. subject?: string; // That is the plain amount that the user specified @@ -1301,6 +1318,15 @@ export namespace TalerCorebankApi { amount_credit: AmountString; } + export interface CashinConversionResponse { + // Amount that the user will get deducted from their fiat + // bank account, according to the 'amount_credit' value. + amount_debit: AmountString; + // Amount that the user will receive in their regional + // bank account, according to 'amount_debit'. + amount_credit: AmountString; + } + export interface Cashouts { // Every string represents a cash-out operation ID. cashouts: CashoutInfo[]; @@ -1308,7 +1334,7 @@ export namespace TalerCorebankApi { export interface CashoutInfo { cashout_id: string; - status: "pending" | "confirmed"; + status: "pending" | "aborted" | "confirmed"; } export interface GlobalCashouts { // Every string represents a cash-out operation ID. @@ -1317,11 +1343,11 @@ export namespace TalerCorebankApi { export interface GlobalCashoutInfo { cashout_id: string; username: string; - status: "pending" | "confirmed"; + status: "pending" | "aborted" | "confirmed"; } export interface CashoutStatusResponse { - status: "pending" | "confirmed"; + status: "pending" | "aborted" | "confirmed"; // Amount debited to the internal // regional currency bank account. @@ -1335,7 +1361,7 @@ export namespace TalerCorebankApi { // Fiat bank account that will receive the cashed out amount. // Specified as a payto URI. - credit_payto_uri: PaytoString; + // credit_payto_uri: PaytoString; // Time when the cashout was created. creation_time: Timestamp; @@ -1365,59 +1391,72 @@ export namespace TalerCorebankApi { } export type MonitorResponse = - | MonitorJustPayouts - | MonitorWithCashout; + | MonitorNoConversion + | MonitorWithConversion; // Monitoring stats when conversion is not supported - export interface MonitorJustPayouts { - type: "just-payouts"; + export interface MonitorNoConversion { + type: "no-conversions"; + + // How many payments were made to a Taler exchange by another + // bank account. + talerInCount: number; - // This number identifies how many payments were made by a - // Taler exchange to a merchant bank account in the internal - // currency, in the timeframe specified in the request. - talerPayoutCount: number; + // Overall volume that has been paid to a Taler + // exchange by another bank account. + talerInVolume: AmountString; - // This amount accounts the overall *internal* currency that - // has been paid by a Taler exchange to a merchant internal - // bank account, in the timeframe specified in the request. - talerPayoutInternalVolume: AmountString; + // How many payments were made by a Taler exchange to another + // bank account. + talerOutCount: number; + + // Overall volume that has been paid by a Taler + // exchange to another bank account. + talerOutVolume: AmountString; } // Monitoring stats when conversion is supported - export interface MonitorWithCashout { - type: "with-cashout"; + export interface MonitorWithConversion { + type: "with-conversions"; - // This number identifies how many cashin operations - // took place in the timeframe specified in the request. - // This number corresponds to how many withdrawals have - // been initiated by a wallet owner. Note: wallet owners + // How many cashin operations were confirmed by a + // wallet owner. Note: wallet owners // are NOT required to be customers of the libeufin-bank. cashinCount: number; - // This amount accounts how much external currency has been - // spent to withdraw Taler coins in the internal currency. - // The exact amount of internal currency being created can be - // calculated using the advertised conversion rates. - cashinExternalVolume: AmountString; + // Overall regional currency that has been paid by the regional admin account + // to regional bank accounts to fulfill all the confirmed cashin operations. + cashinRegionalVolume: AmountString; + + // Overall fiat currency that has been paid to the fiat admin account + // by fiat bank accounts to fulfill all the confirmed cashin operations. + cashinFiatVolume: AmountString; - // This number identifies how many cashout operations were - // confirmed in the timeframe speficied in the request. + // How many cashout operations were confirmed. cashoutCount: number; - // This amount corresponds to how much *external* currency was - // paid by the libeufin-bank administrator to fulfill all the - // confirmed cashouts related to the timeframe specified in the - // request. - cashoutExternalVolume: AmountString; - - // This number identifies how many payments were made by a - // Taler exchange to a merchant bank account in the internal - // currency, in the timeframe specified in the request. - talerPayoutCount: number; - - // This amount accounts the overall *internal* currency that - // has been paid by a Taler exchange to a merchant internal - // bank account, in the timeframe specified in the request. - talerPayoutInternalVolume: AmountString; + // Overall regional currency that has been paid to the regional admin account + // by fiat bank accounts to fulfill all the confirmed cashout operations. + cashoutRegionalVolume: AmountString; + + // Overall fiat currency that has been paid by the fiat admin account + // to fiat bank accounts to fulfill all the confirmed cashout operations. + cashoutFiatVolume: AmountString; + + // How many payments were made to a Taler exchange by another + // bank account. + talerInCount: number; + + // Overall volume that has been paid to a Taler + // exchange by another bank account. + talerInVolume: AmountString; + + // How many payments were made by a Taler exchange to another + // bank account. + talerOutCount: number; + + // Overall volume that has been paid by a Taler + // exchange to another bank account. + talerOutVolume: AmountString; } |