Move django-based uncloud to top-level
This commit is contained in:
parent
0560063326
commit
95d43f002f
265 changed files with 0 additions and 0 deletions
1128
uncloud_pay/templates/bill.html
Normal file
1128
uncloud_pay/templates/bill.html
Normal file
File diff suppressed because one or more lines are too long
18
uncloud_pay/templates/error.html.j2
Normal file
18
uncloud_pay/templates/error.html.j2
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Error</title>
|
||||
<style>
|
||||
#content {
|
||||
width: 400px;
|
||||
margin: auto;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content">
|
||||
<h1>Error</h1>
|
||||
<p>{{ error }}</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
76
uncloud_pay/templates/stripe-payment.html.j2
Normal file
76
uncloud_pay/templates/stripe-payment.html.j2
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Stripe Card Registration</title>
|
||||
|
||||
<!-- https://stripe.com/docs/js/appendix/viewport_meta_requirements -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
|
||||
<script src="https://js.stripe.com/v3/"></script>
|
||||
<style>
|
||||
#content {
|
||||
width: 400px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
#callback-form {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content">
|
||||
<h1>Registering Stripe Credit Card</h1>
|
||||
|
||||
<!-- Stripe form and messages -->
|
||||
<span id="message"></span>
|
||||
<form id="setup-form">
|
||||
<div id="card-element"></div>
|
||||
<button type='button' id="card-button">
|
||||
Save
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<!-- Dirty hack used for callback to API -->
|
||||
<form id="callback-form" action="{{ callback }}" method="post"></form>
|
||||
</div>
|
||||
|
||||
<!-- Enable Stripe from UI elements -->
|
||||
<script>
|
||||
var stripe = Stripe('{{ stripe_pk }}');
|
||||
|
||||
var elements = stripe.elements();
|
||||
var cardElement = elements.create('card');
|
||||
cardElement.mount('#card-element');
|
||||
</script>
|
||||
|
||||
<!-- Handle card submission -->
|
||||
<script>
|
||||
var cardButton = document.getElementById('card-button');
|
||||
var messageContainer = document.getElementById('message');
|
||||
var clientSecret = '{{ client_secret }}';
|
||||
|
||||
cardButton.addEventListener('click', function(ev) {
|
||||
|
||||
stripe.confirmCardSetup(
|
||||
clientSecret,
|
||||
{
|
||||
payment_method: {
|
||||
card: cardElement,
|
||||
billing_details: {
|
||||
},
|
||||
},
|
||||
}
|
||||
).then(function(result) {
|
||||
if (result.error) {
|
||||
var message = document.createTextNode('Error:' + result.error.message);
|
||||
messageContainer.appendChild(message);
|
||||
} else {
|
||||
// Return to API on success.
|
||||
document.getElementById("callback-form").submit();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue