Subversion Repositories SmartDukaan

Rev

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

Rev 6102 Rev 6114
Line 3501... Line 3501...
3501
 
3501
 
3502
def get_recharge_orders_for_transaction(txId):
3502
def get_recharge_orders_for_transaction(txId):
3503
    return RechargeOrder.query.filter_by(transaction_id = txId).first()
3503
    return RechargeOrder.query.filter_by(transaction_id = txId).first()
3504
 
3504
 
3505
def enqueue_recharge_info_email(recharge_order):
3505
def enqueue_recharge_info_email(recharge_order):
3506
    recharge_order = RechargeOrder()
-
 
3507
    status = ""
3506
    status = ""
3508
    message = ""
3507
    message = ""
3509
    html_header = """
3508
    html_header = """
3510
 
3509
 
3511
    <html>
3510
    <html>
Line 3514... Line 3513...
3514
        <p>
3513
        <p>
3515
            Hello $email,<br /><br />
3514
            Hello $email,<br /><br />
3516
            Thanks for placing order with us. Following are the details of your order:
3515
            Thanks for placing order with us. Following are the details of your order:
3517
        </p>
3516
        </p>
3518
        <div>
3517
        <div>
3519
            Order Id : $order_id
3518
            Order Id : $order_id </br>
3520
            Order Date : $order_date
3519
            Order Date : $order_date </br>
3521
            Order Amount : Rs. $order_amount
3520
            Order Amount : Rs. $order_amount </br>
3522
            Order Status : $order_status
3521
            Order Status : $order_status </br>
3523
        </div>
3522
        </div>
3524
    
3523
    
3525
    <br /><br />
3524
    <br /><br />
3526
    $message
3525
    $message
3527
    """
3526
    """
Line 3529... Line 3528...
3529
    if recharge_order.status == RechargeOrderStatus.RECHARGE_SUCCESSFUL:
3528
    if recharge_order.status == RechargeOrderStatus.RECHARGE_SUCCESSFUL:
3530
        status = "Recharge Successful"
3529
        status = "Recharge Successful"
3531
        message = ""
3530
        message = ""
3532
    elif recharge_order.status == RechargeOrderStatus.RECHARGE_FAILED:
3531
    elif recharge_order.status == RechargeOrderStatus.RECHARGE_FAILED:
3533
        status = "Recharge Failed"
3532
        status = "Recharge Failed"
3534
        message = "Due to network failure, we could not process your recharge. We have credit the amount to your wallet. You can use wallet amount to recharge again."
3533
        message = "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>"
3535
    elif recharge_order.status == RechargeOrderStatus.PAYMENT_PENDING:
3534
    elif recharge_order.status == RechargeOrderStatus.PAYMENT_PENDING:
3536
        status = "Recharge Under Process"
3535
        status = "Recharge Under Process"
3537
        message = "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 wallet."
3536
        message = "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>"
3538
        
3537
        
3539
    message = message  + '<br />  In case of any problem, contact please visit <a href="$source_url/contact-us">Contact Us page</a>'
3538
    message = message  + '<br />  In case of any problem, please  <a href="$source_url/contact-us">contact us</a>'
3540
    
3539
    
3541
    html_footer = """
3540
    html_footer = """
3542
    <p>
3541
    <p>
3543
        Best Wishes,<br />
3542
        Best Wishes,<br />
3544
        $source_name Team
3543
        $source_name Team
Line 3550... Line 3549...
3550
 
3549
 
3551
    email = recharge_order.userEmailId
3550
    email = recharge_order.userEmailId
3552
    dt = datetime.datetime.strptime(str(recharge_order.creationTimestamp), "%Y-%m-%d %H:%M:%S")
3551
    dt = datetime.datetime.strptime(str(recharge_order.creationTimestamp), "%Y-%m-%d %H:%M:%S")
3553
    formated_order_date = dt.strftime("%A, %d. %B %Y %I:%M%p")
3552
    formated_order_date = dt.strftime("%A, %d. %B %Y %I:%M%p")
3554
 
3553
 
3555
    email_header = Template(html_header).substitute(dict(order_date = formated_order_date, email = email, source_url = source_url, order_amount = recharge_order.totalAmount, order_status = status, message = message))
3554
    email_header = Template(html_header).substitute(dict(order_id = recharge_order.id, order_date = formated_order_date, email = email, source_url = source_url, order_amount = recharge_order.totalAmount, order_status = status, message = message))
3556
    email_footer = Template(html_footer).substitute(dict(source_url = source_url, source_name = source_name))
3555
    email_footer = Template(html_footer).substitute(dict(source_url = source_url, source_name = source_name))
3557
    
3556
    
3558
    try:
3557
    try:
3559
        helper_client = HelperClient().get_client()
3558
        helper_client = HelperClient().get_client()
3560
        helper_client.saveUserEmailForSending([email], "", source_name + " - Recharge Order Details", email_header + email_footer, str(recharge_order.id), "RechargeInfo", [], [])
3559
        helper_client.saveUserEmailForSending([email], "", source_name + " - Recharge Order Details", email_header + email_footer, str(recharge_order.id), "RechargeInfo", [], [])