From d5cc2d65180f16540f318acb7da1a7aef402980d Mon Sep 17 00:00:00 2001 From: Yann Plougonven--Lastennet <77398553+Yann-Plougonven@users.noreply.github.com> Date: Mon, 12 Aug 2024 20:45:32 +0200 Subject: [PATCH] [PM-10764] Fix ProtonPass creditCard expirationDate import (#10473) * Fix ProtonPass creditCard expirationDate import with protonpass-json-importer.ts * Update protonpass CC expirationDate testData to newest version Between 1.3.1 and 1.12.2 ProtonPass has changed the format of exported CC expiration dates from MMYYYY to YYYY-MM --------- Co-authored-by: Daniel James Smith --- .../spec/test-data/protonpass-json/protonpass.json.ts | 2 +- .../src/importers/protonpass/protonpass-json-importer.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/importer/spec/test-data/protonpass-json/protonpass.json.ts b/libs/importer/spec/test-data/protonpass-json/protonpass.json.ts index b4214031667..ddbe9e89b9e 100644 --- a/libs/importer/spec/test-data/protonpass-json/protonpass.json.ts +++ b/libs/importer/spec/test-data/protonpass-json/protonpass.json.ts @@ -102,7 +102,7 @@ export const testData: ProtonPassJsonFile = { cardType: 0, number: "1234222233334444", verificationNumber: "333", - expirationDate: "012025", + expirationDate: "2025-01", pin: "1234", }, }, diff --git a/libs/importer/src/importers/protonpass/protonpass-json-importer.ts b/libs/importer/src/importers/protonpass/protonpass-json-importer.ts index b680f0a3872..7a7018bde22 100644 --- a/libs/importer/src/importers/protonpass/protonpass-json-importer.ts +++ b/libs/importer/src/importers/protonpass/protonpass-json-importer.ts @@ -84,9 +84,9 @@ export class ProtonPassJsonImporter extends BaseImporter implements Importer { cipher.card.code = this.getValueOrDefault(creditCardContent.verificationNumber); if (!this.isNullOrWhitespace(creditCardContent.expirationDate)) { - cipher.card.expMonth = creditCardContent.expirationDate.substring(0, 2); + cipher.card.expMonth = creditCardContent.expirationDate.substring(5, 7); cipher.card.expMonth = cipher.card.expMonth.replace(/^0+/, ""); - cipher.card.expYear = creditCardContent.expirationDate.substring(2, 6); + cipher.card.expYear = creditCardContent.expirationDate.substring(0, 4); } if (!this.isNullOrWhitespace(creditCardContent.pin)) {