From 5c6aae93eb6511906d863899553859a8e262dc42 Mon Sep 17 00:00:00 2001 From: berick Date: Thu, 17 Feb 2011 15:30:45 -0500 Subject: [PATCH] added some custom CC failure messages; don't pop-up on error, just show inline text --- Open-ILS/web/opac/skin/kcls/js/myopac.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Open-ILS/web/opac/skin/kcls/js/myopac.js b/Open-ILS/web/opac/skin/kcls/js/myopac.js index 06a1ef4e86..bf3b61b61e 100644 --- a/Open-ILS/web/opac/skin/kcls/js/myopac.js +++ b/Open-ILS/web/opac/skin/kcls/js/myopac.js @@ -1559,6 +1559,14 @@ function showFinesDiv(el) { } } +var ecom_event_map = { + CREDIT_PROCESSOR_DECLINED_TRANSACTION : + 'Sorry. Your payment has been declined. Please confirm your information is entered correctly or contact your credit card company.', + CREDIT_PROCESSOR_INVALID_CC_NUMBER : + 'The credit card number entered is not valid. Please confirm your information is entered correctly or contact your credit card company.', + SUCCESS : 'Your payment has been approved' +} + function showPaymentForm() { unHideMe($('pay_fines_now')); hideMe($('acct_sum')); @@ -1570,15 +1578,12 @@ function showPaymentForm() { function(resp) { unHideMe($('cc-payment-error-message')); if(resp.textcode) { - var message = resp.textcode+'\n'+resp.desc + ''; - if(resp.textcode == 'CREDIT_PROCESSOR_DECLINED_TRANSACTION' && resp.payload) - message += '\n' + resp.payload.error_message; - alert(js2JSON(resp)); + var message = ecom_event_map[resp.textcode] || resp.textcode+'\n'+resp.desc + ''; $('cc-payment-error-message').innerHTML = message; return; } G.user.last_xact_id(resp.last_xact_id); // update to match latest from server - $('cc-payment-error-message').innerHTML = 'Payment Successful\nTRANSACTION ID: '+resp.last_xact_id; + $('cc-payment-error-message').innerHTML = ecom_event_map.SUCCESS; printPaymentReceipt(resp.payments); emailPaymentReceipt(resp.payments); hideMe($('pay_fines_now'));unHideMe($('acct_sum')); -- 2.11.0