[open-ils-commits] r16859 - in trunk/Open-ILS/web: js/ui/default/circ/selfcheck templates/default/circ/selfcheck (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Jul 6 15:30:09 EDT 2010


Author: erickson
Date: 2010-07-06 15:30:04 -0400 (Tue, 06 Jul 2010)
New Revision: 16859

Modified:
   trunk/Open-ILS/web/js/ui/default/circ/selfcheck/payment.js
   trunk/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js
   trunk/Open-ILS/web/templates/default/circ/selfcheck/payment.tt2
Log:
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

Modified: trunk/Open-ILS/web/js/ui/default/circ/selfcheck/payment.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/circ/selfcheck/payment.js	2010-07-06 19:30:03 UTC (rev 16858)
+++ trunk/Open-ILS/web/js/ui/default/circ/selfcheck/payment.js	2010-07-06 19:30:04 UTC (rev 16859)
@@ -86,6 +86,7 @@
         payments : xacts,
         cc_args : {
             where_process : 1,
+            //type : oilsSelfckCCType.attr('value'),
             number : oilsSelfckCCNumber.attr('value'),
             cvv2 : oilsSelfckCCCVV.attr('value'),
             expire_year : oilsSelfckCCYear.attr('value'),

Modified: trunk/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js	2010-07-06 19:30:03 UTC (rev 16858)
+++ trunk/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js	2010-07-06 19:30:04 UTC (rev 16859)
@@ -106,9 +106,22 @@
                 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.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
  */

Modified: trunk/Open-ILS/web/templates/default/circ/selfcheck/payment.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/circ/selfcheck/payment.tt2	2010-07-06 19:30:03 UTC (rev 16858)
+++ trunk/Open-ILS/web/templates/default/circ/selfcheck/payment.tt2	2010-07-06 19:30:04 UTC (rev 16859)
@@ -3,7 +3,19 @@
 </div>
 <table id='oils-selfck-cc-payment-table'>
     <tbody>
+        <!-- Technically not needed since card type is derived from the CC number
         <tr>
+            <td>Type of Card</td>
+            <td>
+                <select dojoType='dijit.form.FilteringSelect' jsId='oilsSelfckCCType' required='true'>
+                    <option value='VISA'>VISA</option>
+                    <option value='MasterCard'>MasterCard</option>
+                    <option value='American Express'>American Express</option>
+                </select>
+            </td>
+        </tr>
+        -->
+        <tr>
             <td>Credit Card #</td>
             <td><input dojoType='dijit.form.TextBox' jsId='oilsSelfckCCNumber' required='true'/></td>
         </tr>



More information about the open-ils-commits mailing list