diff options
-rw-r--r-- | packages/taler-util/src/walletTypes.ts | 16 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/wallet-api-types.ts | 480 |
2 files changed, 303 insertions, 193 deletions
diff --git a/packages/taler-util/src/walletTypes.ts b/packages/taler-util/src/walletTypes.ts index 64daee776..bb5d4b3a4 100644 --- a/packages/taler-util/src/walletTypes.ts +++ b/packages/taler-util/src/walletTypes.ts @@ -423,11 +423,17 @@ export const codecForPreparePayResult = (): Codec<PreparePayResult> => ) .build("PreparePayResult"); +/** + * Result of a prepare pay operation. + */ export type PreparePayResult = | PreparePayResultInsufficientBalance | PreparePayResultAlreadyConfirmed | PreparePayResultPaymentPossible; +/** + * Payment is possible. + */ export interface PreparePayResultPaymentPossible { status: PreparePayResultType.PaymentPossible; proposalId: string; @@ -604,7 +610,7 @@ export interface KnownBankAccountsInfo { uri: PaytoUri; kyc_completed: boolean; currency: string; - alias: string, + alias: string; } export interface KnownBankAccounts { @@ -1092,9 +1098,9 @@ export interface AddKnownBankAccountsRequest { export const codecForAddKnownBankAccounts = (): Codec<AddKnownBankAccountsRequest> => buildCodecForObject<AddKnownBankAccountsRequest>() - .property("payto", (codecForString())) - .property("alias", (codecForString())) - .property("currency", (codecForString())) + .property("payto", codecForString()) + .property("alias", codecForString()) + .property("currency", codecForString()) .build("AddKnownBankAccountsRequest"); export interface ForgetKnownBankAccountsRequest { @@ -1104,7 +1110,7 @@ export interface ForgetKnownBankAccountsRequest { export const codecForForgetKnownBankAccounts = (): Codec<ForgetKnownBankAccountsRequest> => buildCodecForObject<ForgetKnownBankAccountsRequest>() - .property("payto", (codecForString())) + .property("payto", codecForString()) .build("ForgetKnownBankAccountsRequest"); export interface GetExchangeWithdrawalInfo { diff --git a/packages/taler-wallet-core/src/wallet-api-types.ts b/packages/taler-wallet-core/src/wallet-api-types.ts index f2c76731b..712219867 100644 --- a/packages/taler-wallet-core/src/wallet-api-types.ts +++ b/packages/taler-wallet-core/src/wallet-api-types.ts @@ -138,195 +138,299 @@ export enum WalletApiOperation { Recycle = "recycle", } +/** + * Initialize wallet-core. + * + * Must be the first message sent before any other operations. + */ +export type InitWalletOp = { + op: WalletApiOperation.InitWallet; + request: {}; + response: {}; +}; + +export type WithdrawFakebankOp = { + op: WalletApiOperation.WithdrawFakebank; + request: WithdrawFakebankRequest; + response: {}; +}; + +export type PreparePayForUriOp = { + op: WalletApiOperation.PreparePayForUri; + request: PreparePayRequest; + response: PreparePayResult; +}; + +export type WithdrawTestkudosOp = { + op: WalletApiOperation.WithdrawTestkudos; + request: {}; + response: {}; +}; + +export type ConfirmPayOp = { + op: WalletApiOperation.ConfirmPay; + request: ConfirmPayRequest; + response: ConfirmPayResult; +}; + +export type AbortPayWithRefundOp = { + request: AbortPayWithRefundRequest; + response: {}; +}; + +export type GetBalancesOp = { + request: {}; + response: BalancesResponse; +}; + +export type GetTransactionsOp = { + request: TransactionsRequest; + response: TransactionsResponse; +}; + +export type GetPendingOperationsOp = { + request: {}; + response: PendingOperationsResponse; +}; + +export type DumpCoinsOp = { + request: {}; + response: CoinDumpJson; +}; + +export type SetCoinSuspendedOp = { + request: SetCoinSuspendedRequest; + response: {}; +}; + +export type ForceRefreshOp = { + request: ForceRefreshRequest; + response: {}; +}; + +export type DeleteTransactionOp = { + request: DeleteTransactionRequest; + response: {}; +}; + +export type RetryTransactionOp = { + request: RetryTransactionRequest; + response: {}; +}; + +export type PrepareTipOp = { + request: PrepareTipRequest; + response: PrepareTipResult; +}; + +export type AcceptTipOp = { + request: AcceptTipRequest; + response: {}; +}; + +export type ApplyRefundOp = { + request: ApplyRefundRequest; + response: ApplyRefundResponse; +}; + +export type ListCurrenciesOp = { + request: {}; + response: WalletCurrencyInfo; +}; + +export type GetWithdrawalDetailsForAmountOp = { + request: GetWithdrawalDetailsForAmountRequest; + response: ManualWithdrawalDetails; +}; + +export type GetWithdrawalDetailsForUriOp = { + request: GetWithdrawalDetailsForUriRequest; + response: WithdrawUriInfoResponse; +}; + +export type AcceptBankIntegratedWithdrawalOp = { + request: AcceptBankIntegratedWithdrawalRequest; + response: AcceptWithdrawalResponse; +}; + +export type AcceptManualWithdrawalOp = { + request: AcceptManualWithdrawalRequest; + response: AcceptManualWithdrawalResult; +}; + +export type ListExchangesOp = { + request: {}; + response: ExchangesListResponse; +}; + +export type AddExchangeOp = { + request: AddExchangeRequest; + response: {}; +}; + +export type SetExchangeTosAcceptedOp = { + request: AcceptExchangeTosRequest; + response: {}; +}; + +export type GetExchangeTosOp = { + request: GetExchangeTosRequest; + response: GetExchangeTosResult; +}; + +export type TrackDepositGroupOp = { + request: TrackDepositGroupRequest; + response: TrackDepositGroupResponse; +}; + +export type CreateDepositGroupOp = { + request: CreateDepositGroupRequest; + response: CreateDepositGroupResponse; +}; + +export type SetWalletDeviceIdOp = { + request: SetWalletDeviceIdRequest; + response: {}; +}; + +export type ExportBackupPlainOp = { + request: {}; + response: WalletBackupContentV1; +}; + +export type ExportBackupRecoveryOp = { + request: {}; + response: BackupRecovery; +}; + +export type ImportBackupRecoveryOp = { + request: RecoveryLoadRequest; + response: {}; +}; + +export type RunBackupCycleOp = { + request: {}; + response: {}; +}; + +export type AddBackupProviderOp = { + request: AddBackupProviderRequest; + response: {}; +}; + +export type GetBackupInfoOp = { + request: {}; + response: BackupInfo; +}; + +export type RunIntegrationTestOp = { + request: IntegrationTestArgs; + response: {}; +}; + +export type WithdrawTestBalanceOp = { + request: WithdrawTestBalanceRequest; + response: {}; +}; + +export type TestPayOp = { + request: TestPayArgs; + response: TestPayResult; +}; + +export type ExportDbOp = { + request: {}; + response: any; +}; + +export type InitiatePeerPushPaymentOp = { + request: InitiatePeerPushPaymentRequest; + response: InitiatePeerPushPaymentResponse; +}; + +export type CheckPeerPushPaymentOp = { + request: CheckPeerPushPaymentRequest; + response: CheckPeerPushPaymentResponse; +}; + +export type AcceptPeerPushPaymentOp = { + request: AcceptPeerPushPaymentRequest; + response: {}; +}; + +export type InitiatePeerPullPaymentOp = { + request: InitiatePeerPullPaymentRequest; + response: InitiatePeerPullPaymentResponse; +}; + +export type CheckPeerPullPaymentOp = { + request: CheckPeerPullPaymentRequest; + response: CheckPeerPullPaymentResponse; +}; + +export type AcceptPeerPullPaymentOp = { + request: AcceptPeerPullPaymentRequest; + response: {}; +}; + +export type ClearDbOp = { + request: {}; + response: {}; +}; + +export type RecycleOp = { + request: {}; + response: {}; +}; + export type WalletOperations = { - [WalletApiOperation.InitWallet]: { - request: {}; - response: {}; - }; - [WalletApiOperation.WithdrawFakebank]: { - request: WithdrawFakebankRequest; - response: {}; - }; - [WalletApiOperation.PreparePayForUri]: { - request: PreparePayRequest; - response: PreparePayResult; - }; - [WalletApiOperation.WithdrawTestkudos]: { - request: {}; - response: {}; - }; - [WalletApiOperation.ConfirmPay]: { - request: ConfirmPayRequest; - response: ConfirmPayResult; - }; - [WalletApiOperation.AbortFailedPayWithRefund]: { - request: AbortPayWithRefundRequest; - response: {}; - }; - [WalletApiOperation.GetBalances]: { - request: {}; - response: BalancesResponse; - }; - [WalletApiOperation.GetTransactions]: { - request: TransactionsRequest; - response: TransactionsResponse; - }; - [WalletApiOperation.GetPendingOperations]: { - request: {}; - response: PendingOperationsResponse; - }; - [WalletApiOperation.DumpCoins]: { - request: {}; - response: CoinDumpJson; - }; - [WalletApiOperation.SetCoinSuspended]: { - request: SetCoinSuspendedRequest; - response: {}; - }; - [WalletApiOperation.ForceRefresh]: { - request: ForceRefreshRequest; - response: {}; - }; - [WalletApiOperation.DeleteTransaction]: { - request: DeleteTransactionRequest; - response: {}; - }; - [WalletApiOperation.RetryTransaction]: { - request: RetryTransactionRequest; - response: {}; - }; - [WalletApiOperation.PrepareTip]: { - request: PrepareTipRequest; - response: PrepareTipResult; - }; - [WalletApiOperation.AcceptTip]: { - request: AcceptTipRequest; - response: {}; - }; - [WalletApiOperation.ApplyRefund]: { - request: ApplyRefundRequest; - response: ApplyRefundResponse; - }; - [WalletApiOperation.ListCurrencies]: { - request: {}; - response: WalletCurrencyInfo; - }; - [WalletApiOperation.GetWithdrawalDetailsForAmount]: { - request: GetWithdrawalDetailsForAmountRequest; - response: ManualWithdrawalDetails; - }; - [WalletApiOperation.GetWithdrawalDetailsForUri]: { - request: GetWithdrawalDetailsForUriRequest; - response: WithdrawUriInfoResponse; - }; - [WalletApiOperation.AcceptBankIntegratedWithdrawal]: { - request: AcceptBankIntegratedWithdrawalRequest; - response: AcceptWithdrawalResponse; - }; - [WalletApiOperation.AcceptManualWithdrawal]: { - request: AcceptManualWithdrawalRequest; - response: AcceptManualWithdrawalResult; - }; - [WalletApiOperation.ListExchanges]: { - request: {}; - response: ExchangesListResponse; - }; - [WalletApiOperation.AddExchange]: { - request: AddExchangeRequest; - response: {}; - }; - [WalletApiOperation.SetExchangeTosAccepted]: { - request: AcceptExchangeTosRequest; - response: {}; - }; - [WalletApiOperation.GetExchangeTos]: { - request: GetExchangeTosRequest; - response: GetExchangeTosResult; - }; - [WalletApiOperation.TrackDepositGroup]: { - request: TrackDepositGroupRequest; - response: TrackDepositGroupResponse; - }; - [WalletApiOperation.CreateDepositGroup]: { - request: CreateDepositGroupRequest; - response: CreateDepositGroupResponse; - }; - [WalletApiOperation.SetWalletDeviceId]: { - request: SetWalletDeviceIdRequest; - response: {}; - }; - [WalletApiOperation.ExportBackupPlain]: { - request: {}; - response: WalletBackupContentV1; - }; - [WalletApiOperation.ExportBackupRecovery]: { - request: {}; - response: BackupRecovery; - }; - [WalletApiOperation.ImportBackupRecovery]: { - request: RecoveryLoadRequest; - response: {}; - }; - [WalletApiOperation.RunBackupCycle]: { - request: {}; - response: {}; - }; - [WalletApiOperation.AddBackupProvider]: { - request: AddBackupProviderRequest; - response: {}; - }; - [WalletApiOperation.GetBackupInfo]: { - request: {}; - response: BackupInfo; - }; - [WalletApiOperation.RunIntegrationTest]: { - request: IntegrationTestArgs; - response: {}; - }; - [WalletApiOperation.WithdrawTestBalance]: { - request: WithdrawTestBalanceRequest; - response: {}; - }; - [WalletApiOperation.TestPay]: { - request: TestPayArgs; - response: TestPayResult; - }; - [WalletApiOperation.ExportDb]: { - request: {}; - response: any; - }; - [WalletApiOperation.InitiatePeerPushPayment]: { - request: InitiatePeerPushPaymentRequest; - response: InitiatePeerPushPaymentResponse; - }; - [WalletApiOperation.CheckPeerPushPayment]: { - request: CheckPeerPushPaymentRequest; - response: CheckPeerPushPaymentResponse; - }; - [WalletApiOperation.AcceptPeerPushPayment]: { - request: AcceptPeerPushPaymentRequest; - response: {}; - }; - [WalletApiOperation.InitiatePeerPullPayment]: { - request: InitiatePeerPullPaymentRequest; - response: InitiatePeerPullPaymentResponse; - }; - [WalletApiOperation.CheckPeerPullPayment]: { - request: CheckPeerPullPaymentRequest; - response: CheckPeerPullPaymentResponse; - }; - [WalletApiOperation.AcceptPeerPullPayment]: { - request: AcceptPeerPullPaymentRequest; - response: {}; - }; - [WalletApiOperation.ClearDb]: { - request: {}; - response: {}; - }; - [WalletApiOperation.Recycle]: { - request: {}; - response: {}; - }; + [WalletApiOperation.InitWallet]: InitWalletOp; + [WalletApiOperation.WithdrawFakebank]: WithdrawFakebankOp; + [WalletApiOperation.PreparePayForUri]: PreparePayForUriOp; + [WalletApiOperation.WithdrawTestkudos]: WithdrawTestkudosOp; + [WalletApiOperation.ConfirmPay]: ConfirmPayOp; + [WalletApiOperation.AbortFailedPayWithRefund]: AbortPayWithRefundOp; + [WalletApiOperation.GetBalances]: GetBalancesOp; + [WalletApiOperation.GetTransactions]: GetTransactionsOp; + [WalletApiOperation.GetPendingOperations]: GetPendingOperationsOp; + [WalletApiOperation.DumpCoins]: DumpCoinsOp; + [WalletApiOperation.SetCoinSuspended]: SetCoinSuspendedOp; + [WalletApiOperation.ForceRefresh]: ForceRefreshOp; + [WalletApiOperation.DeleteTransaction]: DeleteTransactionOp; + [WalletApiOperation.RetryTransaction]: RetryTransactionOp; + [WalletApiOperation.PrepareTip]: PrepareTipOp; + [WalletApiOperation.AcceptTip]: AcceptTipOp; + [WalletApiOperation.ApplyRefund]: ApplyRefundOp; + [WalletApiOperation.ListCurrencies]: ListCurrenciesOp; + [WalletApiOperation.GetWithdrawalDetailsForAmount]: GetWithdrawalDetailsForAmountOp; + [WalletApiOperation.GetWithdrawalDetailsForUri]: GetWithdrawalDetailsForUriOp; + [WalletApiOperation.AcceptBankIntegratedWithdrawal]: AcceptBankIntegratedWithdrawalOp; + [WalletApiOperation.AcceptManualWithdrawal]: AcceptManualWithdrawalOp; + [WalletApiOperation.ListExchanges]: ListExchangesOp; + [WalletApiOperation.AddExchange]: AddExchangeOp; + [WalletApiOperation.SetExchangeTosAccepted]: SetExchangeTosAcceptedOp; + [WalletApiOperation.GetExchangeTos]: GetExchangeTosOp; + [WalletApiOperation.TrackDepositGroup]: TrackDepositGroupOp; + [WalletApiOperation.CreateDepositGroup]: CreateDepositGroupOp; + [WalletApiOperation.SetWalletDeviceId]: SetWalletDeviceIdOp; + [WalletApiOperation.ExportBackupPlain]: ExportBackupPlainOp; + [WalletApiOperation.ExportBackupRecovery]: ExportBackupRecoveryOp; + [WalletApiOperation.ImportBackupRecovery]: ImportBackupRecoveryOp; + [WalletApiOperation.RunBackupCycle]: RunBackupCycleOp; + [WalletApiOperation.AddBackupProvider]: AddBackupProviderOp; + [WalletApiOperation.GetBackupInfo]: GetBackupInfoOp; + [WalletApiOperation.RunIntegrationTest]: RunIntegrationTestOp; + [WalletApiOperation.WithdrawTestBalance]: WithdrawTestBalanceOp; + [WalletApiOperation.TestPay]: TestPayOp; + [WalletApiOperation.ExportDb]: ExportDbOp; + [WalletApiOperation.InitiatePeerPushPayment]: InitiatePeerPushPaymentOp; + [WalletApiOperation.CheckPeerPushPayment]: CheckPeerPushPaymentOp; + [WalletApiOperation.AcceptPeerPushPayment]: AcceptPeerPushPaymentOp; + [WalletApiOperation.InitiatePeerPullPayment]: InitiatePeerPullPaymentOp; + [WalletApiOperation.CheckPeerPullPayment]: CheckPeerPullPaymentOp; + [WalletApiOperation.AcceptPeerPullPayment]: AcceptPeerPullPaymentOp; + [WalletApiOperation.ClearDb]: ClearDbOp; + [WalletApiOperation.Recycle]: RecycleOp; }; export type RequestType< |