Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SIW-1936] Bug fix: the revocation time in the email appears without considering the timezone #357

Merged
merged 39 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
7344382
Progress in sending email following WI revocation
christianatzeni Dec 18, 2024
3f5531a
Using sendRevocationEmail() and QueueClient to handle the WI revocati…
christianatzeni Jan 7, 2025
a5a28e5
Updating yarn.lock file
christianatzeni Jan 7, 2025
6234e63
Using sendRevocationEmail() as TaskEither instead of ReaderTaskEither
christianatzeni Jan 8, 2025
3429d64
Applying correct environment to revokeInvalidWalletInstances() function
christianatzeni Jan 8, 2025
15754fd
Creating and using the WalletInstanceRevocationQueue in terraform
christianatzeni Jan 8, 2025
00a58ff
Merge branch 'master' into SIW-1936-send-email-on-wi-revocation
christianatzeni Jan 8, 2025
893d74c
Using the email template from @pagopa/io-app-email-templates for WI r…
christianatzeni Jan 9, 2025
871ae67
Updating the @pagopa/io-email-templates version
christianatzeni Jan 9, 2025
e747218
Removed incorrect additions related to WalletInstanceCreationEmailFea…
christianatzeni Jan 9, 2025
6621b36
Removed useless exports from config.ts
christianatzeni Jan 9, 2025
2ab9c8b
Using a correct value for WalletInstanceRevocationEmailFeatureFlag en…
christianatzeni Jan 9, 2025
a2f817c
Sending the revocation email only in specific points of the code
christianatzeni Jan 9, 2025
d41e0c1
Removed the email-related code from wallet-instance.ts; added the ema…
christianatzeni Jan 10, 2025
7a87bba
Using revokeUserValidWalletInstancesExceptOne() directly (rather than…
christianatzeni Jan 10, 2025
0d40431
Using revokeUserWalletInstances() directly rather than via another fu…
christianatzeni Jan 10, 2025
a7389e6
Removed unnecessary code
christianatzeni Jan 10, 2025
a8ccfce
Using walletInstanceRepository.batchPatch() directly
christianatzeni Jan 10, 2025
9b5a92c
Adding TelemetryClient to the SendEmailOnWalletInstanceRevocation han…
christianatzeni Jan 13, 2025
92c3b87
Passing new Date() directly instead of new Date().toISOString()
christianatzeni Jan 13, 2025
b74a950
Removed unnecessary 'export' keywords
christianatzeni Jan 13, 2025
4e324ca
Using enqueue() directly instead of throughout the sendCretionEmail()…
christianatzeni Jan 13, 2025
58111ed
Using queueClient instead of queueCreationClient for the CreateWallet…
christianatzeni Jan 13, 2025
0898336
Removing emailRevocationQueuingEnabled and queueRevocationClient as d…
christianatzeni Jan 13, 2025
b4e8a0d
Adding 'Queue Name' for both wallet_instance_revocation_email_queue_n…
christianatzeni Jan 13, 2025
6264e52
Using whitelistFiscalCodes in setWalletInstanceStatus and setCurrentW…
christianatzeni Jan 13, 2025
4fff54b
Helpful comment restored
christianatzeni Jan 13, 2025
01da896
Using IsoDateFromString type for the revokedAt attribute of WalletIns…
christianatzeni Jan 13, 2025
8df2b27
Changeset
christianatzeni Jan 13, 2025
77a75c4
Adding sendEmailOnWalletInstanceRevocation to the function_app_user_s…
christianatzeni Jan 14, 2025
e82f834
Using date-fns-tz to force the Europe/Rome timezone
christianatzeni Jan 14, 2025
af75c0f
Merge branch 'master' into SIW-1936-fixing-time-zone-wi-revocation-email
christianatzeni Jan 14, 2025
f25bef7
Using dayjs with some utilities (utc and timezone) to handle the revo…
christianatzeni Jan 15, 2025
7193f16
Removing reference to test code
christianatzeni Jan 15, 2025
f531585
Removed old file for version
christianatzeni Jan 15, 2025
1614901
Removing allowSyntheticDefaultImports from tsconfig.ts
christianatzeni Jan 15, 2025
18a6e13
Isolated the code for formatting dates in the datetime.ts file
christianatzeni Jan 16, 2025
4e65a9d
Correctly updated the yarn.lock file
christianatzeni Jan 16, 2025
ac53f59
Removing default parameter in formatDate()
christianatzeni Jan 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fresh-masks-beam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
christianatzeni marked this conversation as resolved.
Show resolved Hide resolved
"io-wallet-user-func": major
christianatzeni marked this conversation as resolved.
Show resolved Hide resolved
---

Send email when wallet instance is revoked by user
1 change: 1 addition & 0 deletions apps/io-wallet-user-func/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"asn1js": "^3.0.5",
"cbor-x": "^1.6.0",
"date-fns": "^4.1.0",
"date-fns-tz": "^3.2.0",
"fp-ts": "^2.16.9",
"googleapis": "^144.0.0",
"html-to-text": "5.1.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { IsoDateFromString } from "@pagopa/ts-commons/lib/dates";
import { FiscalCode } from "@pagopa/ts-commons/lib/strings";
import { ValidUrl } from "@pagopa/ts-commons/lib/url";
import { format } from "date-fns";
import { toZonedTime } from "date-fns-tz";
christianatzeni marked this conversation as resolved.
Show resolved Hide resolved
import { pipe } from "fp-ts/function";
import * as RTE from "fp-ts/lib/ReaderTaskEither";
import * as HtmlToText from "html-to-text";
Expand All @@ -20,6 +21,7 @@ type WalletInstanceRevocationQueueItem = t.TypeOf<
typeof WalletInstanceRevocationQueueItem
>;

const WALLET_REVOCATION_EMAIL_TIMEZONE = "Europe/Rome";
christianatzeni marked this conversation as resolved.
Show resolved Hide resolved
const WALLET_REVOCATION_EMAIL_TITLE =
"Messaggi da IO: Documenti su IO disattivato";
const WALLET_REVOCATION_EMAIL_BLOCK_ACCESS_LINK = "https://ioapp.it/it/accedi/";
Expand All @@ -29,9 +31,15 @@ const HTML_TO_TEXT_OPTIONS: HtmlToTextOptions = {
tables: true,
};

const getRevocationTime = (datetime: Date) => format(datetime, "HH:mm");
const getRevocationTime = (datetime: Date) =>
pipe(toZonedTime(datetime, WALLET_REVOCATION_EMAIL_TIMEZONE), (zonedDate) =>
format(zonedDate, "HH:mm"),
);

const getRevocationDate = (datetime: Date) => format(datetime, "dd/MM/yyyy");
const getRevocationDate = (datetime: Date) =>
pipe(toZonedTime(datetime, WALLET_REVOCATION_EMAIL_TIMEZONE), (zonedDate) =>
format(zonedDate, "dd/MM/yyyy"),
);

export const SendEmailOnWalletInstanceRevocationHandler = H.of(
({ fiscalCode, revokedAt }: WalletInstanceRevocationQueueItem) =>
Expand Down
10 changes: 10 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3870,6 +3870,15 @@ __metadata:
languageName: node
linkType: hard

"date-fns-tz@npm:^3.2.0":
version: 3.2.0
resolution: "date-fns-tz@npm:3.2.0"
peerDependencies:
date-fns: ^3.0.0 || ^4.0.0
checksum: 10c0/3f43300a4335d59f3515dc5196c66b4b56ef2af129eb82e4445ce0983e8ef31a5d038bc0406d669946bbbcf52ed953527527aa28b4a810995d6631a54655abcc
languageName: node
linkType: hard

"date-fns@npm:^4.1.0":
version: 4.1.0
resolution: "date-fns@npm:4.1.0"
Expand Down Expand Up @@ -5624,6 +5633,7 @@ __metadata:
azure-functions-core-tools: "npm:^4.0.6610"
cbor-x: "npm:^1.6.0"
date-fns: "npm:^4.1.0"
date-fns-tz: "npm:^3.2.0"
eslint: "npm:9.14.0"
fp-ts: "npm:^2.16.9"
googleapis: "npm:^144.0.0"
Expand Down
Loading