Skip to content

Commit

Permalink
adrienne/thisyahlen: fixed an issue where mt5 password creation for d…
Browse files Browse the repository at this point in the history
…emo is error (binary-com#10778)

* chore: fixed an issue where password creation for demo is error

* chore: revert current changes in merge conflict

* chore: revert current changes in merge conflict
  • Loading branch information
adrienne-deriv committed Oct 18, 2023
1 parent f9ced71 commit da9a72d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
useMT5AccountsList,
useSettings,
useSortedMT5Accounts,
useTradingPlatformPasswordChange,
} from '@deriv/api';
import { ModalWrapper, WalletButton } from '../../../../components/Base';
import MT5PasswordIcon from '../../../../public/images/ic-mt5-password.svg';
Expand All @@ -31,6 +32,7 @@ const marketTypeToPlatformTitleMapper: Record<string, string> = {
const MT5PasswordModal: React.FC<TProps> = ({ marketType, platform }) => {
const [password, setPassword] = useState('');
const { isSuccess, mutate } = useCreateMT5Account();
const { mutate: tradingPasswordChange } = useTradingPlatformPasswordChange();
const { data: activeWallet } = useActiveWalletAccount();
const { data: mt5Accounts } = useMT5AccountsList();
const { data: availableMT5Accounts } = useAvailableMT5Accounts();
Expand All @@ -44,9 +46,16 @@ const MT5PasswordModal: React.FC<TProps> = ({ marketType, platform }) => {
? marketTypeToPlatformTitleMapper[platform]
: marketTypeToTitleMapper[marketType];

const onSubmit = () => {
const onSubmit = async () => {
const accountType = marketType === 'synthetic' ? 'gaming' : marketType;

// in order to create account, we need to set a password through trading_platform_password_change endpoint first
// then only mt5_create_account can be called, otherwise it will response an error for password required
await tradingPasswordChange({
new_password: password,
platform: 'mt5',
});

mutate({
payload: {
account_type: activeWallet?.is_virtual ? 'demo' : accountType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@ const JurisdictionScreen: FC<TJurisdictionScreenProps> = ({ selectedJurisdiction
Add Your Deriv MT5 Financial account under Deriv (V) Ltd, regulated by the Vanuatu Financial
Services Commission.
<div className='wallets-jurisdiction-screen__tnc-checkbox'>
<input type='checkbox' />
<WalletText>I confirm and accept Deriv (V) Ltd’s Terms and Conditions</WalletText>
<input id='tnc-checkbox' type='checkbox' />
<label htmlFor='tnc-checkbox' style={{ cursor: 'pointer' }}>
<WalletText>I confirm and accept Deriv (V) Ltd&lsquo;s Terms and Conditions</WalletText>
</label>
</div>
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const Success: React.FC<TSuccessProps> = ({ description, marketType, platform, r
platform={platform}
/>
<WalletText lineHeight='3xs' size='2xs'>
{marketTypeTitle} ({landingCompanyName})
{marketTypeTitle} {!isDemo && `(${landingCompanyName})`}
</WalletText>
{/* <div className='wallets-success__info__text--type'></div> */}
<WalletText color='primary' lineHeight='sm' size='2xs'>
Expand Down

0 comments on commit da9a72d

Please sign in to comment.