1 """
2 Country Service Module
3
4 This package contains the shipping methods defined by Fedex's
5 CountryService WSDL file. Each is encapsulated in a class for
6 easy access. For more details on each, refer to the respective class's
7 documentation.
8 """
9
10 import datetime
11 from ..base_service import FedexBaseService
12
13
14 -class FedexValidatePostalRequest(FedexBaseService):
15 """
16 This class allows you validate an address.
17 https://www.fedex.com/us/developer/WebHelp/ws/2015/html/WebServicesHelp/WSDVG/47_Country_Service.htm
18 """
19
20 - def __init__(self, config_obj, *args, **kwargs):
21 """
22 @type config_obj: L{FedexConfig}
23 @param config_obj: A valid FedexConfig object.
24 """
25
26 self._config_obj = config_obj
27
28 self._version_info = {
29 'service_id': 'cnty',
30 'major': '4',
31 'intermediate': '0',
32 'minor': '0'
33 }
34
35 self.CarrierCode = None
36 """ivar: Carrier Code Default to Fedex (FDXE), or can bbe FDXG."""
37
38 self.RoutingCode = None
39 """ivar: Routing Code Default to FDSD."""
40
41 self.Address = None
42 """@ivar: Holds Address WSDL objects."""
43
44 self.ShipDateTime = None
45 """@ivar: Holds the ShipDateTime date time objects."""
46
47 self.CheckForMismatch = 1
48 """@ivar: Holds the CheckForMismatch boolean objects."""
49
50 super(FedexValidatePostalRequest, self).__init__(
51 self._config_obj, 'CountryService_v4.wsdl', *args, **kwargs)
52
54 """
55 Create the data structure and get it ready for the WSDL request.
56 """
57 self.CarrierCode = 'FDXE'
58 self.RoutingCode = 'FDSD'
59 self.Address = self.client.factory.create('Address')
60 self.ShipDateTime = datetime.datetime.now().isoformat()
61
63 """
64 Fires off the Fedex request.
65
66 @warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(),
67 WHICH RESIDES ON FedexBaseService AND IS INHERITED.
68 """
69
70
71
72
73 del self.ClientDetail.IntegratorId
74 self.logger.debug(self.WebAuthenticationDetail)
75 self.logger.debug(self.ClientDetail)
76 self.logger.debug(self.TransactionDetail)
77 self.logger.debug(self.VersionId)
78
79 return self.client.service.validatePostal(
80 WebAuthenticationDetail=self.WebAuthenticationDetail,
81 ClientDetail=self.ClientDetail,
82 TransactionDetail=self.TransactionDetail,
83 Version=self.VersionId,
84 Address=self.Address,
85 ShipDateTime=self.ShipDateTime,
86 CarrierCode=self.CarrierCode,
87 CheckForMismatch=self.CheckForMismatch,
88 RoutingCode=self.RoutingCode)
89