From 549eb2baf93da38c73da94cd42565aa0b1d2dfec Mon Sep 17 00:00:00 2001 From: Efraim <45230414+EfraimGENC@users.noreply.github.com> Date: Mon, 12 Sep 2022 01:01:40 +0300 Subject: [PATCH] ResultList json fix, operations added etc --- README.md | 2 +- setup.py | 4 +- ups_turkey/ups.py | 116 +++++++++++++++++++++++++++++++++++++--------- 3 files changed, 96 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 28ac9c5..800b6ca 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ UPS Türkiye yutriçi gönderileri için `ups.com/upsdeveloperkit`'ten ayrı bir UPS Türkiye'nin oluşturma([Createshipment V7](https://ws.ups.com.tr/wsCreateShipment/wsCreateShipment.asmx)) ve sorgulama([QueryPackageInfo](https://ws.ups.com.tr/QueryPackageInfo/wsQueryPackagesInfo.asmx)) işlemleri için iki ayrı servisi bulunmaktadır. --- - +## Table of Contents - [Installation](#Installation) - [Usage](#Usage) - [Inıtilaize Service](#InıtilaizeService) diff --git a/setup.py b/setup.py index e3e24be..61c073d 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="ups_turkey", - version="0.1.1", + version="0.1.2", author="Efraim GENC", author_email='info@kavimdigital.com', description="Easy integration for UPS Turkey", @@ -15,7 +15,7 @@ long_description=long_description, long_description_content_type='text/markdown', url="https://github.com/EfraimGENC/ups-turkey", - download_url = 'https://github.com/EfraimGENC/ups-turkey/archive/refs/tags/v0.1.1.tar.gz', + download_url = 'https://github.com/EfraimGENC/ups-turkey/archive/refs/tags/v0.1.2.tar.gz', classifiers=[ "Programming Language :: Python :: 3", "License :: OSI Approved :: MIT License", diff --git a/ups_turkey/ups.py b/ups_turkey/ups.py index caca36d..4d01d13 100644 --- a/ups_turkey/ups.py +++ b/ups_turkey/ups.py @@ -32,7 +32,7 @@ def has_fail(self, raise_exception=False): return False def json(self): - return to_json(self._data) + return to_json(self) class UPSService: @@ -84,8 +84,57 @@ def CreateShipment_Type2(self, *args, **kwargs): return self.call_service( 'CreateShipment_Type2', False, *args, **kwargs) + def OnDemandPickupRequest_Type1(self, *args, **kwargs): + """ + OnDemand Pickup Request Type 1 + """ + return self.call_service( + 'OnDemandPickupRequest_Type1', False, *args, **kwargs) + + def CustomerShipmentLimitDetail(self): + """ + Customer Shipment LimitDetail + """ + return self.call_service( + 'CustomerShipmentLimitDetail', False) + # Query Services ########################################################## + def GetLastTransactionByTrackingNumber_V1(self, *args, **kwargs): + """ + This method return only the last transaction for a tracking number + """ + return self.call_service( + 'GetLastTransactionByTrackingNumber_V1', True, *args, **kwargs) + + def GetPackageInfoByDatePeriod_V1(self, *args, **kwargs): + """ + This method is used to query all of the packages information, + under an account number, in a given date period. As SessionId + obtained through Login is specific to a customer account number, + account number is not needed as a parameter. + Parameters: `SessionID`, `InformationLevel`, `Startdate`, `EndDate` + """ + return self.call_service( + 'GetPackageInfoByDatePeriod_V1', True, *args, **kwargs) + + def GetPackageInfoByTrackingNumber_V1(self, *args, **kwargs): + """ + This method is used to query package information by tracking number. + Parameters: `SessionID`, `InformationLevel`, `TrackingNumber` + """ + return self.call_service( + 'GetPackageInfoByTrackingNumber_V1', True, *args, **kwargs) + + def GetShipmentInfoByTrackingNumber_V1(self, *args, **kwargs): + """ + This method is used to query package information for all tracking + numbers in a shipment. Any tracking number in a shipment can be sent + as a parameter. + """ + return self.call_service( + 'GetShipmentInfoByTrackingNumber_V1', True, *args, **kwargs) + def GetShipmentInfoByTrackingNumber_V2(self, *args, **kwargs): """ This method is used to query package information for all tracking @@ -95,36 +144,41 @@ def GetShipmentInfoByTrackingNumber_V2(self, *args, **kwargs): return self.call_service( 'GetShipmentInfoByTrackingNumber_V2', True, *args, **kwargs) - def GetPackageInfoByTrackingNumber_V1(self, *args, **kwargs): + def GetTiNTInformationByTrackingNumberList_V1(self, *args, **kwargs): """ - This method is used to query package information by tracking number. - Parameters: `SessionID`, `InformationLevel`, `TrackingNumber` + This method used to query time in transit information for a package. + Pickup date also included in dataset. + Parameters: `SessionID`, `InformationLevel`, + `TrackingNumberList[WaybillList[Waybill]]` """ return self.call_service( - 'GetPackageInfoByTrackingNumber_V1', True, *args, **kwargs) + 'GetTiNTInformationByTrackingNumberList_V1', True, *args, **kwargs) - def GetLastTransactionByTrackingNumber_V1(self, *args, **kwargs): + def GetTiNTInformationByTrackingNumber_V1(self, *args, **kwargs): """ - This method return only the last transaction for a tracking number + This method used to query time in transit information for a package. + Pickup date also included in dataset. + Parameters: `SessionID`, `InformationLevel`, `TrackingNumber` """ return self.call_service( - 'GetLastTransactionByTrackingNumber_V1', True, *args, **kwargs) + 'GetTiNTInformationByTrackingNumber_V1', True, *args, **kwargs) - def GetTransactionsByTrackingNumber_V1(self, *args, **kwargs): + def GetTransactionsByCustomerCode_V1(self, *args, **kwargs): """ - This method return only the last transaction for a tracking number + Parameters: `SessionID`, `InformationLevel`, `RecordId` """ return self.call_service( - 'GetTransactionsByTrackingNumber_V1', True, *args, **kwargs) + 'GetTransactionsByCustomerCode_V1', True, *args, **kwargs) - def GetUnreadTransactionsByTrackingNumber_V1(self, *args, **kwargs): + def GetTransactionsByList_V1(self, *args, **kwargs): """ - This method return all transactions with RecordIds greater than the - RecordId supplied as a parameter. RecordIds are returned as part of - transaction information. + This method returns requested transactions by provided list. + List can be customer referance number and tracking number. + Referance type must be set. Results can be set as last transaction, + all transaction and delivery transaction. """ return self.call_service( - 'GetUnreadTransactionsByTrackingNumber_V1', True, *args, **kwargs) + 'GetTransactionsByList_V1', True, *args, **kwargs) def GetTransactionsByList_V2(self, *args, **kwargs): """ @@ -136,13 +190,29 @@ def GetTransactionsByList_V2(self, *args, **kwargs): return self.call_service( 'GetTransactionsByList_V2', True, *args, **kwargs) - def GetPackageInfoByDatePeriod_V1(self, *args, **kwargs): + def GetTransactionsByPackagePickupDate_V1(self, *args, **kwargs): """ - This method is used to query all of the packages information, - under an account number, in a given date period. As SessionId - obtained through Login is specific to a customer account number, - account number is not needed as a parameter. - Parameters: `SessionID`, `InformationLevel`, `Startdate`, `EndDate` + This method is used to query all of the packages transactions, + under an account number, in a given date period. Results can be set + as last transaction, all transaction and delivery transaction. + Parameters: `SessionID`, `InformationLevel`, `StartDate`, `EndDate`, + `TransactionType` """ return self.call_service( - 'GetPackageInfoByDatePeriod_V1', True, *args, **kwargs) + 'GetTransactionsByPackagePickupDate_V1', True, *args, **kwargs) + + def GetTransactionsByTrackingNumber_V1(self, *args, **kwargs): + """ + This method return only the last transaction for a tracking number + """ + return self.call_service( + 'GetTransactionsByTrackingNumber_V1', True, *args, **kwargs) + + def GetUnreadTransactionsByTrackingNumber_V1(self, *args, **kwargs): + """ + This method return all transactions with RecordIds greater than the + RecordId supplied as a parameter. RecordIds are returned as part of + transaction information. + """ + return self.call_service( + 'GetUnreadTransactionsByTrackingNumber_V1', True, *args, **kwargs)