Skip to content

Commit

Permalink
Add reason code translations for rejected supporting documents (#655)
Browse files Browse the repository at this point in the history
* Add reason code translations for rejected supporting documents

* Fix story type and behaviour

* Feedbacks

* Add missing code translations
  • Loading branch information
sandrine-ds authored Jan 6, 2025
1 parent 00c3f79 commit 511019a
Show file tree
Hide file tree
Showing 11 changed files with 297 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,11 @@ export const ReadOnlyWithDocs = () => {
id: "id",
name: "IdCard.pdf",
url: "https://swan.io",
statusInfo: { status: "Refused", reason: "Invalid document" },
statusInfo: {
status: "Refused",
reason: "Invalid document",
reasonCode: "InvalidDocument",
},
},
},
]}
Expand Down
89 changes: 87 additions & 2 deletions packages/shared-business/src/components/FileTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,94 @@ export const FileTile = ({
.with({ status: "Pending" }, () => (
<LakeAlert anchored={true} title={t("fileTile.status.Pending")} variant="info" />
))
.with({ status: "Refused" }, ({ reason }) => (
.with({ status: "Refused" }, ({ reason, reasonCode }) => (
<LakeAlert anchored={true} title={t("fileTile.status.Refused")} variant="error">
{reason}
<Box direction="column">
<LakeText>
{match(reasonCode)
.with("BadDocumentQuality", () =>
t("supportingDocuments.rejectionReason.BadDocumentQuality"),
)
.with("CompanyNameMismatch", () =>
t("supportingDocuments.rejectionReason.CompanyNameMismatch"),
)
.with("DeclaredAmountMismatch", () =>
t("supportingDocuments.rejectionReason.DeclaredAmountMismatch"),
)
.with("ExpiredDocument", () =>
t("supportingDocuments.rejectionReason.ExpiredDocument"),
)
.with("FullDocumentRequired", () =>
t("supportingDocuments.rejectionReason.FullDocumentRequired"),
)
.with("IbanMismatch", () => t("supportingDocuments.rejectionReason.IbanMismatch"))
.with("InvalidAddress", () =>
t("supportingDocuments.rejectionReason.InvalidAddress"),
)
.with("InvalidDocument", () =>
t("supportingDocuments.rejectionReason.InvalidDocument"),
)
.with("InvalidOrMissingData", () =>
t("supportingDocuments.rejectionReason.InvalidOrMissingData"),
)
.with("InvalidTransaction", () =>
t("supportingDocuments.rejectionReason.InvalidTransaction"),
)
.with("HandwrittenOrCertifiedElectronicSignatureRequired", () =>
t(
"supportingDocuments.rejectionReason.HandwrittenOrCertifiedElectronicSignatureRequired",
),
)
.with("MissingAccommodationProviderId", () =>
t("supportingDocuments.rejectionReason.MissingAccommodationProviderId"),
)
.with("MissingAccommodationProviderIdLetter", () =>
t("supportingDocuments.rejectionReason.MissingAccommodationProviderIdLetter"),
)
.with("MissingAccommodationProviderLetter", () =>
t("supportingDocuments.rejectionReason.MissingAccommodationProviderLetter"),
)
.with("MissingCompanyDomiciliationStatement", () =>
t("supportingDocuments.rejectionReason.MissingCompanyDomiciliationStatement"),
)
.with("MissingProviderProofOfAddress", () =>
t("supportingDocuments.rejectionReason.MissingProviderProofOfAddress"),
)
.with("MissingProviderProofOfAddressAndIdDocument", () =>
t(
"supportingDocuments.rejectionReason.MissingProviderProofOfAddressAndIdDocument",
),
)
.with("MissingDescription", () =>
t("supportingDocuments.rejectionReason.MissingDescription"),
)
.with("MissingSignature", () =>
t("supportingDocuments.rejectionReason.MissingSignature"),
)
.with("PowerOfAttorneyToSwanRequired", () =>
t("supportingDocuments.rejectionReason.PowerOfAttorneyToSwanRequired"),
)
.with("ProviderColorIdDocumentRequired", () =>
t("supportingDocuments.rejectionReason.ProviderColorIdDocumentRequired"),
)
.with("TransactionAmountMismatch", () =>
t("supportingDocuments.rejectionReason.TransactionAmountMismatch"),
)
.with("TransactionDateMismatch", () =>
t("supportingDocuments.rejectionReason.TransactionDateMismatch"),
)
.with("TransactionNameMismatch", () =>
t("supportingDocuments.rejectionReason.TransactionNameMismatch"),
)
.with("UnacceptableDocument", () =>
t("supportingDocuments.rejectionReason.UnacceptableDocument"),
)
.with("other", () => null)
.otherwise(reasonCode => reasonCode)}
</LakeText>

<LakeText>{reason}</LakeText>
</Box>
</LakeAlert>
))
.otherwise(() => null)}
Expand Down
25 changes: 25 additions & 0 deletions packages/shared-business/src/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,31 @@
"supportingDocuments.purpose.UltimateBeneficialOwnerProofOfAddress.description": "Bitte fügen Sie für jede Person, die mindestens 25% des Kapitals oder Stimmrechts besitzt oder jede Person, die die Geschäftsführung oder das Management Ihres Unternehmens kontrolliert, ein Dokument hinzu, das den Wohnsitz des Einzelnen nachweist. Das Dokument muss den Namen und die Adresse der Person enthalten und darf nicht älter als drei Monate sein.\n\nAkzeptable Dokumente:\n- Dokumente zum Wohnsitz (Mietvertrag, Hypothekenabrechnung usw.)\n- Haushaltsrechnungen (für Strom, Telefon, Internetdienste, Gas, Wasser usw.)\n- Lohnabrechnungen (sofern die Adresse des Arbeitnehmers enthalten ist)",
"supportingDocuments.purpose.UltimateBeneficialOwnerProofOfIdentity": "Identitätsdokument für jeden wirtschaftlich Berechtigten",
"supportingDocuments.purpose.UltimateBeneficialOwnerProofOfIdentity.description": "Bitte legen Sie ein Dokument für jede Person vor, die mindestens 25% des Kapitals oder der Stimmrechte besitzt oder jede Person, die die Geschäftsführung oder die Leitungsorgane Ihres Unternehmens kontrolliert.\n\nAkzeptable Dokumente:\n- Reisepass\n- Personalausweis (nur für Bürger von Mitgliedsländern der EWR-Zone)\n- Aufenthaltsgenehmigung (nur für Bewohner von Mitgliedsländern der EWR-Zone)\n- Führerschein (nur für Bewohner von Mitgliedsländern der EWR-Zone)",
"supportingDocuments.rejectionReason.BadDocumentQuality": "Die Qualität des Dokuments ist sehr niedrig",
"supportingDocuments.rejectionReason.CompanyNameMismatch": "Der im eingereichten Dokument angegebene Firmenname stimmt nicht mit unseren Aufzeichnungen überein.",
"supportingDocuments.rejectionReason.DeclaredAmountMismatch": "Der im eingereichten Dokument angegebene Betrag stimmt nicht mit unseren Aufzeichnungen überein.",
"supportingDocuments.rejectionReason.ExpiredDocument": "Das Ablaufdatum im eingereichten Dokument muss in den letzten 3 Monaten liegen.",
"supportingDocuments.rejectionReason.FullDocumentRequired": "Vollständiges Dokument erforderlich",
"supportingDocuments.rejectionReason.HandwrittenOrCertifiedElectronicSignatureRequired": "Die Unterschrift ist nicht handschriftlich oder elektronisch zertifiziert.",
"supportingDocuments.rejectionReason.IbanMismatch": "Die IBAN des Begünstigten im eingereichten Dokument stimmt nicht mit der Transaktionsanfrage überein.",
"supportingDocuments.rejectionReason.InvalidAddress": "Die Adresse im eingereichten Dokument stimmt nicht mit unseren Aufzeichnungen überein.",
"supportingDocuments.rejectionReason.InvalidDocument": "Das Dokument ist ungültig.",
"supportingDocuments.rejectionReason.InvalidOrMissingData": "Der Name des Aktionärs im eingereichten Dokument ist ungültig oder fehlt.",
"supportingDocuments.rejectionReason.InvalidTransaction": "Die Informationen im eingereichten Dokument stimmen nicht mit dieser spezifischen Transaktion überein.",
"supportingDocuments.rejectionReason.MissingAccommodationProviderId": "Ein Identitätsdokument für den Beherbergungsanbieter ist erforderlich.",
"supportingDocuments.rejectionReason.MissingAccommodationProviderIdLetter": "Die ID des Beherbergungsanbieters und ein Nachweis der Unterkunft sind erforderlich.",
"supportingDocuments.rejectionReason.MissingAccommodationProviderLetter": "Ein Nachweis der Unterkunft vom Anbieter ist erforderlich.",
"supportingDocuments.rejectionReason.MissingCompanyDomiciliationStatement": "Die Erklärung des Firmensitzes ist erforderlich.",
"supportingDocuments.rejectionReason.MissingDescription": "Es werden weitere Informationen benötigt, um die Art dieser Transaktion zu verstehen. Bitte reichen Sie zusätzliche Informationen ein.",
"supportingDocuments.rejectionReason.MissingProviderProofOfAddress": "Der Nachweis der Adresse des Beherbergungsanbieters ist erforderlich.",
"supportingDocuments.rejectionReason.MissingProviderProofOfAddressAndIdDocument": "Die ID und der Adressnachweis des Beherbergungsanbieters sind erforderlich.",
"supportingDocuments.rejectionReason.MissingSignature": "Das eingereichte Dokument muss unterschrieben oder datiert sein.",
"supportingDocuments.rejectionReason.PowerOfAttorneyToSwanRequired": "Eine Vollmacht muss an Swan übermittelt werden.",
"supportingDocuments.rejectionReason.ProviderColorIdDocumentRequired": "Das Dokument muss in Farbe eingereicht werden.",
"supportingDocuments.rejectionReason.TransactionAmountMismatch": "Der Transaktionsbetrag im eingereichten Dokument stimmt nicht mit der Transaktionsanfrage überein.",
"supportingDocuments.rejectionReason.TransactionDateMismatch": "Das Datum im eingereichten Dokument stimmt nicht mit der Transaktionsanfrage überein.",
"supportingDocuments.rejectionReason.TransactionNameMismatch": "Der Name des Ausstellers oder Begünstigten im eingereichten Dokument stimmt nicht mit der Transaktionsanfrage überein.",
"supportingDocuments.rejectionReason.UnacceptableDocument": "Das Dokument kann für den angeforderten Dokumenttyp nicht akzeptiert werden",
"taxIdentificationNumber.label": "Steueridentifikationsnummer",
"transactionStatement.creditor.accountNumber": "Kontonummer des Gläubigers",
"transactionStatement.creditor.bankIdentifier": "Bankleitzahl des Gläubigers",
Expand Down
25 changes: 25 additions & 0 deletions packages/shared-business/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,31 @@
"supportingDocuments.purpose.UltimateBeneficialOwnerProofOfAddress.description": "Include one document for each person who owns at least 25% of the capital or rights to vote, or any person who controls your company's executive bodies or management. Any document proving the individual's residence address. They must include the name and address of the individual and be dated less than 3 months old.\n\nAcceptable documents:\n- Documents related to the home (rental contract, mortgage statement, etc)\n- Home utility bills (for electricity, telephone, internet services, gas, water, etc)\n- Payroll (if it includes the worker's address)",
"supportingDocuments.purpose.UltimateBeneficialOwnerProofOfIdentity": "Identity document of each beneficial owner",
"supportingDocuments.purpose.UltimateBeneficialOwnerProofOfIdentity.description": "Include one document for each person who owns at least 25% of the capital or rights to vote, or any person who controls your company's executive bodies or management.\n\nAcceptable documents:\n- Passport\n- ID card (only applicable to citizens of member countries of the EEA zone)\n- Residence permit (only applicable to residents of member countries of the EEA zone)\n- Driver's license (only applicable to residents of member countries of the EEA zone)",
"supportingDocuments.rejectionReason.CompanyNameMismatch": "The company name in the document submitted doesn't match our records.",
"supportingDocuments.rejectionReason.DeclaredAmountMismatch": "The declared amount in the document submitted doesn't match our records.",
"supportingDocuments.rejectionReason.ExpiredDocument": "The expiry date in the document submitted must be within the past 3 months.",
"supportingDocuments.rejectionReason.InvalidAddress": "The address in the document submitted doesn't match our records.",
"supportingDocuments.rejectionReason.InvalidDocument": "The document is not valid.",
"supportingDocuments.rejectionReason.InvalidOrMissingData": "The shareholder's name in the document submitted is invalid or missing.",
"supportingDocuments.rejectionReason.MissingAccommodationProviderId": "An identity document for the accommodation provider is required.",
"supportingDocuments.rejectionReason.MissingAccommodationProviderIdLetter": "The accommodation provider’s ID and proof of accommodation are required.",
"supportingDocuments.rejectionReason.MissingAccommodationProviderLetter": "Proof of accommodation from the provider is required.",
"supportingDocuments.rejectionReason.UnacceptableDocument": "Document cannot be accepted for the requested document type",
"supportingDocuments.rejectionReason.ProviderColorIdDocumentRequired": "The document must be submitted in color.",
"supportingDocuments.rejectionReason.MissingSignature": "The document submitted must be signed or dated.",
"supportingDocuments.rejectionReason.BadDocumentQuality": "The quality of the document is really low",
"supportingDocuments.rejectionReason.FullDocumentRequired": "Full document required",
"supportingDocuments.rejectionReason.MissingProviderProofOfAddress": "The accommodation provider's proof of address is required.",
"supportingDocuments.rejectionReason.MissingProviderProofOfAddressAndIdDocument": "The accommodation provider's ID and proof of address are required.",
"supportingDocuments.rejectionReason.PowerOfAttorneyToSwanRequired": "Power of attorney must be provided to Swan.",
"supportingDocuments.rejectionReason.MissingCompanyDomiciliationStatement": "The company domiciliation statement is required.",
"supportingDocuments.rejectionReason.HandwrittenOrCertifiedElectronicSignatureRequired": "The signature is not handwritten or electronically certified.",
"supportingDocuments.rejectionReason.MissingDescription": "More information is needed to understand the nature of this transaction. Please submit additional information.",
"supportingDocuments.rejectionReason.InvalidTransaction": "The information in the document submitted doesn't match this specific transaction.",
"supportingDocuments.rejectionReason.TransactionNameMismatch": "The issuer or beneficiary name on the document submitted doesn't match the transaction request.",
"supportingDocuments.rejectionReason.TransactionDateMismatch": "The date on the document submitted doesn't match the transaction request.",
"supportingDocuments.rejectionReason.TransactionAmountMismatch": "The transaction amount on the document submitted doesn't match the transaction request.",
"supportingDocuments.rejectionReason.IbanMismatch": "The beneficiary IBAN on the document submitted doesn't match the transaction request.",
"taxIdentificationNumber.label": "Tax identification number",
"transactionStatement.creditor.accountNumber": "Creditor's account number",
"transactionStatement.creditor.bankIdentifier": "Creditor's bank identifier",
Expand Down
Loading

0 comments on commit 511019a

Please sign in to comment.