| Line 3374... |
Line 3374... |
| 3374 |
recharge_order.status = RechargeOrderStatus.PAYMENT_FAILED
|
3374 |
recharge_order.status = RechargeOrderStatus.PAYMENT_FAILED
|
| 3375 |
session.commit()
|
3375 |
session.commit()
|
| 3376 |
return True
|
3376 |
return True
|
| 3377 |
|
3377 |
|
| 3378 |
if rechargeOrderStatus == RechargeOrderStatus.PAYMENT_SUCCESSFUL:
|
3378 |
if rechargeOrderStatus == RechargeOrderStatus.PAYMENT_SUCCESSFUL:
|
| - |
|
3379 |
recharge_order.status = RechargeOrderStatus.PAYMENT_SUCCESSFUL
|
| - |
|
3380 |
session.commit()
|
| 3379 |
if recharge_order.walletAmount > 0:
|
3381 |
if recharge_order.walletAmount > 0:
|
| 3380 |
wallet = get_user_wallet(recharge_order.userId)
|
3382 |
wallet = get_user_wallet(recharge_order.userId)
|
| 3381 |
if wallet and wallet.amount >= recharge_order.walletAmount:
|
3383 |
if wallet and wallet.amount >= recharge_order.walletAmount:
|
| 3382 |
update_amount_in_wallet(recharge_order.userId, -recharge_order.walletAmount, recharge_order.id)
|
3384 |
update_amount_in_wallet(recharge_order.userId, -recharge_order.walletAmount, recharge_order.id)
|
| 3383 |
else:
|
3385 |
else:
|
| 3384 |
update_amount_in_wallet(recharge_order.userId, recharge_order.totalAmount - recharge_order.walletAmount, recharge_order.id)
|
3386 |
update_amount_in_wallet(recharge_order.userId, recharge_order.totalAmount - recharge_order.walletAmount, recharge_order.id)
|
| 3385 |
recharge_order.status = RechargeOrderStatus.PAYMENT_SUCCESSFUL
|
- |
|
| 3386 |
session.commit()
|
3387 |
session.commit()
|
| 3387 |
raise TransactionServiceException(103, 'Wallet amount has already been used')
|
3388 |
raise TransactionServiceException(103, 'Wallet amount has already been used')
|
| 3388 |
|
3389 |
|
| 3389 |
try:
|
3390 |
try:
|
| 3390 |
if activate_recharge_txn(recharge_order):
|
3391 |
if activate_recharge_txn(recharge_order):
|
| Line 3461... |
Line 3462... |
| 3461 |
return ServiceProvider.query.filter_by(id = providerId).one().code
|
3462 |
return ServiceProvider.query.filter_by(id = providerId).one().code
|
| 3462 |
|
3463 |
|
| 3463 |
def get_provider_id(providerCode):
|
3464 |
def get_provider_id(providerCode):
|
| 3464 |
return ServiceProvider.query.filter_by(code = providerCode).one().id
|
3465 |
return ServiceProvider.query.filter_by(code = providerCode).one().id
|
| 3465 |
|
3466 |
|
| 3466 |
def get_service_providers(recharge_type):
|
3467 |
def get_service_providers(recharge_type, only_active):
|
| 3467 |
providers = ServiceProvider.query.filter_by(type = recharge_type, status = 1).all()
|
3468 |
query = ServiceProvider.query.filter_by(type = recharge_type)
|
| - |
|
3469 |
if only_active:
|
| - |
|
3470 |
query = query.filter_by(status = only_active)
|
| - |
|
3471 |
providers = query.all()
|
| 3468 |
serviceProviders = {}
|
3472 |
serviceProviders = {}
|
| 3469 |
for provider in providers:
|
3473 |
for provider in providers:
|
| 3470 |
serviceProviders[provider.id] = provider.name
|
3474 |
serviceProviders[provider.id] = provider.name
|
| 3471 |
return serviceProviders
|
3475 |
return serviceProviders
|
| 3472 |
|
3476 |
|
| Line 3590... |
Line 3594... |
| 3590 |
elif recharge_order.status == RechargeOrderStatus.RECHARGE_FAILED:
|
3594 |
elif recharge_order.status == RechargeOrderStatus.RECHARGE_FAILED:
|
| 3591 |
status = "Recharge Failed"
|
3595 |
status = "Recharge Failed"
|
| 3592 |
message = """
|
3596 |
message = """
|
| 3593 |
Due to network failure, we could not process your recharge. We have credited the amount to your recharge wallet. You can use wallet amount to recharge again. <a href="$source_url/static/recharge-faq">Learn More</a>
|
3597 |
Due to network failure, we could not process your recharge. We have credited the amount to your recharge wallet. You can use wallet amount to recharge again. <a href="$source_url/static/recharge-faq">Learn More</a>
|
| 3594 |
"""
|
3598 |
"""
|
| 3595 |
elif recharge_order.status == RechargeOrderStatus.PAYMENT_PENDING:
|
3599 |
elif recharge_order.status == RechargeOrderStatus.PAYMENT_SUCCESSFUL:
|
| 3596 |
status = "Recharge Under Process"
|
3600 |
status = "Recharge Under Process"
|
| 3597 |
message = """
|
3601 |
message = """
|
| 3598 |
Due to network failure, we could not retrieve the status of your recharge. In case your recharge is not processed, we will credit amount to your recharge wallet. You can use wallet amount to recharge again. <a href="$source_url/static/recharge-faq">Learn More</a>
|
3602 |
Due to network failure, we could not retrieve the status of your recharge. In case your recharge is not processed, we will credit amount to your recharge wallet. You can use wallet amount to recharge again. <a href="$source_url/static/recharge-faq">Learn More</a>
|
| 3599 |
"""
|
3603 |
"""
|
| 3600 |
|
3604 |
|