From e1369ff7e8fc02116b9c4261036f0e42e3423cf4 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 2 Dec 2019 00:42:40 +0100 Subject: the giant refactoring: split wallet into multiple parts --- src/headless/merchant.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src/headless/merchant.ts') diff --git a/src/headless/merchant.ts b/src/headless/merchant.ts index 423e3d09e..1b9630732 100644 --- a/src/headless/merchant.ts +++ b/src/headless/merchant.ts @@ -24,7 +24,6 @@ */ import axios from "axios"; import { CheckPaymentResponse } from "../talerTypes"; -import URI = require("urijs"); /** * Connection to the *internal* merchant backend. @@ -35,7 +34,7 @@ export class MerchantBackendConnection { reason: string, refundAmount: string, ): Promise { - const reqUrl = new URI("refund").absoluteTo(this.merchantBaseUrl).href(); + const reqUrl = new URL("refund", this.merchantBaseUrl); const refundReq = { order_id: orderId, reason, @@ -43,7 +42,7 @@ export class MerchantBackendConnection { }; const resp = await axios({ method: "post", - url: reqUrl, + url: reqUrl.href, data: refundReq, responseType: "json", headers: { @@ -64,7 +63,7 @@ export class MerchantBackendConnection { constructor(public merchantBaseUrl: string, public apiKey: string) {} async authorizeTip(amount: string, justification: string) { - const reqUrl = new URI("tip-authorize").absoluteTo(this.merchantBaseUrl).href(); + const reqUrl = new URL("tip-authorize", this.merchantBaseUrl).href; const tipReq = { amount, justification, @@ -90,7 +89,7 @@ export class MerchantBackendConnection { summary: string, fulfillmentUrl: string, ): Promise<{ orderId: string }> { - const reqUrl = new URI("order").absoluteTo(this.merchantBaseUrl).href(); + const reqUrl = new URL("order", this.merchantBaseUrl).href; const orderReq = { order: { amount, @@ -118,9 +117,7 @@ export class MerchantBackendConnection { } async checkPayment(orderId: string): Promise { - const reqUrl = new URI("check-payment") - .absoluteTo(this.merchantBaseUrl) - .href(); + const reqUrl = new URL("check-payment", this.merchantBaseUrl).href; const resp = await axios({ method: "get", url: reqUrl, -- cgit v1.2.3