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

Akmal / Add onfido name comparison notifications #5129

Merged
merged 5 commits into from
Apr 28, 2022
Merged
Changes from 2 commits
Commits
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
60 changes: 51 additions & 9 deletions packages/core/src/Stores/notification-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,15 @@ export default class NotificationStore extends BaseStore {

const hidden_close_account_notification =
parseInt(localStorage.getItem('hide_close_mx_mlt_account_notification')) === 1;
const { cashier_locked, withdrawal_locked, deposit_locked, mt5_withdrawal_locked, document_needs_action } =
getStatusValidations(status || []);
const {
cashier_locked,
deposit_locked,
document_needs_action,
mt5_withdrawal_locked,
personal_details_locked,
poi_name_mismatch,
withdrawal_locked,
} = getStatusValidations(status || []);

if (obj_total_balance.amount_real > 0) {
this.addNotificationMessage(this.client_notifications.two_f_a);
Expand Down Expand Up @@ -245,14 +252,23 @@ export default class NotificationStore extends BaseStore {
ASK_UK_FUNDS_PROTECTION,
} = cashier_validation ? getCashierValidations(cashier_validation) : {};

this.addVerificationNotifications(identity, document);
const needs_poa =
is_10k_withdrawal_limit_reached &&
(needs_verification.includes('document') || document?.status !== 'verified');
const needs_poi = is_10k_withdrawal_limit_reached && identity?.status !== 'verified';
const onfido_submissions_left = identity.services.onfido.submissions_left;

this.addVerificationNotifications(identity, document);

if (needs_poa) this.addNotificationMessage(this.client_notifications.needs_poa);
if (needs_poi) this.addNotificationMessage(this.client_notifications.needs_poi);
if (poi_name_mismatch && identity.services.onfido.last_rejected) {
akmal-deriv marked this conversation as resolved.
Show resolved Hide resolved
if (!personal_details_locked && onfido_submissions_left > 0) {
yashim-deriv marked this conversation as resolved.
Show resolved Hide resolved
this.addNotificationMessage(this.client_notifications.poi_name_mismatch);
} else {
this.addNotificationMessage(this.client_notifications.onfido_failed);
}
}
if (system_maintenance) {
this.setClientNotifications(client);
this.addNotificationMessage(
Expand Down Expand Up @@ -441,10 +457,12 @@ export default class NotificationStore extends BaseStore {
}

@action.bound
setClientNotifications(client = {}) {
setClientNotifications(client_data = {}) {
const { ui, client } = this.root_store;
const mx_mlt_custom_header = this.custom_notifications.mx_mlt_notification.header();
const mx_mlt_custom_content = this.custom_notifications.mx_mlt_notification.main();
const { ui } = this.root_store;
const client_name =
client.account_status.authentication.identity.services.onfido.reported_properties.first_name;
akmal-deriv marked this conversation as resolved.
Show resolved Hide resolved

const notifications = {
ask_financial_risk_approval: {
Expand Down Expand Up @@ -676,7 +694,7 @@ export default class NotificationStore extends BaseStore {
needs_poi_virtual: {
action: {
onClick: async () => {
const { switchAccount, first_switchable_real_loginid } = client;
const { switchAccount, first_switchable_real_loginid } = client_data;

await switchAccount(first_switchable_real_loginid);
},
Expand Down Expand Up @@ -726,12 +744,36 @@ export default class NotificationStore extends BaseStore {
},
type: 'warning',
},
onfido_failed: {
key: 'onfido_failed',
header: localize("You've reached the limit for uploading your documents."),
message: localize('Please contact us via live chat.'),
action: {
onClick: () => {
window.LC_API.open_chat_window();
},
text: localize('Go to live chat'),
},
type: 'danger',
},
password_changed: {
key: 'password_changed',
header: localize('Password updated.'),
message: <Localize i18n_default_text='Please log in with your updated password.' />,
type: 'info',
},
poi_name_mismatch: {
action: {
route: routes.personal_details,
text: localize('Personal details'),
},
key: 'poi_name_mismatch',
header: localize('What’s your real name, {{client_name}}?', { client_name }),
message: localize(
'It appears that the name in your document doesn’t match the name in your Deriv profile. Please update your name in the Personal details page now.'
),
type: 'warning',
},
required_fields: (withdrawal_locked, deposit_locked) => {
let message;
if (withdrawal_locked) {
Expand Down Expand Up @@ -761,7 +803,7 @@ export default class NotificationStore extends BaseStore {
reset_virtual_balance: {
key: 'reset_virtual_balance',
header: localize('Reset your balance'),
message: client.message,
message: client_data.message,
type: 'info',
is_persistent: true,
should_show_again: true,
Expand All @@ -770,7 +812,7 @@ export default class NotificationStore extends BaseStore {
action: {
text: localize('Reset balance'),
onClick: async () => {
await client.resetVirtualBalance();
await client_data.resetVirtualBalance();
},
},
},
Expand Down Expand Up @@ -808,7 +850,7 @@ export default class NotificationStore extends BaseStore {
},
system_maintenance: (withdrawal_locked, deposit_locked) => {
let message, header;
if (isCryptocurrency(client.currency)) {
if (isCryptocurrency(client_data.currency)) {
if (withdrawal_locked) {
header = localize('Unable to process withdrawals in the moment');
message = localize(
Expand Down