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

Commit 38f4af1

Browse files
authored
farrah/fixed internal limit error (#6607)
* fixed internal limit error * fixed internal limit error * fixed eslint error * fix: added internal transfer limit error on load * trigger build * fix: minor modification
1 parent d065626 commit 38f4af1

File tree

2 files changed

+27
-12
lines changed

2 files changed

+27
-12
lines changed

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

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ const AccountTransfer = (() => {
1616
const form_id_hash = `#${form_id}`;
1717

1818
const messages = {
19-
parent : 'client_message',
20-
error : 'no_account',
21-
balance: 'not_enough_balance',
22-
deposit: 'no_balance',
19+
parent : 'client_message',
20+
error : 'no_account',
21+
balance : 'not_enough_balance',
22+
deposit : 'no_balance',
23+
transfer: 'transfer_not_allowed',
2324
};
2425

2526
let el_transfer_from,
@@ -244,10 +245,12 @@ const AccountTransfer = (() => {
244245
} else {
245246
const req_transfer_between_accounts = BinarySocket.send({ transfer_between_accounts: 1 });
246247
const get_account_status = BinarySocket.send({ get_account_status: 1 });
248+
const req_get_limits = BinarySocket.send({ get_limits: 1 });
247249

248-
Promise.all([req_transfer_between_accounts, get_account_status]).then(() => {
250+
Promise.all([req_transfer_between_accounts, get_account_status, req_get_limits]).then(() => {
249251
const response_transfer = State.get(['response', 'transfer_between_accounts']);
250252
const is_authenticated = State.getResponse('get_account_status.status').some(state => state === 'authenticated');
253+
const response_internal_transfer_limits = State.getResponse('get_limits.daily_transfers.internal');
251254

252255
if (hasError(response_transfer)) {
253256
return;
@@ -258,12 +261,20 @@ const AccountTransfer = (() => {
258261
return;
259262
}
260263

261-
populateAccounts(accounts);
262-
setLimits(min_amount, is_authenticated).then(() => {
263-
showForm({ is_authenticated });
264-
populateHints();
265-
});
266-
264+
const allowed_internal_transfer = response_internal_transfer_limits.allowed;
265+
const available_internal_transfer = response_internal_transfer_limits.available;
266+
if (available_internal_transfer === 0) {
267+
setLoadingVisibility(0);
268+
getElementById(messages.parent).setVisibility(1);
269+
elementTextContent(getElementById('allowed_internal_transfer'), allowed_internal_transfer);
270+
getElementById(messages.transfer).setVisibility(1);
271+
} else {
272+
populateAccounts(accounts);
273+
setLimits(min_amount, is_authenticated).then(() => {
274+
showForm({ is_authenticated });
275+
populateHints();
276+
});
277+
}
267278
});
268279
}
269280
});

src/templates/app/cashier/account_transfer.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React from 'react';
22
import Loading from '../../_common/components/loading.jsx';
33

44
const Row = ({ id }) => (
@@ -35,6 +35,10 @@ const AccountTransfer = () => (
3535
{it.L('Please [_1]deposit[_2] to your account.', `<a href='${it.url_for('cashier/forwardws?action=deposit')}'>`, '</a>')}
3636
&nbsp;
3737
</span>
38+
<span className='invisible' id='transfer_not_allowed'>
39+
{it.L('You can only perform up to [_1] transfers a day. Please try again tomorrow.', '<span id="allowed_internal_transfer"></span>')}
40+
&nbsp;
41+
</span>
3842
</p>
3943
</div>
4044

0 commit comments

Comments
 (0)