diff options
Diffstat (limited to 'packages/taler-wallet-core/src/operations/pay.ts')
-rw-r--r-- | packages/taler-wallet-core/src/operations/pay.ts | 70 |
1 files changed, 64 insertions, 6 deletions
diff --git a/packages/taler-wallet-core/src/operations/pay.ts b/packages/taler-wallet-core/src/operations/pay.ts index 168a0f965..da3980565 100644 --- a/packages/taler-wallet-core/src/operations/pay.ts +++ b/packages/taler-wallet-core/src/operations/pay.ts @@ -24,12 +24,72 @@ /** * Imports. */ -import { AmountJson, Amounts, timestampIsBetween, getTimestampNow, isTimestampExpired, Timestamp, RefreshReason, CoinDepositPermission, NotificationType, TalerErrorDetails, Duration, durationMax, durationMin, durationMul, ContractTerms, codecForProposal, TalerErrorCode, codecForContractTerms, timestampAddDuration, ConfirmPayResult, ConfirmPayResultType, codecForMerchantPayResponse, PreparePayResult, PreparePayResultType, parsePayUri } from "@gnu-taler/taler-util"; +import { + AmountJson, + Amounts, + timestampIsBetween, + getTimestampNow, + isTimestampExpired, + Timestamp, + RefreshReason, + CoinDepositPermission, + NotificationType, + TalerErrorDetails, + Duration, + durationMax, + durationMin, + durationMul, + ContractTerms, + codecForProposal, + TalerErrorCode, + codecForContractTerms, + timestampAddDuration, + ConfirmPayResult, + ConfirmPayResultType, + codecForMerchantPayResponse, + PreparePayResult, + PreparePayResultType, + parsePayUri, +} from "@gnu-taler/taler-util"; import { encodeCrock, getRandomBytes } from "../crypto/talerCrypto"; -import { AbortStatus, AllowedAuditorInfo, AllowedExchangeInfo, CoinRecord, CoinStatus, DenominationRecord, getHttpResponseErrorDetails, guardOperationException, HttpResponseStatus, Logger, makeErrorDetails, OperationFailedAndReportedError, OperationFailedError, ProposalRecord, ProposalStatus, PurchaseRecord, readSuccessResponseJsonOrErrorCode, readSuccessResponseJsonOrThrow, readTalerErrorResponse, Stores, throwUnexpectedRequestError, TransactionHandle, URL, WalletContractData } from "../index.js"; -import { PayCoinSelection, CoinCandidateSelection, AvailableCoinInfo, selectPayCoins } from "../util/coinSelection.js"; +import { + AbortStatus, + AllowedAuditorInfo, + AllowedExchangeInfo, + CoinRecord, + CoinStatus, + DenominationRecord, + getHttpResponseErrorDetails, + guardOperationException, + HttpResponseStatus, + Logger, + makeErrorDetails, + OperationFailedAndReportedError, + OperationFailedError, + ProposalRecord, + ProposalStatus, + PurchaseRecord, + readSuccessResponseJsonOrErrorCode, + readSuccessResponseJsonOrThrow, + readTalerErrorResponse, + Stores, + throwUnexpectedRequestError, + TransactionHandle, + URL, + WalletContractData, +} from "../index.js"; +import { + PayCoinSelection, + CoinCandidateSelection, + AvailableCoinInfo, + selectPayCoins, +} from "../util/coinSelection.js"; import { canonicalJson } from "../util/helpers.js"; -import { initRetryInfo, updateRetryInfoTimeout, getRetryDuration } from "../util/retries.js"; +import { + initRetryInfo, + updateRetryInfoTimeout, + getRetryDuration, +} from "../util/retries.js"; import { getTotalRefreshCost, createRefreshGroup } from "./refresh.js"; import { InternalWalletState, EXCHANGE_COINS_LOCK } from "./state.js"; @@ -38,7 +98,6 @@ import { InternalWalletState, EXCHANGE_COINS_LOCK } from "./state.js"; */ const logger = new Logger("pay.ts"); - /** * Compute the total cost of a payment to the customer. * @@ -123,7 +182,6 @@ export async function getEffectiveDepositAmount( return Amounts.sub(Amounts.sum(amt).amount, Amounts.sum(fees).amount).amount; } - export function isSpendableCoin( coin: CoinRecord, denom: DenominationRecord, |