| Line 36... |
Line 36... |
| 36 |
OrderInventory, Alert, PaymentSettlement, EBSSettlementSummary, \
|
36 |
OrderInventory, Alert, PaymentSettlement, EBSSettlementSummary, \
|
| 37 |
CodVerificationAgent, Attribute, RechargeVoucherTracker, EmiScheme, MiscCharges, \
|
37 |
CodVerificationAgent, Attribute, RechargeVoucherTracker, EmiScheme, MiscCharges, \
|
| 38 |
BlockedIpRange, DeniedIpAddress, InsuranceDetailForOrder, DocumentStore, \
|
38 |
BlockedIpRange, DeniedIpAddress, InsuranceDetailForOrder, DocumentStore, \
|
| 39 |
RechargeTransaction, HotspotStore, WalletForCompany, WalletHistoryForCompany, \
|
39 |
RechargeTransaction, HotspotStore, WalletForCompany, WalletHistoryForCompany, \
|
| 40 |
FRC, OperatorSeries, SourceDetail, Company, \
|
40 |
FRC, OperatorSeries, SourceDetail, Company, \
|
| 41 |
AmazonOrder, StoreOrderDetail, EdcBank
|
41 |
AmazonOrder, StoreOrderDetail, EdcBank, StoreOrderCollection
|
| 42 |
from shop2020.model.v1.order.impl.model.BaseOrder import BaseOrder
|
42 |
from shop2020.model.v1.order.impl.model.BaseOrder import BaseOrder
|
| 43 |
from shop2020.model.v1.order.impl.model.DTHRechargeOrder import DTHRechargeOrder
|
43 |
from shop2020.model.v1.order.impl.model.DTHRechargeOrder import DTHRechargeOrder
|
| 44 |
from shop2020.model.v1.order.impl.model.MobileRechargeOrder import \
|
44 |
from shop2020.model.v1.order.impl.model.MobileRechargeOrder import \
|
| 45 |
MobileRechargeOrder
|
45 |
MobileRechargeOrder
|
| 46 |
from shop2020.model.v1.order.impl.model.RechargeDenomination import \
|
46 |
from shop2020.model.v1.order.impl.model.RechargeDenomination import \
|
| Line 67... |
Line 67... |
| 67 |
StorePaymentStatus
|
67 |
StorePaymentStatus
|
| 68 |
from shop2020.thriftpy.model.v1.user.ttypes import VoucherType
|
68 |
from shop2020.thriftpy.model.v1.user.ttypes import VoucherType
|
| 69 |
from shop2020.thriftpy.payments.ttypes import PaymentException
|
69 |
from shop2020.thriftpy.payments.ttypes import PaymentException
|
| 70 |
from shop2020.thriftpy.warehouse.ttypes import ScanType, \
|
70 |
from shop2020.thriftpy.warehouse.ttypes import ScanType, \
|
| 71 |
WarehouseServiceException
|
71 |
WarehouseServiceException
|
| 72 |
from shop2020.utils.EmailAttachmentSender import mail, get_attachment_part
|
72 |
from shop2020.utils.EmailAttachmentSender import mail, get_attachment_part,\
|
| - |
|
73 |
mail_html
|
| 73 |
from shop2020.utils.Utils import to_py_date, to_java_date
|
74 |
from shop2020.utils.Utils import to_py_date, to_java_date
|
| 74 |
from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound
|
75 |
from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound
|
| 75 |
from sqlalchemy.sql import func
|
76 |
from sqlalchemy.sql import func
|
| 76 |
from sqlalchemy.sql.expression import and_, or_, desc, not_, distinct, cast, \
|
77 |
from sqlalchemy.sql.expression import and_, or_, desc, not_, distinct, cast, \
|
| 77 |
between
|
78 |
between
|
| Line 2786... |
Line 2787... |
| 2786 |
pdf.showPage()
|
2787 |
pdf.showPage()
|
| 2787 |
pdf.save()
|
2788 |
pdf.save()
|
| 2788 |
return filename
|
2789 |
return filename
|
| 2789 |
|
2790 |
|
| 2790 |
def __push_store_collection_to_hotspot(order, ctype, amount):
|
2791 |
def __push_store_collection_to_hotspot(order, ctype, amount):
|
| 2791 |
try:
|
- |
|
| 2792 |
ts = order.created_timestamp
|
2792 |
ts = datetime.datetime.now()
|
| 2793 |
store = get_hotspot_store(order.storeId, "")
|
2793 |
store = get_hotspot_store(order.storeId, "")
|
| 2794 |
storeName = store.hotspotId
|
- |
|
| 2795 |
store_string = "<Store>" + storeName + "</Store>"
|
- |
|
| 2796 |
order_string = "<OrderID>" + str(order.id) + "</OrderID>"
|
- |
|
| 2797 |
product_string = "<Product>" + str(order.lineitems[0]) + "</Product>"
|
- |
|
| 2798 |
collection_type = "<CollectionType>" + ctype + "</CollectionType>"
|
- |
|
| 2799 |
amount_string = "<AdvanceAmount>" + amount + "</AdvanceAmount>"
|
- |
|
| 2800 |
date_string = "<TimeStamp>" + ts.strftime("%Y%m%d%H%M%S") + "</TimeStamp>"
|
- |
|
| 2801 |
cash_string = "<CashAmount>" + order.advanceAmount + "</CashAmount>"
|
- |
|
| 2802 |
card_string = "<CardAmount>" + "0" + "</CardAmount>"
|
- |
|
| 2803 |
|
- |
|
| 2804 |
#advance, saleClosure, advanceRefund, saleRefund
|
- |
|
| 2805 |
|
- |
|
| 2806 |
conn = httplib.HTTPConnection("182.71.104.186")
|
- |
|
| 2807 |
XML="""
|
- |
|
| 2808 |
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
- |
|
| 2809 |
<soap:Body>
|
- |
|
| 2810 |
<SaholicAdvanceTransfer xmlns="http://tempuri.org/">
|
- |
|
| 2811 |
"""
|
- |
|
| 2812 |
|
- |
|
| 2813 |
XML = XML + store_string + order_string + product_string + collection_type + amount_string + cash_string + card_string + date_string
|
- |
|
| 2814 |
|
- |
|
| 2815 |
footer = """
|
- |
|
| 2816 |
</SaholicAdvanceTransfer>
|
- |
|
| 2817 |
</soap:Body>
|
- |
|
| 2818 |
</soap:Envelope>
|
- |
|
| 2819 |
"""
|
- |
|
| 2820 |
XML = XML + footer
|
- |
|
| 2821 |
|
2794 |
|
| - |
|
2795 |
soc = StoreOrderCollection()
|
| - |
|
2796 |
soc.hotspotId = store.hotspotId
|
| - |
|
2797 |
soc.orderId = order.id
|
| - |
|
2798 |
soc.collectionType = ctype
|
| - |
|
2799 |
soc.advanceAmount = int(amount)
|
| - |
|
2800 |
soc.productName = str(order.lineitems[0])
|
| - |
|
2801 |
soc.addedAt = ts
|
| - |
|
2802 |
soc.pushedToOcr = False
|
| - |
|
2803 |
soc.cash = int(amount)
|
| - |
|
2804 |
soc.card = 0
|
| - |
|
2805 |
session.commit()
|
| - |
|
2806 |
|
| - |
|
2807 |
try:
|
| - |
|
2808 |
rcs = StoreOrderCollection.query.filter(StoreOrderCollection.pushedToOcr == False).all()
|
| - |
|
2809 |
for cs in rcs:
|
| - |
|
2810 |
store_string = "<Store>" + cs.hotspotId + "</Store>"
|
| - |
|
2811 |
order_string = "<OrderID>" + str(cs.orderId) + "</OrderID>"
|
| - |
|
2812 |
product_string = "<Product>" + cs.productName + "</Product>"
|
| - |
|
2813 |
collection_type = "<CollectionType>" + cs.collectionType + "</CollectionType>"
|
| - |
|
2814 |
amount_string = "<AdvanceAmount>" + str(cs.advanceAmount) + "</AdvanceAmount>"
|
| - |
|
2815 |
date_string = "<Date>" + cs.addedAt.strftime("%Y%m%d") + "</Date>"
|
| - |
|
2816 |
time_string = "<Time>" + cs.addedAt.strftime("%H%M%S") + "</Time>"
|
| - |
|
2817 |
cash_string = "<CashAmount>" + str(cs.cash) + "</CashAmount>"
|
| - |
|
2818 |
card_string = "<CardAmount>" + str(cs.card) + "</CardAmount>"
|
| - |
|
2819 |
|
| - |
|
2820 |
#advance, saleClosure, advanceRefund, cashRefund, cardRefund
|
| - |
|
2821 |
|
| - |
|
2822 |
conn = httplib.HTTPConnection("182.71.104.186")
|
| - |
|
2823 |
XML="""
|
| - |
|
2824 |
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
| - |
|
2825 |
<soap:Body>
|
| - |
|
2826 |
<SaholicAdvanceTransfer xmlns="http://tempuri.org/">
|
| - |
|
2827 |
"""
|
| - |
|
2828 |
|
| - |
|
2829 |
XML = XML + store_string + order_string + product_string + collection_type + amount_string + cash_string + card_string + time_string + date_string
|
| - |
|
2830 |
|
| - |
|
2831 |
footer = """
|
| - |
|
2832 |
</SaholicAdvanceTransfer>
|
| - |
|
2833 |
</soap:Body>
|
| - |
|
2834 |
</soap:Envelope>
|
| - |
|
2835 |
"""
|
| - |
|
2836 |
XML = XML + footer
|
| - |
|
2837 |
|
| 2822 |
params = urllib.urlencode({'op': 'SaholicAdvanceTransfer'})
|
2838 |
params = urllib.urlencode({'op': 'SaholicAdvanceTransfer'})
|
| 2823 |
headers = { "Content-type": "text/xml", "Content-Length": "%d" % len(XML)}
|
2839 |
headers = { "Content-type": "text/xml", "Content-Length": "%d" % len(XML)}
|
| 2824 |
conn.request("POST", "/loaddetect/Service.asmx?"+params, "", headers)
|
2840 |
conn.request("POST", "/loaddetect/Service.asmx?"+params, "", headers)
|
| 2825 |
conn.send(XML)
|
2841 |
conn.send(XML)
|
| 2826 |
response = conn.getresponse()
|
2842 |
response = conn.getresponse()
|
| 2827 |
print response.status, response.reason
|
2843 |
print response.status, response.reason
|
| 2828 |
resp = response.read()
|
2844 |
resp = response.read()
|
| 2829 |
conn.close()
|
2845 |
conn.close()
|
| 2830 |
print resp
|
2846 |
print resp
|
| 2831 |
if "Saved Successfully" in resp:
|
2847 |
if "Saved Successfully" in resp:
|
| 2832 |
return True
|
2848 |
cs.pushedToOcr = True
|
| 2833 |
elif "Error in Saving Data" in resp:
|
2849 |
cs.pushedAt = datetime.datetime.now()
|
| 2834 |
return False
|
2850 |
session.commit()
|
| 2835 |
else:
|
2851 |
elif "Error in Saving Data" in resp:
|
| - |
|
2852 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["rajveer.singh@shop2020.in", "anupam.singh@shop2020.in", "rajneesh.arora@shop2020.in"], "Problem while pushing store collection to OCR", resp, [])
|
| 2836 |
return False
|
2853 |
else:
|
| 2837 |
except Exception as e:
|
- |
|
| - |
|
2854 |
mail_html("cnc.center@shop2020.in", "5h0p2o2o", ["rajveer.singh@shop2020.in", "anupam.singh@shop2020.in", "rajneesh.arora@shop2020.in"], "Problem while pushing store collection to OCR", resp, [])
|
| 2838 |
print e
|
2855 |
except:
|
| 2839 |
return False
|
2856 |
print "Problem while pushing to ocr"
|
| 2840 |
|
2857 |
|
| 2841 |
def __push_collection_to_hotspot(order, type, storeOrder = False):
|
2858 |
def __push_collection_to_hotspot(order, type, storeOrder = False):
|
| 2842 |
try:
|
2859 |
try:
|
| 2843 |
storeName = '109'
|
2860 |
storeName = '109'
|
| 2844 |
if storeOrder:
|
2861 |
if storeOrder:
|