Mailing List Archive

form profiles
Braintree gives this error when attempting to process a credit card sometimes:

"Postal code can only contain letters, numbers, spaces, and hyphens."

I've only used required/mandatory with mv_form_profile so I'm not sure
how to set up this sort of a check to work with [error]. Can someone
point me in the right direction? I seem to remember "zip" in
etc/profiles.order that I was planning to use as a starting point but
it isn't there any more.

- Grant

_______________________________________________
interchange-users mailing list
interchange-users@icdevgroup.org
http://www.icdevgroup.org/mailman/listinfo/interchange-users
Re: form profiles [ In reply to ]
On 02/11/2015 07:31 AM, Grant wrote:
> Braintree gives this error when attempting to process a credit card sometimes:
>
> "Postal code can only contain letters, numbers, spaces, and hyphens."
>
> I've only used required/mandatory with mv_form_profile so I'm not sure
> how to set up this sort of a check to work with [error]. Can someone
> point me in the right direction? I seem to remember "zip" in
> etc/profiles.order that I was planning to use as a starting point but
> it isn't there any more.

So if I understand correctly you want IC to have the same requirement
before the data goes out to Braintree.

There is zip, ca_postcode and postcode checks but that limits you to US
and Canadian postal codes, see:

http://www.icdevgroup.org/interchange-doc-5.2.0/frames/ictemplates_36.html

You probably want the regex check which is documented on the same page
as follows:

zip=regex ![^A-Za-z0-9 -] "Postal code can only contain letters,
numbers, spaces, and hyphens."


Peter

_______________________________________________
interchange-users mailing list
interchange-users@icdevgroup.org
http://www.icdevgroup.org/mailman/listinfo/interchange-users
Re: form profiles [ In reply to ]
>> Braintree gives this error when attempting to process a credit card sometimes:
>>
>> "Postal code can only contain letters, numbers, spaces, and hyphens."
>>
>> I've only used required/mandatory with mv_form_profile so I'm not sure
>> how to set up this sort of a check to work with [error]. Can someone
>> point me in the right direction? I seem to remember "zip" in
>> etc/profiles.order that I was planning to use as a starting point but
>> it isn't there any more.
>
> So if I understand correctly you want IC to have the same requirement
> before the data goes out to Braintree.
>
> There is zip, ca_postcode and postcode checks but that limits you to US
> and Canadian postal codes, see:
>
> http://www.icdevgroup.org/interchange-doc-5.2.0/frames/ictemplates_36.html
>
> You probably want the regex check which is documented on the same page
> as follows:
>
> zip=regex ![^A-Za-z0-9 -] "Postal code can only contain letters,
> numbers, spaces, and hyphens."


Hi Peter, can that go in the mv_form_profile? I tried it there but I get:

Sorry, there was an error in processing this form action. Please
report the error or try again later. (Unmatched [ in regex; marked by
<-- HERE in m/[ <-- HERE ^A-Za-z0-9/ at (eval 205) line 15. )

Also I use email_only in my mv_form_profile but it lets spaces in the
email address go through. Where is email_only defined or is there a
better definition to use?

- Grant

_______________________________________________
interchange-users mailing list
interchange-users@icdevgroup.org
http://www.icdevgroup.org/mailman/listinfo/interchange-users
Re: form profiles [ In reply to ]
On 03/07/2015 07:49 AM, Grant wrote:
>> zip=regex ![^A-Za-z0-9 -] "Postal code can only contain letters,
>> numbers, spaces, and hyphens."
>
>
> Hi Peter, can that go in the mv_form_profile? I tried it there but I get:
>
> Sorry, there was an error in processing this form action. Please
> report the error or try again later. (Unmatched [. in regex; marked by
> <-- HERE in m/[. <-- HERE ^A-Za-z0-9/ at (eval 205) line 15. )

Try quoting the regex:

zip=regex "![^A-Za-z0-9 -]" "Postal code can only contain letters,
numbers, spaces, and hyphens."

> Also I use email_only in my mv_form_profile but it lets spaces in the
> email address go through. Where is email_only defined or is there a
> better definition to use?

Space is actually a legal character in the local part of an email
address as long as it's quoted and while I would recommend that you
never create an email address with a space (or other funny characters)
in it, you should accept one to avoid rejecting legitimate addresses.
That said...

email_only is defined in code/OrderCheck along with most of the profile
checks. You can grab the regex from in there, modify it slightly and
use it in a regex check instead. The space is octal 040, so you would
do the following to exclude space from the regex:

email=regex "^[\041-\077\101-\176]+\@[-A-Za-z0-9.]+\.[A-Za-z]+$/" "not
an email address"


Peter

_______________________________________________
interchange-users mailing list
interchange-users@icdevgroup.org
http://www.icdevgroup.org/mailman/listinfo/interchange-users