Prikazi cijelu temu 28.08.2024 23:18
zxz Van mreze
Administrator
Registrovan od:03.02.2009
Lokacija:Tuzla


Predmet:Re:Fiskalizacija u RS-u
evo jedan primjer sa statickim podacima.
Uzeto je sa api.ofs.ba znaci tako treba da izgleda json samo sa dinamickim podacima iz baze.
PreuzmiIzvorni kôd (Visual Basic):
  1. Function test_api()
  2. Dim objHTTP As Object
  3. Dim URL As String
  4. Dim requestData As String
  5.  
  6. URL = "https://icentar.ba/api/invoices/index.php"
  7. Set objHTTP = CreateObject("MSXML2.XMLHTTP")
  8. requestData = "{""invoiceRequest"": {""invoiceType"": ""Normal"", ""transactionType"": ""Sale"", ""buyerId"": ""111758195"", ""payment"": [{""amount"": 100.00, ""paymentType"": ""Cash""}], ""items"": [{""name"": ""Artikl 1"", ""labels"": [""F""], ""totalAmount"": 100.00, ""unitPrice"": 50.00, ""quantity"": 2.000}], ""cashier"": ""Radnik 1""}}"
  9.     With objHTTP
  10.         .Open "POST", URL, False
  11.         '.setRequestHeader "Authorization", "Bearer " & token
  12.        '.setRequestHeader "RequestId", "12345"
  13.        .setRequestHeader "Content-Type", "application/json"
  14.         .Send requestData
  15.         Text = .responseText
  16.     End With
  17. MsgBox Text
  18. End Function

Podrska samo putem foruma, jer samo tako i ostali imaju koristi od toga.