More stripe integration #6649
1 changed files with 7 additions and 22 deletions
|
@ -321,41 +321,22 @@ function WalletSendTip(props: Props) {
|
||||||
|
|
||||||
function handleCustomPriceChange(event: SyntheticInputEvent<*>) {
|
function handleCustomPriceChange(event: SyntheticInputEvent<*>) {
|
||||||
|
|
||||||
console.log(event.target.value);
|
|
||||||
|
|
||||||
let tipAmountAsString = event.target.value;
|
let tipAmountAsString = event.target.value;
|
||||||
|
|
||||||
let tipAmount = parseFloat(tipAmountAsString);
|
let tipAmount = parseFloat(tipAmountAsString);
|
||||||
|
|
||||||
|
const howManyDecimals = countDecimals(tipAmountAsString);
|
||||||
|
|
||||||
// allow maximum two decimals
|
// allow maximum two decimals
|
||||||
if (activeTab === TAB_FIAT) {
|
if (activeTab === TAB_FIAT) {
|
||||||
|
|
||||||
console.log(tipAmount);
|
|
||||||
|
|
||||||
console.log(Number.isNaN(tipAmount))
|
|
||||||
|
|
||||||
if (Number.isNaN(tipAmount)) {
|
if (Number.isNaN(tipAmount)) {
|
||||||
setCustomTipAmount('');
|
setCustomTipAmount('');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const howManyDecimals = countDecimals(tipAmountAsString);
|
|
||||||
|
|
||||||
console.log('how many decimals');
|
|
||||||
console.log(howManyDecimals)
|
|
||||||
|
|
||||||
if (howManyDecimals > 2) {
|
if (howManyDecimals > 2) {
|
||||||
tipAmount = Math.floor(tipAmount * 100) / 100;
|
tipAmount = Math.floor(tipAmount * 100) / 100;
|
||||||
// setTipError('Value can only have two decimal places');
|
|
||||||
}
|
}
|
||||||
// else {
|
|
||||||
// tipAmount = ((tipAmount * 100) / 100).toFixed(2);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// console.log(howManyDecimals);
|
|
||||||
|
|
||||||
console.log(tipAmount);
|
|
||||||
|
|
||||||
const howManyDigits = Math.trunc(tipAmount).toString().length;
|
const howManyDigits = Math.trunc(tipAmount).toString().length;
|
||||||
|
|
||||||
|
@ -368,6 +349,11 @@ function WalletSendTip(props: Props) {
|
||||||
setCustomTipAmount(tipAmount);
|
setCustomTipAmount(tipAmount);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (howManyDecimals > 9) {
|
||||||
|
tipAmount = Number(tipAmount.toString().match(/^-?\d+(?:\.\d{0,8})?/)[0]);
|
||||||
|
|
||||||
|
setTipError('Please only use up to 8 decimals')
|
||||||
|
}
|
||||||
|
|||||||
setCustomTipAmount(tipAmount);
|
setCustomTipAmount(tipAmount);
|
||||||
repeated text, without i18n repeated text, without i18n
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -601,7 +587,6 @@ function WalletSendTip(props: Props) {
|
||||||
<FormField
|
<FormField
|
||||||
autoFocus
|
autoFocus
|
||||||
name="tip-input"
|
name="tip-input"
|
||||||
className="send__tip_input"
|
|
||||||
label={
|
label={
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
{__('Custom support amount')}{' '}
|
{__('Custom support amount')}{' '}
|
||||||
|
|
Loading…
Reference in a new issue
MAXIMUM_FIAT_TIP