| Line 31... |
Line 31... |
| 31 |
from shop2020.model.v1.order.impl.DataService import Transaction, LineItem, \
|
31 |
from shop2020.model.v1.order.impl.DataService import Transaction, LineItem, \
|
| 32 |
Order, BatchNoGenerator, InvoiceIDGenerator, TransactionRequiringExtraProcessing, \
|
32 |
Order, BatchNoGenerator, InvoiceIDGenerator, TransactionRequiringExtraProcessing, \
|
| 33 |
OrderInventory, Alert, PaymentSettlement, EBSSettlementSummary, \
|
33 |
OrderInventory, Alert, PaymentSettlement, EBSSettlementSummary, \
|
| 34 |
CodVerificationAgent, Attribute, RechargeVoucherTracker, EmiScheme, \
|
34 |
CodVerificationAgent, Attribute, RechargeVoucherTracker, EmiScheme, \
|
| 35 |
MiscCharges, BlockedIpRange, DeniedIpAddress, InsuranceDetailForOrder,\
|
35 |
MiscCharges, BlockedIpRange, DeniedIpAddress, InsuranceDetailForOrder,\
|
| 36 |
DocumentStore, RechargeTransaction
|
36 |
DocumentStore, RechargeTransaction, HotspotStore, WalletForCompany,\
|
| - |
|
37 |
WalletHistoryForCompany
|
| 37 |
from shop2020.model.v1.order.impl.model.MobileRechargeOrder import \
|
38 |
from shop2020.model.v1.order.impl.model.MobileRechargeOrder import \
|
| 38 |
MobileRechargeOrder
|
39 |
MobileRechargeOrder
|
| 39 |
from shop2020.model.v1.order.impl.model.ReturnOrder import ReturnOrder
|
40 |
from shop2020.model.v1.order.impl.model.ReturnOrder import ReturnOrder
|
| 40 |
from shop2020.thriftpy.alert.ttypes import MonitoredEntity, EntityType
|
41 |
from shop2020.thriftpy.alert.ttypes import MonitoredEntity, EntityType
|
| 41 |
from shop2020.thriftpy.logistics.ttypes import DeliveryType, PickUpType
|
42 |
from shop2020.thriftpy.logistics.ttypes import DeliveryType, PickUpType
|
| Line 4187... |
Line 4188... |
| 4187 |
if document:
|
4188 |
if document:
|
| 4188 |
return document.document
|
4189 |
return document.document
|
| 4189 |
else:
|
4190 |
else:
|
| 4190 |
return bin(0)
|
4191 |
return bin(0)
|
| 4191 |
|
4192 |
|
| 4192 |
def retrieve_invoice(orderId):
|
4193 |
def retrieve_invoice(orderId, userId):
|
| - |
|
4194 |
order = get_order(orderId)
|
| - |
|
4195 |
if order.customer_id != userId:
|
| - |
|
4196 |
return bin(0)
|
| 4193 |
strOrderId = '0'*(10-len(str(orderId)))+str(orderId)
|
4197 |
strOrderId = '0'*(10-len(str(orderId)))+str(orderId)
|
| 4194 |
filename = "/SaholicInvoices/" + strOrderId[0:2] + "/" + strOrderId[2:4] + "/" + strOrderId[4:6] + "/" + str(orderId) + ".pdf"
|
4198 |
filename = "/SaholicInvoices/" + strOrderId[0:2] + "/" + strOrderId[2:4] + "/" + strOrderId[4:6] + "/" + str(orderId) + ".pdf"
|
| 4195 |
file = open(filename, "rb")
|
4199 |
file = open(filename, "rb")
|
| 4196 |
pdfFile = file.read()
|
4200 |
pdfFile = file.read()
|
| 4197 |
return pdfFile
|
4201 |
return pdfFile
|
| Line 4524... |
Line 4528... |
| 4524 |
rechargeTransaction.simNum = t_recharge.simNum
|
4528 |
rechargeTransaction.simNum = t_recharge.simNum
|
| 4525 |
rechargeTransaction.isFrc = t_recharge.isFrc
|
4529 |
rechargeTransaction.isFrc = t_recharge.isFrc
|
| 4526 |
rechargeTransaction.status = RechargeOrderStatus.INIT
|
4530 |
rechargeTransaction.status = RechargeOrderStatus.INIT
|
| 4527 |
rechargeTransaction.storeId = t_recharge.storeId
|
4531 |
rechargeTransaction.storeId = t_recharge.storeId
|
| 4528 |
rechargeTransaction.transactionTime = datetime.datetime.now()
|
4532 |
rechargeTransaction.transactionTime = datetime.datetime.now()
|
| - |
|
4533 |
rechargeTransaction.operatorId = t_recharge.operatorId
|
| - |
|
4534 |
rechargeTransaction.plan = t_recharge.plan
|
| - |
|
4535 |
session.commit()
|
| - |
|
4536 |
|
| - |
|
4537 |
store = HotspotStore.get_by(id=rechargeTransaction.storeId)
|
| - |
|
4538 |
wallet = WalletForCompany.get_by(companyId=store.companyId)
|
| - |
|
4539 |
if store.availableLimit < rechargeTransaction.amount or wallet.amount < rechargeTransaction.amount:
|
| - |
|
4540 |
raise TransactionServiceException(898, "Either wallet amount for company or available limit for store is less than recharge amount.")
|
| - |
|
4541 |
wh = WalletHistoryForCompany()
|
| - |
|
4542 |
wh.walletId = wallet.id
|
| - |
|
4543 |
wh.amount = -rechargeTransaction.amount
|
| - |
|
4544 |
wh.transactionTime = rechargeTransaction.transactionTime
|
| - |
|
4545 |
wh.openingBal = wallet.amount
|
| - |
|
4546 |
wh.closingBal = wallet.amount + wh.amount
|
| - |
|
4547 |
wh.referenceNumber = rechargeTransaction.id
|
| - |
|
4548 |
wh.description = "Debited amount"
|
| - |
|
4549 |
|
| - |
|
4550 |
wallet.amount = wallet.amount - rechargeTransaction.amount
|
| - |
|
4551 |
store.availableLimit = store.availableLimit - rechargeTransaction.amount
|
| - |
|
4552 |
|
| - |
|
4553 |
session.commit()
|
| - |
|
4554 |
|
| - |
|
4555 |
strProviderCode = get_provider_code(rechargeTransaction.mobileOperatorId)
|
| - |
|
4556 |
retStatus, retCode, spiceTID, description = RechargeService.rechargeDevice(rechargeTransaction.id, rechargeTransaction.deviceType, strProviderCode, rechargeTransaction.deviceNum, rechargeTransaction.amount, rechargeTransaction.plan)
|
| - |
|
4557 |
rechargeTransaction.spiceTID = spiceTID
|
| - |
|
4558 |
rechargeTransaction.responseTime = datetime.datetime.now()
|
| - |
|
4559 |
rechargeTransaction.description = description
|
| - |
|
4560 |
if retCode == '00' and retStatus == 'S':
|
| - |
|
4561 |
rechargeTransaction.status = RechargeOrderStatus.RECHARGE_SUCCESSFUL
|
| - |
|
4562 |
|
| - |
|
4563 |
elif retCode in ('STO', 'US', 'UP') and retStatus == 'S':
|
| - |
|
4564 |
rechargeTransaction.status = RechargeOrderStatus.RECHARGE_UNKNOWN
|
| - |
|
4565 |
else:
|
| - |
|
4566 |
rechargeTransaction.status = RechargeOrderStatus.RECHARGE_FAILED
|
| - |
|
4567 |
if retCode in ('SVAI', 'SVIA', 'AI', 'IA', 'EAI', 'SVEAI'):
|
| - |
|
4568 |
rechargeTransaction.description = "Invalid Amount"
|
| - |
|
4569 |
elif retCode in ('ECL', 'SVECL', 'SCL'):
|
| - |
|
4570 |
rechargeTransaction.description = "Customer Exceeded Daily Limit"
|
| - |
|
4571 |
elif retCode in ('CI', 'ECI', 'ESP', 'SVCI', 'SVECI', 'SVESP', 'SV_ECI', 'SV ECI'):
|
| - |
|
4572 |
rechargeTransaction.description = "Invalid Device Number"
|
| - |
|
4573 |
|
| - |
|
4574 |
store = HotspotStore.get_by(id=rechargeTransaction.storeId)
|
| - |
|
4575 |
wallet = WalletForCompany.get_by(companyId=store.companyId)
|
| - |
|
4576 |
wh = WalletHistoryForCompany()
|
| - |
|
4577 |
wh.walletId = wallet.id
|
| - |
|
4578 |
wh.amount = rechargeTransaction.amount
|
| - |
|
4579 |
wh.transactionTime = rechargeTransaction.responseTime
|
| - |
|
4580 |
wh.openingBal = wallet.amount
|
| - |
|
4581 |
wh.closingBal = wallet.amount + wh.amount
|
| - |
|
4582 |
wh.referenceNumber = rechargeTransaction.id
|
| - |
|
4583 |
wh.description = "Credited amount"
|
| - |
|
4584 |
|
| - |
|
4585 |
wallet.amount = wallet.amount + rechargeTransaction.amount
|
| - |
|
4586 |
store.availableLimit = store.availableLimit + rechargeTransaction.amount
|
| - |
|
4587 |
|
| 4529 |
session.commit()
|
4588 |
session.commit()
|
| - |
|
4589 |
|
| 4530 |
return rechargeTransaction
|
4590 |
return rechargeTransaction
|
| 4531 |
|
4591 |
|
| 4532 |
if __name__ == '__main__':
|
4592 |
if __name__ == '__main__':
|
| 4533 |
print 'helllo'
|
4593 |
print 'helllo'
|
| 4534 |
|
4594 |
|