Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shipping validation checks not working with rest_proxy.php #43

Closed
jonstavis opened this issue Apr 26, 2014 · 7 comments
Closed

Shipping validation checks not working with rest_proxy.php #43

jonstavis opened this issue Apr 26, 2014 · 7 comments
Assignees
Labels

Comments

@jonstavis
Copy link

Hi,

I'm following the validation example from https://secure.ultracart.com/merchant/integrationcenter/checkoutapi_v3/demo1.html#demo07

The only difference is that I'm using the rest_proxy script on my server. I am attempting to validate the following checks:

[ 'Billing Validate City State Zip', 'Billing Phone Numbers Provided', 'Billing State Abbreviation Valid', 'Billing Address Provided', 'Email provided if required', 'Item Quantity Valid', 'Shipping Address Provided', 'Shipping State Abbreviation Valid', 'Shipping Validate City State Zip' ]

No matter what checks I specify in the url (including no checks), the only errors returned from validation are:

[
"Please specify your billing first name.",
"Please specify your billing last name.",
"Please specify your billing address.",
"Please specify your billing city.",
"Please specify your billing state.",
"Please specify your billing zip code.",
"Please specify your billing country.",
"Please specify your email."
]

(No shipping info is ever validated, even if all of the billing validations pass.)

The same thing happens if I skip validation and let validation be handled by /rest/cart/checkout. I have verified that shipping info is saved on successful orders.

Here is the actual url that the ajax call from my checkout page is using:

http://myserver.local/rest_proxy.php?_url=/rest/cart/validate&check=Billing%20Validate%20City%20State%20Zip&check=Billing%20Phone%20Numbers%20Provided&check=Billing%20State%20Abbreviation%20Valid&check=Billing%20Address%20Provided&check=Email%20provided%20if%20required&check=Item%20Quantity%20Valid&check=Shipping%20Addres%20Provided&check=Shipping%20State%20Abbreviation%20Valid&check=Shipping%20Validate%20City%20State%20Zip

Adding some logging to the rest_proxy.php script I see that the url it is hitting is:

https://secure.ultracart.com/rest/cart/validate?_url=/rest/cart/validate&check=Billing%20Validate%20City%20State%20Zip&check=Billing%20Phone%20Numbers%20Provided&check=Billing%20State%20Abbreviation%20Valid&check=Billing%20Address%20Provided&check=Email%20provided%20if%20required&check=Item%20Quantity%20Valid&check=Shipping%20Addres%20Provided&check=Shipping%20State%20Abbreviation%20Valid&check=Shipping%20Validate%20City%20State%20Zip

And I see that the POST data contains all of the shipping fields.

Other requests, such as /rest/cart, and /rest/site/items are working fine.

Am I doing something wrong? Is there some option in the merchant portal that I need to turn on to allow validation or to validate shipping fields?

Thanks very much.

@perrytew
Copy link
Contributor

Hey jonstavis,

The validation routine has some checks within it to disable validation of the shipping field due to certain conditions, such as the cart not needing shipping, etc. The urls you provide above are very useful. Could you also post your cart json and the server response json? Be sure to remove any sensitive information. If we could see the json payload and response, we could construct a test harness and give you specific insight as to why you're getting these responses.

Thanks,
Perry

@perrytew perrytew self-assigned this Apr 28, 2014
@jonstavis
Copy link
Author

Thanks for your response. Here you go.

Response:

HTTP/1.1 100 Continue

HTTP/1.1 200 OK
Date: Mon, 28 Apr 2014 12:13:38 GMT
Server: Apache
Content-Type: application/json
Vary: Accept-Encoding
Content-Encoding: gzip
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked

["Please specify your billing first name.","Please specify your billing last name.","Please specify your billing address.","Please specify your billing city.","Please specify your billing state.","Please specify your billing zip code.","Please specify your billing country.","Please specify your email."]

Post data:

{"total":0
"password":null
"email":""
"merchantId":""
"errors":null
"shipToFirstName":""
"shipToLastName":""
"shipToAddress1":""
"shipToAddress2":""
"shipToCity":""
"shipToState":""
"shipToCompany":""
"shipToCountry":""
"shipToPhone":""
"screenBrandingThemeCode":"DFLT"
"items":[{"itemId":"test123"
"quantity":1}]
"buysafeBondAvailable":false
"buysafeBondWanted":true
"buysafeBondCost":null
"insureShipAvailable":false
"insureShipWanted":null
"insureShipCost":null
"subtotalDiscount":0
"tax":0
"customField1":null
"customField2":null
"customField3":null
"customField4":null
"customField5":null
"customField6":null
"customField7":null
"customerProfile":null
"insureShipSeparate":false
"surcharge":0
"taxRate":0
"shippingMethod":""
"taxableSubtotal":0
"taxableSubtotalDiscount":0
"advertisingSource":""
"paymentMethod":"Credit Card"
"ipAddress":"127.0.0.1"
"subtotal":0
"deliveryDate":null
"shipToResidential":true
"coupons":[]
"taxCounty":""
"billToFirstName":""
"billToLastName":""
"giftEmail":null
"comments":null
"shipToTitle":""
"shipOnDate":null
"upsellPathCode":null
"gift":false
"giftCharge":0
"giftWrapCost":0
"giftMessage":null
"purchaseOrderNumber":""
"giftCertificateAmount":null
"shipToEveningPhone":""
"ccEmail":null
"creditCardToken":null
"liftGate":false
"taxExempt":false
"billToCompany":""
"billToAddress1":""
"billToAddress2":""
"billToCity":""
"billToState":""
"billToCountry":""
"billToEveningPhone":""
"storeCreditCard":false
"buysafeBondFree":false
"buysafeCartDisplayText":null
"buysafeCartDisplayUrl":null
"arbitraryTax":null
"arbitraryTaxableSubtotal":null
"arbitraryTaxRate":null
"specialInstructions":""
"emailConfirm":""
"arbitraryShippingHandlingTotal":null
"threatMetrixParams":null
"amazonOrderReferenceId":null
"creditCardType":""
"creditCardExpirationMonth":0
"creditCardExpirationYear":0
"creditCardNumber":""
"affiliateId":null
"giftCertificate":null
"loggedIn":false
"cartId":"**
***********"
"shipToPostalCode":""
"shippingHandling":0
"mailingListOptIn":true
"giftCertificateRemainingBalanceAfterOrder":null
"billToTitle":""
"billToPostalCode":""
"billToDayPhone":""
"creditCardVerificationNumber":""
"hasGoogleCheckout":false
"googleCheckoutCompatible":false
"googleCheckoutButtonUrl":null
"googleCheckoutButtonAltText":null
"payPalButtonUrl":null
"payPalButtonAltText":null
"hasPayPal":false
"payPalCompatible":false
"subtotalWithDiscount":0
"taxableSubtotalWithDiscount":0
"shippingHandlingDiscount":0
"shippingHandlingWithDiscount":0
"creditCardTypes":["Visa"]
"collectCreditCardVerificationNumber":true
"needShipping":false
"customerProfileCreditCardId":null
"diagnostics":null
"amazonButtonUrl":null
"amazonWidgetUrl":null
"hasAmazon":false
"amazonMerchantId":null
"needPayment":true}

@perrytew
Copy link
Contributor

Hey, the next question I have is this item you're testing with. test123. Does it have shipping dimensions and a weight associated with it? Do this: go to the items page, find your test item, and click on the "Links" link. Find the item buy link and open it in a new window. Walk through the standard checkout and place a test order. See if it requires shipping there and what validation messages it gives you along the way. I'm wondering if the item you're testing with triggers the "needs shipping" flag. If it doesn't, then no validation will be done.

@jonstavis
Copy link
Author

That was the problem. I added shipping to the item and shipping fields are now validating.

The checks that I pass into the URL are still not working, but I'm satisfied with the default billing/shipping validations that now seem to be taking place.

Closing this issue. Thank you very much!

@perrytew
Copy link
Contributor

Hey, if you're still having problems, either keep this issue open or open a new one. We're here to help!

@jonstavis
Copy link
Author

Thanks. I am curious why my ?check=X&check=Y&check=Z isn't working but it's not a showstopper because as I said the default validations are just what I need!

@ritu-arosys
Copy link

i am working on responsive checkout and at last on validation get again and again error "please specify your credit card number". but i have already put the card number. please help me on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants