fix payment transaction
This commit is contained in:
parent
b504a5218a
commit
ee7141e28b
@ -434,6 +434,7 @@ async function recordConfirmPay(
|
|||||||
mode: "pay",
|
mode: "pay",
|
||||||
order_id: d.contractData.orderId,
|
order_id: d.contractData.orderId,
|
||||||
};
|
};
|
||||||
|
const payCostInfo = await getTotalPaymentCost(ws, coinSelection);
|
||||||
const t: PurchaseRecord = {
|
const t: PurchaseRecord = {
|
||||||
abortDone: false,
|
abortDone: false,
|
||||||
abortRequested: false,
|
abortRequested: false,
|
||||||
@ -442,6 +443,7 @@ async function recordConfirmPay(
|
|||||||
lastSessionId: sessionId,
|
lastSessionId: sessionId,
|
||||||
payCoinSelection: coinSelection,
|
payCoinSelection: coinSelection,
|
||||||
payReq,
|
payReq,
|
||||||
|
payCostInfo,
|
||||||
timestampAccept: getTimestampNow(),
|
timestampAccept: getTimestampNow(),
|
||||||
timestampLastRefundStatus: undefined,
|
timestampLastRefundStatus: undefined,
|
||||||
proposalId: proposal.proposalId,
|
proposalId: proposal.proposalId,
|
||||||
|
@ -176,11 +176,10 @@ export async function getTransactions(
|
|||||||
if (!proposal) {
|
if (!proposal) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const cost = await getTotalPaymentCost(ws, pr.payCoinSelection);
|
|
||||||
transactions.push({
|
transactions.push({
|
||||||
type: TransactionType.Payment,
|
type: TransactionType.Payment,
|
||||||
amountRaw: Amounts.stringify(pr.contractData.amount),
|
amountRaw: Amounts.stringify(pr.contractData.amount),
|
||||||
amountEffective: Amounts.stringify(cost.totalCost),
|
amountEffective: Amounts.stringify(pr.payCostInfo.totalCost),
|
||||||
failed: false,
|
failed: false,
|
||||||
pending: !pr.timestampFirstSuccessfulPay,
|
pending: !pr.timestampFirstSuccessfulPay,
|
||||||
timestamp: pr.timestampAccept,
|
timestamp: pr.timestampAccept,
|
||||||
|
@ -91,7 +91,6 @@ export function getWithdrawDenomList(
|
|||||||
denoms.sort((d1, d2) => Amounts.cmp(d2.value, d1.value));
|
denoms.sort((d1, d2) => Amounts.cmp(d2.value, d1.value));
|
||||||
|
|
||||||
for (const d of denoms) {
|
for (const d of denoms) {
|
||||||
console.log("considering denom", d);
|
|
||||||
let count = 0;
|
let count = 0;
|
||||||
const cost = Amounts.add(d.value, d.feeWithdraw).amount;
|
const cost = Amounts.add(d.value, d.feeWithdraw).amount;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
@ -43,7 +43,7 @@ import {
|
|||||||
ReserveRecoupTransaction,
|
ReserveRecoupTransaction,
|
||||||
} from "./ReserveTransaction";
|
} from "./ReserveTransaction";
|
||||||
import { Timestamp, Duration, getTimestampNow } from "../util/time";
|
import { Timestamp, Duration, getTimestampNow } from "../util/time";
|
||||||
import { PayCoinSelection } from "../operations/pay";
|
import { PayCoinSelection, PayCostInfo } from "../operations/pay";
|
||||||
|
|
||||||
export enum ReserveRecordStatus {
|
export enum ReserveRecordStatus {
|
||||||
/**
|
/**
|
||||||
@ -1226,6 +1226,8 @@ export interface PurchaseRecord {
|
|||||||
|
|
||||||
payCoinSelection: PayCoinSelection;
|
payCoinSelection: PayCoinSelection;
|
||||||
|
|
||||||
|
payCostInfo: PayCostInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Timestamp of the first time that sending a payment to the merchant
|
* Timestamp of the first time that sending a payment to the merchant
|
||||||
* for this purchase was successful.
|
* for this purchase was successful.
|
||||||
|
Loading…
Reference in New Issue
Block a user