aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMS <ms@taler.net>2020-09-25 16:50:26 +0200
committerMS <ms@taler.net>2020-09-25 16:50:26 +0200
commit2c0464b49479d62b58968a5e28c890555456807b (patch)
tree21f039730d6b4861ea9126ff028c483876b3beb2
parentae898c63fabcfc9229dedf96cd2603e366b7e3fa (diff)
Finalizing loop's cause reproduction.
-rw-r--r--packages/taler-integrationtests/src/merchantApiTypes.ts5
-rw-r--r--packages/taler-integrationtests/src/test-claim-loop.ts38
2 files changed, 23 insertions, 20 deletions
diff --git a/packages/taler-integrationtests/src/merchantApiTypes.ts b/packages/taler-integrationtests/src/merchantApiTypes.ts
index e89e32642..1806ab706 100644
--- a/packages/taler-integrationtests/src/merchantApiTypes.ts
+++ b/packages/taler-integrationtests/src/merchantApiTypes.ts
@@ -82,6 +82,7 @@ export const codecForCheckPaymentPaidResponse = (): Codec<
CheckPaymentPaidResponse
> =>
buildCodecForObject<CheckPaymentPaidResponse>()
+ .property("order_status_url", codecForConstString("paid"))
.property("order_status", codecForConstString("paid"))
.property("refunded", codecForBoolean())
.property("wired", codecForBoolean())
@@ -159,6 +160,8 @@ export interface CheckPaymentPaidResponse {
// The refund details for this order. One entry per
// refunded coin; empty array if there are no refunds.
refund_details: RefundDetails[];
+
+ order_status_url: string;
}
export interface CheckPaymentUnpaidResponse {
@@ -282,4 +285,4 @@ export interface TipCreateRequest {
// URL that the user should be directed to after tipping,
// will be included in the tip_token.
next_url: string;
-} \ No newline at end of file
+}
diff --git a/packages/taler-integrationtests/src/test-claim-loop.ts b/packages/taler-integrationtests/src/test-claim-loop.ts
index ead0076d2..fdc87ba0d 100644
--- a/packages/taler-integrationtests/src/test-claim-loop.ts
+++ b/packages/taler-integrationtests/src/test-claim-loop.ts
@@ -25,6 +25,7 @@ import {
} from "./harness";
import { createSimpleTestkudosEnvironment, withdrawViaBank } from "./helpers";
import { PreparePayResultType, TalerErrorCode } from "taler-wallet-core";
+import { URL } from "url"
/**
* Run test for basic, bank-integrated withdrawal.
@@ -42,38 +43,37 @@ runTest(async (t: GlobalTestState) => {
await withdrawViaBank(t, { wallet, bank, exchange, amount: "TESTKUDOS:20" });
// Set up order.
-
const orderResp = await MerchantPrivateApi.createOrder(merchant, "default", {
order: {
summary: "Buy me!",
amount: "TESTKUDOS:5",
fulfillment_url: "taler://fulfillment-success/thx",
- },
+ }
});
-
- let orderStatus = await MerchantPrivateApi.queryPrivateOrderStatus(merchant, {
+
+ // Query private order status before claiming it.
+ let orderStatusBefore = await MerchantPrivateApi.queryPrivateOrderStatus(merchant, {
orderId: orderResp.order_id,
});
+ let statusUrlBefore = new URL(orderStatusBefore.order_status_url);
- // orderStatus has a "order_status_url" value _with_
- // a 'token' URI parameter.
-
- t.assertTrue(orderStatus.order_status === "unpaid");
-
- const talerPayUri = orderStatus.taler_pay_uri;
-
- // Make wallet claim the order.
-
- const preparePayResult = await wallet.preparePay({
- talerPayUri,
+ // Make wallet claim the unpaid order.
+ t.assertTrue(orderStatusBefore.order_status === "unpaid");
+ const talerPayUri = orderStatusBefore.taler_pay_uri;
+ const y = await wallet.preparePay({
+ talerPayUri
});
- let orderStatusAgain = await MerchantPrivateApi.queryPrivateOrderStatus(merchant, {
+ // Query private order status after claiming it.
+ let orderStatusAfter = await MerchantPrivateApi.queryPrivateOrderStatus(merchant, {
orderId: orderResp.order_id,
});
-
- // orderStatusAgain has a "order_status_url" value
- // _without_ a 'token' URI parameter.
+ let statusUrlAfter = new URL(orderStatusAfter.order_status_url)
+
+ let tokenBefore = statusUrlBefore.searchParams.get("token")
+ let tokenAfter = statusUrlAfter.searchParams.get("token")
+
+ t.assertTrue(tokenBefore === tokenAfter)
await t.shutdown();
});