| Line 33... |
Line 33... |
| 33 |
|
33 |
|
| 34 |
def create_order(t_order):
|
34 |
def create_order(t_order):
|
| 35 |
order = Order()
|
35 |
order = Order()
|
| 36 |
if t_order.warehouse_id:
|
36 |
if t_order.warehouse_id:
|
| 37 |
order.warehouse_id = t_order.warehouse_id
|
37 |
order.warehouse_id = t_order.warehouse_id
|
| 38 |
if order.logistics_provider_id:
|
38 |
if t_order.logistics_provider_id:
|
| 39 |
order.logistics_provider_id = t_order.logistics_provider_id
|
39 |
order.logistics_provider_id = t_order.logistics_provider_id
|
| 40 |
order.airwaybill_no = t_order.airwaybill_no
|
40 |
order.airwaybill_no = t_order.airwaybill_no
|
| 41 |
order.tracking_id = t_order.tracking_id
|
41 |
order.tracking_id = t_order.tracking_id
|
| 42 |
if t_order.expected_delivery_time:
|
42 |
if t_order.expected_delivery_time:
|
| 43 |
order.expected_delivery_time = to_py_date(t_order.expected_delivery_time)
|
43 |
order.expected_delivery_time = to_py_date(t_order.expected_delivery_time)
|
| Line 47... |
Line 47... |
| 47 |
order.customer_mobilenumber = t_order.customer_mobilenumber
|
47 |
order.customer_mobilenumber = t_order.customer_mobilenumber
|
| 48 |
order.customer_pincode = t_order.customer_pincode
|
48 |
order.customer_pincode = t_order.customer_pincode
|
| 49 |
order.customer_address = t_order.customer_address
|
49 |
order.customer_address = t_order.customer_address
|
| 50 |
order.customer_email = t_order.customer_email
|
50 |
order.customer_email = t_order.customer_email
|
| 51 |
#new status and status description to be added
|
51 |
#new status and status description to be added
|
| 52 |
order.status = t_order.status
|
52 |
order.status = get_c_status(t_order.status)
|
| 53 |
order.statusDescription = t_order.statusDescription
|
53 |
order.statusDescription = t_order.statusDescription
|
| 54 |
order.total_amount = t_order.total_amount
|
54 |
order.total_amount = t_order.total_amount
|
| 55 |
order.total_weight = t_order.total_weight
|
55 |
order.total_weight = t_order.total_weight
|
| 56 |
if t_order.created_timestamp:
|
56 |
if t_order.created_timestamp:
|
| 57 |
order.created_timestamp = to_py_date(t_order.created_timestamp)
|
57 |
order.created_timestamp = to_py_date(t_order.created_timestamp)
|
| Line 102... |
Line 102... |
| 102 |
"""
|
102 |
"""
|
| 103 |
litem.order = order
|
103 |
litem.order = order
|
| 104 |
|
104 |
|
| 105 |
#add payment info
|
105 |
#add payment info
|
| 106 |
#transaction.payments=[]
|
106 |
#transaction.payments=[]
|
| - |
|
107 |
"""
|
| 107 |
if t_transaction.paymentInfo:
|
108 |
if t_transaction.paymentInfo:
|
| 108 |
if not t_transaction.paymentInfo.payments:
|
109 |
if not t_transaction.paymentInfo.payments:
|
| 109 |
raise TransactionServiceException(108, "no payments found")
|
110 |
raise TransactionServiceException(108, "no payments found")
|
| 110 |
|
111 |
|
| 111 |
for k,v in t_transaction.paymentInfo.payments.iteritems():
|
112 |
for k,v in t_transaction.paymentInfo.payments.iteritems():
|
| Line 118... |
Line 119... |
| 118 |
payment.status = v.status
|
119 |
payment.status = v.status
|
| 119 |
payment.status_message = v.description
|
120 |
payment.status_message = v.description
|
| 120 |
payment.start_time = to_py_date(v.submissionTimestamp)
|
121 |
payment.start_time = to_py_date(v.submissionTimestamp)
|
| 121 |
payment.finish_time = to_py_date(v.completionTimestamp)
|
122 |
payment.finish_time = to_py_date(v.completionTimestamp)
|
| 122 |
transaction.payments.append(payment)
|
123 |
transaction.payments.append(payment)
|
| - |
|
124 |
"""
|
| 123 |
session.commit()
|
125 |
session.commit()
|
| 124 |
return transaction.id
|
126 |
return transaction.id
|
| 125 |
|
127 |
|
| 126 |
def get_transaction(transaction_id):
|
128 |
def get_transaction(transaction_id):
|
| 127 |
transaction = Transaction.get_by(id=transaction_id)
|
129 |
transaction = Transaction.get_by(id=transaction_id)
|