API Forum

This forum is in read-only mode.
Please refer to our API support in case you have any questions.
We can be reached at api@e-conomic.com
e-conomic API developer forum

https://restapi.e-conomic.com/invoices-experimental/drafts assigns all amounts value 0.0

0

TL;DR: When creating an invoice draft using https://restapi.e-conomic.com/invoices-experimental/drafts the draft is created with succes, but all amounts are set to 0.0.

Questions: Is this caused by our code, or the endpoint? If the latter is responsible, when will this be fixed?

Details:

Code:
    https://gist.github.com/ChrisBuchholz/d56851ddd646ca437ae1

Endpoint:
    https://restapi.e-conomic.com/invoices-experimental/drafts

data:
    {
        'date': '2014-08-19',
        'currency': 'DKK',
        'exchangeRate': 10.25,
        'netAmount': 10.00,
        'netAmountInBaseCurrency': 0.00,
        'grossAmount': 12.50,
        'marginInBaseCurrency': -46.93,
        'marginPercentage': 0.0,
        'vatAmount': 2.50,
        'roundingAmount': 0.00,
        'costPriceInBaseCurrency': 46.93,
        'paymentTerms': {
            'paymentTermsNumber': 1,
            'daysOfCredit': 14,
            'name': 'Lobende maned 14 dage',
            'paymentTermsType': 'invoiceMonth'
        },
        'customer': {
            'customerNumber': 1
        },
        'recipient': {
            'name': 'GatewayAPI.com Credit',
            'vatZone': {
                'name': 'Domestic',
                'vatZoneNumber': 1,
                'enabledForCustomer': true,
                'enabledForSupplier': true
            }
        },
        'delivery': {
        },
        'layout': {
            'layoutNumber': 9
        }
    }

response:
    code: 201
    json:
        {
            'date': '2014-08-19',
            'exchangeRate': 10.25,
            'vatAmount': 0.0,
            'recipient': {
                'vatZone': {
                    'self': 'https://restapi.e-conomic.com/vat-zones/1',
                    'enabledForSupplier': true,
                    'enabledForCustomer': true,
                    'vatZoneNumber': 1,
                    'name': 'Domestic'
                },
                'name': 'GatewayAPI.com Credit'
            },
            'pdf': {
                'download': 'https://restapi.e-conomic.com/invoices-experimental/drafts/21/pdf'
            },
            'roundingAmount': 0.0,
            'customer': {
                'self': 'https://restapi.e-conomic.com/customers/1',
                'customerNumber': 1
            },
            'draftInvoiceNumber': 21,
            'layout': {
                'self': 'https://restapi.e-conomic.com/layouts/9',
                'layoutNumber': 9
            },
            'marginPercentage': 0.0,
            'currency': 'DKK',
            'marginInBaseCurrency': 0.0,
            'paymentTerms': {
                'paymentTermsType': 'paidInCash',
                'self': 'https://restapi.e-conomic.com/payment-terms/1',
                'name': 'Cash',
                'contraAccountForPrepaidAmount': {
                    'self': 'https://restapi.e-conomic.com/accounts/1200',
                    'accountNumber': 1200
                },
                'paymentTermsNumber': 1
            },
            'netAmount': 0.0,
            'self': 'https://restapi.e-conomic.com/invoices-experimental/drafts/21',
            'costPriceInBaseCurrency': 0.0,
            'grossAmount': 0.0,
            'netAmountInBaseCurrency': 0.0
        }
created Aug 19, 2015 by OC-devs
0% Accept Rate
Q 1 A 0 C 0

1 Answer

0
Hi,

All properties representing totals on draft invoices are read-only, and calculated from the draft invoice's lines.

For example, the netAmount is a total each of the lines' (quantity * unitNetPrice * (100 - discountPercentage) / 100).

So, to affect these totals, you need to do so through the lines.

 

Best regards,
answered Aug 29, 2015 by Christian Estrup
Visma e-conomic A/S
...