summaryrefslogtreecommitdiff
path: root/src/headless/merchant.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-12-02 00:42:40 +0100
committerFlorian Dold <florian.dold@gmail.com>2019-12-02 00:42:40 +0100
commite1369ff7e8fc02116b9c4261036f0e42e3423cf4 (patch)
treec621067ebda8977a888bfed34b7bbecf64b3b0f0 /src/headless/merchant.ts
parentaaf7e1338d6cdb1b4e01ad318938b3eaea2f922b (diff)
downloadwallet-core-e1369ff7e8fc02116b9c4261036f0e42e3423cf4.tar.gz
wallet-core-e1369ff7e8fc02116b9c4261036f0e42e3423cf4.tar.bz2
wallet-core-e1369ff7e8fc02116b9c4261036f0e42e3423cf4.zip
the giant refactoring: split wallet into multiple parts
Diffstat (limited to 'src/headless/merchant.ts')
-rw-r--r--src/headless/merchant.ts13
1 files changed, 5 insertions, 8 deletions
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<void> {
- 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<CheckPaymentResponse> {
- 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,