close ad
Help us test the new Databridge BETA with MySQLi support
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

UPSP invalid Mail Type error

Thread began 11/30/2009 9:00 pm by ryanteets270615 | Last modified 8/04/2010 6:49 pm by Eric Mittman | 5626 views | 9 replies |

ryanteets270615

UPSP invalid Mail Type error

I'm a little stuck here, getting this error while trying to get a USPS rate quote:
DomesticRatesV3;clsRateV3.ValidateFirstClassMailType;RateEngineV3.ProcessRequest - Invalid First Class Mail Type.

I called and had my account switched over to the production server, so that part is good now. My code looks correct to me, any ideas?

<?php
//WA eCart UPS Shipping Include
require_once("../WA_eCart/WA_eCart_USPS_PHP.php");
?>
<?php
if ("" == "") {
//WA eCart (Copyright 2007, WebAssist)
//WA eCart USPS Shipping - USPS
$Shipping_SuccessURL = "";
$Shipping_FailureURL = "shipping_failure.php";
$Shipping_Packaging = 0;
$Shipping_PackageArray = array();
$Shipping_PackageIndex = 0;
$Shipping_Counter = 0;
$Shipping_Parameters = array();
$Shipping_Parameters["UserID"] = "603XXXXX1111";
$Shipping_Parameters["USPSServer"] = "http://production.shippingapis.com/shippingapi.dll";
$Shipping_Parameters["CarrierCode"] = "FIRST CLASS";
$Shipping_Parameters["DefaultIntl"] = "none";
$Shipping_Parameters["ShipperZip"] = "90069";
$Shipping_Parameters["ShiptoZip"] = "".$_SESSION['eCartCheckoutForm_shipping_postcode'] ."";
$Shipping_Parameters["ShiptoCountry"] = "US";
while (($Shipping_Packaging == 1 && !$ecoCart->EOF()) || ($Shipping_Packaging == 0 && $Shipping_Counter == 0)) {
if (WA_eCart_USPS_IsTrueValue("true")) {
$Shipping_PackageArray[] = array();
$Shipping_PackageIndex = sizeof($Shipping_PackageArray)-1;
$Shipping_PackageArray[$Shipping_PackageIndex]["eCart_Quantity"] = (($Shipping_Packaging == 1)?$ecoCart->DisplayInfo("Quantity"):1);
$Shipping_PackageArray[$Shipping_PackageIndex]["IsPackage"] = "true";
$Shipping_PackageArray[$Shipping_PackageIndex]["Quantity"] = "1";
$Shipping_PackageArray[$Shipping_PackageIndex]["WeightUnits"] = "oz";
$Shipping_PackageArray[$Shipping_PackageIndex]["PackageWeight"] = "".$_SESSION['ShippingWeight'] ."";
$Shipping_PackageArray[$Shipping_PackageIndex]["PackageType"] = "YOURPACKAGING";
$Shipping_PackageArray[$Shipping_PackageIndex]["PackageSize"] = "REGULAR";
$Shipping_PackageArray[$Shipping_PackageIndex]["PackageMachinable"] = "true";
$Shipping_PackageArray[$Shipping_PackageIndex]["IPackageType"] = "Package";
//Special Services
}
$Shipping_Counter++;
if ($Shipping_Packaging == 1) $ecoCart->MoveNext();
}
if ($Shipping_Packaging == 1) $ecoCart->MoveFirst();
$Shipping_Result = WA_eCart_USPS_GetRateQuote($ecoCart, $Shipping_Parameters, $Shipping_PackageArray);
if ($Shipping_Result && $Shipping_SuccessURL != "")
$ecoCart->redirStr = $Shipping_SuccessURL;
else if (!$Shipping_Result && $Shipping_FailureURL != "") {
Header("Location: " . $Shipping_FailureURL); exit;
}
}
else if (!isset($_SESSION["ecoCart_USPS_Success"])) {
WA_eCart_USPS_SetSessionDefaults($ecoCart);
}
?>

Sign in to reply to this post

ryanteets270615

error messge

ecoCart_USPS_ErrorCode: -2147219428
ecoCart_USPS_ErrorDescription: DomesticRatesV3;clsRateV3.ValidateFirstClassMailType;RateEngineV3.ProcessRequest - Invalid First Class Mail Type.

ecoCart_USPS_FullRequest: API=RateV3&XML=FIRST CLASS900699006901REGULAR

Sign in to reply to this post

Eric Mittman

I have opened a ticket for you on this issue. I have posted some info for you to try and get back to us with the result. To update your ticket please login to the site and visit your support history.

Sign in to reply to this post

Jimmy Wu

The FirstClassMail type is not being sent as a parameter.

In the USPS shipping code, under the:
$Shipping_Parameters["CarrierCode"] = "FIRST CLASS";

Add this line underneath it should fix the issue:
$Shipping_Parameters["FirstClassMailType"] = "PARCEL";

Sign in to reply to this post

corey412091

First Class

Has anyone found a solution to this? I too get this error when trying to change my CarrierCode to "First Class" ??

I added the Shipping_Parameters["FirstClassMailType"] = "PARCEL" but it doesn't even recognize that array node.

Sign in to reply to this post

Eric Mittman

Are you using eCart 5? This should not be an issue with the latest version of eCart. Post back with some additional details about your setup and versions of software. Along with this also post back with a copy of the confirm page that has the USPS server behavior on it minus any of the sensitive details. I will take a look to see if I can spot an issue.

Sign in to reply to this post

corey412091

USPS First Class Mail

Yes i do have the current version of eCart version 5. Here is the snippet of code used from the ecart code bank.

<?php
//WA eCart Include
require_once("../WA_eCart/eCart_PHP.php");
?>
<?php
$eCart->GetContent();
?>
<?php
//WA eCart UPS Shipping Include
require_once("../WA_eCart/WA_eCart_USPS_PHP.php");
?>
<?php if(!session_id()) session_start(); ?>
<?php
if (!$eCart->IsEmpty()) {
//WA eCart (Copyright 2007, WebAssist)
//WA eCart USPS Shipping - USPS
$Shipping_SuccessURL = "../shopping-cart2.php?charity=".$_GET['charity'];
$Shipping_FailureURL = "usps-error.php?charity=".$_GET['charity'];
$Shipping_Packaging = 0;
$Shipping_PackageArray = array();
$Shipping_PackageIndex = 0;
$Shipping_Counter = 0;
$Shipping_Parameters = array();
$Shipping_Parameters["UserID"] = "30##########;
$Shipping_Parameters["USPSServer"] = "http://production.shippingapis.com/shippingapi.dll";
$Shipping_Parameters["CarrierCode"] = 'First Class';
$Shipping_Parameters["FirstClassMailType"] = "PARCEL";
$Shipping_Parameters["DefaultIntl"] = "none";
$Shipping_Parameters["ShipperZip"] = "90025";
$Shipping_Parameters["ShiptoZip"] = $_SESSION['shipping_postal_code'];
$Shipping_Parameters["ShiptoCountry"] = $_SESSION['shipping_country_code'];
while (($Shipping_Packaging == 1 && !$eCart->EOF()) || ($Shipping_Packaging == 0 && $Shipping_Counter == 0)) {
if (WA_eCart_USPS_IsTrueValue("true")) {
$Shipping_PackageArray[] = array();
$Shipping_PackageIndex = sizeof($Shipping_PackageArray)-1;
$Shipping_PackageArray[$Shipping_PackageIndex]["eCart_Quantity"] = (($Shipping_Packaging == 1)?$eCart->DisplayInfo("Quantity"):1);
$Shipping_PackageArray[$Shipping_PackageIndex]["IsPackage"] = "true";
$Shipping_PackageArray[$Shipping_PackageIndex]["Quantity"] = "1";
$Shipping_PackageArray[$Shipping_PackageIndex]["WeightUnits"] = "oz";
$Shipping_PackageArray[$Shipping_PackageIndex]["PackageWeight"] = "".WA_eCart_FormatNumber($eCart->TotalColumn('TotalWeight'), true, 1) ."";
$Shipping_PackageArray[$Shipping_PackageIndex]["PackageType"] = "YOURPACKAGING";
$Shipping_PackageArray[$Shipping_PackageIndex]["PackageSize"] = "REGULAR";
$Shipping_PackageArray[$Shipping_PackageIndex]["PackageMachinable"] = "True";
$Shipping_PackageArray[$Shipping_PackageIndex]["IPackageType"] = "Package";
//Special Services
}
$Shipping_Counter++;
if ($Shipping_Packaging == 1) $eCart->MoveNext();
}
if ($Shipping_Packaging == 1) $eCart->MoveFirst();
$Shipping_Result = WA_eCart_USPS_GetRateQuote($eCart, $Shipping_Parameters, $Shipping_PackageArray);
if ($Shipping_Result && $Shipping_SuccessURL != "")
$eCart->redirStr = $Shipping_SuccessURL;
else if (!$Shipping_Result && $Shipping_FailureURL != "") {
Header("Location: " . $Shipping_FailureURL); exit;
}
}
else if (!isset($_SESSION["eCart_USPS_Success"])) {
WA_eCart_USPS_SetSessionDefaults($eCart);
}
?>
<?php
// WA eCart Redirect
if ($eCart->redirStr != "") {
header("Location: ".$eCart->redirStr);
}
?>

Sign in to reply to this post

Eric Mittman

Is this just the code from the snippet directly or did you generate this code with the checkout wizard or by applying the individual server behavior?

When I choose the First Class mail type the code that eCart produces for me does not have the FirstClassMailType. You should try removing this from your code to see if you get past this error:

php:
$Shipping_Parameters["FirstClassMailType"] = "PARCEL";



If your current version of eCart is producing this code please let me know.

Sign in to reply to this post

corey412091

First Class

No i tried Jimmy Wu's solution above. Either way its the same. That array node doesn't even get recognized. It doesn't matter if i set that Array node var. It is just extra data now in the array. The error cleary states

"Error Message DomesticRatesV3;clsRateV3.ValidateFirstClassMailType;RateEngineV3.ProcessRequest - Invalid First Class Mail Type."

When i read this, it seems like there is either an attribute or another string we need to pass for shipping carrier if it is First Class Mail. I have written a USPS API Class, using SOAP. I dont get this error. A customer of ours wants to switch to First Class carrier, and we had this code in place because we used eCart. It would be nice to figure out what is wrong here, or else i can just write the live shipping quote myself.

Thanks in advance.

Sign in to reply to this post

Eric Mittman

I have opened a ticket for you on this issue. To update the ticket or check it's status login and visit your support history.

supporthistory.php

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...