More stripe integration #6649

Closed
mayeaux wants to merge 17 commits from more-stripe-integration into master
Showing only changes of commit e84c2c91c4 - Show all commits

View file

@ -321,41 +321,22 @@ function WalletSendTip(props: Props) {
function handleCustomPriceChange(event: SyntheticInputEvent<*>) {
console.log(event.target.value);
let tipAmountAsString = event.target.value;
let tipAmount = parseFloat(tipAmountAsString);
const howManyDecimals = countDecimals(tipAmountAsString);
// allow maximum two decimals
if (activeTab === TAB_FIAT) {
console.log(tipAmount);
console.log(Number.isNaN(tipAmount))
if (Number.isNaN(tipAmount)) {
setCustomTipAmount('');
}
const howManyDecimals = countDecimals(tipAmountAsString);
console.log('how many decimals');
console.log(howManyDecimals)
if (howManyDecimals > 2) {
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;
@ -368,6 +349,11 @@ function WalletSendTip(props: Props) {
setCustomTipAmount(tipAmount);
}
} else {
if (howManyDecimals > 9) {
tipAmount = Number(tipAmount.toString().match(/^-?\d+(?:\.\d{0,8})?/)[0]);
setTipError('Please only use up to 8 decimals')
}
jessopb commented 2021-07-29 23:45:28 +02:00 (Migrated from github.com)
Review

MAXIMUM_FIAT_TIP

MAXIMUM_FIAT_TIP
setCustomTipAmount(tipAmount);
jessopb commented 2021-07-29 23:46:10 +02:00 (Migrated from github.com)
Review

repeated text, without i18n

repeated text, without i18n
}
}
@ -601,7 +587,6 @@ function WalletSendTip(props: Props) {
<FormField
autoFocus
name="tip-input"
className="send__tip_input"
label={
<React.Fragment>
{__('Custom support amount')}{' '}