@ -124,6 +124,29 @@ function showReceipt(txid) {
function finishTransaction ( ) {
sendTransactionToServer ( function ( data ) {
if ( nickelbridge ) {
var opendrawer = false ;
if ( $ ( "#change-amount" ) . text ( ) * 1.0 != 0 ) {
opendrawer = true ;
}
$ ( "#payment-lines .list-group-item" ) . each ( function ( ) {
var type = $ ( ".payment-entry" , this ) . data ( "type" ) ;
if ( type == 'cash' || type == 'check' ) {
opendrawer = true ;
}
} ) ;
if ( opendrawer ) {
$ . ajax ( "http://127.0.0.1:64269/opendrawer" , {
contentType : 'application/json' ,
type : 'POST' ,
success : function ( resp ) {
}
} ) . fail ( function ( resp ) {
alert ( "Error: " + JSON . stringify ( resp ) ) ;
} ) ;
}
}
showReceipt ( data . txid ) ;
} ) ;
}
@ -138,6 +161,26 @@ $("#finishbtn").click(function () {
bsalert ( "Incomplete Transaction" , "The customer would need to pay you $" + ( $ ( "#change-amount" ) . text ( ) * 1.0 ) . toFixed ( 2 ) + " for the refund. Adjust payments until the change is zero." ) ;
} else {
sendReturnToServer ( function ( data ) {
if ( nickelbridge ) {
var opendrawer = false ;
$ ( "#payment-lines .list-group-item" ) . each ( function ( ) {
var type = $ ( ".payment-entry" , this ) . data ( "type" ) ;
if ( type == 'cash' || type == 'check' ) {
opendrawer = true ;
}
} ) ;
if ( opendrawer ) {
$ . ajax ( "http://127.0.0.1:64269/opendrawer" , {
contentType : 'application/json' ,
type : 'POST' ,
success : function ( resp ) {
}
} ) . fail ( function ( resp ) {
alert ( "Error: " + JSON . stringify ( resp ) ) ;
} ) ;
}
}
showReceipt ( data . txid ) ;
} ) ;
}