2025-07-03 22:23:30 +02:00

97 lines
3.1 KiB
TypeScript

import { http, HttpResponse } from "msw";
export const handlers = [
http.get(
"https://test-bo.paymentiq.io/paymentiq/backoffice/api/v2/metrics/txsummary",
(req, _res, _ctx) => {
const merchantId = req.url.searchParams.get("merchantId");
const fromDate = req.url.searchParams.get("fromDate");
const toDate = req.url.searchParams.get("toDate");
console.log(merchantId, fromDate, toDate);
return HttpResponse.json({
result: {
txCount: { total: 0, successful: 0 },
amount: { value: "0", currency: "EUR" },
},
});
}
),
http.get(
"https://test-bo.paymentiq.io/paymentiq/backoffice/api/v2/users/",
(req, _res, _ctx) => {
// Mock data for merchantId = 100987998
if (true) {
return HttpResponse.json({
result: [
{
merchantId: 100987998,
id: "bc6a8a55-13bc-4538-8255-cd0cec3bb4e9",
username: "lspaddy",
firstName: "Paddy",
lastName: "Man",
email: "patrick@omegasys.eu",
phone: "",
jobTitle: "",
enabled: true,
authorities: [
"ROLE_IIN",
"ROLE_FIRST_APPROVER",
"ROLE_RULES_ADMIN",
"ROLE_TRANSACTION_VIEWER",
"ROLE_IIN_ADMIN",
"ROLE_USER_PSP_ACCOUNT",
],
allowedMerchantIds: [100987998],
created: "2025-05-04T15:32:48.432Z",
disabledBy: null,
disabledDate: null,
disabledReason: null,
incidentNotes: false,
lastLogin: "",
lastMandatoryUpdated: "2025-05-04T15:32:48.332Z",
marketingNewsletter: false,
releaseNotes: false,
requiredActions: ["CONFIGURE_TOTP", "UPDATE_PASSWORD"],
twoFactorCondition: "required",
twoFactorCredentials: [],
},
{
merchantId: 100987998,
id: "382eed15-1e21-41fa-b1f3-0c1adb3af714",
username: "lsterence",
firstName: "Terence",
lastName: "User",
email: "terence@omegasys.eu",
phone: "",
jobTitle: "",
enabled: true,
authorities: [
"ROLE_IIN",
"ROLE_FIRST_APPROVER",
"ROLE_RULES_ADMIN",
],
allowedMerchantIds: [100987998],
created: "2025-05-04T15:32:48.432Z",
disabledBy: null,
disabledDate: null,
disabledReason: null,
incidentNotes: false,
lastLogin: "",
lastMandatoryUpdated: "2025-05-04T15:32:48.332Z",
marketingNewsletter: false,
releaseNotes: false,
requiredActions: ["CONFIGURE_TOTP", "UPDATE_PASSWORD"],
twoFactorCondition: "required",
twoFactorCredentials: [],
},
// Add more users if needed
],
total: 4,
});
}
}
),
];