Skip to main content

Easy integration for UPS Turkey

Project description

Build Status Made With License Latest Relase

UPS Turkey

Python package for integrate UPS Turkey easily.

UPS Türkiye yutriçi gönderileri için ups.com/upsdeveloperkit'ten ayrı bir sistem kullanmaktadır. ups.com/upsdeveloperkit sadece yurtdışı gönderile için kullanılmaktadır. UPS Türkiye'nin API'ları ise WebService (SOAP) ile çalışmaktadır. Bu hafif python pakedi, UPS Türkiye'nin web servisini kolayca kullanabilmenize olanak sağlar.

UPS Türkiye'nin oluşturma(Createshipment V7) ve sorgulama(QueryPackageInfo) işlemleri için iki ayrı servisi bulunmaktadır.



Installation

pip install ups-turkey

Usage

Inıtilaize Service

from ups_turkey import UPSService

ups = UPSService('CUSTOMER_NUMBER', 'USERNAME', 'PASSWORD')

Service Helpers

result = ups.ANY_OPERATIONS(**payload)

Operartions resturn list of dict as ResultList[Result]. ResultList and Result have some helpers like below.

  • Result(dict)
    • Convert result to JSON: result.json()
    • Convert result to dictionary: result.dict()
    • Checks is result is have an error: result.is_success() returns bool. If you want to raise UPSException(ERROR_CODE, ERROR_DEFINATION) pass raise_exception=True param like result.is_success(raise_exception=True)
    • result.get_error() for getting result's error code and defination as tuple if has
  • ResultList(list)
    • Convert result to JSON: result.json()
    • Checks is any result in list is have an error: result.has_fail() returns bool. If you want to raise UPSException(ERROR_CODE, ERROR_DEFINATION) pass raise_exception=True param like result.has_fail(raise_exception=True)

Operations

List

  • Create Service
    • Cancel_Shipment_V1
    • CreateShipment_Type1
    • CreateShipment_Type2
    • CreateShipment_Type2TRT
    • CreateShipment_Type3
    • CreateShipment_Type3_XML
    • CreateShipment_Type3_ZPL
    • CreateShipment_Type3_ZPL_Types
    • CreateShipment_Type4
    • CustomerShipmentLimitDetail
    • OnDemandPickupRequest_Type1
    • TransferShipmentList_Type1
  • Query Service
    • GetLastTransactionByTrackingNumber_V1
    • GetPackageInfoByDatePeriod_V1
    • GetPackageInfoByReferance_V1
    • GetPackageInfoByTrackingNumber_V1
    • GetShipmentInfoByTrackingNumber_V1
    • GetShipmentInfoByTrackingNumber_V2
    • GetTiNTInformationByTrackingNumberList_V1
    • GetTiNTInformationByTrackingNumber_V1
    • GetTransactionsByCustomerCode_V1
    • GetTransactionsByList_V1
    • GetTransactionsByList_V2
    • GetTransactionsByPackagePickupDate_V1
    • GetTransactionsByTrackingNumber_V1
    • GetUnreadTransactionsByTrackingNumber_V1

Parameter Dictionary

ExpenseCode

Gönderici tarafından sağlanan gider kodu. Paketleri daha fazla sınıflandırmak için raporlamada kullanılır (genellikle maliyet ölçümü için).

CityCode

UPS tarafından tanımlıdır. Türkiye'deki şehirler için plaka numarası.

ThirdPartyAccountNumber

Navlun üçüncü bir şahıs tarafından ödeniyorsa, bu UPS müşteri hesap numarasıdır.

IdControlFlag

Gönderici kimlik teyidi ile teslimat talep ederse “1”, aksi takdirde “0”.

PhonePrealertFlag

Gönderici, alıcının teslimattan önce telefonla uyarılmasını talep ederse “1”, aksi halde “0”.

Examples

CreateShipment_Type2
payload = {
    'ShipmentInfo': {
        # Gönderen
        'ShipperAccountNumber': 'CUSTOMER_NUMBER',
        'ShipperName': 'ABC Ltd. Şti.',
        'ShipperContactName': 'Mehmet Yılmaz',
        'ShipperAddress': 'Huzur Mh. Barış Cd. No:99',
        'ShipperCityCode': 34, # UPS tarafından tanımlanmıştır. Türkiye'deki şehirler için resmi numara.
        'ShipperAreaCode': 5824, # UPS tarafından tanımlanmıştır.
        'ShipperPostalCode': '34000',
        'ShipperPhoneNumber': '0 212 000 00 00',
        'ShipperPhoneExtension': '',
        'ShipperMobilePhoneNumber': '',
        'ShipperEMail': 'info@firma.com',
        'ShipperExpenseCode': '', # Gönderici tarafından sağlanan gider kodu. Paketleri daha fazla sınıflandırmak için raporlamada kullanılır (genellikle maliyet ölçümü için).

        # Alıcı
        'ConsigneeAccountNumber': '',
        'ConsigneeName': 'Mehmet Yılmaz',
        'ConsigneeContactName': '',
        'ConsigneeAddress': 'Memleket Mh. Bilmemne Sk. No:1',
        'ConsigneeCityCode': 34, # UPS tarafından tanımlanmıştır. Türkiye'deki şehirler için resmi numara.
        'ConsigneeAreaCode': 1858, # UPS tarafından tanımlanmıştır.
        'ConsigneePostalCode': '34000',
        'ConsigneePhoneNumber': '',
        'ConsigneePhoneExtension': '',
        'ConsigneeMobilePhoneNumber': '05320000000',
        'ConsigneeEMail': 'musteri@eposta.com',
        'ConsigneeExpenseCode': '', # Gönderici tarafından sağlanan gider kodu. Paketleri daha fazla sınıflandırmak için raporlamada kullanılır (genellikle maliyet ölçümü için).

        # Gönderi
        'ServiceLevel': 3,
        'PaymentType': 2,
        'PackageType': 'K',
        'NumberOfPackages': 1,
        'CustomerReferance': 'SIPARISNO',
        'CustomerInvoiceNumber': 'EFATURA000000',
        'DeliveryNotificationEmail': '',
        'DescriptionOfGoods': 'SKU00000',
        'IdControlFlag': 0, # Gönderici kimlik teyidi ile teslimat talep ederse “1”, aksi takdirde “0”.
        'PhonePrealertFlag': 0, # Gönderici, alıcının teslimattan önce telefonla uyarılmasını talep ederse “1”, aksi halde “0”.
        'SmsToShipper': 0,
        'SmsToConsignee': 1,
        'InsuranceValue': 0.00, # Sigorta değeri. Müşteri tarafından beyan edilir.
        'InsuranceValueCurrency': 'TL', # TL, EUR, USD
        'ValueOfGoods': 0, # Ürün fiyatı. Müşteri tarafından beyan edilir.
        'ValueOfGoodsCurrency': 'TL', # TL, EUR, USD
        'ValueOfGoodsPaymentType': 1,
        'ThirdPartyAccountNumber': '', # Navlun üçüncü bir şahıs tarafından ödeniyorsa, bu UPS müşteri hesap numarasıdır.
        'ThirdPartyExpenseCode': '', # Gönderici tarafından sağlanan gider kodu. Paketleri daha fazla sınıflandırmak için raporlamada kullanılır (genellikle maliyet ölçümü için).
    },
    'ReturnLabelLink': True,
    'ReturnLabelImage': True
}

shipment = ups.CreateShipment_Type2(**payload)
GetShipmentInfoByTrackingNumber_V2
payload = {
    'InformationLevel': 1,
    'TrackingNumber': 'YOUR_TRACKING_NUMBER'
}

result = ups.GetShipmentInfoByTrackingNumber_V2(**payload)
GetTransactionsByTrackingNumber_V1
payload = {
    'InformationLevel': 1,
    'TrackingNumber': 'YOUR_TRACKING_NUMBER'
}

result = ups.GetTransactionsByTrackingNumber_V1(**payload)
GetTransactionsByList_V2
payload = {
    'InformationLevel': 1,
    'refList': {
        'referansType': 'WAYBILL_TYPE',
        'referansList': ['YOUR_UPSReferance_CODE']
    },
    'trnType': 'ALL_TRANSACTIONS'
}

result = ups.GetTransactionsByList_V2(**payload)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ups_turkey-0.1.1.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ups_turkey-0.1.1-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file ups_turkey-0.1.1.tar.gz.

File metadata

  • Download URL: ups_turkey-0.1.1.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for ups_turkey-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e549f64708a24352811983643fb998146879064e6d80e7d7679a71c636d0cb94
MD5 5e9f484ab475c2a5e177ad9d2eaf7c9a
BLAKE2b-256 4fffa07ca08ece31541f0231ce72e773f61811147bd1bd8a22a555661b5568c4

See more details on using hashes here.

File details

Details for the file ups_turkey-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: ups_turkey-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for ups_turkey-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 741f67d66c27408c9320d519d543926e8b90e99526830313a3d715662b9506bb
MD5 1266a3539f916f8ec15c4fe9c07fb85e
BLAKE2b-256 f7d0f338a7f50dc789adc44e50419fcb0453fbec0990e10b269b8ba1b21403e1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page