| Line 32... |
Line 32... |
| 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, HotspotStore, WalletForCompany,\
|
36 |
DocumentStore, RechargeTransaction, HotspotStore, WalletForCompany,\
|
| 37 |
WalletHistoryForCompany
|
37 |
WalletHistoryForCompany, FRC
|
| 38 |
from shop2020.model.v1.order.impl.model.MobileRechargeOrder import \
|
38 |
from shop2020.model.v1.order.impl.model.MobileRechargeOrder import \
|
| 39 |
MobileRechargeOrder
|
39 |
MobileRechargeOrder
|
| 40 |
from shop2020.model.v1.order.impl.model.ReturnOrder import ReturnOrder
|
40 |
from shop2020.model.v1.order.impl.model.ReturnOrder import ReturnOrder
|
| 41 |
from shop2020.thriftpy.alert.ttypes import MonitoredEntity, EntityType
|
41 |
from shop2020.thriftpy.alert.ttypes import MonitoredEntity, EntityType
|
| 42 |
from shop2020.thriftpy.logistics.ttypes import DeliveryType, PickUpType
|
42 |
from shop2020.thriftpy.logistics.ttypes import DeliveryType, PickUpType
|
| Line 4530... |
Line 4530... |
| 4530 |
rechargeTransaction.status = RechargeOrderStatus.INIT
|
4530 |
rechargeTransaction.status = RechargeOrderStatus.INIT
|
| 4531 |
rechargeTransaction.storeId = t_recharge.storeId
|
4531 |
rechargeTransaction.storeId = t_recharge.storeId
|
| 4532 |
rechargeTransaction.transactionTime = datetime.datetime.now()
|
4532 |
rechargeTransaction.transactionTime = datetime.datetime.now()
|
| 4533 |
rechargeTransaction.operatorId = t_recharge.operatorId
|
4533 |
rechargeTransaction.operatorId = t_recharge.operatorId
|
| 4534 |
rechargeTransaction.plan = t_recharge.plan
|
4534 |
rechargeTransaction.plan = t_recharge.plan
|
| - |
|
4535 |
rechargeTransaction.ipAddress = t_recharge.ipAddress
|
| 4535 |
session.commit()
|
4536 |
session.commit()
|
| 4536 |
|
4537 |
|
| 4537 |
store = HotspotStore.get_by(id=rechargeTransaction.storeId)
|
4538 |
store = HotspotStore.get_by(id=rechargeTransaction.storeId)
|
| 4538 |
wallet = WalletForCompany.get_by(companyId=store.companyId)
|
4539 |
wallet = WalletForCompany.get_by(companyId=store.companyId)
|
| 4539 |
if store.availableLimit < rechargeTransaction.amount or wallet.amount < rechargeTransaction.amount:
|
4540 |
if store.availableLimit < rechargeTransaction.amount or wallet.amount < rechargeTransaction.amount:
|
| Line 4550... |
Line 4551... |
| 4550 |
wallet.amount = wallet.amount - rechargeTransaction.amount
|
4551 |
wallet.amount = wallet.amount - rechargeTransaction.amount
|
| 4551 |
store.availableLimit = store.availableLimit - rechargeTransaction.amount
|
4552 |
store.availableLimit = store.availableLimit - rechargeTransaction.amount
|
| 4552 |
store.collectedAmount = store.collectedAmount + rechargeTransaction.amount - rechargeTransaction.discount
|
4553 |
store.collectedAmount = store.collectedAmount + rechargeTransaction.amount - rechargeTransaction.discount
|
| 4553 |
session.commit()
|
4554 |
session.commit()
|
| 4554 |
|
4555 |
|
| 4555 |
strProviderCode = get_provider_code(rechargeTransaction.mobileOperatorId)
|
4556 |
strProviderCode = get_provider_code(rechargeTransaction.operatorId)
|
| 4556 |
retStatus, retCode, spiceTID, description = RechargeService.rechargeDevice(rechargeTransaction.id, rechargeTransaction.deviceType, strProviderCode, rechargeTransaction.deviceNum, rechargeTransaction.amount, rechargeTransaction.plan)
|
4557 |
retStatus, retCode, spiceTID, description = RechargeService.rechargeDevice(rechargeTransaction.id, rechargeTransaction.deviceType, strProviderCode, rechargeTransaction.deviceNum, rechargeTransaction.amount, rechargeTransaction.plan)
|
| 4557 |
rechargeTransaction.spiceTID = spiceTID
|
4558 |
rechargeTransaction.spiceTID = spiceTID
|
| 4558 |
rechargeTransaction.responseTime = datetime.datetime.now()
|
4559 |
rechargeTransaction.responseTime = datetime.datetime.now()
|
| 4559 |
rechargeTransaction.description = description
|
4560 |
rechargeTransaction.description = description
|
| 4560 |
if retCode == '00' and retStatus == 'S':
|
4561 |
if retCode == '00' and retStatus == 'S':
|
| Line 4588... |
Line 4589... |
| 4588 |
|
4589 |
|
| 4589 |
session.commit()
|
4590 |
session.commit()
|
| 4590 |
|
4591 |
|
| 4591 |
return rechargeTransaction
|
4592 |
return rechargeTransaction
|
| 4592 |
|
4593 |
|
| - |
|
4594 |
def get_frcs(circleId, operatorId):
|
| - |
|
4595 |
return FRC.query.filter(circleId == circleId).filter(operatorId == operatorId).all()
|
| - |
|
4596 |
|
| - |
|
4597 |
def get_recharge_transaction(rechargeId):
|
| - |
|
4598 |
recharge = RechargeTransaction.get_by(id = rechargeId)
|
| - |
|
4599 |
if not recharge:
|
| - |
|
4600 |
raise TransactionServiceException(108, "no such transaction")
|
| - |
|
4601 |
return recharge
|
| - |
|
4602 |
|
| 4593 |
if __name__ == '__main__':
|
4603 |
if __name__ == '__main__':
|
| 4594 |
print 'helllo'
|
4604 |
print 'helllo'
|
| 4595 |
|
4605 |
|