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 of the peer push payment incoming initiation.
|
||||||
*/
|
*/
|
||||||
status: PeerPullPaymentIncomingStatus;
|
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 sel = coinSelRes.result;
|
||||||
|
|
||||||
|
const totalAmount = await getTotalPeerPaymentCost(
|
||||||
|
ws,
|
||||||
|
coinSelRes.result.coins,
|
||||||
|
);
|
||||||
|
|
||||||
await ws.db
|
await ws.db
|
||||||
.mktx((x) => [
|
.mktx((x) => [
|
||||||
x.exchanges,
|
x.exchanges,
|
||||||
@ -908,6 +913,7 @@ export async function acceptPeerPullPayment(
|
|||||||
throw Error();
|
throw Error();
|
||||||
}
|
}
|
||||||
pi.status = PeerPullPaymentIncomingStatus.Accepted;
|
pi.status = PeerPullPaymentIncomingStatus.Accepted;
|
||||||
|
pi.totalCost = Amounts.stringify(totalAmount);
|
||||||
await tx.peerPullPaymentIncoming.put(pi);
|
await tx.peerPullPaymentIncoming.put(pi);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -995,6 +1001,7 @@ export async function checkPeerPullPayment(
|
|||||||
timestampCreated: TalerProtocolTimestamp.now(),
|
timestampCreated: TalerProtocolTimestamp.now(),
|
||||||
contractTerms: dec.contractTerms,
|
contractTerms: dec.contractTerms,
|
||||||
status: PeerPullPaymentIncomingStatus.Proposed,
|
status: PeerPullPaymentIncomingStatus.Proposed,
|
||||||
|
totalCost: undefined,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -380,7 +380,9 @@ function buildTransactionForPullPaymentDebit(
|
|||||||
): Transaction {
|
): Transaction {
|
||||||
return {
|
return {
|
||||||
type: TransactionType.PeerPullDebit,
|
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),
|
amountRaw: Amounts.stringify(pi.contractTerms.amount),
|
||||||
exchangeBaseUrl: pi.exchangeBaseUrl,
|
exchangeBaseUrl: pi.exchangeBaseUrl,
|
||||||
frozen: false,
|
frozen: false,
|
||||||
|
Loading…
Reference in New Issue
Block a user