Skip to content

Commit bc84cfe

Browse files
committed
feat: add error message for overspend atttempts and spam
1 parent d0b19bc commit bc84cfe

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

app/sources/src/components/PaymentConfirmation/view.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,12 +259,37 @@ export class PaymentConfirmation extends Component {
259259
denominations[selectedDenomination].toString({
260260
omitDirection: true,
261261
}).fees,
262+
pendingRequestsSum:
263+
payments.estimate.error.pendingRequestsSum &&
264+
denominations[selectedDenomination].stringify(
265+
payments.estimate.error.pendingRequestsSum *
266+
denominations[selectedDenomination].price,
267+
{ omitDirection: true },
268+
),
262269
})}
263270
</Message>
264271
)}
265272
{payments.send.error && (
266273
<Message type="error">
267-
{t([`errors.${payments.send.error.code}`, 'errors.default'])}
274+
{t([`errors.${payments.send.error.code}`, 'errors.default'], {
275+
amountString:
276+
denominations &&
277+
denominations[selectedDenomination].toString({
278+
omitDirection: true,
279+
}).amount,
280+
feeString:
281+
denominations &&
282+
denominations[selectedDenomination].toString({
283+
omitDirection: true,
284+
}).fees,
285+
pendingRequestsSum:
286+
payments.send.error.pendingRequestsSum &&
287+
denominations[selectedDenomination].stringify(
288+
payments.send.error.pendingRequestsSum *
289+
denominations[selectedDenomination].price,
290+
{ omitDirection: true },
291+
),
292+
})}
268293
</Message>
269294
)}
270295
{payment.description ? (

app/sources/src/components/common/Message.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import styled from 'styled-components';
1515

1616
export const Message = styled.div`
1717
word-break: break-word;
18+
white-space: pre-wrap;
1819
display: flex;
1920
flex-direction: column;
2021
width: 100%;

app/sources/src/locales/en.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,16 @@ export default {
6161
'422MWA00': 'Invoice is already expired',
6262
'403RPA01':
6363
'You do not have enough balance to pay {{amountString}} with {{feeString}} payment fees',
64+
'403RPA07':
65+
'You have unfinished payment requests for {{pendingRequestsSum}} and your balance is not enough to pay them and {{amountString}} with {{feeString}} payment fees',
66+
'403RPA06': 'You trying to send payments too often.\nNeed to send frequently? Contact us!',
6467
default: 'Oops, something went wrong',
6568
},
6669
tips: {
6770
fees: {
6871
lightning: 'We are charging 0.5% fee\nfor all lightning payments you send',
69-
blockchain: 'We are charging 0.5% fee\n+ fixed 0.00006 BTC fee\nfor all blockchain payments you send',
72+
blockchain:
73+
'We are charging 0.5% fee\n+ fixed 0.00006 BTC fee\nfor all blockchain payments you send',
7074
},
7175
},
7276
account: {

0 commit comments

Comments
 (0)