aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2023-08-05 23:19:55 +0200
committerFlorian Dold <florian@dold.me>2023-08-05 23:34:37 +0200
commit308a4282cbdde7376d88ca76e3eca967a1f02c46 (patch)
tree1a919a37095d781513109fdc3bf388af0002a437
parent951d1b66fa0ba0dbe7cc4f81a0de4d64b35f8fad (diff)
downloadwallet-core-308a4282cbdde7376d88ca76e3eca967a1f02c46.tar.xz
wallet-core: mock implementation of GetCurrencyInfo
-rw-r--r--packages/taler-harness/src/integrationtests/test-age-restrictions-peer.ts4
-rw-r--r--packages/taler-util/src/wallet-types.ts14
-rw-r--r--packages/taler-wallet-core/src/db.ts5
-rw-r--r--packages/taler-wallet-core/src/wallet-api-types.ts10
-rw-r--r--packages/taler-wallet-core/src/wallet.ts9
5 files changed, 39 insertions, 3 deletions
diff --git a/packages/taler-harness/src/integrationtests/test-age-restrictions-peer.ts b/packages/taler-harness/src/integrationtests/test-age-restrictions-peer.ts
index d15858322..45a4391cb 100644
--- a/packages/taler-harness/src/integrationtests/test-age-restrictions-peer.ts
+++ b/packages/taler-harness/src/integrationtests/test-age-restrictions-peer.ts
@@ -26,7 +26,7 @@ import {
} from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { defaultCoinConfig } from "../harness/denomStructures.js";
-import { GlobalTestState, WalletCli } from "../harness/harness.js";
+import { GlobalTestState } from "../harness/harness.js";
import {
createSimpleTestkudosEnvironmentV2,
createWalletDaemonWithClient,
@@ -106,7 +106,7 @@ export async function runAgeRestrictionsPeerTest(t: GlobalTestState) {
);
await wallet2.call(WalletApiOperation.ConfirmPeerPushCredit, {
- peerPushPaymentIncomingId: checkResp.peerPushPaymentIncomingId,
+ transactionId: checkResp.transactionId,
});
const peerPullCreditDoneCond = wallet2.waitForNotificationCond(
diff --git a/packages/taler-util/src/wallet-types.ts b/packages/taler-util/src/wallet-types.ts
index 38e5787ba..922b20862 100644
--- a/packages/taler-util/src/wallet-types.ts
+++ b/packages/taler-util/src/wallet-types.ts
@@ -379,6 +379,20 @@ export interface Balance {
requiresUserInput: boolean;
}
+export interface GetCurrencyInfoRequest {
+ currency: string;
+ scope: ScopeInfo;
+}
+
+export interface GetCurrencyInfoResponse {
+ decimalSeparator: string;
+ numFractionalDigits: number;
+ /**
+ * Is the currency name leading or trailing?
+ */
+ isCurrencyNameLeading: boolean;
+}
+
export interface InitRequest {
skipDefaults?: boolean;
}
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts
index 3d2878d93..c7d0b0bda 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -711,7 +711,10 @@ export interface RewardCoinSource {
coinIndex: number;
}
-export type CoinSource = WithdrawCoinSource | RefreshCoinSource | RewardCoinSource;
+export type CoinSource =
+ | WithdrawCoinSource
+ | RefreshCoinSource
+ | RewardCoinSource;
/**
* CoinRecord as stored in the "coins" data store
diff --git a/packages/taler-wallet-core/src/wallet-api-types.ts b/packages/taler-wallet-core/src/wallet-api-types.ts
index eaa99a6c3..0c9755a3a 100644
--- a/packages/taler-wallet-core/src/wallet-api-types.ts
+++ b/packages/taler-wallet-core/src/wallet-api-types.ts
@@ -114,6 +114,8 @@ import {
WithdrawUriInfoResponse,
SharePaymentRequest,
SharePaymentResult,
+ GetCurrencyInfoRequest,
+ GetCurrencyInfoResponse,
} from "@gnu-taler/taler-util";
import { AuditorTrustRecord, WalletContractData } from "./db.js";
import {
@@ -210,6 +212,7 @@ export enum WalletApiOperation {
ApplyDevExperiment = "applyDevExperiment",
ValidateIban = "validateIban",
TestingWaitTransactionsFinal = "testingWaitTransactionsFinal",
+ GetCurrencyInfo = "getCurrencyInfo",
}
// group: Initialization
@@ -601,6 +604,12 @@ export type ListCurrenciesOp = {
response: WalletCurrencyInfo;
};
+export type GetCurrencyInfoOp = {
+ op: WalletApiOperation.GetCurrencyInfo;
+ request: GetCurrencyInfoRequest;
+ response: GetCurrencyInfoResponse;
+};
+
// group: Deposits
/**
@@ -1072,6 +1081,7 @@ export type WalletOperations = {
[WalletApiOperation.ApplyDevExperiment]: ApplyDevExperimentOp;
[WalletApiOperation.ValidateIban]: ValidateIbanOp;
[WalletApiOperation.TestingWaitTransactionsFinal]: TestingWaitTransactionsFinal;
+ [WalletApiOperation.GetCurrencyInfo]: GetCurrencyInfoOp;
};
export type WalletCoreRequestType<
diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts
index aab414e94..81ea26260 100644
--- a/packages/taler-wallet-core/src/wallet.ts
+++ b/packages/taler-wallet-core/src/wallet.ts
@@ -118,6 +118,7 @@ import {
sampleWalletCoreTransactions,
validateIban,
codecForSharePaymentRequest,
+ GetCurrencyInfoResponse,
} from "@gnu-taler/taler-util";
import {
HttpRequestLibrary,
@@ -1395,6 +1396,14 @@ async function dispatchRequestInternal<Op extends WalletApiOperation>(
const resp = await getBackupRecovery(ws);
return resp;
}
+ case WalletApiOperation.GetCurrencyInfo: {
+ const resp: GetCurrencyInfoResponse = {
+ decimalSeparator: ",",
+ isCurrencyNameLeading: false,
+ numFractionalDigits: 2,
+ };
+ return resp;
+ }
case WalletApiOperation.ImportBackupRecovery: {
const req = codecForAny().decode(payload);
await loadBackupRecovery(ws, req);