add reservePub to the withdrawal transaction info
This commit is contained in:
parent
4941546886
commit
60cfb0e78f
@ -130,6 +130,9 @@ interface WithdrawalDetailsForManualTransfer {
|
||||
* Already contains the amount and message.
|
||||
*/
|
||||
exchangePaytoUris: string[];
|
||||
|
||||
// Public key of the reserve
|
||||
reservePub: string;
|
||||
}
|
||||
|
||||
interface WithdrawalDetailsForTalerBankIntegrationApi {
|
||||
@ -147,6 +150,9 @@ interface WithdrawalDetailsForTalerBankIntegrationApi {
|
||||
* initiated confirmation.
|
||||
*/
|
||||
bankConfirmationUrl?: string;
|
||||
|
||||
// Public key of the reserve
|
||||
reservePub: string;
|
||||
}
|
||||
|
||||
// This should only be used for actual withdrawals
|
||||
|
@ -15,62 +15,36 @@
|
||||
*/
|
||||
|
||||
import {
|
||||
CreateReserveRequest,
|
||||
CreateReserveResponse,
|
||||
TalerErrorDetails,
|
||||
AcceptWithdrawalResponse,
|
||||
Amounts,
|
||||
codecForBankWithdrawalOperationPostResponse,
|
||||
AcceptWithdrawalResponse, addPaytoQueryParams, Amounts, canonicalizeBaseUrl, codecForBankWithdrawalOperationPostResponse,
|
||||
codecForReserveStatus,
|
||||
codecForWithdrawOperationStatusResponse,
|
||||
Duration,
|
||||
codecForWithdrawOperationStatusResponse, CreateReserveRequest,
|
||||
CreateReserveResponse, Duration,
|
||||
durationMax,
|
||||
durationMin,
|
||||
getTimestampNow,
|
||||
NotificationType,
|
||||
ReserveTransactionType,
|
||||
TalerErrorCode,
|
||||
addPaytoQueryParams,
|
||||
durationMin, encodeCrock, getRandomBytes, getTimestampNow, Logger, NotificationType, randomBytes, ReserveTransactionType,
|
||||
TalerErrorCode, TalerErrorDetails, URL
|
||||
} from "@gnu-taler/taler-util";
|
||||
import { randomBytes } from "@gnu-taler/taler-util";
|
||||
import {
|
||||
ReserveRecordStatus,
|
||||
ReserveBankInfo,
|
||||
ReserveRecord,
|
||||
WithdrawalGroupRecord,
|
||||
WalletStoresV1,
|
||||
} from "../db.js";
|
||||
import { assertUnreachable } from "../util/assertUnreachable.js";
|
||||
import { canonicalizeBaseUrl } from "@gnu-taler/taler-util";
|
||||
import {
|
||||
initRetryInfo,
|
||||
getRetryDuration,
|
||||
updateRetryInfoTimeout,
|
||||
} from "../util/retries.js";
|
||||
import { guardOperationException, OperationFailedError } from "../errors.js";
|
||||
import {
|
||||
updateExchangeFromUrl,
|
||||
getExchangePaytoUri,
|
||||
getExchangeDetails,
|
||||
getExchangeTrust,
|
||||
} from "./exchanges.js";
|
||||
import { InternalWalletState } from "../common.js";
|
||||
import {
|
||||
updateWithdrawalDenoms,
|
||||
getCandidateWithdrawalDenoms,
|
||||
selectWithdrawalDenominations,
|
||||
denomSelectionInfoToState,
|
||||
processWithdrawGroup,
|
||||
getBankWithdrawalInfo,
|
||||
} from "./withdraw.js";
|
||||
import { encodeCrock, getRandomBytes } from "@gnu-taler/taler-util";
|
||||
import { Logger, URL } from "@gnu-taler/taler-util";
|
||||
ReserveBankInfo,
|
||||
ReserveRecord, ReserveRecordStatus, WalletStoresV1, WithdrawalGroupRecord
|
||||
} from "../db.js";
|
||||
import { guardOperationException, OperationFailedError } from "../errors.js";
|
||||
import { assertUnreachable } from "../util/assertUnreachable.js";
|
||||
import {
|
||||
readSuccessResponseJsonOrErrorCode,
|
||||
readSuccessResponseJsonOrThrow,
|
||||
throwUnexpectedRequestError,
|
||||
throwUnexpectedRequestError
|
||||
} from "../util/http.js";
|
||||
import { GetReadOnlyAccess } from "../util/query.js";
|
||||
import {
|
||||
getRetryDuration, initRetryInfo, updateRetryInfoTimeout
|
||||
} from "../util/retries.js";
|
||||
import {
|
||||
getExchangeDetails, getExchangePaytoUri, getExchangeTrust, updateExchangeFromUrl
|
||||
} from "./exchanges.js";
|
||||
import {
|
||||
denomSelectionInfoToState, getBankWithdrawalInfo, getCandidateWithdrawalDenoms, processWithdrawGroup, selectWithdrawalDenominations, updateWithdrawalDenoms
|
||||
} from "./withdraw.js";
|
||||
|
||||
const logger = new Logger("reserves.ts");
|
||||
|
||||
@ -643,8 +617,7 @@ async function updateReserve(
|
||||
logger.trace(
|
||||
`Remaining unclaimed amount in reseve is ${Amounts.stringify(
|
||||
remainingAmount,
|
||||
)} and can be withdrawn with ${
|
||||
denomSelInfo.selectedDenoms.length
|
||||
)} and can be withdrawn with ${denomSelInfo.selectedDenoms.length
|
||||
} coins`,
|
||||
);
|
||||
|
||||
|
@ -17,32 +17,22 @@
|
||||
/**
|
||||
* Imports.
|
||||
*/
|
||||
import {
|
||||
AmountJson,
|
||||
Amounts, OrderShortInfo, PaymentStatus, timestampCmp, Transaction, TransactionsRequest,
|
||||
TransactionsResponse, TransactionType, WithdrawalDetails, WithdrawalType
|
||||
} from "@gnu-taler/taler-util";
|
||||
import { InternalWalletState } from "../common.js";
|
||||
import {
|
||||
WalletRefundItem,
|
||||
RefundState,
|
||||
ReserveRecordStatus,
|
||||
AbortStatus,
|
||||
ReserveRecord,
|
||||
AbortStatus, RefundState, ReserveRecord, ReserveRecordStatus, WalletRefundItem
|
||||
} from "../db.js";
|
||||
import { AmountJson, Amounts, timestampCmp } from "@gnu-taler/taler-util";
|
||||
import {
|
||||
TransactionsRequest,
|
||||
TransactionsResponse,
|
||||
Transaction,
|
||||
TransactionType,
|
||||
PaymentStatus,
|
||||
WithdrawalType,
|
||||
WithdrawalDetails,
|
||||
OrderShortInfo,
|
||||
} from "@gnu-taler/taler-util";
|
||||
import { getFundingPaytoUris } from "./reserves.js";
|
||||
import { getExchangeDetails } from "./exchanges.js";
|
||||
import { processWithdrawGroup } from "./withdraw.js";
|
||||
import { processPurchasePay } from "./pay.js";
|
||||
import { processDepositGroup } from "./deposits.js";
|
||||
import { processTip } from "./tip.js";
|
||||
import { getExchangeDetails } from "./exchanges.js";
|
||||
import { processPurchasePay } from "./pay.js";
|
||||
import { processRefreshGroup } from "./refresh.js";
|
||||
import { getFundingPaytoUris } from "./reserves.js";
|
||||
import { processTip } from "./tip.js";
|
||||
import { processWithdrawGroup } from "./withdraw.js";
|
||||
|
||||
/**
|
||||
* Create an event ID from the type and the primary key for the event.
|
||||
@ -138,6 +128,7 @@ export async function getTransactions(
|
||||
withdrawalDetails = {
|
||||
type: WithdrawalType.TalerBankIntegrationApi,
|
||||
confirmed: true,
|
||||
reservePub: wsr.reservePub,
|
||||
bankConfirmationUrl: r.bankInfo.confirmUrl,
|
||||
};
|
||||
} else {
|
||||
@ -151,11 +142,13 @@ export async function getTransactions(
|
||||
}
|
||||
withdrawalDetails = {
|
||||
type: WithdrawalType.ManualTransfer,
|
||||
reservePub: wsr.reservePub,
|
||||
exchangePaytoUris:
|
||||
exchangeDetails.wireInfo?.accounts.map((x) => x.payto_uri) ??
|
||||
[],
|
||||
};
|
||||
}
|
||||
|
||||
transactions.push({
|
||||
type: TransactionType.Withdrawal,
|
||||
amountEffective: Amounts.stringify(wsr.denomsSel.totalCoinValue),
|
||||
@ -194,11 +187,13 @@ export async function getTransactions(
|
||||
withdrawalDetails = {
|
||||
type: WithdrawalType.TalerBankIntegrationApi,
|
||||
confirmed: false,
|
||||
reservePub: r.reservePub,
|
||||
bankConfirmationUrl: r.bankInfo.confirmUrl,
|
||||
};
|
||||
} else {
|
||||
withdrawalDetails = {
|
||||
type: WithdrawalType.ManualTransfer,
|
||||
reservePub: r.reservePub,
|
||||
exchangePaytoUris: await getFundingPaytoUris(tx, r.reservePub),
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user