diff options
author | Florian Dold <florian@dold.me> | 2021-05-20 18:27:35 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2021-05-20 18:27:35 +0200 |
commit | 9a861b80efc1b753296b477ce61b8abf24137dee (patch) | |
tree | cf0e50ba1ba6e7e4a17950ae29ffdee9afc1c312 | |
parent | 6f1b7f5b998c1d7c385cad2f29a85db311999131 (diff) |
allow deletion via API
-rw-r--r-- | packages/taler-util/src/walletTypes.ts | 9 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/wallet.ts | 9 |
2 files changed, 14 insertions, 4 deletions
diff --git a/packages/taler-util/src/walletTypes.ts b/packages/taler-util/src/walletTypes.ts index 006140070..10dbf75eb 100644 --- a/packages/taler-util/src/walletTypes.ts +++ b/packages/taler-util/src/walletTypes.ts @@ -68,8 +68,6 @@ export class CreateReserveResponse { reservePub: string; } - - export interface Balance { available: AmountString; pendingIncoming: AmountString; @@ -949,4 +947,9 @@ export interface WalletCurrencyInfo { export interface DeleteTransactionRequest { transactionId: string; -}
\ No newline at end of file +} + +export const codecForDeleteTransactionRequest = (): Codec<DeleteTransactionRequest> => + buildCodecForObject<DeleteTransactionRequest>() + .property("transactionId", codecForString()) + .build("DeleteTransactionRequest"); diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts index c380786ab..317d81ceb 100644 --- a/packages/taler-wallet-core/src/wallet.ts +++ b/packages/taler-wallet-core/src/wallet.ts @@ -25,6 +25,7 @@ import { BackupRecovery, codecForAny, + codecForDeleteTransactionRequest, DeleteTransactionRequest, TalerErrorCode, WalletCurrencyInfo, @@ -1191,9 +1192,15 @@ export class Wallet { const req = codecForCreateDepositGroupRequest().decode(payload); return await createDepositGroup(this.ws, req); } - case "trackDepositGroup": + case "trackDepositGroup": { const req = codecForTrackDepositGroupRequest().decode(payload); return trackDepositGroup(this.ws, req); + } + case "deleteTransaction": { + const req = codecForDeleteTransactionRequest().decode(payload); + await deleteTransaction(this.ws, req.transactionId); + return {}; + } } throw OperationFailedError.fromCode( TalerErrorCode.WALLET_CORE_API_OPERATION_UNKNOWN, |