credit card
This commit is contained in:
parent
089454e8ac
commit
8f44c43850
8 changed files with 510 additions and 153 deletions
|
|
@ -72,7 +72,7 @@
|
|||
</div>
|
||||
{% if credit_card_data %}
|
||||
<form role="form" id="billing-form" method="post" action="{% url 'digitalglarus:booking_payment' %}" novalidate>
|
||||
<h2 class="billing-head">Credit Card<a class="btn btn-primary btn-grey btn-edit" href="{% url 'digitalglarus:user_billing_address' %}">Edit</a></h2>
|
||||
<h2 class="billing-head">Credit Card<a class="btn btn-primary btn-grey btn-edit" href="{% url 'digitalglarus:TermsAndConditions' %}">Edit</a></h2>
|
||||
<h2 class="membership-lead">Last 4: *****{{credit_card_data.last4}}</h2>
|
||||
<h2 class="membership-lead">Type: {{credit_card_data.cc_brand}}</h2>
|
||||
<input type="hidden" name="credit_card_needed" value="false"/>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,113 @@
|
|||
{% extends "new_base_glarus.html" %}
|
||||
{% load staticfiles cms_tags bootstrap3%}
|
||||
{% block title %}crowdfunding{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
#cancel-subscription-modal{
|
||||
margin-top:10%;
|
||||
}
|
||||
|
||||
#cancel-subscription-modal .modal-header{
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
#cancel-subscription-modal .modal-footer{
|
||||
border-top: none;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.space-above {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<section id="price">
|
||||
<div class="signup-container">
|
||||
<div class="col-xs-12 col-sm-3 col-lg-4 text-center wow fadeInDown"> </div>
|
||||
<div class="col-xs-12 col-sm-6 col-lg-4 text-center wow fadeInDown">
|
||||
|
||||
<!-- <span class="glyphicon glyphicon-user"></span> -->
|
||||
<div class="payment-box">
|
||||
<h2 class="billing-head">Update your credit card information</h2>
|
||||
<hr class="greyline-long">
|
||||
<h2 class="membership-lead">Do you want to update your credit card information ?</h2>
|
||||
<div class="date-box">
|
||||
</div>
|
||||
<!--<hr class="primary">-->
|
||||
<div class="signup-form form-group row">
|
||||
|
||||
<div class="button-booking-box form-inline row">
|
||||
|
||||
<form method="POST" action="">
|
||||
{% csrf_token %}
|
||||
<a class="btn btn-primary btn-grey space-above" href="{{request.META.HTTP_REFERER}}">Go back</a>
|
||||
<button type="button" class="btn btn-primary btn-blue space-above" data-toggle="modal" data-target="#cancel-subscription-modal">Update my credit card</button>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="modal fade bs-example-modal-sm" id="cancel-subscription-modal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">Cancel Subscription</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Do you want to cancel your subscription?</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary btn-grey" data-dismiss="modal">No</button>
|
||||
<button type="submit" class="btn btn-primary">Yes</button>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<div class="notice-box text-left">
|
||||
<p class="order-bottom-text">
|
||||
Your membership wouldn't be automatically renewed each month.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-xs-12 col-sm-3 col-lg-4 text-center wow fadeInDown"> </div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section id="contact">
|
||||
<div class="fill">
|
||||
<div class="row" class="wow fadeInDown">
|
||||
<div class="col-lg-12 text-center wow fadeInDown">
|
||||
<div class="col-md-4 map-title">
|
||||
Digital Glarus<br>
|
||||
<span class="map-caption">In der Au 7 Schwanden 8762 Switzerland
|
||||
<br>info@digitalglarus.ch
|
||||
<br>
|
||||
(044) 534-66-22
|
||||
<p> </p>
|
||||
</span>
|
||||
</div>
|
||||
<p> </p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
||||
347
digitalglarus/templates/digitalglarus/new_credit_card.html
Normal file
347
digitalglarus/templates/digitalglarus/new_credit_card.html
Normal file
|
|
@ -0,0 +1,347 @@
|
|||
{% extends "new_base_glarus.html" %}
|
||||
{% load staticfiles bootstrap3 i18n %}
|
||||
{% block content %}
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
.nopadding {
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
.form-control#id_country{
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
background-position: right 50%;
|
||||
background-repeat: no-repeat;
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAMCAYAAABSgIzaAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6NDZFNDEwNjlGNzFEMTFFMkJEQ0VDRTM1N0RCMzMyMkIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6NDZFNDEwNkFGNzFEMTFFMkJEQ0VDRTM1N0RCMzMyMkIiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo0NkU0MTA2N0Y3MUQxMUUyQkRDRUNFMzU3REIzMzIyQiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo0NkU0MTA2OEY3MUQxMUUyQkRDRUNFMzU3REIzMzIyQiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PuGsgwQAAAA5SURBVHjaYvz//z8DOYCJgUxAf42MQIzTk0D/M+KzkRGPoQSdykiKJrBGpOhgJFYTWNEIiEeAAAMAzNENEOH+do8AAAAASUVORK5CYII=);
|
||||
padding: .5em;
|
||||
padding-right: 1.5em
|
||||
}
|
||||
|
||||
.order-bottom-text a{
|
||||
margin-left: 0px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<section id="price">
|
||||
<div class="signup-container">
|
||||
<div class="col-xs-12 col-sm-6 col-lg-8 text-center wow fadeInDown">
|
||||
<div class="payment-box">
|
||||
<h2 class="section-heading payment-head">New Credit Card</h2>
|
||||
<!-- <h2 class="membership-amount">35CHF</h2> -->
|
||||
<hr class="greyline-long">
|
||||
|
||||
<h2 class="membership-lead">
|
||||
Your Digital Glarus Membership enables
|
||||
you to use our coworking space and it includes
|
||||
2 working days for the month you signed up.
|
||||
The membership fee is a monthly subscription.
|
||||
Additional day costs
|
||||
15CHF per day. More than 17 days a month it
|
||||
will charge only 290CHF/month.
|
||||
</h2>
|
||||
{% if is_free %}
|
||||
<h2 class="billing-head">Billing Adress</h2>
|
||||
<div class="signup-form form-group row">
|
||||
<form role="form" id="billing-form" method="post" action="{% url 'digitalglarus:booking_payment' %}" novalidate>
|
||||
{% for field in form %}
|
||||
{% csrf_token %}
|
||||
{% bootstrap_field field show_label=False type='fields'%}
|
||||
{% endfor %}
|
||||
{% bootstrap_form_errors form type='non_fields'%}
|
||||
<br>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<hr class="greyline-long">
|
||||
<br/>
|
||||
<h2 class="billing-head">Your booking is FREE of charge! You can change or cancel the booking freely 7 days before the booking date.</h2>
|
||||
<br/><br/>
|
||||
{% else %}
|
||||
<br>
|
||||
<h2 class="billing-head">Credit Card Information</h2>
|
||||
|
||||
|
||||
{% if credit_card_data %}
|
||||
<form role="form" id="billing-form" method="post" action="{% url 'digitalglarus:booking_payment' %}" novalidate>
|
||||
<h2 class="membership-lead">Last 4: *****{{last4}}</h2>
|
||||
<h2 class="membership-lead">Type: {{cc_brand}}</h2>
|
||||
|
||||
<input type="hidden" name="credit_card_needed" value="false"/>
|
||||
</form>
|
||||
|
||||
{% else %}
|
||||
<form role="form" id="billing-form" method="post" action="{% url 'digitalglarus:booking_payment' %}" novalidate>
|
||||
<h2 class="membership-lead">Last 4: *****{{last4}}</h2>
|
||||
<h2 class="membership-lead">Type: {{cc_brand}}</h2>
|
||||
<input type="hidden" name="credit_card_needed" value="false"/>
|
||||
</form>
|
||||
<h2 class="billing-head">Credit Card (New One)</h2>
|
||||
<div class="signup-form form-group row">
|
||||
{% csrf_token %}
|
||||
<form role="form" id="payment-form" novalidate>
|
||||
{% csrf_token %}
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-12">
|
||||
<div class="form-group">
|
||||
<input for="name" type="text" class="form-control" name="cardName" placeholder="Name on card" required autofocus data-stripe="name" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-12">
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="cardNumber" placeholder="Valid Card Number" required data-stripe="number" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6 col-md-6 nopadding">
|
||||
<label for="expMonth">EXPIRATION DATE</label><br/>
|
||||
<div class="col-xs-6 col-lg-6 col-md-6">
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="expMonth" placeholder="MM" required data-stripe="exp_month" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6 col-lg-6 col-md-6 pl-ziro">
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="expYear" placeholder="YY" required data-stripe="exp_year" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-4 col-md-6 pull-right">
|
||||
<div class="form-group">
|
||||
<label for="cvCode">CV CODE</label>
|
||||
<input type="password" class="form-control" name="cvCode" placeholder="CV" required data-stripe="cvc" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="text-center">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<input type="checkbox" hidden="True" class="custom-control-input agree-terms" checked>
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col-xs-6 col-md-6 col-xs-offset-1 col-md-offset-3">
|
||||
<button type="button" class="btn btn-primary btn-grey" data-dismiss="modal">Cancel</button>
|
||||
<button class="btn btn-primary btn-md btn-blck submit-payment" type="submit">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="row" style="display:none;">
|
||||
<div class="col-xs-12">
|
||||
<p class="payment-errors"></p>
|
||||
</div>
|
||||
</div>
|
||||
{% if paymentError %}
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<p>
|
||||
{% bootstrap_alert paymentError alert_type='danger' %}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
{% endif %}
|
||||
</form>
|
||||
<br>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
<section id="contact">
|
||||
<div class="fill">
|
||||
<div class="row" class="wow fadeInDown">
|
||||
<div class="col-lg-12 text-center wow fadeInDown">
|
||||
<div class="col-md-4 map-title">
|
||||
Digital Glarus<br>
|
||||
<span class="map-caption">In der Au 7 Schwanden 8762 Switzerland
|
||||
<br>info@digitalglarus.ch
|
||||
<br>
|
||||
(044) 534-66-22
|
||||
<p> </p>
|
||||
</span>
|
||||
</div>
|
||||
<p> </p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- stripe key data -->
|
||||
{% if stripe_key %}
|
||||
<script type="text/javascript">
|
||||
(function () {window.stripeKey = "{{stripe_key}}";})();
|
||||
|
||||
</script>
|
||||
{%endif%}
|
||||
<script>
|
||||
$( document ).ready(function() {
|
||||
|
||||
$.ajaxSetup({
|
||||
beforeSend: function(xhr, settings) {
|
||||
function getCookie(name) {
|
||||
var cookieValue = null;
|
||||
if (document.cookie && document.cookie != '') {
|
||||
var cookies = document.cookie.split(';');
|
||||
for (var i = 0; i < cookies.length; i++) {
|
||||
var cookie = jQuery.trim(cookies[i]);
|
||||
// Does this cookie string begin with the name we want?
|
||||
if (cookie.substring(0, name.length + 1) == (name + '=')) {
|
||||
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return cookieValue;
|
||||
}
|
||||
if (!(/^http:.*/.test(settings.url) || /^https:.*/.test(settings.url))) {
|
||||
// Only send the token to relative URLs i.e. locally.
|
||||
alert("POR AQUI");
|
||||
xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken'));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//Acept term and conditions button
|
||||
|
||||
|
||||
|
||||
var submit_form_btn = $('#payment_button');
|
||||
submit_form_btn.on('click', submit_payment);
|
||||
|
||||
function submit_payment(e){
|
||||
$('#billing-form').submit();
|
||||
alert("POR AQUI2");
|
||||
// $form.submit();
|
||||
}
|
||||
|
||||
|
||||
var $form = $('#payment-form');
|
||||
$form.submit(payWithStripe);
|
||||
|
||||
/* If you're using Stripe for payments */
|
||||
function payWithStripe(e) {
|
||||
console.log("submiting");
|
||||
e.preventDefault();
|
||||
|
||||
if (!$('.agree-terms').is(':checked')){
|
||||
alert("You must accept terms and conditions.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Visual feedback */
|
||||
$form.find('[type=submit]').html('Validating <i class="fa fa-spinner fa-pulse"></i>');
|
||||
|
||||
var PublishableKey = window.stripeKey;
|
||||
Stripe.setPublishableKey(PublishableKey);
|
||||
Stripe.card.createToken($form, function stripeResponseHandler(status, response) {
|
||||
if (response.error) {
|
||||
/* Visual feedback */
|
||||
alert("POR AQUI3");
|
||||
$form.find('[type=submit]').html('Try again');
|
||||
/* Show Stripe errors on the form */
|
||||
$form.find('.payment-errors').text(response.error.message);
|
||||
$form.find('.payment-errors').closest('.row').show();
|
||||
} else {
|
||||
/* Visual feedback */
|
||||
$form.find('[type=submit]').html('Processing <i class="fa fa-spinner fa-pulse"></i>');
|
||||
/* Hide Stripe errors on the form */
|
||||
$form.find('.payment-errors').closest('.row').hide();
|
||||
$form.find('.payment-errors').text("");
|
||||
// response contains id and card, which contains additional card details
|
||||
var token = response.id;
|
||||
// AJAX
|
||||
|
||||
//set token on a hidden input
|
||||
$('#id_token').val(token);
|
||||
$('#billing-form').submit();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* Form validation */
|
||||
$.validator.addMethod("month", function(value, element) {
|
||||
return this.optional(element) || /^(01|02|03|04|05|06|07|08|09|10|11|12)$/.test(value);
|
||||
}, "Please specify a valid 2-digit month.");
|
||||
|
||||
$.validator.addMethod("year", function(value, element) {
|
||||
return this.optional(element) || /^[0-9]{2}$/.test(value);
|
||||
}, "Please specify a valid 2-digit year.");
|
||||
|
||||
validator = $form.validate({
|
||||
rules: {
|
||||
cardNumber: {
|
||||
required: true,
|
||||
creditcard: true,
|
||||
digits: true
|
||||
},
|
||||
expMonth: {
|
||||
required: true,
|
||||
month: true
|
||||
},
|
||||
expYear: {
|
||||
required: true,
|
||||
year: true
|
||||
},
|
||||
cvCode: {
|
||||
required: true,
|
||||
digits: true
|
||||
}
|
||||
},
|
||||
highlight: function(element) {
|
||||
$(element).closest('.form-control').removeClass('success').addClass('error');
|
||||
},
|
||||
unhighlight: function(element) {
|
||||
$(element).closest('.form-control').removeClass('error').addClass('success');
|
||||
},
|
||||
errorPlacement: function(error, element) {
|
||||
$(element).closest('.form-group').append(error);
|
||||
}
|
||||
});
|
||||
|
||||
paymentFormReady = function() {
|
||||
if ($form.find('[name=cardNumber]').hasClass("success") &&
|
||||
$form.find('[name=expMonth]').hasClass("success") &&
|
||||
$form.find('[name=expYear]').hasClass("success") &&
|
||||
$form.find('[name=cvCode]').val().length > 1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
$form.find('[type=submit]').prop('disabled', true);
|
||||
var readyInterval = setInterval(function() {
|
||||
if (paymentFormReady()) {
|
||||
$form.find('[type=submit]').prop('disabled', false);
|
||||
clearInterval(readyInterval);
|
||||
}
|
||||
}, 250);
|
||||
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
</form>
|
||||
<br>
|
||||
<div class="notice-box">
|
||||
<p class="signup-text">Still have trouble?<a href="mailto:info@ungleich.ch" > Contact us </a>.</p>
|
||||
<p class="signup-text">Still have trouble? For technical support <a href="mailto:info@ungleich.ch" > Contact us </a>.</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue