gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] branch master updated: remove rewards from tests


From: gnunet
Subject: [taler-wallet-core] branch master updated: remove rewards from tests
Date: Tue, 13 Feb 2024 12:08:35 +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 c23ad08e4 remove rewards from tests
c23ad08e4 is described below

commit c23ad08e4481de611be3f51a392118f97f6da70e
Author: Florian Dold <florian@dold.me>
AuthorDate: Tue Feb 13 12:08:35 2024 +0100

    remove rewards from tests
---
 packages/taler-harness/src/index.ts                | 119 ---------------------
 .../test-age-restrictions-merchant.ts              |  49 +--------
 .../src/integrationtests/test-denom-unoffered.ts   |   1 +
 packages/taler-util/src/MerchantApiClient.ts       |  63 -----------
 packages/taler-util/src/merchant-api-types.ts      |  32 ------
 5 files changed, 3 insertions(+), 261 deletions(-)

diff --git a/packages/taler-harness/src/index.ts 
b/packages/taler-harness/src/index.ts
index 530f25a7c..0fdf3a15b 100644
--- a/packages/taler-harness/src/index.ts
+++ b/packages/taler-harness/src/index.ts
@@ -380,104 +380,6 @@ const deploymentCli = 
testingCli.subcommand("deploymentArgs", "deployment", {
   help: "Subcommands for handling GNU Taler deployments.",
 });
 
-deploymentCli
-  .subcommand("tipTopup", "tip-topup")
-  .requiredOption("merchantBaseUrl", ["--merchant-url"], clk.STRING)
-  .requiredOption("exchangeBaseUrl", ["--exchange-url"], clk.STRING)
-  .requiredOption("merchantApikey", ["--merchant-apikey"], clk.STRING)
-  .requiredOption("bankAccessUrl", ["--bank-access-url"], clk.STRING)
-  .requiredOption("bankAccount", ["--bank-account"], clk.STRING)
-  .requiredOption("bankPassword", ["--bank-password"], clk.STRING)
-  .requiredOption("wireMethod", ["--wire-method"], clk.STRING)
-  .requiredOption("amount", ["--amount"], clk.AMOUNT)
-  .action(async (args) => {
-    const amount = args.tipTopup.amount;
-
-    const merchantClient = new MerchantApiClient(
-      args.tipTopup.merchantBaseUrl,
-      {
-        auth: {
-          method: "token",
-          token: args.tipTopup.merchantApikey,
-        },
-      },
-    );
-
-    const res = await merchantClient.getPrivateInstanceInfo();
-    console.log(res);
-
-    const tipReserveResp = await merchantClient.createTippingReserve({
-      exchange_url: args.tipTopup.exchangeBaseUrl,
-      initial_balance: amount,
-      wire_method: args.tipTopup.wireMethod,
-    });
-
-    console.log(tipReserveResp);
-
-    const bankAccessApiClient = new TalerCorebankApiClient(
-      args.tipTopup.bankAccessUrl,
-      {
-        auth: {
-          username: args.tipTopup.bankAccount,
-          password: args.tipTopup.bankPassword,
-        },
-      },
-    );
-
-    const paytoUri = addPaytoQueryParams(tipReserveResp.accounts[0].payto_uri, 
{
-      message: `tip-reserve ${tipReserveResp.reserve_pub}`,
-    });
-    console.log("payto URI:", paytoUri);
-
-    const transactions = await bankAccessApiClient.getTransactions(
-      args.tipTopup.bankAccount,
-    );
-    console.log("transactions:", j2s(transactions));
-
-    await bankAccessApiClient.createTransaction(args.tipTopup.bankAccount, {
-      amount,
-      paytoUri,
-    });
-  });
-
-deploymentCli
-  .subcommand("tipCleanup", "tip-cleanup")
-  .requiredOption("merchantBaseUrl", ["--merchant-url"], clk.STRING)
-  .requiredOption("merchantApikey", ["--merchant-apikey"], clk.STRING)
-  .flag("dryRun", ["--dry-run"])
-  .action(async (args) => {
-    const merchantClient = new MerchantApiClient(
-      args.tipCleanup.merchantBaseUrl,
-      {
-        auth: {
-          method: "token",
-          token: args.tipCleanup.merchantApikey,
-        },
-      },
-    );
-
-    const res = await merchantClient.getPrivateInstanceInfo();
-    console.log(res);
-
-    const tipRes = await merchantClient.getPrivateTipReserves();
-    console.log(tipRes);
-
-    for (const reserve of tipRes.reserves) {
-      if (Amounts.isZero(reserve.exchange_initial_amount)) {
-        if (args.tipCleanup.dryRun) {
-          logger.info(`dry run, would purge reserve ${reserve}`);
-        } else {
-          await merchantClient.deleteTippingReserve({
-            reservePub: reserve.reserve_pub,
-            purge: true,
-          });
-        }
-      }
-    }
-
-    // FIXME: Now delete reserves that are not filled yet
-  });
-
 deploymentCli
   .subcommand("testTalerdotnetDemo", "test-demodottalerdotnet")
   .action(async (args) => {
@@ -563,27 +465,6 @@ deploymentCli
     console.log("reserve status", reserveStatusResp.status);
   });
 
-deploymentCli
-  .subcommand("tipStatus", "tip-status")
-  .requiredOption("merchantBaseUrl", ["--merchant-url"], clk.STRING)
-  .requiredOption("merchantApikey", ["--merchant-apikey"], clk.STRING)
-  .action(async (args) => {
-    const merchantClient = new MerchantApiClient(
-      args.tipStatus.merchantBaseUrl,
-      {
-        auth: {
-          method: "token",
-          token: args.tipStatus.merchantApikey,
-        },
-      },
-    );
-
-    const res = await merchantClient.getPrivateInstanceInfo();
-
-    const tipRes = await merchantClient.getPrivateTipReserves();
-    console.log(j2s(tipRes));
-  });
-
 deploymentCli
   .subcommand("lintExchange", "lint-exchange", {
     help: "Run checks on the exchange deployment.",
diff --git 
a/packages/taler-harness/src/integrationtests/test-age-restrictions-merchant.ts 
b/packages/taler-harness/src/integrationtests/test-age-restrictions-merchant.ts
index 8ca00359c..cdb100c65 100644
--- 
a/packages/taler-harness/src/integrationtests/test-age-restrictions-merchant.ts
+++ 
b/packages/taler-harness/src/integrationtests/test-age-restrictions-merchant.ts
@@ -17,21 +17,16 @@
 /**
  * Imports.
  */
+import { AmountString, MerchantApiClient } from "@gnu-taler/taler-util";
 import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
 import { defaultCoinConfig } from "../harness/denomStructures.js";
-import { getWireMethodForTest, GlobalTestState } from "../harness/harness.js";
+import { GlobalTestState } from "../harness/harness.js";
 import {
   createSimpleTestkudosEnvironmentV2,
   createWalletDaemonWithClient,
   makeTestPaymentV2,
   withdrawViaBankV2,
 } from "../harness/helpers.js";
-import {
-  TalerCorebankApiClient,
-  MerchantApiClient,
-  WireGatewayApiClient,
-  AmountString,
-} from "@gnu-taler/taler-util";
 
 /**
  * Run test for basic, bank-integrated withdrawal and payment.
@@ -177,46 +172,6 @@ export async function runAgeRestrictionsMerchantTest(t: 
GlobalTestState) {
       {},
     );
   }
-
-  // Pay with coin from tipping
-  {
-    const bankClient = new TalerCorebankApiClient(bank.corebankApiBaseUrl);
-    const mbu = await bankClient.createRandomBankUser();
-    const tipReserveResp = await merchantClient.createTippingReserve({
-      exchange_url: exchange.baseUrl,
-      initial_balance: "TESTKUDOS:10" as AmountString,
-      wire_method: getWireMethodForTest(),
-    });
-
-    t.assertDeepEqual(
-      tipReserveResp.accounts[0].payto_uri,
-      exchangeBankAccount.accountPaytoUri,
-    );
-
-    const wireGatewayApiClient = new WireGatewayApiClient(
-      exchangeBankAccount.wireGatewayApiBaseUrl,
-      {
-        auth: {
-          username: exchangeBankAccount.accountName,
-          password: exchangeBankAccount.accountPassword,
-        },
-      },
-    );
-
-    await wireGatewayApiClient.adminAddIncoming({
-      amount: "TESTKUDOS:10",
-      debitAccountPayto: mbu.accountPaytoUri,
-      reservePub: tipReserveResp.reserve_pub,
-    });
-
-    await exchange.runWirewatchOnce();
-
-    const tip = await merchantClient.giveTip({
-      amount: "TESTKUDOS:5" as AmountString,
-      justification: "why not?",
-      next_url: "https://example.com/after-tip";,
-    });
-  }
 }
 
 runAgeRestrictionsMerchantTest.suites = ["wallet"];
diff --git 
a/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts 
b/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts
index 1a62a6065..79269d533 100644
--- a/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts
+++ b/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts
@@ -130,6 +130,7 @@ export async function runDenomUnofferedTest(t: 
GlobalTestState) {
   // Force updating the exchange entry so that the wallet knows about the new 
denominations.
   await walletClient.call(WalletApiOperation.UpdateExchangeEntry, {
     exchangeBaseUrl: exchange.baseUrl,
+    force: true,
   });
 
   await walletClient.call(WalletApiOperation.DeleteTransaction, {
diff --git a/packages/taler-util/src/MerchantApiClient.ts 
b/packages/taler-util/src/MerchantApiClient.ts
index db1ffef4e..8afacfa46 100644
--- a/packages/taler-util/src/MerchantApiClient.ts
+++ b/packages/taler-util/src/MerchantApiClient.ts
@@ -33,14 +33,9 @@ import {
   MerchantOrderPrivateStatusResponse,
   MerchantPostOrderRequest,
   MerchantPostOrderResponse,
-  MerchantReserveCreateConfirmation,
   MerchantTemplateAddDetails,
-  RewardCreateConfirmation,
-  RewardCreateRequest,
-  TippingReserveStatus,
   codecForMerchantOrderPrivateStatusResponse,
   codecForMerchantPostOrderResponse,
-  codecForMerchantReserveCreateConfirmation,
 } from "./merchant-api-types.js";
 import {
   FailCasesByMethod,
@@ -184,35 +179,6 @@ export class MerchantApiClient {
     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, {
@@ -222,16 +188,6 @@ export class MerchantApiClient {
     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, {
@@ -316,25 +272,6 @@ export class MerchantApiClient {
     );
   }
 
-  async giveTip(req: RewardCreateRequest): Promise<RewardCreateConfirmation> {
-    const reqUrl = new URL(`private/rewards`, this.baseUrl);
-    const resp = await this.httpClient.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 this.httpClient.fetch(reqUrl.href, {
-      headers: this.makeAuthHeader(),
-    });
-    // FIXME: validate
-    return resp.json();
-  }
-
   async giveRefund(r: {
     instance: string;
     orderId: string;
diff --git a/packages/taler-util/src/merchant-api-types.ts 
b/packages/taler-util/src/merchant-api-types.ts
index 724e99b55..838bfa99d 100644
--- a/packages/taler-util/src/merchant-api-types.ts
+++ b/packages/taler-util/src/merchant-api-types.ts
@@ -259,11 +259,6 @@ export interface TransactionWireReport {
   coin_pub: CoinPublicKeyString;
 }
 
-export interface TippingReserveStatus {
-  // Array of all known reserves (possibly empty!)
-  reserves: ReserveStatusEntry[];
-}
-
 export interface ReserveStatusEntry {
   // Public key of the reserve
   reserve_pub: string;
@@ -291,33 +286,6 @@ export interface ReserveStatusEntry {
   active: boolean;
 }
 
-export interface RewardCreateConfirmation {
-  // Unique tip identifier for the tip that was created.
-  reward_id: string;
-
-  // taler://tip URI for the tip
-  taler_reward_uri: string;
-
-  // URL that will directly trigger processing
-  // the tip when the browser is redirected to it
-  reward_status_url: string;
-
-  // when does the reward expire
-  reward_expiration: AbsoluteTime;
-}
-
-export interface RewardCreateRequest {
-  // Amount that the customer should be tipped
-  amount: AmountString;
-
-  // Justification for giving the tip
-  justification: string;
-
-  // URL that the user should be directed to after tipping,
-  // will be included in the tip_token.
-  next_url: string;
-}
-
 export interface MerchantInstancesResponse {
   // List of instances that are present in the backend (see Instance)
   instances: MerchantInstanceDetail[];

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]