diff --git a/packages/p2p/src/components/app-content.jsx b/packages/p2p/src/components/app-content.jsx index bb3225dd48ab..962c2a68be46 100644 --- a/packages/p2p/src/components/app-content.jsx +++ b/packages/p2p/src/components/app-content.jsx @@ -51,7 +51,7 @@ const AppContent = ({ order_id }) => { return ; } - if (general_store.should_show_dp2p_blocked || general_store.is_p2p_blocked_for_pa) { + if (general_store.should_show_dp2p_blocked) { return ; } diff --git a/packages/p2p/src/components/dp2p-blocked/dp2p-blocked-checklist.jsx b/packages/p2p/src/components/dp2p-blocked/dp2p-blocked-checklist.jsx index 6da39a0ecd44..f25f66522340 100644 --- a/packages/p2p/src/components/dp2p-blocked/dp2p-blocked-checklist.jsx +++ b/packages/p2p/src/components/dp2p-blocked/dp2p-blocked-checklist.jsx @@ -10,7 +10,7 @@ const Dp2pBlockedChecklist = () => { const { general_store } = useStores(); const history = useHistory(); - if (general_store.is_high_risk_fully_authed_without_fa && !general_store.is_p2p_blocked_for_pa) { + if (general_store.is_high_risk && !general_store.is_blocked) { const checklist_items = [ { content: localize('Complete the financial assessment form'), diff --git a/packages/p2p/src/components/dp2p-blocked/dp2p-blocked-description.jsx b/packages/p2p/src/components/dp2p-blocked/dp2p-blocked-description.jsx index aa65a31c4757..fedfff82b7b1 100644 --- a/packages/p2p/src/components/dp2p-blocked/dp2p-blocked-description.jsx +++ b/packages/p2p/src/components/dp2p-blocked/dp2p-blocked-description.jsx @@ -7,24 +7,15 @@ import { Localize } from '../i18next'; const Dp2pBlockedDescription = () => { const { general_store } = useStores(); - let blocked_description; - - if (general_store.is_high_risk_fully_authed_without_fa) { + const getBlockedDescription = () => { if (general_store.is_p2p_blocked_for_pa) { - blocked_description = ( + return ( ); - } else { - blocked_description = ( - - ); + } else if (general_store.is_high_risk && !general_store.is_blocked) { + return ; } - } else if (general_store.is_p2p_blocked_for_pa) { - blocked_description = ( - - ); - } else { - blocked_description = ( + return ( { ]} /> ); - } + }; return ( - {blocked_description} + {getBlockedDescription()} ); }; diff --git a/packages/p2p/src/stores/general-store.js b/packages/p2p/src/stores/general-store.js index b12eef1e1fbe..75c6d10acab6 100644 --- a/packages/p2p/src/stores/general-store.js +++ b/packages/p2p/src/stores/general-store.js @@ -32,7 +32,7 @@ export default class GeneralStore extends BaseStore { is_blocked = false; is_block_unblock_user_loading = false; is_block_user_modal_open = false; - is_high_risk_fully_authed_without_fa = false; + is_high_risk = false; is_listed = false; is_loading = false; is_modal_open = false; @@ -51,6 +51,7 @@ export default class GeneralStore extends BaseStore { should_show_popup = false; user_blocked_count = 0; user_blocked_until = null; + is_modal_open = false; list_item_limit = isMobile() ? 10 : 50; path = { @@ -91,6 +92,7 @@ export default class GeneralStore extends BaseStore { is_blocked: observable, is_block_unblock_user_loading: observable, is_block_user_modal_open: observable, + is_high_risk: observable, is_listed: observable, is_loading: observable, is_p2p_blocked_for_pa: observable, @@ -107,7 +109,6 @@ export default class GeneralStore extends BaseStore { should_show_popup: observable, user_blocked_count: observable, user_blocked_until: observable, - is_high_risk_fully_authed_without_fa: observable, is_modal_open: observable, blocked_until_date_time: computed, is_active_tab: computed, @@ -141,7 +142,7 @@ export default class GeneralStore extends BaseStore { setInactiveNotificationCount: action.bound, setIsAdvertiser: action.bound, setIsBlocked: action.bound, - setIsHighRiskFullyAuthedWithoutFa: action.bound, + setIsHighRisk: action.bound, setIsListed: action.bound, setIsLoading: action.bound, setIsP2pBlockedForPa: action.bound, @@ -191,7 +192,7 @@ export default class GeneralStore extends BaseStore { } get should_show_dp2p_blocked() { - return this.is_blocked || this.is_high_risk_fully_authed_without_fa; + return this.is_blocked || this.is_high_risk || this.is_p2p_blocked_for_pa; } blockUnblockUser(should_block, advertiser_id, should_set_is_counterparty_blocked = true) { @@ -419,7 +420,7 @@ export default class GeneralStore extends BaseStore { onMount() { this.setIsLoading(true); this.setIsBlocked(false); - this.setIsHighRiskFullyAuthedWithoutFa(false); + this.setIsHighRisk(false); this.setIsP2pBlockedForPa(false); this.disposeUserBarredReaction = reaction( @@ -438,37 +439,36 @@ export default class GeneralStore extends BaseStore { requestWS({ get_account_status: 1 }).then(({ error, get_account_status }) => { const hasStatuses = statuses => statuses.every(status => get_account_status.status.includes(status)); + const is_authenticated = hasStatuses(['authenticated']); const is_blocked_for_pa = hasStatuses(['p2p_blocked_for_pa']); + const is_fa_not_complete = hasStatuses(['financial_assessment_not_complete']); if (error) { - this.setIsHighRiskFullyAuthedWithoutFa(false); + this.setIsHighRisk(false); this.setIsBlocked(false); this.setIsP2pBlockedForPa(false); + } else if (get_account_status.p2p_status === 'perm_ban') { + this.setIsBlocked(true); } else if (get_account_status.risk_classification === 'high') { const is_cashier_locked = hasStatuses(['cashier_locked']); - - const is_fully_authenticated = hasStatuses(['age_verification', 'authenticated']); const is_not_fully_authenticated = !hasStatuses(['age_verification', 'authenticated']); - const is_fully_authed_but_poi_expired = hasStatuses(['authenticated', 'document_expired']); - const is_fully_authed_but_needs_fa = - is_fully_authenticated && hasStatuses(['financial_assessment_not_complete']); - const is_not_fully_authenticated_and_fa_not_completed = - is_not_fully_authenticated && hasStatuses(['financial_assessment_not_complete']); - - if (is_fully_authed_but_needs_fa) { - // First priority: Send user to Financial Assessment if they have to submit it. - this.setIsHighRiskFullyAuthedWithoutFa(true); - } else if ( - is_cashier_locked || - is_not_fully_authenticated || - is_fully_authed_but_poi_expired || - is_not_fully_authenticated_and_fa_not_completed + is_not_fully_authenticated && is_fa_not_complete; + + if ( + is_authenticated && + (is_cashier_locked || + is_not_fully_authenticated || + is_fully_authed_but_poi_expired || + is_not_fully_authenticated_and_fa_not_completed) ) { - // Second priority: If user is blocked, don't bother asking them to submit FA. this.setIsBlocked(true); } + + if (!is_authenticated && !is_fa_not_complete) this.setIsBlocked(true); + + if (is_fa_not_complete) this.setIsHighRisk(true); } if (is_blocked_for_pa) { @@ -672,8 +672,8 @@ export default class GeneralStore extends BaseStore { this.is_block_unblock_user_loading = is_block_unblock_user_loading; } - setIsHighRiskFullyAuthedWithoutFa(is_high_risk_fully_authed_without_fa) { - this.is_high_risk_fully_authed_without_fa = is_high_risk_fully_authed_without_fa; + setIsHighRisk(is_high_risk) { + this.is_high_risk = is_high_risk; } setIsListed(is_listed) {