[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] branch master updated: wallet-core: allow requesting
From: |
gnunet |
Subject: |
[taler-wallet-core] branch master updated: wallet-core: allow requesting full contract terms in getTransactionById |
Date: |
Wed, 04 Dec 2024 23:07:15 +0100 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository wallet-core.
The following commit(s) were added to refs/heads/master by this push:
new 9ced5e05b wallet-core: allow requesting full contract terms in
getTransactionById
9ced5e05b is described below
commit 9ced5e05bea5f7d0d664d95c89ff9608ea447b75
Author: Florian Dold <florian@dold.me>
AuthorDate: Wed Dec 4 23:07:11 2024 +0100
wallet-core: allow requesting full contract terms in getTransactionById
---
.../src/types-taler-wallet-transactions.ts | 20 +++++++++++++++++++-
packages/taler-wallet-core/src/common.ts | 5 +++++
packages/taler-wallet-core/src/pay-merchant.ts | 5 +++++
packages/taler-wallet-core/src/transactions.ts | 4 +++-
packages/taler-wallet-core/src/wallet-api-types.ts | 11 +++++++++--
.../src/components/ShowFullContractTermPopup.tsx | 1 +
6 files changed, 42 insertions(+), 4 deletions(-)
diff --git a/packages/taler-util/src/types-taler-wallet-transactions.ts
b/packages/taler-util/src/types-taler-wallet-transactions.ts
index 43a9d9c55..27c068c39 100644
--- a/packages/taler-util/src/types-taler-wallet-transactions.ts
+++ b/packages/taler-util/src/types-taler-wallet-transactions.ts
@@ -49,7 +49,11 @@ import {
InternationalizedString,
codecForInternationalizedString,
} from "./types-taler-common.js";
-import { MerchantInfo, codecForMerchantInfo } from "./types-taler-merchant.js";
+import {
+ ContractTerms,
+ MerchantInfo,
+ codecForMerchantInfo,
+} from "./types-taler-merchant.js";
import {
RefreshReason,
ScopeInfo,
@@ -633,6 +637,13 @@ export interface TransactionPayment extends
TransactionCommon {
*/
info: OrderShortInfo;
+ /**
+ * Full contract terms.
+ *
+ * Only included if explicitly included in the request.
+ */
+ contractTerms?: ContractTerms;
+
/**
* Amount that must be paid for the contract
*/
@@ -834,12 +845,19 @@ export interface TransactionDeposit extends
TransactionCommon {
export interface TransactionByIdRequest {
transactionId: string;
+
+ /**
+ * If set to true, report the full contract terms in the response
+ * if the transaction has them.
+ */
+ includeContractTerms?: boolean;
}
export const codecForTransactionByIdRequest =
(): Codec<TransactionByIdRequest> =>
buildCodecForObject<TransactionByIdRequest>()
.property("transactionId", codecForString())
+ .property("includeContractTerms", codecOptional(codecForBoolean()))
.build("TransactionByIdRequest");
export const codecForGetTransactionsV2Request =
diff --git a/packages/taler-wallet-core/src/common.ts
b/packages/taler-wallet-core/src/common.ts
index d9438d19c..36215f841 100644
--- a/packages/taler-wallet-core/src/common.ts
+++ b/packages/taler-wallet-core/src/common.ts
@@ -806,9 +806,14 @@ export interface TransactionContext {
deleteTransaction(): Promise<void>;
lookupFullTransaction(
tx: WalletDbAllStoresReadOnlyTransaction,
+ args?: LookupFullTransactionOpts,
): Promise<Transaction | undefined>;
}
+export interface LookupFullTransactionOpts {
+ includeContractTerms?: boolean;
+}
+
declare const __taskIdStr: unique symbol;
export type TaskIdStr = string & { [__taskIdStr]: true };
diff --git a/packages/taler-wallet-core/src/pay-merchant.ts
b/packages/taler-wallet-core/src/pay-merchant.ts
index d6dafac69..08bbeaec1 100644
--- a/packages/taler-wallet-core/src/pay-merchant.ts
+++ b/packages/taler-wallet-core/src/pay-merchant.ts
@@ -115,6 +115,7 @@ import {
constructTaskIdentifier,
genericWaitForState,
genericWaitForStateVal,
+ LookupFullTransactionOpts,
PendingTaskType,
spendCoins,
TaskIdentifiers,
@@ -218,6 +219,7 @@ export class PayMerchantTransactionContext implements
TransactionContext {
async lookupFullTransaction(
tx: WalletDbAllStoresReadOnlyTransaction,
+ req: LookupFullTransactionOpts,
): Promise<Transaction | undefined> {
const proposalId = this.proposalId;
const purchaseRec = await tx.purchases.get(proposalId);
@@ -305,6 +307,9 @@ export class PayMerchantTransactionContext implements
TransactionContext {
}),
abortReason: purchaseRec.abortReason,
info,
+ contractTerms: req.includeContractTerms
+ ? download.contractTermsRaw
+ : undefined,
refundQueryActive:
purchaseRec.purchaseStatus === PurchaseStatus.PendingQueryingRefund,
...(payRetryRec?.lastError ? { error: payRetryRec.lastError } : {}),
diff --git a/packages/taler-wallet-core/src/transactions.ts
b/packages/taler-wallet-core/src/transactions.ts
index 3f1e7a3ac..fd876e108 100644
--- a/packages/taler-wallet-core/src/transactions.ts
+++ b/packages/taler-wallet-core/src/transactions.ts
@@ -159,7 +159,9 @@ export async function getTransactionById(
case TransactionType.Refund: {
const ctx = await getContextForTransaction(wex, req.transactionId);
const txDetails = await wex.db.runAllStoresReadOnlyTx({}, async (tx) =>
- ctx.lookupFullTransaction(tx),
+ ctx.lookupFullTransaction(tx, {
+ includeContractTerms: req.includeContractTerms,
+ }),
);
if (!txDetails) {
throw Error("transaction not found");
diff --git a/packages/taler-wallet-core/src/wallet-api-types.ts
b/packages/taler-wallet-core/src/wallet-api-types.ts
index e7cf8ec24..0bba54393 100644
--- a/packages/taler-wallet-core/src/wallet-api-types.ts
+++ b/packages/taler-wallet-core/src/wallet-api-types.ts
@@ -182,7 +182,6 @@ export enum WalletApiOperation {
SharePayment = "sharePayment",
CheckPayForTemplate = "checkPayForTemplate",
PreparePayForTemplate = "preparePayForTemplate",
- GetContractTermsDetails = "getContractTermsDetails",
RunIntegrationTest = "runIntegrationTest",
RunIntegrationTestV2 = "runIntegrationTestV2",
TestCrypto = "testCrypto",
@@ -294,9 +293,17 @@ export enum WalletApiOperation {
HintApplicationResumed = "hintApplicationResumed",
/**
- * @deprecated use checkDeposit instead
+ * @deprecated (2024-12-04)
+ *
+ * use checkDeposit instead
*/
PrepareDeposit = "prepareDeposit",
+
+ /**
+ * @deprecated (2024-12-04)
+ * Use getTransactionById with includeContractTerms: true instead
+ */
+ GetContractTermsDetails = "getContractTermsDetails",
}
// group: Initialization
diff --git
a/packages/taler-wallet-webextension/src/components/ShowFullContractTermPopup.tsx
b/packages/taler-wallet-webextension/src/components/ShowFullContractTermPopup.tsx
index e655def39..b318f7ec7 100644
---
a/packages/taler-wallet-webextension/src/components/ShowFullContractTermPopup.tsx
+++
b/packages/taler-wallet-webextension/src/components/ShowFullContractTermPopup.tsx
@@ -36,6 +36,7 @@ import { compose, StateViewMap } from "../utils/index.js";
import { Amount } from "./Amount.js";
import { ErrorAlertView } from "./CurrentAlerts.js";
import { Link } from "./styled/index.js";
+import { WxApiType } from "../wxApi.js";
const ContractTermsTable = styled.table`
width: 100%;
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-wallet-core] branch master updated: wallet-core: allow requesting full contract terms in getTransactionById,
gnunet <=