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