aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-wallet-core/src/operations')
-rw-r--r--packages/taler-wallet-core/src/operations/pay-peer.ts7
-rw-r--r--packages/taler-wallet-core/src/operations/transactions.ts4
2 files changed, 10 insertions, 1 deletions
diff --git a/packages/taler-wallet-core/src/operations/pay-peer.ts b/packages/taler-wallet-core/src/operations/pay-peer.ts
index 48434e452..7dc7b67fe 100644
--- a/packages/taler-wallet-core/src/operations/pay-peer.ts
+++ b/packages/taler-wallet-core/src/operations/pay-peer.ts
@@ -882,6 +882,11 @@ export async function acceptPeerPullPayment(
const sel = coinSelRes.result;
+ const totalAmount = await getTotalPeerPaymentCost(
+ ws,
+ coinSelRes.result.coins,
+ );
+
await ws.db
.mktx((x) => [
x.exchanges,
@@ -908,6 +913,7 @@ export async function acceptPeerPullPayment(
throw Error();
}
pi.status = PeerPullPaymentIncomingStatus.Accepted;
+ pi.totalCost = Amounts.stringify(totalAmount);
await tx.peerPullPaymentIncoming.put(pi);
});
@@ -995,6 +1001,7 @@ export async function checkPeerPullPayment(
timestampCreated: TalerProtocolTimestamp.now(),
contractTerms: dec.contractTerms,
status: PeerPullPaymentIncomingStatus.Proposed,
+ totalCost: undefined,
});
});
diff --git a/packages/taler-wallet-core/src/operations/transactions.ts b/packages/taler-wallet-core/src/operations/transactions.ts
index 58def0f34..b94617851 100644
--- a/packages/taler-wallet-core/src/operations/transactions.ts
+++ b/packages/taler-wallet-core/src/operations/transactions.ts
@@ -380,7 +380,9 @@ function buildTransactionForPullPaymentDebit(
): Transaction {
return {
type: TransactionType.PeerPullDebit,
- amountEffective: Amounts.stringify(pi.contractTerms.amount),
+ amountEffective: pi.totalCost
+ ? pi.totalCost
+ : Amounts.stringify(pi.contractTerms.amount),
amountRaw: Amounts.stringify(pi.contractTerms.amount),
exchangeBaseUrl: pi.exchangeBaseUrl,
frozen: false,