Subversion Repositories SmartDukaan

Rev

Rev 6310 | Rev 6314 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6310 Rev 6313
Line 3520... Line 3520...
3520
    if rechargeType == RechargeType.MOBILE:
3520
    if rechargeType == RechargeType.MOBILE:
3521
        serviceType = 'MTP'
3521
        serviceType = 'MTP'
3522
    if rechargeType == RechargeType.DTH:
3522
    if rechargeType == RechargeType.DTH:
3523
        serviceType = 'RCH'
3523
        serviceType = 'RCH'
3524
    
3524
    
-
 
3525
    provider = None
3525
    try:    
3526
    try:    
3526
        providerCode, operatorCircle = RechargeService.checkServiceProviderApi(serviceType, deviceNumber)
3527
        providerCode, operatorCircle = RechargeService.checkServiceProviderApi(serviceType, deviceNumber)
3527
        if providerCode == 'SNS' or providerCode == '':
3528
        if providerCode == 'SNS' or providerCode == '':
3528
            providerId = 0
3529
            providerId = 0
3529
        else:
3530
        else:
Line 3533... Line 3534...
3533
        providerId = -1
3534
        providerId = -1
3534
        
3535
        
3535
    deviceNumberInfo = DeviceNumberInfo()
3536
    deviceNumberInfo = DeviceNumberInfo()
3536
    deviceNumberInfo.circleName = operatorCircle
3537
    deviceNumberInfo.circleName = operatorCircle
3537
    deviceNumberInfo.operatorId = providerId
3538
    deviceNumberInfo.operatorId = providerId
-
 
3539
    if provider:
3538
    deviceNumberInfo.operatorName = provider.name
3540
        deviceNumberInfo.operatorName = provider.name
3539
    return deviceNumberInfo
3541
    return deviceNumberInfo
3540
 
3542
 
3541
def validate_recharge(rechargeType, deviceNumber, circleCode, userSelectedProviderId):
3543
def validate_recharge(rechargeType, deviceNumber, circleCode, userSelectedProviderId):
3542
    deviceNumberInfo = get_service_provider_for_device(rechargeType, deviceNumber)
3544
    deviceNumberInfo = get_service_provider_for_device(rechargeType, deviceNumber)
3543
    if deviceNumberInfo.operatorId == -1:
3545
    if deviceNumberInfo.operatorId == -1:
3544
        return "Oops! There seems to be a problem. Please try after some time."
3546
        return "Oops! There seems to be a problem. Please try after some time."
3545
    circle = TelecomCircle.query.filter_by(code = circleCode).first()
3547
    circle = TelecomCircle.query.filter_by(code = circleCode).first()
-
 
3548
    if circle:
3546
    if not ServiceAvailability.query.filter_by(circleId = circle.id).filter_by(operatorId = userSelectedProviderId).first().isServiceAvailable :
3549
        if not ServiceAvailability.query.filter_by(circleId = circle.id).filter_by(operatorId = userSelectedProviderId).first().isServiceAvailable :
-
 
3550
            if deviceNumberInfo.operatorName :
3547
        return deviceNumberInfo.operatorName + " is down in " + circle.name + " currently. Please try later." 
3551
                return deviceNumberInfo.operatorName + " is down in " + circle.name + " currently. Please try later." 
-
 
3552
            else
-
 
3553
                return "This operator is down in " + circle.name + " currently. Please try later." 
3548
    allcounts, successcounts  = get_previous_transactions(rechargeType, deviceNumber)
3554
    allcounts, successcounts  = get_previous_transactions(rechargeType, deviceNumber)
3549
    if allcounts >= 15 or successcounts >= 5:
3555
    if allcounts >= 15 or successcounts >= 5:
3550
        return "You have exceeded daily limit for this mobile number."
3556
        return "You have exceeded daily limit for this mobile number."
3551
    return "SUCCESS"
3557
    return "SUCCESS"
3552
    
3558