| Line 2... |
Line 2... |
| 2 |
Created on 29-Mar-2010
|
2 |
Created on 29-Mar-2010
|
| 3 |
|
3 |
|
| 4 |
@author: ashish
|
4 |
@author: ashish
|
| 5 |
'''
|
5 |
'''
|
| 6 |
from elixir import session
|
6 |
from elixir import session
|
| 7 |
from shop2020.helpers.impl.DataAccessor import close_session
|
- |
|
| 8 |
from shop2020.model.v1.order.impl import DataService, RedExpressUpdateService, \
|
7 |
from shop2020.model.v1.order.impl import DataService, RedExpressUpdateService, \
|
| 9 |
RechargeService
|
8 |
RechargeService
|
| 10 |
from shop2020.model.v1.order.impl.Convertors import to_t_transaction, to_t_alert, \
|
9 |
from shop2020.model.v1.order.impl.Convertors import to_t_transaction, to_t_alert, \
|
| 11 |
to_t_order, to_t_lineitem, to_t_payment_settlement, to_t_verification_agent, \
|
10 |
to_t_order, to_t_lineitem, to_t_payment_settlement, to_t_verification_agent, \
|
| 12 |
to_t_attribute, to_t_rechargeTransaction, to_t_frc, to_t_hotspot, \
|
11 |
to_t_attribute, to_t_rechargeTransaction, to_t_frc, to_t_hotspot, \
|
| Line 116... |
Line 115... |
| 116 |
get_return_pickup_request, mark_return_not_required_orders_as_processed, \
|
115 |
get_return_pickup_request, mark_return_not_required_orders_as_processed, \
|
| 117 |
get_all_return_orders_for_return_pickup_request, unaccept_order, \
|
116 |
get_all_return_orders_for_return_pickup_request, unaccept_order, \
|
| 118 |
get_outstanding_payments, mark_payment_settled, get_seller_info, \
|
117 |
get_outstanding_payments, mark_payment_settled, get_seller_info, \
|
| 119 |
get_warehouse_address, get_buyer_by_warehouse, add_shipment_delay, \
|
118 |
get_warehouse_address, get_buyer_by_warehouse, add_shipment_delay, \
|
| 120 |
refund_return_order, get_cost_detail_for_logistics_txn_id, add_shipment_logistic_detail, \
|
119 |
refund_return_order, get_cost_detail_for_logistics_txn_id, add_shipment_logistic_detail, \
|
| 121 |
create_payment, calculate_payment_amount
|
120 |
create_payment, calculate_payment_amount, add_amount_in_wallet
|
| 122 |
from shop2020.model.v1.order.impl.DataService import DtrBatchCreditTracker
|
121 |
from shop2020.model.v1.order.impl.DataService import DtrBatchCreditTracker
|
| 123 |
from shop2020.model.v1.order.impl.ObsoleteDataAccessors import create_ebay_order, \
|
122 |
from shop2020.model.v1.order.impl.ObsoleteDataAccessors import create_ebay_order, \
|
| 124 |
get_ebay_order_by_orderId, get_ebay_order_by_sales_rec_number, get_ebay_order, \
|
123 |
get_ebay_order_by_orderId, get_ebay_order_by_sales_rec_number, get_ebay_order, \
|
| 125 |
update_ebay_order, ebay_order_exists, update_order_for_ebay, split_ebay_order, \
|
124 |
update_ebay_order, ebay_order_exists, update_order_for_ebay, split_ebay_order, \
|
| 126 |
add_or_update_amazon_fba_sales_snapshot, get_amazon_fba_sales_snapshot_for_days, \
|
125 |
add_or_update_amazon_fba_sales_snapshot, get_amazon_fba_sales_snapshot_for_days, \
|
| Line 143... |
Line 142... |
| 143 |
MobileRechargeOrder
|
142 |
MobileRechargeOrder
|
| 144 |
from shop2020.model.v1.order.impl.model.UserWalletHistory import \
|
143 |
from shop2020.model.v1.order.impl.model.UserWalletHistory import \
|
| 145 |
UserWalletHistory
|
144 |
UserWalletHistory
|
| 146 |
from shop2020.model.v1.user.impl.Converters import to_t_address
|
145 |
from shop2020.model.v1.user.impl.Converters import to_t_address
|
| 147 |
from shop2020.thriftpy.model.v1.order.ttypes import TransactionServiceException, \
|
146 |
from shop2020.thriftpy.model.v1.order.ttypes import TransactionServiceException, \
|
| 148 |
RechargeType, AmazonOrdersToAcknowledge
|
147 |
RechargeType, AmazonOrdersToAcknowledge, WalletReferenceType
|
| 149 |
from shop2020.utils.Utils import to_py_date, get_fdate_tdate, to_java_date
|
148 |
from shop2020.utils.Utils import to_py_date, get_fdate_tdate, to_java_date
|
| 150 |
import datetime
|
149 |
import datetime
|
| 151 |
import json
|
150 |
import json
|
| 152 |
|
151 |
|
| 153 |
|
152 |
|
| Line 2645... |
Line 2644... |
| 2645 |
try:
|
2644 |
try:
|
| 2646 |
now = datetime.datetime.now()
|
2645 |
now = datetime.datetime.now()
|
| 2647 |
sum = 0
|
2646 |
sum = 0
|
| 2648 |
for key, amount in json.loads(userAmount).iteritems():
|
2647 |
for key, amount in json.loads(userAmount).iteritems():
|
| 2649 |
userId = int(key)
|
2648 |
userId = int(key)
|
| 2650 |
wallet = get_user_wallet(userId)
|
- |
|
| 2651 |
wallet.amount = wallet.amount + amount
|
2649 |
add_amount_in_wallet(userId, amount, batchId, WalletReferenceType.PURCHASE, True)
|
| 2652 |
history = UserWalletHistory()
|
- |
|
| 2653 |
history.amount = amount
|
- |
|
| 2654 |
history.orderId = batchId
|
- |
|
| 2655 |
history.wallet = wallet
|
- |
|
| 2656 |
history.timestamp = now
|
- |
|
| 2657 |
sum += amount
|
2650 |
sum += amount
|
| 2658 |
|
2651 |
|
| 2659 |
batchCreditTracker = DtrBatchCreditTracker()
|
2652 |
batchCreditTracker = DtrBatchCreditTracker()
|
| 2660 |
batchCreditTracker.id = batchId
|
2653 |
batchCreditTracker.id = batchId
|
| 2661 |
batchCreditTracker.amount = sum
|
2654 |
batchCreditTracker.amount = sum
|