From 8407948f622c3434373fbd9884a6706a3c904577 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Tue, 12 Feb 2013 11:32:21 +0200 Subject: Fixed Rapair().create_carryin() --- gsxws.py | 30 +++++++++++++++--------------- tests/create_carryin_repair.json | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/gsxws.py b/gsxws.py index 8f4d0fa..740000a 100755 --- a/gsxws.py +++ b/gsxws.py @@ -251,7 +251,6 @@ class GsxResponse(dict): if isinstance(v, basestring): # convert dates to native Python type - if re.search('^\d{2}/\d{2}/\d{2}$', v): m, d, y = v.split('/') v = date(2000+int(y), int(m), int(d)).isoformat() @@ -439,8 +438,7 @@ class Repair(GsxObject): request_dt = 'ns1:repairLookupRequestType' def __init__(self, *args, **kwargs): - super(Repair, self).__init__() - + super(Repair, self).__init__(*args, **kwargs) formats = get_format() # native date types are not welcome here :) @@ -454,15 +452,12 @@ class Repair(GsxObject): def create_carryin(self): """ - The Parts Pending Return API returns a list of all parts that - are pending for return, based on the search criteria. + GSX validates the information and if all of the validations go through, + it obtains a quote for the repair and creates the carry-in repair. """ - self.set_type('ns2:emeaAspCreateCarryInRepairDataType') - ca = CLIENT.factory.create('ns7:addressType') - self.dt.customerAddress = self.data['customerAddress'] - self.set_request('ns2:carryInRequestType', 'repairData') - result = self.submit('CreateCarryInRepair') - + dt = self._make_type('ns2:carryInRequestType') + dt.repairData = self.data + result = CLIENT.service.CreateCarryInRepair(dt) return result.repairConfirmation def create_cnd(self): @@ -478,6 +473,7 @@ class Repair(GsxObject): N07 Third Party Part N99 Other """ + pass def update_carryin(self): """ @@ -605,6 +601,7 @@ class Product(GsxObject): """ self.set_request('ns3:warrantyStatusRequestType', 'unitDetail') result = self.submit('WarrantyStatus') + return self._process(result.warrantyDetailInfo) def get_activation(self): @@ -686,10 +683,13 @@ if __name__ == '__main__': parser.add_argument('--region', default='emea') args = parser.parse_args() - #connect(**vars(args)) + connect(**vars(args)) - #f = 'tests/create_carryin_repair.json' + f = 'tests/create_carryin_repair.json' #f = 'tests/update_escalation.json' - #fp = open(f, 'r') - #data = json.load(fp) + fp = open(f, 'r') + data = json.load(fp) + rep = Repair(**data) + print rep.create_carryin() + \ No newline at end of file diff --git a/tests/create_carryin_repair.json b/tests/create_carryin_repair.json index 085c765..56ce4e0 100644 --- a/tests/create_carryin_repair.json +++ b/tests/create_carryin_repair.json @@ -4,7 +4,7 @@ "serialNumber": "C3TFJJTNDCP9", "symptom": "Does not work", "diagnosis": "Does not work", - "unitReceivedDate": "01/01/13", + "unitReceivedDate": "02/10/13", "unitReceivedTime": "12:00 AM", "checkIfOutOfWarrantyCoverage": "N", "overrideDiagnosticCodeCheck": "Y", -- cgit v1.2.3