| Line 68... |
Line 68... |
| 68 |
TransactionStatus, OrderStatus, DelayReason, ExtraTransactionProcessingType, \
|
68 |
TransactionStatus, OrderStatus, DelayReason, ExtraTransactionProcessingType, \
|
| 69 |
HotspotAction, TimeoutSummary, OrderStatusGroups, OrderType, RechargeOrderStatus, \
|
69 |
HotspotAction, TimeoutSummary, OrderStatusGroups, OrderType, RechargeOrderStatus, \
|
| 70 |
RechargeType, RechargeStatistics, DeviceNumberInfo, EmiChargeType, PayMethod, \
|
70 |
RechargeType, RechargeStatistics, DeviceNumberInfo, EmiChargeType, PayMethod, \
|
| 71 |
OrderSource, StorePaymentStatus, ProductCondition, TaxType, \
|
71 |
OrderSource, StorePaymentStatus, ProductCondition, TaxType, \
|
| 72 |
AmazonFCWarehouseLocation, RechargeMode
|
72 |
AmazonFCWarehouseLocation, RechargeMode
|
| 73 |
from shop2020.thriftpy.utils.ttypes import UserSmsInfo, SmsType
|
- |
|
| 74 |
from shop2020.thriftpy.model.v1.user.ttypes import VoucherType, CouponCategory, \
|
73 |
from shop2020.thriftpy.model.v1.user.ttypes import VoucherType, CouponCategory, \
|
| 75 |
User, Sex
|
74 |
User, Sex
|
| 76 |
from shop2020.thriftpy.payments.ttypes import PaymentException
|
75 |
from shop2020.thriftpy.payments.ttypes import PaymentException
|
| - |
|
76 |
from shop2020.thriftpy.utils.ttypes import UserSmsInfo, SmsType
|
| 77 |
from shop2020.thriftpy.warehouse.ttypes import ScanType, \
|
77 |
from shop2020.thriftpy.warehouse.ttypes import ScanType, \
|
| 78 |
WarehouseServiceException
|
78 |
WarehouseServiceException
|
| 79 |
from shop2020.utils.EmailAttachmentSender import mail, get_attachment_part, \
|
79 |
from shop2020.utils.EmailAttachmentSender import mail, get_attachment_part, \
|
| 80 |
mail_html
|
80 |
mail_html
|
| 81 |
from shop2020.utils.Utils import to_py_date, to_java_date, getAsyncOperatorsForRecharge
|
81 |
from shop2020.utils.Utils import to_py_date, to_java_date, \
|
| - |
|
82 |
getAsyncOperatorsForRecharge
|
| 82 |
from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound
|
83 |
from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound
|
| 83 |
from sqlalchemy.sql import func
|
84 |
from sqlalchemy.sql import func
|
| 84 |
from sqlalchemy.sql.expression import and_, or_, desc, not_, distinct, cast, \
|
85 |
from sqlalchemy.sql.expression import and_, or_, desc, not_, distinct, cast, \
|
| 85 |
between
|
86 |
between
|
| 86 |
from string import Template
|
87 |
from string import Template
|
| 87 |
from suds.client import Client
|
88 |
from suds.client import Client
|
| 88 |
from textwrap import dedent
|
89 |
from textwrap import dedent
|
| 89 |
from xml.dom.minidom import parseString
|
90 |
from xml.dom.minidom import parseString
|
| 90 |
import base64
|
91 |
import base64
|
| 91 |
import base64
|
92 |
import base64
|
| 92 |
import re
|
- |
|
| 93 |
import datetime
|
93 |
import datetime
|
| 94 |
import httplib
|
94 |
import httplib
|
| 95 |
import logging
|
95 |
import logging
|
| 96 |
import os
|
96 |
import os
|
| - |
|
97 |
import re
|
| 97 |
import sys
|
98 |
import sys
|
| 98 |
import time
|
99 |
import time
|
| 99 |
import traceback
|
100 |
import traceback
|
| 100 |
import urllib
|
101 |
import urllib
|
| 101 |
#Start:- Added By Manish Sharma for Creating a new Ticket: Category- RTO Refund on 21-Jun-2013
|
102 |
#Start:- Added By Manish Sharma for Creating a new Ticket: Category- RTO Refund on 21-Jun-2013
|
| Line 5648... |
Line 5649... |
| 5648 |
rechargeTransaction.invoiceNumber = get_next_invoice_number(OrderType.RCH4HOTSPOT)
|
5649 |
rechargeTransaction.invoiceNumber = get_next_invoice_number(OrderType.RCH4HOTSPOT)
|
| 5649 |
session.commit()
|
5650 |
session.commit()
|
| 5650 |
|
5651 |
|
| 5651 |
|
5652 |
|
| 5652 |
def create_recharge_transaction(t_recharge):
|
5653 |
def create_recharge_transaction(t_recharge):
|
| - |
|
5654 |
if t_recharge.deviceNum in ('9435070973','9818682439','83760333153','9459060666'):
|
| - |
|
5655 |
pass
|
| - |
|
5656 |
else:
|
| - |
|
5657 |
raise TransactionServiceException(898, "In last 10 minutes you had already recharged this mobile number. Please try after sometime.")
|
| 5653 |
dt = datetime.datetime.now() - datetime.timedelta(minutes=10)
|
5658 |
dt = datetime.datetime.now() - datetime.timedelta(minutes=10)
|
| 5654 |
txns = RechargeTransaction.query.filter(RechargeTransaction.deviceNum == t_recharge.deviceNum).filter(RechargeTransaction.transactionTime > dt).all()
|
5659 |
txns = RechargeTransaction.query.filter(RechargeTransaction.deviceNum == t_recharge.deviceNum).filter(RechargeTransaction.transactionTime > dt).all()
|
| 5655 |
if txns:
|
5660 |
if txns:
|
| 5656 |
raise TransactionServiceException(898, "In last 10 minutes you had already recharged this mobile number. Please try after sometime.")
|
5661 |
raise TransactionServiceException(898, "In last 10 minutes you had already recharged this mobile number. Please try after sometime.")
|
| 5657 |
rechargeTransaction = RechargeTransaction()
|
5662 |
rechargeTransaction = RechargeTransaction()
|
| Line 7256... |
Line 7261... |
| 7256 |
else:
|
7261 |
else:
|
| 7257 |
invoiceNo = get_next_invoice_number(orders[0].orderType)
|
7262 |
invoiceNo = get_next_invoice_number(orders[0].orderType)
|
| 7258 |
for order in orders:
|
7263 |
for order in orders:
|
| 7259 |
order.invoice_number = invoiceNo
|
7264 |
order.invoice_number = invoiceNo
|
| 7260 |
session.commit()
|
7265 |
session.commit()
|
| 7261 |
|
7266 |
|
| 7262 |
def get_fa_order_by_fk_order_id(fk_OrderId,fk_OrderItemId):
|
7267 |
def get_fa_order_by_fk_order_id(fk_OrderId,fk_OrderItemId):
|
| 7263 |
faOrder = FlipkartAdvantageOrder.query.filter_by(fkOrderId=fk_OrderId,fkOrderItemId=fk_OrderItemId).first()
|
7268 |
faOrder = FlipkartAdvantageOrder.query.filter_by(fkOrderId=fk_OrderId,fkOrderItemId=fk_OrderItemId).first()
|
| 7264 |
if not faOrder:
|
7269 |
if not faOrder:
|
| 7265 |
print "Not found order for orderId " + str(fk_OrderId)
|
7270 |
print "Not found order for orderId " + str(fk_OrderId)
|
| 7266 |
raise TransactionServiceException(108, "no such order")
|
7271 |
raise TransactionServiceException(108, "no such order")
|
| Line 7363... |
Line 7368... |
| 7363 |
def get_recharge_transaction_status(rechargeTransactionId, final):
|
7368 |
def get_recharge_transaction_status(rechargeTransactionId, final):
|
| 7364 |
d_rechargeTransaction = get_recharge_transaction(rechargeTransactionId)
|
7369 |
d_rechargeTransaction = get_recharge_transaction(rechargeTransactionId)
|
| 7365 |
if d_rechargeTransaction.status == RechargeOrderStatus.RECHARGE_IN_PROCESS:
|
7370 |
if d_rechargeTransaction.status == RechargeOrderStatus.RECHARGE_IN_PROCESS:
|
| 7366 |
try:
|
7371 |
try:
|
| 7367 |
status, description = RechargeService.checkTransactionStatus('', str(rechargeTransactionId))
|
7372 |
status, description = RechargeService.checkTransactionStatus('', str(rechargeTransactionId))
|
| - |
|
7373 |
d_rechargeTransaction.description = description
|
| 7368 |
print status, description
|
7374 |
print status, description
|
| 7369 |
if status:
|
7375 |
if status:
|
| 7370 |
update_recharge_transaction_status(rechargeTransactionId, RechargeOrderStatus.RECHARGE_SUCCESSFUL)
|
7376 |
update_recharge_transaction_status(rechargeTransactionId, RechargeOrderStatus.RECHARGE_SUCCESSFUL)
|
| 7371 |
else:
|
7377 |
else:
|
| 7372 |
update_recharge_transaction_status(rechargeTransactionId, RechargeOrderStatus.RECHARGE_FAILED)
|
7378 |
update_recharge_transaction_status(rechargeTransactionId, RechargeOrderStatus.RECHARGE_FAILED)
|