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