From 1e665c0aa09bc758205a65b4f79e12542da415d0 Mon Sep 17 00:00:00 2001 From: erickson Date: Tue, 6 Jul 2010 19:30:04 +0000 Subject: [PATCH] showing the more descriptive cc payment errors in self-check. printing CC payment receipts from self-check. added a commented-out cc type picker for possible future use git-svn-id: svn://svn.open-ils.org/ILS/trunk@16859 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../web/js/ui/default/circ/selfcheck/payment.js | 1 + .../web/js/ui/default/circ/selfcheck/selfcheck.js | 48 ++++++++++++++++++++-- .../templates/default/circ/selfcheck/payment.tt2 | 12 ++++++ 3 files changed, 58 insertions(+), 3 deletions(-) diff --git a/Open-ILS/web/js/ui/default/circ/selfcheck/payment.js b/Open-ILS/web/js/ui/default/circ/selfcheck/payment.js index a960e3a3e8..b3a59fc6b6 100644 --- a/Open-ILS/web/js/ui/default/circ/selfcheck/payment.js +++ b/Open-ILS/web/js/ui/default/circ/selfcheck/payment.js @@ -86,6 +86,7 @@ proto.sendCCPayment = function(patron, xacts, onPaymentSubmit) { payments : xacts, cc_args : { where_process : 1, + //type : oilsSelfckCCType.attr('value'), number : oilsSelfckCCNumber.attr('value'), cvv2 : oilsSelfckCCCVV.attr('value'), expire_year : oilsSelfckCCYear.attr('value'), diff --git a/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js b/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js index 2dc7c1598a..a4d061bcc9 100644 --- a/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js +++ b/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js @@ -106,9 +106,22 @@ SelfCheckManager.prototype.init = function() { self.patron, self.getSelectedFinesTotal(), self.getSelectedFineTransactions(), - function() { - self.updateFinesSummary(); - self.drawFinesPage(); + function(resp) { + var evt = openils.Event.parse(resp); + if(evt) { + var message = evt + ''; + if(evt.textcode == 'CREDIT_PROCESSOR_DECLINED_TRANSACTION' && evt.payload) + message += '\n' + evt.payload.error_message; + self.handleAlert(message, true, 'payment-failure'); + return; + } + self.printPaymentReceipt( + resp, + function() { + self.updateFinesSummary(); + self.drawFinesPage(); + } + ); } ); }, @@ -1326,6 +1339,35 @@ SelfCheckManager.prototype.printHoldsReceipt = function(callback) { } +SelfCheckManager.prototype.printPaymentReceipt = function(paymentIds, callback) { + + var self = this; + progressDialog.show(true); + + fieldmapper.standardRequest( + ['open-ils.circ', 'open-ils.circ.money.payment_receipt.print'], + { + async : true, + params : [this.authtoken, paymentIds], + oncomplete : function(r) { + var resp = openils.Util.readResponse(r); + var output = resp.template_output(); + progressDialog.hide(); + if(output) { + self.printData(output.data(), 1, callback); + } else { + var error = resp.error_output(); + if(error) { + throw new Error("Error creating receipt: " + error.data()); + } else { + throw new Error("No receipt data returned from server"); + } + } + } + } + ); +} + /** * Print a receipt for this user's items out */ diff --git a/Open-ILS/web/templates/default/circ/selfcheck/payment.tt2 b/Open-ILS/web/templates/default/circ/selfcheck/payment.tt2 index 9ae3155b6d..f4fe97eb6d 100644 --- a/Open-ILS/web/templates/default/circ/selfcheck/payment.tt2 +++ b/Open-ILS/web/templates/default/circ/selfcheck/payment.tt2 @@ -3,6 +3,18 @@ + -- 2.11.0
Credit Card #