Advertisement
wurtz

Update Reader Display

May 14th, 2021
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. // updates the screen on the card reader for the customer
  2. window.addEventListener('prices-updated', event => {
  3.  
  4. console.log('prices-updated');
  5. console.log(event.detail.info);
  6.  
  7. var info = [];
  8.  
  9. $(event.detail.info).each(function($index)
  10. {
  11. info[$index] = {
  12. description: this[0],
  13. quantity: this[1],
  14. amount: this[2] * 100,
  15. }
  16. });
  17.  
  18. var subtotal = $('#subtotal').val();
  19. var tax = $('#tax').val();
  20. var total = $('#total').val();
  21.  
  22. terminal.setReaderDisplay({
  23.  
  24. type: 'cart',
  25. cart: {
  26. line_items: info,
  27. tax: tax * 100,
  28. total: total * 100,
  29. currency: 'usd',
  30. }
  31.  
  32. });
  33.  
  34. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement