Ve starší verzi API jsme při dotazu na detail faktury vraceli vždy jen jeden záznam:

{
    "InvoiceEmail": {
        "id": "1723906"
    },
    "InvoicePayment": {
        "amount": "8.33",
        "created": "2019-01-25 00:00:00",
        "document_no": "",
        "exchange_rate": "1.00000000000000",
        "home_currency": "EUR",
        "id": "3055989",
        "import_payment_id": null,
        "invoice_id": "5178132",
        "payment_currency": "EUR",
        "payment_type": "gopay",
        "user_id": "43977",
        "user_profile_id": "38549",
        "vat": "1.67"
    },
    "PostStamp": {
        "id": "41507"
    }
}

To však nevyhovuje v případech, když byla faktura uhrazená více platbami, nebo odesílaná klientovi vícekrát. Proto v nové verzi API (od února 2019) dostanete v odpovědi všechny tyto události jako pole:

{
    "Invoice":{},
    "Client":{},
    "InvoiceEmail":[
        {
            "id":"1723906",
            "user_id":"43977",
            "user_profile_id":"38549",
            "invoice_id":"5178132",
            "type":"regular",
            "email":"",
            "phone":null,
            "email_cc":"[]",
            "subject":"Fakt\u00fara 2019013",
            "message":"Dobr\u00fd de\u0148,\r\n\r\nv pr\u00edlohe posielame fakt\u00faru \u010d. 2019013.\r\n\r\nSuma na \u00fahradu: 0,00 EUR\r\nVariabiln\u00fd symbol: 2019013\r\n\u010c\u00edslo \u00fa\u010dtu: SK4211000000000123456789\r\n\r\n\u010eakujeme za \u00fahradu a prajeme pr\u00edjemn\u00fd de\u0148.\r\nTest s.r.o",
            "due":null,
            "created":"2019-01-25 11:04:37"
        }
    ],
    "PostStamp":[
        {
            "id":"41507",
            "user_id":"43977",
            "user_profile_id":"38549",
            "post_stamp_package_id":"1549",
            "invoice_id":"5178132",
            "invoice_language":"slo",
            "no_signature":"0",
            "payment_info":"0",
            "bysquare":"0",
            "recycled":"0",
            "status":"sent",
            "sent_to":"{\"name\":\"",\"address\":\"\\u0160vermova 10\",\"city\":\"Bansk\\u00e1 Bystrica\",\"zip\":\"974 04\",\"country\":\"Slovensko\"}",
            "external_service":null,
            "external_service_id":null,
            "external_response":null,
            "external_status":null,
            "created":"2019-01-23 10:48:04",
            "modified":"2019-01-23 10:48:10",
            "requested":"2019-01-23 10:48:10",
            "sent":"0000-00-00 00:00:00"
        },
        {
            "id":"41508",
            "user_id":"43977",
            "user_profile_id":"38549",
            "post_stamp_package_id":"1549",
            "invoice_id":"5178132",
            "invoice_language":"slo",
            "no_signature":"0",
            "payment_info":"0",
            "bysquare":"0",
            "recycled":"0",
            "status":"sent",
            "sent_to":"{\"name\":\"",\"address\":\"\\u0160vermova 10\",\"city\":\"Bansk\\u00e1 Bystrica\",\"zip\":\"974 04\",\"country\":\"Slovensko\"}",
            "external_service":null,
            "external_service_id":null,
            "external_response":null,
            "external_status":null,
            "created":"2019-01-23 10:48:04",
            "modified":"2019-01-23 10:49:32",
            "requested":"2019-01-23 10:49:32",
            "sent":"0000-00-00 00:00:00"
        }
    ],
    "InvoicePayment":[
        {
            "id":"3055989",
            "invoice_id":"5178132",
            "import_payment_id":null,
            "user_id":"43977",
            "user_profile_id":"38549",
            "payment_type":"gopay",
            "amount":"8.33",
            "home_currency":"EUR",
            "payment_currency":"EUR",
            "exchange_rate":"1.00000000000000",
            "vat":"1.67",
            "document_no":"",
            "created":"2019-01-25 00:00:00"
        }
    ]
}

Napsat komentář

Vaše emailová adresa nebude zveřejněna. Vyžadované informace jsou označeny *

Tato stránka používá Akismet k omezení spamu. Podívejte se, jak vaše data z komentářů zpracováváme..