fix: missing total cost in peer pull payment
This commit is contained in:
parent
20b9e62aa1
commit
4bd9b1ba79
@ -1864,6 +1864,12 @@ export interface PeerPullPaymentIncomingRecord {
|
||||
* Status of the peer push payment incoming initiation.
|
||||
*/
|
||||
status: PeerPullPaymentIncomingStatus;
|
||||
|
||||
/**
|
||||
* Total cost based on the coin selection.
|
||||
* Non undefined after status === "Accepted"
|
||||
*/
|
||||
totalCost: AmountString | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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,
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user