Skip to content

Commit

Permalink
Merge branch 'master' into IOPLT-639-new-status-alert-messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Vangaorth authored Oct 4, 2024
2 parents 1ff70ac + f12261e commit 5fa6c6a
Show file tree
Hide file tree
Showing 5 changed files with 165 additions and 45 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"api_cdc": "https://raw.githubusercontent.com/pagopa/io-app/master/assets/CdcSwagger.yml",
"api_fci": "https://raw.githubusercontent.com/pagopa/io-backend/v14.3.0-RELEASE/api_io_sign.yaml",
"api_pn": "https://raw.githubusercontent.com/pagopa/io-backend/v14.3.0-RELEASE/api_pn.yaml",
"api_idpay": "https://raw.githubusercontent.com/pagopa/cstar-infrastructure/v6.5.0/src/domains/idpay-app/api/idpay_appio_full/openapi.appio.full.yml",
"api_idpay": "https://raw.githubusercontent.com/pagopa/cstar-infrastructure/v8.25.1/src/domains/idpay-app/api/idpay_appio_full/openapi.appio.full.yml",
"api_fast_login": "https://raw.githubusercontent.com/pagopa/io-auth-n-identity-domain/io-session-manager@1.0.0/apps/io-session-manager/api/fast-login.yaml",
"api_trial_system": "https://raw.githubusercontent.com/pagopa/io-backend/v14.3.0-RELEASE/api_trial_system.yaml",
"api_pagopa_walletv3": "https://raw.githubusercontent.com/pagopa/pagopa-infra/v1.64.0/src/domains/pay-wallet-app/api/io-payment-wallet/v1/_openapi.json.tpl",
Expand Down Expand Up @@ -82,7 +82,7 @@
"cookie-parser": "^1.4.6",
"crypto": "^1.0.1",
"date-fns": "^2.27.0",
"express": "4.19.2",
"express": "4.20.0",
"figlet": "^1.5.2",
"fp-ts": "^2.16.0",
"io-ts": "^2.2.20",
Expand Down
2 changes: 1 addition & 1 deletion src/payloads/features/idpay/get-timeline-detail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const generateRandomOperationDetailDTO = (
case "TRANSACTION":
return {
...operation,
accrued: operation.accrued || faker.datatype.number(100),
accruedCents: operation.accruedCents || faker.datatype.number(10000),
idTrxAcquirer: ulid(),
idTrxIssuer: ulid()
};
Expand Down
22 changes: 11 additions & 11 deletions src/persistence/idpay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,19 @@ const { idPay: walletConfig } = ioDevServerConfig.wallet;
const pagoPaWallet: WalletV2 = getWalletV2()[0];

const generateRandomInitiativeDTO = (): InitiativeDTO => {
const amount = faker.datatype.number({ min: 50, max: 200, precision: 10 });
const accrued = faker.datatype.number({ max: 200, precision: 10 });
const refunded = faker.datatype.number({ max: accrued, precision: 10 });
const amountCents = faker.datatype.number({ min: 5000, max: 20000 });
const accruedCents = faker.datatype.number({ max: 20000 });
const refundedCents = faker.datatype.number({ max: accruedCents });

return {
initiativeId: ulid(),
initiativeName: faker.company.name(),
status: getRandomEnumValue(InitiativeStatus),
endDate: faker.date.future(1),
amount,
accrued,
amountCents,
accruedCents,
initiativeRewardType: getRandomEnumValue(InitiativeRewardTypeEnum),
refunded,
refundedCents,
lastCounterUpdate: faker.date.recent(1),
iban: faker.helpers.arrayElement(ibanList)?.iban || "",
nInstr: 1,
Expand Down Expand Up @@ -107,8 +107,8 @@ const generateRandomTransactionOperationDTO = (
operationType: getRandomEnumValue(TransactionOperationTypeEnum),
operationDate: new Date(),
operationId: ulid(),
accrued: faker.datatype.number({ min: 5, max: 25 }),
amount: faker.datatype.number({ min: 50, max: 100 }),
accruedCents: faker.datatype.number({ min: 500, max: 2500 }),
amountCents: faker.datatype.number({ min: 5000, max: 10000 }),
brand,
circuitType: "01",
brandLogo,
Expand All @@ -128,7 +128,7 @@ const generateRandomRefundOperationDTO = (
operationDate: new Date(),
operationId: ulid(),
eventId: ulid(),
amount: faker.datatype.number({ min: 5, max: 100 }),
amountCents: faker.datatype.number({ min: 500, max: 10000 }),
...withInfo
});

Expand Down Expand Up @@ -525,8 +525,8 @@ range(0, walletConfig.discountCount).forEach(() => {
status: InitiativeStatus.REFUNDABLE,
iban: undefined,
nInstr: 0,
accrued: 0,
refunded: 0
accruedCents: 0,
refundedCents: 0
};

const { initiativeId } = initiative;
Expand Down
8 changes: 4 additions & 4 deletions src/routers/features/idpay/payment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@ import { addIdPayHandler } from "./router";

const generateRandomAuthPaymentResponseDTO = (): AuthPaymentResponseDTO => {
const amount = faker.datatype.number({
min: 100,
max: 10000
min: 10000,
max: 1000000
});

return {
id: ulid(),
initiativeId: Object.values(initiatives)[0]?.initiativeId ?? ulid(),
status: getRandomEnumValue(PaymentStatusEnum),
trxCode: faker.datatype.string(),
reward: amount,
rewardCents: amount,
amountCents: amount,
businessName: faker.commerce.productName(),
initiativeName: faker.company.name(),
trxDate: faker.date.recent(0),
residualBudget: faker.datatype.number({
residualBudgetCents: faker.datatype.number({
min: 1000,
max: 20000
})
Expand Down
Loading

0 comments on commit 5fa6c6a

Please sign in to comment.