Skip to content

Commit

Permalink
Merge pull request #1098 from xzzy/master2
Browse files Browse the repository at this point in the history
Fix payment error popup message
  • Loading branch information
xzzy authored Aug 20, 2024
2 parents 2b9549a + 126dace commit aa70072
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ <h2 class="card-header">
<div class="card">
<h2 class="card-header">Change Log</h2>
<div class="card-body">
<div class="row">



<div class="row">
<div class="col-12">
<BR>

Expand Down
2 changes: 1 addition & 1 deletion ledger/checkout/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def do_place_order(self, request):
if not self.checkout_session.checkout_token():
bankcard_form = forms.BankcardForm(request.POST)
if not bankcard_form.is_valid():
messages.error(request, "Invalid submission")
messages.error(request, "The was an issue with the card information provided. Please check the details are correct and try again.")
if self.request.COOKIES.get('payment_api_wrapper') == 'true':
return self.render_payment_message(self.request, error=None,)
#HttpResponse("ERROR PLEASE CHECK")
Expand Down
27 changes: 15 additions & 12 deletions ledger/templates/checkout/payment_details_api_wrapper_js.html
Original file line number Diff line number Diff line change
Expand Up @@ -343,18 +343,21 @@
reset_forms();

$('#id_number').on('keydown keyup',function(e){
if(mastercard_regex.test(e.target.value)){
$('.mastercard').removeClass('disabled');
$('.visa').addClass('disabled');
}
else if (visa_regex.test(e.target.value)){
$('.mastercard').addClass('disabled');
$('.visa').removeClass('disabled');
}
else{
$('.mastercard').addClass('disabled');
$('.visa').addClass('disabled');
}
var card_number = e.target.value.replace(/^\s+|\s+$/gm,'');
$('#id_number').val(card_number);

// if(mastercard_regex.test(e.target.value)){
// $('.mastercard').removeClass('disabled');
// $('.visa').addClass('disabled');
// }
// else if (visa_regex.test(e.target.value)){
// $('.mastercard').addClass('disabled');
// $('.visa').removeClass('disabled');
// }
// else{
// $('.mastercard').addClass('disabled');
// $('.visa').addClass('disabled');
// }
});
});
</script>
75 changes: 45 additions & 30 deletions ledger/templates/checkout/preview-ledger-api.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,57 @@
{% else %}
<BR><BR>

<div class="container rounded m-2" style='background-color: #FFFFFF; position:fixed;'>
<div class="row">

<div class="col-12">
<div class="row pt-4">
<div class="col-10">
<h3> <i class="bi bi-x-circle-fill " style='color: red; font-size: 34px;'></i> Payment Error</h3>
</div>
<div class="col-2 text-end">
<button type="button" class="btn-close close-ledger-popup" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="col-12">
&nbsp;

<div style=" position:fixed; width: 100%">
<div class="container">
<div class="rounded m-2" style='background-color: #FFFFFF; padding-left: 20px; padding-right:20px;'>

<div class="row">

<div class="col-12">
<div class="row pt-4">
<div class="col-10">
<h3> <i class="bi bi-x-circle-fill " style='color: red; font-size: 34px;'></i> Payment Error</h3>
</div>
<div class="col-2 text-end">
<button type="button" class="btn-close close-ledger-popup" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="col-12">
&nbsp;
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="page_inner">
<div class="row">
<div class="col-12">
<div class="page_inner">

{% if error %}
<div class="alert alert-danger">
{{ error }}
</div>
{% endif %}
{% if error %}
<div class="alert alert-danger">
{{ error }}
</div>
{% endif %}

{% include "partials/alert_messages.html" %}
{% if messages %}
{% for message in messages %}
<div class="alert {{ message.tags }} alert-dismissible shadow fade show" role="alert">
{{ message | safe }}
</div>
{% endfor %}
{% endif %}




<BR>
<BR>
</div>
</div>
</div>
</div>

<BR>
<BR>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

<script>
$('.close-ledger-popup').click(function() {
$('#ledger-payment-overtop').hide();
Expand Down

0 comments on commit aa70072

Please sign in to comment.