Advertisement
DecaK

Untitled

Dec 29th, 2021
1,233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <title>Online POS</title>
  5.     <meta charset="utf-8">
  6. </head>
  7. <body>
  8.     <h1>Online POS</h1>
  9.     <label for="invoiceRequest">Invoice request json</label>
  10.     <textarea id="invoiceRequest" cols="100" rows="30" style="display:block"></textarea>
  11.     <label for="taxcore_sign_element">Send Invoice Request:</label>
  12.     <button id="taxcore_sign_element"
  13.                 data-taxcore-vsdc-url="https://vsdc.sandbox.suf.purs.gov.rs/"
  14.                 data-taxcore-input-id="invoiceRequest"
  15.                 data-taxcore-output-id="results"
  16.                 data-taxcore-invoice-request=""
  17.                 data-taxcore-debug="true"
  18.                 data-taxcore-signed-invoice-response="">Sign Invoice</button>
  19.     <label for="results">Received Signed Invoice:</label>
  20.     <textarea readonly id="results" cols="100" rows="30"></textarea>
  21.     <!-- TAXCORE.JS -->
  22.     <script src="https://vsdc.sandbox.suf.purs.gov.rs/onlinepos/v1/taxcore.min.js"></script>
  23.     <!-- Custom script at Online POS -->
  24.     <script>
  25.         document.getElementById("invoiceRequest").innerHTML =
  26.                 JSON.stringify(CreateExampleInvoiceRequest(), undefined, 4);
  27.  
  28. document.getElementById("taxcore_sign_element").dataset.taxcoreInvoiceRequest =
  29.         JSON.stringify(CreateExampleInvoiceRequest());
  30.  
  31. // Listen to messages from TaxCore
  32.         window.onmessage = function (e) {
  33.             console.log(e.data);
  34.         }
  35.  
  36.         function CreateExampleInvoiceRequest() {
  37.             var invoiceRequest = {
  38.   "dateAndTimeOfIssue": "2020-12-08T08:55:23.286Z",
  39.   "cashier": "123456789",
  40.   "buyerId": "RS34564565",
  41.   "buyerCostCenterId": "567546",
  42.   "invoiceType": "Normal",
  43.   "transactionType": "Sale",
  44.   "payment": [
  45.     {
  46.       "amount": 70.00,
  47.       "paymentType": "Cash"
  48.     }
  49.   ],
  50.   "invoiceNumber": "POS2017/998",
  51.   "options": {
  52.     "omitQRCodeGen" : "1" ,
  53.     "omitTextualRepresentation" : "0"
  54.   },
  55.   "items": [
  56.     {
  57.       "name": "Sport-100 Helmet, Blue",
  58.       "quantity": 2,
  59.       "unitPrice": 34.23,
  60.       "labels": [
  61.         "A"
  62.       ],
  63.       "totalAmount": 68.46
  64.     }
  65.   ]
  66. };
  67.  
  68.             return invoiceRequest;
  69.         }
  70.     </script>
  71. </body>
  72. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement