| 104 |
ashish |
1 |
'''
|
|
|
2 |
Created on 29-Mar-2010
|
|
|
3 |
|
|
|
4 |
@author: ashish
|
|
|
5 |
'''
|
| 19973 |
amit.gupta |
6 |
import datetime
|
| 6056 |
amit.gupta |
7 |
from elixir import session
|
| 19973 |
amit.gupta |
8 |
import json
|
|
|
9 |
|
| 11902 |
amit.gupta |
10 |
from shop2020.helpers.impl.DataAccessor import close_session
|
|
|
11 |
from shop2020.model.v1.order.impl import DataService, RedExpressUpdateService, \
|
| 7363 |
rajveer |
12 |
RechargeService
|
| 6000 |
mandeep.dh |
13 |
from shop2020.model.v1.order.impl.Convertors import to_t_transaction, to_t_alert, \
|
|
|
14 |
to_t_order, to_t_lineitem, to_t_payment_settlement, to_t_verification_agent, \
|
| 11902 |
amit.gupta |
15 |
to_t_attribute, to_t_rechargeTransaction, to_t_frc, to_t_hotspot, \
|
|
|
16 |
to_t_sourcedetail, to_t_amazonorder, to_t_storeOrderDetail, \
|
|
|
17 |
to_t_storeOrderCollection, to_t_hotspotServiceMatrix, to_t_ebayOrder, \
|
| 14134 |
amit.gupta |
18 |
to_t_amazonFbaSalesSnapshot, to_t_snapdealOrder, to_t_flipkartOrder, \
|
| 19836 |
amit.gupta |
19 |
to_t_amazonFbaOrderReturn, to_t_flipkartAdvantageOrder, to_t_hsOrder, \
|
|
|
20 |
to_t_Creditor, to_t_CreditHistory, to_t_UserSanction, to_t_LoanHistory, \
|
|
|
21 |
to_t_PaginatedCreditHistory, to_t_PaginatedLoanHistory, \
|
|
|
22 |
to_t_PaginatedUserSanction, to_t_returnOrderInfo, to_t_returnTransaction, \
|
| 19889 |
manas |
23 |
to_t_rPickupRequest, to_t_OutstandingPayments
|
| 6000 |
mandeep.dh |
24 |
from shop2020.model.v1.order.impl.DataAccessors import create_transaction, \
|
|
|
25 |
get_transactions_for_customer, get_transaction_status, get_line_items_for_order, \
|
|
|
26 |
get_transaction, get_transactions_for_shopping_cart_id, \
|
|
|
27 |
change_transaction_status, get_orders_for_customer, get_orders_for_transaction, \
|
|
|
28 |
get_order, get_returnable_orders_for_customer, \
|
|
|
29 |
get_cancellable_orders_for_customer, get_orders_by_billing_date, get_all_orders, \
|
|
|
30 |
change_order_status, get_alerts, add_alert, add_billing_details, close_session, \
|
|
|
31 |
accept_order, mark_orders_as_picked_up, mark_orders_as_delivered, \
|
|
|
32 |
mark_orders_as_rto, order_outofstock, batch_orders, update_non_delivery_reason, \
|
|
|
33 |
enqueue_transaction_info_email, get_undelivered_orders, get_order_for_customer, \
|
|
|
34 |
get_valid_order_count, get_cust_count_with_successful_txn, \
|
|
|
35 |
get_valid_orders_amount_range, get_valid_orders, toggle_doa_flag, \
|
|
|
36 |
request_pickup_number, authorize_pickup, receive_return, validate_doa, \
|
|
|
37 |
reship_order, refund_order, get_return_orders, process_return, get_return_order, \
|
|
|
38 |
mark_doas_as_picked_up, verify_order, is_alive, get_orders_by_shipping_date, \
|
|
|
39 |
update_weight, change_warehouse, change_product, add_delay_reason, \
|
|
|
40 |
reconcile_cod_collection, get_transactions_requiring_extra_processing, \
|
|
|
41 |
mark_transaction_as_processed, get_item_wise_risky_orders_count, \
|
|
|
42 |
accept_order_for_item, get_orders_in_batch, get_order_count, \
|
|
|
43 |
get_ebs_settlement_summaries, mark_order_cancellation_request_received, \
|
|
|
44 |
mark_order_cancellation_request_denied, refund_transaction, \
|
|
|
45 |
mark_order_cancellation_request_confirmed, \
|
|
|
46 |
mark_transaction_as_payment_flag_removed, accept_orders_for_item_id, \
|
|
|
47 |
mark_orders_as_po_raised, mark_orders_as_reversal_initiated, \
|
|
|
48 |
mark_orders_as_not_available, update_shipment_address, mark_orders_as_timeout, \
|
|
|
49 |
get_order_for_awb, mark_orders_as_shipped_from_warehouse, mark_alerts_as_seen, \
|
|
|
50 |
mark_order_doa_request_received, mark_order_doa_request_authorized, \
|
|
|
51 |
mark_order_return_request_received, mark_order_return_request_authorized, \
|
|
|
52 |
add_invoice_number, get_reshipped_order_ids, validate_return_product, \
|
|
|
53 |
get_orders_for_provider_for_status, save_ebs_settlement_summary, \
|
|
|
54 |
get_ebs_settlement_date, save_payment_settlements, mark_ebs_settlement_uploaded, \
|
|
|
55 |
get_billed_orders_for_vendor, get_settlement_for_Prepaid, \
|
|
|
56 |
get_settlements_by_date, get_slipped_sipping_date_orders, \
|
|
|
57 |
mark_order_as_lost_in_transit, get_cancelled_orders, mark_order_as_delivered, \
|
|
|
58 |
mark_return_orders_as_picked_up, update_orders_as_PORaised, \
|
|
|
59 |
get_order_distribution_by_status, get_orders_not_met_expected_delivery_date, \
|
|
|
60 |
mark_orders_as_local_connected, mark_orders_as_destinationCityReached, \
|
|
|
61 |
mark_orders_as_firstDeliveryAttempted, get_non_delivered_orders_by_courier, \
|
|
|
62 |
get_orders_not_local_connected, get_doas_not_picked_up, \
|
|
|
63 |
get_return_orders_not_picked_up, get_orders_not_picked_up, get_rto_orders, \
|
|
|
64 |
get_order_list, get_order_ids_for_status, update_orders_as_paid_to_vendor, \
|
|
|
65 |
update_COD_agent, get_refunded_orders_marked_paid, get_settlement_for_Cod, \
|
|
|
66 |
get_order_list_for_vendor, update_order_only_as_paid_to_vendor, \
|
|
|
67 |
get_all_verification_agents, get_all_attributes_for_order_id, \
|
|
|
68 |
set_order_attribute_for_transaction, get_billed_orders, get_all_return_orders, \
|
|
|
69 |
mark_order_as_received_at_store, get_receive_pending_orders, \
|
|
|
70 |
get_received_at_store_orders, mark_orders_as_returned_from_store, \
|
| 6056 |
amit.gupta |
71 |
set_order_attributes, get_orders_collection_at_store, get_order_attribute_value, \
|
|
|
72 |
change_jacket_number, mark_order_as_rto_in_transit, get_recharge_order, \
|
|
|
73 |
get_recharge_orders, update_recharge_order_status, activate_recharge_txn, \
|
|
|
74 |
get_user_wallet, get_user_wallet_history, get_service_providers, \
|
| 6396 |
amit.gupta |
75 |
get_service_provider_for_device, get_recharge_orders_for_transaction, \
|
|
|
76 |
update_amount_in_wallet, get_recharge_orders_for_device, \
|
|
|
77 |
get_recharge_orders_for_status, get_plans_for_operator, get_recharge_statistics, \
|
|
|
78 |
validate_recharge, get_recharge_denominations, update_availability_status, \
|
| 6821 |
amar.kumar |
79 |
get_misc_charges, get_available_emi_schemes, refund_recharge_order, \
|
| 7073 |
anupam.sin |
80 |
create_recharge_transaction, get_physical_orders, get_document, retrieve_invoice, \
|
| 7125 |
amit.gupta |
81 |
change_shipping_address, get_recharge_transactions, get_recharge_transaction, \
|
| 7151 |
amit.gupta |
82 |
get_frcs, get_hotspot_store, get_circle, retrieve_hotspot_recharge_invoice, \
|
| 7190 |
amar.kumar |
83 |
get_recharge_trans, split_freebie_order, get_recharge_transactions_by_number, \
|
| 11902 |
amit.gupta |
84 |
update_hotspot_store_password, get_source_detail, get_all_circles, delete_frcs, \
|
|
|
85 |
topup_company_wallet, get_wallet_balance_for_company, add_amazon_order, \
|
|
|
86 |
update_amazon_order_status, get_amazon_order, get_amazon_orders_shipped, \
|
|
|
87 |
get_amazon_orders_cancelled, get_orders_for_store, \
|
|
|
88 |
get_store_order_advance_invoice, add_frc, add_series, get_store_order_detail, \
|
|
|
89 |
save_store_order_detail, get_all_edc_banks, save_refund_amounts_for_store_order, \
|
|
|
90 |
get_collections_for_store, get_amazon_orders_to_acknowledge, \
|
|
|
91 |
change_amazon_order_status, update_timestamp_for_amazon_order, \
|
|
|
92 |
update_source_detail_timestamp, get_amazon_order_by_amazonorderid, \
|
|
|
93 |
get_orders_by_mobile_number, get_orders_by_amazon_id, change_courier_provider, \
|
|
|
94 |
convert_store_to_normal, update_freebie_item, update_order_AWB, \
|
| 8182 |
amar.kumar |
95 |
get_hotspot_service_matrices, get_orders_by_vendor, create_ebay_order, \
|
|
|
96 |
get_ebay_order_by_sales_rec_number, get_ebay_order_by_orderId, update_ebay_order, \
|
| 8488 |
amar.kumar |
97 |
ebay_order_exists, update_order_for_ebay, get_ebay_order, split_ebay_order, \
|
|
|
98 |
add_or_update_amazon_fba_sales_snapshot, get_amazon_fba_sales_snapshot_for_days, \
|
|
|
99 |
get_amazon_fba_sales_latest_snapshot_for_item, create_snapdeal_order, \
|
| 11902 |
amit.gupta |
100 |
get_snapdeal_order, snapdeal_order_exists, update_latest_fba_prices_for_item, \
|
|
|
101 |
flipkart_order_exists, create_flipkart_order, get_flipkart_order, \
|
|
|
102 |
get_flipkart_order_by_subOrderId, update_flipkart_order_dates_and_awb, \
|
|
|
103 |
get_order_for_airwayBillNo, get_orders_count_created_after_timestamp_for_source, \
|
|
|
104 |
get_min_created_timestamp_undelivered_orders_for_source, \
|
|
|
105 |
update_snapdeal_orders_status, update_flipkart_orders_status, \
|
|
|
106 |
bulk_add_or_update_amazon_fba_sales_snapshot, get_created_orders_for_flipkart, \
|
| 12103 |
manish.sha |
107 |
is_private_deal_transaction, change_easyship_mfn_order_txn_status, \
|
|
|
108 |
update_amazon_fba_order_returns, get_all_amazon_fba_order_returns, \
|
| 13941 |
amit.gupta |
109 |
get_total_sale_returns_fba_skus_curent_time, \
|
|
|
110 |
get_amazon_fba_sales_latest_snapshot_for_item_location_wise, \
|
|
|
111 |
get_verification_pending_orders_fk, add_invoice_details_to_orders, \
|
|
|
112 |
get_fa_order_by_fk_order_id, get_all_fa_orders_list, add_update_fa_orders_bulk, \
|
|
|
113 |
flipkart_fa_order_exists, get_recharge_order_status, \
|
|
|
114 |
get_recharge_transaction_status, accept_package_orders, \
|
|
|
115 |
get_group_orders_by_logistics_txn_id, add_billing_details_for_groupped_orders, \
|
|
|
116 |
get_invoice_format_logistics_txn_id, homeshop_order_exists, \
|
| 19836 |
amit.gupta |
117 |
create_homeshop_order, get_homeshop_order, split_bulk_order, \
|
|
|
118 |
move_orders_to_correct_warehouse, verify_orders_for_transaction, \
|
|
|
119 |
get_creditor_info, update_creditor_info, get_user_sanction_details, \
|
| 18634 |
manish.sha |
120 |
update_user_sanction, get_credit_history_records, process_credit_transaction, \
|
|
|
121 |
get_loan_payable_for_user_to_creditor, get_loan_history_records, \
|
| 19836 |
amit.gupta |
122 |
process_loan_transaction, get_credit_history_records_paginated, \
|
|
|
123 |
get_loan_history_records_paginated, get_user_sanction_details_paginated, \
|
|
|
124 |
get_orders_in_batch_as_promised_shipping, \
|
|
|
125 |
set_order_attribute_for_master_order_id, update_master_order_awb, \
|
|
|
126 |
add_or_update_shipment_logistics_cost_details, get_return_order_info, \
|
|
|
127 |
get_return_orders_info_map, update_return_order_info, \
|
|
|
128 |
bulk_update_return_order_info, get_return_orders_as_per_warehouse, \
|
|
|
129 |
create_return_transaction, get_return_transactions_for_customer, \
|
|
|
130 |
get_return_transaction, change_return_transaction_status, \
|
|
|
131 |
create_return_pickup_request, update_return_pickup_request, \
|
|
|
132 |
get_return_orders_for_return_transaction, receive_return_pickup, \
|
|
|
133 |
validate_return_pickup, process_return_pickup, mark_return_transaction_complete, \
|
|
|
134 |
refund_return_transaction_payment, get_eligible_orders_for_return, \
|
|
|
135 |
get_eligible_return_orders_for_pickup, validate_return_transaction, \
|
|
|
136 |
get_return_pickup_request, mark_return_not_required_orders_as_processed, \
|
| 19973 |
amit.gupta |
137 |
get_all_return_orders_for_return_pickup_request, unaccept_order, \
|
| 19980 |
amit.gupta |
138 |
get_outstanding_payments, mark_payment_settled, get_seller_info, \
|
|
|
139 |
get_warehouse_address
|
| 14134 |
amit.gupta |
140 |
from shop2020.model.v1.order.impl.DataService import DtrBatchCreditTracker
|
| 6000 |
mandeep.dh |
141 |
from shop2020.model.v1.order.impl.model.DTHRechargeOrder import DTHRechargeOrder
|
| 6056 |
amit.gupta |
142 |
from shop2020.model.v1.order.impl.model.DigitalTransaction import \
|
|
|
143 |
DigitalTransaction
|
| 6000 |
mandeep.dh |
144 |
from shop2020.model.v1.order.impl.model.MobileRechargeOrder import \
|
|
|
145 |
MobileRechargeOrder
|
| 14134 |
amit.gupta |
146 |
from shop2020.model.v1.order.impl.model.UserWalletHistory import \
|
|
|
147 |
UserWalletHistory
|
| 11902 |
amit.gupta |
148 |
from shop2020.model.v1.user.impl.Converters import to_t_address
|
| 6000 |
mandeep.dh |
149 |
from shop2020.thriftpy.model.v1.order.ttypes import TransactionServiceException, \
|
| 11902 |
amit.gupta |
150 |
RechargeType, AmazonOrdersToAcknowledge
|
| 6000 |
mandeep.dh |
151 |
from shop2020.utils.Utils import to_py_date, get_fdate_tdate, to_java_date
|
| 1405 |
ankur.sing |
152 |
|
| 5527 |
anupam.sin |
153 |
|
| 104 |
ashish |
154 |
class OrderServiceHandler:
|
|
|
155 |
|
| 3187 |
rajveer |
156 |
def __init__(self, dbname='transaction', db_hostname='localhost'):
|
| 483 |
rajveer |
157 |
"""
|
| 104 |
ashish |
158 |
Constructor
|
| 483 |
rajveer |
159 |
"""
|
| 3187 |
rajveer |
160 |
DataService.initialize(dbname, db_hostname)
|
| 104 |
ashish |
161 |
|
|
|
162 |
def createTransaction(self, transaction):
|
|
|
163 |
"""
|
|
|
164 |
Parameters:
|
|
|
165 |
- transaction
|
|
|
166 |
"""
|
| 766 |
rajveer |
167 |
try:
|
|
|
168 |
return create_transaction(transaction)
|
|
|
169 |
finally:
|
|
|
170 |
close_session()
|
|
|
171 |
|
| 104 |
ashish |
172 |
def getTransaction(self, id):
|
|
|
173 |
"""
|
|
|
174 |
Get transaction methods.
|
|
|
175 |
|
|
|
176 |
Parameters:
|
|
|
177 |
- id
|
|
|
178 |
"""
|
| 766 |
rajveer |
179 |
try:
|
|
|
180 |
transaction = get_transaction(id)
|
|
|
181 |
return to_t_transaction(transaction)
|
|
|
182 |
finally:
|
|
|
183 |
close_session()
|
|
|
184 |
|
| 483 |
rajveer |
185 |
def getTransactionsForCustomer(self, customerId, from_date, to_date, status):
|
| 104 |
ashish |
186 |
"""
|
|
|
187 |
Parameters:
|
| 483 |
rajveer |
188 |
- customerId
|
| 104 |
ashish |
189 |
- from_date
|
|
|
190 |
- to_date
|
| 483 |
rajveer |
191 |
- status
|
| 104 |
ashish |
192 |
"""
|
| 766 |
rajveer |
193 |
try:
|
|
|
194 |
current_from_date, current_to_date = get_fdate_tdate(from_date, to_date)
|
|
|
195 |
|
|
|
196 |
transactions = get_transactions_for_customer(customerId, current_from_date, current_to_date, status)
|
|
|
197 |
t_transaction = []
|
|
|
198 |
for transaction in transactions:
|
|
|
199 |
t_transaction.append(to_t_transaction(transaction))
|
|
|
200 |
return t_transaction
|
|
|
201 |
finally:
|
|
|
202 |
close_session()
|
| 483 |
rajveer |
203 |
|
|
|
204 |
def getTransactionsForShoppingCartId(self, shoppingCartId):
|
|
|
205 |
"""
|
|
|
206 |
Parameters:
|
|
|
207 |
- shoppingCartId
|
|
|
208 |
"""
|
| 766 |
rajveer |
209 |
try:
|
|
|
210 |
transactions = get_transactions_for_shopping_cart_id(shoppingCartId)
|
|
|
211 |
t_transaction = []
|
|
|
212 |
for transaction in transactions:
|
|
|
213 |
t_transaction.append(to_t_transaction(transaction))
|
|
|
214 |
return t_transaction
|
|
|
215 |
finally:
|
|
|
216 |
close_session()
|
| 104 |
ashish |
217 |
|
| 483 |
rajveer |
218 |
def getTransactionStatus(self, transactionId):
|
| 104 |
ashish |
219 |
"""
|
|
|
220 |
Parameters:
|
| 483 |
rajveer |
221 |
- transactionId
|
|
|
222 |
"""
|
| 766 |
rajveer |
223 |
try:
|
|
|
224 |
return get_transaction_status(transactionId)
|
|
|
225 |
finally:
|
|
|
226 |
close_session()
|
|
|
227 |
|
| 7293 |
anupam.sin |
228 |
def changeTransactionStatus(self, transactionId, status, description, pickUp, orderType, source):
|
| 483 |
rajveer |
229 |
"""
|
|
|
230 |
Parameters:
|
|
|
231 |
- transactionId
|
| 104 |
ashish |
232 |
- status
|
| 483 |
rajveer |
233 |
- description
|
| 5387 |
rajveer |
234 |
- selfPickup
|
| 483 |
rajveer |
235 |
"""
|
| 766 |
rajveer |
236 |
try:
|
| 7293 |
anupam.sin |
237 |
return change_transaction_status(transactionId, status, description, pickUp, orderType, source)
|
| 766 |
rajveer |
238 |
finally:
|
|
|
239 |
close_session()
|
|
|
240 |
|
| 1528 |
ankur.sing |
241 |
def getOrdersForTransaction(self, transactionId, customerId):
|
| 483 |
rajveer |
242 |
"""
|
| 1528 |
ankur.sing |
243 |
Returns list of orders for given transaction Id. Also filters based on customer Id so that
|
|
|
244 |
only user who owns the transaction can view its order details.
|
|
|
245 |
|
| 483 |
rajveer |
246 |
Parameters:
|
|
|
247 |
- transactionId
|
| 1528 |
ankur.sing |
248 |
- customerId
|
| 483 |
rajveer |
249 |
"""
|
| 766 |
rajveer |
250 |
try:
|
| 1528 |
ankur.sing |
251 |
orders = get_orders_for_transaction(transactionId, customerId)
|
| 766 |
rajveer |
252 |
return [to_t_order(order) for order in orders]
|
|
|
253 |
finally:
|
|
|
254 |
close_session()
|
|
|
255 |
|
| 4801 |
anupam.sin |
256 |
def getAllOrders(self, statuses, from_date, to_date, warehouse_id):
|
| 483 |
rajveer |
257 |
"""
|
|
|
258 |
Parameters:
|
|
|
259 |
- status
|
| 104 |
ashish |
260 |
- from_date
|
|
|
261 |
- to_date
|
| 483 |
rajveer |
262 |
- warehouse_id
|
| 104 |
ashish |
263 |
"""
|
| 766 |
rajveer |
264 |
try:
|
|
|
265 |
current_from_date, current_to_date = get_fdate_tdate(from_date, to_date)
|
| 4801 |
anupam.sin |
266 |
orders = get_all_orders(statuses, current_from_date, current_to_date, warehouse_id)
|
| 766 |
rajveer |
267 |
return [to_t_order(order) for order in orders]
|
|
|
268 |
finally:
|
|
|
269 |
close_session()
|
| 4133 |
chandransh |
270 |
|
| 8303 |
amar.kumar |
271 |
def getOrdersInBatch(self, statuses, offset, limit, warehouse_id, source):
|
| 4133 |
chandransh |
272 |
"""
|
|
|
273 |
Returns at most 'limit' orders with the given statuses for the given warehouse starting from the given offset.
|
|
|
274 |
Pass the status as null and the limit as 0 to ignore them.
|
|
|
275 |
|
|
|
276 |
Parameters:
|
|
|
277 |
- statuses
|
|
|
278 |
- offset
|
|
|
279 |
- limit
|
|
|
280 |
- warehouse_id
|
|
|
281 |
"""
|
|
|
282 |
try:
|
| 8303 |
amar.kumar |
283 |
orders = get_orders_in_batch(statuses, offset, limit, warehouse_id, source)
|
| 4133 |
chandransh |
284 |
return [to_t_order(order) for order in orders]
|
|
|
285 |
finally:
|
|
|
286 |
close_session()
|
|
|
287 |
|
| 8303 |
amar.kumar |
288 |
def getOrderCount(self, statuses, warehouseId, source):
|
| 4133 |
chandransh |
289 |
"""
|
|
|
290 |
Returns the count of orders with the given statuses assigned to the given warehouse.
|
|
|
291 |
|
|
|
292 |
Parameters:
|
|
|
293 |
- statuses
|
|
|
294 |
- warehouseId
|
|
|
295 |
"""
|
|
|
296 |
try:
|
| 8303 |
amar.kumar |
297 |
return get_order_count(statuses, warehouseId, source)
|
| 4133 |
chandransh |
298 |
finally:
|
|
|
299 |
close_session()
|
|
|
300 |
|
| 995 |
varun.gupt |
301 |
def getOrdersByBillingDate(self, status, start_billing_date, end_billing_date, warehouse_id):
|
|
|
302 |
"""
|
|
|
303 |
Parameters:
|
|
|
304 |
- status
|
|
|
305 |
- start_billing_date
|
|
|
306 |
- end_billing_date
|
|
|
307 |
- warehouse_id
|
|
|
308 |
"""
|
|
|
309 |
try:
|
|
|
310 |
current_start_billing_date, current_end_billing_date = get_fdate_tdate(start_billing_date, end_billing_date)
|
|
|
311 |
orders = get_orders_by_billing_date(status, current_start_billing_date, current_end_billing_date, warehouse_id)
|
|
|
312 |
return [to_t_order(order) for order in orders]
|
|
|
313 |
finally:
|
|
|
314 |
close_session()
|
| 1382 |
varun.gupt |
315 |
|
| 3451 |
chandransh |
316 |
def getOrdersByShippingDate(self, fromShippingDate, toShippingDate, providerId, warehouseId, cod):
|
| 3427 |
chandransh |
317 |
"""
|
|
|
318 |
Returns orders for a particular provider and warehouse which were shipped between the given dates.
|
| 3451 |
chandransh |
319 |
Returned orders comprise of COD orders if cod parameter is true. It comprises of prepaid orders otherwise.
|
|
|
320 |
Pass providerId and warehouseId as -1 to ignore both these parameters.
|
| 3427 |
chandransh |
321 |
|
|
|
322 |
Parameters:
|
|
|
323 |
- fromShippingDate
|
|
|
324 |
- toShippingDate
|
|
|
325 |
- providerId
|
|
|
326 |
- warehouseId
|
| 3451 |
chandransh |
327 |
- cod
|
| 3427 |
chandransh |
328 |
"""
|
|
|
329 |
try:
|
|
|
330 |
from_shipping_date, to_shipping_date = get_fdate_tdate(fromShippingDate, toShippingDate)
|
| 3451 |
chandransh |
331 |
orders = get_orders_by_shipping_date(from_shipping_date, to_shipping_date, providerId, warehouseId, cod)
|
| 3427 |
chandransh |
332 |
return [to_t_order(order) for order in orders]
|
|
|
333 |
finally:
|
|
|
334 |
close_session()
|
|
|
335 |
|
| 1382 |
varun.gupt |
336 |
def getReturnableOrdersForCustomer(self, customerId, limit = None):
|
|
|
337 |
"""
|
|
|
338 |
Parameters:
|
|
|
339 |
- customerId
|
|
|
340 |
- limit
|
|
|
341 |
"""
|
|
|
342 |
try:
|
|
|
343 |
return get_returnable_orders_for_customer(customerId, limit)
|
|
|
344 |
finally:
|
|
|
345 |
close_session()
|
| 995 |
varun.gupt |
346 |
|
| 1382 |
varun.gupt |
347 |
def getCancellableOrdersForCustomer(self, customerId, limit = None):
|
|
|
348 |
"""
|
|
|
349 |
Parameters:
|
|
|
350 |
- customerId
|
|
|
351 |
- limit
|
|
|
352 |
"""
|
|
|
353 |
try:
|
|
|
354 |
return get_cancellable_orders_for_customer(customerId, limit)
|
|
|
355 |
finally:
|
|
|
356 |
close_session()
|
|
|
357 |
|
| 483 |
rajveer |
358 |
def changeOrderStatus(self, orderId, status, description):
|
|
|
359 |
"""
|
|
|
360 |
Parameters:
|
|
|
361 |
- orderId
|
|
|
362 |
- status
|
|
|
363 |
- description
|
|
|
364 |
-
|
|
|
365 |
"""
|
| 766 |
rajveer |
366 |
try:
|
|
|
367 |
return change_order_status(self, orderId, status, description)
|
|
|
368 |
finally:
|
|
|
369 |
close_session()
|
| 921 |
rajveer |
370 |
|
| 3064 |
chandransh |
371 |
def verifyOrder(self, orderId):
|
|
|
372 |
"""
|
|
|
373 |
Marks the given order as SUBMITTED_FOR_PROCESSING and updates the verified
|
|
|
374 |
timestamp. It is intended to be used for COD orders but can be harmlessly
|
|
|
375 |
used for all other orders as well.
|
|
|
376 |
Throws an exception if no such order exists.
|
|
|
377 |
|
|
|
378 |
Parameters:
|
|
|
379 |
- orderId
|
|
|
380 |
"""
|
|
|
381 |
try:
|
| 7391 |
rajveer |
382 |
return verify_order(orderId)
|
| 3064 |
chandransh |
383 |
finally:
|
|
|
384 |
close_session()
|
|
|
385 |
|
| 921 |
rajveer |
386 |
def acceptOrder(self, orderId):
|
|
|
387 |
"""
|
| 3064 |
chandransh |
388 |
Marks the given order as ACCEPTED and updates the accepted timestamp. If the
|
|
|
389 |
given order is not a COD order, it also captures the payment if the same has
|
|
|
390 |
not been captured.
|
|
|
391 |
Throws an exception if no such order exists.
|
|
|
392 |
|
| 921 |
rajveer |
393 |
Parameters:
|
|
|
394 |
- orderId
|
|
|
395 |
"""
|
|
|
396 |
try:
|
| 4285 |
rajveer |
397 |
return accept_order(orderId)
|
| 921 |
rajveer |
398 |
finally:
|
|
|
399 |
close_session()
|
| 19832 |
amit.gupta |
400 |
|
|
|
401 |
def unacceptOrder(self, orderId):
|
|
|
402 |
"""
|
|
|
403 |
Rollsback to Processing State
|
|
|
404 |
|
|
|
405 |
Parameters:
|
|
|
406 |
- orderId
|
|
|
407 |
"""
|
|
|
408 |
try:
|
| 19836 |
amit.gupta |
409 |
return unaccept_order(orderId)
|
| 19832 |
amit.gupta |
410 |
finally:
|
|
|
411 |
close_session()
|
| 921 |
rajveer |
412 |
|
| 3014 |
chandransh |
413 |
def getOrdersForCustomer(self, customerId, from_date, to_date, statuses):
|
| 104 |
ashish |
414 |
"""
|
| 3014 |
chandransh |
415 |
Returns list of orders for the given customer created between the given dates and having the given statuses.
|
|
|
416 |
Pass and empty list to ignore filtering on statuses.
|
|
|
417 |
|
| 104 |
ashish |
418 |
Parameters:
|
|
|
419 |
- customerId
|
|
|
420 |
- from_date
|
|
|
421 |
- to_date
|
| 3014 |
chandransh |
422 |
- statuses
|
| 104 |
ashish |
423 |
"""
|
| 766 |
rajveer |
424 |
try:
|
|
|
425 |
current_from_date, current_to_date = get_fdate_tdate(from_date, to_date)
|
|
|
426 |
|
| 3014 |
chandransh |
427 |
orders = get_orders_for_customer(customerId, current_from_date, current_to_date, statuses)
|
| 766 |
rajveer |
428 |
return [to_t_order(order) for order in orders]
|
|
|
429 |
finally:
|
|
|
430 |
close_session()
|
| 1528 |
ankur.sing |
431 |
|
|
|
432 |
def getOrderForCustomer(self, orderId, customerId):
|
|
|
433 |
"""
|
|
|
434 |
Returns an order for the order Id. Also checks if the order belongs to the customer whose Id is passed.
|
|
|
435 |
Throws exception if either order Id is invalid or order does not below to the customer whose Id is passed.
|
|
|
436 |
|
|
|
437 |
Parameters:
|
|
|
438 |
- customerId
|
|
|
439 |
- orderId
|
|
|
440 |
"""
|
|
|
441 |
try:
|
|
|
442 |
return to_t_order(get_order_for_customer(orderId, customerId))
|
|
|
443 |
finally:
|
|
|
444 |
close_session()
|
| 766 |
rajveer |
445 |
|
| 483 |
rajveer |
446 |
def getOrder(self, id):
|
|
|
447 |
"""
|
|
|
448 |
Parameters:
|
|
|
449 |
- id
|
|
|
450 |
"""
|
| 766 |
rajveer |
451 |
try:
|
|
|
452 |
return to_t_order(get_order(id))
|
|
|
453 |
finally:
|
|
|
454 |
close_session()
|
| 4999 |
phani.kuma |
455 |
|
|
|
456 |
def getOrderList(self, order_ids):
|
|
|
457 |
"""
|
|
|
458 |
Parameters:
|
|
|
459 |
- order_ids
|
|
|
460 |
"""
|
|
|
461 |
try:
|
|
|
462 |
orders = get_order_list(order_ids)
|
|
|
463 |
return [to_t_order(order) for order in orders]
|
|
|
464 |
finally:
|
|
|
465 |
close_session()
|
|
|
466 |
|
| 5386 |
phani.kuma |
467 |
def getOrderListForVendor(self, order_ids, vendorId):
|
|
|
468 |
"""
|
|
|
469 |
Parameters:
|
|
|
470 |
- order_ids
|
|
|
471 |
- vendorId
|
|
|
472 |
"""
|
|
|
473 |
try:
|
|
|
474 |
orders = get_order_list_for_vendor(order_ids, vendorId)
|
|
|
475 |
return [to_t_order(order) for order in orders]
|
|
|
476 |
finally:
|
|
|
477 |
close_session()
|
|
|
478 |
|
| 483 |
rajveer |
479 |
def getLineItemsForOrder(self, orderId):
|
|
|
480 |
"""
|
|
|
481 |
Parameters:
|
|
|
482 |
- orderId
|
|
|
483 |
"""
|
| 766 |
rajveer |
484 |
try:
|
|
|
485 |
lineitems = get_line_items_for_order(orderId)
|
|
|
486 |
t_lineitems = []
|
|
|
487 |
for lineitem in lineitems:
|
|
|
488 |
t_lineitems.append(to_t_lineitem(lineitem))
|
|
|
489 |
return t_lineitems
|
|
|
490 |
finally:
|
|
|
491 |
close_session()
|
| 1149 |
chandransh |
492 |
|
| 7190 |
amar.kumar |
493 |
def addBillingDetails(self, orderId, invoice_number, serialNumber, itemNumber, freebieWarehouseId, billedBy, jacketNumber, billingType, vendorId, authorize):
|
| 494 |
rajveer |
494 |
"""
|
| 4658 |
mandeep.dh |
495 |
Adds jacket number and serial no. to the order. Doesn't update the serial no. if a -1 is supplied.
|
| 2783 |
chandransh |
496 |
Also marks the order as billed and sets the billing timestamp.
|
|
|
497 |
Return false if it doesn't find the order with the given ID.
|
| 1149 |
chandransh |
498 |
|
|
|
499 |
Parameters:
|
|
|
500 |
- orderId
|
|
|
501 |
- jacketNumber
|
| 4658 |
mandeep.dh |
502 |
- serialNumber
|
| 2783 |
chandransh |
503 |
- itemNumber
|
| 7190 |
amar.kumar |
504 |
- freebieWarehouseId
|
| 2783 |
chandransh |
505 |
- billedBy
|
| 1149 |
chandransh |
506 |
"""
|
|
|
507 |
try:
|
| 7190 |
amar.kumar |
508 |
return add_billing_details(orderId, invoice_number, serialNumber, itemNumber, freebieWarehouseId, billedBy, jacketNumber, billingType, vendorId, authorize)
|
| 1149 |
chandransh |
509 |
finally:
|
|
|
510 |
close_session()
|
| 1220 |
chandransh |
511 |
|
| 6751 |
amar.kumar |
512 |
def addInvoiceNumber(self, orderId, invoiceNumber, color, serialNumber, itemNumber):
|
| 4579 |
rajveer |
513 |
"""
|
|
|
514 |
Add the invoice number to the order.
|
|
|
515 |
|
|
|
516 |
Parameters:
|
|
|
517 |
- orderId
|
|
|
518 |
- invoice_number
|
|
|
519 |
"""
|
|
|
520 |
try:
|
| 6751 |
amar.kumar |
521 |
add_invoice_number(orderId, invoiceNumber, color, serialNumber, itemNumber)
|
| 4579 |
rajveer |
522 |
finally:
|
|
|
523 |
close_session()
|
|
|
524 |
|
| 1220 |
chandransh |
525 |
def batchOrders(self, warehouseId):
|
|
|
526 |
"""
|
|
|
527 |
Create a batch of all the pending orders for the given warehouse.
|
|
|
528 |
The returned list is orderd by created_timestamp.
|
|
|
529 |
If there are no pending orders, an empty list is returned.
|
| 1208 |
chandransh |
530 |
|
| 1220 |
chandransh |
531 |
Parameters:
|
|
|
532 |
- warehouseId
|
|
|
533 |
"""
|
|
|
534 |
try:
|
|
|
535 |
pending_orders = batch_orders(warehouseId)
|
|
|
536 |
return [to_t_order(order) for order in pending_orders]
|
|
|
537 |
finally:
|
|
|
538 |
close_session()
|
|
|
539 |
|
| 1208 |
chandransh |
540 |
def markOrderAsOutOfStock(self, orderId):
|
|
|
541 |
"""
|
|
|
542 |
Mark the given order as out of stock. Throws an exception if the order with the given Id couldn't be found.
|
|
|
543 |
|
|
|
544 |
|
|
|
545 |
Parameters:
|
|
|
546 |
- orderId
|
|
|
547 |
"""
|
|
|
548 |
try:
|
|
|
549 |
return order_outofstock(orderId)
|
|
|
550 |
finally:
|
|
|
551 |
close_session()
|
|
|
552 |
|
| 4910 |
phani.kuma |
553 |
def markOrdersAsShippedFromWarehouse(self, warehouseId, providerId, cod, orderIds):
|
| 759 |
chandransh |
554 |
"""
|
| 3064 |
chandransh |
555 |
Depending on the third parameter, marks either all prepaid or all cod orders BILLED by the
|
| 4910 |
phani.kuma |
556 |
given warehouse and were picked up by the given provider as SHIPPED_FROM_WH.
|
| 759 |
chandransh |
557 |
|
|
|
558 |
Parameters:
|
|
|
559 |
- warehouseId
|
|
|
560 |
- providerId
|
| 3064 |
chandransh |
561 |
- cod
|
| 759 |
chandransh |
562 |
"""
|
| 766 |
rajveer |
563 |
try:
|
| 4910 |
phani.kuma |
564 |
return mark_orders_as_shipped_from_warehouse(warehouseId, providerId, cod, orderIds)
|
| 766 |
rajveer |
565 |
finally:
|
|
|
566 |
close_session()
|
| 1113 |
chandransh |
567 |
|
| 5713 |
rajveer |
568 |
def markOrdersAsReturnedFromStore(self, providerId, orderIds, awbs):
|
| 5676 |
rajveer |
569 |
"""
|
|
|
570 |
Parameters:
|
|
|
571 |
- providerId
|
|
|
572 |
- orderIds
|
| 5713 |
rajveer |
573 |
- awbs
|
| 5676 |
rajveer |
574 |
"""
|
|
|
575 |
try:
|
| 5713 |
rajveer |
576 |
return mark_orders_as_returned_from_store(providerId, orderIds, awbs)
|
| 5676 |
rajveer |
577 |
finally:
|
|
|
578 |
close_session()
|
|
|
579 |
|
|
|
580 |
def setOrderAttributes(self, orderId, attributes):
|
|
|
581 |
"""
|
|
|
582 |
sets attributes for an order
|
|
|
583 |
|
|
|
584 |
Parameters:
|
|
|
585 |
- orderId
|
|
|
586 |
- attributes
|
|
|
587 |
"""
|
|
|
588 |
try:
|
|
|
589 |
return set_order_attributes(orderId, attributes)
|
|
|
590 |
finally:
|
|
|
591 |
close_session()
|
|
|
592 |
|
|
|
593 |
|
| 4910 |
phani.kuma |
594 |
def markOrdersAsPickedUp(self, providerId, pickupDetails):
|
| 4410 |
rajveer |
595 |
"""
|
| 4910 |
phani.kuma |
596 |
Marks all SHIPPED_FROM_WH orders of the previous day for a provider as SHIPPED_TO_LOGISTICS.
|
|
|
597 |
Raises an exception if we encounter report for an AWB number that we did not ship.
|
| 4410 |
rajveer |
598 |
|
|
|
599 |
Parameters:
|
|
|
600 |
- providerId
|
| 4910 |
phani.kuma |
601 |
- pickupDetails
|
| 4410 |
rajveer |
602 |
"""
|
|
|
603 |
try:
|
| 4910 |
phani.kuma |
604 |
mark_orders_as_picked_up(providerId, pickupDetails)
|
| 4410 |
rajveer |
605 |
finally:
|
|
|
606 |
close_session()
|
|
|
607 |
|
| 4910 |
phani.kuma |
608 |
def getOrdersNotPickedUp(self, providerId):
|
| 1113 |
chandransh |
609 |
"""
|
|
|
610 |
Returns a list of orders that were shipped from warehouse but did not appear in the pick-up report.
|
|
|
611 |
|
|
|
612 |
Parameters:
|
|
|
613 |
- providerId
|
|
|
614 |
"""
|
|
|
615 |
try:
|
| 4910 |
phani.kuma |
616 |
orders_not_picked_up = get_orders_not_picked_up(providerId)
|
| 1113 |
chandransh |
617 |
return [to_t_order(order) for order in orders_not_picked_up]
|
|
|
618 |
finally:
|
|
|
619 |
close_session()
|
| 1132 |
chandransh |
620 |
|
|
|
621 |
def markOrdersAsDelivered(self, providerId, deliveredOrders):
|
|
|
622 |
"""
|
|
|
623 |
Marks all orders with AWBs in the given map as delivered. Also sets the delivery timestamp and
|
|
|
624 |
the name of the receiver.
|
|
|
625 |
Raises an exception if we encounter report for an AWB number that we did not ship.
|
|
|
626 |
|
|
|
627 |
Parameters:
|
|
|
628 |
- providerId
|
|
|
629 |
- deliveredOrders
|
|
|
630 |
"""
|
|
|
631 |
try:
|
|
|
632 |
mark_orders_as_delivered(providerId, deliveredOrders)
|
|
|
633 |
finally:
|
|
|
634 |
close_session()
|
| 1135 |
chandransh |
635 |
|
| 4712 |
rajveer |
636 |
def markOrderAsDelivered(self, orderId, deliveryTimestamp, receiver):
|
|
|
637 |
"""
|
|
|
638 |
Attributes:
|
|
|
639 |
- orderId
|
|
|
640 |
- deliveryTimestamp
|
|
|
641 |
- receiver
|
|
|
642 |
"""
|
|
|
643 |
try:
|
|
|
644 |
mark_order_as_delivered(orderId, to_py_date(deliveryTimestamp), receiver)
|
|
|
645 |
finally:
|
|
|
646 |
close_session()
|
|
|
647 |
|
|
|
648 |
|
| 5555 |
rajveer |
649 |
def markOrderAsReceivedAtStore(self, orderId, deliveryTimestamp):
|
|
|
650 |
"""
|
|
|
651 |
Attributes:
|
|
|
652 |
- orderId
|
|
|
653 |
- deliveryTimestamp
|
|
|
654 |
"""
|
|
|
655 |
try:
|
|
|
656 |
mark_order_as_received_at_store(orderId, to_py_date(deliveryTimestamp))
|
|
|
657 |
finally:
|
|
|
658 |
close_session()
|
|
|
659 |
|
|
|
660 |
def getReceivePendingOrders(self, storeId):
|
|
|
661 |
"""
|
|
|
662 |
Attributes:
|
|
|
663 |
- storeId
|
|
|
664 |
"""
|
|
|
665 |
try:
|
|
|
666 |
orders = get_receive_pending_orders(storeId)
|
|
|
667 |
return [to_t_order(order) for order in orders]
|
|
|
668 |
finally:
|
|
|
669 |
close_session()
|
|
|
670 |
|
|
|
671 |
def getReceivedAtStoreOrders(self, storeId):
|
|
|
672 |
"""
|
|
|
673 |
Attributes:
|
|
|
674 |
- storeId
|
|
|
675 |
"""
|
|
|
676 |
try:
|
|
|
677 |
orders = get_received_at_store_orders(storeId)
|
|
|
678 |
return [to_t_order(order) for order in orders]
|
|
|
679 |
finally:
|
|
|
680 |
close_session()
|
| 5713 |
rajveer |
681 |
|
|
|
682 |
def getOrdersCollectionAtStore(self, storeId, fromDate, toDate, onlyCod):
|
|
|
683 |
"""
|
|
|
684 |
Parameters:
|
|
|
685 |
- storeId
|
|
|
686 |
- fromDate
|
|
|
687 |
- toDate
|
|
|
688 |
- onlyCod
|
|
|
689 |
"""
|
|
|
690 |
try:
|
|
|
691 |
orders = get_orders_collection_at_store(storeId, to_py_date(fromDate), to_py_date(toDate), onlyCod)
|
|
|
692 |
return [to_t_order(order) for order in orders]
|
|
|
693 |
finally:
|
|
|
694 |
close_session()
|
|
|
695 |
|
| 4910 |
phani.kuma |
696 |
def markAsRTOrders(self, providerId, returnedOrders):
|
| 1135 |
chandransh |
697 |
"""
|
| 4910 |
phani.kuma |
698 |
Mark all orders with AWBs in the given map as RTO. Also sets the delivery timestamp.
|
| 1135 |
chandransh |
699 |
Raises an exception if we encounter report for an AWB number that we did not ship.
|
|
|
700 |
|
|
|
701 |
Parameters:
|
|
|
702 |
- providerId
|
|
|
703 |
- returnedOrders
|
|
|
704 |
"""
|
|
|
705 |
try:
|
| 4910 |
phani.kuma |
706 |
mark_orders_as_rto(providerId, returnedOrders)
|
| 1135 |
chandransh |
707 |
finally:
|
|
|
708 |
close_session()
|
| 1246 |
chandransh |
709 |
|
| 4910 |
phani.kuma |
710 |
def getRTOrders(self, providerId):
|
|
|
711 |
"""
|
|
|
712 |
Returns a list of orders that were returned by courier.
|
|
|
713 |
|
|
|
714 |
Parameters:
|
|
|
715 |
- providerId
|
|
|
716 |
"""
|
|
|
717 |
try:
|
|
|
718 |
rto_orders = get_rto_orders(providerId)
|
|
|
719 |
return [to_t_order(order) for order in rto_orders]
|
|
|
720 |
finally:
|
|
|
721 |
close_session()
|
|
|
722 |
|
| 1246 |
chandransh |
723 |
def updateNonDeliveryReason(self, providerId, undeliveredOrders):
|
|
|
724 |
"""
|
|
|
725 |
Update the status description of orders whose AWB numbers are keys of the Map.
|
|
|
726 |
|
|
|
727 |
Parameters:
|
|
|
728 |
- providerId
|
|
|
729 |
- undelivered_orders
|
|
|
730 |
"""
|
|
|
731 |
try:
|
| 4910 |
phani.kuma |
732 |
update_non_delivery_reason(providerId, undeliveredOrders)
|
|
|
733 |
finally:
|
|
|
734 |
close_session()
|
|
|
735 |
|
|
|
736 |
def getNonDeliveredOrdersbyCourier(self, providerId):
|
|
|
737 |
"""
|
|
|
738 |
Returns a list of orders that were picked up or shipped four days ago but did not get delivered.
|
|
|
739 |
|
|
|
740 |
Parameters:
|
|
|
741 |
- providerId
|
|
|
742 |
"""
|
|
|
743 |
try:
|
|
|
744 |
orders_not_delivered = get_non_delivered_orders_by_courier(providerId)
|
| 4581 |
phani.kuma |
745 |
return [to_t_order(order) for order in orders_not_delivered]
|
| 1246 |
chandransh |
746 |
finally:
|
|
|
747 |
close_session()
|
| 1405 |
ankur.sing |
748 |
|
| 4910 |
phani.kuma |
749 |
def markOrdersAsLocalConnected(self, providerId, local_connected_orders):
|
|
|
750 |
"""
|
|
|
751 |
Mark all orders with AWBs in the given map as local connected. Also sets the local connected timestamp.
|
|
|
752 |
|
|
|
753 |
Parameters:
|
|
|
754 |
- providerId
|
|
|
755 |
- local_connected_orders
|
|
|
756 |
"""
|
|
|
757 |
try:
|
|
|
758 |
mark_orders_as_local_connected(providerId, local_connected_orders)
|
|
|
759 |
finally:
|
|
|
760 |
close_session()
|
|
|
761 |
|
|
|
762 |
def getOrdersNotLocalConnected(self, providerId):
|
|
|
763 |
"""
|
|
|
764 |
Returns a list of orders that were picked up or shipped but pending local connection.
|
|
|
765 |
|
|
|
766 |
Parameters:
|
|
|
767 |
- providerId
|
|
|
768 |
"""
|
|
|
769 |
try:
|
|
|
770 |
orders_pending_local_connection = get_orders_not_local_connected(providerId)
|
|
|
771 |
return [to_t_order(order) for order in orders_pending_local_connection]
|
|
|
772 |
finally:
|
|
|
773 |
close_session()
|
|
|
774 |
|
|
|
775 |
def markOrdersAsDestinationCityReached(self, providerId, destination_city_reached_orders):
|
|
|
776 |
"""
|
|
|
777 |
Mark all orders with AWBs in the given map as reached destination city. Also sets the reached destination timestamp.
|
|
|
778 |
|
|
|
779 |
Parameters:
|
|
|
780 |
- providerId
|
|
|
781 |
- destination_city_reached_orders
|
|
|
782 |
"""
|
|
|
783 |
try:
|
|
|
784 |
mark_orders_as_destinationCityReached(providerId, destination_city_reached_orders)
|
|
|
785 |
finally:
|
|
|
786 |
close_session()
|
|
|
787 |
|
|
|
788 |
def markOrdersAsFirstDeliveryAttempted(self, providerId, first_atdl_orders):
|
|
|
789 |
"""
|
|
|
790 |
Mark all orders with AWBs in the given map as first delivery attempt made. Also sets the first delivery attempted timestamp.
|
|
|
791 |
|
|
|
792 |
Parameters:
|
|
|
793 |
- providerId
|
|
|
794 |
- first_atdl_orders
|
|
|
795 |
"""
|
|
|
796 |
try:
|
|
|
797 |
mark_orders_as_firstDeliveryAttempted(providerId, first_atdl_orders)
|
|
|
798 |
finally:
|
|
|
799 |
close_session()
|
|
|
800 |
|
| 4783 |
phani.kuma |
801 |
def getUndeliveredOrdersExpectedDeliveryDateNotMet(self):
|
|
|
802 |
"""
|
|
|
803 |
Returns the list of orders whose expected delivery date has passed but have not been
|
|
|
804 |
delivered yet.
|
|
|
805 |
Returns an empty list if no such orders exist.
|
|
|
806 |
"""
|
|
|
807 |
try:
|
|
|
808 |
orders_not_delivered = get_orders_not_met_expected_delivery_date()
|
|
|
809 |
return [to_t_order(order) for order in orders_not_delivered]
|
|
|
810 |
finally:
|
|
|
811 |
close_session()
|
|
|
812 |
|
| 1405 |
ankur.sing |
813 |
def getUndeliveredOrders(self, providerId, warehouseId):
|
|
|
814 |
"""
|
|
|
815 |
Returns the list of orders whose delivery time has passed but have not been
|
|
|
816 |
delivered yet for the given provider and warehouse. To get a complete list of
|
|
|
817 |
undelivered orders, pass them as -1.
|
|
|
818 |
Returns an empty list if no such orders exist.
|
|
|
819 |
|
|
|
820 |
Parameters:
|
|
|
821 |
- providerId
|
|
|
822 |
- warehouseId
|
|
|
823 |
"""
|
|
|
824 |
try:
|
|
|
825 |
undelivered_orders = get_undelivered_orders(providerId, warehouseId)
|
|
|
826 |
return [to_t_order(order) for order in undelivered_orders]
|
|
|
827 |
finally:
|
|
|
828 |
close_session()
|
| 1351 |
varun.gupt |
829 |
|
| 1398 |
varun.gupt |
830 |
def enqueueTransactionInfoEmail(self, transactionId):
|
| 1351 |
varun.gupt |
831 |
"""
|
| 1398 |
varun.gupt |
832 |
Save the email containing order details to be sent to customer later by batch job
|
| 1351 |
varun.gupt |
833 |
|
|
|
834 |
Parameters:
|
|
|
835 |
- transactionId
|
|
|
836 |
"""
|
|
|
837 |
try:
|
| 1398 |
varun.gupt |
838 |
return enqueue_transaction_info_email(transactionId)
|
| 1351 |
varun.gupt |
839 |
finally:
|
|
|
840 |
close_session()
|
|
|
841 |
|
| 4444 |
rajveer |
842 |
def getAlerts(self, type, warehouseId, status, timestamp):
|
| 483 |
rajveer |
843 |
"""
|
|
|
844 |
Parameters:
|
| 4394 |
rajveer |
845 |
- type
|
| 4444 |
rajveer |
846 |
- warehouseId
|
| 4394 |
rajveer |
847 |
- status
|
|
|
848 |
- timestamp
|
| 483 |
rajveer |
849 |
"""
|
| 766 |
rajveer |
850 |
try:
|
| 4444 |
rajveer |
851 |
alerts = get_alerts(type, warehouseId, status, timestamp)
|
| 766 |
rajveer |
852 |
|
|
|
853 |
t_alerts = []
|
|
|
854 |
for alert in alerts:
|
|
|
855 |
t_alerts.append(to_t_alert(alert))
|
|
|
856 |
|
|
|
857 |
return t_alerts
|
|
|
858 |
finally:
|
|
|
859 |
close_session()
|
| 4394 |
rajveer |
860 |
|
| 4447 |
rajveer |
861 |
def addAlert(self, type, warehouseId, description):
|
| 483 |
rajveer |
862 |
"""
|
|
|
863 |
Parameters:
|
|
|
864 |
- type
|
| 4394 |
rajveer |
865 |
- description
|
| 4447 |
rajveer |
866 |
- warehouseId
|
| 483 |
rajveer |
867 |
"""
|
| 766 |
rajveer |
868 |
try:
|
| 4447 |
rajveer |
869 |
add_alert(type, warehouseId, description)
|
| 766 |
rajveer |
870 |
finally:
|
|
|
871 |
close_session()
|
| 1596 |
ankur.sing |
872 |
|
| 4444 |
rajveer |
873 |
def markAlertsAsSeen(self, warehouseId):
|
|
|
874 |
"""
|
|
|
875 |
Parameters:
|
|
|
876 |
- warehouseId
|
|
|
877 |
"""
|
|
|
878 |
try:
|
|
|
879 |
mark_alerts_as_seen(warehouseId)
|
|
|
880 |
finally:
|
|
|
881 |
close_session()
|
|
|
882 |
pass
|
|
|
883 |
|
| 1596 |
ankur.sing |
884 |
def getValidOrderCount(self, ):
|
|
|
885 |
"""
|
|
|
886 |
Return the number of valid orders. (OrderStatus >= OrderStatus.SUBMITTED_FOR_PROCESSING)
|
|
|
887 |
"""
|
| 1731 |
ankur.sing |
888 |
try:
|
|
|
889 |
return get_valid_order_count()
|
|
|
890 |
finally:
|
|
|
891 |
close_session()
|
| 1627 |
ankur.sing |
892 |
|
|
|
893 |
def getNoOfCustomersWithSuccessfulTransaction(self, ):
|
|
|
894 |
"""
|
|
|
895 |
Returns the number of distinct customers who have done successful transactions
|
|
|
896 |
"""
|
| 1731 |
ankur.sing |
897 |
try:
|
|
|
898 |
return get_cust_count_with_successful_txn()
|
|
|
899 |
finally:
|
|
|
900 |
close_session()
|
| 1627 |
ankur.sing |
901 |
|
| 1731 |
ankur.sing |
902 |
|
|
|
903 |
def getValidOrdersAmountRange(self, ):
|
| 1627 |
ankur.sing |
904 |
"""
|
| 1731 |
ankur.sing |
905 |
Returns the minimum and maximum amounts of a valid order. (OrderStatus >= OrderStatus.SUBMITTED_FOR_PROCESSING)
|
|
|
906 |
List contains two values, first minimum amount and second maximum amount.
|
| 1627 |
ankur.sing |
907 |
"""
|
| 1731 |
ankur.sing |
908 |
try:
|
|
|
909 |
return get_valid_orders_amount_range()
|
|
|
910 |
finally:
|
|
|
911 |
close_session()
|
| 1627 |
ankur.sing |
912 |
|
| 5874 |
rajveer |
913 |
def getValidOrders(self, limit, onlyStore):
|
| 1886 |
ankur.sing |
914 |
"""
|
|
|
915 |
Returns list of Orders in descending order by Order creation date. List is restricted to limit Orders.
|
|
|
916 |
If limit is passed as 0, then all valid Orders are returned.
|
|
|
917 |
|
|
|
918 |
Parameters:
|
|
|
919 |
- limit
|
| 5874 |
rajveer |
920 |
- onlyStore
|
| 1886 |
ankur.sing |
921 |
"""
|
|
|
922 |
try:
|
| 5874 |
rajveer |
923 |
return [to_t_order(order) for order in get_valid_orders(limit, onlyStore)]
|
| 1886 |
ankur.sing |
924 |
finally:
|
|
|
925 |
close_session()
|
| 104 |
ashish |
926 |
|
| 2536 |
chandransh |
927 |
def toggleDOAFlag(self, orderId):
|
| 104 |
ashish |
928 |
"""
|
| 2536 |
chandransh |
929 |
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.
|
|
|
930 |
Returns the final flag status.
|
|
|
931 |
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 |
932 |
|
| 132 |
ashish |
933 |
Parameters:
|
| 2536 |
chandransh |
934 |
- orderId
|
| 132 |
ashish |
935 |
"""
|
| 2536 |
chandransh |
936 |
try:
|
|
|
937 |
return toggle_doa_flag(orderId)
|
|
|
938 |
finally:
|
|
|
939 |
close_session()
|
| 483 |
rajveer |
940 |
|
| 4454 |
rajveer |
941 |
def markOrderDoaRequestReceived(self, orderId):
|
|
|
942 |
"""
|
|
|
943 |
Once user raise the request for a DOA, order status will be changed from DELVIERY_SUCCESS to DOA_REQUEST_RECEIVED
|
|
|
944 |
|
|
|
945 |
Parameters:
|
|
|
946 |
- orderId
|
|
|
947 |
"""
|
|
|
948 |
try:
|
|
|
949 |
return mark_order_doa_request_received(orderId)
|
|
|
950 |
finally:
|
|
|
951 |
close_session()
|
|
|
952 |
|
| 7645 |
anupam.sin |
953 |
def markOrderDoaRequestAuthorized(self, orderId, isAuthorized, fromStore, isReship):
|
| 4454 |
rajveer |
954 |
"""
|
|
|
955 |
CRM person can authorize or deny the request reised by customer. If he authorizes order will change from DOA_REQUEST_RECEIVED
|
|
|
956 |
to DOA_REQUEST_AUTHORIZED. If he denies, status will be changed back to DELVIERY_SUCCESS.
|
|
|
957 |
|
|
|
958 |
Parameters:
|
|
|
959 |
- orderId
|
|
|
960 |
- isAuthorized
|
|
|
961 |
"""
|
|
|
962 |
try:
|
| 7645 |
anupam.sin |
963 |
return mark_order_doa_request_authorized(orderId, isAuthorized, fromStore, isReship)
|
| 4454 |
rajveer |
964 |
finally:
|
|
|
965 |
close_session()
|
|
|
966 |
|
| 4488 |
rajveer |
967 |
def markOrderReturnRequestReceived(self, orderId):
|
|
|
968 |
"""
|
|
|
969 |
Once user raise the request for a DOA, order status will be changed from DELVIERY_SUCCESS to RET_REQUEST_RECEIVED
|
|
|
970 |
|
|
|
971 |
Parameters:
|
|
|
972 |
- orderId
|
|
|
973 |
"""
|
|
|
974 |
try:
|
|
|
975 |
return mark_order_return_request_received(orderId)
|
|
|
976 |
finally:
|
|
|
977 |
close_session()
|
|
|
978 |
|
| 7645 |
anupam.sin |
979 |
def markOrderReturnRequestAuthorized(self, orderId, isAuthorized, fromStore, isReship):
|
| 4488 |
rajveer |
980 |
"""
|
|
|
981 |
CRM person can authorize or deny the request reised by customer. If he authorizes order will change from RET_REQUEST_RECEIVED
|
|
|
982 |
to RET_REQUEST_AUTHORIZED. If he denies, status will be changed back to DELVIERY_SUCCESS.
|
|
|
983 |
|
|
|
984 |
Parameters:
|
|
|
985 |
- orderId
|
|
|
986 |
- isAuthorized
|
|
|
987 |
"""
|
|
|
988 |
try:
|
| 7645 |
anupam.sin |
989 |
return mark_order_return_request_authorized(orderId, isAuthorized, fromStore, isReship)
|
| 4488 |
rajveer |
990 |
finally:
|
|
|
991 |
close_session()
|
|
|
992 |
|
| 4579 |
rajveer |
993 |
def requestPickupNumber(self, orderId, providerId):
|
| 104 |
ashish |
994 |
"""
|
| 2536 |
chandransh |
995 |
Sends out an email to the account manager of the original courier provider used to ship the order.
|
| 4452 |
rajveer |
996 |
If the order status was DELIVERY_SUCCESS, it is changed to be DOA_PICKUP_REQUEST_RAISED.
|
|
|
997 |
If the order status was DOA_PICKUP_REQUEST_RAISED, it is left unchanged.
|
| 2536 |
chandransh |
998 |
For any other status, it returns false.
|
|
|
999 |
Throws an exception if the order with the given id couldn't be found.
|
| 104 |
ashish |
1000 |
|
|
|
1001 |
Parameters:
|
| 2536 |
chandransh |
1002 |
- orderId
|
| 104 |
ashish |
1003 |
"""
|
| 2536 |
chandransh |
1004 |
try:
|
| 4579 |
rajveer |
1005 |
return request_pickup_number(orderId, providerId)
|
| 2536 |
chandransh |
1006 |
finally:
|
|
|
1007 |
close_session()
|
| 483 |
rajveer |
1008 |
|
| 4602 |
rajveer |
1009 |
def authorizePickup(self, orderId, pickupNumber, providerId):
|
| 304 |
ashish |
1010 |
"""
|
| 4452 |
rajveer |
1011 |
If the order status is DOA_PICKUP_REQUEST_RAISED, it does the following
|
| 2536 |
chandransh |
1012 |
1. Sends out an email to the customer with the dispatch advice that he has to print as an attachment.
|
|
|
1013 |
2. Changes order status to be DOA_PICKUP_AUTHORIZED.
|
|
|
1014 |
3. Returns true
|
|
|
1015 |
If the order is any other status, it returns false.
|
|
|
1016 |
Throws an exception if the order with the given id couldn't be found.
|
| 304 |
ashish |
1017 |
|
|
|
1018 |
Parameters:
|
| 2536 |
chandransh |
1019 |
- orderId
|
|
|
1020 |
- pickupNumber
|
| 304 |
ashish |
1021 |
"""
|
| 2536 |
chandransh |
1022 |
try:
|
| 4602 |
rajveer |
1023 |
return authorize_pickup(orderId, pickupNumber, providerId)
|
| 2536 |
chandransh |
1024 |
finally:
|
|
|
1025 |
close_session()
|
| 2764 |
chandransh |
1026 |
|
|
|
1027 |
def markDoasAsPickedUp(self, providerId, pickupDetails):
|
|
|
1028 |
"""
|
|
|
1029 |
Marks all DOA_PICKUP_AUTHORIZED orders of the previous day for a provider as DOA_RETURN_IN_TRANSIT.
|
|
|
1030 |
|
|
|
1031 |
Parameters:
|
|
|
1032 |
- providerId
|
|
|
1033 |
- pickupDetails
|
|
|
1034 |
"""
|
|
|
1035 |
try:
|
| 4910 |
phani.kuma |
1036 |
mark_doas_as_picked_up(providerId, pickupDetails)
|
|
|
1037 |
finally:
|
|
|
1038 |
close_session()
|
|
|
1039 |
|
|
|
1040 |
def getDoasNotPickedUp(self, providerId):
|
|
|
1041 |
"""
|
|
|
1042 |
Returns a list of orders that were authorized for pickup but did not appear in the pick-up report.
|
|
|
1043 |
|
|
|
1044 |
Parameters:
|
|
|
1045 |
- providerId
|
|
|
1046 |
"""
|
|
|
1047 |
try:
|
|
|
1048 |
orders_not_picked_up = get_doas_not_picked_up(providerId)
|
| 2764 |
chandransh |
1049 |
return [to_t_order(order) for order in orders_not_picked_up]
|
|
|
1050 |
finally:
|
|
|
1051 |
close_session()
|
| 4910 |
phani.kuma |
1052 |
|
| 4741 |
phani.kuma |
1053 |
def markReturnOrdersAsPickedUp(self, providerId, pickupDetails):
|
|
|
1054 |
"""
|
|
|
1055 |
Marks all RET_PICKUP_CONFIRMED orders of the previous day for a provider as RET_RETURN_IN_TRANSIT.
|
|
|
1056 |
|
|
|
1057 |
Parameters:
|
|
|
1058 |
- providerId
|
|
|
1059 |
- pickupDetails
|
|
|
1060 |
"""
|
|
|
1061 |
try:
|
| 4910 |
phani.kuma |
1062 |
mark_return_orders_as_picked_up(providerId, pickupDetails)
|
|
|
1063 |
finally:
|
|
|
1064 |
close_session()
|
|
|
1065 |
|
|
|
1066 |
def getReturnOrdersNotPickedUp(self, providerId):
|
|
|
1067 |
"""
|
|
|
1068 |
Returns a list of orders that were authorized for pickup but did not appear in the pick-up report.
|
|
|
1069 |
|
|
|
1070 |
Parameters:
|
|
|
1071 |
- providerId
|
|
|
1072 |
"""
|
|
|
1073 |
try:
|
|
|
1074 |
orders_not_picked_up = get_return_orders_not_picked_up(providerId)
|
| 4741 |
phani.kuma |
1075 |
return [to_t_order(order) for order in orders_not_picked_up]
|
|
|
1076 |
finally:
|
|
|
1077 |
close_session()
|
| 4910 |
phani.kuma |
1078 |
|
| 13276 |
manish.sha |
1079 |
def receiveReturn(self, orderId, receiveCondition, receiveFreebie, serialNumbers):
|
| 2591 |
chandransh |
1080 |
"""
|
| 4452 |
rajveer |
1081 |
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 |
1082 |
If the order is in any other state, it returns false.
|
|
|
1083 |
Throws an exception if the order with the given id couldn't be found.
|
|
|
1084 |
|
|
|
1085 |
Parameters:
|
|
|
1086 |
- orderId
|
|
|
1087 |
"""
|
|
|
1088 |
try:
|
| 13276 |
manish.sha |
1089 |
return receive_return(orderId, receiveCondition, receiveFreebie, serialNumbers)
|
| 2591 |
chandransh |
1090 |
finally:
|
|
|
1091 |
close_session()
|
|
|
1092 |
|
|
|
1093 |
def validateDoa(self, orderId, isValid):
|
|
|
1094 |
"""
|
| 4452 |
rajveer |
1095 |
Used to validate the DOA certificate for an order in the DOA_RECEIVED_PRESTINE state. If the certificate is valid,
|
| 2609 |
chandransh |
1096 |
the order state is changed to DOA_CERT_PENDING.
|
| 2591 |
chandransh |
1097 |
If the certificate is invalid, the order state is changed to DOA_CERT_INVALID.
|
|
|
1098 |
If the order is in any other state, it returns false.
|
|
|
1099 |
Throws an exception if the order with the given id couldn't be found.
|
|
|
1100 |
|
|
|
1101 |
Parameters:
|
|
|
1102 |
- orderId
|
|
|
1103 |
- isValid
|
|
|
1104 |
"""
|
|
|
1105 |
try:
|
|
|
1106 |
return validate_doa(orderId, isValid)
|
|
|
1107 |
finally:
|
|
|
1108 |
close_session()
|
| 2628 |
chandransh |
1109 |
|
| 4495 |
rajveer |
1110 |
def validateReturnProduct(self, orderId, isUsable):
|
|
|
1111 |
"""
|
|
|
1112 |
Parameters:
|
|
|
1113 |
- orderId
|
|
|
1114 |
- isUsable
|
|
|
1115 |
"""
|
|
|
1116 |
try:
|
|
|
1117 |
return validate_return_product(orderId, isUsable)
|
|
|
1118 |
finally:
|
|
|
1119 |
close_session()
|
|
|
1120 |
|
| 2628 |
chandransh |
1121 |
def reshipOrder(self, orderId):
|
|
|
1122 |
"""
|
| 4484 |
rajveer |
1123 |
If the order is in RTO_RECEIVED_PRESTINE or DOA_CERT_INVALID state, it does the following:
|
| 2628 |
chandransh |
1124 |
1. Creates a new order for processing in the BILLED state. All billing information is saved.
|
| 4484 |
rajveer |
1125 |
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 |
1126 |
|
|
|
1127 |
If the order is in DOA_CERT_VALID state, it does the following:
|
|
|
1128 |
1. Creates a new order for processing in the SUBMITTED_FOR_PROCESSING state.
|
|
|
1129 |
2. Creates a return order for the warehouse executive to return the DOA material.
|
| 4452 |
rajveer |
1130 |
3. Marks the current order as the final DOA_VALID_RESHIPPED state.
|
| 2628 |
chandransh |
1131 |
|
|
|
1132 |
Returns the id of the newly created order.
|
|
|
1133 |
|
|
|
1134 |
Throws an exception if the order with the given id couldn't be found.
|
|
|
1135 |
|
|
|
1136 |
Parameters:
|
|
|
1137 |
- orderId
|
|
|
1138 |
"""
|
|
|
1139 |
try:
|
|
|
1140 |
return reship_order(orderId)
|
|
|
1141 |
finally:
|
|
|
1142 |
close_session()
|
|
|
1143 |
|
| 3226 |
chandransh |
1144 |
def refundOrder(self, orderId, refundedBy, reason):
|
| 2628 |
chandransh |
1145 |
"""
|
| 4484 |
rajveer |
1146 |
If the order is in RTO_RECEIVED_PRESTINE, DOA_CERT_VALID or DOA_CERT_INVALID state, it does the following:
|
| 2628 |
chandransh |
1147 |
1. Creates a refund request for batch processing.
|
|
|
1148 |
2. Creates a return order for the warehouse executive to return the shipped material.
|
| 4484 |
rajveer |
1149 |
3. Marks the current order as RTO_REFUNDED, DOA_VALID_REFUNDED or DOA_INVALID_REFUNDED final states.
|
| 2628 |
chandransh |
1150 |
|
|
|
1151 |
If the order is in SUBMITTED_FOR_PROCESSING or INVENTORY_LOW state, it does the following:
|
|
|
1152 |
1. Creates a refund request for batch processing.
|
| 3226 |
chandransh |
1153 |
2. Cancels the reservation of the item in the warehouse.
|
|
|
1154 |
3. Marks the current order as the REFUNDED final state.
|
| 2628 |
chandransh |
1155 |
|
| 3226 |
chandransh |
1156 |
For all COD orders, if the order is in INIT, SUBMITTED_FOR_PROCESSING or INVENTORY_LOW state, it does the following:
|
|
|
1157 |
1. Cancels the reservation of the item in the warehouse.
|
|
|
1158 |
2. Marks the current order as CANCELED.
|
|
|
1159 |
|
|
|
1160 |
In all cases, it updates the reason for cancellation or refund and the person who performed the action.
|
|
|
1161 |
|
| 2628 |
chandransh |
1162 |
Returns True if it is successful, False otherwise.
|
|
|
1163 |
|
|
|
1164 |
Throws an exception if the order with the given id couldn't be found.
|
|
|
1165 |
|
|
|
1166 |
Parameters:
|
|
|
1167 |
- orderId
|
| 3226 |
chandransh |
1168 |
- refundedBy
|
|
|
1169 |
- reason
|
| 2628 |
chandransh |
1170 |
"""
|
|
|
1171 |
try:
|
| 3226 |
chandransh |
1172 |
return refund_order(orderId, refundedBy, reason)
|
| 2628 |
chandransh |
1173 |
finally:
|
|
|
1174 |
close_session()
|
|
|
1175 |
|
| 2697 |
chandransh |
1176 |
def getReturnOrders(self, warehouseId, fromDate, toDate):
|
|
|
1177 |
"""
|
|
|
1178 |
Get all return orders created between the from and to dates for the given warehouse.
|
|
|
1179 |
Ignores the warehouse if it is passed as -1.
|
|
|
1180 |
|
|
|
1181 |
Parameters:
|
|
|
1182 |
- warehouseId
|
|
|
1183 |
- fromDate
|
|
|
1184 |
- toDate
|
|
|
1185 |
"""
|
|
|
1186 |
try:
|
|
|
1187 |
from_date, to_date = get_fdate_tdate(fromDate, toDate)
|
|
|
1188 |
return get_return_orders(warehouseId, from_date, to_date)
|
|
|
1189 |
finally:
|
|
|
1190 |
close_session()
|
|
|
1191 |
|
| 5481 |
phani.kuma |
1192 |
def getAllReturnOrders(self, onlyNotProcessed, fromDate, toDate):
|
|
|
1193 |
"""
|
|
|
1194 |
Get all return orders created between the from and to dates for the given warehouse.
|
|
|
1195 |
Ignores the warehouse if it is passed as -1.
|
|
|
1196 |
|
|
|
1197 |
Parameters:
|
|
|
1198 |
- warehouseId
|
|
|
1199 |
- fromDate
|
|
|
1200 |
- toDate
|
|
|
1201 |
"""
|
|
|
1202 |
try:
|
|
|
1203 |
from_date, to_date = get_fdate_tdate(fromDate, toDate)
|
|
|
1204 |
return get_all_return_orders(onlyNotProcessed, from_date, to_date)
|
|
|
1205 |
finally:
|
|
|
1206 |
close_session()
|
|
|
1207 |
|
| 2700 |
chandransh |
1208 |
def getReturnOrder(self, id):
|
|
|
1209 |
"""
|
|
|
1210 |
Returns the ReturnOrder corresponding to the given id.
|
|
|
1211 |
Throws an exception if the return order with the given id couldn't be found.
|
|
|
1212 |
|
|
|
1213 |
Parameters:
|
|
|
1214 |
- id
|
|
|
1215 |
"""
|
|
|
1216 |
try:
|
|
|
1217 |
return get_return_order(id)
|
|
|
1218 |
finally:
|
|
|
1219 |
close_session()
|
|
|
1220 |
|
| 2697 |
chandransh |
1221 |
def processReturn(self, returnOrderId):
|
|
|
1222 |
"""
|
|
|
1223 |
Marks the return order with the given id as processed. Raises an exception if no such return order exists.
|
|
|
1224 |
|
|
|
1225 |
Parameters:
|
|
|
1226 |
- returnOrderId
|
|
|
1227 |
"""
|
|
|
1228 |
try:
|
|
|
1229 |
process_return(returnOrderId)
|
|
|
1230 |
finally:
|
|
|
1231 |
close_session()
|
| 4757 |
mandeep.dh |
1232 |
|
|
|
1233 |
def updateOrdersAsPORaised(self, itemIdQuantityMap, purchaseOrderId, warehouseId):
|
| 2819 |
chandransh |
1234 |
"""
|
| 4757 |
mandeep.dh |
1235 |
Updates orders as PO raised. Also updates purchase order id in orders. Pass a map of items mapped to
|
|
|
1236 |
the quantities for which the PO is raised.
|
|
|
1237 |
|
| 2819 |
chandransh |
1238 |
Parameters:
|
| 4757 |
mandeep.dh |
1239 |
- itemIdQuantityMap
|
|
|
1240 |
- purchaseOrderId
|
| 2819 |
chandransh |
1241 |
- warehouseId
|
|
|
1242 |
"""
|
|
|
1243 |
try:
|
| 4757 |
mandeep.dh |
1244 |
update_orders_as_PORaised(itemIdQuantityMap, purchaseOrderId, warehouseId)
|
| 2819 |
chandransh |
1245 |
finally:
|
|
|
1246 |
close_session()
|
| 4757 |
mandeep.dh |
1247 |
|
| 3451 |
chandransh |
1248 |
def updateWeight(self, orderId, weight):
|
|
|
1249 |
"""
|
|
|
1250 |
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.
|
|
|
1251 |
|
|
|
1252 |
Parameters:
|
|
|
1253 |
- orderId
|
|
|
1254 |
- weight
|
|
|
1255 |
"""
|
|
|
1256 |
try:
|
|
|
1257 |
order = update_weight(orderId, weight)
|
|
|
1258 |
return to_t_order(order)
|
|
|
1259 |
finally:
|
|
|
1260 |
close_session()
|
|
|
1261 |
|
| 3469 |
chandransh |
1262 |
def changeItem(self, orderId, itemId):
|
|
|
1263 |
"""
|
|
|
1264 |
Change the item to be shipped for this order. Also adjusts the reservation in the inventory accordingly.
|
|
|
1265 |
Currently, it also ensures that only a different color of the given item is shipped.
|
|
|
1266 |
|
|
|
1267 |
Parameters:
|
|
|
1268 |
- orderId
|
|
|
1269 |
- itemId
|
|
|
1270 |
"""
|
|
|
1271 |
try:
|
|
|
1272 |
order = change_product(orderId, itemId)
|
|
|
1273 |
return to_t_order(order)
|
|
|
1274 |
finally:
|
|
|
1275 |
close_session()
|
| 7560 |
rajveer |
1276 |
|
|
|
1277 |
def changeCourierProvider(self, orderId, providerId):
|
|
|
1278 |
try:
|
|
|
1279 |
order = change_courier_provider(orderId, providerId)
|
|
|
1280 |
return to_t_order(order)
|
|
|
1281 |
finally:
|
|
|
1282 |
close_session()
|
|
|
1283 |
|
| 3469 |
chandransh |
1284 |
|
|
|
1285 |
def shiftToWarehouse(self, orderId, warehouseId):
|
|
|
1286 |
"""
|
|
|
1287 |
Moves the given order to the given warehouse. Also adjusts the inventory reservations accordingly.
|
|
|
1288 |
|
|
|
1289 |
Parameters:
|
|
|
1290 |
- orderId
|
|
|
1291 |
- warehouseId
|
|
|
1292 |
"""
|
|
|
1293 |
try:
|
|
|
1294 |
order = change_warehouse(orderId, warehouseId)
|
|
|
1295 |
return to_t_order(order)
|
|
|
1296 |
finally:
|
|
|
1297 |
close_session()
|
| 3553 |
chandransh |
1298 |
|
| 4647 |
rajveer |
1299 |
def addDelayReason(self, orderId, delayReason, furtherDelay, delayReasonText):
|
| 3553 |
chandransh |
1300 |
"""
|
|
|
1301 |
Adds the given delay reason to the given order.
|
| 3986 |
chandransh |
1302 |
Increases the expected delivery time of the given order by the given no. of days.
|
| 3553 |
chandransh |
1303 |
Raises an exception if no order with the given id can be found.
|
| 3469 |
chandransh |
1304 |
|
| 3553 |
chandransh |
1305 |
Parameters:
|
|
|
1306 |
- orderId
|
|
|
1307 |
- delayReason
|
|
|
1308 |
"""
|
|
|
1309 |
try:
|
| 4647 |
rajveer |
1310 |
return add_delay_reason(orderId, delayReason, furtherDelay, delayReasonText)
|
| 3553 |
chandransh |
1311 |
finally:
|
|
|
1312 |
close_session()
|
|
|
1313 |
|
| 3956 |
chandransh |
1314 |
def reconcileCodCollection(self, collectedAmountMap, xferBy, xferTxnId, xferDate):
|
|
|
1315 |
"""
|
|
|
1316 |
Marks the COD orders with given AWB nos. as having been processed.
|
|
|
1317 |
Updates the captured amount for the corresponding payment.
|
|
|
1318 |
|
|
|
1319 |
Returns a map of AWBs which were not processed and the associated reason. An AWB is not processed if:
|
|
|
1320 |
1. There is no order corresponding to an AWB number.
|
|
|
1321 |
2. The captured amount for a payment exceeds the total payment.
|
|
|
1322 |
3. The order corresponding to an AWB no. is in a state prior to DELIVERY_SUCCESS.
|
|
|
1323 |
|
|
|
1324 |
Parameters:
|
|
|
1325 |
- collectedAmountMap
|
|
|
1326 |
- xferBy
|
|
|
1327 |
- xferTxnId
|
|
|
1328 |
- xferDate
|
|
|
1329 |
"""
|
|
|
1330 |
try:
|
|
|
1331 |
return reconcile_cod_collection(collectedAmountMap, xferBy, xferTxnId, xferDate)
|
|
|
1332 |
finally:
|
|
|
1333 |
close_session()
|
| 4008 |
mandeep.dh |
1334 |
|
|
|
1335 |
def getTransactionsRequiringExtraProcessing(self, category):
|
|
|
1336 |
"""
|
|
|
1337 |
Returns the list of transactions that require some extra processing and
|
|
|
1338 |
which belong to a particular category. This is currently used by CRM
|
|
|
1339 |
application.
|
|
|
1340 |
"""
|
|
|
1341 |
try:
|
|
|
1342 |
return get_transactions_requiring_extra_processing(category)
|
|
|
1343 |
finally:
|
|
|
1344 |
close_session()
|
|
|
1345 |
|
|
|
1346 |
def markTransactionAsProcessed(self, transactionId, category):
|
|
|
1347 |
"""
|
|
|
1348 |
Marks a particular transaction as processed for a particular category.
|
|
|
1349 |
It essentially deletes the transaction if it is processed for a particular
|
|
|
1350 |
category. This is currently used by CRM application.
|
|
|
1351 |
"""
|
|
|
1352 |
try:
|
|
|
1353 |
return mark_transaction_as_processed(transactionId, category)
|
|
|
1354 |
finally:
|
|
|
1355 |
close_session()
|
| 4018 |
chandransh |
1356 |
|
|
|
1357 |
def getItemWiseRiskyOrdersCount(self, ):
|
|
|
1358 |
"""
|
|
|
1359 |
Returns a map containing the number of risky orders keyed by item id. A risky order
|
|
|
1360 |
is defined as one whose shipping date is about to expire.
|
|
|
1361 |
"""
|
|
|
1362 |
try:
|
|
|
1363 |
return get_item_wise_risky_orders_count()
|
|
|
1364 |
finally:
|
|
|
1365 |
close_session()
|
| 3956 |
chandransh |
1366 |
|
| 4247 |
rajveer |
1367 |
def markOrderCancellationRequestReceived(self, orderId):
|
|
|
1368 |
"""
|
|
|
1369 |
Mark order as cancellation request received. If customer sends request of cancellation of
|
|
|
1370 |
a particular order, this method will be called. It will just change status of the order
|
|
|
1371 |
depending on its current status. It also records the previous status, so that we can move
|
|
|
1372 |
back to that status if cancellation request is denied.
|
|
|
1373 |
|
|
|
1374 |
Parameters:
|
|
|
1375 |
- orderId
|
|
|
1376 |
"""
|
|
|
1377 |
try:
|
|
|
1378 |
return mark_order_cancellation_request_received(orderId)
|
|
|
1379 |
finally:
|
|
|
1380 |
close_session()
|
|
|
1381 |
|
|
|
1382 |
|
| 4662 |
rajveer |
1383 |
def markOrderAsLostInTransit(self, orderId):
|
|
|
1384 |
"""
|
|
|
1385 |
Parameters:
|
|
|
1386 |
- orderId
|
|
|
1387 |
"""
|
|
|
1388 |
try:
|
|
|
1389 |
return mark_order_as_lost_in_transit(orderId)
|
|
|
1390 |
finally:
|
|
|
1391 |
close_session()
|
|
|
1392 |
|
| 4258 |
rajveer |
1393 |
def markTransactionAsPaymentFlagRemoved(self, transactionId):
|
| 4247 |
rajveer |
1394 |
"""
|
| 4258 |
rajveer |
1395 |
If we and/or payment gateway has decided to accept the payment, this method needs to be called.
|
|
|
1396 |
Changed transaction and all orders status to payment accepted.
|
| 4247 |
rajveer |
1397 |
|
|
|
1398 |
Parameters:
|
| 4258 |
rajveer |
1399 |
- transactionId
|
| 4247 |
rajveer |
1400 |
"""
|
|
|
1401 |
try:
|
| 4259 |
anupam.sin |
1402 |
return mark_transaction_as_payment_flag_removed(transactionId)
|
| 4247 |
rajveer |
1403 |
finally:
|
|
|
1404 |
close_session()
|
| 4259 |
anupam.sin |
1405 |
|
|
|
1406 |
def refundTransaction(self, transactionId, refundedBy, reason):
|
|
|
1407 |
"""
|
|
|
1408 |
This method is called when a flagged payment is deemed unserviceable and the corresponding orders
|
|
|
1409 |
need to be cancelled
|
|
|
1410 |
|
|
|
1411 |
Parameters:
|
|
|
1412 |
- transactionId
|
|
|
1413 |
"""
|
|
|
1414 |
try:
|
|
|
1415 |
return refund_transaction(transactionId, refundedBy, reason)
|
|
|
1416 |
finally:
|
|
|
1417 |
close_session()
|
| 4247 |
rajveer |
1418 |
|
|
|
1419 |
def markOrderCancellationRequestDenied(self, orderId):
|
|
|
1420 |
"""
|
|
|
1421 |
If we decide to not to cancel order, we will move the order ro previous status.
|
|
|
1422 |
|
|
|
1423 |
Parameters:
|
|
|
1424 |
- orderId
|
|
|
1425 |
"""
|
|
|
1426 |
try:
|
|
|
1427 |
return mark_order_cancellation_request_denied(orderId)
|
|
|
1428 |
finally:
|
|
|
1429 |
close_session()
|
|
|
1430 |
|
|
|
1431 |
def markOrderCancellationRequestConfirmed(self, orderId):
|
|
|
1432 |
"""
|
|
|
1433 |
If we decide to to cancel order, CRM will call this method to move the status of order to
|
|
|
1434 |
cancellation request confirmed. After this OM will be able to cancel the order.
|
|
|
1435 |
|
|
|
1436 |
Parameters:
|
|
|
1437 |
- orderId
|
|
|
1438 |
"""
|
|
|
1439 |
try:
|
|
|
1440 |
return mark_order_cancellation_request_confirmed(orderId)
|
|
|
1441 |
finally:
|
|
|
1442 |
close_session()
|
|
|
1443 |
|
| 4324 |
mandeep.dh |
1444 |
def updateShipmentAddress(self, orderId, addressId):
|
|
|
1445 |
"""
|
|
|
1446 |
Updates shipment address of an order. Delivery and shipping date estimates
|
|
|
1447 |
etc. are also updated here.
|
|
|
1448 |
|
|
|
1449 |
Throws TransactionServiceException in case address change is not
|
|
|
1450 |
possible due to certain reasons such as new pincode in address is
|
|
|
1451 |
not serviceable etc.
|
|
|
1452 |
|
|
|
1453 |
Parameters:
|
|
|
1454 |
- orderId
|
|
|
1455 |
- addressId
|
|
|
1456 |
"""
|
|
|
1457 |
try:
|
|
|
1458 |
update_shipment_address(orderId, addressId)
|
|
|
1459 |
finally:
|
|
|
1460 |
close_session()
|
|
|
1461 |
|
| 4285 |
rajveer |
1462 |
def acceptOrdersForItemId(self, itemId, inventory):
|
|
|
1463 |
"""
|
|
|
1464 |
Marks the orders as ACCEPTED for the given itemId and inventory. It also updates the accepted timestamp. If the
|
|
|
1465 |
given order is not a COD order, it also captures the payment if the same has not been captured.
|
|
|
1466 |
|
|
|
1467 |
Parameters:
|
|
|
1468 |
- itemId
|
|
|
1469 |
- inventory
|
|
|
1470 |
"""
|
|
|
1471 |
try:
|
|
|
1472 |
return accept_orders_for_item_id(itemId, inventory)
|
|
|
1473 |
finally:
|
|
|
1474 |
close_session()
|
|
|
1475 |
|
| 4303 |
rajveer |
1476 |
|
|
|
1477 |
|
| 4369 |
rajveer |
1478 |
def markOrdersAsPORaised(self, vendorId, itemId, quantity, estimate, isReminder):
|
| 4303 |
rajveer |
1479 |
"""
|
|
|
1480 |
Parameters:
|
|
|
1481 |
- vendorId
|
|
|
1482 |
- itemId
|
|
|
1483 |
- quantity
|
|
|
1484 |
- estimate
|
| 4369 |
rajveer |
1485 |
- isReminder
|
| 4303 |
rajveer |
1486 |
"""
|
|
|
1487 |
try:
|
| 4369 |
rajveer |
1488 |
return mark_orders_as_po_raised(vendorId, itemId, quantity, estimate, isReminder)
|
| 4303 |
rajveer |
1489 |
finally:
|
|
|
1490 |
close_session()
|
|
|
1491 |
|
| 4369 |
rajveer |
1492 |
def markOrdersAsReversalInitiated(self, vendorId, itemId, quantity, estimate, isReminder):
|
| 4303 |
rajveer |
1493 |
"""
|
|
|
1494 |
Parameters:
|
|
|
1495 |
- vendorId
|
|
|
1496 |
- itemId
|
|
|
1497 |
- quantity
|
|
|
1498 |
- estimate
|
| 4369 |
rajveer |
1499 |
- isReminder
|
| 4303 |
rajveer |
1500 |
"""
|
|
|
1501 |
try:
|
| 4369 |
rajveer |
1502 |
return mark_orders_as_reversal_initiated(vendorId, itemId, quantity, estimate, isReminder)
|
| 4303 |
rajveer |
1503 |
finally:
|
|
|
1504 |
close_session()
|
|
|
1505 |
|
| 4369 |
rajveer |
1506 |
def markOrdersAsNotAvailabke(self, vendorId, itemId, quantity, estimate, isReminder):
|
| 4303 |
rajveer |
1507 |
"""
|
|
|
1508 |
Parameters:
|
|
|
1509 |
- vendorId
|
|
|
1510 |
- itemId
|
|
|
1511 |
- quantity
|
|
|
1512 |
- estimate
|
| 4369 |
rajveer |
1513 |
- isReminder
|
| 4303 |
rajveer |
1514 |
"""
|
|
|
1515 |
try:
|
| 4369 |
rajveer |
1516 |
return mark_orders_as_not_available(vendorId, itemId, quantity, estimate, isReminder)
|
| 4303 |
rajveer |
1517 |
finally:
|
|
|
1518 |
close_session()
|
|
|
1519 |
|
|
|
1520 |
|
| 4369 |
rajveer |
1521 |
def markOrdersAsTimeout(self, vendorId):
|
|
|
1522 |
"""
|
|
|
1523 |
Parameters:
|
|
|
1524 |
- vendorId
|
|
|
1525 |
"""
|
|
|
1526 |
try:
|
|
|
1527 |
return mark_orders_as_timeout(vendorId)
|
|
|
1528 |
finally:
|
|
|
1529 |
close_session()
|
| 4386 |
anupam.sin |
1530 |
|
|
|
1531 |
def getOrderForAwb(self, awb):
|
|
|
1532 |
"""
|
|
|
1533 |
Parameters:
|
|
|
1534 |
- AirwayBill Number
|
|
|
1535 |
"""
|
| 13276 |
manish.sha |
1536 |
ret_Orders =[]
|
|
|
1537 |
|
| 4386 |
anupam.sin |
1538 |
try:
|
| 13276 |
manish.sha |
1539 |
orderList = get_order_for_awb(awb)
|
|
|
1540 |
for order in orderList:
|
|
|
1541 |
ret_Orders.append(to_t_order(order))
|
|
|
1542 |
return ret_Orders
|
| 4386 |
anupam.sin |
1543 |
finally:
|
|
|
1544 |
close_session()
|
| 4369 |
rajveer |
1545 |
|
| 4910 |
phani.kuma |
1546 |
def getOrdersForProviderForStatus(self, provider_id, order_status_list):
|
| 4506 |
phani.kuma |
1547 |
"""
|
|
|
1548 |
Parameters:
|
|
|
1549 |
- provider id
|
|
|
1550 |
- order status
|
|
|
1551 |
"""
|
|
|
1552 |
try:
|
| 4910 |
phani.kuma |
1553 |
orders_of_provider_by_status = get_orders_for_provider_for_status(provider_id, order_status_list)
|
| 4506 |
phani.kuma |
1554 |
return [to_t_order(order) for order in orders_of_provider_by_status if order != None]
|
|
|
1555 |
finally:
|
|
|
1556 |
close_session()
|
| 4600 |
varun.gupt |
1557 |
|
|
|
1558 |
def getBilledOrdersForVendor(self, vendorId, billingDateFrom, billingDateTo):
|
|
|
1559 |
'''
|
|
|
1560 |
Parameters:
|
|
|
1561 |
- vendorId
|
|
|
1562 |
- billingDateFrom
|
|
|
1563 |
- billingDateTo
|
|
|
1564 |
'''
|
|
|
1565 |
try:
|
|
|
1566 |
return [to_t_order(order) for order in get_billed_orders_for_vendor(vendorId, to_py_date(billingDateFrom), to_py_date(billingDateTo))]
|
|
|
1567 |
finally:
|
|
|
1568 |
close_session()
|
|
|
1569 |
|
| 4607 |
rajveer |
1570 |
def getSlippedSippingDateOrders(self):
|
|
|
1571 |
try:
|
|
|
1572 |
return [to_t_order(order) for order in get_slipped_sipping_date_orders()]
|
|
|
1573 |
finally:
|
|
|
1574 |
close_session()
|
|
|
1575 |
|
| 4709 |
rajveer |
1576 |
def getCancelledOrders(self, cancelDateFrom, cancelDateTo):
|
|
|
1577 |
try:
|
|
|
1578 |
return [to_t_order(order) for order in get_cancelled_orders(to_py_date(cancelDateFrom), to_py_date(cancelDateTo))]
|
|
|
1579 |
finally:
|
|
|
1580 |
close_session()
|
|
|
1581 |
|
| 4600 |
varun.gupt |
1582 |
def getEBSSettlementSummaries(self):
|
|
|
1583 |
try:
|
|
|
1584 |
return get_ebs_settlement_summaries()
|
|
|
1585 |
finally:
|
|
|
1586 |
close_session()
|
| 4369 |
rajveer |
1587 |
|
| 4600 |
varun.gupt |
1588 |
def saveEBSSettlementSummary(self, settlementId, settlementDate, transactionDateFrom, transactionDateTo, amount):
|
|
|
1589 |
try:
|
|
|
1590 |
save_ebs_settlement_summary(settlementId, to_py_date(settlementDate), to_py_date(transactionDateFrom), to_py_date(transactionDateTo), amount)
|
|
|
1591 |
finally:
|
|
|
1592 |
close_session()
|
|
|
1593 |
|
| 5386 |
phani.kuma |
1594 |
def getSettlementForPrepaid(self, referenceId, isRefund):
|
| 4600 |
varun.gupt |
1595 |
'''
|
|
|
1596 |
Parameters:
|
| 5189 |
varun.gupt |
1597 |
- referenceId
|
|
|
1598 |
- isRefund
|
| 4600 |
varun.gupt |
1599 |
'''
|
|
|
1600 |
try:
|
| 5386 |
phani.kuma |
1601 |
return to_t_payment_settlement(get_settlement_for_Prepaid(referenceId, isRefund))
|
| 4600 |
varun.gupt |
1602 |
finally:
|
|
|
1603 |
close_session()
|
| 5386 |
phani.kuma |
1604 |
|
|
|
1605 |
def getSettlementForCod(self, orderId, isRefund):
|
|
|
1606 |
'''
|
|
|
1607 |
Parameters:
|
|
|
1608 |
- orderId
|
|
|
1609 |
- isRefund
|
|
|
1610 |
'''
|
|
|
1611 |
try:
|
|
|
1612 |
return to_t_payment_settlement(get_settlement_for_Cod(orderId, isRefund))
|
|
|
1613 |
finally:
|
|
|
1614 |
close_session()
|
|
|
1615 |
|
| 4600 |
varun.gupt |
1616 |
def getEBSSettlementDate(self, settlementId):
|
|
|
1617 |
try:
|
|
|
1618 |
return to_java_date(get_ebs_settlement_date(settlementId))
|
|
|
1619 |
finally:
|
|
|
1620 |
close_session()
|
|
|
1621 |
|
| 4905 |
varun.gupt |
1622 |
def savePaymentSettlements(self, settlementDate, paymentGatewayId, referenceId, serviceTax, otherCharges, netCollection):
|
| 4600 |
varun.gupt |
1623 |
try:
|
| 4905 |
varun.gupt |
1624 |
save_payment_settlements(to_py_date(settlementDate), paymentGatewayId, referenceId, serviceTax, otherCharges, netCollection)
|
| 4600 |
varun.gupt |
1625 |
finally:
|
|
|
1626 |
close_session()
|
|
|
1627 |
|
|
|
1628 |
def markEBSSettlementUploaded(self, settlementId):
|
|
|
1629 |
try:
|
|
|
1630 |
mark_ebs_settlement_uploaded(settlementId)
|
|
|
1631 |
finally:
|
|
|
1632 |
close_session()
|
|
|
1633 |
|
| 4715 |
varun.gupt |
1634 |
def getSettlementsByDate(self, settlementDateFrom, settlementDateTo, isRefund):
|
|
|
1635 |
try:
|
|
|
1636 |
settlements = get_settlements_by_date(to_py_date(settlementDateFrom), to_py_date(settlementDateTo), isRefund)
|
|
|
1637 |
return [to_t_payment_settlement(settlement) for settlement in settlements]
|
|
|
1638 |
finally:
|
|
|
1639 |
close_session()
|
|
|
1640 |
|
|
|
1641 |
def getReshippedOrderIds(self, orderIds):
|
|
|
1642 |
try:
|
|
|
1643 |
return get_reshipped_order_ids(orderIds)
|
|
|
1644 |
finally:
|
|
|
1645 |
close_session()
|
|
|
1646 |
|
| 5481 |
phani.kuma |
1647 |
def getBilledOrders(self, vendorId, onlyVendorNotPaid, billingDateFrom, billingDateTo):
|
| 4875 |
varun.gupt |
1648 |
try:
|
| 5481 |
phani.kuma |
1649 |
from_date, to_date = get_fdate_tdate(billingDateFrom, billingDateTo)
|
|
|
1650 |
return [to_t_order(order) for order in get_billed_orders(vendorId, onlyVendorNotPaid, from_date, to_date)]
|
| 4875 |
varun.gupt |
1651 |
finally:
|
|
|
1652 |
close_session()
|
|
|
1653 |
|
| 5062 |
varun.gupt |
1654 |
def getStatusDistributionOfOrders(self, startDate, endDate):
|
|
|
1655 |
try:
|
| 5067 |
varun.gupt |
1656 |
distribution = {}
|
|
|
1657 |
|
|
|
1658 |
for status, count in get_order_distribution_by_status(to_py_date(startDate), to_py_date(endDate)):
|
|
|
1659 |
distribution[status] = count
|
|
|
1660 |
|
|
|
1661 |
return distribution
|
| 5062 |
varun.gupt |
1662 |
finally:
|
|
|
1663 |
close_session()
|
|
|
1664 |
|
| 5067 |
varun.gupt |
1665 |
def getOrderIdsForStatus(self, status, startDatetime, endDatetime):
|
|
|
1666 |
try:
|
|
|
1667 |
orders = get_order_ids_for_status(status, to_py_date(startDatetime), to_py_date(endDatetime))
|
|
|
1668 |
return [order.id for order in orders]
|
|
|
1669 |
finally:
|
|
|
1670 |
close_session()
|
|
|
1671 |
|
| 5099 |
varun.gupt |
1672 |
def updateOrderAsPaidToVendor(self, orderId):
|
|
|
1673 |
try:
|
|
|
1674 |
update_orders_as_paid_to_vendor(orderId)
|
|
|
1675 |
finally:
|
|
|
1676 |
close_session()
|
|
|
1677 |
|
| 5348 |
anupam.sin |
1678 |
def updateCODAgent(self, agentEmailId, orderId):
|
|
|
1679 |
try:
|
|
|
1680 |
update_COD_agent(agentEmailId, orderId)
|
|
|
1681 |
finally:
|
|
|
1682 |
close_session()
|
|
|
1683 |
|
| 5386 |
phani.kuma |
1684 |
def updateOrderOnlyAsPaidToVendor(self, orderId):
|
|
|
1685 |
try:
|
|
|
1686 |
update_order_only_as_paid_to_vendor(orderId)
|
|
|
1687 |
finally:
|
|
|
1688 |
close_session()
|
|
|
1689 |
|
| 5208 |
varun.gupt |
1690 |
def getRefundedOrdersMarkedPaid(self):
|
|
|
1691 |
try:
|
|
|
1692 |
return [to_t_order(order) for order in get_refunded_orders_marked_paid()]
|
|
|
1693 |
finally:
|
|
|
1694 |
close_session()
|
| 5447 |
anupam.sin |
1695 |
|
|
|
1696 |
def getAllVerificationAgents(self, minOrderId, maxOrderId):
|
|
|
1697 |
try:
|
|
|
1698 |
return [to_t_verification_agent(codAgent) for codAgent in get_all_verification_agents(minOrderId, maxOrderId)]
|
|
|
1699 |
finally:
|
| 5527 |
anupam.sin |
1700 |
close_session()
|
|
|
1701 |
|
|
|
1702 |
def getAllAttributesForOrderId(self, orderId):
|
|
|
1703 |
try:
|
|
|
1704 |
return [to_t_attribute(attribute) for attribute in get_all_attributes_for_order_id(orderId)]
|
|
|
1705 |
finally:
|
|
|
1706 |
close_session()
|
|
|
1707 |
|
|
|
1708 |
def setOrderAttributeForTransaction(self, transactionId, attribute):
|
|
|
1709 |
try:
|
|
|
1710 |
set_order_attribute_for_transaction(transactionId, attribute)
|
|
|
1711 |
finally:
|
|
|
1712 |
close_session()
|
| 5593 |
mandeep.dh |
1713 |
|
|
|
1714 |
def acceptOrderForItem(self, itemId, quantity, fulfilmentWarehouseId, billingWarehouseId):
|
|
|
1715 |
"""
|
|
|
1716 |
Accepts appropriate order for an item in a given billingWarehouse. Usually
|
|
|
1717 |
invoked while scanning IN of items.
|
|
|
1718 |
|
|
|
1719 |
Parameters:
|
|
|
1720 |
- itemId
|
|
|
1721 |
- quantity
|
|
|
1722 |
- fulfilmentWarehouseId
|
|
|
1723 |
- billingWarehouseId
|
|
|
1724 |
"""
|
|
|
1725 |
try:
|
|
|
1726 |
accept_order_for_item(itemId, quantity, fulfilmentWarehouseId, billingWarehouseId)
|
|
|
1727 |
finally:
|
|
|
1728 |
close_session()
|
|
|
1729 |
|
| 5833 |
rajveer |
1730 |
def getOrderAttributeValue(self, orderId, attributeName):
|
|
|
1731 |
"""
|
|
|
1732 |
Parameters:
|
|
|
1733 |
- orderId
|
|
|
1734 |
- attributeName
|
|
|
1735 |
"""
|
|
|
1736 |
try:
|
| 6019 |
rajveer |
1737 |
return get_order_attribute_value(orderId, attributeName)
|
| 5833 |
rajveer |
1738 |
finally:
|
|
|
1739 |
close_session()
|
|
|
1740 |
|
| 6019 |
rajveer |
1741 |
def changeJacketNumber(self, orderId, jacketNumber):
|
|
|
1742 |
"""
|
|
|
1743 |
Parameters:
|
|
|
1744 |
- orderId
|
|
|
1745 |
- jacketNumber
|
|
|
1746 |
"""
|
|
|
1747 |
try:
|
|
|
1748 |
return change_jacket_number(orderId, jacketNumber)
|
|
|
1749 |
finally:
|
|
|
1750 |
close_session()
|
|
|
1751 |
|
|
|
1752 |
def markOrderAsRtoInTransit(self, orderId):
|
|
|
1753 |
"""
|
|
|
1754 |
Parameters:
|
|
|
1755 |
- orderId
|
|
|
1756 |
"""
|
|
|
1757 |
try:
|
|
|
1758 |
return mark_order_as_rto_in_transit(orderId)
|
|
|
1759 |
finally:
|
|
|
1760 |
close_session()
|
|
|
1761 |
|
| 6000 |
mandeep.dh |
1762 |
def createRechargeOrder(self, thriftRechargeOrder):
|
|
|
1763 |
"""
|
|
|
1764 |
Parameters:
|
|
|
1765 |
- thriftRechargeOrder
|
|
|
1766 |
"""
|
| 6031 |
rajveer |
1767 |
try:
|
|
|
1768 |
if thriftRechargeOrder is None or thriftRechargeOrder.rechargeType is None:
|
|
|
1769 |
raise TransactionServiceException(102, 'Order or the type is Null')
|
|
|
1770 |
|
|
|
1771 |
rechargeOrder = None
|
|
|
1772 |
if thriftRechargeOrder.rechargeType == RechargeType.MOBILE:
|
|
|
1773 |
rechargeOrder = MobileRechargeOrder()
|
|
|
1774 |
elif thriftRechargeOrder.rechargeType == RechargeType.DTH:
|
|
|
1775 |
rechargeOrder = DTHRechargeOrder()
|
|
|
1776 |
|
|
|
1777 |
if rechargeOrder is None:
|
|
|
1778 |
raise TransactionServiceException(102, 'Unsupported recharge type')
|
| 6000 |
mandeep.dh |
1779 |
|
| 6031 |
rajveer |
1780 |
transaction = DigitalTransaction()
|
|
|
1781 |
transaction.createdOn = datetime.datetime.now()
|
| 6056 |
amit.gupta |
1782 |
transaction.userId = thriftRechargeOrder.userId
|
| 6031 |
rajveer |
1783 |
transaction.orders = [rechargeOrder]
|
|
|
1784 |
|
| 6000 |
mandeep.dh |
1785 |
rechargeOrder.from_thrift_object(thriftRechargeOrder)
|
|
|
1786 |
session.commit()
|
| 6031 |
rajveer |
1787 |
return rechargeOrder.to_thrift_object()
|
| 6000 |
mandeep.dh |
1788 |
except:
|
|
|
1789 |
raise TransactionServiceException(103, 'Invalid values passed')
|
|
|
1790 |
finally:
|
|
|
1791 |
self.closeSession()
|
|
|
1792 |
|
| 6031 |
rajveer |
1793 |
def getRechargeOrder(self, rechargeOrderId):
|
|
|
1794 |
"""
|
|
|
1795 |
Parameters:
|
|
|
1796 |
- rechargeOrderId
|
|
|
1797 |
"""
|
|
|
1798 |
try:
|
| 6048 |
rajveer |
1799 |
return get_recharge_order(rechargeOrderId).to_thrift_object()
|
| 6031 |
rajveer |
1800 |
finally:
|
|
|
1801 |
self.closeSession()
|
|
|
1802 |
|
|
|
1803 |
def getRechargeOrders(self, userId):
|
|
|
1804 |
"""
|
|
|
1805 |
Parameters:
|
|
|
1806 |
- userId
|
|
|
1807 |
"""
|
|
|
1808 |
try:
|
|
|
1809 |
return [order.to_thrift_object() for order in get_recharge_orders(userId)]
|
|
|
1810 |
finally:
|
|
|
1811 |
self.closeSession()
|
|
|
1812 |
|
| 6000 |
mandeep.dh |
1813 |
def updateRechargeOrderStatus(self, rechargeOrderId, rechargeOrderStatus):
|
|
|
1814 |
"""
|
|
|
1815 |
Parameters:
|
|
|
1816 |
- rechargeOrderId
|
|
|
1817 |
- rechargeOrderStatus
|
|
|
1818 |
"""
|
| 6031 |
rajveer |
1819 |
try:
|
|
|
1820 |
return update_recharge_order_status(rechargeOrderId, rechargeOrderStatus)
|
|
|
1821 |
finally:
|
|
|
1822 |
self.closeSession()
|
|
|
1823 |
|
|
|
1824 |
def activateRechargeTxn(self, rechargeOrderId):
|
| 6000 |
mandeep.dh |
1825 |
"""
|
|
|
1826 |
Parameters:
|
| 6031 |
rajveer |
1827 |
- rechargeOrderId
|
| 6000 |
mandeep.dh |
1828 |
"""
|
| 6031 |
rajveer |
1829 |
try:
|
|
|
1830 |
return True
|
|
|
1831 |
activate_recharge_txn(rechargeOrderId)
|
|
|
1832 |
finally:
|
|
|
1833 |
self.closeSession()
|
| 6000 |
mandeep.dh |
1834 |
|
| 6031 |
rajveer |
1835 |
def getUserWallet(self, userId):
|
| 6000 |
mandeep.dh |
1836 |
"""
|
|
|
1837 |
Parameters:
|
| 6031 |
rajveer |
1838 |
- userId
|
| 6000 |
mandeep.dh |
1839 |
"""
|
| 6031 |
rajveer |
1840 |
try:
|
|
|
1841 |
return get_user_wallet(userId).to_thrift_object()
|
|
|
1842 |
finally:
|
|
|
1843 |
self.closeSession()
|
| 6000 |
mandeep.dh |
1844 |
|
| 6031 |
rajveer |
1845 |
def getUserWalletHistory(self, userId):
|
| 6000 |
mandeep.dh |
1846 |
"""
|
|
|
1847 |
Parameters:
|
| 6031 |
rajveer |
1848 |
- userId
|
| 6000 |
mandeep.dh |
1849 |
"""
|
| 6031 |
rajveer |
1850 |
try:
|
|
|
1851 |
return [wallet.to_thrift_object() for wallet in get_user_wallet_history(userId)]
|
|
|
1852 |
finally:
|
|
|
1853 |
self.closeSession()
|
| 6000 |
mandeep.dh |
1854 |
|
| 6206 |
rajveer |
1855 |
def getServiceProviders(self, rechargeType, onlyActive):
|
| 6048 |
rajveer |
1856 |
"""
|
|
|
1857 |
Parameters:
|
|
|
1858 |
- rechargeType
|
| 6206 |
rajveer |
1859 |
- onlyActive
|
| 6048 |
rajveer |
1860 |
"""
|
| 6077 |
anupam.sin |
1861 |
|
| 6048 |
rajveer |
1862 |
try:
|
| 6206 |
rajveer |
1863 |
return get_service_providers(rechargeType, onlyActive)
|
| 6048 |
rajveer |
1864 |
finally:
|
|
|
1865 |
self.closeSession()
|
|
|
1866 |
|
| 6049 |
rajveer |
1867 |
def getServiceProviderForDevice(self, rechargeType, deviceNumber):
|
| 6048 |
rajveer |
1868 |
"""
|
|
|
1869 |
Parameters:
|
|
|
1870 |
- deviceNumber
|
|
|
1871 |
"""
|
|
|
1872 |
try:
|
| 6049 |
rajveer |
1873 |
return get_service_provider_for_device(rechargeType, deviceNumber)
|
| 6048 |
rajveer |
1874 |
finally:
|
|
|
1875 |
self.closeSession()
|
| 6056 |
amit.gupta |
1876 |
|
| 6591 |
anupam.sin |
1877 |
def validateRecharge(self, rechargeType, deviceNumber, userSelectedProviderId, clientAddress):
|
| 6269 |
rajveer |
1878 |
"""
|
|
|
1879 |
Parameters:
|
|
|
1880 |
- deviceNumber
|
|
|
1881 |
"""
|
|
|
1882 |
try:
|
| 6591 |
anupam.sin |
1883 |
return validate_recharge(rechargeType, deviceNumber, userSelectedProviderId, clientAddress)
|
| 6269 |
rajveer |
1884 |
finally:
|
|
|
1885 |
self.closeSession()
|
|
|
1886 |
|
| 6056 |
amit.gupta |
1887 |
def getRechargeOrdersForTransaction(self, txId):
|
|
|
1888 |
"""
|
|
|
1889 |
Parameters:
|
|
|
1890 |
- transactionId
|
|
|
1891 |
"""
|
|
|
1892 |
try:
|
|
|
1893 |
return get_recharge_orders_for_transaction(txId).to_thrift_object()
|
|
|
1894 |
finally:
|
|
|
1895 |
self.closeSession()
|
| 6048 |
rajveer |
1896 |
|
| 6094 |
rajveer |
1897 |
def getRechargeOrdersForDevice(self, deviceNumber):
|
|
|
1898 |
"""
|
|
|
1899 |
Parameters:
|
|
|
1900 |
- deviceNumber
|
|
|
1901 |
"""
|
|
|
1902 |
try:
|
|
|
1903 |
return [order.to_thrift_object() for order in get_recharge_orders_for_device(deviceNumber)]
|
|
|
1904 |
finally:
|
|
|
1905 |
self.closeSession()
|
|
|
1906 |
|
| 6154 |
rajveer |
1907 |
def getRechargeOrdersForStatus(self, status):
|
|
|
1908 |
"""
|
|
|
1909 |
Parameters:
|
|
|
1910 |
- status
|
|
|
1911 |
"""
|
|
|
1912 |
try:
|
|
|
1913 |
return [order.to_thrift_object() for order in get_recharge_orders_for_status(status)]
|
|
|
1914 |
finally:
|
|
|
1915 |
self.closeSession()
|
|
|
1916 |
|
| 6159 |
rajveer |
1917 |
def getPlansForOperator(self, operatorId):
|
|
|
1918 |
"""
|
|
|
1919 |
Parameters:
|
|
|
1920 |
- operatorId
|
|
|
1921 |
"""
|
|
|
1922 |
try:
|
|
|
1923 |
return [plan.to_thrift_object() for plan in get_plans_for_operator(operatorId)]
|
|
|
1924 |
finally:
|
|
|
1925 |
self.closeSession()
|
|
|
1926 |
|
|
|
1927 |
|
| 6094 |
rajveer |
1928 |
def addAmountToWallet(self, userId, orderId, amount):
|
|
|
1929 |
"""
|
|
|
1930 |
Parameters:
|
|
|
1931 |
- userId
|
|
|
1932 |
- orderId
|
|
|
1933 |
- amount
|
|
|
1934 |
"""
|
|
|
1935 |
try:
|
| 8729 |
anupam.sin |
1936 |
update_amount_in_wallet(userId, amount, orderId, 0)
|
| 6094 |
rajveer |
1937 |
finally:
|
|
|
1938 |
self.closeSession()
|
|
|
1939 |
|
| 6188 |
rajveer |
1940 |
def getRechargeStatistics(self):
|
|
|
1941 |
"""
|
|
|
1942 |
Parameters:
|
|
|
1943 |
"""
|
|
|
1944 |
try:
|
|
|
1945 |
return get_recharge_statistics()
|
|
|
1946 |
finally:
|
|
|
1947 |
self.closeSession()
|
|
|
1948 |
|
| 6307 |
anupam.sin |
1949 |
def getRechargeDenominations(self, operatorId, circleCode, denominationType):
|
| 6289 |
anupam.sin |
1950 |
try:
|
|
|
1951 |
returnList = []
|
| 6307 |
anupam.sin |
1952 |
rechargeDenominations = get_recharge_denominations(operatorId, circleCode, denominationType)
|
| 6289 |
anupam.sin |
1953 |
for rechargeDenomination in rechargeDenominations:
|
|
|
1954 |
returnList.append(rechargeDenomination.to_thrift_object())
|
|
|
1955 |
return returnList
|
|
|
1956 |
finally:
|
|
|
1957 |
self.closeSession()
|
| 6188 |
rajveer |
1958 |
|
| 6371 |
rajveer |
1959 |
def updateAvailabilityStatus(self, operatorId, circleId, isAvailable):
|
|
|
1960 |
try:
|
|
|
1961 |
update_availability_status(operatorId, circleId, isAvailable)
|
|
|
1962 |
finally:
|
|
|
1963 |
self.closeSession()
|
|
|
1964 |
|
| 6396 |
amit.gupta |
1965 |
def getAvailableEmiSchemes(self):
|
|
|
1966 |
try:
|
|
|
1967 |
return get_available_emi_schemes()
|
|
|
1968 |
finally:
|
|
|
1969 |
self.closeSession()
|
|
|
1970 |
|
| 6389 |
rajveer |
1971 |
def getMiscCharges(self, transactionId):
|
|
|
1972 |
try:
|
|
|
1973 |
return get_misc_charges(transactionId)
|
|
|
1974 |
finally:
|
|
|
1975 |
self.closeSession()
|
|
|
1976 |
|
| 6507 |
anupam.sin |
1977 |
def refundRechargeOrder (self, rechargeOrderId):
|
|
|
1978 |
try:
|
|
|
1979 |
return refund_recharge_order(rechargeOrderId)
|
|
|
1980 |
finally:
|
|
|
1981 |
self.closeSession()
|
| 6821 |
amar.kumar |
1982 |
|
|
|
1983 |
def getPhysicalOrders(self, start_date, end_date):
|
|
|
1984 |
try:
|
| 6832 |
amar.kumar |
1985 |
return [to_t_order(order) for order in get_physical_orders(to_py_date(start_date), to_py_date(end_date))]
|
| 6821 |
amar.kumar |
1986 |
finally:
|
|
|
1987 |
self.closeSession()
|
| 6507 |
anupam.sin |
1988 |
|
| 6906 |
rajveer |
1989 |
def getDocument(self, docType, docSource):
|
|
|
1990 |
try:
|
|
|
1991 |
return get_document(docType, docSource)
|
|
|
1992 |
finally:
|
|
|
1993 |
self.closeSession()
|
| 6988 |
rajveer |
1994 |
|
| 7075 |
rajveer |
1995 |
def retrieveInvoice(self, orderId, userId):
|
| 6988 |
rajveer |
1996 |
try:
|
| 7075 |
rajveer |
1997 |
return retrieve_invoice(orderId,userId)
|
| 6988 |
rajveer |
1998 |
finally:
|
|
|
1999 |
self.closeSession()
|
| 6906 |
rajveer |
2000 |
|
| 7027 |
rajveer |
2001 |
def receiveUpdatesForRedExpress(self, awbNumber):
|
|
|
2002 |
try:
|
| 7032 |
rajveer |
2003 |
return RedExpressUpdateService.get_updates_for_user(awbNumber)
|
| 7027 |
rajveer |
2004 |
finally:
|
|
|
2005 |
self.closeSession()
|
|
|
2006 |
|
| 6985 |
anupam.sin |
2007 |
def changeShippingAddress(self, orderId, line1, line2, city, state, pin):
|
|
|
2008 |
try:
|
|
|
2009 |
return change_shipping_address(orderId, line1, line2, city, state, pin)
|
|
|
2010 |
finally:
|
|
|
2011 |
self.closeSession()
|
|
|
2012 |
|
| 7073 |
anupam.sin |
2013 |
def createRechargeTransaction(self, t_rechargeTransaction):
|
|
|
2014 |
try:
|
|
|
2015 |
return to_t_rechargeTransaction(create_recharge_transaction(t_rechargeTransaction))
|
|
|
2016 |
finally:
|
|
|
2017 |
self.closeSession()
|
| 7084 |
rajveer |
2018 |
|
|
|
2019 |
def getRechargeTransactions(self, storeId):
|
|
|
2020 |
try:
|
|
|
2021 |
return [to_t_rechargeTransaction(txn) for txn in get_recharge_transactions(storeId)]
|
|
|
2022 |
finally:
|
|
|
2023 |
self.closeSession()
|
|
|
2024 |
|
| 7151 |
amit.gupta |
2025 |
def getRechargeTrans(self, storeId, startdate, enddate, status):
|
|
|
2026 |
try:
|
|
|
2027 |
return [to_t_rechargeTransaction(txn) for txn in get_recharge_trans(storeId,startdate, enddate, status)]
|
|
|
2028 |
finally:
|
|
|
2029 |
self.closeSession()
|
| 7084 |
rajveer |
2030 |
|
| 7080 |
anupam.sin |
2031 |
def getRechargeTransaction(self, rechargeId):
|
|
|
2032 |
try:
|
|
|
2033 |
return to_t_rechargeTransaction(get_recharge_transaction(rechargeId))
|
|
|
2034 |
finally:
|
|
|
2035 |
self.closeSession()
|
|
|
2036 |
|
|
|
2037 |
def getFRCs(self, circleId, operatorId):
|
|
|
2038 |
try:
|
|
|
2039 |
return [to_t_frc(frc) for frc in get_frcs(circleId, operatorId)]
|
|
|
2040 |
finally:
|
|
|
2041 |
self.closeSession()
|
|
|
2042 |
|
| 7096 |
anupam.sin |
2043 |
def getHotspotStore(self, id, hotspotid):
|
|
|
2044 |
try:
|
|
|
2045 |
return to_t_hotspot(get_hotspot_store(id, hotspotid))
|
|
|
2046 |
finally:
|
|
|
2047 |
self.closeSession()
|
|
|
2048 |
|
|
|
2049 |
def getTelecomCircle(self, id, code):
|
|
|
2050 |
try:
|
|
|
2051 |
return get_circle(id, code).to_thrift_object()
|
|
|
2052 |
finally:
|
|
|
2053 |
self.closeSession()
|
|
|
2054 |
|
| 7109 |
anupam.sin |
2055 |
def retrieveHotspotRechargeInvoice(self, rechargeId):
|
|
|
2056 |
try:
|
|
|
2057 |
return retrieve_hotspot_recharge_invoice(rechargeId)
|
|
|
2058 |
finally:
|
|
|
2059 |
self.closeSession()
|
| 7190 |
amar.kumar |
2060 |
|
|
|
2061 |
def splitFreebieOrder(self, orderId, splitReason, shippingDate):
|
|
|
2062 |
try:
|
|
|
2063 |
return split_freebie_order(orderId, splitReason, shippingDate)
|
|
|
2064 |
finally:
|
|
|
2065 |
self.closeSession()
|
| 7109 |
anupam.sin |
2066 |
|
| 7172 |
anupam.sin |
2067 |
def getRechargeTransactionsByNumber(self, number, storeId):
|
| 7169 |
anupam.sin |
2068 |
try:
|
| 7172 |
anupam.sin |
2069 |
return [to_t_rechargeTransaction(txn) for txn in get_recharge_transactions_by_number(number, storeId)]
|
| 7169 |
anupam.sin |
2070 |
finally:
|
|
|
2071 |
self.closeSession()
|
|
|
2072 |
|
|
|
2073 |
def updateHotspotStorePassword(self, storeId, password):
|
|
|
2074 |
try:
|
|
|
2075 |
return update_hotspot_store_password(storeId, password)
|
|
|
2076 |
finally:
|
|
|
2077 |
self.closeSession()
|
|
|
2078 |
|
| 7263 |
anupam.sin |
2079 |
def getSourceDetail(self, source):
|
|
|
2080 |
try:
|
|
|
2081 |
return to_t_sourcedetail(get_source_detail(source))
|
|
|
2082 |
finally:
|
|
|
2083 |
self.closeSession()
|
|
|
2084 |
|
| 7267 |
anupam.sin |
2085 |
def getAllCircles(self):
|
|
|
2086 |
try:
|
|
|
2087 |
return [circle.to_thrift_object() for circle in get_all_circles()]
|
|
|
2088 |
finally:
|
|
|
2089 |
self.closeSession()
|
| 7263 |
anupam.sin |
2090 |
|
| 7267 |
anupam.sin |
2091 |
def deleteFrcs(self, frcIdsToDelete):
|
|
|
2092 |
try:
|
|
|
2093 |
return delete_frcs(frcIdsToDelete)
|
|
|
2094 |
finally:
|
|
|
2095 |
self.closeSession()
|
| 7285 |
rajveer |
2096 |
|
|
|
2097 |
def topupCompanyWallet(self, companyId, amount):
|
|
|
2098 |
try:
|
|
|
2099 |
return topup_company_wallet(companyId, amount)
|
|
|
2100 |
finally:
|
|
|
2101 |
self.closeSession()
|
|
|
2102 |
|
|
|
2103 |
def getWalletBalanceForCompany(self, companyId):
|
|
|
2104 |
try:
|
|
|
2105 |
return get_wallet_balance_for_company(companyId)
|
|
|
2106 |
finally:
|
|
|
2107 |
self.closeSession()
|
| 7311 |
kshitij.so |
2108 |
|
|
|
2109 |
def addAmazonOrder(self,amazonOrder):
|
|
|
2110 |
try:
|
|
|
2111 |
add_amazon_order(amazonOrder)
|
|
|
2112 |
except:
|
|
|
2113 |
self.closeSession()
|
|
|
2114 |
|
| 7322 |
vikram.rag |
2115 |
def updateAmazonOrderStatus(self,orderId,status):
|
| 7311 |
kshitij.so |
2116 |
try:
|
| 7577 |
rajveer |
2117 |
return update_amazon_order_status(orderId,status)
|
| 7311 |
kshitij.so |
2118 |
finally:
|
|
|
2119 |
self.closeSession()
|
| 7322 |
vikram.rag |
2120 |
|
| 7683 |
vikram.rag |
2121 |
def getAmazonOrdersShipped(self):
|
| 7311 |
kshitij.so |
2122 |
try:
|
| 7683 |
vikram.rag |
2123 |
ordersShipped = get_amazon_orders_shipped()
|
| 7311 |
kshitij.so |
2124 |
finally:
|
|
|
2125 |
self.closeSession()
|
|
|
2126 |
return ordersShipped
|
|
|
2127 |
|
|
|
2128 |
def getAmazonOrdersCancelled(self,interval):
|
|
|
2129 |
ordersCancelled=None
|
|
|
2130 |
try:
|
|
|
2131 |
ordersCancelled = get_amazon_orders_cancelled(interval)
|
|
|
2132 |
except:
|
|
|
2133 |
ordersCancelled=None
|
|
|
2134 |
finally:
|
|
|
2135 |
self.closeSession()
|
|
|
2136 |
return ordersCancelled
|
|
|
2137 |
|
| 7322 |
vikram.rag |
2138 |
def getAmazonOrder(self,orderId):
|
|
|
2139 |
result = None
|
|
|
2140 |
try:
|
| 7343 |
anupam.sin |
2141 |
result = to_t_amazonorder(get_amazon_order(orderId))
|
| 7322 |
vikram.rag |
2142 |
finally:
|
|
|
2143 |
self.closeSession()
|
| 7542 |
vikram.rag |
2144 |
return result
|
|
|
2145 |
|
|
|
2146 |
def getAmazonOrderByAmazonOrderId(self,amazonOrderId):
|
|
|
2147 |
result = []
|
|
|
2148 |
try:
|
|
|
2149 |
for amazonOrder in get_amazon_order_by_amazonorderid(amazonOrderId):
|
|
|
2150 |
result.append(to_t_amazonorder(amazonOrder))
|
|
|
2151 |
except:
|
|
|
2152 |
return None
|
|
|
2153 |
finally:
|
|
|
2154 |
self.closeSession()
|
|
|
2155 |
return result
|
| 7343 |
anupam.sin |
2156 |
|
|
|
2157 |
def getOrdersForStore(self, id, storeId, startDate, endDate, statuses):
|
|
|
2158 |
try:
|
|
|
2159 |
return [to_t_order(order) for order in get_orders_for_store(id, storeId, to_py_date(startDate), to_py_date(endDate), statuses)]
|
|
|
2160 |
finally:
|
|
|
2161 |
self.closeSession()
|
|
|
2162 |
|
| 7386 |
anupam.sin |
2163 |
def getStoreOrderAdvanceInvoice(self, orderId, storeId):
|
| 7343 |
anupam.sin |
2164 |
try:
|
| 7386 |
anupam.sin |
2165 |
return get_store_order_advance_invoice(orderId, storeId)
|
| 7343 |
anupam.sin |
2166 |
finally:
|
|
|
2167 |
self.closeSession()
|
| 7363 |
rajveer |
2168 |
|
|
|
2169 |
def getSaholicRechargeBalance(self):
|
|
|
2170 |
try:
|
|
|
2171 |
return RechargeService.getBalance()
|
|
|
2172 |
finally:
|
|
|
2173 |
self.closeSession()
|
|
|
2174 |
|
| 7370 |
anupam.sin |
2175 |
def addFrc(self, circle, operatorId, denomination, maxDiscount):
|
|
|
2176 |
try:
|
|
|
2177 |
return add_frc(circle, operatorId, denomination, maxDiscount)
|
|
|
2178 |
except:
|
|
|
2179 |
return False
|
|
|
2180 |
finally:
|
|
|
2181 |
self.closeSession()
|
|
|
2182 |
|
| 7371 |
anupam.sin |
2183 |
def addSeries(self, circle, operatorId, series):
|
|
|
2184 |
try:
|
|
|
2185 |
return add_series(circle, operatorId, series)
|
|
|
2186 |
except:
|
|
|
2187 |
return "Error Occured. Try Again."
|
|
|
2188 |
finally:
|
|
|
2189 |
self.closeSession()
|
|
|
2190 |
|
| 7386 |
anupam.sin |
2191 |
def saveStoreOrderDetail(self, storeOrderDetail):
|
|
|
2192 |
try:
|
|
|
2193 |
return save_store_order_detail(storeOrderDetail)
|
|
|
2194 |
except:
|
|
|
2195 |
return False
|
|
|
2196 |
finally:
|
|
|
2197 |
self.closeSession()
|
|
|
2198 |
|
|
|
2199 |
|
|
|
2200 |
def getStoreOrderDetail(self, orderId, storeId):
|
|
|
2201 |
try:
|
|
|
2202 |
return to_t_storeOrderDetail(get_store_order_detail(orderId, storeId))
|
|
|
2203 |
finally:
|
|
|
2204 |
self.closeSession()
|
|
|
2205 |
|
|
|
2206 |
def getAllEdcBanks(self):
|
|
|
2207 |
try:
|
|
|
2208 |
return get_all_edc_banks()
|
|
|
2209 |
finally:
|
|
|
2210 |
self.closeSession()
|
| 7393 |
anupam.sin |
2211 |
|
|
|
2212 |
def saveRefundAmountsForStoreOrder(self, orderId, storeId, cashRefundAmount, cardRefundAmount):
|
|
|
2213 |
try:
|
| 7399 |
anupam.sin |
2214 |
return save_refund_amounts_for_store_order(orderId, storeId, cashRefundAmount, cardRefundAmount)
|
| 7393 |
anupam.sin |
2215 |
finally:
|
|
|
2216 |
self.closeSession()
|
| 7386 |
anupam.sin |
2217 |
|
| 7427 |
anupam.sin |
2218 |
def getCollectionsForStore(self, storeId, startDate, endDate):
|
|
|
2219 |
try:
|
|
|
2220 |
return [to_t_storeOrderCollection(collection) for collection in get_collections_for_store(storeId, startDate, endDate)]
|
|
|
2221 |
finally:
|
|
|
2222 |
self.closeSession()
|
| 7442 |
vikram.rag |
2223 |
|
| 12614 |
amit.gupta |
2224 |
def getAmazonOrdersToAcknowledge(self, source):
|
| 7442 |
vikram.rag |
2225 |
try:
|
|
|
2226 |
ordersack = []
|
| 12614 |
amit.gupta |
2227 |
for amazonOrderId,amazonOrderCode,status,txnid,count in get_amazon_orders_to_acknowledge(source):
|
| 7442 |
vikram.rag |
2228 |
orderack = AmazonOrdersToAcknowledge()
|
|
|
2229 |
orderack.amazonOrderId = amazonOrderId
|
|
|
2230 |
orderack.amazonOrderItemId = amazonOrderCode
|
|
|
2231 |
orderack.status = status
|
|
|
2232 |
orderack.transaction_id = txnid
|
|
|
2233 |
orderack.count = count
|
|
|
2234 |
ordersack.append(orderack)
|
|
|
2235 |
return ordersack
|
|
|
2236 |
except:
|
|
|
2237 |
return None
|
|
|
2238 |
finally:
|
|
|
2239 |
self.closeSession()
|
|
|
2240 |
|
|
|
2241 |
def changeAmazonOrderStatus(self,amazonOrderCode,status):
|
|
|
2242 |
try:
|
|
|
2243 |
change_amazon_order_status(amazonOrderCode,status)
|
|
|
2244 |
finally:
|
| 7460 |
kshitij.so |
2245 |
self.closeSession()
|
|
|
2246 |
|
| 7741 |
kshitij.so |
2247 |
def updateTimestampForAmazonOrder(self,orderDeliveryMap):
|
| 7460 |
kshitij.so |
2248 |
try:
|
| 7741 |
kshitij.so |
2249 |
return update_timestamp_for_amazon_order(orderDeliveryMap)
|
| 7530 |
kshitij.so |
2250 |
except:
|
|
|
2251 |
return False
|
| 7460 |
kshitij.so |
2252 |
finally:
|
| 7530 |
kshitij.so |
2253 |
self.closeSession()
|
|
|
2254 |
|
|
|
2255 |
def updateSourceDetailTimestamp(self,id,lastUpdatedOn):
|
|
|
2256 |
try:
|
|
|
2257 |
return update_source_detail_timestamp(id,lastUpdatedOn)
|
|
|
2258 |
except:
|
|
|
2259 |
return False
|
|
|
2260 |
finally:
|
| 7442 |
vikram.rag |
2261 |
self.closeSession()
|
| 7607 |
anupam.sin |
2262 |
|
|
|
2263 |
def getOrdersByMobileNumber(self, mobileNumber):
|
|
|
2264 |
try:
|
|
|
2265 |
orders = get_orders_by_mobile_number(mobileNumber)
|
|
|
2266 |
return [to_t_order(order) for order in orders]
|
|
|
2267 |
finally:
|
|
|
2268 |
self.closeSession()
|
| 7427 |
anupam.sin |
2269 |
|
| 7645 |
anupam.sin |
2270 |
def getOrdersByAmazonOrderCode(self, amazonId):
|
| 7607 |
anupam.sin |
2271 |
try:
|
|
|
2272 |
orders = get_orders_by_amazon_id(amazonId)
|
|
|
2273 |
return [to_t_order(order) for order in orders]
|
|
|
2274 |
finally:
|
|
|
2275 |
self.closeSession()
|
| 7730 |
anupam.sin |
2276 |
|
|
|
2277 |
def convertStoreToNormal(self, orderId):
|
|
|
2278 |
try:
|
|
|
2279 |
return convert_store_to_normal(orderId)
|
|
|
2280 |
except:
|
|
|
2281 |
return False
|
|
|
2282 |
finally:
|
|
|
2283 |
self.closeSession()
|
| 7822 |
amar.kumar |
2284 |
|
|
|
2285 |
def updateFreebieItem(self, orderId, newFreebieItemId):
|
|
|
2286 |
try:
|
|
|
2287 |
return to_t_order(update_freebie_item(orderId, newFreebieItemId))
|
|
|
2288 |
finally:
|
|
|
2289 |
self.closeSession()
|
| 7938 |
manish.sha |
2290 |
|
| 7967 |
anupam.sin |
2291 |
def getHotspotServiceMatrices(self):
|
|
|
2292 |
try:
|
|
|
2293 |
return [to_t_hotspotServiceMatrix(hotpotServiceMatrix) for hotpotServiceMatrix in get_hotspot_service_matrices()]
|
|
|
2294 |
finally:
|
|
|
2295 |
self.closeSession()
|
|
|
2296 |
|
| 7938 |
manish.sha |
2297 |
def updateOrderAWB(self, orderId, airwayBillNo):
|
|
|
2298 |
try:
|
| 7985 |
manish.sha |
2299 |
return to_t_order(update_order_AWB(orderId, airwayBillNo))
|
| 7938 |
manish.sha |
2300 |
finally:
|
|
|
2301 |
close_session()
|
| 8182 |
amar.kumar |
2302 |
def getOrdersByVendor(self, vendors, statuses):
|
|
|
2303 |
try:
|
|
|
2304 |
return [to_t_order(order) for order in get_orders_by_vendor(vendors, statuses)]
|
|
|
2305 |
finally:
|
|
|
2306 |
close_session()
|
| 7607 |
anupam.sin |
2307 |
|
| 8182 |
amar.kumar |
2308 |
def createEbayOrder(self, ebayOrder):
|
|
|
2309 |
try:
|
|
|
2310 |
create_ebay_order(ebayOrder)
|
|
|
2311 |
finally:
|
|
|
2312 |
close_session()
|
|
|
2313 |
def getEbayOrderByOrderId(self, orderId):
|
|
|
2314 |
try:
|
|
|
2315 |
return to_t_ebayOrder(get_ebay_order_by_orderId(orderId))
|
|
|
2316 |
finally:
|
|
|
2317 |
close_session()
|
|
|
2318 |
|
|
|
2319 |
def getEbayOrderBySalesRecNumber(self, salesRecordNumber):
|
|
|
2320 |
try:
|
|
|
2321 |
return to_t_ebayOrder(get_ebay_order_by_sales_rec_number(salesRecordNumber))
|
|
|
2322 |
finally:
|
|
|
2323 |
close_session()
|
|
|
2324 |
|
| 8241 |
amar.kumar |
2325 |
def getEbayOrder(self, salesRecordNumber, listingId, paisaPayId):
|
| 8182 |
amar.kumar |
2326 |
try:
|
| 8253 |
amar.kumar |
2327 |
return [to_t_ebayOrder(order) for order in get_ebay_order(salesRecordNumber, listingId, paisaPayId)]
|
| 8182 |
amar.kumar |
2328 |
finally:
|
|
|
2329 |
close_session()
|
|
|
2330 |
|
|
|
2331 |
def updateEbayOrder(self, ebayOrder):
|
|
|
2332 |
try:
|
|
|
2333 |
update_ebay_order(ebayOrder)
|
|
|
2334 |
finally:
|
|
|
2335 |
close_session()
|
|
|
2336 |
|
|
|
2337 |
def ebayOrderExists(self, salesRecNumber, ebayListingId):
|
|
|
2338 |
try:
|
|
|
2339 |
return ebay_order_exists(salesRecNumber, ebayListingId)
|
|
|
2340 |
finally:
|
|
|
2341 |
close_session()
|
|
|
2342 |
|
|
|
2343 |
def updateOrderForEbay(self, order):
|
|
|
2344 |
try:
|
|
|
2345 |
update_order_for_ebay(order)
|
|
|
2346 |
finally:
|
|
|
2347 |
close_session()
|
|
|
2348 |
|
|
|
2349 |
def splitEbayOrder(self, orderId, splitOrderQty, splitOrderItemId, usePowerShip):
|
|
|
2350 |
try:
|
|
|
2351 |
return to_t_order(split_ebay_order(orderId, splitOrderQty, splitOrderItemId, usePowerShip))
|
|
|
2352 |
finally:
|
|
|
2353 |
close_session()
|
| 8282 |
kshitij.so |
2354 |
|
|
|
2355 |
def addOrUpdateAmazonFbaSalesSnapshot(self,amazonfbasalessnapshot):
|
|
|
2356 |
try:
|
|
|
2357 |
add_or_update_amazon_fba_sales_snapshot(amazonfbasalessnapshot)
|
|
|
2358 |
finally:
|
|
|
2359 |
close_session()
|
|
|
2360 |
|
|
|
2361 |
def getAmazonFbaSalesSnapshotForDays(self,days):
|
|
|
2362 |
fbasalessnapshot = []
|
|
|
2363 |
try:
|
|
|
2364 |
snapshots = get_amazon_fba_sales_snapshot_for_days(days)
|
|
|
2365 |
for snapshot in snapshots:
|
|
|
2366 |
fbasalessnapshot.append(to_t_amazonFbaSalesSnapshot(snapshot))
|
|
|
2367 |
return fbasalessnapshot
|
|
|
2368 |
except:
|
|
|
2369 |
return None
|
|
|
2370 |
finally:
|
|
|
2371 |
close_session()
|
|
|
2372 |
|
|
|
2373 |
def getAmazonFbaSalesLatestSnapshotForItem(self,item_id):
|
|
|
2374 |
try:
|
| 8363 |
vikram.rag |
2375 |
return to_t_amazonFbaSalesSnapshot(get_amazon_fba_sales_latest_snapshot_for_item(item_id))
|
| 8282 |
kshitij.so |
2376 |
except:
|
|
|
2377 |
return None
|
|
|
2378 |
finally:
|
|
|
2379 |
close_session()
|
| 8532 |
vikram.rag |
2380 |
|
| 8488 |
amar.kumar |
2381 |
def createSnapdealOrder(self, snapdeal_order):
|
|
|
2382 |
try:
|
|
|
2383 |
create_snapdeal_order(snapdeal_order)
|
|
|
2384 |
finally:
|
|
|
2385 |
close_session()
|
|
|
2386 |
|
|
|
2387 |
def getSnapdealOrder(self, orderId, reference_code, suborder_id):
|
|
|
2388 |
try:
|
| 11424 |
kshitij.so |
2389 |
return [to_t_snapdealOrder(snapdealOrder) for snapdealOrder in get_snapdeal_order(orderId, reference_code, suborder_id)]
|
|
|
2390 |
#return to_t_snapdealOrder(get_snapdeal_order(orderId, reference_code, suborder_id))
|
| 8488 |
amar.kumar |
2391 |
finally:
|
|
|
2392 |
close_session()
|
|
|
2393 |
|
| 8802 |
amar.kumar |
2394 |
def snapdealOrderExists(self, suborder_id, referenceCode):
|
| 8488 |
amar.kumar |
2395 |
try:
|
| 8802 |
amar.kumar |
2396 |
return snapdeal_order_exists(suborder_id, referenceCode)
|
| 8488 |
amar.kumar |
2397 |
finally:
|
|
|
2398 |
close_session()
|
| 8532 |
vikram.rag |
2399 |
|
|
|
2400 |
def updateLatestFbaPricesForItem(self,fbaitemprices):
|
|
|
2401 |
try:
|
|
|
2402 |
update_latest_fba_prices_for_item(fbaitemprices)
|
|
|
2403 |
finally:
|
| 8961 |
vikram.rag |
2404 |
close_session()
|
|
|
2405 |
|
|
|
2406 |
def flipkartOrderExists(self,flipkartOrderId,flipkartSubOrderId):
|
|
|
2407 |
try:
|
|
|
2408 |
return flipkart_order_exists(flipkartOrderId,flipkartSubOrderId)
|
|
|
2409 |
finally:
|
|
|
2410 |
self.closeSession()
|
| 8532 |
vikram.rag |
2411 |
|
| 8961 |
vikram.rag |
2412 |
def createFlipkartOrder(self,flipkartOrder):
|
|
|
2413 |
try:
|
|
|
2414 |
create_flipkart_order(flipkartOrder)
|
|
|
2415 |
finally:
|
| 8990 |
vikram.rag |
2416 |
self.closeSession()
|
|
|
2417 |
|
|
|
2418 |
def getFlipkartOrder(self,orderId):
|
|
|
2419 |
try:
|
|
|
2420 |
return to_t_flipkartOrder(get_flipkart_order(orderId))
|
|
|
2421 |
finally:
|
| 9159 |
amar.kumar |
2422 |
self.closeSession()
|
|
|
2423 |
|
|
|
2424 |
def getFlipkartOrderByOrderItemId(self, flipkartOrderItemId):
|
|
|
2425 |
try:
|
|
|
2426 |
return to_t_flipkartOrder(get_flipkart_order_by_subOrderId(flipkartOrderItemId))
|
|
|
2427 |
finally:
|
|
|
2428 |
close_session()
|
| 9107 |
vikram.rag |
2429 |
self.closeSession()
|
|
|
2430 |
|
|
|
2431 |
def updateFlipkartOrderDatesAndAWB(self,flipkartOrderId,flipkartSubOrderId,date,awb):
|
|
|
2432 |
try:
|
|
|
2433 |
return update_flipkart_order_dates_and_awb(flipkartOrderId,flipkartSubOrderId,date,awb)
|
|
|
2434 |
finally:
|
|
|
2435 |
self.closeSession()
|
| 9338 |
manish.sha |
2436 |
|
| 9571 |
vikram.rag |
2437 |
def getOrdersCreatedAfterTimestampForSource(self,timestamp,source):
|
| 9404 |
vikram.rag |
2438 |
try:
|
| 9571 |
vikram.rag |
2439 |
return get_orders_count_created_after_timestamp_for_source(timestamp,source)
|
| 9404 |
vikram.rag |
2440 |
finally:
|
|
|
2441 |
self.closeSession()
|
|
|
2442 |
|
|
|
2443 |
|
| 9338 |
manish.sha |
2444 |
def getOrderForAirwayBillNo(self, airwaybillNo):
|
| 13276 |
manish.sha |
2445 |
ret_Orders =[]
|
| 9338 |
manish.sha |
2446 |
try:
|
| 13276 |
manish.sha |
2447 |
orderList = get_order_for_awb(airwaybillNo)
|
|
|
2448 |
for order in orderList:
|
|
|
2449 |
ret_Orders.append(to_t_order(order))
|
|
|
2450 |
return ret_Orders
|
| 9338 |
manish.sha |
2451 |
finally:
|
|
|
2452 |
close_session()
|
|
|
2453 |
|
| 9651 |
manish.sha |
2454 |
def getMinCreatedTimeStampUndeliveredOrdersForSource(self, source):
|
|
|
2455 |
try:
|
|
|
2456 |
return get_min_created_timestamp_undelivered_orders_for_source(source)
|
|
|
2457 |
finally:
|
|
|
2458 |
close_session()
|
|
|
2459 |
|
| 9882 |
manish.sha |
2460 |
def updateSnapdealOrdersStatus(self, orders):
|
| 9651 |
manish.sha |
2461 |
try:
|
| 9882 |
manish.sha |
2462 |
update_snapdeal_orders_status(orders)
|
| 9651 |
manish.sha |
2463 |
finally:
|
|
|
2464 |
close_session()
|
|
|
2465 |
|
|
|
2466 |
def updateFlipkartOrdersStatus(self, delivered_orders):
|
|
|
2467 |
try:
|
|
|
2468 |
update_flipkart_orders_status(delivered_orders)
|
|
|
2469 |
finally:
|
|
|
2470 |
close_session()
|
| 9801 |
manish.sha |
2471 |
|
|
|
2472 |
def bulkAddOrUpdateAmazonFbaSalesSnapshot(self, amazonfbasalessnapshotlist):
|
|
|
2473 |
try:
|
|
|
2474 |
bulk_add_or_update_amazon_fba_sales_snapshot(amazonfbasalessnapshotlist)
|
|
|
2475 |
finally:
|
| 9945 |
vikram.rag |
2476 |
close_session()
|
|
|
2477 |
|
|
|
2478 |
def getCreatedOrdersForFlipkart(self,flipkartorderids):
|
|
|
2479 |
try:
|
|
|
2480 |
return get_created_orders_for_flipkart(flipkartorderids)
|
|
|
2481 |
finally:
|
| 11896 |
amit.gupta |
2482 |
close_session()
|
|
|
2483 |
|
|
|
2484 |
def isPrivateDealTransaction(self, transactionId):
|
|
|
2485 |
try:
|
| 11903 |
amit.gupta |
2486 |
return is_private_deal_transaction(transactionId)
|
| 11896 |
amit.gupta |
2487 |
except:
|
|
|
2488 |
return False
|
|
|
2489 |
finally:
|
| 9945 |
vikram.rag |
2490 |
close_session()
|
| 9651 |
manish.sha |
2491 |
|
| 12103 |
manish.sha |
2492 |
def changeEasyshipMfnOrderTxnStatus(self, transactionId, status, description, pickUp, orderType, source, shipTimestamp, deliveryTimeStamp):
|
|
|
2493 |
try:
|
|
|
2494 |
return change_easyship_mfn_order_txn_status(transactionId, status, description, pickUp, orderType, source, shipTimestamp, deliveryTimeStamp)
|
|
|
2495 |
finally:
|
|
|
2496 |
close_session()
|
|
|
2497 |
|
|
|
2498 |
def updateAmazonFbaOrdersReturns(self, fbaOrderReturns):
|
|
|
2499 |
try:
|
|
|
2500 |
update_amazon_fba_order_returns(fbaOrderReturns)
|
|
|
2501 |
finally:
|
|
|
2502 |
close_session()
|
|
|
2503 |
|
|
|
2504 |
def getAllAmazonFbaOrderReturnsByCurrentTime(self, insertionTimestamp):
|
|
|
2505 |
try:
|
|
|
2506 |
ret_order_returns= []
|
|
|
2507 |
returns = get_all_amazon_fba_order_returns(insertionTimestamp)
|
|
|
2508 |
for order_return in returns:
|
|
|
2509 |
ret_order_returns.append(to_t_amazonFbaOrderReturn(order_return))
|
|
|
2510 |
return ret_order_returns
|
|
|
2511 |
finally:
|
|
|
2512 |
close_session()
|
|
|
2513 |
|
|
|
2514 |
def getTotalSaleReturnsFbaSkusCurentTime(self, insertionTimestamp):
|
|
|
2515 |
try:
|
|
|
2516 |
return get_total_sale_returns_fba_skus_curent_time(insertionTimestamp)
|
|
|
2517 |
finally:
|
|
|
2518 |
close_session()
|
| 12398 |
kshitij.so |
2519 |
|
|
|
2520 |
def getAmazonFbaSalesLatestSnapshotForItemLocationWise(self,item_id,location):
|
|
|
2521 |
try:
|
|
|
2522 |
return to_t_amazonFbaSalesSnapshot(get_amazon_fba_sales_latest_snapshot_for_item_location_wise(item_id,location))
|
|
|
2523 |
except:
|
|
|
2524 |
return None
|
|
|
2525 |
finally:
|
|
|
2526 |
close_session()
|
| 12103 |
manish.sha |
2527 |
|
| 12589 |
manish.sha |
2528 |
def getVerificationPendingOrdersFK(self):
|
|
|
2529 |
ret_Orders = []
|
|
|
2530 |
try:
|
|
|
2531 |
fk_Orders = get_verification_pending_orders_fk()
|
|
|
2532 |
for fk_order in fk_Orders:
|
|
|
2533 |
ret_Orders.append(to_t_flipkartOrder(fk_order))
|
|
|
2534 |
return ret_Orders
|
|
|
2535 |
finally:
|
|
|
2536 |
close_session()
|
|
|
2537 |
|
| 12653 |
manish.sha |
2538 |
def addInvoiceDetailsToOrders(self, transactionId, customerId):
|
|
|
2539 |
try:
|
|
|
2540 |
add_invoice_details_to_orders(transactionId, customerId)
|
|
|
2541 |
finally:
|
|
|
2542 |
close_session()
|
|
|
2543 |
|
| 12772 |
manish.sha |
2544 |
def getFAOrderByFkOrderId(self, fkOrderId, fkOrderItemId):
|
|
|
2545 |
try:
|
|
|
2546 |
return to_t_flipkartAdvantageOrder(get_fa_order_by_fk_order_id(fkOrderId, fkOrderItemId))
|
|
|
2547 |
finally:
|
|
|
2548 |
close_session()
|
|
|
2549 |
|
|
|
2550 |
def getAllFAOrdersList(self, status):
|
|
|
2551 |
ret_fa_Orders =[]
|
|
|
2552 |
try:
|
|
|
2553 |
faOrders = get_all_fa_orders_list(status)
|
|
|
2554 |
for faOrder in faOrders:
|
|
|
2555 |
ret_fa_Orders.append(to_t_flipkartAdvantageOrder(faOrder))
|
|
|
2556 |
return ret_fa_Orders
|
|
|
2557 |
finally:
|
|
|
2558 |
close_session()
|
|
|
2559 |
|
|
|
2560 |
def addUpdateFaOrdersBulk(self, faOrdersList):
|
|
|
2561 |
try:
|
|
|
2562 |
add_update_fa_orders_bulk(faOrdersList)
|
|
|
2563 |
finally:
|
|
|
2564 |
close_session()
|
|
|
2565 |
|
|
|
2566 |
def flipkartFaOrderExists(self, fkOrderId, fkOrderItemId):
|
|
|
2567 |
try:
|
|
|
2568 |
return flipkart_fa_order_exists(fkOrderId, fkOrderItemId)
|
|
|
2569 |
finally:
|
|
|
2570 |
close_session()
|
|
|
2571 |
|
| 12979 |
kshitij.so |
2572 |
def getRcgOrderStatus(self,rechargeOrderId,isFinal):
|
|
|
2573 |
try:
|
|
|
2574 |
return get_recharge_order_status(rechargeOrderId,isFinal).to_thrift_object()
|
|
|
2575 |
finally:
|
|
|
2576 |
self.closeSession()
|
|
|
2577 |
|
|
|
2578 |
def getRcgTransactionStatus(self,rechargeTransactionId,isFinal):
|
|
|
2579 |
try:
|
|
|
2580 |
return to_t_rechargeTransaction(get_recharge_transaction_status(rechargeTransactionId,isFinal))
|
|
|
2581 |
finally:
|
|
|
2582 |
self.closeSession()
|
|
|
2583 |
|
| 13146 |
manish.sha |
2584 |
def acceptPackageOrders(self, orders):
|
|
|
2585 |
try:
|
|
|
2586 |
return accept_package_orders(orders)
|
|
|
2587 |
finally:
|
|
|
2588 |
self.closeSession()
|
| 12979 |
kshitij.so |
2589 |
|
| 13146 |
manish.sha |
2590 |
def getGroupOrdersByLogisticsTxnId(self, logisticsTxnId):
|
|
|
2591 |
ret_Orders =[]
|
|
|
2592 |
try:
|
|
|
2593 |
ordersList = get_group_orders_by_logistics_txn_id(logisticsTxnId)
|
|
|
2594 |
for order in ordersList:
|
|
|
2595 |
ret_Orders.append(to_t_order(order))
|
|
|
2596 |
return ret_Orders
|
|
|
2597 |
finally:
|
|
|
2598 |
self.closeSession()
|
|
|
2599 |
|
| 13276 |
manish.sha |
2600 |
def addBillingDetailsForGrouppedOrders(self, order_ids, invoice_number, itemNumbersMap, serialNumbersMap, freebieWarehouseIdMap, billed_by, jacketNumber, billingType, authorize, invoiceType):
|
| 13146 |
manish.sha |
2601 |
try:
|
| 13276 |
manish.sha |
2602 |
return add_billing_details_for_groupped_orders(order_ids, invoice_number, itemNumbersMap, serialNumbersMap, freebieWarehouseIdMap, billed_by, jacketNumber, billingType, authorize, invoiceType)
|
| 13146 |
manish.sha |
2603 |
finally:
|
|
|
2604 |
self.closeSession()
|
| 13276 |
manish.sha |
2605 |
|
|
|
2606 |
def getInvoiceFormatLogisticsTxnId(self, transactionId, shipementSeq):
|
|
|
2607 |
try:
|
|
|
2608 |
return get_invoice_format_logistics_txn_id(transactionId, shipementSeq)
|
|
|
2609 |
finally:
|
|
|
2610 |
self.closeSession()
|
| 13584 |
manish.sha |
2611 |
|
| 13691 |
manish.sha |
2612 |
def createHomeShopOrder(self, hsOrder):
|
|
|
2613 |
try:
|
|
|
2614 |
create_homeshop_order(hsOrder)
|
|
|
2615 |
finally:
|
|
|
2616 |
close_session()
|
|
|
2617 |
|
|
|
2618 |
def getHomeShopOrder(self, orderId, hsOrderNo, hsSubOrderNo):
|
|
|
2619 |
try:
|
|
|
2620 |
return [to_t_hsOrder(hsOrder) for hsOrder in get_homeshop_order(orderId, hsOrderNo, hsSubOrderNo)]
|
|
|
2621 |
#return to_t_snapdealOrder(get_snapdeal_order(orderId, reference_code, suborder_id))
|
|
|
2622 |
finally:
|
|
|
2623 |
close_session()
|
|
|
2624 |
|
|
|
2625 |
def homeShopOrderExists(self, hsOrderNo, hsSubOrderNo):
|
|
|
2626 |
try:
|
|
|
2627 |
return homeshop_order_exists(hsOrderNo, hsSubOrderNo)
|
|
|
2628 |
finally:
|
|
|
2629 |
close_session()
|
|
|
2630 |
|
| 2536 |
chandransh |
2631 |
def closeSession(self, ):
|
|
|
2632 |
close_session()
|
| 3376 |
rajveer |
2633 |
|
|
|
2634 |
def isAlive(self, ):
|
|
|
2635 |
"""
|
| 5447 |
anupam.sin |
2636 |
For checking whether service is alive or not. It also checks connectivity with database
|
| 3376 |
rajveer |
2637 |
"""
|
|
|
2638 |
try:
|
|
|
2639 |
return is_alive()
|
|
|
2640 |
finally:
|
| 6988 |
rajveer |
2641 |
close_session()
|
| 13941 |
amit.gupta |
2642 |
|
|
|
2643 |
def creditBatch(self, batchId, userAmount):
|
| 14134 |
amit.gupta |
2644 |
try:
|
|
|
2645 |
now = datetime.datetime.now()
|
|
|
2646 |
sum = 0
|
|
|
2647 |
for key, amount in json.loads(userAmount).iteritems():
|
|
|
2648 |
userId = int(key)
|
|
|
2649 |
wallet = get_user_wallet(userId)
|
|
|
2650 |
wallet.amount = wallet.amount + amount
|
|
|
2651 |
history = UserWalletHistory()
|
|
|
2652 |
history.amount = amount
|
|
|
2653 |
history.orderId = batchId
|
|
|
2654 |
history.wallet = wallet
|
|
|
2655 |
history.timestamp = now
|
|
|
2656 |
sum += amount
|
|
|
2657 |
|
|
|
2658 |
batchCreditTracker = DtrBatchCreditTracker()
|
|
|
2659 |
batchCreditTracker.id = batchId
|
|
|
2660 |
batchCreditTracker.amount = sum
|
|
|
2661 |
batchCreditTracker.creditedOn = now
|
|
|
2662 |
|
|
|
2663 |
session.commit()
|
|
|
2664 |
finally:
|
|
|
2665 |
close_session()
|
| 17470 |
manish.sha |
2666 |
|
|
|
2667 |
def splitBulkOrder(self, orderId, splitOrderQty):
|
|
|
2668 |
try:
|
|
|
2669 |
return to_t_order(split_bulk_order(orderId, splitOrderQty))
|
|
|
2670 |
finally:
|
|
|
2671 |
close_session()
|
| 18041 |
manish.sha |
2672 |
|
|
|
2673 |
def moveOrdersToCorrectWarehouse(self):
|
|
|
2674 |
try:
|
|
|
2675 |
return move_orders_to_correct_warehouse()
|
| 18046 |
manish.sha |
2676 |
except:
|
|
|
2677 |
return "Error"
|
| 18041 |
manish.sha |
2678 |
finally:
|
|
|
2679 |
close_session()
|
| 18046 |
manish.sha |
2680 |
|
| 18590 |
manish.sha |
2681 |
def verifyOrderForTransaction(self, transactionId):
|
|
|
2682 |
try:
|
|
|
2683 |
return verify_orders_for_transaction(transactionId)
|
|
|
2684 |
finally:
|
|
|
2685 |
close_session()
|
|
|
2686 |
|
| 18634 |
manish.sha |
2687 |
def getCreditorInfo(self, creditorId, name):
|
|
|
2688 |
try:
|
|
|
2689 |
return to_t_Creditor(get_creditor_info(creditorId, name))
|
|
|
2690 |
except:
|
|
|
2691 |
return None
|
|
|
2692 |
finally:
|
|
|
2693 |
close_session()
|
|
|
2694 |
|
|
|
2695 |
def updateCreditorInfo(self, creditor):
|
|
|
2696 |
try:
|
|
|
2697 |
return update_creditor_info(creditor)
|
|
|
2698 |
finally:
|
|
|
2699 |
close_session()
|
|
|
2700 |
|
|
|
2701 |
def getUserSanctionDetails(self, userId):
|
|
|
2702 |
try:
|
| 18677 |
manish.sha |
2703 |
returnMap = get_user_sanction_details(userId, None)
|
|
|
2704 |
sanctionsList = []
|
| 18700 |
manish.sha |
2705 |
for creditorMap in returnMap.values():
|
| 18677 |
manish.sha |
2706 |
for sanction in creditorMap.get('Sanctions'):
|
|
|
2707 |
sanctionsList.append(to_t_UserSanction(sanction, creditorMap.get('TicketSize')))
|
|
|
2708 |
return sanctionsList
|
| 18634 |
manish.sha |
2709 |
finally:
|
|
|
2710 |
close_session()
|
|
|
2711 |
|
|
|
2712 |
def getUserSanctionDetailsForCreditor(self, userId, creditorId):
|
|
|
2713 |
try:
|
| 18703 |
manish.sha |
2714 |
returnMap = get_user_sanction_details(userId, creditorId)
|
|
|
2715 |
sanctionsList = []
|
|
|
2716 |
for creditorMap in returnMap.values():
|
|
|
2717 |
for sanction in creditorMap.get('Sanctions'):
|
|
|
2718 |
sanctionsList.append(to_t_UserSanction(sanction, creditorMap.get('TicketSize')))
|
|
|
2719 |
return sanctionsList[0]
|
| 18634 |
manish.sha |
2720 |
except:
|
|
|
2721 |
return None
|
|
|
2722 |
finally:
|
|
|
2723 |
close_session()
|
|
|
2724 |
|
|
|
2725 |
def updateUserSanction(self, userSanaction):
|
|
|
2726 |
try:
|
|
|
2727 |
return update_user_sanction(userSanaction)
|
|
|
2728 |
finally:
|
|
|
2729 |
close_session()
|
|
|
2730 |
|
|
|
2731 |
def getCreditHistoryRecordsForTransaction(self, paymentId, creditTxnType):
|
|
|
2732 |
try:
|
|
|
2733 |
return [to_t_CreditHistory(creditHistory) for creditHistory in get_credit_history_records(paymentId, None, None, creditTxnType)]
|
|
|
2734 |
finally:
|
|
|
2735 |
close_session()
|
|
|
2736 |
|
|
|
2737 |
def getCreditHistoryRecordsForUserAndCreditor(self, userId, creditorId, creditTxnType):
|
|
|
2738 |
try:
|
|
|
2739 |
return [to_t_CreditHistory(creditHistory) for creditHistory in get_credit_history_records(None, userId, creditorId, creditTxnType)]
|
|
|
2740 |
finally:
|
|
|
2741 |
close_session()
|
|
|
2742 |
|
|
|
2743 |
def processCreditTransaction(self, paymentId, userId, creditorId, creditTxns):
|
|
|
2744 |
try:
|
|
|
2745 |
return process_credit_transaction(paymentId, userId, creditorId, creditTxns)
|
|
|
2746 |
finally:
|
|
|
2747 |
close_session()
|
|
|
2748 |
|
|
|
2749 |
def getLoanPayableForUserToCreditor(self, userId, creditorId, dueDate):
|
|
|
2750 |
try:
|
|
|
2751 |
return get_loan_payable_for_user_to_creditor(userId, creditorId, dueDate)
|
|
|
2752 |
finally:
|
|
|
2753 |
close_session()
|
|
|
2754 |
|
|
|
2755 |
def getLoanHistoryRecordsForTransaction(self, paymentId, creditTxnType):
|
|
|
2756 |
try:
|
|
|
2757 |
return [to_t_LoanHistory(loanHistory) for loanHistory in get_loan_history_records(paymentId, None, None, creditTxnType)]
|
|
|
2758 |
finally:
|
|
|
2759 |
close_session()
|
|
|
2760 |
|
|
|
2761 |
def getLoanHistoryRecordsForUserAndCreditor(self, userId, creditorId, creditTxnType):
|
|
|
2762 |
try:
|
|
|
2763 |
return [to_t_LoanHistory(loanHistory) for loanHistory in get_loan_history_records(None, userId, creditorId, creditTxnType)]
|
|
|
2764 |
finally:
|
|
|
2765 |
close_session()
|
|
|
2766 |
|
|
|
2767 |
def processLoanTransaction(self, paymentId, userId, creditorId, creditTxns):
|
|
|
2768 |
try:
|
|
|
2769 |
return process_loan_transaction(paymentId, creditTxns)
|
|
|
2770 |
finally:
|
| 18769 |
manish.sha |
2771 |
close_session()
|
|
|
2772 |
|
|
|
2773 |
def getLimitedCreditHistoryRecords(self, paymentId, userId, creditorId, limit, offset):
|
|
|
2774 |
try:
|
| 18805 |
manish.sha |
2775 |
hasMore, totalCount, creditHistoryList = get_credit_history_records_paginated(paymentId, userId, creditorId, None, limit, offset)
|
|
|
2776 |
return to_t_PaginatedCreditHistory(hasMore, totalCount, creditHistoryList)
|
| 18769 |
manish.sha |
2777 |
finally:
|
|
|
2778 |
close_session()
|
|
|
2779 |
|
|
|
2780 |
def getLimitedLoanHistoryRecords(self, paymentId, userId, creditorId, limit, offset):
|
|
|
2781 |
try:
|
| 18805 |
manish.sha |
2782 |
hasMore, totalCount, loanHistoryList = get_loan_history_records_paginated(paymentId, userId, creditorId, None, limit, offset)
|
|
|
2783 |
return to_t_PaginatedLoanHistory(hasMore, totalCount, loanHistoryList)
|
| 18769 |
manish.sha |
2784 |
finally:
|
|
|
2785 |
close_session()
|
| 18794 |
manish.sha |
2786 |
|
| 19868 |
manas |
2787 |
def getUserSanctionsDetailsAsPerLimit(self, userId, creditorId, limit, offset,sort):
|
| 18794 |
manish.sha |
2788 |
try:
|
| 19868 |
manas |
2789 |
hasMore, totalCount, returnMap = get_user_sanction_details_paginated(userId, creditorId, limit, offset,sort)
|
| 18794 |
manish.sha |
2790 |
sanctionsList = []
|
|
|
2791 |
for creditorMap in returnMap.values():
|
|
|
2792 |
for sanction in creditorMap.get('Sanctions'):
|
|
|
2793 |
sanctionsList.append(to_t_UserSanction(sanction, creditorMap.get('TicketSize')))
|
|
|
2794 |
return to_t_PaginatedUserSanction(hasMore, totalCount, sanctionsList)
|
|
|
2795 |
finally:
|
|
|
2796 |
close_session()
|
| 19004 |
manish.sha |
2797 |
|
| 19889 |
manas |
2798 |
def getOutstandingPayments(self,fetchType,userId,limit):
|
|
|
2799 |
try:
|
|
|
2800 |
userCounterMap, outstandingResults = get_outstanding_payments(fetchType,userId,limit)
|
|
|
2801 |
return [to_t_OutstandingPayments(outstandingResult,userCounterMap.get(outstandingResult.user_id)) for outstandingResult in outstandingResults]
|
|
|
2802 |
finally:
|
|
|
2803 |
close_session()
|
|
|
2804 |
|
| 19912 |
manas |
2805 |
def markPaymentSettled(self,userId,paymentId,totalAmount,repaymentDate):
|
|
|
2806 |
returnMap = {}
|
|
|
2807 |
try:
|
|
|
2808 |
flag, message = mark_payment_settled(userId,paymentId,totalAmount,repaymentDate)
|
|
|
2809 |
returnMap[flag] = message
|
|
|
2810 |
return returnMap
|
|
|
2811 |
finally:
|
|
|
2812 |
close_session()
|
|
|
2813 |
|
| 19004 |
manish.sha |
2814 |
def getOrdersInBatchAsPromisedShipping(self, statuses, offset, limit, warehouse_id, source):
|
|
|
2815 |
"""
|
|
|
2816 |
Returns at most 'limit' orders with the given statuses for the given warehouse starting from the given offset.
|
|
|
2817 |
These orders should be in order of promised shipping time.
|
|
|
2818 |
Pass the status as null and the limit as 0 to ignore them.
|
|
|
2819 |
|
|
|
2820 |
Parameters:
|
|
|
2821 |
- statuses
|
|
|
2822 |
- offset
|
|
|
2823 |
- limit
|
|
|
2824 |
- warehouse_id
|
|
|
2825 |
"""
|
|
|
2826 |
try:
|
|
|
2827 |
orders = get_orders_in_batch_as_promised_shipping(statuses, offset, limit, warehouse_id, source)
|
|
|
2828 |
return [to_t_order(order) for order in orders]
|
|
|
2829 |
finally:
|
|
|
2830 |
close_session()
|
| 18794 |
manish.sha |
2831 |
|
| 19421 |
manish.sha |
2832 |
def setOrderAttributeForMasterOrderId(self, logisticsTransactionId, attributes):
|
|
|
2833 |
try:
|
|
|
2834 |
set_order_attribute_for_master_order_id(logisticsTransactionId, attributes)
|
|
|
2835 |
finally:
|
|
|
2836 |
close_session()
|
|
|
2837 |
|
|
|
2838 |
def updateMasterOrderAWB(self, logisticsTransactionId, airwaybill_no):
|
|
|
2839 |
try:
|
|
|
2840 |
return update_master_order_awb(logisticsTransactionId, airwaybill_no)
|
|
|
2841 |
finally:
|
|
|
2842 |
close_session()
|
|
|
2843 |
|
| 19474 |
manish.sha |
2844 |
def addOrUpdateShipmentLogisticsCostDetails(self, shipmentLogisticsCostDetails):
|
|
|
2845 |
try:
|
|
|
2846 |
return add_or_update_shipment_logistics_cost_details(shipmentLogisticsCostDetails)
|
|
|
2847 |
finally:
|
|
|
2848 |
close_session()
|
| 19691 |
manish.sha |
2849 |
|
|
|
2850 |
def getReturnOrderInfo(self, id):
|
|
|
2851 |
try:
|
|
|
2852 |
returnOrderInfo = get_return_order_info(id)
|
| 19814 |
kshitij.so |
2853 |
return to_t_returnOrderInfo(returnOrderInfo)
|
| 19691 |
manish.sha |
2854 |
finally:
|
|
|
2855 |
close_session()
|
|
|
2856 |
|
|
|
2857 |
def getReturnOrderInfoList(self, order_ids):
|
|
|
2858 |
try:
|
|
|
2859 |
returnOrdersInfoMap = get_return_orders_info_map(order_ids)
|
|
|
2860 |
mapToReturn = {}
|
|
|
2861 |
for orderId, returnOrdersList in returnOrdersInfoMap.items():
|
|
|
2862 |
returnList = []
|
|
|
2863 |
for returnOrder in returnOrdersList:
|
|
|
2864 |
returnList.append(to_t_returnOrderInfo(returnOrder))
|
|
|
2865 |
mapToReturn[orderId] = returnList
|
|
|
2866 |
return mapToReturn
|
|
|
2867 |
finally:
|
|
|
2868 |
close_session()
|
| 19474 |
manish.sha |
2869 |
|
| 19691 |
manish.sha |
2870 |
def getReturnOrderInfoListAsByStatus(self, order_ids, statuses):
|
|
|
2871 |
try:
|
|
|
2872 |
returnOrdersInfoMap = get_return_orders_info_map(order_ids, statuses)
|
|
|
2873 |
mapToReturn = {}
|
|
|
2874 |
for orderId, returnOrdersList in returnOrdersInfoMap.items():
|
|
|
2875 |
returnList = []
|
|
|
2876 |
for returnOrder in returnOrdersList:
|
|
|
2877 |
returnList.append(to_t_returnOrderInfo(returnOrder))
|
|
|
2878 |
mapToReturn[orderId] = returnList
|
|
|
2879 |
return mapToReturn
|
|
|
2880 |
finally:
|
|
|
2881 |
close_session()
|
|
|
2882 |
|
|
|
2883 |
def updateReturnOrderInfo(self, returnInfo):
|
|
|
2884 |
try:
|
|
|
2885 |
return update_return_order_info(returnInfo)
|
|
|
2886 |
finally:
|
|
|
2887 |
close_session()
|
|
|
2888 |
|
|
|
2889 |
def bulkUpdateReturnOrderInfo(self, orderReturnInfosMap):
|
|
|
2890 |
try:
|
|
|
2891 |
return bulk_update_return_order_info(orderReturnInfosMap)
|
|
|
2892 |
finally:
|
|
|
2893 |
close_session()
|
|
|
2894 |
|
|
|
2895 |
def getReturnOrdersAsPerWarehouseId(self, warehouseId):
|
|
|
2896 |
"""
|
|
|
2897 |
Returns all return orders list as per warehouse
|
|
|
2898 |
|
|
|
2899 |
Parameters:
|
|
|
2900 |
- warehouseId
|
|
|
2901 |
"""
|
|
|
2902 |
try:
|
|
|
2903 |
all_returns_orders = get_return_orders_as_per_warehouse(warehouseId)
|
|
|
2904 |
return [to_t_returnOrderInfo(order) for order in all_returns_orders]
|
|
|
2905 |
finally:
|
|
|
2906 |
close_session()
|
|
|
2907 |
|
| 19735 |
manish.sha |
2908 |
def createReturnTransaction(self, returnTransaction, itemCondition, overrideWarranty):
|
| 19691 |
manish.sha |
2909 |
"""
|
|
|
2910 |
Create Return Ticket or Transaction for all Returns
|
|
|
2911 |
|
|
|
2912 |
Parameters:
|
|
|
2913 |
- returnTransaction Thrift Object
|
| 19735 |
manish.sha |
2914 |
- itemCondition
|
|
|
2915 |
- overrideWarranty
|
| 19691 |
manish.sha |
2916 |
"""
|
|
|
2917 |
try:
|
| 19814 |
kshitij.so |
2918 |
return to_t_returnTransaction(create_return_transaction(returnTransaction, itemCondition, overrideWarranty))
|
| 19691 |
manish.sha |
2919 |
finally:
|
|
|
2920 |
close_session()
|
|
|
2921 |
|
|
|
2922 |
def getReturnTransactionsForCustomer(self, statusList, customerMobile, customerEmail, returnTransactionId, customerId):
|
|
|
2923 |
"""
|
|
|
2924 |
Get all return transactions as per customer and status for sepcific time interval
|
|
|
2925 |
|
|
|
2926 |
Parameters:
|
|
|
2927 |
- statusList
|
|
|
2928 |
- customerMobile
|
|
|
2929 |
- customerEmail
|
|
|
2930 |
- returnTransactionId
|
|
|
2931 |
"""
|
|
|
2932 |
|
|
|
2933 |
try:
|
|
|
2934 |
transactions = get_return_transactions_for_customer(statusList, customerMobile, customerEmail, returnTransactionId, customerId)
|
|
|
2935 |
if transactions is None:
|
|
|
2936 |
return []
|
|
|
2937 |
else:
|
|
|
2938 |
return [to_t_returnTransaction(transaction) for transaction in transactions]
|
|
|
2939 |
finally:
|
|
|
2940 |
close_session()
|
|
|
2941 |
|
|
|
2942 |
def getReturnTransaction(self, id):
|
|
|
2943 |
"""
|
|
|
2944 |
Get Return Transaction as per given id
|
|
|
2945 |
|
|
|
2946 |
Parameters:
|
|
|
2947 |
- id
|
|
|
2948 |
"""
|
|
|
2949 |
try:
|
|
|
2950 |
return to_t_returnTransaction(get_return_transaction(id))
|
|
|
2951 |
finally:
|
|
|
2952 |
close_session()
|
|
|
2953 |
|
|
|
2954 |
def getReturnOrdersForReturnTransaction(self, returnTransactionId):
|
|
|
2955 |
"""
|
|
|
2956 |
Get Return Orders for given return transaction
|
|
|
2957 |
|
|
|
2958 |
Parameters:
|
|
|
2959 |
- returnTransactionId
|
|
|
2960 |
"""
|
|
|
2961 |
try:
|
|
|
2962 |
returnorders = get_return_orders_for_return_transaction(returnTransactionId)
|
|
|
2963 |
return [to_t_returnOrderInfo(returnorder) for returnorder in returnorders]
|
|
|
2964 |
finally:
|
|
|
2965 |
close_session()
|
|
|
2966 |
|
|
|
2967 |
def changeReturnTransactionStatus(self, returnTransactionId, new_status, returnOrdersIds):
|
|
|
2968 |
"""
|
|
|
2969 |
Change Return Transaction Status
|
|
|
2970 |
|
|
|
2971 |
Parameters:
|
|
|
2972 |
- returnTransactionId
|
|
|
2973 |
- new_status
|
|
|
2974 |
"""
|
|
|
2975 |
try:
|
|
|
2976 |
return change_return_transaction_status(returnTransactionId, new_status, returnOrdersIds)
|
|
|
2977 |
finally:
|
|
|
2978 |
close_session()
|
|
|
2979 |
|
|
|
2980 |
def createReturnPickupRequest(self, returnOrderIds, providerId):
|
|
|
2981 |
"""
|
|
|
2982 |
Create Return Pickup Request
|
|
|
2983 |
|
|
|
2984 |
Parameters
|
|
|
2985 |
- returnOrderIds
|
|
|
2986 |
- providerId
|
|
|
2987 |
"""
|
|
|
2988 |
try:
|
|
|
2989 |
return create_return_pickup_request(returnOrderIds, providerId)
|
|
|
2990 |
finally:
|
|
|
2991 |
close_session()
|
|
|
2992 |
|
|
|
2993 |
def updateReturnPickupRequest(self, returnPickupRequest):
|
|
|
2994 |
"""
|
|
|
2995 |
Update Return Pickup Request
|
|
|
2996 |
|
|
|
2997 |
Parameters
|
|
|
2998 |
- ReturnPickupRequest Object
|
|
|
2999 |
"""
|
|
|
3000 |
try:
|
|
|
3001 |
return update_return_pickup_request(returnPickupRequest)
|
|
|
3002 |
finally:
|
|
|
3003 |
close_session()
|
|
|
3004 |
|
|
|
3005 |
def receiveReturnPickup(self, returnOrdersMap, id):
|
|
|
3006 |
"""
|
|
|
3007 |
Receive Return Pickup
|
|
|
3008 |
|
|
|
3009 |
Parameters:
|
|
|
3010 |
- returnOrdersMap
|
|
|
3011 |
- id
|
|
|
3012 |
|
|
|
3013 |
"""
|
|
|
3014 |
try:
|
|
|
3015 |
return receive_return_pickup(returnOrdersMap, id)
|
|
|
3016 |
finally:
|
|
|
3017 |
close_session()
|
|
|
3018 |
|
|
|
3019 |
def validateReturnPickup(self, returnPickupId, returnOrdersMap):
|
|
|
3020 |
"""
|
|
|
3021 |
Validate Return Pickup
|
|
|
3022 |
|
|
|
3023 |
Parameters:
|
|
|
3024 |
- returnPickupId
|
|
|
3025 |
- returnOrdersMap
|
|
|
3026 |
"""
|
|
|
3027 |
try:
|
|
|
3028 |
return validate_return_pickup(returnPickupId, returnOrdersMap)
|
|
|
3029 |
finally:
|
|
|
3030 |
close_session()
|
|
|
3031 |
|
|
|
3032 |
def processReturnPickup(self, returnPickupId, returnOrdersMap):
|
|
|
3033 |
"""
|
|
|
3034 |
Process Return Pickup
|
|
|
3035 |
|
|
|
3036 |
Parameters:
|
|
|
3037 |
- returnPickupId
|
|
|
3038 |
- returnOrdersMap
|
|
|
3039 |
"""
|
|
|
3040 |
try:
|
|
|
3041 |
return process_return_pickup(returnPickupId, returnOrdersMap)
|
|
|
3042 |
finally:
|
|
|
3043 |
close_session()
|
|
|
3044 |
|
|
|
3045 |
def markReturnTransactionComplete(self, returnTransactionId):
|
|
|
3046 |
"""
|
|
|
3047 |
Mark Return Transaction Complete based upon the orders processed.
|
|
|
3048 |
|
|
|
3049 |
Parameters:
|
|
|
3050 |
- returnTransactionId
|
|
|
3051 |
"""
|
|
|
3052 |
try:
|
|
|
3053 |
return mark_return_transaction_complete(returnTransactionId)
|
|
|
3054 |
finally:
|
|
|
3055 |
close_session()
|
|
|
3056 |
|
|
|
3057 |
def refundReturnTransactionPayment(self, returnOrdersMap, returnTransactionId):
|
|
|
3058 |
"""
|
|
|
3059 |
Refund Return Transaction Payment
|
|
|
3060 |
|
|
|
3061 |
Parameters
|
|
|
3062 |
- returnOrdersMap
|
|
|
3063 |
- returnTransactionId
|
|
|
3064 |
"""
|
|
|
3065 |
|
|
|
3066 |
try:
|
|
|
3067 |
return refund_return_transaction_payment(returnOrdersMap, returnTransactionId)
|
|
|
3068 |
finally:
|
|
|
3069 |
close_session()
|
|
|
3070 |
|
| 19714 |
manish.sha |
3071 |
def getEligibleOrdersForReturn(self, customerId, itemCondition, overrideWarranty):
|
|
|
3072 |
"""
|
|
|
3073 |
Return Eligible Orders for Return Process
|
|
|
3074 |
|
|
|
3075 |
Parameters
|
|
|
3076 |
- customerId
|
|
|
3077 |
- itemCondition - (Damaged for return and Defective for DOA)
|
|
|
3078 |
- overrideWarranty for Admin so that he can return any order without any warranty.
|
|
|
3079 |
|
|
|
3080 |
"""
|
|
|
3081 |
try:
|
|
|
3082 |
orders = []
|
|
|
3083 |
eligibleOrders = get_eligible_orders_for_return(customerId, itemCondition, overrideWarranty)
|
|
|
3084 |
for order in eligibleOrders:
|
|
|
3085 |
orders.append(to_t_order(order))
|
|
|
3086 |
return orders
|
|
|
3087 |
finally:
|
|
|
3088 |
close_session()
|
|
|
3089 |
|
|
|
3090 |
def getEligibleReturnOrdersForPickup(self, customerId):
|
|
|
3091 |
"""
|
|
|
3092 |
Return All Eligible Return Orders awaiting pickup
|
|
|
3093 |
|
|
|
3094 |
Parameters
|
|
|
3095 |
- customerId
|
|
|
3096 |
|
|
|
3097 |
"""
|
|
|
3098 |
try:
|
|
|
3099 |
returnOrders = []
|
|
|
3100 |
eligibleReturnOrders = get_eligible_return_orders_for_pickup(customerId)
|
|
|
3101 |
for returnOrder in eligibleReturnOrders:
|
|
|
3102 |
returnOrders.append(to_t_returnOrderInfo(returnOrder))
|
|
|
3103 |
return returnOrders
|
|
|
3104 |
finally:
|
|
|
3105 |
close_session()
|
| 19735 |
manish.sha |
3106 |
|
|
|
3107 |
def validateReturnTransaction(self, customerId, returnOrdersMap, itemCondition, overrideWarranty):
|
|
|
3108 |
"""
|
|
|
3109 |
To Validate return transaction data
|
| 19714 |
manish.sha |
3110 |
|
| 19735 |
manish.sha |
3111 |
Parameters
|
|
|
3112 |
- customerId
|
|
|
3113 |
- returnOrdersMap
|
|
|
3114 |
- itemCondition
|
|
|
3115 |
- overrideWarranty
|
|
|
3116 |
"""
|
|
|
3117 |
try:
|
|
|
3118 |
return validate_return_transaction(customerId, returnOrdersMap, itemCondition, overrideWarranty)
|
|
|
3119 |
finally:
|
|
|
3120 |
close_session()
|
| 19817 |
manish.sha |
3121 |
|
|
|
3122 |
def markReturnNotRequiredOrdersProcessed(self, returnTransactionId):
|
|
|
3123 |
"""
|
|
|
3124 |
Mark Return Not Required Orders as Processed
|
| 19735 |
manish.sha |
3125 |
|
| 19817 |
manish.sha |
3126 |
Parameters
|
|
|
3127 |
- returnTransactionId
|
|
|
3128 |
"""
|
|
|
3129 |
try:
|
|
|
3130 |
return mark_return_not_required_orders_as_processed(returnTransactionId)
|
|
|
3131 |
finally:
|
|
|
3132 |
close_session()
|
|
|
3133 |
|
|
|
3134 |
def getReturnPickupRequest(self, returnPickupId):
|
|
|
3135 |
"""
|
|
|
3136 |
Get Particular Return Pickup Id
|
|
|
3137 |
Parameters
|
|
|
3138 |
- returnPickupId
|
|
|
3139 |
"""
|
|
|
3140 |
try:
|
|
|
3141 |
return to_t_rPickupRequest(get_return_pickup_request(returnPickupId))
|
|
|
3142 |
finally:
|
|
|
3143 |
close_session()
|
|
|
3144 |
|
| 19820 |
manish.sha |
3145 |
def getAllReturnOrdersForReturnPickupRequest(self, logisticsRequestId):
|
|
|
3146 |
try:
|
|
|
3147 |
returnOrders = []
|
|
|
3148 |
eligibleReturnOrders = get_all_return_orders_for_return_pickup_request(logisticsRequestId)
|
|
|
3149 |
for returnOrder in eligibleReturnOrders:
|
|
|
3150 |
returnOrders.append(to_t_returnOrderInfo(returnOrder))
|
|
|
3151 |
return returnOrders
|
|
|
3152 |
finally:
|
|
|
3153 |
close_session()
|
|
|
3154 |
|
| 19973 |
amit.gupta |
3155 |
def getSellerInfo(self, sellerId):
|
|
|
3156 |
try:
|
|
|
3157 |
return get_seller_info(sellerId)
|
|
|
3158 |
finally:
|
|
|
3159 |
close_session()
|
| 19980 |
amit.gupta |
3160 |
|
| 19983 |
amit.gupta |
3161 |
def getWarehouseAddress(self, addressId):
|
| 19980 |
amit.gupta |
3162 |
try:
|
|
|
3163 |
return get_warehouse_address(addressId)
|
|
|
3164 |
finally:
|
|
|
3165 |
close_session()
|
| 19973 |
amit.gupta |
3166 |
|
| 19817 |
manish.sha |
3167 |
|
| 14134 |
amit.gupta |
3168 |
def main():
|
|
|
3169 |
OrderServiceHandler().creditBatch(2, '{"483649":100.0, "8021773":23, "123213":10}')
|
|
|
3170 |
|
|
|
3171 |
if __name__ == '__main__':
|
|
|
3172 |
main()
|