move merchant API client to taler-util

This commit is contained in:
Florian Dold 2023-09-06 11:44:07 +02:00
parent 9a1a3b350d
commit 324d9f871c
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
35 changed files with 145 additions and 475 deletions

View File

@ -57,6 +57,8 @@ import {
WalletNotification,
codecForAny,
AccountAddDetails,
MerchantInstanceConfig,
PartialMerchantInstanceConfig,
} from "@gnu-taler/taler-util";
import {
createPlatformHttpLib,
@ -1339,23 +1341,12 @@ export interface MerchantConfig {
overrideTestDir?: string;
}
export interface PrivateOrderStatusQuery {
instance?: string;
orderId: string;
sessionId?: string;
}
export interface MerchantServiceInterface {
makeInstanceBaseUrl(instanceName?: string): string;
readonly port: number;
readonly name: string;
}
export interface DeleteTippingReserveArgs {
reservePub: string;
purge?: boolean;
}
/**
* Default HTTP client handle for the integration test harness.
*/
@ -1364,232 +1355,6 @@ export const harnessHttpLib = createPlatformHttpLib({
enableThrottling: false,
});
/**
* FIXME: Move this out of the harness.
*/
export class MerchantApiClient {
/**
* Base URL for the particular instance that this merchant API client
* is for.
*/
private baseUrl: string;
readonly auth: MerchantAuthConfiguration;
constructor(baseUrl: string, auth?: MerchantAuthConfiguration) {
this.baseUrl = baseUrl;
this.auth = auth ?? {
method: "external",
};
}
httpClient = createPlatformHttpLib({
allowHttp: true,
enableThrottling: false,
});
async changeAuth(auth: MerchantAuthConfiguration): Promise<void> {
const url = new URL("private/auth", this.baseUrl);
const res = await this.httpClient.fetch(url.href, {
method: "POST",
body: auth,
headers: this.makeAuthHeader(),
});
await expectSuccessResponseOrThrow(res);
}
async deleteTippingReserve(req: DeleteTippingReserveArgs): Promise<void> {
const url = new URL(`private/reserves/${req.reservePub}`, this.baseUrl);
if (req.purge) {
url.searchParams.set("purge", "YES");
}
const resp = await this.httpClient.fetch(url.href, {
method: "DELETE",
headers: this.makeAuthHeader(),
});
logger.info(`delete status: ${resp.status}`);
return;
}
async createTippingReserve(
req: CreateMerchantTippingReserveRequest,
): Promise<MerchantReserveCreateConfirmation> {
const url = new URL("private/reserves", this.baseUrl);
const resp = await this.httpClient.fetch(url.href, {
method: "POST",
body: req,
headers: this.makeAuthHeader(),
});
const respData = readSuccessResponseJsonOrThrow(
resp,
codecForMerchantReserveCreateConfirmation(),
);
return respData;
}
async getPrivateInstanceInfo(): Promise<any> {
const url = new URL("private", this.baseUrl);
const resp = await this.httpClient.fetch(url.href, {
method: "GET",
headers: this.makeAuthHeader(),
});
return await resp.json();
}
async getPrivateTipReserves(): Promise<TippingReserveStatus> {
const url = new URL("private/reserves", this.baseUrl);
const resp = await this.httpClient.fetch(url.href, {
method: "GET",
headers: this.makeAuthHeader(),
});
// FIXME: Validate!
return await resp.json();
}
async deleteInstance(instanceId: string) {
const url = new URL(`management/instances/${instanceId}`, this.baseUrl);
const resp = await this.httpClient.fetch(url.href, {
method: "DELETE",
headers: this.makeAuthHeader(),
});
await expectSuccessResponseOrThrow(resp);
}
async createInstance(req: MerchantInstanceConfig): Promise<void> {
const url = new URL("management/instances", this.baseUrl);
await this.httpClient.fetch(url.href, {
method: "POST",
body: req,
headers: this.makeAuthHeader(),
});
}
async getInstances(): Promise<MerchantInstancesResponse> {
const url = new URL("management/instances", this.baseUrl);
const resp = await this.httpClient.fetch(url.href, {
headers: this.makeAuthHeader(),
});
return resp.json();
}
async getInstanceFullDetails(instanceId: string): Promise<any> {
const url = new URL(`management/instances/${instanceId}`, this.baseUrl);
try {
const resp = await this.httpClient.fetch(url.href, {
headers: this.makeAuthHeader(),
});
return resp.json();
} catch (e) {
throw e;
}
}
async createOrder(
req: MerchantPostOrderRequest,
): Promise<MerchantPostOrderResponse> {
let url = new URL("private/orders", this.baseUrl);
const resp = await harnessHttpLib.fetch(url.href, {
method: "POST",
body: req,
headers: this.makeAuthHeader(),
});
return readSuccessResponseJsonOrThrow(
resp,
codecForMerchantPostOrderResponse(),
);
}
async queryPrivateOrderStatus(
query: PrivateOrderStatusQuery,
): Promise<MerchantOrderPrivateStatusResponse> {
const reqUrl = new URL(`private/orders/${query.orderId}`, this.baseUrl);
if (query.sessionId) {
reqUrl.searchParams.set("session_id", query.sessionId);
}
const resp = await harnessHttpLib.fetch(reqUrl.href, {
headers: this.makeAuthHeader(),
});
return readSuccessResponseJsonOrThrow(
resp,
codecForMerchantOrderPrivateStatusResponse(),
);
}
async giveTip(req: RewardCreateRequest): Promise<RewardCreateConfirmation> {
const reqUrl = new URL(`private/tips`, this.baseUrl);
const resp = await harnessHttpLib.fetch(reqUrl.href, {
method: "POST",
body: req,
});
// FIXME: validate
return resp.json();
}
async queryTippingReserves(): Promise<TippingReserveStatus> {
const reqUrl = new URL(`private/reserves`, this.baseUrl);
const resp = await harnessHttpLib.fetch(reqUrl.href, {
headers: this.makeAuthHeader(),
});
// FIXME: validate
return resp.json();
}
async giveRefund(r: {
instance: string;
orderId: string;
amount: string;
justification: string;
}): Promise<{ talerRefundUri: string }> {
const reqUrl = new URL(`private/orders/${r.orderId}/refund`, this.baseUrl);
const resp = await harnessHttpLib.fetch(reqUrl.href, {
method: "POST",
body: {
refund: r.amount,
reason: r.justification,
},
});
const respBody = await resp.json();
return {
talerRefundUri: respBody.taler_refund_uri,
};
}
async createTemplate(req: MerchantTemplateAddDetails) {
let url = new URL("private/templates", this.baseUrl);
const resp = await harnessHttpLib.fetch(url.href, {
method: "POST",
body: req,
headers: this.makeAuthHeader(),
});
if (resp.status !== 204) {
throw Error("failed to create template");
}
}
private makeAuthHeader(): Record<string, string> {
switch (this.auth.method) {
case "external":
return {};
case "token":
return {
Authorization: `Bearer ${this.auth.token}`,
};
}
}
}
export interface CreateMerchantTippingReserveRequest {
// Amount that the merchant promises to put into the reserve
initial_balance: AmountString;
// Exchange the merchant intends to use for tipping
exchange_url: string;
// Desired wire method, for example "iban" or "x-taler-bank"
wire_method: string;
}
export class MerchantService implements MerchantServiceInterface {
static fromExistingConfig(
gc: GlobalTestState,
@ -1814,66 +1579,6 @@ export class MerchantService implements MerchantServiceInterface {
}
}
export interface MerchantAuthConfiguration {
method: "external" | "token";
token?: string;
}
// FIXME: Why do we need this? Describe / fix!
export interface PartialMerchantInstanceConfig {
auth?: MerchantAuthConfiguration;
id: string;
name: string;
paytoUris: string[];
address?: unknown;
jurisdiction?: unknown;
defaultWireTransferDelay?: TalerProtocolDuration;
defaultPayDelay?: TalerProtocolDuration;
}
// FIXME: Move all these types into merchant-api-types.ts!
type FacadeCredentials = NoFacadeCredentials | BasicAuthFacadeCredentials;
interface NoFacadeCredentials {
type: "none";
}
interface BasicAuthFacadeCredentials {
type: "basic";
// Username to use to authenticate
username: string;
// Password to use to authenticate
password: string;
}
interface MerchantBankAccount {
// The payto:// URI where the wallet will send coins.
payto_uri: string;
// Optional base URL for a facade where the
// merchant backend can see incoming wire
// transfers to reconcile its accounting
// with that of the exchange. Used by
// taler-merchant-wirewatch.
credit_facade_url?: string;
// Credentials for accessing the credit facade.
credit_facade_credentials?: FacadeCredentials;
}
export interface MerchantInstanceConfig {
accounts: MerchantBankAccount[];
auth: MerchantAuthConfiguration;
id: string;
name: string;
address: unknown;
jurisdiction: unknown;
use_stefan: boolean;
default_wire_transfer_delay: TalerProtocolDuration;
default_pay_delay: TalerProtocolDuration;
}
type TestStatus = "pass" | "fail" | "skip";
export interface TestRunResult {

View File

@ -33,6 +33,7 @@ import {
WalletNotification,
TransactionMajorState,
Logger,
MerchantApiClient,
} from "@gnu-taler/taler-util";
import {
BankAccessApi,
@ -53,7 +54,6 @@ import {
FakebankService,
getPayto,
GlobalTestState,
MerchantApiClient,
MerchantService,
MerchantServiceInterface,
setupDb,

View File

@ -24,6 +24,7 @@ import {
decodeCrock,
j2s,
Logger,
MerchantApiClient,
rsaBlind,
setGlobalLogLevelFromString,
} from "@gnu-taler/taler-util";
@ -45,11 +46,7 @@ import { runBench2 } from "./bench2.js";
import { runBench3 } from "./bench3.js";
import { runEnvFull } from "./env-full.js";
import { runEnv1 } from "./env1.js";
import {
GlobalTestState,
MerchantApiClient,
runTestWithState,
} from "./harness/harness.js";
import { GlobalTestState, runTestWithState } from "./harness/harness.js";
import { getTestInfo, runTests } from "./integrationtests/testrunner.js";
import { lintExchangeDeployment } from "./lint.js";

View File

@ -1,6 +1,6 @@
/*
This file is part of GNU Taler
(C) 2022 Taler Systems S.A.
(C) 2022-2023 Taler Systems S.A.
GNU Taler is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
@ -23,17 +23,14 @@ import {
WireGatewayApiClient,
} from "@gnu-taler/taler-wallet-core";
import { defaultCoinConfig } from "../harness/denomStructures.js";
import {
getWireMethodForTest,
GlobalTestState,
MerchantApiClient,
} from "../harness/harness.js";
import { getWireMethodForTest, GlobalTestState } from "../harness/harness.js";
import {
createSimpleTestkudosEnvironmentV2,
createWalletDaemonWithClient,
makeTestPaymentV2,
withdrawViaBankV2,
} from "../harness/helpers.js";
import { MerchantApiClient } from "@gnu-taler/taler-util";
/**
* Run test for basic, bank-integrated withdrawal and payment.
@ -57,9 +54,6 @@ export async function runAgeRestrictionsMerchantTest(t: GlobalTestState) {
const merchantClient = new MerchantApiClient(
merchant.makeInstanceBaseUrl("default"),
{
method: "external",
},
);
const { walletClient: walletClientTwo } = await createWalletDaemonWithClient(

View File

@ -19,14 +19,12 @@
*/
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { URL } from "url";
import {
GlobalTestState,
MerchantApiClient,
} from "../harness/harness.js";
import { GlobalTestState } from "../harness/harness.js";
import {
createSimpleTestkudosEnvironmentV2,
withdrawViaBankV2,
} from "../harness/helpers.js";
import { MerchantApiClient } from "@gnu-taler/taler-util";
/**
* Run test for the merchant's order lifecycle.

View File

@ -17,12 +17,13 @@
/**
* Imports.
*/
import { PreparePayResultType, TalerErrorCode } from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import {
GlobalTestState,
MerchantApiClient,
} from "../harness/harness.js";
PreparePayResultType,
TalerErrorCode,
} from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { GlobalTestState } from "../harness/harness.js";
import {
createSimpleTestkudosEnvironmentV2,
withdrawViaBankV2,

View File

@ -26,11 +26,13 @@ import {
TransactionMinorState,
TransactionType,
} from "@gnu-taler/taler-util";
import { createPlatformHttpLib } from "@gnu-taler/taler-util/http";
import {
BankAccessApi,
BankApi,
WalletApiOperation,
} from "@gnu-taler/taler-wallet-core";
import * as http from "node:http";
import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures.js";
import {
BankService,
@ -43,8 +45,6 @@ import {
WalletService,
} from "../harness/harness.js";
import { EnvOptions, SimpleTestEnvironmentNg } from "../harness/helpers.js";
import * as http from "node:http";
import { createPlatformHttpLib } from "@gnu-taler/taler-util/http";
const logger = new Logger("test-kyc.ts");

View File

@ -20,6 +20,7 @@
import {
codecForMerchantOrderStatusUnpaid,
ConfirmPayResultType,
MerchantApiClient,
PreparePayResultType,
} from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
@ -35,7 +36,6 @@ import {
getPayto,
GlobalTestState,
harnessHttpLib,
MerchantApiClient,
MerchantService,
setupDb,
} from "../harness/harness.js";

View File

@ -17,17 +17,15 @@
/**
* Imports.
*/
import { TalerError, URL } from "@gnu-taler/taler-util";
import { MerchantApiClient, TalerError, URL } from "@gnu-taler/taler-util";
import {
ExchangeService,
GlobalTestState,
MerchantApiClient,
MerchantService,
setupDb,
getPayto,
harnessHttpLib,
setupDb,
} from "../harness/harness.js";
import { createPlatformHttpLib } from "@gnu-taler/taler-util/http";
/**
* Test instance deletion and authentication for it
@ -69,7 +67,9 @@ export async function runMerchantInstancesDeleteTest(t: GlobalTestState) {
// Instances should initially be empty
{
const r = await harnessHttpLib.fetch(new URL("management/instances", baseUrl).href);
const r = await harnessHttpLib.fetch(
new URL("management/instances", baseUrl).href,
);
const data = await r.json();
t.assertDeepEqual(data.instances, []);
}

View File

@ -17,17 +17,15 @@
/**
* Imports.
*/
import { Duration } from "@gnu-taler/taler-util";
import { Duration, MerchantApiClient } from "@gnu-taler/taler-util";
import {
ExchangeService,
GlobalTestState,
MerchantApiClient,
MerchantService,
setupDb,
getPayto,
harnessHttpLib,
setupDb,
} from "../harness/harness.js";
import { createPlatformHttpLib } from "@gnu-taler/taler-util/http";
/**
* Do basic checks on instance management and authentication.

View File

@ -17,17 +17,15 @@
/**
* Imports.
*/
import { URL } from "@gnu-taler/taler-util";
import { MerchantApiClient, URL } from "@gnu-taler/taler-util";
import {
ExchangeService,
GlobalTestState,
MerchantApiClient,
MerchantService,
setupDb,
getPayto,
harnessHttpLib,
} from "../harness/harness.js";
import { createPlatformHttpLib } from "@gnu-taler/taler-util/http";
/**
* Do basic checks on instance management and authentication.

View File

@ -19,16 +19,13 @@
*/
import {
ConfirmPayResultType,
MerchantApiClient,
PreparePayResultType,
URL,
codecForMerchantOrderStatusUnpaid,
} from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import {
GlobalTestState,
MerchantApiClient,
harnessHttpLib,
} from "../harness/harness.js";
import { GlobalTestState, harnessHttpLib } from "../harness/harness.js";
import {
createSimpleTestkudosEnvironmentV2,
withdrawViaBankV2,

View File

@ -18,27 +18,27 @@
* Imports.
*/
import {
Duration,
MerchantApiClient,
PreparePayResultType,
URL,
durationFromSpec,
} from "@gnu-taler/taler-util";
import {
BankServiceHandle,
WalletApiOperation,
} from "@gnu-taler/taler-wallet-core";
import {
ExchangeServiceInterface,
GlobalTestState,
MerchantServiceInterface,
ExchangeServiceInterface,
harnessHttpLib,
WalletClient,
MerchantApiClient,
harnessHttpLib,
} from "../harness/harness.js";
import {
createSimpleTestkudosEnvironmentV2,
withdrawViaBankV2,
} from "../harness/helpers.js";
import {
URL,
durationFromSpec,
PreparePayResultType,
Duration,
} from "@gnu-taler/taler-util";
import {
WalletApiOperation,
BankServiceHandle,
} from "@gnu-taler/taler-wallet-core";
async function testRefundApiWithFulfillmentUrl(
t: GlobalTestState,

View File

@ -19,6 +19,7 @@
*/
import {
ConfirmPayResultType,
MerchantApiClient,
PreparePayResultType,
URL,
encodeCrock,
@ -29,7 +30,6 @@ import {
BankService,
ExchangeService,
GlobalTestState,
MerchantApiClient,
MerchantService,
harnessHttpLib,
} from "../harness/harness.js";

View File

@ -18,22 +18,19 @@
* Imports.
*/
import {
GlobalTestState,
ConfirmPayResultType,
MerchantApiClient,
harnessHttpLib,
} from "../harness/harness.js";
PreparePayResultType,
URL,
codecForMerchantOrderStatusUnpaid,
} from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { FaultInjectionRequestContext } from "../harness/faultInjection.js";
import { GlobalTestState, harnessHttpLib } from "../harness/harness.js";
import {
createFaultInjectedMerchantTestkudosEnvironment,
withdrawViaBankV2,
} from "../harness/helpers.js";
import {
PreparePayResultType,
codecForMerchantOrderStatusUnpaid,
ConfirmPayResultType,
URL,
} from "@gnu-taler/taler-util";
import { FaultInjectionRequestContext } from "../harness/faultInjection.js";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
/**
* Run test for the wallets repurchase detection mechanism

View File

@ -18,25 +18,22 @@
* Imports.
*/
import {
GlobalTestState,
MerchantApiClient,
harnessHttpLib,
} from "../harness/harness.js";
import {
createFaultInjectedMerchantTestkudosEnvironment,
withdrawViaBankV2,
} from "../harness/helpers.js";
import { FaultInjectionRequestContext } from "../harness/faultInjection.js";
import {
codecForMerchantOrderStatusUnpaid,
ConfirmPayResultType,
j2s,
MerchantApiClient,
PreparePayResultType,
TalerErrorCode,
TalerErrorDetail,
URL,
codecForMerchantOrderStatusUnpaid,
j2s,
} from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { FaultInjectionRequestContext } from "../harness/faultInjection.js";
import { GlobalTestState, harnessHttpLib } from "../harness/harness.js";
import {
createFaultInjectedMerchantTestkudosEnvironment,
withdrawViaBankV2,
} from "../harness/helpers.js";
export async function runPaymentAbortTest(t: GlobalTestState) {
// Set up test environment

View File

@ -17,9 +17,13 @@
/**
* Imports.
*/
import { PreparePayResultType, TalerErrorCode } from "@gnu-taler/taler-util";
import {
MerchantApiClient,
PreparePayResultType,
TalerErrorCode,
} from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { GlobalTestState, MerchantApiClient, WalletCli } from "../harness/harness.js";
import { GlobalTestState, WalletCli } from "../harness/harness.js";
import {
createSimpleTestkudosEnvironmentV2,
withdrawViaBankV2,

View File

@ -17,21 +17,22 @@
/**
* Imports.
*/
import {
AbsoluteTime,
ConfirmPayResultType,
Duration,
MerchantApiClient,
MerchantContractTerms,
PreparePayResultType,
j2s,
} from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { GlobalTestState, MerchantApiClient } from "../harness/harness.js";
import { GlobalTestState } from "../harness/harness.js";
import {
applyTimeTravelV2,
createSimpleTestkudosEnvironmentV2,
withdrawViaBankV2,
} from "../harness/helpers.js";
import {
AbsoluteTime,
ConfirmPayResultType,
Duration,
MerchantContractTerms,
PreparePayResultType,
j2s,
} from "@gnu-taler/taler-util";
/**
* Run a test for the following scenario:

View File

@ -21,28 +21,27 @@
/**
* Imports.
*/
import { CoreApiResponse, MerchantApiClient } from "@gnu-taler/taler-util";
import {
GlobalTestState,
MerchantService,
ExchangeService,
setupDb,
BankService,
WalletCli,
getPayto,
MerchantApiClient,
} from "../harness/harness.js";
BankAccessApi,
BankApi,
WalletApiOperation,
} from "@gnu-taler/taler-wallet-core";
import { defaultCoinConfig } from "../harness/denomStructures.js";
import {
FaultInjectedExchangeService,
FaultInjectionRequestContext,
FaultInjectionResponseContext,
} from "../harness/faultInjection.js";
import { CoreApiResponse } from "@gnu-taler/taler-util";
import { defaultCoinConfig } from "../harness/denomStructures.js";
import {
WalletApiOperation,
BankApi,
BankAccessApi,
} from "@gnu-taler/taler-wallet-core";
BankService,
ExchangeService,
GlobalTestState,
MerchantService,
WalletCli,
getPayto,
setupDb,
} from "../harness/harness.js";
/**
* Run test for basic, bank-integrated withdrawal.

View File

@ -17,9 +17,9 @@
/**
* Imports.
*/
import { PreparePayResultType } from "@gnu-taler/taler-util";
import { MerchantApiClient, PreparePayResultType } from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { GlobalTestState, MerchantApiClient } from "../harness/harness.js";
import { GlobalTestState } from "../harness/harness.js";
import {
createSimpleTestkudosEnvironmentV2,
withdrawViaBankV2,

View File

@ -17,17 +17,17 @@
/**
* Imports.
*/
import { MerchantApiClient } from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { coin_ct10, coin_u1 } from "../harness/denomStructures.js";
import {
GlobalTestState,
setupDb,
BankService,
ExchangeService,
GlobalTestState,
MerchantService,
getPayto,
MerchantApiClient,
setupDb,
} from "../harness/harness.js";
import { coin_ct10, coin_u1 } from "../harness/denomStructures.js";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import {
createWalletDaemonWithClient,
withdrawViaBankV2,

View File

@ -19,10 +19,11 @@
*/
import {
ConfirmPayResultType,
MerchantApiClient,
PreparePayResultType,
} from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { GlobalTestState, MerchantApiClient } from "../harness/harness.js";
import { GlobalTestState } from "../harness/harness.js";
import {
createSimpleTestkudosEnvironmentV2,
createWalletDaemonWithClient,

View File

@ -20,10 +20,11 @@
import {
ConfirmPayResultType,
Duration,
MerchantApiClient,
PreparePayResultType,
} from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { GlobalTestState, MerchantApiClient } from "../harness/harness.js";
import { GlobalTestState } from "../harness/harness.js";
import {
createSimpleTestkudosEnvironmentV2,
withdrawViaBankV2,

View File

@ -19,6 +19,7 @@
*/
import {
ConfirmPayResultType,
MerchantApiClient,
PreparePayResultType,
TalerErrorCode,
TalerErrorDetail,
@ -27,11 +28,7 @@ import {
} from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { FaultInjectionResponseContext } from "../harness/faultInjection.js";
import {
GlobalTestState,
MerchantApiClient,
harnessHttpLib,
} from "../harness/harness.js";
import { GlobalTestState, harnessHttpLib } from "../harness/harness.js";
import {
createFaultInjectedMerchantTestkudosEnvironment,
withdrawViaBankV2,

View File

@ -18,17 +18,14 @@
* Imports.
*/
import {
GlobalTestState,
MerchantApiClient,
harnessHttpLib,
} from "../harness/harness.js";
import {
PreparePayResultType,
codecForMerchantOrderStatusUnpaid,
ConfirmPayResultType,
MerchantApiClient,
PreparePayResultType,
URL,
codecForMerchantOrderStatusUnpaid,
} from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { GlobalTestState, harnessHttpLib } from "../harness/harness.js";
import {
createSimpleTestkudosEnvironmentV2,
withdrawViaBankV2,

View File

@ -17,9 +17,13 @@
/**
* Imports.
*/
import { Duration, durationFromSpec } from "@gnu-taler/taler-util";
import {
Duration,
MerchantApiClient,
durationFromSpec,
} from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { GlobalTestState, MerchantApiClient } from "../harness/harness.js";
import { GlobalTestState } from "../harness/harness.js";
import {
createSimpleTestkudosEnvironmentV2,
withdrawViaBankV2,

View File

@ -17,18 +17,19 @@
/**
* Imports.
*/
import { GlobalTestState, MerchantApiClient } from "../harness/harness.js";
import {
AbsoluteTime,
Duration,
MerchantApiClient,
durationFromSpec,
} from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { GlobalTestState } from "../harness/harness.js";
import {
applyTimeTravelV2,
createSimpleTestkudosEnvironmentV2,
withdrawViaBankV2,
} from "../harness/helpers.js";
import {
AbsoluteTime,
Duration,
durationFromSpec,
} from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
/**
* Run test for basic, bank-integrated withdrawal.

View File

@ -20,15 +20,12 @@
import {
Amounts,
Duration,
MerchantApiClient,
TransactionType,
durationFromSpec,
} from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import {
GlobalTestState,
MerchantApiClient,
delayMs,
} from "../harness/harness.js";
import { GlobalTestState, delayMs } from "../harness/harness.js";
import {
createSimpleTestkudosEnvironmentV2,
withdrawViaBankV2,

View File

@ -20,11 +20,12 @@
import {
Duration,
durationFromSpec,
MerchantApiClient,
NotificationType,
TransactionMajorState,
} from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { GlobalTestState, MerchantApiClient } from "../harness/harness.js";
import { GlobalTestState } from "../harness/harness.js";
import {
createSimpleTestkudosEnvironmentV2,
withdrawViaBankV2,

View File

@ -21,6 +21,7 @@ import {
ConfirmPayResultType,
Duration,
durationFromSpec,
MerchantApiClient,
PreparePayResultType,
} from "@gnu-taler/taler-util";
import {
@ -31,11 +32,10 @@ import { makeNoFeeCoinConfig } from "../harness/denomStructures.js";
import {
BankService,
ExchangeService,
getPayto,
GlobalTestState,
MerchantService,
setupDb,
getPayto,
MerchantApiClient,
} from "../harness/harness.js";
import {
applyTimeTravelV2,

View File

@ -17,18 +17,17 @@
/**
* Imports.
*/
import {
MerchantApiClient,
TransactionMajorState,
} from "@gnu-taler/taler-util";
import {
BankAccessApiClient,
WalletApiOperation,
WireGatewayApiClient,
} from "@gnu-taler/taler-wallet-core";
import {
GlobalTestState,
MerchantApiClient,
getWireMethodForTest,
} from "../harness/harness.js";
import { GlobalTestState, getWireMethodForTest } from "../harness/harness.js";
import { createSimpleTestkudosEnvironmentV2 } from "../harness/helpers.js";
import { TransactionMajorState } from "@gnu-taler/taler-util";
/**
* Run test for basic, bank-integrated withdrawal.

View File

@ -17,9 +17,9 @@
/**
* Imports.
*/
import { PreparePayResultType } from "@gnu-taler/taler-util";
import { MerchantApiClient, PreparePayResultType } from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { GlobalTestState, MerchantApiClient } from "../harness/harness.js";
import { GlobalTestState } from "../harness/harness.js";
import {
createSimpleTestkudosEnvironmentV2,
createWalletDaemonWithClient,
@ -126,11 +126,9 @@ export async function runWalletBackupDoublespendTest(t: GlobalTestState) {
},
});
let orderStatus = await merchantClient.queryPrivateOrderStatus(
{
orderId: orderResp.order_id,
},
);
let orderStatus = await merchantClient.queryPrivateOrderStatus({
orderId: orderResp.order_id,
});
t.assertTrue(orderStatus.order_status === "unpaid");

View File

@ -17,9 +17,13 @@
/**
* Imports.
*/
import { Amounts, PreparePayResultType } from "@gnu-taler/taler-util";
import {
Amounts,
MerchantApiClient,
PreparePayResultType,
} from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { GlobalTestState, MerchantApiClient } from "../harness/harness.js";
import { GlobalTestState } from "../harness/harness.js";
import {
createSimpleTestkudosEnvironmentV2,
withdrawViaBankV2,

View File

@ -39,3 +39,5 @@ export * from "./merchant-api-types.js";
export * from "./errors.js";
export * from "./iban.js";
export * from "./transaction-test-data.js";
export * from "./libeufin-api-types.js";
export * from "./MerchantApiClient.js";

View File

@ -47,7 +47,7 @@ import {
WireAccount,
codecForWireAccount,
codecForList,
HashCodeString,
FacadeCredentials,
} from "@gnu-taler/taler-util";
export interface MerchantPostOrderRequest {
@ -401,21 +401,3 @@ export interface AccountAddDetails {
// To really delete credentials, set them to the type: "none".
credit_facade_credentials?: FacadeCredentials;
}
export type FacadeCredentials =
| NoFacadeCredentials
| BasicAuthFacadeCredentials;
export interface NoFacadeCredentials {
type: "none";
}
export interface BasicAuthFacadeCredentials {
type: "basic";
// Username to use to authenticate
username: string;
// Password to use to authenticate
password: string;
}