11"""
2- Service Availability and Commitment Module
2+ Country Service Module
33=================================
44This package contains the shipping methods defined by Fedex's
5- ValidationAvailabilityAndCommitmentService WSDL file. Each is encapsulated in a class for
5+ CountryService WSDL file. Each is encapsulated in a class for
66easy access. For more details on each, refer to the respective class's
77documentation.
88"""
1111from ..base_service import FedexBaseService
1212
1313
14- class FedexAvailabilityCommitmentRequest (FedexBaseService ):
14+ class FedexValidatePostalRequest (FedexBaseService ):
1515 """
1616 This class allows you validate service availability
1717 """
@@ -25,7 +25,7 @@ def __init__(self, config_obj, *args, **kwargs):
2525 self ._config_obj = config_obj
2626 # Holds version info for the VersionId SOAP object.
2727 self ._version_info = {
28- 'service_id' : 'vacs ' ,
28+ 'service_id' : 'cnty ' ,
2929 'major' : '4' ,
3030 'intermediate' : '0' ,
3131 'minor' : '0'
@@ -34,33 +34,26 @@ def __init__(self, config_obj, *args, **kwargs):
3434 """ivar: Carrier Code Default to Fedex (FDXE), or can bbe FDXG."""
3535 self .CarrierCode = None
3636
37+ """ivar: Routing Code Default to FDSD"""
38+ self .RoutingCode = None
39+
3740 """@ivar: Holds Addresses, Ship Date, Service and Packaging objects."""
38- self .Origin = self .Destination = None
39- self .ShipDate = None
40- self .Service = None
41- self .Packaging = None
41+ self .Address = None
42+ self .ShipDateTime = None
43+ self .CheckForMismatch = 1
4244
4345 """@ivar: Holds the ValidationAvailabilityAndCommitmentService WSDL object."""
44- # Call the parent FedexBaseService class for basic setup work.
45- # Shortened the name of the wsdl, otherwise suds did not load it properly.
46- # Suds throws the following error when using the long file name from FedEx:
47- #
48- # File "/Library/Python/2.7/site-packages/suds/wsdl.py", line 878, in resolve
49- # raise Exception("binding '%s', not-found" % p.binding)
50- # Exception: binding 'ns:ValidationAvailabilityAndCommitmentServiceSoapBinding', not-found
51-
52- super (FedexAvailabilityCommitmentRequest , self ).__init__ (
53- self ._config_obj , 'AvailabilityAndCommitmentService_v4.wsdl' , * args , ** kwargs )
46+ super (FedexValidatePostalRequest , self ).__init__ (
47+ self ._config_obj , 'CountryService_v4.wsdl' , * args , ** kwargs )
5448
5549 def _prepare_wsdl_objects (self ):
5650 """
5751 Create the data structure and get it ready for the WSDL request.
5852 """
5953 self .CarrierCode = 'FDXE'
60- self .Origin = self .Destination = self .client .factory .create ('Address' )
61- self .ShipDate = datetime .date .today ().isoformat ()
62- self .Service = None
63- self .Packaging = 'YOUR_PACKAGING'
54+ self .RoutingCode = 'FDSD'
55+ self .Address = self .client .factory .create ('Address' )
56+ self .ShipDateTime = datetime .datetime .now ().isoformat ()
6457
6558 def _assemble_and_send_request (self ):
6659 """
@@ -79,14 +72,13 @@ def _assemble_and_send_request(self):
7972 self .logger .debug (self .TransactionDetail )
8073 self .logger .debug (self .VersionId )
8174 # Fire off the query.
82- return self .client .service .serviceAvailability (
75+ return self .client .service .validatePostal (
8376 WebAuthenticationDetail = self .WebAuthenticationDetail ,
8477 ClientDetail = self .ClientDetail ,
8578 TransactionDetail = self .TransactionDetail ,
8679 Version = self .VersionId ,
87- Origin = self .Origin ,
88- Destination = self .Destination ,
89- ShipDate = self .ShipDate ,
80+ Address = self .Address ,
81+ ShipDateTime = self .ShipDateTime ,
9082 CarrierCode = self .CarrierCode ,
91- Service = self .Service ,
92- Packaging = self .Packaging )
83+ CheckForMismatch = self .CheckForMismatch ,
84+ RoutingCode = self .RoutingCode )
0 commit comments