Skip to content

Commit

Permalink
ResultList json fix, operations added etc
Browse files Browse the repository at this point in the history
  • Loading branch information
EfraimGENC committed Sep 11, 2022
1 parent 531cf6b commit 549eb2b
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 26 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="ups_turkey",
version="0.1.1",
version="0.1.2",
author="Efraim GENC",
author_email='[email protected]',
description="Easy integration for UPS Turkey",
Expand All @@ -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",
Expand Down
116 changes: 93 additions & 23 deletions ups_turkey/ups.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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):
"""
Expand All @@ -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)

0 comments on commit 549eb2b

Please sign in to comment.