| Line 1... |
Line 1... |
| 1 |
'''
|
1 |
'''
|
| 2 |
Created on 29-Mar-2010
|
2 |
Created on 29-Mar-2010
|
| 3 |
|
3 |
|
| 4 |
@author: ashish
|
4 |
@author: ashish
|
| 5 |
'''
|
5 |
'''
|
| 6 |
from shop2020.model.v1.order.impl import DataService
|
- |
|
| 7 |
from elixir import session
|
6 |
from elixir import session
|
| - |
|
7 |
from shop2020.model.v1.order.impl import DataService
|
| 8 |
from shop2020.model.v1.order.impl.Convertors import to_t_transaction, to_t_alert, \
|
8 |
from shop2020.model.v1.order.impl.Convertors import to_t_transaction, to_t_alert, \
|
| 9 |
to_t_order, to_t_lineitem, to_t_payment_settlement, to_t_verification_agent, \
|
9 |
to_t_order, to_t_lineitem, to_t_payment_settlement, to_t_verification_agent, \
|
| 10 |
to_t_attribute
|
10 |
to_t_attribute
|
| 11 |
from shop2020.model.v1.order.impl.DataAccessors import create_transaction, \
|
11 |
from shop2020.model.v1.order.impl.DataAccessors import create_transaction, \
|
| 12 |
get_transactions_for_customer, get_transaction_status, get_line_items_for_order, \
|
12 |
get_transactions_for_customer, get_transaction_status, get_line_items_for_order, \
|
| Line 53... |
Line 53... |
| 53 |
get_order_list_for_vendor, update_order_only_as_paid_to_vendor, \
|
53 |
get_order_list_for_vendor, update_order_only_as_paid_to_vendor, \
|
| 54 |
get_all_verification_agents, get_all_attributes_for_order_id, \
|
54 |
get_all_verification_agents, get_all_attributes_for_order_id, \
|
| 55 |
set_order_attribute_for_transaction, get_billed_orders, get_all_return_orders, \
|
55 |
set_order_attribute_for_transaction, get_billed_orders, get_all_return_orders, \
|
| 56 |
mark_order_as_received_at_store, get_receive_pending_orders, \
|
56 |
mark_order_as_received_at_store, get_receive_pending_orders, \
|
| 57 |
get_received_at_store_orders, mark_orders_as_returned_from_store, \
|
57 |
get_received_at_store_orders, mark_orders_as_returned_from_store, \
|
| 58 |
set_order_attributes, get_orders_collection_at_store, get_order_attribute_value,\
|
58 |
set_order_attributes, get_orders_collection_at_store, get_order_attribute_value, \
|
| 59 |
change_jacket_number, mark_order_as_rto_in_transit, get_recharge_order,\
|
59 |
change_jacket_number, mark_order_as_rto_in_transit, get_recharge_order, \
|
| 60 |
get_recharge_orders, update_recharge_order_status, activate_recharge_txn,\
|
60 |
get_recharge_orders, update_recharge_order_status, activate_recharge_txn, \
|
| 61 |
get_user_wallet, get_user_wallet_history, get_service_providers,\
|
61 |
get_user_wallet, get_user_wallet_history, get_service_providers, \
|
| 62 |
get_service_provider_for_device
|
62 |
get_service_provider_for_device, get_recharge_orders_for_transaction
|
| 63 |
from shop2020.model.v1.order.impl.model.DTHRechargeOrder import DTHRechargeOrder
|
63 |
from shop2020.model.v1.order.impl.model.DTHRechargeOrder import DTHRechargeOrder
|
| - |
|
64 |
from shop2020.model.v1.order.impl.model.DigitalTransaction import \
|
| - |
|
65 |
DigitalTransaction
|
| 64 |
from shop2020.model.v1.order.impl.model.MobileRechargeOrder import \
|
66 |
from shop2020.model.v1.order.impl.model.MobileRechargeOrder import \
|
| 65 |
MobileRechargeOrder
|
67 |
MobileRechargeOrder
|
| 66 |
from shop2020.thriftpy.model.v1.order.ttypes import TransactionServiceException, \
|
68 |
from shop2020.thriftpy.model.v1.order.ttypes import TransactionServiceException, \
|
| 67 |
RechargeType
|
69 |
RechargeType
|
| 68 |
from shop2020.utils.Utils import to_py_date, get_fdate_tdate, to_java_date
|
70 |
from shop2020.utils.Utils import to_py_date, get_fdate_tdate, to_java_date
|
| 69 |
from shop2020.model.v1.order.impl.model.DigitalTransaction import DigitalTransaction
|
- |
|
| 70 |
import datetime
|
71 |
import datetime
|
| 71 |
|
72 |
|
| 72 |
|
73 |
|
| 73 |
|
74 |
|
| 74 |
class OrderServiceHandler:
|
75 |
class OrderServiceHandler:
|
| Line 1671... |
Line 1672... |
| 1671 |
if rechargeOrder is None:
|
1672 |
if rechargeOrder is None:
|
| 1672 |
raise TransactionServiceException(102, 'Unsupported recharge type')
|
1673 |
raise TransactionServiceException(102, 'Unsupported recharge type')
|
| 1673 |
|
1674 |
|
| 1674 |
transaction = DigitalTransaction()
|
1675 |
transaction = DigitalTransaction()
|
| 1675 |
transaction.createdOn = datetime.datetime.now()
|
1676 |
transaction.createdOn = datetime.datetime.now()
|
| 1676 |
transaction.userId = rechargeOrder.userId
|
1677 |
transaction.userId = thriftRechargeOrder.userId
|
| 1677 |
transaction.orders = [rechargeOrder]
|
1678 |
transaction.orders = [rechargeOrder]
|
| 1678 |
|
1679 |
|
| 1679 |
rechargeOrder.from_thrift_object(thriftRechargeOrder)
|
1680 |
rechargeOrder.from_thrift_object(thriftRechargeOrder)
|
| 1680 |
session.commit()
|
1681 |
session.commit()
|
| 1681 |
return rechargeOrder.to_thrift_object()
|
1682 |
return rechargeOrder.to_thrift_object()
|
| Line 1763... |
Line 1764... |
| 1763 |
"""
|
1764 |
"""
|
| 1764 |
try:
|
1765 |
try:
|
| 1765 |
return get_service_provider_for_device(rechargeType, deviceNumber)
|
1766 |
return get_service_provider_for_device(rechargeType, deviceNumber)
|
| 1766 |
finally:
|
1767 |
finally:
|
| 1767 |
self.closeSession()
|
1768 |
self.closeSession()
|
| - |
|
1769 |
|
| - |
|
1770 |
def getRechargeOrdersForTransaction(self, txId):
|
| - |
|
1771 |
"""
|
| - |
|
1772 |
Parameters:
|
| - |
|
1773 |
- transactionId
|
| - |
|
1774 |
"""
|
| - |
|
1775 |
try:
|
| - |
|
1776 |
return get_recharge_orders_for_transaction(txId).to_thrift_object()
|
| - |
|
1777 |
finally:
|
| - |
|
1778 |
self.closeSession()
|
| 1768 |
|
1779 |
|
| 1769 |
def closeSession(self, ):
|
1780 |
def closeSession(self, ):
|
| 1770 |
close_session()
|
1781 |
close_session()
|
| 1771 |
|
1782 |
|
| 1772 |
def isAlive(self, ):
|
1783 |
def isAlive(self, ):
|