Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all 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
15 changes: 11 additions & 4 deletions src/javascript/app/base/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ const Header = (() => {

const buildMessage = (string, path, hash = '') => template(string, [`<a href="${Url.urlFor(path)}${hash}">`, '</a>']);
const buildSpecificMessage = (string, additional) => template(string, [...additional]);
const buildMessageHref = (string, href) => template(string, [`<a href="${href}" target="_blank">`, '</a>']);
const hasStatus = (string) => status.findIndex(s => s === string) < 0 ? Boolean(false) : Boolean(true);
const hasVerification = (string) => {
const { prompt_client_to_authenticate } = get_account_status;
Expand Down Expand Up @@ -357,6 +358,7 @@ const Header = (() => {

const messages = {
cashier_locked : () => localize('Deposits and withdrawals have been disabled on your account. Please check your email for more details.'),
system_maintenance : () => buildMessageHref(localizeKeepPlaceholders('We’re updating our cashier system and it’ll be back online soon. Please see our [_1]status page[_2] for updates.'), 'https://deriv.statuspage.io/'),
currency : () => buildMessage(localizeKeepPlaceholders('Please set the [_1]currency[_2] of your account.'), 'user/set-currency'),
unsubmitted : () => buildMessage(localizeKeepPlaceholders('Please submit your [_1]proof of identity and proof of address[_2].'), 'user/authenticate'),
expired : () => buildSpecificMessage(localizeKeepPlaceholders('Your [_1]proof of identity[_3] and [_2]proof of address[_3] have expired.'), [`<a href='${Url.urlFor('user/authenticate')}'>`, `<a href='${Url.urlFor('user/authenticate')}?authentication_tab=poa'>`, '</a>']),
Expand Down Expand Up @@ -385,6 +387,7 @@ const Header = (() => {

const validations = {
cashier_locked : () => hasStatus('cashier_locked'),
system_maintenance : () => hasStatus('system_maintenance'),
currency : () => !Client.get('currency'),
unsubmitted : () => hasVerification('unsubmitted'),
expired : () => hasVerification('expired'),
Expand Down Expand Up @@ -429,6 +432,7 @@ const Header = (() => {
'document',
'unwelcome',
'no_withdrawal_or_trading',
'system_maintenance',
'cashier_locked',
'withdrawal_locked_review',
'withdrawal_locked',
Expand Down Expand Up @@ -456,11 +460,14 @@ const Header = (() => {
} else {
const el_account_status = createElement('span', { class: 'authenticated', 'data-balloon': localize('Account Authenticated'), 'data-balloon-pos': 'down' });
BinarySocket.wait('website_status', 'get_account_status', 'get_settings', 'balance').then(() => {
authentication = State.getResponse('get_account_status.authentication') || {};
get_account_status = State.getResponse('get_account_status') || {};
status = get_account_status.status;
/* eslint-disable max-len */
authentication = State.getResponse('get_account_status.authentication') || {};
get_account_status = State.getResponse('get_account_status') || {};
const has_cashier_validation = !!get_account_status.cashier_validation;
const cashier_validation = has_cashier_validation ? [...get_account_status.cashier_validation] : [];
status = [...cashier_validation , ...get_account_status.status];
checkStatus(check_statuses_real);
is_fully_authenticated = hasStatus('authenticated') && !+get_account_status.prompt_client_to_authenticate;
is_fully_authenticated = hasStatus('authenticated') && !+get_account_status.prompt_client_to_authenticate;
$('.account-id')[is_fully_authenticated ? 'append' : 'remove'](el_account_status);
});
}
Expand Down
14 changes: 11 additions & 3 deletions src/javascript/app/pages/cashier/deposit_withdraw.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const isBinaryApp = require('../../../config').isBinaryApp;

const DepositWithdraw = (() => {
const default_iframe_height = 700;

let response_withdrawal = {};

let cashier_type,
Expand Down Expand Up @@ -257,11 +256,20 @@ const DepositWithdraw = (() => {
}

await BinarySocket.send({ get_account_status: 1 });

// cannot use State.getResponse because we want to check error which is outside of response[msg_type]
const response_get_account_status = State.get(['response', 'get_account_status']);
if (!response_get_account_status.error) {
const is_crypto = Currency.isCryptocurrency(Client.get('currency'));
if (/cashier_locked/.test(response_get_account_status.get_account_status.status)) {
if (/system_maintenance/.test(response_get_account_status.get_account_status.cashier_validation)) {
if (is_crypto) {
showError('custom_error', localize('Our cryptocurrency cashier is temporarily down due to system maintenance. You can access the cashier as soon as the maintenance is complete..'));
} else {
showError('custom_error', localize('Our cashier is temporarily down due to system maintenance. You can access the cashier as soon as the maintenance is complete.'));
}
return;
}
if (/ASK_UK_FUNDS_PROTECTION/.test(response_get_account_status.get_account_status.cashier_validation)) {
initUKGC();
return;
Expand All @@ -270,7 +278,7 @@ const DepositWithdraw = (() => {
showError('limits_error');
return;
}

showError('custom_error', localize('Your cashier is locked.')); // Locked from BO
return;
}
Expand Down