aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations/pay-merchant.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2023-01-04 15:18:58 +0100
committerFlorian Dold <florian@dold.me>2023-01-04 15:18:58 +0100
commit7d02e4212346b7b7b88197259a7e74554e1b10a3 (patch)
treee77f2ea4484247d6eadebabb9d0b3601dacba2d8 /packages/taler-wallet-core/src/operations/pay-merchant.ts
parentaa165477d0ba682f5464d3b27ddb07001eab8366 (diff)
downloadwallet-core-7d02e4212346b7b7b88197259a7e74554e1b10a3.tar.xz
wallet-core: define insufficient balance details
Diffstat (limited to 'packages/taler-wallet-core/src/operations/pay-merchant.ts')
-rw-r--r--packages/taler-wallet-core/src/operations/pay-merchant.ts73
1 files changed, 45 insertions, 28 deletions
diff --git a/packages/taler-wallet-core/src/operations/pay-merchant.ts b/packages/taler-wallet-core/src/operations/pay-merchant.ts
index ed7f17a18..49b9a6559 100644
--- a/packages/taler-wallet-core/src/operations/pay-merchant.ts
+++ b/packages/taler-wallet-core/src/operations/pay-merchant.ts
@@ -191,34 +191,6 @@ export async function getTotalPaymentCost(
});
}
-export interface CoinSelectionRequest {
- amount: AmountJson;
-
- allowedAuditors: AllowedAuditorInfo[];
- allowedExchanges: AllowedExchangeInfo[];
-
- /**
- * Timestamp of the contract.
- */
- timestamp: TalerProtocolTimestamp;
-
- wireMethod: string;
-
- wireFeeAmortization: number;
-
- maxWireFee: AmountJson;
-
- maxDepositFee: AmountJson;
-
- /**
- * Minimum age requirement for the coin selection.
- *
- * When present, only select coins with either no age restriction
- * or coins with an age commitment that matches the minimum age.
- */
- minimumAge?: number;
-}
-
async function failProposalPermanently(
ws: InternalWalletState,
proposalId: string,
@@ -903,6 +875,51 @@ async function unblockBackup(
});
}
+/**
+ * Detailed reason for why the wallet's balance is insufficient.
+ */
+export interface PayMerchantInsufficientBalanceDetails {
+ /**
+ * Amount requested by the merchant.
+ */
+ amountRequested: AmountJson;
+
+ /**
+ * Balance of type "available" (see balance.ts for definition).
+ */
+ balanceAvailable: AmountJson;
+
+ /**
+ * Balance of type "material" (see balance.ts for definition).
+ */
+ balanceMaterial: AmountJson;
+
+ /**
+ * Balance of type "age-acceptable" (see balance.ts for definition).
+ */
+ balanceAgeAcceptable: AmountJson;
+
+ /**
+ * Balance of type "merchant-acceptable" (see balance.ts for definition).
+ */
+ balanceMechantAcceptable: AmountJson;
+
+ /**
+ * Balance of type "merchant-wireable" (see balance.ts for definition).
+ */
+ balanceMechantWireable: AmountJson;
+
+ /**
+ * If the payment would succeed without fees,
+ * this field contains an estimate of the amount that would additionally
+ * be required to cover the fees.
+ *
+ * It is not possible to give an exact value here, since it depends
+ * on the coin selection for the amount that would be additionally withdrawn.
+ */
+ feeGapEstimate: AmountJson
+}
+
export interface SelectPayCoinRequestNg {
exchanges: AllowedExchangeInfo[];
auditors: AllowedAuditorInfo[];