Finalizing loop's cause reproduction.
This commit is contained in:
parent
ae898c63fa
commit
2c0464b494
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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, {
|
||||
orderId: orderResp.order_id,
|
||||
});
|
||||
|
||||
// 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,
|
||||
});
|
||||
|
||||
let orderStatusAgain = await MerchantPrivateApi.queryPrivateOrderStatus(merchant, {
|
||||
orderId: orderResp.order_id,
|
||||
}
|
||||
});
|
||||
|
||||
// orderStatusAgain has a "order_status_url" value
|
||||
// _without_ a 'token' URI parameter.
|
||||
// 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);
|
||||
|
||||
// Make wallet claim the unpaid order.
|
||||
t.assertTrue(orderStatusBefore.order_status === "unpaid");
|
||||
const talerPayUri = orderStatusBefore.taler_pay_uri;
|
||||
const y = await wallet.preparePay({
|
||||
talerPayUri
|
||||
});
|
||||
|
||||
// Query private order status after claiming it.
|
||||
let orderStatusAfter = await MerchantPrivateApi.queryPrivateOrderStatus(merchant, {
|
||||
orderId: orderResp.order_id,
|
||||
});
|
||||
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();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user