Stricter sanitization of dispatch trade name in e-invoice then needed

HI @Smit_Vora

I realize that the sanitization done for trade name for dispatch address in einvoice is stricter than needed. The code for address title for dispatch address is:

"address_title": self.sanitize_value(
                    address.address_title,
                    regex=2,
                    fieldname="address_title",
                    **error_context,
                ),
REGEX_MAP = {
    1: re.compile(r"[^A-Za-z0-9]"),
    2: re.compile(r"[^A-Za-z0-9\-\/. ]"),
    3: re.compile(r"[^A-Za-z0-9@#\-\/,&.(*) ]"),
}

Official constraint in einv site is "pattern": "^([^\\\"])*$",

I tried to generate an IRN with the following name in the dispatch addr and it succeeded:

ABC & @ # - / . ( ) *

Can we change the sanitization to regex 3 from 2? Best would be if we can add another regex that matches the official pattern as follows:

REGEX_MAP = {
    1: re.compile(r"[^A-Za-z0-9]"),
    2: re.compile(r"[^A-Za-z0-9\-\/. ]"),
    3: re.compile(r"[^A-Za-z0-9@#\-\/,&.(*) ]"),
    4: re.compile(r’[\"]'),
}

and use regex=4 for address title.

The problem is since we are stripping special characters like “&”, a company name like “Basant & Associate” is getting malformed in einvoice.

1 Like

This validation is the stricter of requirements between e-Invoice and e-Waybill requirements.
Both have different validations.

https://docs.ewaybillgst.gov.in/apidocs/version1.03/generate-eway-bill.html#JSONSchema