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