Best Mailbox Address Prevention Strategies?

I have a client that ships via UPS, and therefore cannot deliver it to mailboxes. I would like to be able to check the client address fields so that they cannot enter addresses containing the PO field. It would be better if it were implemented as a regular expression, so that I could use client-side regular expression validation control (ASP.NET).

I understand that there is probably no way to get a 100% detection level, I'm just looking for something that will work most of the time.

+2
source share
9 answers

This should help you get started. Verify that the Address field matches this regular expression.

"^P\.?\s?O\.?\sB[Oo][Xx]." 

English translation: this is P at the beginning of the line, followed by an optional period and a space, followed by O, followed by an optional period, followed by a space, and then โ€œBoxโ€, followed by something else.

+3
source

There are also tools in the UPS that you can integrate to do this ... so you can check the address exactly if they will be sent, what will be the cost, schedules, etc. I suggest visiting the UPS IT Solutions Page for more information.

+6
source

Perhaps you are better off leaving a warning on the page that you are not able to send mailboxes, against checking input.

Most likely, if you create a regular expression that catches most of PO In the box scripts there is a good chance that it will also catch what you did not intend (i.e. Client with a street name containing the letters "p" and "box" )

+1
source

I would start with the regular expression ala Lizard (but use the flag "ignore case" :)), check for historical data, and then repeat, as you see, what invalid inclusions and exceptions you see when testing.

0
source

Most delivery providers (such as FedEx) will verify the delivery address. For example, using FedEx web services, there is a request to confirm the delivery address and receive estimated cost. This not only ensures that the address is not a PO Box, but also ensures that the rest of the address is valid.

0
source

Regarding the OP comment on Jason Coco:

Since you can add regular expression checking to the delivery address, I assume that you are in control of the application (i.e. you have a source and can change it). In this case, you should be able, after receiving the submitted data, to check whether it should be sent via USPS, FedEx or UPS and send a request to the appropriate validator of the sender's addresses, having typed all the advantages offered in Jason's answer.

By making it specific to the shipper, this will also allow you to avoid implementing rules of the same size for everyone, such as "there are no mailboxes because the UPS does not deliver to them," even if the user can select non-UPSs that are delivered to the mailboxes.

0
source

What if it does not start with "PO Box .." or "PO Box"?

Example:

John Schmidt | Silver Valley PO Box 3901 | Whereswaldoville, SI. 78946

I used the onblur event for the address field to use the javascript, indexOf function to recognize input.toUpperCase "PO BOX" || "PO" that> = 0.

If none of these two searches is found, -1 is returned, otherwise it will return the starting position of the string, which will always be 0 or more.

This will provide lazy input, the "po" field, the "po field" and just as the "po field" will be recognized. I suppose you could add 'po. field ".

In any case, the condition causes an unobtrusive message to indicate that "we cannot send the PO Box address." This function does not see if it does not apply to you. Otherwise, for users, t is js or css enabled, they just see the message. The only glitch in this graceful deterioration is if the user has css but not js enabled (where they just don't see the message at all). with a solution today, but if I think of a better way, I will come back to publish it here.

0
source

Unfortunately, online UPS software allows you to use PO Boxes to get through, but will choke on them when they are in the delivery channel. In our case, the rejection rate of the basket increased when we tried to elegantly prevent the PO Boxes. It was much more profitable for us to leave him alone, accept the sale, bring it to the attention of customer service and let them solve this problem. Of course, if you get high frequency PO Boxes, this may not be the case.

0
source

From the original question:

I understand that there is probably no way to get 100% detection, ...

In fact, there is.

If the address is first verified and standardized in USPS format using the address verification tool (the company I work for produces YAddress ), then all mailbox addresses will be written without exception as "PO BOX ...". After that, you can compare them for coincidence with an accuracy of 100%.

0
source

Source: https://habr.com/ru/post/916900/


All Articles