mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for payment methods datatables
This commit is contained in:
parent
46602a21c5
commit
89330e6e34
@ -61,18 +61,14 @@
|
|||||||
var cardButton = document.getElementById('card-button');
|
var cardButton = document.getElementById('card-button');
|
||||||
var clientSecret = cardButton.dataset.secret;
|
var clientSecret = cardButton.dataset.secret;
|
||||||
|
|
||||||
|
@if($token)
|
||||||
cardButton.addEventListener('click', function(ev) {
|
cardButton.addEventListener('click', function(ev) {
|
||||||
stripe.handleCardPayment(
|
stripe.handleCardPayment(
|
||||||
clientSecret, cardElement, {
|
clientSecret, {
|
||||||
payment_method_data: {
|
payment_method: {{$token->token}},
|
||||||
billing_details: {name: cardholderName.value}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
).then(function(result) {
|
).then(function(result) {
|
||||||
if (result.error) {
|
if (result.error) {
|
||||||
// Display error.message in your UI.
|
|
||||||
// console.log(result.error);
|
|
||||||
// console.log(result.error.message);
|
|
||||||
|
|
||||||
$("#card-errors").empty();
|
$("#card-errors").empty();
|
||||||
$("#card-errors").append("<b>" + result.error.message + "</b>");
|
$("#card-errors").append("<b>" + result.error.message + "</b>");
|
||||||
@ -85,7 +81,29 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@else
|
||||||
|
cardButton.addEventListener('click', function(ev) {
|
||||||
|
stripe.handleCardPayment(
|
||||||
|
clientSecret, cardElement, {
|
||||||
|
payment_method_data: {
|
||||||
|
billing_details: {name: cardholderName.value}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
).then(function(result) {
|
||||||
|
if (result.error) {
|
||||||
|
|
||||||
|
$("#card-errors").empty();
|
||||||
|
$("#card-errors").append("<b>" + result.error.message + "</b>");
|
||||||
|
$("#card-button").removeAttr("disabled");
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// The setup has succeeded. Display a success message.
|
||||||
|
console.log(result);
|
||||||
|
postResult(result);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
@endif
|
||||||
$("#card-button").attr("disabled", true);
|
$("#card-button").attr("disabled", true);
|
||||||
|
|
||||||
$('#cardholder-name').on('input',function(e){
|
$('#cardholder-name').on('input',function(e){
|
||||||
|
@ -69,6 +69,10 @@ $(function() {
|
|||||||
loadingRecords: "{{ trans('texts.loading') }}",
|
loadingRecords: "{{ trans('texts.loading') }}",
|
||||||
zeroRecords: "{{ trans('texts.no_records_found') }}"
|
zeroRecords: "{{ trans('texts.no_records_found') }}"
|
||||||
},
|
},
|
||||||
|
ajax: {
|
||||||
|
url: '{!! route('client.payment_methods.index') !!}'
|
||||||
|
|
||||||
|
},
|
||||||
columns: [
|
columns: [
|
||||||
|
|
||||||
{data: 'created_at', name: 'created_at', title: '{{ctrans('texts.created_at')}}', visible: true},
|
{data: 'created_at', name: 'created_at', title: '{{ctrans('texts.created_at')}}', visible: true},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user