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

[COJ] Evgeniy/coj-266/Add "I dont have any of these to idv options and redirect to manual" #11996

Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7647e66
chore: [COJ] Evgeniy/coj-266/add I dont have any of these to idv opti…
Dec 4, 2023
e025223
fix: unused imports remove
Dec 5, 2023
02c800d
Merge branch 'master' of github.com:binary-com/deriv-app into coj-266…
Dec 5, 2023
82d05c8
Merge branch 'binary-com:master' into coj-266/redirect_to_manual_if_i…
yauheni-deriv Dec 5, 2023
86ce2f3
Merge branch 'binary-com:master' into coj-266/redirect_to_manual_if_i…
yauheni-deriv Dec 6, 2023
3ed75be
Merge branch 'binary-com:master' into coj-266/redirect_to_manual_if_i…
yauheni-deriv Dec 7, 2023
2288862
Merge branch 'binary-com:master' into coj-266/redirect_to_manual_if_i…
yauheni-deriv Dec 8, 2023
d7775f8
Merge branch 'binary-com:master' into coj-266/redirect_to_manual_if_i…
yauheni-deriv Dec 8, 2023
c8b1dbf
fix: resolve conflicts
Dec 12, 2023
fca81d4
fix: resolve conflicts
Dec 15, 2023
431741e
Merge branch 'binary-com:master' into coj-266/redirect_to_manual_if_i…
yauheni-deriv Dec 15, 2023
ea9d550
Merge branch 'binary-com:master' into coj-266/redirect_to_manual_if_i…
yauheni-deriv Dec 18, 2023
eb53378
Merge branch 'binary-com:master' into coj-266/redirect_to_manual_if_i…
yauheni-deriv Dec 19, 2023
2eea59e
Merge branch 'binary-com:master' into coj-266/redirect_to_manual_if_i…
yauheni-deriv Dec 20, 2023
e67341f
Merge branch 'binary-com:master' into coj-266/redirect_to_manual_if_i…
yauheni-deriv Dec 21, 2023
95f2b28
fix: subcards
yauheni-deriv Dec 22, 2023
dee7624
fix: remove back button for manual mt5
yauheni-deriv Dec 22, 2023
89ba7a9
fix: max-width for manual mt5
yauheni-deriv Dec 22, 2023
0f4fefa
fix: idvfailed styles
yauheni-deriv Dec 22, 2023
4957605
Merge branch 'master' into coj-266/redirect_to_manual_if_i_dont_have_…
likhith-deriv Dec 22, 2023
06cc20c
Merge branch 'master' into coj-266/redirect_to_manual_if_i_dont_have_…
likhith-deriv Dec 22, 2023
59846d3
fix: manual styles for mt5
yauheni-deriv Dec 24, 2023
cc184c1
fix: idv to manual flow for mt5 (#39)
likhith-deriv Dec 24, 2023
95f14c2
Merge branch 'master' into coj-266/redirect_to_manual_if_i_dont_have_…
likhith-deriv Dec 26, 2023
ada3320
Merge branch 'binary-com:master' into coj-266/redirect_to_manual_if_i…
yauheni-deriv Dec 26, 2023
e262190
fix: added null check
likhith-deriv Dec 26, 2023
968df00
fix: identity page styling
yauheni-deriv Dec 26, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,27 @@ describe('<IDVForm/>', () => {
});
expect(await screen.findByText('Example: 0123456789')).toBeInTheDocument();
});

it("Should hide document number field when 'I dont have any of these is chosen'", async () => {
render(<IDVForm {...mock_props} />, {
wrapper: ({ children }) => (
<Formik initialValues={mock_values} onSubmit={jest.fn()}>
{() => children}
</Formik>
),
});

const document_type_input = screen.getByLabelText('Choose the document type');
const document_number_input = screen.getByText('Enter your document number');

expect(document_type_input).toBeVisible();
expect(document_number_input).toBeVisible();

userEvent.click(document_type_input);
userEvent.type(document_type_input, "I don't have any of these");

await waitFor(() => {
expect(document_number_input).not.toBeVisible();
});
});
});
19 changes: 12 additions & 7 deletions packages/account/src/Components/forms/idv-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ type TIDVFormProps = {
selected_country: ResidenceList[0];
hide_hint?: boolean;
class_name?: string;
can_skip_document_verification?: boolean;
is_for_real_account_signup_modal?: boolean;
is_for_mt5: boolean;
};

const IDVForm = ({
class_name,
selected_country,
hide_hint,
can_skip_document_verification = false,
is_for_real_account_signup_modal = false,
is_for_mt5 = false,
}: TIDVFormProps) => {
const [document_list, setDocumentList] = React.useState<Array<TDocument>>([]);
const [selected_doc, setSelectedDoc] = React.useState('');
Expand All @@ -40,7 +42,10 @@ const IDVForm = ({
example_format: '',
};

const IDV_NOT_APPLICABLE_OPTION = React.useMemo(() => getIDVNotApplicableOption(), []);
const IDV_NOT_APPLICABLE_OPTION = React.useMemo(
() => getIDVNotApplicableOption(is_for_real_account_signup_modal),
[is_for_real_account_signup_modal]
);

React.useEffect(() => {
if (document_data && selected_country && selected_country.value) {
Expand Down Expand Up @@ -79,13 +84,13 @@ const IDVForm = ({
};
});

if (can_skip_document_verification) {
setDocumentList([...new_document_list, IDV_NOT_APPLICABLE_OPTION]);
} else {
if (is_for_mt5) {
setDocumentList([...new_document_list]);
} else {
setDocumentList([...new_document_list, IDV_NOT_APPLICABLE_OPTION]);
}
}
}, [document_data, selected_country, can_skip_document_verification, IDV_NOT_APPLICABLE_OPTION]);
}, [document_data, selected_country, IDV_NOT_APPLICABLE_OPTION, is_for_mt5]);

const resetDocumentItemSelected = () => {
setFieldValue('document_type', default_document, true);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import InlineNoteWithIcon from '../inline-note-with-icon';
import classNames from 'classnames';
import { Form, Formik } from 'formik';
import { Analytics } from '@deriv/analytics';
import {
AutoHeightWrapper,
Div100vhContainer,
Expand All @@ -12,6 +12,7 @@ import {
} from '@deriv/components';
import { getIDVNotApplicableOption, isDesktop, isMobile, removeEmptyPropertiesFromObject } from '@deriv/shared';
import { Localize, localize } from '@deriv/translations';
import { useStore, observer } from '@deriv/stores';
import {
isAdditionalDocumentValid,
isDocumentNumberValid,
Expand All @@ -22,10 +23,9 @@ import PoiNameDobExample from '../../Assets/ic-poi-name-dob-example.svg';
import FormSubHeader from '../form-sub-header';
import IDVForm from '../forms/idv-form';
import PersonalDetailsForm from '../forms/personal-details-form';
import InlineNoteWithIcon from '../inline-note-with-icon';
import { splitValidationResultTypes } from '../real-account-signup/helpers/utils';
import ScrollToFieldWithError from '../forms/scroll-to-field-with-error';
import { useStore, observer } from '@deriv/stores';
import { Analytics } from '@deriv/analytics';

const PersonalDetails = observer(
({
Expand Down Expand Up @@ -221,8 +221,8 @@ const PersonalDetails = observer(
<FormSubHeader title={localize('Identity verification')} />
<IDVForm
selected_country={selected_country}
hide_hint={true}
can_skip_document_verification={true}
hide_hint
is_for_real_account_signup_modal
/>
</React.Fragment>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const mock_store = mockStore({
client: {
getChangeableFields: jest.fn(() => []),
},
ui: { is_desktop: true },
});

jest.mock('Assets/ic-document-submit-icon.svg', () => jest.fn(() => 'DocumentSubmitLogo'));
Expand Down Expand Up @@ -59,6 +60,7 @@ jest.mock('@deriv/shared', () => ({
describe('<IdvDocumentSubmit/>', () => {
const mock_props: React.ComponentProps<typeof IdvDocumentSubmit> = {
handleBack: jest.fn(),
handleSelectionNext: jest.fn(),
handleViewComplete: jest.fn(),
selected_country: {
value: 'tc',
Expand Down Expand Up @@ -109,7 +111,7 @@ describe('<IdvDocumentSubmit/>', () => {
</StoreProvider>
);

const backBtn = screen.getByRole('button', { name: /go back/i });
const backBtn = screen.getByRole('button', { name: /back/i });
userEvent.click(backBtn);
expect(mock_props.handleBack).toHaveBeenCalledTimes(1);

Expand Down
Loading