#StackBounty: #scala Mobile number validation issue with google i18 package

Bounty: 50

I am using google i18 package

package com.google.i18n.phonenumbers;

 private val mobileRule = genValidation("mobile", _.notificationChannels.find(_.channel == "mobile").forall { channel =>
      channel.channelId.exists(number => !numberUtil.isValidNumber(numberUtil.parse(number, "GB")))
    }, "the mobile number entered is not valid or has not been entered")
    
    private val landlineRule = genValidation("landline", _.notificationChannels.find(_.channel == "landline").exists { channel =>
      channel.channelId.exists(number => !numberUtil.isValidNumber(numberUtil.parse(number, "GB")))
    }, "the landline number entered is not valid")
    

With this i18 package if i pass a 17 digit mobile number then it accept otherwise it gives me 500 error can somebody help me on that so that if i pass greater than digit 10 it gives me some type of error like mobile number is incorrect.

With the above code If I pass less than 10 then gives me error that is mobile number is incorrect which is fine but I want if i pass greater then 10 also in that case it gives me 500 error.

Please help if anyone have idea.


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.