153 lines
		
	
	
		
			6.3 KiB
		
	
	
	
		
			HTML
		
	
	
		
			Executable File
		
	
	
			
		
		
	
	
			153 lines
		
	
	
		
			6.3 KiB
		
	
	
	
		
			HTML
		
	
	
		
			Executable File
		
	
	
{% extends "mnfapp/base.html" %}
 | 
						|
{% load static %}
 | 
						|
{% block content %}
 | 
						|
    <meta charset="UTF-8">
 | 
						|
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
 | 
						|
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
 | 
						|
    <title> gift subscription</title>
 | 
						|
    <script src="https://checkout.razorpay.com/v1/checkout.js"></script>
 | 
						|
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
 | 
						|
 | 
						|
 | 
						|
    <style>
 | 
						|
        .sample-container{
 | 
						|
            width:60vw;
 | 
						|
            margin: auto;
 | 
						|
            margin-top: 10vh;
 | 
						|
            border-radius: 10px;
 | 
						|
            padding: 1em;
 | 
						|
            display: grid;
 | 
						|
            grid-template-columns: auto auto;
 | 
						|
            box-shadow: 4px 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
 | 
						|
        }
 | 
						|
        .sample-container input{
 | 
						|
            margin: auto;
 | 
						|
            width: 25vw;
 | 
						|
            margin-top: 5px;
 | 
						|
            margin-bottom: 5px;
 | 
						|
        }
 | 
						|
        .sample-container button{
 | 
						|
            width: 20vw;
 | 
						|
            margin:auto;
 | 
						|
            text-align: center;
 | 
						|
            margin-left: 20vw;
 | 
						|
            margin-top: 1em;
 | 
						|
        }
 | 
						|
        #h1{
 | 
						|
            text-align: center;
 | 
						|
            /* color: linear-gradient(#ee364d , rgb(0, 89, 255)); */
 | 
						|
            background: -webkit-linear-gradient(#ee364d, rgb(56, 109, 206));
 | 
						|
            -webkit-background-clip: text;
 | 
						|
            -webkit-text-fill-color: transparent;
 | 
						|
        }
 | 
						|
    </style>
 | 
						|
 | 
						|
    <div>
 | 
						|
        <h6 style="text-align: right;"><button onclick="window.history.back()" style="width:2vw; height:2vw;padding: 3px; border-radius: 4px; color: white; background-color: red;">x</button></h6>
 | 
						|
 | 
						|
        <div>
 | 
						|
            <h1 style="text-align: center; margin-top: 1em;">GIFT SUBSCRIPTIONS</h1>
 | 
						|
            <h3 id="h1">
 | 
						|
                Gift a subscription of 1 month (for 80% of the fee)
 | 
						|
            </h3>
 | 
						|
            <div style="width: 100vw; text-align: center;">
 | 
						|
            <span>
 | 
						|
                {%if message%}
 | 
						|
                <span style="color: green;">{{message}}</span>
 | 
						|
                {%endif%}
 | 
						|
            </span>
 | 
						|
		<h3 id ='text' style="text-align:center;color:red"></h3>
 | 
						|
            </div>
 | 
						|
            <div class="sample-container">
 | 
						|
                <form action="" method="POST" class="form-group">
 | 
						|
                    {% csrf_token %}
 | 
						|
                    <div style="display: grid; grid-template-columns: auto auto;">
 | 
						|
                        <input type="text" placeholder="Name" class="form-control border border-dark" name="name1"  required>
 | 
						|
                        <input type="email" placeholder="Email" class="form-control border border-dark" name="email1" id="email1" required>
 | 
						|
                    </div>
 | 
						|
                    <span id="text" style="color: red;"></span>
 | 
						|
                    <button type="submit" class="btn btn-primary" id="refer">Gift Now</button>
 | 
						|
                </form><br>
 | 
						|
            </div>
 | 
						|
        </div>
 | 
						|
        
 | 
						|
 | 
						|
        {%if response%}
 | 
						|
        <div id="amt-cont" style="padding: 5px;background-color: white;position: absolute;width: 50vw; left: 25%; top: 40%;box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);">
 | 
						|
         <h6 style="text-align: right;"><button onclick="$('#amt-cont').hide()" style="width:2vw; height:2vw; border-radius: 4px; color: white; background-color: red;">x</button></h6>
 | 
						|
         <div style="text-align: center;">
 | 
						|
             {% if response %}
 | 
						|
             <div style="display: grid; grid-template-columns: auto auto auto;  padding: 1em;">
 | 
						|
                 <span style="font-size: 1.3em; font-weight: bold; margin-right: 15%;margin-top: 6px;">Amount to be paid</span>
 | 
						|
                 <span style="font-size: 1.3em; font-weight: bold; margin-right: 15%;margin-top: 6px;" id="amount"><del>₹100</del> ₹80</span>
 | 
						|
                 <input type="text" style="display: none;" name="plan" id="plan" required>
 | 
						|
                 <button class="btn btn-success" id = "rzp-button1">Buy Now</button>
 | 
						|
                 
 | 
						|
             </div>
 | 
						|
             {% endif %}
 | 
						|
         </div>
 | 
						|
        </div>
 | 
						|
         
 | 
						|
         {% endif %}
 | 
						|
 | 
						|
 | 
						|
        
 | 
						|
    </div>
 | 
						|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
 | 
						|
 | 
						|
 <script>
 | 
						|
        $('#refer').click(function(){
 | 
						|
            if($('#email1').val() == '{{user.email}}'){
 | 
						|
                document.getElementById('text').innerHTML = 'You cant put your registered email id. LOL'
 | 
						|
                return false
 | 
						|
            }
 | 
						|
        })
 | 
						|
 | 
						|
 | 
						|
</script>
 | 
						|
<script>
 | 
						|
    var options = {
 | 
						|
        "key": "rzp_test_6U9A7gZuno8Qz1", // Enter the Key ID generated from the Dashboard
 | 
						|
        "amount": "{{amount}}", // Amount is in currency subunits. Default currency is INR. Hence, 50000 refers to 50000 paise
 | 
						|
        "currency": "INR",
 | 
						|
        "name": "MyNextFilm",
 | 
						|
        "description": "Gift MNF Subscription",
 | 
						|
        "image": "{% static 'logo.jpg' %}",
 | 
						|
        "order_id": "{{sub_id}}", //This is a sample Order ID. Pass the `id` obtained in the response of Step 1
 | 
						|
        "prefill": {
 | 
						|
            "name": "{{user.first_name}} {{user.last_name}}",
 | 
						|
            "email": "{{user.email}}",
 | 
						|
            "contact": ""},
 | 
						|
        "handler": function (response){
 | 
						|
            alert(response.razorpay_payment_id);
 | 
						|
            // alert(response.razorpay_order_id);
 | 
						|
            // alert(response.razorpay_signature)
 | 
						|
            // window.location.href = "/pay/success/"+response.razorpay_order_id+"/"+response.razorpay_signature;
 | 
						|
            window.location.href = "/pay/giftsent/"+'{{giftId}}'+"/"+response.razorpay_payment_id+"/"+response.razorpay_order_id;
 | 
						|
            },
 | 
						|
        "notes": {
 | 
						|
            "address": "Razorpay Corporate Office"
 | 
						|
        },
 | 
						|
        "theme": {      "color": "#ee3c4d"    }
 | 
						|
    };
 | 
						|
    var rzp1 = new Razorpay(options);
 | 
						|
    rzp1.on('payment.failed', function (response){
 | 
						|
            // alert(response.error.code);
 | 
						|
            alert(response.error.description);
 | 
						|
            // alert(response.error.source);
 | 
						|
            // alert(response.error.step);
 | 
						|
            alert(response.error.reason);
 | 
						|
            // alert(response.error.metadata.order_id);
 | 
						|
            // alert(response.error.metadata.payment_id);
 | 
						|
            window.location.href = "/pay/failed/";
 | 
						|
 | 
						|
    });
 | 
						|
    document.getElementById('rzp-button1').onclick = function(e){
 | 
						|
        rzp1.open();
 | 
						|
        e.preventDefault();
 | 
						|
    }
 | 
						|
</script>
 | 
						|
 | 
						|
 | 
						|
{%endblock%}
 |