From 4433ab0ecdbf814982c10ead62f8abd9d0969a10 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Mon, 25 Oct 2021 16:41:13 +0330 Subject: [PATCH 1/2] feat: add poa and poi notifications --- .../Stores/Helpers/client-notifications.js | 42 ++++++++++++------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/packages/core/src/Stores/Helpers/client-notifications.js b/packages/core/src/Stores/Helpers/client-notifications.js index 61e2642ad29d..6e48adfe00c6 100644 --- a/packages/core/src/Stores/Helpers/client-notifications.js +++ b/packages/core/src/Stores/Helpers/client-notifications.js @@ -16,6 +16,7 @@ import { StaticUrl } from '@deriv/components'; import { localize, Localize } from '@deriv/translations'; import { BinaryLink } from 'App/Components/Routes'; import { WS } from 'Services'; +import { populateVerificationStatus } from '@deriv/account'; // TODO: Update links to app_2 links when components are done. /* eslint-disable react/jsx-no-target-blank */ @@ -129,17 +130,25 @@ export const clientNotifications = (ui = {}, client = {}) => { type: 'warning', }; }, - authenticate: { - key: 'authenticate', - header: localize('Your account has not been verified'), - message: localize( - 'Please submit your proof of identity and proof of address to verify your account in your account settings to access the cashier.' - ), + verify_poi: { + key: 'verify_poi', + header: localize('Please verify your identity'), + message: localize('To continue trading with us, please confirm who you are.'), action: { route: routes.proof_of_identity, - text: localize('Go to my account settings'), + text: localize('Verify identity'), }, - type: 'warning', + type: 'danger', + }, + verify_poa: { + key: 'verify_poa', + header: localize('Please verify your address'), + message: localize('To continue trading with us, please confirm where you live.'), + action: { + route: routes.proof_of_address, + text: localize('Verify address'), + }, + type: 'danger', }, withdrawal_locked_review: { key: 'withdrawal_locked_review', @@ -524,13 +533,8 @@ const checkAccountStatus = ( cashier_validation, } = account_status; - const { - cashier_locked, - withdrawal_locked, - deposit_locked, - mt5_withdrawal_locked, - document_needs_action, - } = getStatusValidations(status); + const { cashier_locked, withdrawal_locked, deposit_locked, mt5_withdrawal_locked, document_needs_action } = + getStatusValidations(status); const { system_maintenance, @@ -573,7 +577,13 @@ const checkAccountStatus = ( } else if (ASK_CURRENCY) { addNotificationMessage(clientNotifications(ui_store).currency); } else if (ASK_AUTHENTICATE) { - addNotificationMessage(clientNotifications().authenticate); + const { has_poi, has_poa } = populateVerificationStatus(account_status); + if (!has_poi) { + addNotificationMessage(clientNotifications().verify_poi); + } + if (!has_poa) { + addNotificationMessage(clientNotifications().verify_poa); + } } else if (isAccountOfType('financial') && ASK_FINANCIAL_RISK_APPROVAL) { addNotificationMessage(clientNotifications().ask_financial_risk_approval); } else if (FinancialAssessmentRequired) { From 240cd4ab0a8111b4ad6b1b4697961800d3de5045 Mon Sep 17 00:00:00 2001 From: "Ali(Ako) Hosseini" Date: Tue, 26 Oct 2021 10:05:34 +0330 Subject: [PATCH 2/2] feat: add proof notifications after real account creation --- .../status-dialog-container.jsx | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/packages/core/src/App/Containers/RealAccountSignup/status-dialog-container.jsx b/packages/core/src/App/Containers/RealAccountSignup/status-dialog-container.jsx index 09db5d5e47de..d9771b2240d3 100644 --- a/packages/core/src/App/Containers/RealAccountSignup/status-dialog-container.jsx +++ b/packages/core/src/App/Containers/RealAccountSignup/status-dialog-container.jsx @@ -9,6 +9,8 @@ import { EXPERIAN, getExperianResult } from './helpers/constants'; import { DialogHeading } from './helpers/dialog-heading.jsx'; import { DialogMessage } from './helpers/dialog-message.jsx'; import { DialogButtons } from './helpers/dialog-buttons.jsx'; +import { populateVerificationStatus } from '@deriv/account'; +import { clientNotifications } from '../../../Stores/Helpers/client-notifications'; const MainIcon = ({ currency }) => ; const Checkmark = ({ className }) => ; @@ -32,6 +34,8 @@ const StatusDialogContainer = ({ is_isle_of_man_residence, landing_company_shortcode, switchToVirtual, + account_status, + addNotificationMessage, }) => { const closeModalAndOpenCashier = () => { closeModal(); @@ -47,6 +51,16 @@ const StatusDialogContainer = ({ closeModal(); history.push(routes.proof_of_address); }; + const closeModalAndAddProofsNotifications = () => { + const { has_poa, has_poi } = populateVerificationStatus(account_status); + if (!has_poi) { + addNotificationMessage(clientNotifications().verify_poi); + } + if (!has_poa) { + addNotificationMessage(clientNotifications().verify_poa); + } + closeModal(); + }; /** * Get the status for the current account @@ -92,7 +106,7 @@ const StatusDialogContainer = ({ /> ({ +export default connect(({ client, ui }) => ({ + addNotificationMessage: ui.addNotificationMessage, + account_status: client.account_status, country_standpoint: client.country_standpoint, landing_company_shortcode: client.landing_company_shortcode, is_fully_authenticated: client.is_fully_authenticated,