change barcode scan to use promises, making it work more robustly with AngularJS