CourierCloseout |
[This is preliminary documentation and is subject to change.]
For a package to be included in a close out, its entire order must be valid, and a label must have been created for the package. The software does not have the ability to determine if a label was successfully printed, but it counts if the label has been displayed on the web site or if any request returned a response with the ZPL code for or image of the label.
It is important that each package included in a close out has actually been shipped since this may generate customs documentation or trigger other procedures which enable the package to be shipped without incident. It is also important to not include packages which haven’t actually shipped since you will be billed for packages which are closed out.
Create a Closeout(CloseoutRequest)
ParsNumber is required for PARS customers.
PackIDType must specify either Pin or PackageID.
PackageIDs must contain either a list of Purolator generated Pins (from the barcode section of the label) or the PackageIDs/Package Numbers for each included package depending on the value of PackIDType.
Save any Documents returned in the close out (if successful) response.
Save updated rates for the closed out packages if needed.
Example using PackageID
CredentialInfo credentials = new CredentialInfo { UserName = "User", Password = "****", ClientID = "0000000" }; string[] addedPackageIDs = orderResponse.Packages.Select(pkg => pkg.PackageID).ToArray(); ShippingServicesSoapClient client = new ShippingServicesSoapClient("PurolatorWebService"); CloseoutRequest closeoutRequest = new CloseoutRequest { Credentials = credentials, PackageIDs = packageIDs, PackIDType = "PackageID", SkidCount = 1, ParsNumber = "12-15368325", // Only used by PARS customers. }; CloseoutResponse closeoutResponse = client.Closeout(closeoutRequest); if (closeoutResponse.Status == (int)SeverityEnum.Error) { foreach (ResponseMessage message in closeoutResponse.Messages) { switch (message.Number) { case 1: // Invalid Credentials Console.Write("Invalid Credentials"); return; case 71: // No packages. case 79: // No packages. return; case 87: // PackIDType should be Pin or PackageID. closeoutRequest.PackIDType = "PackageID"; break; case 88: // Package(s) not found, or is not available for closeout. // This can happen if the label isn't printed, if the package is voided, if the package isn't verified, ... return; } } closeoutResponse = client.Closeout(closeoutRequest); if (closeoutResponse.Status == (int)SeverityEnum.Error) return; } // Handle any closeoutResponse.Documents
Example using Pin
CredentialInfo credentials = new CredentialInfo { UserName = "User", Password = "****", ClientID = "0000000" }; string[] trackingNumbers = orderResponse.Packages.Select(pkg => pkg.TrackingNumber).ToArray(); ShippingServicesSoapClient client = new ShippingServicesSoapClient("PurolatorWebService"); CloseoutRequest closeoutRequest = new CloseoutRequest { Credentials = credentials, PackageIDs = trackingNumbers, PackIDType = "Pin", SkidCount = 1, ParsNumber = "12-14799638", // Only used by PARS customers. }; CloseoutResponse closeoutResponse = client.Closeout(closeoutRequest); if (closeoutResponse.Status == (int)SeverityEnum.Error) { foreach (ResponseMessage message in closeoutResponse.Messages) { switch (message.Number) { case 1: // Invalid Credentials Console.Write("Invalid Credentials"); return; case 71: // No packages. case 79: // No packages. return; case 87: // PackIDType should be Pin or PackageID. closeoutRequest.PackIDType = "Pin"; break; case 88: // Package(s) not found, or is not available for closeout. // This can happen if the label isn't printed, if the package is voided, if the package isn't verified, ... return; } } closeoutResponse = client.Closeout(closeoutRequest); if (closeoutResponse.Status == (int)SeverityEnum.Error) return; } // Handle any closeoutResponse.Documents