Advertisement
wurtz

setReaderDisplay

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