finetune payment
This commit is contained in:
+10
-6
@@ -1,5 +1,6 @@
|
||||
// dictionary: deveui as key, count as value
|
||||
var abos_to_buy = {}
|
||||
var stripe_pk = "";
|
||||
|
||||
function validate(what, text) {
|
||||
if (what == 'alias') {
|
||||
@@ -26,7 +27,7 @@ function HandleAbocostResponse(data) {
|
||||
abo_table += '<tr><th class="is-2">Alias</th><th>verlängern bis</th><th class="has-text-right">Betrag</th></tr>';
|
||||
jQuery.each(ordered, function (index, val) {
|
||||
counter += 1;
|
||||
abo_table += '<tr><td>' + val[3] + '</td><td>' + moment(val[2], 'DD.MM.YYYY').add('years', val[0]).format('DD.MM.YYYY') + '</td><td class="has-text-right">' + (val[1] / 100).toFixed(2) + '</td></tr>';
|
||||
abo_table += '<tr><td>' + val[3] + '</td><td>' + moment(val[2], 'DD.MM.YYYY').add(val[0], 'years').format('DD.MM.YYYY') + '</td><td class="has-text-right">' + (val[1] / 100).toFixed(2) + '</td></tr>';
|
||||
total_amount += (val[1] / 100);
|
||||
if (charge_data == '') {
|
||||
charge_data = index + ":" + val[0] + ":" + val[1];
|
||||
@@ -124,8 +125,6 @@ $(document).ready(function () {
|
||||
return;
|
||||
}
|
||||
|
||||
loadStripeLibrary();
|
||||
|
||||
$.ajax({
|
||||
url: "abocost",
|
||||
type: "POST", //send it through post method
|
||||
@@ -133,8 +132,13 @@ $(document).ready(function () {
|
||||
data: JSON.stringify(abos_to_buy),
|
||||
success: function(response) {
|
||||
console.log("SUCCESS");
|
||||
console.log(response);
|
||||
HandleAbocostResponse(response);
|
||||
console.log(response.stripe_pk);
|
||||
console.log(response.data);
|
||||
if (stripe_pk == "") {
|
||||
stripe_pk = response['stripe_pk'];
|
||||
loadStripeLibrary();
|
||||
}
|
||||
HandleAbocostResponse(response['data']);
|
||||
},
|
||||
error: function(xhr) {
|
||||
console.log("ERROR");
|
||||
@@ -207,7 +211,7 @@ function loadStripeLibrary() {
|
||||
function SetupStripe() {
|
||||
// Set your publishable key: remember to change this to your live publishable key in production
|
||||
// See your keys here: https://dashboard.stripe.com/account/apikeys
|
||||
stripe = Stripe('pk_test_51Icq29K2XyHQRTs2DeltUIWrbFb5evfJVGaQzMv4r50g8Q7HAUkSFr7BBGv0aP1damXIhM6fZ4Yf9Wz0qW6TpTVi00dWcW7J1O');
|
||||
stripe = Stripe(stripe_pk);
|
||||
elements = stripe.elements({ locale: "de" });
|
||||
|
||||
// Set up Stripe.js and Elements to use in checkout form
|
||||
|
||||
Reference in New Issue
Block a user