diff options
author | Florian Dold <florian.dold@gmail.com> | 2019-12-15 19:04:14 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2019-12-15 19:04:14 +0100 |
commit | 857c0ab4cd2253a0e1d53e3372a1ff1565cb4150 (patch) | |
tree | 1284cef3d992ce767baee0a4788214b7f474a3ba /src/wallet.ts | |
parent | 7cc3b10824683c601a9051ef98e7c1478a801db8 (diff) | |
download | wallet-core-857c0ab4cd2253a0e1d53e3372a1ff1565cb4150.tar.xz |
introduce refund groups, react correctly to 410 Gone for /refund
Diffstat (limited to 'src/wallet.ts')
-rw-r--r-- | src/wallet.ts | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/wallet.ts b/src/wallet.ts index 163f3def9..a4e201074 100644 --- a/src/wallet.ts +++ b/src/wallet.ts @@ -42,11 +42,7 @@ import { preparePay, confirmPay, processDownloadProposal, - applyRefund, - getFullRefundFees, processPurchasePay, - processPurchaseQueryRefund, - processPurchaseApplyRefund, } from "./operations/pay"; import { @@ -107,6 +103,7 @@ import { AsyncOpMemoSingle } from "./util/asyncMemo"; import { PendingOperationInfo, PendingOperationsResponse, PendingOperationType } from "./types/pending"; import { WalletNotification, NotificationType } from "./types/notifications"; import { HistoryQuery, HistoryEvent } from "./types/history"; +import { processPurchaseQueryRefund, processPurchaseApplyRefund, getFullRefundFees, applyRefund } from "./operations/refund"; /** * Wallet protocol version spoken with the exchange @@ -695,21 +692,21 @@ export class Wallet { if (!purchase) { throw Error("unknown purchase"); } - const refundsDoneAmounts = Object.values(purchase.refundsDone).map(x => - Amounts.parseOrThrow(x.refund_amount), + const refundsDoneAmounts = Object.values(purchase.refundState.refundsDone).map(x => + Amounts.parseOrThrow(x.perm.refund_amount), ); const refundsPendingAmounts = Object.values( - purchase.refundsPending, - ).map(x => Amounts.parseOrThrow(x.refund_amount)); + purchase.refundState.refundsPending, + ).map(x => Amounts.parseOrThrow(x.perm.refund_amount)); const totalRefundAmount = Amounts.sum([ ...refundsDoneAmounts, ...refundsPendingAmounts, ]).amount; - const refundsDoneFees = Object.values(purchase.refundsDone).map(x => - Amounts.parseOrThrow(x.refund_amount), + const refundsDoneFees = Object.values(purchase.refundState.refundsDone).map(x => + Amounts.parseOrThrow(x.perm.refund_amount), ); - const refundsPendingFees = Object.values(purchase.refundsPending).map(x => - Amounts.parseOrThrow(x.refund_amount), + const refundsPendingFees = Object.values(purchase.refundState.refundsPending).map(x => + Amounts.parseOrThrow(x.perm.refund_amount), ); const totalRefundFees = Amounts.sum([ ...refundsDoneFees, |