Skip to content

Commit

Permalink
remove enums
Browse files Browse the repository at this point in the history
  • Loading branch information
oboratav committed Oct 31, 2020
1 parent 3ba818f commit e7acdc1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
8 changes: 3 additions & 5 deletions proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from zeep.helpers import serialize_object

from reference import (ERRORS_CREATE_SHIPMENT, PROD_WSDL_URL, SUCCESSFUL,
TEST_WSDL_URL, QueryShipmentIdentifier)
TEST_WSDL_URL, IDENTIFIER_INVOICE_ID, IDENTIFIER_SHIPMENT_ID)
from utilities import extract_credentials, parameter_as_list

transport = Transport(cache=SqliteCache())
Expand Down Expand Up @@ -96,13 +96,12 @@ def on_get(self, req, resp):
description="No identifier was provided")

if shipment_id is not None:
identifier_type = QueryShipmentIdentifier.SHIPMENT_ID
query_by_shipment_id = req.context["client"].service.queryShipment(
wsUserName=req.context["username"],
wsPassword=req.context["password"],
wsLanguage="TR", # Fixed value
keys=shipment_id,
keyType=identifier_type,
keyType=IDENTIFIER_SHIPMENT_ID,
addHistoricalData=add_historical_data,
onlyTracking=tracking_url_only,
)
Expand All @@ -111,13 +110,12 @@ def on_get(self, req, resp):
response_content = serialize_object(query_by_shipment_id, target_cls=dict)

if invoice_id is not None:
identifier_type = QueryShipmentIdentifier.INVOICE_ID
query_by_invoice_id = req.context["client"].service.queryShipment(
wsUserName=req.context["username"],
wsPassword=req.context["password"],
wsLanguage="TR", # Fixed value
keys=invoice_id,
keyType=identifier_type,
keyType=IDENTIFIER_INVOICE_ID,
addHistoricalData=add_historical_data,
onlyTracking=tracking_url_only,
)
Expand Down
12 changes: 4 additions & 8 deletions reference.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from enum import Enum

import falcon

# WSDL URLs
Expand Down Expand Up @@ -134,13 +132,11 @@
),
}

class QueryShipmentIdentifier(Enum):
SHIPMENT_ID = 0
INVOICE_ID = 1
IDENTIFIER_SHIPMENT_ID = 0
IDENTIFIER_INVOICE_ID = 1

class CODPaymentMethod(Enum):
CASH = 0
CREDIT_CARD = 1
COD_PAYMENT_METHOD_CASH = 0
COD_PAYMENT_METHOD_CREDIT_CARD = 1

class CallResult(object):
def __init__(self, outFlag: str, successful: bool):
Expand Down

0 comments on commit e7acdc1

Please sign in to comment.