| Line 9605... |
Line 9605... |
| 9605 |
new_order.lineitems[0].total_price = new_order.lineitems[0].unit_price*split_order_quantity
|
9605 |
new_order.lineitems[0].total_price = new_order.lineitems[0].unit_price*split_order_quantity
|
| 9606 |
new_order.lineitems[0].total_weight = new_order.lineitems[0].unit_weight*split_order_quantity
|
9606 |
new_order.lineitems[0].total_weight = new_order.lineitems[0].unit_weight*split_order_quantity
|
| 9607 |
new_order.total_amount = new_order.lineitems[0].total_price
|
9607 |
new_order.total_amount = new_order.lineitems[0].total_price
|
| 9608 |
new_order.total_weight = new_order.lineitems[0].total_weight
|
9608 |
new_order.total_weight = new_order.lineitems[0].total_weight
|
| 9609 |
new_order.shippingCost = round((order.shippingCost/order.lineitems[0].quantity)*split_order_quantity,0)
|
9609 |
new_order.shippingCost = round((order.shippingCost/order.lineitems[0].quantity)*split_order_quantity,0)
|
| - |
|
9610 |
new_order.shippingRefund = round((order.shippingRefund/order.lineitems[0].quantity)*split_order_quantity,0)
|
| 9610 |
order.lineitems[0].quantity = order.lineitems[0].quantity - split_order_quantity
|
9611 |
order.lineitems[0].quantity = order.lineitems[0].quantity - split_order_quantity
|
| 9611 |
order.lineitems[0].total_price = order.lineitems[0].unit_price * order.lineitems[0].quantity
|
9612 |
order.lineitems[0].total_price = order.lineitems[0].unit_price * order.lineitems[0].quantity
|
| 9612 |
order.lineitems[0].total_weight = order.lineitems[0].unit_weight*order.lineitems[0].quantity
|
9613 |
order.lineitems[0].total_weight = order.lineitems[0].unit_weight*order.lineitems[0].quantity
|
| 9613 |
order.total_amount = order.lineitems[0].total_price
|
9614 |
order.total_amount = order.lineitems[0].total_price
|
| 9614 |
order.total_weight = order.lineitems[0].total_weight
|
9615 |
order.total_weight = order.lineitems[0].total_weight
|
| Line 11546... |
Line 11547... |
| 11546 |
ap.cash_back_type = "PERCENTAGE"
|
11547 |
ap.cash_back_type = "PERCENTAGE"
|
| 11547 |
ap.cash_back_amount = int(math.floor(amount * .01))
|
11548 |
ap.cash_back_amount = int(math.floor(amount * .01))
|
| 11548 |
session.commit()
|
11549 |
session.commit()
|
| 11549 |
add_amount_in_wallet(userId, ap.amount + ap.cash_back_amount, ap.id, WalletReferenceType.ADVANCE_AMOUNT, True, True)
|
11550 |
add_amount_in_wallet(userId, ap.amount + ap.cash_back_amount, ap.id, WalletReferenceType.ADVANCE_AMOUNT, True, True)
|
| 11550 |
return True
|
11551 |
return True
|
| - |
|
11552 |
|
| - |
|
11553 |
#refund complete shipping if type is list else as per map
|
| - |
|
11554 |
def __refund_shipping(orders, commit=True):
|
| - |
|
11555 |
if type(orders) is list:
|
| - |
|
11556 |
for order in orders:
|
| - |
|
11557 |
order.shippingRefund = order.shippingCost
|
| - |
|
11558 |
add_amount_in_wallet(order.customer_id, order.shippingCost, order.transaction_id, WalletReferenceType.SHIPPING_REFUND, False, False)
|
| - |
|
11559 |
if commit:
|
| - |
|
11560 |
session.commit()
|
| - |
|
11561 |
|
| - |
|
11562 |
def mark_order_for_selfpickup(transaction_ids):
|
| - |
|
11563 |
for transaction_id in transaction_id:
|
| - |
|
11564 |
transaction = get_transaction(transaction_id)
|
| - |
|
11565 |
user_client = UserClient().get_client()
|
| - |
|
11566 |
counter = user_client.getCounterByUserId(transaction.customer_id)
|
| - |
|
11567 |
address = user_client.getAddressById(counter.address)
|
| - |
|
11568 |
for order in transaction.orders:
|
| - |
|
11569 |
oa = Attribute()
|
| - |
|
11570 |
oa.value = counter.tin
|
| - |
|
11571 |
oa.name='tinNumber'
|
| - |
|
11572 |
oa.orderId = order.id
|
| - |
|
11573 |
|
| - |
|
11574 |
order.customer_name = address.name
|
| - |
|
11575 |
order.customer_pincode = address.pin
|
| - |
|
11576 |
order.customer_address1 = address.line1
|
| - |
|
11577 |
order.customer_address2 = address.line2
|
| - |
|
11578 |
order.customer_city = address.city
|
| - |
|
11579 |
order.customer_state = address.state
|
| - |
|
11580 |
order.orderType = OrderType.B2B
|
| - |
|
11581 |
#Self Pickup
|
| - |
|
11582 |
order.logistics_provider_id = 4
|
| - |
|
11583 |
__refund_shipping(transaction.orders, False)
|
| - |
|
11584 |
session.commit()
|
| - |
|
11585 |
session.close()
|
| - |
|
11586 |
|
| 11551 |
|
11587 |
|
| 11552 |
if __name__ == '__main__':
|
11588 |
if __name__ == '__main__':
|
| 11553 |
DataService.initialize()
|
11589 |
DataService.initialize()
|
| - |
|
11590 |
transaction_ids=[]
|
| - |
|
11591 |
mark_order_for_selfpickup(transaction_ids)
|
| 11554 |
# get_billed_orders_for_manifest_gen(7441, 2, True)
|
11592 |
# get_billed_orders_for_manifest_gen(7441, 2, True)
|
| 11555 |
# ordersmap = {'911319502886601':1544266,'911319502890314':1544266,'x911319502903141':1544269,'x911319502916655':1544269,'x911319502950985':1544269,'x911319502836309':1544269,'x911319502972369':1544269,'x911319502950860':1544269,'x911319502918313':1544269,
|
11593 |
# ordersmap = {'911319502886601':1544266,'911319502890314':1544266,'x911319502903141':1544269,'x911319502916655':1544269,'x911319502950985':1544269,'x911319502836309':1544269,'x911319502972369':1544269,'x911319502950860':1544269,'x911319502918313':1544269,
|
| 11556 |
# 'x911319502943436':1544269,'x911319502928056':1544269,'x911319502838263':1544269,'911319502794144':1544269,'x911319502821616':1544269,'x911319502974746':1544269,'x911319502821442':1544269,'x911319502903984':1544269,'x911319502820980':1544269,
|
11594 |
# 'x911319502943436':1544269,'x911319502928056':1544269,'x911319502838263':1544269,'911319502794144':1544269,'x911319502821616':1544269,'x911319502974746':1544269,'x911319502821442':1544269,'x911319502903984':1544269,'x911319502820980':1544269,
|
| 11557 |
# 'x911319502973102':1544269,'x911319502913009':1544269,'x911319502973979':1544269,'x911319502842729':1544269,'x911319502824784':1544269,'x911319502847249':1544269,'x911319502848387':1544269,'x911319502887021':1544269,'x911319502962634':1544269,
|
11595 |
# 'x911319502973102':1544269,'x911319502913009':1544269,'x911319502973979':1544269,'x911319502842729':1544269,'x911319502824784':1544269,'x911319502847249':1544269,'x911319502848387':1544269,'x911319502887021':1544269,'x911319502962634':1544269,
|
| 11558 |
# 'x911319502826268':1544269,'x911319502785761':1544269,'x911319502956750':1544269,'x911319502825195':1544269,'x911319502828298':1544269,'x911319502972054':1544269,'x911319502902044':1544269,'x911319502846498':1544269,'x911319502824305':1544269,
|
11596 |
# 'x911319502826268':1544269,'x911319502785761':1544269,'x911319502956750':1544269,'x911319502825195':1544269,'x911319502828298':1544269,'x911319502972054':1544269,'x911319502902044':1544269,'x911319502846498':1544269,'x911319502824305':1544269,
|
| Line 11577... |
Line 11615... |
| 11577 |
#pincodes = [302006,263139,781001,834001,380051,380001,110074,400095,560037,125055,122001,700009,400709,462022,700023,400015]
|
11615 |
#pincodes = [302006,263139,781001,834001,380051,380001,110074,400095,560037,125055,122001,700009,400709,462022,700023,400015]
|
| 11578 |
#logistics_client = LogisticsClient().get_client()
|
11616 |
#logistics_client = LogisticsClient().get_client()
|
| 11579 |
#for pincode in pincodes:
|
11617 |
#for pincode in pincodes:
|
| 11580 |
# print pincode, logistics_client.getLogisticsEstimation(26385, str(pincode), 1).providerId
|
11618 |
# print pincode, logistics_client.getLogisticsEstimation(26385, str(pincode), 1).providerId
|
| 11581 |
|
11619 |
|
| 11582 |
# transaction_id=[1,2,3]
|
- |
|
| 11583 |
# for transaction_id in transaction_id:
|
- |
|
| 11584 |
# transaction = get_transaction(transaction_id)
|
- |
|
| 11585 |
# user_client = UserClient().get_client()
|
- |
|
| 11586 |
# oa = Attribute()
|
- |
|
| 11587 |
# counter = user_client.getCounterByUserId(transaction.customer_id)
|
- |
|
| 11588 |
# oa.value = counter.tin
|
- |
|
| 11589 |
# address = user_client.getAddressById(counter.address)
|
- |
|
| 11590 |
# shipping_refund = 0
|
- |
|
| 11591 |
# net_payable = 0
|
- |
|
| 11592 |
# for order in transaction.orders:
|
- |
|
| 11593 |
# oa.name='tinNumber'
|
- |
|
| 11594 |
# oa.orderId = order.id
|
- |
|
| 11595 |
#
|
- |
|
| 11596 |
# order.customer_name = address.name
|
- |
|
| 11597 |
# order.customer_pincode = address.pin
|
- |
|
| 11598 |
# order.customer_address1 = address.line1
|
- |
|
| 11599 |
# order.customer_address2 = address.line2
|
- |
|
| 11600 |
# order.customer_city = address.city
|
- |
|
| 11601 |
# order.customer_state = address.state
|
- |
|
| 11602 |
# order.orderType = OrderType.B2B
|
- |
|
| 11603 |
# order.logistics_provider_id = 4 #Self Pickup
|
- |
|
| 11604 |
# shipping_refund += order.shippingCost
|
- |
|
| 11605 |
# net_payable += order.net_payable_amount
|
- |
|
| 11606 |
# order.shippingCost = 0
|
- |
|
| 11607 |
# if shipping_refund > 0 and net_payable==0:
|
- |
|
| 11608 |
# add_amount_in_wallet(order.customer_id, order.shippingCost, order.transaction_id, WalletReferenceType.REFUND, False, False)
|
- |
|
| 11609 |
# payment_client = PaymentClient().get_client()
|
- |
|
| 11610 |
# payment_client.
|
- |
|
| 11611 |
# payments = payment_client.refundPayment(transaction_id, shipping_refund, False)
|
- |
|
| 11612 |
# session.commit()
|
- |
|
| 11613 |
|
11620 |
|