|
@@ -140,11 +140,11 @@ const Withdraw = () => {
|
|
|
case "account_no":
|
|
|
{
|
|
|
if (currentType.type === ChannelEnum.CPF) {
|
|
|
- const toValue = inputNumber(curValue, { length: 11 });
|
|
|
+ const toValue = inputNumber(curValue, { length: 11, notNumber: true });
|
|
|
formInstanceRef.current?.setFieldValue(key, toValue);
|
|
|
}
|
|
|
if (currentType.type === ChannelEnum.CNPJ) {
|
|
|
- const toValue = inputNumber(curValue, { length: 14 });
|
|
|
+ const toValue = inputNumber(curValue, { length: 14, notNumber: true });
|
|
|
formInstanceRef.current?.setFieldValue(key, toValue);
|
|
|
}
|
|
|
if (currentType.type === ChannelEnum.Phone) {
|
|
@@ -159,7 +159,7 @@ const Withdraw = () => {
|
|
|
break;
|
|
|
case "passport":
|
|
|
{
|
|
|
- const toValue = inputNumber(curValue, { length: 11 });
|
|
|
+ const toValue = inputNumber(curValue, { length: 11, notNumber: true });
|
|
|
formInstanceRef.current?.setFieldValue(key, toValue);
|
|
|
}
|
|
|
break;
|
|
@@ -172,16 +172,21 @@ const Withdraw = () => {
|
|
|
opts?: {
|
|
|
max?: number;
|
|
|
length?: number;
|
|
|
+ notNumber?: boolean;
|
|
|
}
|
|
|
) => {
|
|
|
const toValue = value.replace(/[^0-9]/gi, "");
|
|
|
let toAmount = "";
|
|
|
- if (toValue) {
|
|
|
+ if (toValue && !opts?.notNumber) {
|
|
|
toAmount = new BigNumber(toValue).toFixed(0, BigNumber.ROUND_DOWN);
|
|
|
+ if (opts?.max !== undefined && new BigNumber(toAmount).isGreaterThan(opts.max)) {
|
|
|
+ toAmount = opts.max.toString();
|
|
|
+ }
|
|
|
}
|
|
|
- if (opts?.max !== undefined && new BigNumber(toAmount).isGreaterThan(opts.max)) {
|
|
|
- toAmount = opts.max.toString();
|
|
|
+ if (toValue && opts?.notNumber) {
|
|
|
+ toAmount = toValue;
|
|
|
}
|
|
|
+
|
|
|
if (opts?.length && toAmount.length > opts.length) {
|
|
|
toAmount = toAmount.slice(0, opts.length);
|
|
|
}
|