Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.

Commit d9cca86

Browse files
Mahdiyeh/fix: suspend cryptocashier notification (#6670)
* fix suspend cryptocashier notification * align equals * fix opening link in new window * fix system maintanance error in cashier page * fix cashier_blocked_status notification * fix contents * fix cashier_locked status function
1 parent f0c7af2 commit d9cca86

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

src/javascript/app/base/header.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ const Header = (() => {
299299

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

358359
const messages = {
359360
cashier_locked : () => localize('Deposits and withdrawals have been disabled on your account. Please check your email for more details.'),
361+
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/'),
360362
currency : () => buildMessage(localizeKeepPlaceholders('Please set the [_1]currency[_2] of your account.'), 'user/set-currency'),
361363
unsubmitted : () => buildMessage(localizeKeepPlaceholders('Please submit your [_1]proof of identity and proof of address[_2].'), 'user/authenticate'),
362364
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>']),
@@ -385,6 +387,7 @@ const Header = (() => {
385387

386388
const validations = {
387389
cashier_locked : () => hasStatus('cashier_locked'),
390+
system_maintenance : () => hasStatus('system_maintenance'),
388391
currency : () => !Client.get('currency'),
389392
unsubmitted : () => hasVerification('unsubmitted'),
390393
expired : () => hasVerification('expired'),
@@ -429,6 +432,7 @@ const Header = (() => {
429432
'document',
430433
'unwelcome',
431434
'no_withdrawal_or_trading',
435+
'system_maintenance',
432436
'cashier_locked',
433437
'withdrawal_locked_review',
434438
'withdrawal_locked',
@@ -456,11 +460,14 @@ const Header = (() => {
456460
} else {
457461
const el_account_status = createElement('span', { class: 'authenticated', 'data-balloon': localize('Account Authenticated'), 'data-balloon-pos': 'down' });
458462
BinarySocket.wait('website_status', 'get_account_status', 'get_settings', 'balance').then(() => {
459-
authentication = State.getResponse('get_account_status.authentication') || {};
460-
get_account_status = State.getResponse('get_account_status') || {};
461-
status = get_account_status.status;
463+
/* eslint-disable max-len */
464+
authentication = State.getResponse('get_account_status.authentication') || {};
465+
get_account_status = State.getResponse('get_account_status') || {};
466+
const has_cashier_validation = !!get_account_status.cashier_validation;
467+
const cashier_validation = has_cashier_validation ? [...get_account_status.cashier_validation] : [];
468+
status = [...cashier_validation , ...get_account_status.status];
462469
checkStatus(check_statuses_real);
463-
is_fully_authenticated = hasStatus('authenticated') && !+get_account_status.prompt_client_to_authenticate;
470+
is_fully_authenticated = hasStatus('authenticated') && !+get_account_status.prompt_client_to_authenticate;
464471
$('.account-id')[is_fully_authenticated ? 'append' : 'remove'](el_account_status);
465472
});
466473
}

src/javascript/app/pages/cashier/deposit_withdraw.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ const isBinaryApp = require('../../../config').isBinaryApp;
1919

2020
const DepositWithdraw = (() => {
2121
const default_iframe_height = 700;
22-
2322
let response_withdrawal = {};
2423

2524
let cashier_type,
@@ -257,11 +256,20 @@ const DepositWithdraw = (() => {
257256
}
258257

259258
await BinarySocket.send({ get_account_status: 1 });
260-
259+
261260
// cannot use State.getResponse because we want to check error which is outside of response[msg_type]
262261
const response_get_account_status = State.get(['response', 'get_account_status']);
263262
if (!response_get_account_status.error) {
263+
const is_crypto = Currency.isCryptocurrency(Client.get('currency'));
264264
if (/cashier_locked/.test(response_get_account_status.get_account_status.status)) {
265+
if (/system_maintenance/.test(response_get_account_status.get_account_status.cashier_validation)) {
266+
if (is_crypto) {
267+
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..'));
268+
} else {
269+
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.'));
270+
}
271+
return;
272+
}
265273
if (/ASK_UK_FUNDS_PROTECTION/.test(response_get_account_status.get_account_status.cashier_validation)) {
266274
initUKGC();
267275
return;
@@ -270,7 +278,7 @@ const DepositWithdraw = (() => {
270278
showError('limits_error');
271279
return;
272280
}
273-
281+
274282
showError('custom_error', localize('Your cashier is locked.')); // Locked from BO
275283
return;
276284
}

0 commit comments

Comments
 (0)