| 104 |
ashish |
1 |
'''
|
|
|
2 |
Created on 29-Mar-2010
|
|
|
3 |
|
|
|
4 |
@author: ashish
|
|
|
5 |
'''
|
| 6056 |
amit.gupta |
6 |
from elixir import session
|
| 7363 |
rajveer |
7 |
from shop2020.model.v1.order.impl import DataService, RedExpressUpdateService,\
|
|
|
8 |
RechargeService
|
| 6000 |
mandeep.dh |
9 |
from shop2020.model.v1.order.impl.Convertors import to_t_transaction, to_t_alert, \
|
|
|
10 |
to_t_order, to_t_lineitem, to_t_payment_settlement, to_t_verification_agent, \
|
| 7311 |
kshitij.so |
11 |
to_t_attribute, to_t_rechargeTransaction, to_t_frc, to_t_hotspot, to_t_sourcedetail, \
|
| 7967 |
anupam.sin |
12 |
to_t_amazonorder, to_t_storeOrderDetail, to_t_storeOrderCollection, \
|
| 8488 |
amar.kumar |
13 |
to_t_hotspotServiceMatrix, to_t_ebayOrder, to_t_amazonFbaSalesSnapshot, \
|
|
|
14 |
to_t_snapdealOrder
|
| 8282 |
kshitij.so |
15 |
|
| 6000 |
mandeep.dh |
16 |
from shop2020.model.v1.order.impl.DataAccessors import create_transaction, \
|
|
|
17 |
get_transactions_for_customer, get_transaction_status, get_line_items_for_order, \
|
|
|
18 |
get_transaction, get_transactions_for_shopping_cart_id, \
|
|
|
19 |
change_transaction_status, get_orders_for_customer, get_orders_for_transaction, \
|
|
|
20 |
get_order, get_returnable_orders_for_customer, \
|
|
|
21 |
get_cancellable_orders_for_customer, get_orders_by_billing_date, get_all_orders, \
|
|
|
22 |
change_order_status, get_alerts, add_alert, add_billing_details, close_session, \
|
|
|
23 |
accept_order, mark_orders_as_picked_up, mark_orders_as_delivered, \
|
|
|
24 |
mark_orders_as_rto, order_outofstock, batch_orders, update_non_delivery_reason, \
|
|
|
25 |
enqueue_transaction_info_email, get_undelivered_orders, get_order_for_customer, \
|
|
|
26 |
get_valid_order_count, get_cust_count_with_successful_txn, \
|
|
|
27 |
get_valid_orders_amount_range, get_valid_orders, toggle_doa_flag, \
|
|
|
28 |
request_pickup_number, authorize_pickup, receive_return, validate_doa, \
|
|
|
29 |
reship_order, refund_order, get_return_orders, process_return, get_return_order, \
|
|
|
30 |
mark_doas_as_picked_up, verify_order, is_alive, get_orders_by_shipping_date, \
|
|
|
31 |
update_weight, change_warehouse, change_product, add_delay_reason, \
|
|
|
32 |
reconcile_cod_collection, get_transactions_requiring_extra_processing, \
|
|
|
33 |
mark_transaction_as_processed, get_item_wise_risky_orders_count, \
|
|
|
34 |
accept_order_for_item, get_orders_in_batch, get_order_count, \
|
|
|
35 |
get_ebs_settlement_summaries, mark_order_cancellation_request_received, \
|
|
|
36 |
mark_order_cancellation_request_denied, refund_transaction, \
|
|
|
37 |
mark_order_cancellation_request_confirmed, \
|
|
|
38 |
mark_transaction_as_payment_flag_removed, accept_orders_for_item_id, \
|
|
|
39 |
mark_orders_as_po_raised, mark_orders_as_reversal_initiated, \
|
|
|
40 |
mark_orders_as_not_available, update_shipment_address, mark_orders_as_timeout, \
|
|
|
41 |
get_order_for_awb, mark_orders_as_shipped_from_warehouse, mark_alerts_as_seen, \
|
|
|
42 |
mark_order_doa_request_received, mark_order_doa_request_authorized, \
|
|
|
43 |
mark_order_return_request_received, mark_order_return_request_authorized, \
|
|
|
44 |
add_invoice_number, get_reshipped_order_ids, validate_return_product, \
|
|
|
45 |
get_orders_for_provider_for_status, save_ebs_settlement_summary, \
|
|
|
46 |
get_ebs_settlement_date, save_payment_settlements, mark_ebs_settlement_uploaded, \
|
|
|
47 |
get_billed_orders_for_vendor, get_settlement_for_Prepaid, \
|
|
|
48 |
get_settlements_by_date, get_slipped_sipping_date_orders, \
|
|
|
49 |
mark_order_as_lost_in_transit, get_cancelled_orders, mark_order_as_delivered, \
|
|
|
50 |
mark_return_orders_as_picked_up, update_orders_as_PORaised, \
|
|
|
51 |
get_order_distribution_by_status, get_orders_not_met_expected_delivery_date, \
|
|
|
52 |
mark_orders_as_local_connected, mark_orders_as_destinationCityReached, \
|
|
|
53 |
mark_orders_as_firstDeliveryAttempted, get_non_delivered_orders_by_courier, \
|
|
|
54 |
get_orders_not_local_connected, get_doas_not_picked_up, \
|
|
|
55 |
get_return_orders_not_picked_up, get_orders_not_picked_up, get_rto_orders, \
|
|
|
56 |
get_order_list, get_order_ids_for_status, update_orders_as_paid_to_vendor, \
|
|
|
57 |
update_COD_agent, get_refunded_orders_marked_paid, get_settlement_for_Cod, \
|
|
|
58 |
get_order_list_for_vendor, update_order_only_as_paid_to_vendor, \
|
|
|
59 |
get_all_verification_agents, get_all_attributes_for_order_id, \
|
|
|
60 |
set_order_attribute_for_transaction, get_billed_orders, get_all_return_orders, \
|
|
|
61 |
mark_order_as_received_at_store, get_receive_pending_orders, \
|
|
|
62 |
get_received_at_store_orders, mark_orders_as_returned_from_store, \
|
| 6056 |
amit.gupta |
63 |
set_order_attributes, get_orders_collection_at_store, get_order_attribute_value, \
|
|
|
64 |
change_jacket_number, mark_order_as_rto_in_transit, get_recharge_order, \
|
|
|
65 |
get_recharge_orders, update_recharge_order_status, activate_recharge_txn, \
|
|
|
66 |
get_user_wallet, get_user_wallet_history, get_service_providers, \
|
| 6396 |
amit.gupta |
67 |
get_service_provider_for_device, get_recharge_orders_for_transaction, \
|
|
|
68 |
update_amount_in_wallet, get_recharge_orders_for_device, \
|
|
|
69 |
get_recharge_orders_for_status, get_plans_for_operator, get_recharge_statistics, \
|
|
|
70 |
validate_recharge, get_recharge_denominations, update_availability_status, \
|
| 6821 |
amar.kumar |
71 |
get_misc_charges, get_available_emi_schemes, refund_recharge_order, \
|
| 7073 |
anupam.sin |
72 |
create_recharge_transaction, get_physical_orders, get_document, retrieve_invoice, \
|
| 7125 |
amit.gupta |
73 |
change_shipping_address, get_recharge_transactions, get_recharge_transaction, \
|
| 7151 |
amit.gupta |
74 |
get_frcs, get_hotspot_store, get_circle, retrieve_hotspot_recharge_invoice, \
|
| 7190 |
amar.kumar |
75 |
get_recharge_trans, split_freebie_order, get_recharge_transactions_by_number, \
|
| 7285 |
rajveer |
76 |
update_hotspot_store_password, get_source_detail, get_all_circles, delete_frcs,\
|
| 7311 |
kshitij.so |
77 |
topup_company_wallet, get_wallet_balance_for_company, \
|
| 7343 |
anupam.sin |
78 |
add_amazon_order, update_amazon_order_status,get_amazon_order, get_amazon_orders_shipped, \
|
| 7371 |
anupam.sin |
79 |
get_amazon_orders_cancelled, get_orders_for_store, get_store_order_advance_invoice, add_frc, \
|
| 7393 |
anupam.sin |
80 |
add_series, get_store_order_detail, save_store_order_detail, get_all_edc_banks, \
|
| 7442 |
vikram.rag |
81 |
save_refund_amounts_for_store_order, get_collections_for_store,get_amazon_orders_to_acknowledge, \
|
| 7607 |
anupam.sin |
82 |
change_amazon_order_status,update_timestamp_for_amazon_order,update_source_detail_timestamp, \
|
|
|
83 |
get_amazon_order_by_amazonorderid, get_orders_by_mobile_number, get_orders_by_amazon_id, \
|
| 7967 |
anupam.sin |
84 |
change_courier_provider, convert_store_to_normal, update_freebie_item, update_order_AWB, \
|
| 8182 |
amar.kumar |
85 |
get_hotspot_service_matrices, get_orders_by_vendor, create_ebay_order, \
|
|
|
86 |
get_ebay_order_by_sales_rec_number, get_ebay_order_by_orderId, update_ebay_order, \
|
| 8488 |
amar.kumar |
87 |
ebay_order_exists, update_order_for_ebay, get_ebay_order, split_ebay_order, \
|
|
|
88 |
add_or_update_amazon_fba_sales_snapshot, get_amazon_fba_sales_snapshot_for_days, \
|
|
|
89 |
get_amazon_fba_sales_latest_snapshot_for_item, create_snapdeal_order, \
|
|
|
90 |
get_snapdeal_order, snapdeal_order_exists
|
| 7343 |
anupam.sin |
91 |
|
| 6000 |
mandeep.dh |
92 |
from shop2020.model.v1.order.impl.model.DTHRechargeOrder import DTHRechargeOrder
|
| 6056 |
amit.gupta |
93 |
from shop2020.model.v1.order.impl.model.DigitalTransaction import \
|
|
|
94 |
DigitalTransaction
|
| 6000 |
mandeep.dh |
95 |
from shop2020.model.v1.order.impl.model.MobileRechargeOrder import \
|
|
|
96 |
MobileRechargeOrder
|
|
|
97 |
from shop2020.thriftpy.model.v1.order.ttypes import TransactionServiceException, \
|
| 7442 |
vikram.rag |
98 |
RechargeType,AmazonOrdersToAcknowledge
|
| 6000 |
mandeep.dh |
99 |
from shop2020.utils.Utils import to_py_date, get_fdate_tdate, to_java_date
|
| 6031 |
rajveer |
100 |
import datetime
|
| 8182 |
amar.kumar |
101 |
from shop2020.helpers.impl.DataAccessor import close_session
|
| 8488 |
amar.kumar |
102 |
from shop2020.model.v1.user.impl.Converters import to_t_address
|
| 1405 |
ankur.sing |
103 |
|
| 5527 |
anupam.sin |
104 |
|
| 104 |
ashish |
105 |
|
|
|
106 |
class OrderServiceHandler:
|
|
|
107 |
|
| 3187 |
rajveer |
108 |
def __init__(self, dbname='transaction', db_hostname='localhost'):
|
| 483 |
rajveer |
109 |
"""
|
| 104 |
ashish |
110 |
Constructor
|
| 483 |
rajveer |
111 |
"""
|
| 3187 |
rajveer |
112 |
DataService.initialize(dbname, db_hostname)
|
| 104 |
ashish |
113 |
|
|
|
114 |
def createTransaction(self, transaction):
|
|
|
115 |
"""
|
|
|
116 |
Parameters:
|
|
|
117 |
- transaction
|
|
|
118 |
"""
|
| 766 |
rajveer |
119 |
try:
|
|
|
120 |
return create_transaction(transaction)
|
|
|
121 |
finally:
|
|
|
122 |
close_session()
|
|
|
123 |
|
| 104 |
ashish |
124 |
def getTransaction(self, id):
|
|
|
125 |
"""
|
|
|
126 |
Get transaction methods.
|
|
|
127 |
|
|
|
128 |
Parameters:
|
|
|
129 |
- id
|
|
|
130 |
"""
|
| 766 |
rajveer |
131 |
try:
|
|
|
132 |
transaction = get_transaction(id)
|
|
|
133 |
return to_t_transaction(transaction)
|
|
|
134 |
finally:
|
|
|
135 |
close_session()
|
|
|
136 |
|
| 483 |
rajveer |
137 |
def getTransactionsForCustomer(self, customerId, from_date, to_date, status):
|
| 104 |
ashish |
138 |
"""
|
|
|
139 |
Parameters:
|
| 483 |
rajveer |
140 |
- customerId
|
| 104 |
ashish |
141 |
- from_date
|
|
|
142 |
- to_date
|
| 483 |
rajveer |
143 |
- status
|
| 104 |
ashish |
144 |
"""
|
| 766 |
rajveer |
145 |
try:
|
|
|
146 |
current_from_date, current_to_date = get_fdate_tdate(from_date, to_date)
|
|
|
147 |
|
|
|
148 |
transactions = get_transactions_for_customer(customerId, current_from_date, current_to_date, status)
|
|
|
149 |
t_transaction = []
|
|
|
150 |
for transaction in transactions:
|
|
|
151 |
t_transaction.append(to_t_transaction(transaction))
|
|
|
152 |
return t_transaction
|
|
|
153 |
finally:
|
|
|
154 |
close_session()
|
| 483 |
rajveer |
155 |
|
|
|
156 |
def getTransactionsForShoppingCartId(self, shoppingCartId):
|
|
|
157 |
"""
|
|
|
158 |
Parameters:
|
|
|
159 |
- shoppingCartId
|
|
|
160 |
"""
|
| 766 |
rajveer |
161 |
try:
|
|
|
162 |
transactions = get_transactions_for_shopping_cart_id(shoppingCartId)
|
|
|
163 |
t_transaction = []
|
|
|
164 |
for transaction in transactions:
|
|
|
165 |
t_transaction.append(to_t_transaction(transaction))
|
|
|
166 |
return t_transaction
|
|
|
167 |
finally:
|
|
|
168 |
close_session()
|
| 104 |
ashish |
169 |
|
| 483 |
rajveer |
170 |
def getTransactionStatus(self, transactionId):
|
| 104 |
ashish |
171 |
"""
|
|
|
172 |
Parameters:
|
| 483 |
rajveer |
173 |
- transactionId
|
|
|
174 |
"""
|
| 766 |
rajveer |
175 |
try:
|
|
|
176 |
return get_transaction_status(transactionId)
|
|
|
177 |
finally:
|
|
|
178 |
close_session()
|
|
|
179 |
|
| 7293 |
anupam.sin |
180 |
def changeTransactionStatus(self, transactionId, status, description, pickUp, orderType, source):
|
| 483 |
rajveer |
181 |
"""
|
|
|
182 |
Parameters:
|
|
|
183 |
- transactionId
|
| 104 |
ashish |
184 |
- status
|
| 483 |
rajveer |
185 |
- description
|
| 5387 |
rajveer |
186 |
- selfPickup
|
| 483 |
rajveer |
187 |
"""
|
| 766 |
rajveer |
188 |
try:
|
| 7293 |
anupam.sin |
189 |
return change_transaction_status(transactionId, status, description, pickUp, orderType, source)
|
| 766 |
rajveer |
190 |
finally:
|
|
|
191 |
close_session()
|
|
|
192 |
|
| 1528 |
ankur.sing |
193 |
def getOrdersForTransaction(self, transactionId, customerId):
|
| 483 |
rajveer |
194 |
"""
|
| 1528 |
ankur.sing |
195 |
Returns list of orders for given transaction Id. Also filters based on customer Id so that
|
|
|
196 |
only user who owns the transaction can view its order details.
|
|
|
197 |
|
| 483 |
rajveer |
198 |
Parameters:
|
|
|
199 |
- transactionId
|
| 1528 |
ankur.sing |
200 |
- customerId
|
| 483 |
rajveer |
201 |
"""
|
| 766 |
rajveer |
202 |
try:
|
| 1528 |
ankur.sing |
203 |
orders = get_orders_for_transaction(transactionId, customerId)
|
| 766 |
rajveer |
204 |
return [to_t_order(order) for order in orders]
|
|
|
205 |
finally:
|
|
|
206 |
close_session()
|
|
|
207 |
|
| 4801 |
anupam.sin |
208 |
def getAllOrders(self, statuses, from_date, to_date, warehouse_id):
|
| 483 |
rajveer |
209 |
"""
|
|
|
210 |
Parameters:
|
|
|
211 |
- status
|
| 104 |
ashish |
212 |
- from_date
|
|
|
213 |
- to_date
|
| 483 |
rajveer |
214 |
- warehouse_id
|
| 104 |
ashish |
215 |
"""
|
| 766 |
rajveer |
216 |
try:
|
|
|
217 |
current_from_date, current_to_date = get_fdate_tdate(from_date, to_date)
|
| 4801 |
anupam.sin |
218 |
orders = get_all_orders(statuses, current_from_date, current_to_date, warehouse_id)
|
| 766 |
rajveer |
219 |
return [to_t_order(order) for order in orders]
|
|
|
220 |
finally:
|
|
|
221 |
close_session()
|
| 4133 |
chandransh |
222 |
|
| 8303 |
amar.kumar |
223 |
def getOrdersInBatch(self, statuses, offset, limit, warehouse_id, source):
|
| 4133 |
chandransh |
224 |
"""
|
|
|
225 |
Returns at most 'limit' orders with the given statuses for the given warehouse starting from the given offset.
|
|
|
226 |
Pass the status as null and the limit as 0 to ignore them.
|
|
|
227 |
|
|
|
228 |
Parameters:
|
|
|
229 |
- statuses
|
|
|
230 |
- offset
|
|
|
231 |
- limit
|
|
|
232 |
- warehouse_id
|
|
|
233 |
"""
|
|
|
234 |
try:
|
| 8303 |
amar.kumar |
235 |
orders = get_orders_in_batch(statuses, offset, limit, warehouse_id, source)
|
| 4133 |
chandransh |
236 |
return [to_t_order(order) for order in orders]
|
|
|
237 |
finally:
|
|
|
238 |
close_session()
|
|
|
239 |
|
| 8303 |
amar.kumar |
240 |
def getOrderCount(self, statuses, warehouseId, source):
|
| 4133 |
chandransh |
241 |
"""
|
|
|
242 |
Returns the count of orders with the given statuses assigned to the given warehouse.
|
|
|
243 |
|
|
|
244 |
Parameters:
|
|
|
245 |
- statuses
|
|
|
246 |
- warehouseId
|
|
|
247 |
"""
|
|
|
248 |
try:
|
| 8303 |
amar.kumar |
249 |
return get_order_count(statuses, warehouseId, source)
|
| 4133 |
chandransh |
250 |
finally:
|
|
|
251 |
close_session()
|
|
|
252 |
|
| 995 |
varun.gupt |
253 |
def getOrdersByBillingDate(self, status, start_billing_date, end_billing_date, warehouse_id):
|
|
|
254 |
"""
|
|
|
255 |
Parameters:
|
|
|
256 |
- status
|
|
|
257 |
- start_billing_date
|
|
|
258 |
- end_billing_date
|
|
|
259 |
- warehouse_id
|
|
|
260 |
"""
|
|
|
261 |
try:
|
|
|
262 |
current_start_billing_date, current_end_billing_date = get_fdate_tdate(start_billing_date, end_billing_date)
|
|
|
263 |
orders = get_orders_by_billing_date(status, current_start_billing_date, current_end_billing_date, warehouse_id)
|
|
|
264 |
return [to_t_order(order) for order in orders]
|
|
|
265 |
finally:
|
|
|
266 |
close_session()
|
| 1382 |
varun.gupt |
267 |
|
| 3451 |
chandransh |
268 |
def getOrdersByShippingDate(self, fromShippingDate, toShippingDate, providerId, warehouseId, cod):
|
| 3427 |
chandransh |
269 |
"""
|
|
|
270 |
Returns orders for a particular provider and warehouse which were shipped between the given dates.
|
| 3451 |
chandransh |
271 |
Returned orders comprise of COD orders if cod parameter is true. It comprises of prepaid orders otherwise.
|
|
|
272 |
Pass providerId and warehouseId as -1 to ignore both these parameters.
|
| 3427 |
chandransh |
273 |
|
|
|
274 |
Parameters:
|
|
|
275 |
- fromShippingDate
|
|
|
276 |
- toShippingDate
|
|
|
277 |
- providerId
|
|
|
278 |
- warehouseId
|
| 3451 |
chandransh |
279 |
- cod
|
| 3427 |
chandransh |
280 |
"""
|
|
|
281 |
try:
|
|
|
282 |
from_shipping_date, to_shipping_date = get_fdate_tdate(fromShippingDate, toShippingDate)
|
| 3451 |
chandransh |
283 |
orders = get_orders_by_shipping_date(from_shipping_date, to_shipping_date, providerId, warehouseId, cod)
|
| 3427 |
chandransh |
284 |
return [to_t_order(order) for order in orders]
|
|
|
285 |
finally:
|
|
|
286 |
close_session()
|
|
|
287 |
|
| 1382 |
varun.gupt |
288 |
def getReturnableOrdersForCustomer(self, customerId, limit = None):
|
|
|
289 |
"""
|
|
|
290 |
Parameters:
|
|
|
291 |
- customerId
|
|
|
292 |
- limit
|
|
|
293 |
"""
|
|
|
294 |
try:
|
|
|
295 |
return get_returnable_orders_for_customer(customerId, limit)
|
|
|
296 |
finally:
|
|
|
297 |
close_session()
|
| 995 |
varun.gupt |
298 |
|
| 1382 |
varun.gupt |
299 |
def getCancellableOrdersForCustomer(self, customerId, limit = None):
|
|
|
300 |
"""
|
|
|
301 |
Parameters:
|
|
|
302 |
- customerId
|
|
|
303 |
- limit
|
|
|
304 |
"""
|
|
|
305 |
try:
|
|
|
306 |
return get_cancellable_orders_for_customer(customerId, limit)
|
|
|
307 |
finally:
|
|
|
308 |
close_session()
|
|
|
309 |
|
| 483 |
rajveer |
310 |
def changeOrderStatus(self, orderId, status, description):
|
|
|
311 |
"""
|
|
|
312 |
Parameters:
|
|
|
313 |
- orderId
|
|
|
314 |
- status
|
|
|
315 |
- description
|
|
|
316 |
-
|
|
|
317 |
"""
|
| 766 |
rajveer |
318 |
try:
|
|
|
319 |
return change_order_status(self, orderId, status, description)
|
|
|
320 |
finally:
|
|
|
321 |
close_session()
|
| 921 |
rajveer |
322 |
|
| 3064 |
chandransh |
323 |
def verifyOrder(self, orderId):
|
|
|
324 |
"""
|
|
|
325 |
Marks the given order as SUBMITTED_FOR_PROCESSING and updates the verified
|
|
|
326 |
timestamp. It is intended to be used for COD orders but can be harmlessly
|
|
|
327 |
used for all other orders as well.
|
|
|
328 |
Throws an exception if no such order exists.
|
|
|
329 |
|
|
|
330 |
Parameters:
|
|
|
331 |
- orderId
|
|
|
332 |
"""
|
|
|
333 |
try:
|
| 7391 |
rajveer |
334 |
return verify_order(orderId)
|
| 3064 |
chandransh |
335 |
finally:
|
|
|
336 |
close_session()
|
|
|
337 |
|
| 921 |
rajveer |
338 |
def acceptOrder(self, orderId):
|
|
|
339 |
"""
|
| 3064 |
chandransh |
340 |
Marks the given order as ACCEPTED and updates the accepted timestamp. If the
|
|
|
341 |
given order is not a COD order, it also captures the payment if the same has
|
|
|
342 |
not been captured.
|
|
|
343 |
Throws an exception if no such order exists.
|
|
|
344 |
|
| 921 |
rajveer |
345 |
Parameters:
|
|
|
346 |
- orderId
|
|
|
347 |
"""
|
|
|
348 |
try:
|
| 4285 |
rajveer |
349 |
return accept_order(orderId)
|
| 921 |
rajveer |
350 |
finally:
|
|
|
351 |
close_session()
|
|
|
352 |
|
| 3014 |
chandransh |
353 |
def getOrdersForCustomer(self, customerId, from_date, to_date, statuses):
|
| 104 |
ashish |
354 |
"""
|
| 3014 |
chandransh |
355 |
Returns list of orders for the given customer created between the given dates and having the given statuses.
|
|
|
356 |
Pass and empty list to ignore filtering on statuses.
|
|
|
357 |
|
| 104 |
ashish |
358 |
Parameters:
|
|
|
359 |
- customerId
|
|
|
360 |
- from_date
|
|
|
361 |
- to_date
|
| 3014 |
chandransh |
362 |
- statuses
|
| 104 |
ashish |
363 |
"""
|
| 766 |
rajveer |
364 |
try:
|
|
|
365 |
current_from_date, current_to_date = get_fdate_tdate(from_date, to_date)
|
|
|
366 |
|
| 3014 |
chandransh |
367 |
orders = get_orders_for_customer(customerId, current_from_date, current_to_date, statuses)
|
| 766 |
rajveer |
368 |
return [to_t_order(order) for order in orders]
|
|
|
369 |
finally:
|
|
|
370 |
close_session()
|
| 1528 |
ankur.sing |
371 |
|
|
|
372 |
def getOrderForCustomer(self, orderId, customerId):
|
|
|
373 |
"""
|
|
|
374 |
Returns an order for the order Id. Also checks if the order belongs to the customer whose Id is passed.
|
|
|
375 |
Throws exception if either order Id is invalid or order does not below to the customer whose Id is passed.
|
|
|
376 |
|
|
|
377 |
Parameters:
|
|
|
378 |
- customerId
|
|
|
379 |
- orderId
|
|
|
380 |
"""
|
|
|
381 |
try:
|
|
|
382 |
return to_t_order(get_order_for_customer(orderId, customerId))
|
|
|
383 |
finally:
|
|
|
384 |
close_session()
|
| 766 |
rajveer |
385 |
|
| 483 |
rajveer |
386 |
def getOrder(self, id):
|
|
|
387 |
"""
|
|
|
388 |
Parameters:
|
|
|
389 |
- id
|
|
|
390 |
"""
|
| 766 |
rajveer |
391 |
try:
|
|
|
392 |
return to_t_order(get_order(id))
|
|
|
393 |
finally:
|
|
|
394 |
close_session()
|
| 4999 |
phani.kuma |
395 |
|
|
|
396 |
def getOrderList(self, order_ids):
|
|
|
397 |
"""
|
|
|
398 |
Parameters:
|
|
|
399 |
- order_ids
|
|
|
400 |
"""
|
|
|
401 |
try:
|
|
|
402 |
orders = get_order_list(order_ids)
|
|
|
403 |
return [to_t_order(order) for order in orders]
|
|
|
404 |
finally:
|
|
|
405 |
close_session()
|
|
|
406 |
|
| 5386 |
phani.kuma |
407 |
def getOrderListForVendor(self, order_ids, vendorId):
|
|
|
408 |
"""
|
|
|
409 |
Parameters:
|
|
|
410 |
- order_ids
|
|
|
411 |
- vendorId
|
|
|
412 |
"""
|
|
|
413 |
try:
|
|
|
414 |
orders = get_order_list_for_vendor(order_ids, vendorId)
|
|
|
415 |
return [to_t_order(order) for order in orders]
|
|
|
416 |
finally:
|
|
|
417 |
close_session()
|
|
|
418 |
|
| 483 |
rajveer |
419 |
def getLineItemsForOrder(self, orderId):
|
|
|
420 |
"""
|
|
|
421 |
Parameters:
|
|
|
422 |
- orderId
|
|
|
423 |
"""
|
| 766 |
rajveer |
424 |
try:
|
|
|
425 |
lineitems = get_line_items_for_order(orderId)
|
|
|
426 |
t_lineitems = []
|
|
|
427 |
for lineitem in lineitems:
|
|
|
428 |
t_lineitems.append(to_t_lineitem(lineitem))
|
|
|
429 |
return t_lineitems
|
|
|
430 |
finally:
|
|
|
431 |
close_session()
|
| 1149 |
chandransh |
432 |
|
| 7190 |
amar.kumar |
433 |
def addBillingDetails(self, orderId, invoice_number, serialNumber, itemNumber, freebieWarehouseId, billedBy, jacketNumber, billingType, vendorId, authorize):
|
| 494 |
rajveer |
434 |
"""
|
| 4658 |
mandeep.dh |
435 |
Adds jacket number and serial no. to the order. Doesn't update the serial no. if a -1 is supplied.
|
| 2783 |
chandransh |
436 |
Also marks the order as billed and sets the billing timestamp.
|
|
|
437 |
Return false if it doesn't find the order with the given ID.
|
| 1149 |
chandransh |
438 |
|
|
|
439 |
Parameters:
|
|
|
440 |
- orderId
|
|
|
441 |
- jacketNumber
|
| 4658 |
mandeep.dh |
442 |
- serialNumber
|
| 2783 |
chandransh |
443 |
- itemNumber
|
| 7190 |
amar.kumar |
444 |
- freebieWarehouseId
|
| 2783 |
chandransh |
445 |
- billedBy
|
| 1149 |
chandransh |
446 |
"""
|
|
|
447 |
try:
|
| 7190 |
amar.kumar |
448 |
return add_billing_details(orderId, invoice_number, serialNumber, itemNumber, freebieWarehouseId, billedBy, jacketNumber, billingType, vendorId, authorize)
|
| 1149 |
chandransh |
449 |
finally:
|
|
|
450 |
close_session()
|
| 1220 |
chandransh |
451 |
|
| 6751 |
amar.kumar |
452 |
def addInvoiceNumber(self, orderId, invoiceNumber, color, serialNumber, itemNumber):
|
| 4579 |
rajveer |
453 |
"""
|
|
|
454 |
Add the invoice number to the order.
|
|
|
455 |
|
|
|
456 |
Parameters:
|
|
|
457 |
- orderId
|
|
|
458 |
- invoice_number
|
|
|
459 |
"""
|
|
|
460 |
try:
|
| 6751 |
amar.kumar |
461 |
add_invoice_number(orderId, invoiceNumber, color, serialNumber, itemNumber)
|
| 4579 |
rajveer |
462 |
finally:
|
|
|
463 |
close_session()
|
|
|
464 |
|
| 1220 |
chandransh |
465 |
def batchOrders(self, warehouseId):
|
|
|
466 |
"""
|
|
|
467 |
Create a batch of all the pending orders for the given warehouse.
|
|
|
468 |
The returned list is orderd by created_timestamp.
|
|
|
469 |
If there are no pending orders, an empty list is returned.
|
| 1208 |
chandransh |
470 |
|
| 1220 |
chandransh |
471 |
Parameters:
|
|
|
472 |
- warehouseId
|
|
|
473 |
"""
|
|
|
474 |
try:
|
|
|
475 |
pending_orders = batch_orders(warehouseId)
|
|
|
476 |
return [to_t_order(order) for order in pending_orders]
|
|
|
477 |
finally:
|
|
|
478 |
close_session()
|
|
|
479 |
|
| 1208 |
chandransh |
480 |
def markOrderAsOutOfStock(self, orderId):
|
|
|
481 |
"""
|
|
|
482 |
Mark the given order as out of stock. Throws an exception if the order with the given Id couldn't be found.
|
|
|
483 |
|
|
|
484 |
|
|
|
485 |
Parameters:
|
|
|
486 |
- orderId
|
|
|
487 |
"""
|
|
|
488 |
try:
|
|
|
489 |
return order_outofstock(orderId)
|
|
|
490 |
finally:
|
|
|
491 |
close_session()
|
|
|
492 |
|
| 4910 |
phani.kuma |
493 |
def markOrdersAsShippedFromWarehouse(self, warehouseId, providerId, cod, orderIds):
|
| 759 |
chandransh |
494 |
"""
|
| 3064 |
chandransh |
495 |
Depending on the third parameter, marks either all prepaid or all cod orders BILLED by the
|
| 4910 |
phani.kuma |
496 |
given warehouse and were picked up by the given provider as SHIPPED_FROM_WH.
|
| 759 |
chandransh |
497 |
|
|
|
498 |
Parameters:
|
|
|
499 |
- warehouseId
|
|
|
500 |
- providerId
|
| 3064 |
chandransh |
501 |
- cod
|
| 759 |
chandransh |
502 |
"""
|
| 766 |
rajveer |
503 |
try:
|
| 4910 |
phani.kuma |
504 |
return mark_orders_as_shipped_from_warehouse(warehouseId, providerId, cod, orderIds)
|
| 766 |
rajveer |
505 |
finally:
|
|
|
506 |
close_session()
|
| 1113 |
chandransh |
507 |
|
| 5713 |
rajveer |
508 |
def markOrdersAsReturnedFromStore(self, providerId, orderIds, awbs):
|
| 5676 |
rajveer |
509 |
"""
|
|
|
510 |
Parameters:
|
|
|
511 |
- providerId
|
|
|
512 |
- orderIds
|
| 5713 |
rajveer |
513 |
- awbs
|
| 5676 |
rajveer |
514 |
"""
|
|
|
515 |
try:
|
| 5713 |
rajveer |
516 |
return mark_orders_as_returned_from_store(providerId, orderIds, awbs)
|
| 5676 |
rajveer |
517 |
finally:
|
|
|
518 |
close_session()
|
|
|
519 |
|
|
|
520 |
def setOrderAttributes(self, orderId, attributes):
|
|
|
521 |
"""
|
|
|
522 |
sets attributes for an order
|
|
|
523 |
|
|
|
524 |
Parameters:
|
|
|
525 |
- orderId
|
|
|
526 |
- attributes
|
|
|
527 |
"""
|
|
|
528 |
try:
|
|
|
529 |
return set_order_attributes(orderId, attributes)
|
|
|
530 |
finally:
|
|
|
531 |
close_session()
|
|
|
532 |
|
|
|
533 |
|
| 4910 |
phani.kuma |
534 |
def markOrdersAsPickedUp(self, providerId, pickupDetails):
|
| 4410 |
rajveer |
535 |
"""
|
| 4910 |
phani.kuma |
536 |
Marks all SHIPPED_FROM_WH orders of the previous day for a provider as SHIPPED_TO_LOGISTICS.
|
|
|
537 |
Raises an exception if we encounter report for an AWB number that we did not ship.
|
| 4410 |
rajveer |
538 |
|
|
|
539 |
Parameters:
|
|
|
540 |
- providerId
|
| 4910 |
phani.kuma |
541 |
- pickupDetails
|
| 4410 |
rajveer |
542 |
"""
|
|
|
543 |
try:
|
| 4910 |
phani.kuma |
544 |
mark_orders_as_picked_up(providerId, pickupDetails)
|
| 4410 |
rajveer |
545 |
finally:
|
|
|
546 |
close_session()
|
|
|
547 |
|
| 4910 |
phani.kuma |
548 |
def getOrdersNotPickedUp(self, providerId):
|
| 1113 |
chandransh |
549 |
"""
|
|
|
550 |
Returns a list of orders that were shipped from warehouse but did not appear in the pick-up report.
|
|
|
551 |
|
|
|
552 |
Parameters:
|
|
|
553 |
- providerId
|
|
|
554 |
"""
|
|
|
555 |
try:
|
| 4910 |
phani.kuma |
556 |
orders_not_picked_up = get_orders_not_picked_up(providerId)
|
| 1113 |
chandransh |
557 |
return [to_t_order(order) for order in orders_not_picked_up]
|
|
|
558 |
finally:
|
|
|
559 |
close_session()
|
| 1132 |
chandransh |
560 |
|
|
|
561 |
def markOrdersAsDelivered(self, providerId, deliveredOrders):
|
|
|
562 |
"""
|
|
|
563 |
Marks all orders with AWBs in the given map as delivered. Also sets the delivery timestamp and
|
|
|
564 |
the name of the receiver.
|
|
|
565 |
Raises an exception if we encounter report for an AWB number that we did not ship.
|
|
|
566 |
|
|
|
567 |
Parameters:
|
|
|
568 |
- providerId
|
|
|
569 |
- deliveredOrders
|
|
|
570 |
"""
|
|
|
571 |
try:
|
|
|
572 |
mark_orders_as_delivered(providerId, deliveredOrders)
|
|
|
573 |
finally:
|
|
|
574 |
close_session()
|
| 1135 |
chandransh |
575 |
|
| 4712 |
rajveer |
576 |
def markOrderAsDelivered(self, orderId, deliveryTimestamp, receiver):
|
|
|
577 |
"""
|
|
|
578 |
Attributes:
|
|
|
579 |
- orderId
|
|
|
580 |
- deliveryTimestamp
|
|
|
581 |
- receiver
|
|
|
582 |
"""
|
|
|
583 |
try:
|
|
|
584 |
mark_order_as_delivered(orderId, to_py_date(deliveryTimestamp), receiver)
|
|
|
585 |
finally:
|
|
|
586 |
close_session()
|
|
|
587 |
|
|
|
588 |
|
| 5555 |
rajveer |
589 |
def markOrderAsReceivedAtStore(self, orderId, deliveryTimestamp):
|
|
|
590 |
"""
|
|
|
591 |
Attributes:
|
|
|
592 |
- orderId
|
|
|
593 |
- deliveryTimestamp
|
|
|
594 |
"""
|
|
|
595 |
try:
|
|
|
596 |
mark_order_as_received_at_store(orderId, to_py_date(deliveryTimestamp))
|
|
|
597 |
finally:
|
|
|
598 |
close_session()
|
|
|
599 |
|
|
|
600 |
def getReceivePendingOrders(self, storeId):
|
|
|
601 |
"""
|
|
|
602 |
Attributes:
|
|
|
603 |
- storeId
|
|
|
604 |
"""
|
|
|
605 |
try:
|
|
|
606 |
orders = get_receive_pending_orders(storeId)
|
|
|
607 |
return [to_t_order(order) for order in orders]
|
|
|
608 |
finally:
|
|
|
609 |
close_session()
|
|
|
610 |
|
|
|
611 |
def getReceivedAtStoreOrders(self, storeId):
|
|
|
612 |
"""
|
|
|
613 |
Attributes:
|
|
|
614 |
- storeId
|
|
|
615 |
"""
|
|
|
616 |
try:
|
|
|
617 |
orders = get_received_at_store_orders(storeId)
|
|
|
618 |
return [to_t_order(order) for order in orders]
|
|
|
619 |
finally:
|
|
|
620 |
close_session()
|
| 5713 |
rajveer |
621 |
|
|
|
622 |
def getOrdersCollectionAtStore(self, storeId, fromDate, toDate, onlyCod):
|
|
|
623 |
"""
|
|
|
624 |
Parameters:
|
|
|
625 |
- storeId
|
|
|
626 |
- fromDate
|
|
|
627 |
- toDate
|
|
|
628 |
- onlyCod
|
|
|
629 |
"""
|
|
|
630 |
try:
|
|
|
631 |
orders = get_orders_collection_at_store(storeId, to_py_date(fromDate), to_py_date(toDate), onlyCod)
|
|
|
632 |
return [to_t_order(order) for order in orders]
|
|
|
633 |
finally:
|
|
|
634 |
close_session()
|
|
|
635 |
|
| 4910 |
phani.kuma |
636 |
def markAsRTOrders(self, providerId, returnedOrders):
|
| 1135 |
chandransh |
637 |
"""
|
| 4910 |
phani.kuma |
638 |
Mark all orders with AWBs in the given map as RTO. Also sets the delivery timestamp.
|
| 1135 |
chandransh |
639 |
Raises an exception if we encounter report for an AWB number that we did not ship.
|
|
|
640 |
|
|
|
641 |
Parameters:
|
|
|
642 |
- providerId
|
|
|
643 |
- returnedOrders
|
|
|
644 |
"""
|
|
|
645 |
try:
|
| 4910 |
phani.kuma |
646 |
mark_orders_as_rto(providerId, returnedOrders)
|
| 1135 |
chandransh |
647 |
finally:
|
|
|
648 |
close_session()
|
| 1246 |
chandransh |
649 |
|
| 4910 |
phani.kuma |
650 |
def getRTOrders(self, providerId):
|
|
|
651 |
"""
|
|
|
652 |
Returns a list of orders that were returned by courier.
|
|
|
653 |
|
|
|
654 |
Parameters:
|
|
|
655 |
- providerId
|
|
|
656 |
"""
|
|
|
657 |
try:
|
|
|
658 |
rto_orders = get_rto_orders(providerId)
|
|
|
659 |
return [to_t_order(order) for order in rto_orders]
|
|
|
660 |
finally:
|
|
|
661 |
close_session()
|
|
|
662 |
|
| 1246 |
chandransh |
663 |
def updateNonDeliveryReason(self, providerId, undeliveredOrders):
|
|
|
664 |
"""
|
|
|
665 |
Update the status description of orders whose AWB numbers are keys of the Map.
|
|
|
666 |
|
|
|
667 |
Parameters:
|
|
|
668 |
- providerId
|
|
|
669 |
- undelivered_orders
|
|
|
670 |
"""
|
|
|
671 |
try:
|
| 4910 |
phani.kuma |
672 |
update_non_delivery_reason(providerId, undeliveredOrders)
|
|
|
673 |
finally:
|
|
|
674 |
close_session()
|
|
|
675 |
|
|
|
676 |
def getNonDeliveredOrdersbyCourier(self, providerId):
|
|
|
677 |
"""
|
|
|
678 |
Returns a list of orders that were picked up or shipped four days ago but did not get delivered.
|
|
|
679 |
|
|
|
680 |
Parameters:
|
|
|
681 |
- providerId
|
|
|
682 |
"""
|
|
|
683 |
try:
|
|
|
684 |
orders_not_delivered = get_non_delivered_orders_by_courier(providerId)
|
| 4581 |
phani.kuma |
685 |
return [to_t_order(order) for order in orders_not_delivered]
|
| 1246 |
chandransh |
686 |
finally:
|
|
|
687 |
close_session()
|
| 1405 |
ankur.sing |
688 |
|
| 4910 |
phani.kuma |
689 |
def markOrdersAsLocalConnected(self, providerId, local_connected_orders):
|
|
|
690 |
"""
|
|
|
691 |
Mark all orders with AWBs in the given map as local connected. Also sets the local connected timestamp.
|
|
|
692 |
|
|
|
693 |
Parameters:
|
|
|
694 |
- providerId
|
|
|
695 |
- local_connected_orders
|
|
|
696 |
"""
|
|
|
697 |
try:
|
|
|
698 |
mark_orders_as_local_connected(providerId, local_connected_orders)
|
|
|
699 |
finally:
|
|
|
700 |
close_session()
|
|
|
701 |
|
|
|
702 |
def getOrdersNotLocalConnected(self, providerId):
|
|
|
703 |
"""
|
|
|
704 |
Returns a list of orders that were picked up or shipped but pending local connection.
|
|
|
705 |
|
|
|
706 |
Parameters:
|
|
|
707 |
- providerId
|
|
|
708 |
"""
|
|
|
709 |
try:
|
|
|
710 |
orders_pending_local_connection = get_orders_not_local_connected(providerId)
|
|
|
711 |
return [to_t_order(order) for order in orders_pending_local_connection]
|
|
|
712 |
finally:
|
|
|
713 |
close_session()
|
|
|
714 |
|
|
|
715 |
def markOrdersAsDestinationCityReached(self, providerId, destination_city_reached_orders):
|
|
|
716 |
"""
|
|
|
717 |
Mark all orders with AWBs in the given map as reached destination city. Also sets the reached destination timestamp.
|
|
|
718 |
|
|
|
719 |
Parameters:
|
|
|
720 |
- providerId
|
|
|
721 |
- destination_city_reached_orders
|
|
|
722 |
"""
|
|
|
723 |
try:
|
|
|
724 |
mark_orders_as_destinationCityReached(providerId, destination_city_reached_orders)
|
|
|
725 |
finally:
|
|
|
726 |
close_session()
|
|
|
727 |
|
|
|
728 |
def markOrdersAsFirstDeliveryAttempted(self, providerId, first_atdl_orders):
|
|
|
729 |
"""
|
|
|
730 |
Mark all orders with AWBs in the given map as first delivery attempt made. Also sets the first delivery attempted timestamp.
|
|
|
731 |
|
|
|
732 |
Parameters:
|
|
|
733 |
- providerId
|
|
|
734 |
- first_atdl_orders
|
|
|
735 |
"""
|
|
|
736 |
try:
|
|
|
737 |
mark_orders_as_firstDeliveryAttempted(providerId, first_atdl_orders)
|
|
|
738 |
finally:
|
|
|
739 |
close_session()
|
|
|
740 |
|
| 4783 |
phani.kuma |
741 |
def getUndeliveredOrdersExpectedDeliveryDateNotMet(self):
|
|
|
742 |
"""
|
|
|
743 |
Returns the list of orders whose expected delivery date has passed but have not been
|
|
|
744 |
delivered yet.
|
|
|
745 |
Returns an empty list if no such orders exist.
|
|
|
746 |
"""
|
|
|
747 |
try:
|
|
|
748 |
orders_not_delivered = get_orders_not_met_expected_delivery_date()
|
|
|
749 |
return [to_t_order(order) for order in orders_not_delivered]
|
|
|
750 |
finally:
|
|
|
751 |
close_session()
|
|
|
752 |
|
| 1405 |
ankur.sing |
753 |
def getUndeliveredOrders(self, providerId, warehouseId):
|
|
|
754 |
"""
|
|
|
755 |
Returns the list of orders whose delivery time has passed but have not been
|
|
|
756 |
delivered yet for the given provider and warehouse. To get a complete list of
|
|
|
757 |
undelivered orders, pass them as -1.
|
|
|
758 |
Returns an empty list if no such orders exist.
|
|
|
759 |
|
|
|
760 |
Parameters:
|
|
|
761 |
- providerId
|
|
|
762 |
- warehouseId
|
|
|
763 |
"""
|
|
|
764 |
try:
|
|
|
765 |
undelivered_orders = get_undelivered_orders(providerId, warehouseId)
|
|
|
766 |
return [to_t_order(order) for order in undelivered_orders]
|
|
|
767 |
finally:
|
|
|
768 |
close_session()
|
| 1351 |
varun.gupt |
769 |
|
| 1398 |
varun.gupt |
770 |
def enqueueTransactionInfoEmail(self, transactionId):
|
| 1351 |
varun.gupt |
771 |
"""
|
| 1398 |
varun.gupt |
772 |
Save the email containing order details to be sent to customer later by batch job
|
| 1351 |
varun.gupt |
773 |
|
|
|
774 |
Parameters:
|
|
|
775 |
- transactionId
|
|
|
776 |
"""
|
|
|
777 |
try:
|
| 1398 |
varun.gupt |
778 |
return enqueue_transaction_info_email(transactionId)
|
| 1351 |
varun.gupt |
779 |
finally:
|
|
|
780 |
close_session()
|
|
|
781 |
|
| 4444 |
rajveer |
782 |
def getAlerts(self, type, warehouseId, status, timestamp):
|
| 483 |
rajveer |
783 |
"""
|
|
|
784 |
Parameters:
|
| 4394 |
rajveer |
785 |
- type
|
| 4444 |
rajveer |
786 |
- warehouseId
|
| 4394 |
rajveer |
787 |
- status
|
|
|
788 |
- timestamp
|
| 483 |
rajveer |
789 |
"""
|
| 766 |
rajveer |
790 |
try:
|
| 4444 |
rajveer |
791 |
alerts = get_alerts(type, warehouseId, status, timestamp)
|
| 766 |
rajveer |
792 |
|
|
|
793 |
t_alerts = []
|
|
|
794 |
for alert in alerts:
|
|
|
795 |
t_alerts.append(to_t_alert(alert))
|
|
|
796 |
|
|
|
797 |
return t_alerts
|
|
|
798 |
finally:
|
|
|
799 |
close_session()
|
| 4394 |
rajveer |
800 |
|
| 4447 |
rajveer |
801 |
def addAlert(self, type, warehouseId, description):
|
| 483 |
rajveer |
802 |
"""
|
|
|
803 |
Parameters:
|
|
|
804 |
- type
|
| 4394 |
rajveer |
805 |
- description
|
| 4447 |
rajveer |
806 |
- warehouseId
|
| 483 |
rajveer |
807 |
"""
|
| 766 |
rajveer |
808 |
try:
|
| 4447 |
rajveer |
809 |
add_alert(type, warehouseId, description)
|
| 766 |
rajveer |
810 |
finally:
|
|
|
811 |
close_session()
|
| 1596 |
ankur.sing |
812 |
|
| 4444 |
rajveer |
813 |
def markAlertsAsSeen(self, warehouseId):
|
|
|
814 |
"""
|
|
|
815 |
Parameters:
|
|
|
816 |
- warehouseId
|
|
|
817 |
"""
|
|
|
818 |
try:
|
|
|
819 |
mark_alerts_as_seen(warehouseId)
|
|
|
820 |
finally:
|
|
|
821 |
close_session()
|
|
|
822 |
pass
|
|
|
823 |
|
| 1596 |
ankur.sing |
824 |
def getValidOrderCount(self, ):
|
|
|
825 |
"""
|
|
|
826 |
Return the number of valid orders. (OrderStatus >= OrderStatus.SUBMITTED_FOR_PROCESSING)
|
|
|
827 |
"""
|
| 1731 |
ankur.sing |
828 |
try:
|
|
|
829 |
return get_valid_order_count()
|
|
|
830 |
finally:
|
|
|
831 |
close_session()
|
| 1627 |
ankur.sing |
832 |
|
|
|
833 |
def getNoOfCustomersWithSuccessfulTransaction(self, ):
|
|
|
834 |
"""
|
|
|
835 |
Returns the number of distinct customers who have done successful transactions
|
|
|
836 |
"""
|
| 1731 |
ankur.sing |
837 |
try:
|
|
|
838 |
return get_cust_count_with_successful_txn()
|
|
|
839 |
finally:
|
|
|
840 |
close_session()
|
| 1627 |
ankur.sing |
841 |
|
| 1731 |
ankur.sing |
842 |
|
|
|
843 |
def getValidOrdersAmountRange(self, ):
|
| 1627 |
ankur.sing |
844 |
"""
|
| 1731 |
ankur.sing |
845 |
Returns the minimum and maximum amounts of a valid order. (OrderStatus >= OrderStatus.SUBMITTED_FOR_PROCESSING)
|
|
|
846 |
List contains two values, first minimum amount and second maximum amount.
|
| 1627 |
ankur.sing |
847 |
"""
|
| 1731 |
ankur.sing |
848 |
try:
|
|
|
849 |
return get_valid_orders_amount_range()
|
|
|
850 |
finally:
|
|
|
851 |
close_session()
|
| 1627 |
ankur.sing |
852 |
|
| 5874 |
rajveer |
853 |
def getValidOrders(self, limit, onlyStore):
|
| 1886 |
ankur.sing |
854 |
"""
|
|
|
855 |
Returns list of Orders in descending order by Order creation date. List is restricted to limit Orders.
|
|
|
856 |
If limit is passed as 0, then all valid Orders are returned.
|
|
|
857 |
|
|
|
858 |
Parameters:
|
|
|
859 |
- limit
|
| 5874 |
rajveer |
860 |
- onlyStore
|
| 1886 |
ankur.sing |
861 |
"""
|
|
|
862 |
try:
|
| 5874 |
rajveer |
863 |
return [to_t_order(order) for order in get_valid_orders(limit, onlyStore)]
|
| 1886 |
ankur.sing |
864 |
finally:
|
|
|
865 |
close_session()
|
| 104 |
ashish |
866 |
|
| 2536 |
chandransh |
867 |
def toggleDOAFlag(self, orderId):
|
| 104 |
ashish |
868 |
"""
|
| 2536 |
chandransh |
869 |
Toggle the DOA flag of an order. This should be used to flag an order for follow-up and unflag it when the follow-up is complete.
|
|
|
870 |
Returns the final flag status.
|
|
|
871 |
Throws an exception if the order with the given id couldn't be found or if the order status is not DELVIERY_SUCCESS.
|
| 483 |
rajveer |
872 |
|
| 132 |
ashish |
873 |
Parameters:
|
| 2536 |
chandransh |
874 |
- orderId
|
| 132 |
ashish |
875 |
"""
|
| 2536 |
chandransh |
876 |
try:
|
|
|
877 |
return toggle_doa_flag(orderId)
|
|
|
878 |
finally:
|
|
|
879 |
close_session()
|
| 483 |
rajveer |
880 |
|
| 4454 |
rajveer |
881 |
def markOrderDoaRequestReceived(self, orderId):
|
|
|
882 |
"""
|
|
|
883 |
Once user raise the request for a DOA, order status will be changed from DELVIERY_SUCCESS to DOA_REQUEST_RECEIVED
|
|
|
884 |
|
|
|
885 |
Parameters:
|
|
|
886 |
- orderId
|
|
|
887 |
"""
|
|
|
888 |
try:
|
|
|
889 |
return mark_order_doa_request_received(orderId)
|
|
|
890 |
finally:
|
|
|
891 |
close_session()
|
|
|
892 |
|
| 7645 |
anupam.sin |
893 |
def markOrderDoaRequestAuthorized(self, orderId, isAuthorized, fromStore, isReship):
|
| 4454 |
rajveer |
894 |
"""
|
|
|
895 |
CRM person can authorize or deny the request reised by customer. If he authorizes order will change from DOA_REQUEST_RECEIVED
|
|
|
896 |
to DOA_REQUEST_AUTHORIZED. If he denies, status will be changed back to DELVIERY_SUCCESS.
|
|
|
897 |
|
|
|
898 |
Parameters:
|
|
|
899 |
- orderId
|
|
|
900 |
- isAuthorized
|
|
|
901 |
"""
|
|
|
902 |
try:
|
| 7645 |
anupam.sin |
903 |
return mark_order_doa_request_authorized(orderId, isAuthorized, fromStore, isReship)
|
| 4454 |
rajveer |
904 |
finally:
|
|
|
905 |
close_session()
|
|
|
906 |
|
| 4488 |
rajveer |
907 |
def markOrderReturnRequestReceived(self, orderId):
|
|
|
908 |
"""
|
|
|
909 |
Once user raise the request for a DOA, order status will be changed from DELVIERY_SUCCESS to RET_REQUEST_RECEIVED
|
|
|
910 |
|
|
|
911 |
Parameters:
|
|
|
912 |
- orderId
|
|
|
913 |
"""
|
|
|
914 |
try:
|
|
|
915 |
return mark_order_return_request_received(orderId)
|
|
|
916 |
finally:
|
|
|
917 |
close_session()
|
|
|
918 |
|
| 7645 |
anupam.sin |
919 |
def markOrderReturnRequestAuthorized(self, orderId, isAuthorized, fromStore, isReship):
|
| 4488 |
rajveer |
920 |
"""
|
|
|
921 |
CRM person can authorize or deny the request reised by customer. If he authorizes order will change from RET_REQUEST_RECEIVED
|
|
|
922 |
to RET_REQUEST_AUTHORIZED. If he denies, status will be changed back to DELVIERY_SUCCESS.
|
|
|
923 |
|
|
|
924 |
Parameters:
|
|
|
925 |
- orderId
|
|
|
926 |
- isAuthorized
|
|
|
927 |
"""
|
|
|
928 |
try:
|
| 7645 |
anupam.sin |
929 |
return mark_order_return_request_authorized(orderId, isAuthorized, fromStore, isReship)
|
| 4488 |
rajveer |
930 |
finally:
|
|
|
931 |
close_session()
|
|
|
932 |
|
| 4579 |
rajveer |
933 |
def requestPickupNumber(self, orderId, providerId):
|
| 104 |
ashish |
934 |
"""
|
| 2536 |
chandransh |
935 |
Sends out an email to the account manager of the original courier provider used to ship the order.
|
| 4452 |
rajveer |
936 |
If the order status was DELIVERY_SUCCESS, it is changed to be DOA_PICKUP_REQUEST_RAISED.
|
|
|
937 |
If the order status was DOA_PICKUP_REQUEST_RAISED, it is left unchanged.
|
| 2536 |
chandransh |
938 |
For any other status, it returns false.
|
|
|
939 |
Throws an exception if the order with the given id couldn't be found.
|
| 104 |
ashish |
940 |
|
|
|
941 |
Parameters:
|
| 2536 |
chandransh |
942 |
- orderId
|
| 104 |
ashish |
943 |
"""
|
| 2536 |
chandransh |
944 |
try:
|
| 4579 |
rajveer |
945 |
return request_pickup_number(orderId, providerId)
|
| 2536 |
chandransh |
946 |
finally:
|
|
|
947 |
close_session()
|
| 483 |
rajveer |
948 |
|
| 4602 |
rajveer |
949 |
def authorizePickup(self, orderId, pickupNumber, providerId):
|
| 304 |
ashish |
950 |
"""
|
| 4452 |
rajveer |
951 |
If the order status is DOA_PICKUP_REQUEST_RAISED, it does the following
|
| 2536 |
chandransh |
952 |
1. Sends out an email to the customer with the dispatch advice that he has to print as an attachment.
|
|
|
953 |
2. Changes order status to be DOA_PICKUP_AUTHORIZED.
|
|
|
954 |
3. Returns true
|
|
|
955 |
If the order is any other status, it returns false.
|
|
|
956 |
Throws an exception if the order with the given id couldn't be found.
|
| 304 |
ashish |
957 |
|
|
|
958 |
Parameters:
|
| 2536 |
chandransh |
959 |
- orderId
|
|
|
960 |
- pickupNumber
|
| 304 |
ashish |
961 |
"""
|
| 2536 |
chandransh |
962 |
try:
|
| 4602 |
rajveer |
963 |
return authorize_pickup(orderId, pickupNumber, providerId)
|
| 2536 |
chandransh |
964 |
finally:
|
|
|
965 |
close_session()
|
| 2764 |
chandransh |
966 |
|
|
|
967 |
def markDoasAsPickedUp(self, providerId, pickupDetails):
|
|
|
968 |
"""
|
|
|
969 |
Marks all DOA_PICKUP_AUTHORIZED orders of the previous day for a provider as DOA_RETURN_IN_TRANSIT.
|
|
|
970 |
|
|
|
971 |
Parameters:
|
|
|
972 |
- providerId
|
|
|
973 |
- pickupDetails
|
|
|
974 |
"""
|
|
|
975 |
try:
|
| 4910 |
phani.kuma |
976 |
mark_doas_as_picked_up(providerId, pickupDetails)
|
|
|
977 |
finally:
|
|
|
978 |
close_session()
|
|
|
979 |
|
|
|
980 |
def getDoasNotPickedUp(self, providerId):
|
|
|
981 |
"""
|
|
|
982 |
Returns a list of orders that were authorized for pickup but did not appear in the pick-up report.
|
|
|
983 |
|
|
|
984 |
Parameters:
|
|
|
985 |
- providerId
|
|
|
986 |
"""
|
|
|
987 |
try:
|
|
|
988 |
orders_not_picked_up = get_doas_not_picked_up(providerId)
|
| 2764 |
chandransh |
989 |
return [to_t_order(order) for order in orders_not_picked_up]
|
|
|
990 |
finally:
|
|
|
991 |
close_session()
|
| 4910 |
phani.kuma |
992 |
|
| 4741 |
phani.kuma |
993 |
def markReturnOrdersAsPickedUp(self, providerId, pickupDetails):
|
|
|
994 |
"""
|
|
|
995 |
Marks all RET_PICKUP_CONFIRMED orders of the previous day for a provider as RET_RETURN_IN_TRANSIT.
|
|
|
996 |
|
|
|
997 |
Parameters:
|
|
|
998 |
- providerId
|
|
|
999 |
- pickupDetails
|
|
|
1000 |
"""
|
|
|
1001 |
try:
|
| 4910 |
phani.kuma |
1002 |
mark_return_orders_as_picked_up(providerId, pickupDetails)
|
|
|
1003 |
finally:
|
|
|
1004 |
close_session()
|
|
|
1005 |
|
|
|
1006 |
def getReturnOrdersNotPickedUp(self, providerId):
|
|
|
1007 |
"""
|
|
|
1008 |
Returns a list of orders that were authorized for pickup but did not appear in the pick-up report.
|
|
|
1009 |
|
|
|
1010 |
Parameters:
|
|
|
1011 |
- providerId
|
|
|
1012 |
"""
|
|
|
1013 |
try:
|
|
|
1014 |
orders_not_picked_up = get_return_orders_not_picked_up(providerId)
|
| 4741 |
phani.kuma |
1015 |
return [to_t_order(order) for order in orders_not_picked_up]
|
|
|
1016 |
finally:
|
|
|
1017 |
close_session()
|
| 4910 |
phani.kuma |
1018 |
|
| 4479 |
rajveer |
1019 |
def receiveReturn(self, orderId, receiveCondition):
|
| 2591 |
chandransh |
1020 |
"""
|
| 4452 |
rajveer |
1021 |
If the order status is DOA_PICKUP_CONFIRMED or DOA_RETURN_IN_TRANSIT, marks the order status as DOA_RECEIVED_PRESTINE and returns true.
|
| 2591 |
chandransh |
1022 |
If the order is in any other state, it returns false.
|
|
|
1023 |
Throws an exception if the order with the given id couldn't be found.
|
|
|
1024 |
|
|
|
1025 |
Parameters:
|
|
|
1026 |
- orderId
|
|
|
1027 |
"""
|
|
|
1028 |
try:
|
| 4479 |
rajveer |
1029 |
return receive_return(orderId, receiveCondition)
|
| 2591 |
chandransh |
1030 |
finally:
|
|
|
1031 |
close_session()
|
|
|
1032 |
|
|
|
1033 |
def validateDoa(self, orderId, isValid):
|
|
|
1034 |
"""
|
| 4452 |
rajveer |
1035 |
Used to validate the DOA certificate for an order in the DOA_RECEIVED_PRESTINE state. If the certificate is valid,
|
| 2609 |
chandransh |
1036 |
the order state is changed to DOA_CERT_PENDING.
|
| 2591 |
chandransh |
1037 |
If the certificate is invalid, the order state is changed to DOA_CERT_INVALID.
|
|
|
1038 |
If the order is in any other state, it returns false.
|
|
|
1039 |
Throws an exception if the order with the given id couldn't be found.
|
|
|
1040 |
|
|
|
1041 |
Parameters:
|
|
|
1042 |
- orderId
|
|
|
1043 |
- isValid
|
|
|
1044 |
"""
|
|
|
1045 |
try:
|
|
|
1046 |
return validate_doa(orderId, isValid)
|
|
|
1047 |
finally:
|
|
|
1048 |
close_session()
|
| 2628 |
chandransh |
1049 |
|
| 4495 |
rajveer |
1050 |
def validateReturnProduct(self, orderId, isUsable):
|
|
|
1051 |
"""
|
|
|
1052 |
Parameters:
|
|
|
1053 |
- orderId
|
|
|
1054 |
- isUsable
|
|
|
1055 |
"""
|
|
|
1056 |
try:
|
|
|
1057 |
return validate_return_product(orderId, isUsable)
|
|
|
1058 |
finally:
|
|
|
1059 |
close_session()
|
|
|
1060 |
|
| 2628 |
chandransh |
1061 |
def reshipOrder(self, orderId):
|
|
|
1062 |
"""
|
| 4484 |
rajveer |
1063 |
If the order is in RTO_RECEIVED_PRESTINE or DOA_CERT_INVALID state, it does the following:
|
| 2628 |
chandransh |
1064 |
1. Creates a new order for processing in the BILLED state. All billing information is saved.
|
| 4484 |
rajveer |
1065 |
2. Marks the current order as one of the final states RTO_RESHIPPED and DOA_INVALID_RESHIPPED depending on what state the order started in.
|
| 2628 |
chandransh |
1066 |
|
|
|
1067 |
If the order is in DOA_CERT_VALID state, it does the following:
|
|
|
1068 |
1. Creates a new order for processing in the SUBMITTED_FOR_PROCESSING state.
|
|
|
1069 |
2. Creates a return order for the warehouse executive to return the DOA material.
|
| 4452 |
rajveer |
1070 |
3. Marks the current order as the final DOA_VALID_RESHIPPED state.
|
| 2628 |
chandransh |
1071 |
|
|
|
1072 |
Returns the id of the newly created order.
|
|
|
1073 |
|
|
|
1074 |
Throws an exception if the order with the given id couldn't be found.
|
|
|
1075 |
|
|
|
1076 |
Parameters:
|
|
|
1077 |
- orderId
|
|
|
1078 |
"""
|
|
|
1079 |
try:
|
|
|
1080 |
return reship_order(orderId)
|
|
|
1081 |
finally:
|
|
|
1082 |
close_session()
|
|
|
1083 |
|
| 3226 |
chandransh |
1084 |
def refundOrder(self, orderId, refundedBy, reason):
|
| 2628 |
chandransh |
1085 |
"""
|
| 4484 |
rajveer |
1086 |
If the order is in RTO_RECEIVED_PRESTINE, DOA_CERT_VALID or DOA_CERT_INVALID state, it does the following:
|
| 2628 |
chandransh |
1087 |
1. Creates a refund request for batch processing.
|
|
|
1088 |
2. Creates a return order for the warehouse executive to return the shipped material.
|
| 4484 |
rajveer |
1089 |
3. Marks the current order as RTO_REFUNDED, DOA_VALID_REFUNDED or DOA_INVALID_REFUNDED final states.
|
| 2628 |
chandransh |
1090 |
|
|
|
1091 |
If the order is in SUBMITTED_FOR_PROCESSING or INVENTORY_LOW state, it does the following:
|
|
|
1092 |
1. Creates a refund request for batch processing.
|
| 3226 |
chandransh |
1093 |
2. Cancels the reservation of the item in the warehouse.
|
|
|
1094 |
3. Marks the current order as the REFUNDED final state.
|
| 2628 |
chandransh |
1095 |
|
| 3226 |
chandransh |
1096 |
For all COD orders, if the order is in INIT, SUBMITTED_FOR_PROCESSING or INVENTORY_LOW state, it does the following:
|
|
|
1097 |
1. Cancels the reservation of the item in the warehouse.
|
|
|
1098 |
2. Marks the current order as CANCELED.
|
|
|
1099 |
|
|
|
1100 |
In all cases, it updates the reason for cancellation or refund and the person who performed the action.
|
|
|
1101 |
|
| 2628 |
chandransh |
1102 |
Returns True if it is successful, False otherwise.
|
|
|
1103 |
|
|
|
1104 |
Throws an exception if the order with the given id couldn't be found.
|
|
|
1105 |
|
|
|
1106 |
Parameters:
|
|
|
1107 |
- orderId
|
| 3226 |
chandransh |
1108 |
- refundedBy
|
|
|
1109 |
- reason
|
| 2628 |
chandransh |
1110 |
"""
|
|
|
1111 |
try:
|
| 3226 |
chandransh |
1112 |
return refund_order(orderId, refundedBy, reason)
|
| 2628 |
chandransh |
1113 |
finally:
|
|
|
1114 |
close_session()
|
|
|
1115 |
|
| 2697 |
chandransh |
1116 |
def getReturnOrders(self, warehouseId, fromDate, toDate):
|
|
|
1117 |
"""
|
|
|
1118 |
Get all return orders created between the from and to dates for the given warehouse.
|
|
|
1119 |
Ignores the warehouse if it is passed as -1.
|
|
|
1120 |
|
|
|
1121 |
Parameters:
|
|
|
1122 |
- warehouseId
|
|
|
1123 |
- fromDate
|
|
|
1124 |
- toDate
|
|
|
1125 |
"""
|
|
|
1126 |
try:
|
|
|
1127 |
from_date, to_date = get_fdate_tdate(fromDate, toDate)
|
|
|
1128 |
return get_return_orders(warehouseId, from_date, to_date)
|
|
|
1129 |
finally:
|
|
|
1130 |
close_session()
|
|
|
1131 |
|
| 5481 |
phani.kuma |
1132 |
def getAllReturnOrders(self, onlyNotProcessed, fromDate, toDate):
|
|
|
1133 |
"""
|
|
|
1134 |
Get all return orders created between the from and to dates for the given warehouse.
|
|
|
1135 |
Ignores the warehouse if it is passed as -1.
|
|
|
1136 |
|
|
|
1137 |
Parameters:
|
|
|
1138 |
- warehouseId
|
|
|
1139 |
- fromDate
|
|
|
1140 |
- toDate
|
|
|
1141 |
"""
|
|
|
1142 |
try:
|
|
|
1143 |
from_date, to_date = get_fdate_tdate(fromDate, toDate)
|
|
|
1144 |
return get_all_return_orders(onlyNotProcessed, from_date, to_date)
|
|
|
1145 |
finally:
|
|
|
1146 |
close_session()
|
|
|
1147 |
|
| 2700 |
chandransh |
1148 |
def getReturnOrder(self, id):
|
|
|
1149 |
"""
|
|
|
1150 |
Returns the ReturnOrder corresponding to the given id.
|
|
|
1151 |
Throws an exception if the return order with the given id couldn't be found.
|
|
|
1152 |
|
|
|
1153 |
Parameters:
|
|
|
1154 |
- id
|
|
|
1155 |
"""
|
|
|
1156 |
try:
|
|
|
1157 |
return get_return_order(id)
|
|
|
1158 |
finally:
|
|
|
1159 |
close_session()
|
|
|
1160 |
|
| 2697 |
chandransh |
1161 |
def processReturn(self, returnOrderId):
|
|
|
1162 |
"""
|
|
|
1163 |
Marks the return order with the given id as processed. Raises an exception if no such return order exists.
|
|
|
1164 |
|
|
|
1165 |
Parameters:
|
|
|
1166 |
- returnOrderId
|
|
|
1167 |
"""
|
|
|
1168 |
try:
|
|
|
1169 |
process_return(returnOrderId)
|
|
|
1170 |
finally:
|
|
|
1171 |
close_session()
|
| 4757 |
mandeep.dh |
1172 |
|
|
|
1173 |
def updateOrdersAsPORaised(self, itemIdQuantityMap, purchaseOrderId, warehouseId):
|
| 2819 |
chandransh |
1174 |
"""
|
| 4757 |
mandeep.dh |
1175 |
Updates orders as PO raised. Also updates purchase order id in orders. Pass a map of items mapped to
|
|
|
1176 |
the quantities for which the PO is raised.
|
|
|
1177 |
|
| 2819 |
chandransh |
1178 |
Parameters:
|
| 4757 |
mandeep.dh |
1179 |
- itemIdQuantityMap
|
|
|
1180 |
- purchaseOrderId
|
| 2819 |
chandransh |
1181 |
- warehouseId
|
|
|
1182 |
"""
|
|
|
1183 |
try:
|
| 4757 |
mandeep.dh |
1184 |
update_orders_as_PORaised(itemIdQuantityMap, purchaseOrderId, warehouseId)
|
| 2819 |
chandransh |
1185 |
finally:
|
|
|
1186 |
close_session()
|
| 4757 |
mandeep.dh |
1187 |
|
| 3451 |
chandransh |
1188 |
def updateWeight(self, orderId, weight):
|
|
|
1189 |
"""
|
|
|
1190 |
Set the weight of the given order to the provided value. Will attempt to update the weight of the item in the catalog as well.
|
|
|
1191 |
|
|
|
1192 |
Parameters:
|
|
|
1193 |
- orderId
|
|
|
1194 |
- weight
|
|
|
1195 |
"""
|
|
|
1196 |
try:
|
|
|
1197 |
order = update_weight(orderId, weight)
|
|
|
1198 |
return to_t_order(order)
|
|
|
1199 |
finally:
|
|
|
1200 |
close_session()
|
|
|
1201 |
|
| 3469 |
chandransh |
1202 |
def changeItem(self, orderId, itemId):
|
|
|
1203 |
"""
|
|
|
1204 |
Change the item to be shipped for this order. Also adjusts the reservation in the inventory accordingly.
|
|
|
1205 |
Currently, it also ensures that only a different color of the given item is shipped.
|
|
|
1206 |
|
|
|
1207 |
Parameters:
|
|
|
1208 |
- orderId
|
|
|
1209 |
- itemId
|
|
|
1210 |
"""
|
|
|
1211 |
try:
|
|
|
1212 |
order = change_product(orderId, itemId)
|
|
|
1213 |
return to_t_order(order)
|
|
|
1214 |
finally:
|
|
|
1215 |
close_session()
|
| 7560 |
rajveer |
1216 |
|
|
|
1217 |
def changeCourierProvider(self, orderId, providerId):
|
|
|
1218 |
try:
|
|
|
1219 |
order = change_courier_provider(orderId, providerId)
|
|
|
1220 |
return to_t_order(order)
|
|
|
1221 |
finally:
|
|
|
1222 |
close_session()
|
|
|
1223 |
|
| 3469 |
chandransh |
1224 |
|
|
|
1225 |
def shiftToWarehouse(self, orderId, warehouseId):
|
|
|
1226 |
"""
|
|
|
1227 |
Moves the given order to the given warehouse. Also adjusts the inventory reservations accordingly.
|
|
|
1228 |
|
|
|
1229 |
Parameters:
|
|
|
1230 |
- orderId
|
|
|
1231 |
- warehouseId
|
|
|
1232 |
"""
|
|
|
1233 |
try:
|
|
|
1234 |
order = change_warehouse(orderId, warehouseId)
|
|
|
1235 |
return to_t_order(order)
|
|
|
1236 |
finally:
|
|
|
1237 |
close_session()
|
| 3553 |
chandransh |
1238 |
|
| 4647 |
rajveer |
1239 |
def addDelayReason(self, orderId, delayReason, furtherDelay, delayReasonText):
|
| 3553 |
chandransh |
1240 |
"""
|
|
|
1241 |
Adds the given delay reason to the given order.
|
| 3986 |
chandransh |
1242 |
Increases the expected delivery time of the given order by the given no. of days.
|
| 3553 |
chandransh |
1243 |
Raises an exception if no order with the given id can be found.
|
| 3469 |
chandransh |
1244 |
|
| 3553 |
chandransh |
1245 |
Parameters:
|
|
|
1246 |
- orderId
|
|
|
1247 |
- delayReason
|
|
|
1248 |
"""
|
|
|
1249 |
try:
|
| 4647 |
rajveer |
1250 |
return add_delay_reason(orderId, delayReason, furtherDelay, delayReasonText)
|
| 3553 |
chandransh |
1251 |
finally:
|
|
|
1252 |
close_session()
|
|
|
1253 |
|
| 3956 |
chandransh |
1254 |
def reconcileCodCollection(self, collectedAmountMap, xferBy, xferTxnId, xferDate):
|
|
|
1255 |
"""
|
|
|
1256 |
Marks the COD orders with given AWB nos. as having been processed.
|
|
|
1257 |
Updates the captured amount for the corresponding payment.
|
|
|
1258 |
|
|
|
1259 |
Returns a map of AWBs which were not processed and the associated reason. An AWB is not processed if:
|
|
|
1260 |
1. There is no order corresponding to an AWB number.
|
|
|
1261 |
2. The captured amount for a payment exceeds the total payment.
|
|
|
1262 |
3. The order corresponding to an AWB no. is in a state prior to DELIVERY_SUCCESS.
|
|
|
1263 |
|
|
|
1264 |
Parameters:
|
|
|
1265 |
- collectedAmountMap
|
|
|
1266 |
- xferBy
|
|
|
1267 |
- xferTxnId
|
|
|
1268 |
- xferDate
|
|
|
1269 |
"""
|
|
|
1270 |
try:
|
|
|
1271 |
return reconcile_cod_collection(collectedAmountMap, xferBy, xferTxnId, xferDate)
|
|
|
1272 |
finally:
|
|
|
1273 |
close_session()
|
| 4008 |
mandeep.dh |
1274 |
|
|
|
1275 |
def getTransactionsRequiringExtraProcessing(self, category):
|
|
|
1276 |
"""
|
|
|
1277 |
Returns the list of transactions that require some extra processing and
|
|
|
1278 |
which belong to a particular category. This is currently used by CRM
|
|
|
1279 |
application.
|
|
|
1280 |
"""
|
|
|
1281 |
try:
|
|
|
1282 |
return get_transactions_requiring_extra_processing(category)
|
|
|
1283 |
finally:
|
|
|
1284 |
close_session()
|
|
|
1285 |
|
|
|
1286 |
def markTransactionAsProcessed(self, transactionId, category):
|
|
|
1287 |
"""
|
|
|
1288 |
Marks a particular transaction as processed for a particular category.
|
|
|
1289 |
It essentially deletes the transaction if it is processed for a particular
|
|
|
1290 |
category. This is currently used by CRM application.
|
|
|
1291 |
"""
|
|
|
1292 |
try:
|
|
|
1293 |
return mark_transaction_as_processed(transactionId, category)
|
|
|
1294 |
finally:
|
|
|
1295 |
close_session()
|
| 4018 |
chandransh |
1296 |
|
|
|
1297 |
def getItemWiseRiskyOrdersCount(self, ):
|
|
|
1298 |
"""
|
|
|
1299 |
Returns a map containing the number of risky orders keyed by item id. A risky order
|
|
|
1300 |
is defined as one whose shipping date is about to expire.
|
|
|
1301 |
"""
|
|
|
1302 |
try:
|
|
|
1303 |
return get_item_wise_risky_orders_count()
|
|
|
1304 |
finally:
|
|
|
1305 |
close_session()
|
| 3956 |
chandransh |
1306 |
|
| 4247 |
rajveer |
1307 |
def markOrderCancellationRequestReceived(self, orderId):
|
|
|
1308 |
"""
|
|
|
1309 |
Mark order as cancellation request received. If customer sends request of cancellation of
|
|
|
1310 |
a particular order, this method will be called. It will just change status of the order
|
|
|
1311 |
depending on its current status. It also records the previous status, so that we can move
|
|
|
1312 |
back to that status if cancellation request is denied.
|
|
|
1313 |
|
|
|
1314 |
Parameters:
|
|
|
1315 |
- orderId
|
|
|
1316 |
"""
|
|
|
1317 |
try:
|
|
|
1318 |
return mark_order_cancellation_request_received(orderId)
|
|
|
1319 |
finally:
|
|
|
1320 |
close_session()
|
|
|
1321 |
|
|
|
1322 |
|
| 4662 |
rajveer |
1323 |
def markOrderAsLostInTransit(self, orderId):
|
|
|
1324 |
"""
|
|
|
1325 |
Parameters:
|
|
|
1326 |
- orderId
|
|
|
1327 |
"""
|
|
|
1328 |
try:
|
|
|
1329 |
return mark_order_as_lost_in_transit(orderId)
|
|
|
1330 |
finally:
|
|
|
1331 |
close_session()
|
|
|
1332 |
|
| 4258 |
rajveer |
1333 |
def markTransactionAsPaymentFlagRemoved(self, transactionId):
|
| 4247 |
rajveer |
1334 |
"""
|
| 4258 |
rajveer |
1335 |
If we and/or payment gateway has decided to accept the payment, this method needs to be called.
|
|
|
1336 |
Changed transaction and all orders status to payment accepted.
|
| 4247 |
rajveer |
1337 |
|
|
|
1338 |
Parameters:
|
| 4258 |
rajveer |
1339 |
- transactionId
|
| 4247 |
rajveer |
1340 |
"""
|
|
|
1341 |
try:
|
| 4259 |
anupam.sin |
1342 |
return mark_transaction_as_payment_flag_removed(transactionId)
|
| 4247 |
rajveer |
1343 |
finally:
|
|
|
1344 |
close_session()
|
| 4259 |
anupam.sin |
1345 |
|
|
|
1346 |
def refundTransaction(self, transactionId, refundedBy, reason):
|
|
|
1347 |
"""
|
|
|
1348 |
This method is called when a flagged payment is deemed unserviceable and the corresponding orders
|
|
|
1349 |
need to be cancelled
|
|
|
1350 |
|
|
|
1351 |
Parameters:
|
|
|
1352 |
- transactionId
|
|
|
1353 |
"""
|
|
|
1354 |
try:
|
|
|
1355 |
return refund_transaction(transactionId, refundedBy, reason)
|
|
|
1356 |
finally:
|
|
|
1357 |
close_session()
|
| 4247 |
rajveer |
1358 |
|
|
|
1359 |
def markOrderCancellationRequestDenied(self, orderId):
|
|
|
1360 |
"""
|
|
|
1361 |
If we decide to not to cancel order, we will move the order ro previous status.
|
|
|
1362 |
|
|
|
1363 |
Parameters:
|
|
|
1364 |
- orderId
|
|
|
1365 |
"""
|
|
|
1366 |
try:
|
|
|
1367 |
return mark_order_cancellation_request_denied(orderId)
|
|
|
1368 |
finally:
|
|
|
1369 |
close_session()
|
|
|
1370 |
|
|
|
1371 |
def markOrderCancellationRequestConfirmed(self, orderId):
|
|
|
1372 |
"""
|
|
|
1373 |
If we decide to to cancel order, CRM will call this method to move the status of order to
|
|
|
1374 |
cancellation request confirmed. After this OM will be able to cancel the order.
|
|
|
1375 |
|
|
|
1376 |
Parameters:
|
|
|
1377 |
- orderId
|
|
|
1378 |
"""
|
|
|
1379 |
try:
|
|
|
1380 |
return mark_order_cancellation_request_confirmed(orderId)
|
|
|
1381 |
finally:
|
|
|
1382 |
close_session()
|
|
|
1383 |
|
| 4324 |
mandeep.dh |
1384 |
def updateShipmentAddress(self, orderId, addressId):
|
|
|
1385 |
"""
|
|
|
1386 |
Updates shipment address of an order. Delivery and shipping date estimates
|
|
|
1387 |
etc. are also updated here.
|
|
|
1388 |
|
|
|
1389 |
Throws TransactionServiceException in case address change is not
|
|
|
1390 |
possible due to certain reasons such as new pincode in address is
|
|
|
1391 |
not serviceable etc.
|
|
|
1392 |
|
|
|
1393 |
Parameters:
|
|
|
1394 |
- orderId
|
|
|
1395 |
- addressId
|
|
|
1396 |
"""
|
|
|
1397 |
try:
|
|
|
1398 |
update_shipment_address(orderId, addressId)
|
|
|
1399 |
finally:
|
|
|
1400 |
close_session()
|
|
|
1401 |
|
| 4285 |
rajveer |
1402 |
def acceptOrdersForItemId(self, itemId, inventory):
|
|
|
1403 |
"""
|
|
|
1404 |
Marks the orders as ACCEPTED for the given itemId and inventory. It also updates the accepted timestamp. If the
|
|
|
1405 |
given order is not a COD order, it also captures the payment if the same has not been captured.
|
|
|
1406 |
|
|
|
1407 |
Parameters:
|
|
|
1408 |
- itemId
|
|
|
1409 |
- inventory
|
|
|
1410 |
"""
|
|
|
1411 |
try:
|
|
|
1412 |
return accept_orders_for_item_id(itemId, inventory)
|
|
|
1413 |
finally:
|
|
|
1414 |
close_session()
|
|
|
1415 |
|
| 4303 |
rajveer |
1416 |
|
|
|
1417 |
|
| 4369 |
rajveer |
1418 |
def markOrdersAsPORaised(self, vendorId, itemId, quantity, estimate, isReminder):
|
| 4303 |
rajveer |
1419 |
"""
|
|
|
1420 |
Parameters:
|
|
|
1421 |
- vendorId
|
|
|
1422 |
- itemId
|
|
|
1423 |
- quantity
|
|
|
1424 |
- estimate
|
| 4369 |
rajveer |
1425 |
- isReminder
|
| 4303 |
rajveer |
1426 |
"""
|
|
|
1427 |
try:
|
| 4369 |
rajveer |
1428 |
return mark_orders_as_po_raised(vendorId, itemId, quantity, estimate, isReminder)
|
| 4303 |
rajveer |
1429 |
finally:
|
|
|
1430 |
close_session()
|
|
|
1431 |
|
| 4369 |
rajveer |
1432 |
def markOrdersAsReversalInitiated(self, vendorId, itemId, quantity, estimate, isReminder):
|
| 4303 |
rajveer |
1433 |
"""
|
|
|
1434 |
Parameters:
|
|
|
1435 |
- vendorId
|
|
|
1436 |
- itemId
|
|
|
1437 |
- quantity
|
|
|
1438 |
- estimate
|
| 4369 |
rajveer |
1439 |
- isReminder
|
| 4303 |
rajveer |
1440 |
"""
|
|
|
1441 |
try:
|
| 4369 |
rajveer |
1442 |
return mark_orders_as_reversal_initiated(vendorId, itemId, quantity, estimate, isReminder)
|
| 4303 |
rajveer |
1443 |
finally:
|
|
|
1444 |
close_session()
|
|
|
1445 |
|
| 4369 |
rajveer |
1446 |
def markOrdersAsNotAvailabke(self, vendorId, itemId, quantity, estimate, isReminder):
|
| 4303 |
rajveer |
1447 |
"""
|
|
|
1448 |
Parameters:
|
|
|
1449 |
- vendorId
|
|
|
1450 |
- itemId
|
|
|
1451 |
- quantity
|
|
|
1452 |
- estimate
|
| 4369 |
rajveer |
1453 |
- isReminder
|
| 4303 |
rajveer |
1454 |
"""
|
|
|
1455 |
try:
|
| 4369 |
rajveer |
1456 |
return mark_orders_as_not_available(vendorId, itemId, quantity, estimate, isReminder)
|
| 4303 |
rajveer |
1457 |
finally:
|
|
|
1458 |
close_session()
|
|
|
1459 |
|
|
|
1460 |
|
| 4369 |
rajveer |
1461 |
def markOrdersAsTimeout(self, vendorId):
|
|
|
1462 |
"""
|
|
|
1463 |
Parameters:
|
|
|
1464 |
- vendorId
|
|
|
1465 |
"""
|
|
|
1466 |
try:
|
|
|
1467 |
return mark_orders_as_timeout(vendorId)
|
|
|
1468 |
finally:
|
|
|
1469 |
close_session()
|
| 4386 |
anupam.sin |
1470 |
|
|
|
1471 |
def getOrderForAwb(self, awb):
|
|
|
1472 |
"""
|
|
|
1473 |
Parameters:
|
|
|
1474 |
- AirwayBill Number
|
|
|
1475 |
"""
|
|
|
1476 |
try:
|
|
|
1477 |
return to_t_order(get_order_for_awb(awb))
|
|
|
1478 |
finally:
|
|
|
1479 |
close_session()
|
| 4369 |
rajveer |
1480 |
|
| 4910 |
phani.kuma |
1481 |
def getOrdersForProviderForStatus(self, provider_id, order_status_list):
|
| 4506 |
phani.kuma |
1482 |
"""
|
|
|
1483 |
Parameters:
|
|
|
1484 |
- provider id
|
|
|
1485 |
- order status
|
|
|
1486 |
"""
|
|
|
1487 |
try:
|
| 4910 |
phani.kuma |
1488 |
orders_of_provider_by_status = get_orders_for_provider_for_status(provider_id, order_status_list)
|
| 4506 |
phani.kuma |
1489 |
return [to_t_order(order) for order in orders_of_provider_by_status if order != None]
|
|
|
1490 |
finally:
|
|
|
1491 |
close_session()
|
| 4600 |
varun.gupt |
1492 |
|
|
|
1493 |
def getBilledOrdersForVendor(self, vendorId, billingDateFrom, billingDateTo):
|
|
|
1494 |
'''
|
|
|
1495 |
Parameters:
|
|
|
1496 |
- vendorId
|
|
|
1497 |
- billingDateFrom
|
|
|
1498 |
- billingDateTo
|
|
|
1499 |
'''
|
|
|
1500 |
try:
|
|
|
1501 |
return [to_t_order(order) for order in get_billed_orders_for_vendor(vendorId, to_py_date(billingDateFrom), to_py_date(billingDateTo))]
|
|
|
1502 |
finally:
|
|
|
1503 |
close_session()
|
|
|
1504 |
|
| 4607 |
rajveer |
1505 |
def getSlippedSippingDateOrders(self):
|
|
|
1506 |
try:
|
|
|
1507 |
return [to_t_order(order) for order in get_slipped_sipping_date_orders()]
|
|
|
1508 |
finally:
|
|
|
1509 |
close_session()
|
|
|
1510 |
|
| 4709 |
rajveer |
1511 |
def getCancelledOrders(self, cancelDateFrom, cancelDateTo):
|
|
|
1512 |
try:
|
|
|
1513 |
return [to_t_order(order) for order in get_cancelled_orders(to_py_date(cancelDateFrom), to_py_date(cancelDateTo))]
|
|
|
1514 |
finally:
|
|
|
1515 |
close_session()
|
|
|
1516 |
|
| 4600 |
varun.gupt |
1517 |
def getEBSSettlementSummaries(self):
|
|
|
1518 |
try:
|
|
|
1519 |
return get_ebs_settlement_summaries()
|
|
|
1520 |
finally:
|
|
|
1521 |
close_session()
|
| 4369 |
rajveer |
1522 |
|
| 4600 |
varun.gupt |
1523 |
def saveEBSSettlementSummary(self, settlementId, settlementDate, transactionDateFrom, transactionDateTo, amount):
|
|
|
1524 |
try:
|
|
|
1525 |
save_ebs_settlement_summary(settlementId, to_py_date(settlementDate), to_py_date(transactionDateFrom), to_py_date(transactionDateTo), amount)
|
|
|
1526 |
finally:
|
|
|
1527 |
close_session()
|
|
|
1528 |
|
| 5386 |
phani.kuma |
1529 |
def getSettlementForPrepaid(self, referenceId, isRefund):
|
| 4600 |
varun.gupt |
1530 |
'''
|
|
|
1531 |
Parameters:
|
| 5189 |
varun.gupt |
1532 |
- referenceId
|
|
|
1533 |
- isRefund
|
| 4600 |
varun.gupt |
1534 |
'''
|
|
|
1535 |
try:
|
| 5386 |
phani.kuma |
1536 |
return to_t_payment_settlement(get_settlement_for_Prepaid(referenceId, isRefund))
|
| 4600 |
varun.gupt |
1537 |
finally:
|
|
|
1538 |
close_session()
|
| 5386 |
phani.kuma |
1539 |
|
|
|
1540 |
def getSettlementForCod(self, orderId, isRefund):
|
|
|
1541 |
'''
|
|
|
1542 |
Parameters:
|
|
|
1543 |
- orderId
|
|
|
1544 |
- isRefund
|
|
|
1545 |
'''
|
|
|
1546 |
try:
|
|
|
1547 |
return to_t_payment_settlement(get_settlement_for_Cod(orderId, isRefund))
|
|
|
1548 |
finally:
|
|
|
1549 |
close_session()
|
|
|
1550 |
|
| 4600 |
varun.gupt |
1551 |
def getEBSSettlementDate(self, settlementId):
|
|
|
1552 |
try:
|
|
|
1553 |
return to_java_date(get_ebs_settlement_date(settlementId))
|
|
|
1554 |
finally:
|
|
|
1555 |
close_session()
|
|
|
1556 |
|
| 4905 |
varun.gupt |
1557 |
def savePaymentSettlements(self, settlementDate, paymentGatewayId, referenceId, serviceTax, otherCharges, netCollection):
|
| 4600 |
varun.gupt |
1558 |
try:
|
| 4905 |
varun.gupt |
1559 |
save_payment_settlements(to_py_date(settlementDate), paymentGatewayId, referenceId, serviceTax, otherCharges, netCollection)
|
| 4600 |
varun.gupt |
1560 |
finally:
|
|
|
1561 |
close_session()
|
|
|
1562 |
|
|
|
1563 |
def markEBSSettlementUploaded(self, settlementId):
|
|
|
1564 |
try:
|
|
|
1565 |
mark_ebs_settlement_uploaded(settlementId)
|
|
|
1566 |
finally:
|
|
|
1567 |
close_session()
|
|
|
1568 |
|
| 4715 |
varun.gupt |
1569 |
def getSettlementsByDate(self, settlementDateFrom, settlementDateTo, isRefund):
|
|
|
1570 |
try:
|
|
|
1571 |
settlements = get_settlements_by_date(to_py_date(settlementDateFrom), to_py_date(settlementDateTo), isRefund)
|
|
|
1572 |
return [to_t_payment_settlement(settlement) for settlement in settlements]
|
|
|
1573 |
finally:
|
|
|
1574 |
close_session()
|
|
|
1575 |
|
|
|
1576 |
def getReshippedOrderIds(self, orderIds):
|
|
|
1577 |
try:
|
|
|
1578 |
return get_reshipped_order_ids(orderIds)
|
|
|
1579 |
finally:
|
|
|
1580 |
close_session()
|
|
|
1581 |
|
| 5481 |
phani.kuma |
1582 |
def getBilledOrders(self, vendorId, onlyVendorNotPaid, billingDateFrom, billingDateTo):
|
| 4875 |
varun.gupt |
1583 |
try:
|
| 5481 |
phani.kuma |
1584 |
from_date, to_date = get_fdate_tdate(billingDateFrom, billingDateTo)
|
|
|
1585 |
return [to_t_order(order) for order in get_billed_orders(vendorId, onlyVendorNotPaid, from_date, to_date)]
|
| 4875 |
varun.gupt |
1586 |
finally:
|
|
|
1587 |
close_session()
|
|
|
1588 |
|
| 5062 |
varun.gupt |
1589 |
def getStatusDistributionOfOrders(self, startDate, endDate):
|
|
|
1590 |
try:
|
| 5067 |
varun.gupt |
1591 |
distribution = {}
|
|
|
1592 |
|
|
|
1593 |
for status, count in get_order_distribution_by_status(to_py_date(startDate), to_py_date(endDate)):
|
|
|
1594 |
distribution[status] = count
|
|
|
1595 |
|
|
|
1596 |
return distribution
|
| 5062 |
varun.gupt |
1597 |
finally:
|
|
|
1598 |
close_session()
|
|
|
1599 |
|
| 5067 |
varun.gupt |
1600 |
def getOrderIdsForStatus(self, status, startDatetime, endDatetime):
|
|
|
1601 |
try:
|
|
|
1602 |
orders = get_order_ids_for_status(status, to_py_date(startDatetime), to_py_date(endDatetime))
|
|
|
1603 |
return [order.id for order in orders]
|
|
|
1604 |
finally:
|
|
|
1605 |
close_session()
|
|
|
1606 |
|
| 5099 |
varun.gupt |
1607 |
def updateOrderAsPaidToVendor(self, orderId):
|
|
|
1608 |
try:
|
|
|
1609 |
update_orders_as_paid_to_vendor(orderId)
|
|
|
1610 |
finally:
|
|
|
1611 |
close_session()
|
|
|
1612 |
|
| 5348 |
anupam.sin |
1613 |
def updateCODAgent(self, agentEmailId, orderId):
|
|
|
1614 |
try:
|
|
|
1615 |
update_COD_agent(agentEmailId, orderId)
|
|
|
1616 |
finally:
|
|
|
1617 |
close_session()
|
|
|
1618 |
|
| 5386 |
phani.kuma |
1619 |
def updateOrderOnlyAsPaidToVendor(self, orderId):
|
|
|
1620 |
try:
|
|
|
1621 |
update_order_only_as_paid_to_vendor(orderId)
|
|
|
1622 |
finally:
|
|
|
1623 |
close_session()
|
|
|
1624 |
|
| 5208 |
varun.gupt |
1625 |
def getRefundedOrdersMarkedPaid(self):
|
|
|
1626 |
try:
|
|
|
1627 |
return [to_t_order(order) for order in get_refunded_orders_marked_paid()]
|
|
|
1628 |
finally:
|
|
|
1629 |
close_session()
|
| 5447 |
anupam.sin |
1630 |
|
|
|
1631 |
def getAllVerificationAgents(self, minOrderId, maxOrderId):
|
|
|
1632 |
try:
|
|
|
1633 |
return [to_t_verification_agent(codAgent) for codAgent in get_all_verification_agents(minOrderId, maxOrderId)]
|
|
|
1634 |
finally:
|
| 5527 |
anupam.sin |
1635 |
close_session()
|
|
|
1636 |
|
|
|
1637 |
def getAllAttributesForOrderId(self, orderId):
|
|
|
1638 |
try:
|
|
|
1639 |
return [to_t_attribute(attribute) for attribute in get_all_attributes_for_order_id(orderId)]
|
|
|
1640 |
finally:
|
|
|
1641 |
close_session()
|
|
|
1642 |
|
|
|
1643 |
def setOrderAttributeForTransaction(self, transactionId, attribute):
|
|
|
1644 |
try:
|
|
|
1645 |
set_order_attribute_for_transaction(transactionId, attribute)
|
|
|
1646 |
finally:
|
|
|
1647 |
close_session()
|
| 5593 |
mandeep.dh |
1648 |
|
|
|
1649 |
def acceptOrderForItem(self, itemId, quantity, fulfilmentWarehouseId, billingWarehouseId):
|
|
|
1650 |
"""
|
|
|
1651 |
Accepts appropriate order for an item in a given billingWarehouse. Usually
|
|
|
1652 |
invoked while scanning IN of items.
|
|
|
1653 |
|
|
|
1654 |
Parameters:
|
|
|
1655 |
- itemId
|
|
|
1656 |
- quantity
|
|
|
1657 |
- fulfilmentWarehouseId
|
|
|
1658 |
- billingWarehouseId
|
|
|
1659 |
"""
|
|
|
1660 |
try:
|
|
|
1661 |
accept_order_for_item(itemId, quantity, fulfilmentWarehouseId, billingWarehouseId)
|
|
|
1662 |
finally:
|
|
|
1663 |
close_session()
|
|
|
1664 |
|
| 5833 |
rajveer |
1665 |
def getOrderAttributeValue(self, orderId, attributeName):
|
|
|
1666 |
"""
|
|
|
1667 |
Parameters:
|
|
|
1668 |
- orderId
|
|
|
1669 |
- attributeName
|
|
|
1670 |
"""
|
|
|
1671 |
try:
|
| 6019 |
rajveer |
1672 |
return get_order_attribute_value(orderId, attributeName)
|
| 5833 |
rajveer |
1673 |
finally:
|
|
|
1674 |
close_session()
|
|
|
1675 |
|
| 6019 |
rajveer |
1676 |
def changeJacketNumber(self, orderId, jacketNumber):
|
|
|
1677 |
"""
|
|
|
1678 |
Parameters:
|
|
|
1679 |
- orderId
|
|
|
1680 |
- jacketNumber
|
|
|
1681 |
"""
|
|
|
1682 |
try:
|
|
|
1683 |
return change_jacket_number(orderId, jacketNumber)
|
|
|
1684 |
finally:
|
|
|
1685 |
close_session()
|
|
|
1686 |
|
|
|
1687 |
def markOrderAsRtoInTransit(self, orderId):
|
|
|
1688 |
"""
|
|
|
1689 |
Parameters:
|
|
|
1690 |
- orderId
|
|
|
1691 |
"""
|
|
|
1692 |
try:
|
|
|
1693 |
return mark_order_as_rto_in_transit(orderId)
|
|
|
1694 |
finally:
|
|
|
1695 |
close_session()
|
|
|
1696 |
|
| 6000 |
mandeep.dh |
1697 |
def createRechargeOrder(self, thriftRechargeOrder):
|
|
|
1698 |
"""
|
|
|
1699 |
Parameters:
|
|
|
1700 |
- thriftRechargeOrder
|
|
|
1701 |
"""
|
| 6031 |
rajveer |
1702 |
try:
|
|
|
1703 |
if thriftRechargeOrder is None or thriftRechargeOrder.rechargeType is None:
|
|
|
1704 |
raise TransactionServiceException(102, 'Order or the type is Null')
|
|
|
1705 |
|
|
|
1706 |
rechargeOrder = None
|
|
|
1707 |
if thriftRechargeOrder.rechargeType == RechargeType.MOBILE:
|
|
|
1708 |
rechargeOrder = MobileRechargeOrder()
|
|
|
1709 |
elif thriftRechargeOrder.rechargeType == RechargeType.DTH:
|
|
|
1710 |
rechargeOrder = DTHRechargeOrder()
|
|
|
1711 |
|
|
|
1712 |
if rechargeOrder is None:
|
|
|
1713 |
raise TransactionServiceException(102, 'Unsupported recharge type')
|
| 6000 |
mandeep.dh |
1714 |
|
| 6031 |
rajveer |
1715 |
transaction = DigitalTransaction()
|
|
|
1716 |
transaction.createdOn = datetime.datetime.now()
|
| 6056 |
amit.gupta |
1717 |
transaction.userId = thriftRechargeOrder.userId
|
| 6031 |
rajveer |
1718 |
transaction.orders = [rechargeOrder]
|
|
|
1719 |
|
| 6000 |
mandeep.dh |
1720 |
rechargeOrder.from_thrift_object(thriftRechargeOrder)
|
|
|
1721 |
session.commit()
|
| 6031 |
rajveer |
1722 |
return rechargeOrder.to_thrift_object()
|
| 6000 |
mandeep.dh |
1723 |
except:
|
|
|
1724 |
raise TransactionServiceException(103, 'Invalid values passed')
|
|
|
1725 |
finally:
|
|
|
1726 |
self.closeSession()
|
|
|
1727 |
|
| 6031 |
rajveer |
1728 |
def getRechargeOrder(self, rechargeOrderId):
|
|
|
1729 |
"""
|
|
|
1730 |
Parameters:
|
|
|
1731 |
- rechargeOrderId
|
|
|
1732 |
"""
|
|
|
1733 |
try:
|
| 6048 |
rajveer |
1734 |
return get_recharge_order(rechargeOrderId).to_thrift_object()
|
| 6031 |
rajveer |
1735 |
finally:
|
|
|
1736 |
self.closeSession()
|
|
|
1737 |
|
|
|
1738 |
def getRechargeOrders(self, userId):
|
|
|
1739 |
"""
|
|
|
1740 |
Parameters:
|
|
|
1741 |
- userId
|
|
|
1742 |
"""
|
|
|
1743 |
try:
|
|
|
1744 |
return [order.to_thrift_object() for order in get_recharge_orders(userId)]
|
|
|
1745 |
finally:
|
|
|
1746 |
self.closeSession()
|
|
|
1747 |
|
| 6000 |
mandeep.dh |
1748 |
def updateRechargeOrderStatus(self, rechargeOrderId, rechargeOrderStatus):
|
|
|
1749 |
"""
|
|
|
1750 |
Parameters:
|
|
|
1751 |
- rechargeOrderId
|
|
|
1752 |
- rechargeOrderStatus
|
|
|
1753 |
"""
|
| 6031 |
rajveer |
1754 |
try:
|
|
|
1755 |
return update_recharge_order_status(rechargeOrderId, rechargeOrderStatus)
|
|
|
1756 |
finally:
|
|
|
1757 |
self.closeSession()
|
|
|
1758 |
|
|
|
1759 |
def activateRechargeTxn(self, rechargeOrderId):
|
| 6000 |
mandeep.dh |
1760 |
"""
|
|
|
1761 |
Parameters:
|
| 6031 |
rajveer |
1762 |
- rechargeOrderId
|
| 6000 |
mandeep.dh |
1763 |
"""
|
| 6031 |
rajveer |
1764 |
try:
|
|
|
1765 |
return True
|
|
|
1766 |
activate_recharge_txn(rechargeOrderId)
|
|
|
1767 |
finally:
|
|
|
1768 |
self.closeSession()
|
| 6000 |
mandeep.dh |
1769 |
|
| 6031 |
rajveer |
1770 |
def getUserWallet(self, userId):
|
| 6000 |
mandeep.dh |
1771 |
"""
|
|
|
1772 |
Parameters:
|
| 6031 |
rajveer |
1773 |
- userId
|
| 6000 |
mandeep.dh |
1774 |
"""
|
| 6031 |
rajveer |
1775 |
try:
|
|
|
1776 |
return get_user_wallet(userId).to_thrift_object()
|
|
|
1777 |
finally:
|
|
|
1778 |
self.closeSession()
|
| 6000 |
mandeep.dh |
1779 |
|
| 6031 |
rajveer |
1780 |
def getUserWalletHistory(self, userId):
|
| 6000 |
mandeep.dh |
1781 |
"""
|
|
|
1782 |
Parameters:
|
| 6031 |
rajveer |
1783 |
- userId
|
| 6000 |
mandeep.dh |
1784 |
"""
|
| 6031 |
rajveer |
1785 |
try:
|
|
|
1786 |
return [wallet.to_thrift_object() for wallet in get_user_wallet_history(userId)]
|
|
|
1787 |
finally:
|
|
|
1788 |
self.closeSession()
|
| 6000 |
mandeep.dh |
1789 |
|
| 6206 |
rajveer |
1790 |
def getServiceProviders(self, rechargeType, onlyActive):
|
| 6048 |
rajveer |
1791 |
"""
|
|
|
1792 |
Parameters:
|
|
|
1793 |
- rechargeType
|
| 6206 |
rajveer |
1794 |
- onlyActive
|
| 6048 |
rajveer |
1795 |
"""
|
| 6077 |
anupam.sin |
1796 |
|
| 6048 |
rajveer |
1797 |
try:
|
| 6206 |
rajveer |
1798 |
return get_service_providers(rechargeType, onlyActive)
|
| 6048 |
rajveer |
1799 |
finally:
|
|
|
1800 |
self.closeSession()
|
|
|
1801 |
|
| 6049 |
rajveer |
1802 |
def getServiceProviderForDevice(self, rechargeType, deviceNumber):
|
| 6048 |
rajveer |
1803 |
"""
|
|
|
1804 |
Parameters:
|
|
|
1805 |
- deviceNumber
|
|
|
1806 |
"""
|
|
|
1807 |
try:
|
| 6049 |
rajveer |
1808 |
return get_service_provider_for_device(rechargeType, deviceNumber)
|
| 6048 |
rajveer |
1809 |
finally:
|
|
|
1810 |
self.closeSession()
|
| 6056 |
amit.gupta |
1811 |
|
| 6591 |
anupam.sin |
1812 |
def validateRecharge(self, rechargeType, deviceNumber, userSelectedProviderId, clientAddress):
|
| 6269 |
rajveer |
1813 |
"""
|
|
|
1814 |
Parameters:
|
|
|
1815 |
- deviceNumber
|
|
|
1816 |
"""
|
|
|
1817 |
try:
|
| 6591 |
anupam.sin |
1818 |
return validate_recharge(rechargeType, deviceNumber, userSelectedProviderId, clientAddress)
|
| 6269 |
rajveer |
1819 |
finally:
|
|
|
1820 |
self.closeSession()
|
|
|
1821 |
|
| 6056 |
amit.gupta |
1822 |
def getRechargeOrdersForTransaction(self, txId):
|
|
|
1823 |
"""
|
|
|
1824 |
Parameters:
|
|
|
1825 |
- transactionId
|
|
|
1826 |
"""
|
|
|
1827 |
try:
|
|
|
1828 |
return get_recharge_orders_for_transaction(txId).to_thrift_object()
|
|
|
1829 |
finally:
|
|
|
1830 |
self.closeSession()
|
| 6048 |
rajveer |
1831 |
|
| 6094 |
rajveer |
1832 |
def getRechargeOrdersForDevice(self, deviceNumber):
|
|
|
1833 |
"""
|
|
|
1834 |
Parameters:
|
|
|
1835 |
- deviceNumber
|
|
|
1836 |
"""
|
|
|
1837 |
try:
|
|
|
1838 |
return [order.to_thrift_object() for order in get_recharge_orders_for_device(deviceNumber)]
|
|
|
1839 |
finally:
|
|
|
1840 |
self.closeSession()
|
|
|
1841 |
|
| 6154 |
rajveer |
1842 |
def getRechargeOrdersForStatus(self, status):
|
|
|
1843 |
"""
|
|
|
1844 |
Parameters:
|
|
|
1845 |
- status
|
|
|
1846 |
"""
|
|
|
1847 |
try:
|
|
|
1848 |
return [order.to_thrift_object() for order in get_recharge_orders_for_status(status)]
|
|
|
1849 |
finally:
|
|
|
1850 |
self.closeSession()
|
|
|
1851 |
|
| 6159 |
rajveer |
1852 |
def getPlansForOperator(self, operatorId):
|
|
|
1853 |
"""
|
|
|
1854 |
Parameters:
|
|
|
1855 |
- operatorId
|
|
|
1856 |
"""
|
|
|
1857 |
try:
|
|
|
1858 |
return [plan.to_thrift_object() for plan in get_plans_for_operator(operatorId)]
|
|
|
1859 |
finally:
|
|
|
1860 |
self.closeSession()
|
|
|
1861 |
|
|
|
1862 |
|
| 6094 |
rajveer |
1863 |
def addAmountToWallet(self, userId, orderId, amount):
|
|
|
1864 |
"""
|
|
|
1865 |
Parameters:
|
|
|
1866 |
- userId
|
|
|
1867 |
- orderId
|
|
|
1868 |
- amount
|
|
|
1869 |
"""
|
|
|
1870 |
try:
|
|
|
1871 |
update_amount_in_wallet(userId, amount, orderId)
|
|
|
1872 |
finally:
|
|
|
1873 |
self.closeSession()
|
|
|
1874 |
|
| 6188 |
rajveer |
1875 |
def getRechargeStatistics(self):
|
|
|
1876 |
"""
|
|
|
1877 |
Parameters:
|
|
|
1878 |
"""
|
|
|
1879 |
try:
|
|
|
1880 |
return get_recharge_statistics()
|
|
|
1881 |
finally:
|
|
|
1882 |
self.closeSession()
|
|
|
1883 |
|
| 6307 |
anupam.sin |
1884 |
def getRechargeDenominations(self, operatorId, circleCode, denominationType):
|
| 6289 |
anupam.sin |
1885 |
try:
|
|
|
1886 |
returnList = []
|
| 6307 |
anupam.sin |
1887 |
rechargeDenominations = get_recharge_denominations(operatorId, circleCode, denominationType)
|
| 6289 |
anupam.sin |
1888 |
for rechargeDenomination in rechargeDenominations:
|
|
|
1889 |
returnList.append(rechargeDenomination.to_thrift_object())
|
|
|
1890 |
return returnList
|
|
|
1891 |
finally:
|
|
|
1892 |
self.closeSession()
|
| 6188 |
rajveer |
1893 |
|
| 6371 |
rajveer |
1894 |
def updateAvailabilityStatus(self, operatorId, circleId, isAvailable):
|
|
|
1895 |
try:
|
|
|
1896 |
update_availability_status(operatorId, circleId, isAvailable)
|
|
|
1897 |
finally:
|
|
|
1898 |
self.closeSession()
|
|
|
1899 |
|
| 6396 |
amit.gupta |
1900 |
def getAvailableEmiSchemes(self):
|
|
|
1901 |
try:
|
|
|
1902 |
return get_available_emi_schemes()
|
|
|
1903 |
finally:
|
|
|
1904 |
self.closeSession()
|
|
|
1905 |
|
| 6389 |
rajveer |
1906 |
def getMiscCharges(self, transactionId):
|
|
|
1907 |
try:
|
|
|
1908 |
return get_misc_charges(transactionId)
|
|
|
1909 |
finally:
|
|
|
1910 |
self.closeSession()
|
|
|
1911 |
|
| 6507 |
anupam.sin |
1912 |
def refundRechargeOrder (self, rechargeOrderId):
|
|
|
1913 |
try:
|
|
|
1914 |
return refund_recharge_order(rechargeOrderId)
|
|
|
1915 |
finally:
|
|
|
1916 |
self.closeSession()
|
| 6821 |
amar.kumar |
1917 |
|
|
|
1918 |
def getPhysicalOrders(self, start_date, end_date):
|
|
|
1919 |
try:
|
| 6832 |
amar.kumar |
1920 |
return [to_t_order(order) for order in get_physical_orders(to_py_date(start_date), to_py_date(end_date))]
|
| 6821 |
amar.kumar |
1921 |
finally:
|
|
|
1922 |
self.closeSession()
|
| 6507 |
anupam.sin |
1923 |
|
| 6906 |
rajveer |
1924 |
def getDocument(self, docType, docSource):
|
|
|
1925 |
try:
|
|
|
1926 |
return get_document(docType, docSource)
|
|
|
1927 |
finally:
|
|
|
1928 |
self.closeSession()
|
| 6988 |
rajveer |
1929 |
|
| 7075 |
rajveer |
1930 |
def retrieveInvoice(self, orderId, userId):
|
| 6988 |
rajveer |
1931 |
try:
|
| 7075 |
rajveer |
1932 |
return retrieve_invoice(orderId,userId)
|
| 6988 |
rajveer |
1933 |
finally:
|
|
|
1934 |
self.closeSession()
|
| 6906 |
rajveer |
1935 |
|
| 7027 |
rajveer |
1936 |
def receiveUpdatesForRedExpress(self, awbNumber):
|
|
|
1937 |
try:
|
| 7032 |
rajveer |
1938 |
return RedExpressUpdateService.get_updates_for_user(awbNumber)
|
| 7027 |
rajveer |
1939 |
finally:
|
|
|
1940 |
self.closeSession()
|
|
|
1941 |
|
| 6985 |
anupam.sin |
1942 |
def changeShippingAddress(self, orderId, line1, line2, city, state, pin):
|
|
|
1943 |
try:
|
|
|
1944 |
return change_shipping_address(orderId, line1, line2, city, state, pin)
|
|
|
1945 |
finally:
|
|
|
1946 |
self.closeSession()
|
|
|
1947 |
|
| 7073 |
anupam.sin |
1948 |
def createRechargeTransaction(self, t_rechargeTransaction):
|
|
|
1949 |
try:
|
|
|
1950 |
return to_t_rechargeTransaction(create_recharge_transaction(t_rechargeTransaction))
|
|
|
1951 |
finally:
|
|
|
1952 |
self.closeSession()
|
| 7084 |
rajveer |
1953 |
|
|
|
1954 |
def getRechargeTransactions(self, storeId):
|
|
|
1955 |
try:
|
|
|
1956 |
return [to_t_rechargeTransaction(txn) for txn in get_recharge_transactions(storeId)]
|
|
|
1957 |
finally:
|
|
|
1958 |
self.closeSession()
|
|
|
1959 |
|
| 7151 |
amit.gupta |
1960 |
def getRechargeTrans(self, storeId, startdate, enddate, status):
|
|
|
1961 |
try:
|
|
|
1962 |
return [to_t_rechargeTransaction(txn) for txn in get_recharge_trans(storeId,startdate, enddate, status)]
|
|
|
1963 |
finally:
|
|
|
1964 |
self.closeSession()
|
| 7084 |
rajveer |
1965 |
|
| 7080 |
anupam.sin |
1966 |
def getRechargeTransaction(self, rechargeId):
|
|
|
1967 |
try:
|
|
|
1968 |
return to_t_rechargeTransaction(get_recharge_transaction(rechargeId))
|
|
|
1969 |
finally:
|
|
|
1970 |
self.closeSession()
|
|
|
1971 |
|
|
|
1972 |
def getFRCs(self, circleId, operatorId):
|
|
|
1973 |
try:
|
|
|
1974 |
return [to_t_frc(frc) for frc in get_frcs(circleId, operatorId)]
|
|
|
1975 |
finally:
|
|
|
1976 |
self.closeSession()
|
|
|
1977 |
|
| 7096 |
anupam.sin |
1978 |
def getHotspotStore(self, id, hotspotid):
|
|
|
1979 |
try:
|
|
|
1980 |
return to_t_hotspot(get_hotspot_store(id, hotspotid))
|
|
|
1981 |
finally:
|
|
|
1982 |
self.closeSession()
|
|
|
1983 |
|
|
|
1984 |
def getTelecomCircle(self, id, code):
|
|
|
1985 |
try:
|
|
|
1986 |
return get_circle(id, code).to_thrift_object()
|
|
|
1987 |
finally:
|
|
|
1988 |
self.closeSession()
|
|
|
1989 |
|
| 7109 |
anupam.sin |
1990 |
def retrieveHotspotRechargeInvoice(self, rechargeId):
|
|
|
1991 |
try:
|
|
|
1992 |
return retrieve_hotspot_recharge_invoice(rechargeId)
|
|
|
1993 |
finally:
|
|
|
1994 |
self.closeSession()
|
| 7190 |
amar.kumar |
1995 |
|
|
|
1996 |
def splitFreebieOrder(self, orderId, splitReason, shippingDate):
|
|
|
1997 |
try:
|
|
|
1998 |
return split_freebie_order(orderId, splitReason, shippingDate)
|
|
|
1999 |
finally:
|
|
|
2000 |
self.closeSession()
|
| 7109 |
anupam.sin |
2001 |
|
| 7172 |
anupam.sin |
2002 |
def getRechargeTransactionsByNumber(self, number, storeId):
|
| 7169 |
anupam.sin |
2003 |
try:
|
| 7172 |
anupam.sin |
2004 |
return [to_t_rechargeTransaction(txn) for txn in get_recharge_transactions_by_number(number, storeId)]
|
| 7169 |
anupam.sin |
2005 |
finally:
|
|
|
2006 |
self.closeSession()
|
|
|
2007 |
|
|
|
2008 |
def updateHotspotStorePassword(self, storeId, password):
|
|
|
2009 |
try:
|
|
|
2010 |
return update_hotspot_store_password(storeId, password)
|
|
|
2011 |
finally:
|
|
|
2012 |
self.closeSession()
|
|
|
2013 |
|
| 7263 |
anupam.sin |
2014 |
def getSourceDetail(self, source):
|
|
|
2015 |
try:
|
|
|
2016 |
return to_t_sourcedetail(get_source_detail(source))
|
|
|
2017 |
finally:
|
|
|
2018 |
self.closeSession()
|
|
|
2019 |
|
| 7267 |
anupam.sin |
2020 |
def getAllCircles(self):
|
|
|
2021 |
try:
|
|
|
2022 |
return [circle.to_thrift_object() for circle in get_all_circles()]
|
|
|
2023 |
finally:
|
|
|
2024 |
self.closeSession()
|
| 7263 |
anupam.sin |
2025 |
|
| 7267 |
anupam.sin |
2026 |
def deleteFrcs(self, frcIdsToDelete):
|
|
|
2027 |
try:
|
|
|
2028 |
return delete_frcs(frcIdsToDelete)
|
|
|
2029 |
finally:
|
|
|
2030 |
self.closeSession()
|
| 7285 |
rajveer |
2031 |
|
|
|
2032 |
def topupCompanyWallet(self, companyId, amount):
|
|
|
2033 |
try:
|
|
|
2034 |
return topup_company_wallet(companyId, amount)
|
|
|
2035 |
finally:
|
|
|
2036 |
self.closeSession()
|
|
|
2037 |
|
|
|
2038 |
def getWalletBalanceForCompany(self, companyId):
|
|
|
2039 |
try:
|
|
|
2040 |
return get_wallet_balance_for_company(companyId)
|
|
|
2041 |
finally:
|
|
|
2042 |
self.closeSession()
|
| 7311 |
kshitij.so |
2043 |
|
|
|
2044 |
def addAmazonOrder(self,amazonOrder):
|
|
|
2045 |
try:
|
|
|
2046 |
add_amazon_order(amazonOrder)
|
|
|
2047 |
except:
|
|
|
2048 |
self.closeSession()
|
|
|
2049 |
|
| 7322 |
vikram.rag |
2050 |
def updateAmazonOrderStatus(self,orderId,status):
|
| 7311 |
kshitij.so |
2051 |
try:
|
| 7577 |
rajveer |
2052 |
return update_amazon_order_status(orderId,status)
|
| 7311 |
kshitij.so |
2053 |
finally:
|
|
|
2054 |
self.closeSession()
|
| 7322 |
vikram.rag |
2055 |
|
| 7683 |
vikram.rag |
2056 |
def getAmazonOrdersShipped(self):
|
| 7311 |
kshitij.so |
2057 |
try:
|
| 7683 |
vikram.rag |
2058 |
ordersShipped = get_amazon_orders_shipped()
|
| 7311 |
kshitij.so |
2059 |
finally:
|
|
|
2060 |
self.closeSession()
|
|
|
2061 |
return ordersShipped
|
|
|
2062 |
|
|
|
2063 |
def getAmazonOrdersCancelled(self,interval):
|
|
|
2064 |
ordersCancelled=None
|
|
|
2065 |
try:
|
|
|
2066 |
ordersCancelled = get_amazon_orders_cancelled(interval)
|
|
|
2067 |
except:
|
|
|
2068 |
ordersCancelled=None
|
|
|
2069 |
finally:
|
|
|
2070 |
self.closeSession()
|
|
|
2071 |
return ordersCancelled
|
|
|
2072 |
|
| 7322 |
vikram.rag |
2073 |
def getAmazonOrder(self,orderId):
|
|
|
2074 |
result = None
|
|
|
2075 |
try:
|
| 7343 |
anupam.sin |
2076 |
result = to_t_amazonorder(get_amazon_order(orderId))
|
| 7322 |
vikram.rag |
2077 |
finally:
|
|
|
2078 |
self.closeSession()
|
| 7542 |
vikram.rag |
2079 |
return result
|
|
|
2080 |
|
|
|
2081 |
def getAmazonOrderByAmazonOrderId(self,amazonOrderId):
|
|
|
2082 |
result = []
|
|
|
2083 |
try:
|
|
|
2084 |
for amazonOrder in get_amazon_order_by_amazonorderid(amazonOrderId):
|
|
|
2085 |
result.append(to_t_amazonorder(amazonOrder))
|
|
|
2086 |
except:
|
|
|
2087 |
return None
|
|
|
2088 |
finally:
|
|
|
2089 |
self.closeSession()
|
|
|
2090 |
return result
|
| 7343 |
anupam.sin |
2091 |
|
|
|
2092 |
def getOrdersForStore(self, id, storeId, startDate, endDate, statuses):
|
|
|
2093 |
try:
|
|
|
2094 |
return [to_t_order(order) for order in get_orders_for_store(id, storeId, to_py_date(startDate), to_py_date(endDate), statuses)]
|
|
|
2095 |
finally:
|
|
|
2096 |
self.closeSession()
|
|
|
2097 |
|
| 7386 |
anupam.sin |
2098 |
def getStoreOrderAdvanceInvoice(self, orderId, storeId):
|
| 7343 |
anupam.sin |
2099 |
try:
|
| 7386 |
anupam.sin |
2100 |
return get_store_order_advance_invoice(orderId, storeId)
|
| 7343 |
anupam.sin |
2101 |
finally:
|
|
|
2102 |
self.closeSession()
|
| 7363 |
rajveer |
2103 |
|
|
|
2104 |
def getSaholicRechargeBalance(self):
|
|
|
2105 |
try:
|
|
|
2106 |
return RechargeService.getBalance()
|
|
|
2107 |
finally:
|
|
|
2108 |
self.closeSession()
|
|
|
2109 |
|
| 7370 |
anupam.sin |
2110 |
def addFrc(self, circle, operatorId, denomination, maxDiscount):
|
|
|
2111 |
try:
|
|
|
2112 |
return add_frc(circle, operatorId, denomination, maxDiscount)
|
|
|
2113 |
except:
|
|
|
2114 |
return False
|
|
|
2115 |
finally:
|
|
|
2116 |
self.closeSession()
|
|
|
2117 |
|
| 7371 |
anupam.sin |
2118 |
def addSeries(self, circle, operatorId, series):
|
|
|
2119 |
try:
|
|
|
2120 |
return add_series(circle, operatorId, series)
|
|
|
2121 |
except:
|
|
|
2122 |
return "Error Occured. Try Again."
|
|
|
2123 |
finally:
|
|
|
2124 |
self.closeSession()
|
|
|
2125 |
|
| 7386 |
anupam.sin |
2126 |
def saveStoreOrderDetail(self, storeOrderDetail):
|
|
|
2127 |
try:
|
|
|
2128 |
return save_store_order_detail(storeOrderDetail)
|
|
|
2129 |
except:
|
|
|
2130 |
return False
|
|
|
2131 |
finally:
|
|
|
2132 |
self.closeSession()
|
|
|
2133 |
|
|
|
2134 |
|
|
|
2135 |
def getStoreOrderDetail(self, orderId, storeId):
|
|
|
2136 |
try:
|
|
|
2137 |
return to_t_storeOrderDetail(get_store_order_detail(orderId, storeId))
|
|
|
2138 |
finally:
|
|
|
2139 |
self.closeSession()
|
|
|
2140 |
|
|
|
2141 |
def getAllEdcBanks(self):
|
|
|
2142 |
try:
|
|
|
2143 |
return get_all_edc_banks()
|
|
|
2144 |
finally:
|
|
|
2145 |
self.closeSession()
|
| 7393 |
anupam.sin |
2146 |
|
|
|
2147 |
def saveRefundAmountsForStoreOrder(self, orderId, storeId, cashRefundAmount, cardRefundAmount):
|
|
|
2148 |
try:
|
| 7399 |
anupam.sin |
2149 |
return save_refund_amounts_for_store_order(orderId, storeId, cashRefundAmount, cardRefundAmount)
|
| 7393 |
anupam.sin |
2150 |
finally:
|
|
|
2151 |
self.closeSession()
|
| 7386 |
anupam.sin |
2152 |
|
| 7427 |
anupam.sin |
2153 |
def getCollectionsForStore(self, storeId, startDate, endDate):
|
|
|
2154 |
try:
|
|
|
2155 |
return [to_t_storeOrderCollection(collection) for collection in get_collections_for_store(storeId, startDate, endDate)]
|
|
|
2156 |
finally:
|
|
|
2157 |
self.closeSession()
|
| 7442 |
vikram.rag |
2158 |
|
|
|
2159 |
def getAmazonOrdersToAcknowledge(self):
|
|
|
2160 |
try:
|
|
|
2161 |
ordersack = []
|
|
|
2162 |
for amazonOrderId,amazonOrderCode,status,txnid,count in get_amazon_orders_to_acknowledge():
|
|
|
2163 |
orderack = AmazonOrdersToAcknowledge()
|
|
|
2164 |
orderack.amazonOrderId = amazonOrderId
|
|
|
2165 |
orderack.amazonOrderItemId = amazonOrderCode
|
|
|
2166 |
orderack.status = status
|
|
|
2167 |
orderack.transaction_id = txnid
|
|
|
2168 |
orderack.count = count
|
|
|
2169 |
ordersack.append(orderack)
|
|
|
2170 |
return ordersack
|
|
|
2171 |
except:
|
|
|
2172 |
return None
|
|
|
2173 |
finally:
|
|
|
2174 |
self.closeSession()
|
|
|
2175 |
|
|
|
2176 |
def changeAmazonOrderStatus(self,amazonOrderCode,status):
|
|
|
2177 |
try:
|
|
|
2178 |
change_amazon_order_status(amazonOrderCode,status)
|
|
|
2179 |
finally:
|
| 7460 |
kshitij.so |
2180 |
self.closeSession()
|
|
|
2181 |
|
| 7741 |
kshitij.so |
2182 |
def updateTimestampForAmazonOrder(self,orderDeliveryMap):
|
| 7460 |
kshitij.so |
2183 |
try:
|
| 7741 |
kshitij.so |
2184 |
return update_timestamp_for_amazon_order(orderDeliveryMap)
|
| 7530 |
kshitij.so |
2185 |
except:
|
|
|
2186 |
return False
|
| 7460 |
kshitij.so |
2187 |
finally:
|
| 7530 |
kshitij.so |
2188 |
self.closeSession()
|
|
|
2189 |
|
|
|
2190 |
def updateSourceDetailTimestamp(self,id,lastUpdatedOn):
|
|
|
2191 |
try:
|
|
|
2192 |
return update_source_detail_timestamp(id,lastUpdatedOn)
|
|
|
2193 |
except:
|
|
|
2194 |
return False
|
|
|
2195 |
finally:
|
| 7442 |
vikram.rag |
2196 |
self.closeSession()
|
| 7607 |
anupam.sin |
2197 |
|
|
|
2198 |
def getOrdersByMobileNumber(self, mobileNumber):
|
|
|
2199 |
try:
|
|
|
2200 |
orders = get_orders_by_mobile_number(mobileNumber)
|
|
|
2201 |
return [to_t_order(order) for order in orders]
|
|
|
2202 |
finally:
|
|
|
2203 |
self.closeSession()
|
| 7427 |
anupam.sin |
2204 |
|
| 7645 |
anupam.sin |
2205 |
def getOrdersByAmazonOrderCode(self, amazonId):
|
| 7607 |
anupam.sin |
2206 |
try:
|
|
|
2207 |
orders = get_orders_by_amazon_id(amazonId)
|
|
|
2208 |
return [to_t_order(order) for order in orders]
|
|
|
2209 |
finally:
|
|
|
2210 |
self.closeSession()
|
| 7730 |
anupam.sin |
2211 |
|
|
|
2212 |
def convertStoreToNormal(self, orderId):
|
|
|
2213 |
try:
|
|
|
2214 |
return convert_store_to_normal(orderId)
|
|
|
2215 |
except:
|
|
|
2216 |
return False
|
|
|
2217 |
finally:
|
|
|
2218 |
self.closeSession()
|
| 7822 |
amar.kumar |
2219 |
|
|
|
2220 |
def updateFreebieItem(self, orderId, newFreebieItemId):
|
|
|
2221 |
try:
|
|
|
2222 |
return to_t_order(update_freebie_item(orderId, newFreebieItemId))
|
|
|
2223 |
finally:
|
|
|
2224 |
self.closeSession()
|
| 7938 |
manish.sha |
2225 |
|
| 7967 |
anupam.sin |
2226 |
def getHotspotServiceMatrices(self):
|
|
|
2227 |
try:
|
|
|
2228 |
return [to_t_hotspotServiceMatrix(hotpotServiceMatrix) for hotpotServiceMatrix in get_hotspot_service_matrices()]
|
|
|
2229 |
finally:
|
|
|
2230 |
self.closeSession()
|
|
|
2231 |
|
| 7938 |
manish.sha |
2232 |
def updateOrderAWB(self, orderId, airwayBillNo):
|
|
|
2233 |
try:
|
| 7985 |
manish.sha |
2234 |
return to_t_order(update_order_AWB(orderId, airwayBillNo))
|
| 7938 |
manish.sha |
2235 |
finally:
|
|
|
2236 |
close_session()
|
| 8182 |
amar.kumar |
2237 |
def getOrdersByVendor(self, vendors, statuses):
|
|
|
2238 |
try:
|
|
|
2239 |
return [to_t_order(order) for order in get_orders_by_vendor(vendors, statuses)]
|
|
|
2240 |
finally:
|
|
|
2241 |
close_session()
|
| 7607 |
anupam.sin |
2242 |
|
| 8182 |
amar.kumar |
2243 |
def createEbayOrder(self, ebayOrder):
|
|
|
2244 |
try:
|
|
|
2245 |
create_ebay_order(ebayOrder)
|
|
|
2246 |
finally:
|
|
|
2247 |
close_session()
|
|
|
2248 |
def getEbayOrderByOrderId(self, orderId):
|
|
|
2249 |
try:
|
|
|
2250 |
return to_t_ebayOrder(get_ebay_order_by_orderId(orderId))
|
|
|
2251 |
finally:
|
|
|
2252 |
close_session()
|
|
|
2253 |
|
|
|
2254 |
def getEbayOrderBySalesRecNumber(self, salesRecordNumber):
|
|
|
2255 |
try:
|
|
|
2256 |
return to_t_ebayOrder(get_ebay_order_by_sales_rec_number(salesRecordNumber))
|
|
|
2257 |
finally:
|
|
|
2258 |
close_session()
|
|
|
2259 |
|
| 8241 |
amar.kumar |
2260 |
def getEbayOrder(self, salesRecordNumber, listingId, paisaPayId):
|
| 8182 |
amar.kumar |
2261 |
try:
|
| 8253 |
amar.kumar |
2262 |
return [to_t_ebayOrder(order) for order in get_ebay_order(salesRecordNumber, listingId, paisaPayId)]
|
| 8182 |
amar.kumar |
2263 |
finally:
|
|
|
2264 |
close_session()
|
|
|
2265 |
|
|
|
2266 |
def updateEbayOrder(self, ebayOrder):
|
|
|
2267 |
try:
|
|
|
2268 |
update_ebay_order(ebayOrder)
|
|
|
2269 |
finally:
|
|
|
2270 |
close_session()
|
|
|
2271 |
|
|
|
2272 |
def ebayOrderExists(self, salesRecNumber, ebayListingId):
|
|
|
2273 |
try:
|
|
|
2274 |
return ebay_order_exists(salesRecNumber, ebayListingId)
|
|
|
2275 |
finally:
|
|
|
2276 |
close_session()
|
|
|
2277 |
|
|
|
2278 |
def updateOrderForEbay(self, order):
|
|
|
2279 |
try:
|
|
|
2280 |
update_order_for_ebay(order)
|
|
|
2281 |
finally:
|
|
|
2282 |
close_session()
|
|
|
2283 |
|
|
|
2284 |
def splitEbayOrder(self, orderId, splitOrderQty, splitOrderItemId, usePowerShip):
|
|
|
2285 |
try:
|
|
|
2286 |
return to_t_order(split_ebay_order(orderId, splitOrderQty, splitOrderItemId, usePowerShip))
|
|
|
2287 |
finally:
|
|
|
2288 |
close_session()
|
| 8282 |
kshitij.so |
2289 |
|
|
|
2290 |
def addOrUpdateAmazonFbaSalesSnapshot(self,amazonfbasalessnapshot):
|
|
|
2291 |
try:
|
|
|
2292 |
add_or_update_amazon_fba_sales_snapshot(amazonfbasalessnapshot)
|
|
|
2293 |
finally:
|
|
|
2294 |
close_session()
|
|
|
2295 |
|
|
|
2296 |
def getAmazonFbaSalesSnapshotForDays(self,days):
|
|
|
2297 |
fbasalessnapshot = []
|
|
|
2298 |
try:
|
|
|
2299 |
snapshots = get_amazon_fba_sales_snapshot_for_days(days)
|
|
|
2300 |
for snapshot in snapshots:
|
|
|
2301 |
fbasalessnapshot.append(to_t_amazonFbaSalesSnapshot(snapshot))
|
|
|
2302 |
return fbasalessnapshot
|
|
|
2303 |
except:
|
|
|
2304 |
return None
|
|
|
2305 |
finally:
|
|
|
2306 |
close_session()
|
|
|
2307 |
|
|
|
2308 |
def getAmazonFbaSalesLatestSnapshotForItem(self,item_id):
|
|
|
2309 |
try:
|
| 8363 |
vikram.rag |
2310 |
return to_t_amazonFbaSalesSnapshot(get_amazon_fba_sales_latest_snapshot_for_item(item_id))
|
| 8282 |
kshitij.so |
2311 |
except:
|
|
|
2312 |
return None
|
|
|
2313 |
finally:
|
|
|
2314 |
close_session()
|
| 8488 |
amar.kumar |
2315 |
|
|
|
2316 |
def createSnapdealOrder(self, snapdeal_order):
|
|
|
2317 |
try:
|
|
|
2318 |
create_snapdeal_order(snapdeal_order)
|
|
|
2319 |
finally:
|
|
|
2320 |
close_session()
|
|
|
2321 |
|
|
|
2322 |
def getSnapdealOrder(self, orderId, reference_code, suborder_id):
|
|
|
2323 |
try:
|
|
|
2324 |
return to_t_snapdealOrder(get_snapdeal_order(self, orderId, reference_code, suborder_id))
|
|
|
2325 |
finally:
|
|
|
2326 |
close_session()
|
|
|
2327 |
|
|
|
2328 |
def snapdealOrderExists(self, suborder_id):
|
|
|
2329 |
try:
|
|
|
2330 |
return snapdeal_order_exists(suborder_id)
|
|
|
2331 |
finally:
|
|
|
2332 |
close_session()
|
| 8182 |
amar.kumar |
2333 |
|
| 2536 |
chandransh |
2334 |
def closeSession(self, ):
|
|
|
2335 |
close_session()
|
| 3376 |
rajveer |
2336 |
|
|
|
2337 |
def isAlive(self, ):
|
|
|
2338 |
"""
|
| 5447 |
anupam.sin |
2339 |
For checking whether service is alive or not. It also checks connectivity with database
|
| 3376 |
rajveer |
2340 |
"""
|
|
|
2341 |
try:
|
|
|
2342 |
return is_alive()
|
|
|
2343 |
finally:
|
| 6988 |
rajveer |
2344 |
close_session()
|