tag test properly
This commit is contained in:
parent
5e69745072
commit
20ffa834d8
@ -168,9 +168,9 @@ export interface LibeufinSandboxAddIncomingRequest {
|
||||
creditorIban: string;
|
||||
creditorBic: string;
|
||||
creditorName: string;
|
||||
debitorIban: string;
|
||||
debitorBic: string;
|
||||
debitorName: string;
|
||||
debtorIban: string;
|
||||
debtorBic: string;
|
||||
debtorName: string;
|
||||
subject: string;
|
||||
amount: string;
|
||||
currency: string;
|
||||
@ -332,7 +332,6 @@ export interface SimulateIncomingTransactionRequest {
|
||||
* Decimal amount without currency.
|
||||
*/
|
||||
amount: string;
|
||||
currency: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -798,9 +797,9 @@ export namespace LibeufinSandboxApi {
|
||||
creditorIban: creditorBundle.ebicsBankAccount.iban,
|
||||
creditorBic: creditorBundle.ebicsBankAccount.bic,
|
||||
creditorName: creditorBundle.ebicsBankAccount.name,
|
||||
debitorIban: debitorBundle.ebicsBankAccount.iban,
|
||||
debitorBic: debitorBundle.ebicsBankAccount.bic,
|
||||
debitorName: debitorBundle.ebicsBankAccount.name,
|
||||
debtorIban: debitorBundle.ebicsBankAccount.iban,
|
||||
debtorBic: debitorBundle.ebicsBankAccount.bic,
|
||||
debtorName: debitorBundle.ebicsBankAccount.name,
|
||||
subject: subject,
|
||||
amount: amount,
|
||||
currency: currency,
|
||||
|
@ -93,9 +93,9 @@ export async function runLibeufinApiBankaccountTest(t: GlobalTestState) {
|
||||
creditorIban: "DE71500105179674997361",
|
||||
creditorBic: "BELADEBEXXX",
|
||||
creditorName: "mock",
|
||||
debitorIban: "DE84500105176881385584",
|
||||
debitorBic: "BELADEBEXXX",
|
||||
debitorName: "mock2",
|
||||
debtorIban: "DE84500105176881385584",
|
||||
debtorBic: "BELADEBEXXX",
|
||||
debtorName: "mock2",
|
||||
subject: "mock subject",
|
||||
currency: "EUR",
|
||||
amount: "1",
|
||||
|
@ -257,7 +257,6 @@ export async function runLibeufinBasicTest(t: GlobalTestState) {
|
||||
"exchangeacct",
|
||||
{
|
||||
amount: "15.00",
|
||||
currency: "EUR",
|
||||
debtorBic: customerBic,
|
||||
debtorIban: customerIban,
|
||||
debtorName: "Jane Customer",
|
||||
|
@ -23,7 +23,7 @@ import {
|
||||
PreparePayResultType,
|
||||
codecForMerchantOrderStatusUnpaid,
|
||||
ConfirmPayResultType,
|
||||
URL
|
||||
URL,
|
||||
} from "@gnu-taler/taler-util";
|
||||
import axios from "axios";
|
||||
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
|
||||
@ -60,10 +60,9 @@ export async function runMerchantLongpollingTest(t: GlobalTestState) {
|
||||
amount: "TESTKUDOS:5",
|
||||
fulfillment_url: "https://example.com/article42",
|
||||
},
|
||||
create_token: false,
|
||||
});
|
||||
|
||||
const firstOrderId = orderResp.order_id;
|
||||
|
||||
let orderStatus = await MerchantPrivateApi.queryPrivateOrderStatus(merchant, {
|
||||
orderId: orderResp.order_id,
|
||||
sessionId: "mysession-one",
|
||||
@ -74,16 +73,31 @@ export async function runMerchantLongpollingTest(t: GlobalTestState) {
|
||||
t.assertTrue(orderStatus.already_paid_order_id === undefined);
|
||||
let publicOrderStatusUrl = new URL(orderStatus.order_status_url);
|
||||
|
||||
// Wait for half a second seconds!
|
||||
// First, request order status without longpolling
|
||||
{
|
||||
console.log("requesting", publicOrderStatusUrl.href);
|
||||
let publicOrderStatusResp = await axios.get(publicOrderStatusUrl.href, {
|
||||
validateStatus: () => true,
|
||||
});
|
||||
|
||||
if (publicOrderStatusResp.status != 402) {
|
||||
throw Error(
|
||||
`expected status 402 (before claiming, no long polling), but got ${publicOrderStatusResp.status}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Now do long-polling for half a second!
|
||||
publicOrderStatusUrl.searchParams.set("timeout_ms", "500");
|
||||
|
||||
console.log("requesting", publicOrderStatusUrl.href);
|
||||
let publicOrderStatusResp = await axios.get(publicOrderStatusUrl.href, {
|
||||
validateStatus: () => true,
|
||||
});
|
||||
|
||||
if (publicOrderStatusResp.status != 402) {
|
||||
throw Error(
|
||||
`expected status 402 (before claiming), but got ${publicOrderStatusResp.status}`,
|
||||
`expected status 402 (before claiming, with long-polling), but got ${publicOrderStatusResp.status}`,
|
||||
);
|
||||
}
|
||||
|
||||
@ -99,12 +113,6 @@ export async function runMerchantLongpollingTest(t: GlobalTestState) {
|
||||
* =========================================================================
|
||||
*/
|
||||
|
||||
publicOrderStatusUrl.searchParams.set("timeout_ms", "5000");
|
||||
|
||||
let publicOrderStatusPromise = axios.get(publicOrderStatusUrl.href, {
|
||||
validateStatus: () => true,
|
||||
});
|
||||
|
||||
let preparePayResp = await wallet.client.call(
|
||||
WalletApiOperation.PreparePayForUri,
|
||||
{
|
||||
@ -114,6 +122,18 @@ export async function runMerchantLongpollingTest(t: GlobalTestState) {
|
||||
|
||||
t.assertTrue(preparePayResp.status === PreparePayResultType.PaymentPossible);
|
||||
|
||||
publicOrderStatusUrl.searchParams.set("timeout_ms", "5000");
|
||||
publicOrderStatusUrl.searchParams.set(
|
||||
"h_contract",
|
||||
preparePayResp.contractTermsHash,
|
||||
);
|
||||
|
||||
let publicOrderStatusPromise = axios.get(publicOrderStatusUrl.href, {
|
||||
validateStatus: () => true,
|
||||
});
|
||||
|
||||
t.assertTrue(preparePayResp.status === PreparePayResultType.PaymentPossible);
|
||||
|
||||
const proposalId = preparePayResp.proposalId;
|
||||
|
||||
publicOrderStatusResp = await publicOrderStatusPromise;
|
||||
@ -137,3 +157,5 @@ export async function runMerchantLongpollingTest(t: GlobalTestState) {
|
||||
|
||||
t.assertTrue(confirmPayRes.type === ConfirmPayResultType.Done);
|
||||
}
|
||||
|
||||
runMerchantLongpollingTest.suites = ["merchant"];
|
||||
|
Loading…
Reference in New Issue
Block a user