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