#!/usr/bin/env python3

import requests


"""
In acest exemplu se face o cerere POST catre API-ul IceFact pentru a crea o proforma.
In cazul in care comanda s-a executat cu succes raspunsul va fi de tipul:

{
    "status": "OK",
    "proforma_id": 1
}

"""


url = 'https://api.icefact.ro:10777/v1/proforma/create'
cert = ('demo-api.icefact.ro.crt', 'demo-api.icefact.ro.key')

json = {
    "cumparator": {
        "denumire": "Test SRL",
        "localitate": "Navodari",
        "judet": "RO-CT",
        "tara": "RO"
    },

    "articole": [
        {
            "denumire": "Produs",
            "um": "H87",
            "cantitate": 1,
            "pret_unitar_fara_tva": 100,
            "cota_tva": "21%"
        }
    ]
}

response = requests.post(
    url, 
    json=json,
    cert=cert
)

print(f'Status code: {response.status_code}')
print(f'Response text: {response.text}')
