| Line 67... |
Line 67... |
| 67 |
from shop2020.thriftpy.model.v1.order.ttypes import TransactionServiceException, \
|
67 |
from shop2020.thriftpy.model.v1.order.ttypes import TransactionServiceException, \
|
| 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
|
72 |
AmazonFCWarehouseLocation, RechargeMode
|
| 73 |
from shop2020.thriftpy.utils.ttypes import UserSmsInfo, SmsType
|
73 |
from shop2020.thriftpy.utils.ttypes import UserSmsInfo, SmsType
|
| 74 |
from shop2020.thriftpy.model.v1.user.ttypes import VoucherType, CouponCategory, \
|
74 |
from shop2020.thriftpy.model.v1.user.ttypes import VoucherType, CouponCategory, \
|
| 75 |
User, Sex
|
75 |
User, Sex
|
| 76 |
from shop2020.thriftpy.payments.ttypes import PaymentException
|
76 |
from shop2020.thriftpy.payments.ttypes import PaymentException
|
| 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
|
81 |
from shop2020.utils.Utils import to_py_date, to_java_date, getAsyncOperatorsForRecharge
|
| 82 |
from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound
|
82 |
from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound
|
| 83 |
from sqlalchemy.sql import func
|
83 |
from sqlalchemy.sql import func
|
| 84 |
from sqlalchemy.sql.expression import and_, or_, desc, not_, distinct, cast, \
|
84 |
from sqlalchemy.sql.expression import and_, or_, desc, not_, distinct, cast, \
|
| 85 |
between
|
85 |
between
|
| 86 |
from string import Template
|
86 |
from string import Template
|
| Line 885... |
Line 885... |
| 885 |
email_header = Template(html_header).substitute(dict(order_date = formated_order_date, customer_name = customer_name, source_url = source_url, otgLink = otgLink, saddress = saddress))
|
885 |
email_header = Template(html_header).substitute(dict(order_date = formated_order_date, customer_name = customer_name, source_url = source_url, otgLink = otgLink, saddress = saddress))
|
| 886 |
email_footer = Template(html_footer).substitute(dict(total_amount = "%.2f" % total_amount, emi_amount = "%.2f" % emi_amount, advance_amount = "%.2f" % advance_amount, net_amount = "%.2f" % (total_amount-order.gvAmount), secret_code = random_text, store_address = store_address, store_delivery_date = store_delivery_date, source_url = source_url, source_name = source_name, amount_string = amount_string))
|
886 |
email_footer = Template(html_footer).substitute(dict(total_amount = "%.2f" % total_amount, emi_amount = "%.2f" % emi_amount, advance_amount = "%.2f" % advance_amount, net_amount = "%.2f" % (total_amount-order.gvAmount), secret_code = random_text, store_address = store_address, store_delivery_date = store_delivery_date, source_url = source_url, source_name = source_name, amount_string = amount_string))
|
| 887 |
|
887 |
|
| 888 |
if otgSms:
|
888 |
if otgSms:
|
| 889 |
smsText = smsText +" Order comes under On Time Guarantee We Pay if we Delay. T&C Apply"
|
889 |
smsText = smsText +" Order comes under On Time Guarantee We Pay if we Delay. T&C Apply"
|
| 890 |
|
890 |
|
| 891 |
try:
|
891 |
try:
|
| 892 |
helper_client = HelperClient().get_client()
|
892 |
helper_client = HelperClient().get_client()
|
| 893 |
helper_client.saveUserEmailForSending([user_email], "", subject, email_header + html_table + email_footer, str(transaction_id), "TransactionInfo", [], bcc, orders[0].source)
|
893 |
helper_client.saveUserEmailForSending([user_email], "", subject, email_header + html_table + email_footer, str(transaction_id), "TransactionInfo", [], bcc, orders[0].source)
|
| 894 |
send_transaction_sms(customerId, mobileNo, smsText, SmsType.TRANSACTIONAL)
|
894 |
send_transaction_sms(customerId, mobileNo, smsText, SmsType.TRANSACTIONAL)
|
| 895 |
return True
|
895 |
return True
|
| Line 4597... |
Line 4597... |
| 4597 |
update_amount_in_wallet(recharge_order.userId, recharge_order.walletAmount, recharge_order.id, 1)
|
4597 |
update_amount_in_wallet(recharge_order.userId, recharge_order.walletAmount, recharge_order.id, 1)
|
| 4598 |
update_amount_in_wallet(recharge_order.userId, recharge_order.totalAmount - recharge_order.walletAmount - recharge_order.couponAmount, recharge_order.id, 0)
|
4598 |
update_amount_in_wallet(recharge_order.userId, recharge_order.totalAmount - recharge_order.walletAmount - recharge_order.couponAmount, recharge_order.id, 0)
|
| 4599 |
session.commit()
|
4599 |
session.commit()
|
| 4600 |
return False
|
4600 |
return False
|
| 4601 |
except:
|
4601 |
except:
|
| - |
|
4602 |
if isinstance(recharge_order, MobileRechargeOrder):
|
| - |
|
4603 |
if recharge_order.mobileOperatorId in (getAsyncOperatorsForRecharge()):
|
| - |
|
4604 |
return False
|
| - |
|
4605 |
if isinstance(recharge_order, DTHRechargeOrder):
|
| - |
|
4606 |
if recharge_order.dthOperatorId in (getAsyncOperatorsForRecharge()):
|
| - |
|
4607 |
return False
|
| 4602 |
transaction_requiring_extra_processing = TransactionRequiringExtraProcessing()
|
4608 |
transaction_requiring_extra_processing = TransactionRequiringExtraProcessing()
|
| 4603 |
transaction_requiring_extra_processing.category = 'RECHARGE_UNKNOWN'
|
4609 |
transaction_requiring_extra_processing.category = 'RECHARGE_UNKNOWN'
|
| 4604 |
transaction_requiring_extra_processing.transaction_id = recharge_order.transaction_id
|
4610 |
transaction_requiring_extra_processing.transaction_id = recharge_order.transaction_id
|
| 4605 |
session.commit()
|
4611 |
session.commit()
|
| 4606 |
return False
|
4612 |
return False
|
| Line 4630... |
Line 4636... |
| 4630 |
if isinstance(recharge_order, MobileRechargeOrder):
|
4636 |
if isinstance(recharge_order, MobileRechargeOrder):
|
| 4631 |
rechargeType = 'MTP'
|
4637 |
rechargeType = 'MTP'
|
| 4632 |
deviceNumber = recharge_order.mobileNumber
|
4638 |
deviceNumber = recharge_order.mobileNumber
|
| 4633 |
strProviderCode = get_provider_code(recharge_order.mobileOperatorId)
|
4639 |
strProviderCode = get_provider_code(recharge_order.mobileOperatorId)
|
| 4634 |
plan = recharge_order.rechargePlan
|
4640 |
plan = recharge_order.rechargePlan
|
| - |
|
4641 |
if recharge_order.mobileOperatorId in (getAsyncOperatorsForRecharge()):
|
| - |
|
4642 |
__activate_recharge_txn_asynchronously(recharge_order,rechargeType,deviceNumber,strProviderCode,plan)
|
| 4635 |
if isinstance(recharge_order, DTHRechargeOrder):
|
4643 |
if isinstance(recharge_order, DTHRechargeOrder):
|
| 4636 |
rechargeType = 'RCH'
|
4644 |
rechargeType = 'RCH'
|
| 4637 |
deviceNumber = recharge_order.dthAccountNumber
|
4645 |
deviceNumber = recharge_order.dthAccountNumber
|
| 4638 |
strProviderCode = get_provider_code(recharge_order.dthOperatorId)
|
4646 |
strProviderCode = get_provider_code(recharge_order.dthOperatorId)
|
| 4639 |
plan = ''
|
4647 |
plan = ''
|
| - |
|
4648 |
if recharge_order.dthOperatorId in (getAsyncOperatorsForRecharge()):
|
| - |
|
4649 |
__activate_recharge_txn_asynchronously(recharge_order,rechargeType,deviceNumber,strProviderCode,plan)
|
| 4640 |
retStatus, retCode, spiceTID, description, aggTID, providerTID = RechargeService.rechargeDevice(recharge_order.id, rechargeType, strProviderCode, deviceNumber, recharge_order.totalAmount, plan)
|
4650 |
retStatus, retCode, spiceTID, description, aggTID, providerTID = RechargeService.rechargeDevice(recharge_order.id, rechargeType, strProviderCode, deviceNumber, recharge_order.totalAmount, plan, )
|
| 4641 |
recharge_order.spiceTID = spiceTID
|
4651 |
recharge_order.spiceTID = spiceTID
|
| 4642 |
recharge_order.responseTimestamp = datetime.datetime.now()
|
4652 |
recharge_order.responseTimestamp = datetime.datetime.now()
|
| 4643 |
recharge_order.description = description
|
4653 |
recharge_order.description = description
|
| 4644 |
session.commit()
|
4654 |
session.commit()
|
| 4645 |
if retCode == '00' and retStatus == 'S':
|
4655 |
if retCode == '00' and retStatus == 'S':
|
| Line 4653... |
Line 4663... |
| 4653 |
promotionServiceClient.get_client().trackCouponUsage(couponCode, recharge_order.id, recharge_order.userId)
|
4663 |
promotionServiceClient.get_client().trackCouponUsage(couponCode, recharge_order.id, recharge_order.userId)
|
| 4654 |
except Exception as e:
|
4664 |
except Exception as e:
|
| 4655 |
print 'Unable to track the usage of coupon - ' + recharge_order.couponCode + ' and spiceTID - ' + str(spiceTID)
|
4665 |
print 'Unable to track the usage of coupon - ' + recharge_order.couponCode + ' and spiceTID - ' + str(spiceTID)
|
| 4656 |
print e
|
4666 |
print e
|
| 4657 |
return True
|
4667 |
return True
|
| 4658 |
elif retCode in ('STO', 'US', 'UP') and retStatus == 'S':
|
4668 |
elif retCode in ('STO', 'US', 'UP','STP') and retStatus == 'S':
|
| - |
|
4669 |
if recharge_order.couponAmount > 0 :
|
| - |
|
4670 |
couponCode = recharge_order.couponCode
|
| - |
|
4671 |
if couponCode :
|
| - |
|
4672 |
try:
|
| - |
|
4673 |
promotionServiceClient = PromotionClient()
|
| - |
|
4674 |
promotionServiceClient.get_client().trackCouponUsage(couponCode, recharge_order.id, recharge_order.userId)
|
| - |
|
4675 |
except Exception as e:
|
| - |
|
4676 |
print 'Unable to track the usage of coupon - ' + recharge_order.couponCode + ' and spiceTID - ' + str(spiceTID)
|
| - |
|
4677 |
print e
|
| 4659 |
raise TransactionServiceException(111, "No response from operator within specified time")
|
4678 |
raise TransactionServiceException(111, "No response from operator within specified time")
|
| 4660 |
else:
|
4679 |
else:
|
| 4661 |
recharge_order.status = RechargeOrderStatus.RECHARGE_FAILED
|
4680 |
recharge_order.status = RechargeOrderStatus.RECHARGE_FAILED
|
| 4662 |
if retCode in ('SVAI', 'SVIA', 'AI', 'IA', 'EAI', 'SVEAI'):
|
4681 |
if retCode in ('SVAI', 'SVIA', 'AI', 'IA', 'EAI', 'SVEAI'):
|
| 4663 |
recharge_order.description = "Invalid Amount"
|
4682 |
recharge_order.description = "Invalid Amount"
|
| Line 4666... |
Line 4685... |
| 4666 |
elif retCode in ('CI', 'ECI', 'ESP', 'SVCI', 'SVECI', 'SVESP', 'SV_ECI', 'SV ECI'):
|
4685 |
elif retCode in ('CI', 'ECI', 'ESP', 'SVCI', 'SVECI', 'SVESP', 'SV_ECI', 'SV ECI'):
|
| 4667 |
recharge_order.description = "Invalid Device Number"
|
4686 |
recharge_order.description = "Invalid Device Number"
|
| 4668 |
session.commit()
|
4687 |
session.commit()
|
| 4669 |
return False
|
4688 |
return False
|
| 4670 |
|
4689 |
|
| - |
|
4690 |
def __activate_recharge_txn_asynchronously(recharge_order, rechargeType, deviceNumber, strProviderCode, plan):
|
| - |
|
4691 |
retStatus, retCode, spiceTID, description, aggTID, providerTID = RechargeService.rechargeDevice(recharge_order.id, rechargeType, strProviderCode, deviceNumber, recharge_order.totalAmount, plan, RechargeMode._NAMES_TO_VALUES.get('ASYNC'))
|
| - |
|
4692 |
recharge_order.spiceTID = spiceTID
|
| - |
|
4693 |
recharge_order.responseTimestamp = datetime.datetime.now()
|
| - |
|
4694 |
recharge_order.status = RechargeOrderStatus.RECHARGE_UNKNOWN
|
| - |
|
4695 |
recharge_order.description = 'Recharge In Process'
|
| - |
|
4696 |
session.commit()
|
| - |
|
4697 |
if recharge_order.couponAmount > 0 :
|
| - |
|
4698 |
couponCode = recharge_order.couponCode
|
| - |
|
4699 |
if couponCode :
|
| - |
|
4700 |
try:
|
| - |
|
4701 |
promotionServiceClient = PromotionClient()
|
| - |
|
4702 |
promotionServiceClient.get_client().trackCouponUsage(couponCode, recharge_order.id, recharge_order.userId)
|
| - |
|
4703 |
except Exception as e:
|
| - |
|
4704 |
print 'Unable to track the usage of coupon - ' + recharge_order.couponCode + ' and spiceTID - ' + str(spiceTID)
|
| - |
|
4705 |
print e
|
| - |
|
4706 |
raise(TransactionServiceException(111, "Explicitly raising exception, will try to fetch final status"))
|
| - |
|
4707 |
|
| 4671 |
|
4708 |
|
| 4672 |
def get_user_wallet(userId):
|
4709 |
def get_user_wallet(userId):
|
| 4673 |
wallet = UserWallet.get_by(userId = userId)
|
4710 |
wallet = UserWallet.get_by(userId = userId)
|
| 4674 |
if not wallet:
|
4711 |
if not wallet:
|
| 4675 |
wallet = UserWallet()
|
4712 |
wallet = UserWallet()
|
| Line 5645... |
Line 5682... |
| 5645 |
strProviderCode = get_provider_code(rechargeTransaction.operatorId)
|
5682 |
strProviderCode = get_provider_code(rechargeTransaction.operatorId)
|
| 5646 |
if rechargeTransaction.deviceType == 1:
|
5683 |
if rechargeTransaction.deviceType == 1:
|
| 5647 |
rtype = 'MTP'
|
5684 |
rtype = 'MTP'
|
| 5648 |
else:
|
5685 |
else:
|
| 5649 |
rtype = 'RCH'
|
5686 |
rtype = 'RCH'
|
| - |
|
5687 |
if rechargeTransaction.operatorId in (getAsyncOperatorsForRecharge()):
|
| - |
|
5688 |
rechargeMode = RechargeMode._NAMES_TO_VALUES.get('ASYNC')
|
| - |
|
5689 |
else:
|
| - |
|
5690 |
rechargeMode = RechargeMode._NAMES_TO_VALUES.get('SYNC')
|
| 5650 |
retStatus, retCode, spiceTID, description, aggTID, providerTID = RechargeService.rechargeDevice(rechargeTransaction.id, rtype, strProviderCode, rechargeTransaction.deviceNum, rechargeTransaction.amount, rechargeTransaction.plan, store.hotspotId)
|
5691 |
retStatus, retCode, spiceTID, description, aggTID, providerTID = RechargeService.rechargeDevice(rechargeTransaction.id, rtype, strProviderCode, rechargeTransaction.deviceNum, rechargeTransaction.amount, rechargeTransaction.plan, store.hotspotId, rechargeMode)
|
| 5651 |
rechargeTransaction.spiceTID = spiceTID
|
5692 |
rechargeTransaction.spiceTID = spiceTID
|
| 5652 |
rechargeTransaction.aggTID = aggTID
|
5693 |
rechargeTransaction.aggTID = aggTID
|
| 5653 |
rechargeTransaction.providerTID = providerTID
|
5694 |
rechargeTransaction.providerTID = providerTID
|
| 5654 |
rechargeTransaction.responseTime = datetime.datetime.now()
|
5695 |
rechargeTransaction.responseTime = datetime.datetime.now()
|
| 5655 |
rechargeTransaction.description = description
|
5696 |
rechargeTransaction.description = description
|
| - |
|
5697 |
if rechargeMode == RechargeMode._NAMES_TO_VALUES.get('SYNC'):
|
| 5656 |
if retCode == '00' and retStatus == 'S':
|
5698 |
if retCode == '00' and retStatus == 'S':
|
| 5657 |
rechargeTransaction.status = RechargeOrderStatus.RECHARGE_SUCCESSFUL
|
5699 |
rechargeTransaction.status = RechargeOrderStatus.RECHARGE_SUCCESSFUL
|
| 5658 |
rechargeTransaction.invoiceNumber = get_next_invoice_number(OrderType.RCH4HOTSPOT)
|
5700 |
rechargeTransaction.invoiceNumber = get_next_invoice_number(OrderType.RCH4HOTSPOT)
|
| 5659 |
|
5701 |
|
| 5660 |
elif retCode in ('STO', 'US', 'UP') and retStatus == 'S':
|
5702 |
elif retCode in ('STO', 'US', 'UP') and retStatus == 'S':
|
| 5661 |
rechargeTransaction.status = RechargeOrderStatus.RECHARGE_UNKNOWN
|
5703 |
rechargeTransaction.status = RechargeOrderStatus.RECHARGE_UNKNOWN
|
| 5662 |
else:
|
5704 |
else:
|
| 5663 |
rechargeTransaction.status = RechargeOrderStatus.RECHARGE_FAILED
|
5705 |
rechargeTransaction.status = RechargeOrderStatus.RECHARGE_FAILED
|
| 5664 |
if retCode in ('SVAI', 'SVIA', 'AI', 'IA', 'EAI', 'SVEAI'):
|
5706 |
if retCode in ('SVAI', 'SVIA', 'AI', 'IA', 'EAI', 'SVEAI'):
|
| 5665 |
rechargeTransaction.description = "Invalid Amount"
|
5707 |
rechargeTransaction.description = "Invalid Amount"
|
| 5666 |
elif retCode in ('ECL', 'SVECL', 'SCL'):
|
5708 |
elif retCode in ('ECL', 'SVECL', 'SCL'):
|
| 5667 |
rechargeTransaction.description = "Customer Exceeded Daily Limit"
|
5709 |
rechargeTransaction.description = "Customer Exceeded Daily Limit"
|
| 5668 |
elif retCode in ('CI', 'ECI', 'ESP', 'SVCI', 'SVECI', 'SVESP', 'SV_ECI', 'SV ECI'):
|
5710 |
elif retCode in ('CI', 'ECI', 'ESP', 'SVCI', 'SVECI', 'SVESP', 'SV_ECI', 'SV ECI'):
|
| 5669 |
rechargeTransaction.description = "Invalid Device Number"
|
5711 |
rechargeTransaction.description = "Invalid Device Number"
|
| 5670 |
|
5712 |
|
| 5671 |
store = HotspotStore.get_by(id=rechargeTransaction.storeId)
|
5713 |
store = HotspotStore.get_by(id=rechargeTransaction.storeId)
|
| 5672 |
wallet = WalletForCompany.query.filter(WalletForCompany.companyId==store.companyId).with_lockmode("update").one()
|
5714 |
wallet = WalletForCompany.query.filter(WalletForCompany.companyId==store.companyId).with_lockmode("update").one()
|
| 5673 |
wh = WalletHistoryForCompany()
|
5715 |
wh = WalletHistoryForCompany()
|
| 5674 |
wh.walletId = wallet.id
|
5716 |
wh.walletId = wallet.id
|
| 5675 |
wh.amount = rechargeTransaction.amount
|
5717 |
wh.amount = rechargeTransaction.amount
|
| 5676 |
wh.transactionTime = rechargeTransaction.responseTime
|
5718 |
wh.transactionTime = rechargeTransaction.responseTime
|
| 5677 |
wh.openingBal = wallet.amount
|
5719 |
wh.openingBal = wallet.amount
|
| 5678 |
wh.closingBal = wallet.amount + wh.amount
|
5720 |
wh.closingBal = wallet.amount + wh.amount
|
| 5679 |
wh.referenceNumber = rechargeTransaction.id
|
5721 |
wh.referenceNumber = rechargeTransaction.id
|
| 5680 |
wh.description = "Credited amount"
|
5722 |
wh.description = "Credited amount"
|
| 5681 |
|
5723 |
|
| 5682 |
wallet.amount = wallet.amount + rechargeTransaction.amount
|
5724 |
wallet.amount = wallet.amount + rechargeTransaction.amount
|
| 5683 |
store.availableLimit = store.availableLimit + rechargeTransaction.amount
|
5725 |
store.availableLimit = store.availableLimit + rechargeTransaction.amount
|
| 5684 |
store.collectedAmount = store.collectedAmount - rechargeTransaction.amount + rechargeTransaction.discount
|
5726 |
store.collectedAmount = store.collectedAmount - rechargeTransaction.amount + rechargeTransaction.discount
|
| 5685 |
|
5727 |
|
| - |
|
5728 |
else:
|
| - |
|
5729 |
rechargeTransaction.status = RechargeOrderStatus.RECHARGE_IN_PROCESS
|
| - |
|
5730 |
rechargeTransaction.description = 'Recharge In Process'
|
| 5686 |
session.commit()
|
5731 |
session.commit()
|
| 5687 |
|
- |
|
| 5688 |
return rechargeTransaction
|
5732 |
return rechargeTransaction
|
| 5689 |
|
5733 |
|
| 5690 |
def get_frcs(circleId, operatorId):
|
5734 |
def get_frcs(circleId, operatorId):
|
| 5691 |
query = FRC.query.filter(FRC.circleId == circleId)
|
5735 |
query = FRC.query.filter(FRC.circleId == circleId)
|
| 5692 |
if(operatorId > 0):
|
5736 |
if(operatorId > 0):
|
| Line 7274... |
Line 7318... |
| 7274 |
fa_Order.cancelReason = faOrder.cancelReason
|
7318 |
fa_Order.cancelReason = faOrder.cancelReason
|
| 7275 |
fa_Order.returnReason = faOrder.returnReason
|
7319 |
fa_Order.returnReason = faOrder.returnReason
|
| 7276 |
fa_Order.freebieItemId = faOrder.freebieItemId
|
7320 |
fa_Order.freebieItemId = faOrder.freebieItemId
|
| 7277 |
fa_Order.productTitle = faOrder.productTitle
|
7321 |
fa_Order.productTitle = faOrder.productTitle
|
| 7278 |
session.commit()
|
7322 |
session.commit()
|
| - |
|
7323 |
|
| - |
|
7324 |
def get_recharge_order_status(rechargeOrderId, final):
|
| - |
|
7325 |
d_rechargeOrder = get_recharge_order(rechargeOrderId)
|
| - |
|
7326 |
if d_rechargeOrder.status == RechargeOrderStatus.RECHARGE_UNKNOWN:
|
| - |
|
7327 |
try:
|
| - |
|
7328 |
status, description = RechargeService.checkTransactionStatus('', str(rechargeOrderId))
|
| - |
|
7329 |
print status, description
|
| - |
|
7330 |
if status:
|
| - |
|
7331 |
update_recharge_order_status(rechargeOrderId, RechargeOrderStatus.RECHARGE_SUCCESSFUL)
|
| - |
|
7332 |
else:
|
| - |
|
7333 |
update_recharge_order_status(rechargeOrderId, RechargeOrderStatus.RECHARGE_FAILED)
|
| - |
|
7334 |
except:
|
| - |
|
7335 |
if final:
|
| - |
|
7336 |
d_rechargeOrder.status = RechargeOrderStatus.PAYMENT_SUCCESSFUL
|
| - |
|
7337 |
finally:
|
| - |
|
7338 |
return get_recharge_order(rechargeOrderId)
|
| - |
|
7339 |
else:
|
| - |
|
7340 |
return d_rechargeOrder
|
| - |
|
7341 |
|
| - |
|
7342 |
def get_recharge_transaction_status(rechargeTransactionId, final):
|
| - |
|
7343 |
d_rechargeTransaction = get_recharge_transaction(rechargeTransactionId)
|
| - |
|
7344 |
if d_rechargeTransaction.status == RechargeOrderStatus.RECHARGE_IN_PROCESS:
|
| - |
|
7345 |
try:
|
| - |
|
7346 |
status, description = RechargeService.checkTransactionStatus('', str(rechargeTransactionId))
|
| - |
|
7347 |
print status, description
|
| - |
|
7348 |
if status:
|
| - |
|
7349 |
update_recharge_transaction_status(rechargeTransactionId, RechargeOrderStatus.RECHARGE_SUCCESSFUL)
|
| - |
|
7350 |
else:
|
| - |
|
7351 |
update_recharge_transaction_status(rechargeTransactionId, RechargeOrderStatus.RECHARGE_FAILED)
|
| - |
|
7352 |
except:
|
| - |
|
7353 |
if final:
|
| - |
|
7354 |
d_rechargeTransaction.status = RechargeOrderStatus.RECHARGE_UNKNOWN
|
| - |
|
7355 |
finally:
|
| - |
|
7356 |
return get_recharge_transaction(rechargeTransactionId)
|
| - |
|
7357 |
else:
|
| - |
|
7358 |
return d_rechargeTransaction
|
| - |
|
7359 |
|
| 7279 |
|
7360 |
|
| 7280 |
|
7361 |
|
| 7281 |
if __name__ == '__main__':
|
7362 |
if __name__ == '__main__':
|
| 7282 |
print get_orders_by_mobile_number("9650889334")
|
7363 |
print get_orders_by_mobile_number("9650889334")
|