Skip to content

Commit

Permalink
chore: add expired card in wallet (#361)
Browse files Browse the repository at this point in the history
  • Loading branch information
mastro993 authored Apr 12, 2024
1 parent da217cb commit 3c10a43
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/features/wallet/persistence/userWallet.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { faker } from "@faker-js/faker";
import { format } from "date-fns";
import * as E from "fp-ts/lib/Either";
import _ from "lodash";
import { WalletApplication } from "../../../../generated/definitions/pagopa/walletv3/WalletApplication";
import { WalletApplicationStatusEnum } from "../../../../generated/definitions/pagopa/walletv3/WalletApplicationStatus";
import { WalletInfo } from "../../../../generated/definitions/pagopa/walletv3/WalletInfo";
import { WalletInfoDetails } from "../../../../generated/definitions/pagopa/walletv3/WalletInfoDetails";
import { WalletStatusEnum } from "../../../../generated/definitions/pagopa/walletv3/WalletStatus";
import { generateWalletDetailsByPaymentMethod } from "./paymentMethods";

Expand All @@ -21,9 +24,15 @@ const removeUserWallet = (walletId: WalletInfo["walletId"]) => {
userWallets.delete(walletId);
};

const generateUserWallet = (paymentMethodId: number) => {
const generateUserWallet = (
paymentMethodId: number,
extraDetails: Partial<WalletInfoDetails> = {}
) => {
const walletId = (getUserWallets().length + 1).toString();
const details = generateWalletDetailsByPaymentMethod(paymentMethodId);
const details = _.merge(
generateWalletDetailsByPaymentMethod(paymentMethodId),
extraDetails
);

const randomWallet: WalletInfo = {
walletId,
Expand All @@ -49,6 +58,7 @@ const generateWalletData = () => {
generateUserWallet(3);
generateUserWallet(2);
generateUserWallet(1);
generateUserWallet(1, { expiryDate: format(faker.date.past(1), "yyyyMM") });
};

const updateUserWalletApplication = (
Expand Down

0 comments on commit 3c10a43

Please sign in to comment.