api:invoice:current:update
Table of Contents
API : Current Invoice Update
Introduction
This request will update a current invoice line.
Current invoice lines can contain one-time fees, recurring special services/products and auto-generated things to invoice such as porting fees, number purchase fees, initial or final invoicing of services.
As little as a single field can be updated.
Current invoice lines that are locked (created by the system and not meant to be edited) cannot be updated, unless the user is ADMIN.
Request
| URL | https://api.telecomx.dk/invoice/current/ID | ||
|---|---|---|---|
| Method | POST | ||
| Access level | RESELLER if customer belongs to the reseller. ADMIN. |
||
| Param | ID | Id of the current invoice line to update. | |
| Query | externalLicenses | Boolean | If true, returns the external license invoice lines instead. |
| Body | name | String | [optional] Overrides product name if set. |
| description | String | [optional] Overrides product default description if set. |
|
| units | Number | [optional] Number of units to invoice, can be negative for crediting (price is multiplied by this). |
|
| unitWholesale | Number | [optional] Overrides products wholesale price if set (RESELLER/ADMIN only). |
|
| unitPrice | Number | [optional] Overrides products price if set. |
|
| start | Date | [optional] The date this should be invoiced from. Cannot be in the past, and will be auto-set to today if not provided. This is only valid for recurring products of type 'OTHER'. |
|
| terminate | Date | [optional] The date the product should be invoiced until in the monthly invoicing and then deleted. This is only valid for recurring products of type 'OTHER'. |
|
| recurrence | String | Overrides the type of recurrence: NONE, MONTHLY, QUARTERLY, YEARLY. This is only valid for recurring invoice lines of product type 'AD_HOC'. | |
| billingCustomer | ObjectID | Other customer this line can be invoiced to. Can only be used when creating AD_HOC lines. | |
Request body examples
{ units: 3, unitPrice: 795.00 }
Response
The response will be the newly created current invoice line, if no errors occurred.
| JSON object | ||
|---|---|---|
| _id | Id | Unique id of the invoice line. |
| customer | Id | Id of customer. |
| product._id | Id | Id of the product used. |
| product.type | String | Type of product - see more here. |
| product.productCode | String | Id to use when adding a product and for syncing with accounting system when doing invoicing. |
| product.name | String | Name of the product. |
| product.unitType | String | Type of units: MIN, MB, UNITS, HOURS, KM, MONTHS. |
| product.recurrence | String | Type of recurrence: NONE, MONTHLY, QUARTERLY, YEARLY. |
| product.recurrenceFullMonth | Boolean | If true, and the product is added mid month, customer will be invoiced for the full month otherwise the customer will be invoiced for a fraction of the month according to the start date. |
| product.cost | Number | Cost of the product for one month (if recurring) or one unit (ADMIN only). |
| product.wholesale | Number | Resellers cost for one month (if recurring) or one unit (RESELLER/ADMIN only). |
| product.price | Number | Customer price for one month (if recurring) or one unit. |
| name | String | Overrides product name if set. |
| description | String | Overrides product default description if set. |
| units | Number | Number of units to invoice, can be negative for crediting (price is multiplied by this). |
| unitCost | Number | Overrides products cost price if set (ADMIN only). |
| unitWholesale | Number | Overrides products wholesale price if set (RESELLER/ADMIN only). |
| unitPrice | Number | Overrides products price if set. |
| start | Date | The date the invoice line was added (only used by recurring products of type 'OTHER'). |
| invoicedUntil | Date | The date this invoice line has been invoiced until (only used by recurring products of type 'OTHER'). |
| terminate | Date | The date the product should be invoiced until in the monthly invoicing and then deleted. (only used by recurring products of type 'OTHER'. |
| locked | Boolean | If true this current invoice line cannot be deleted because it contains usage that cannot be returned/credited (unless you have ADMIN rights). |
| vatExempt | Boolean | True if this is exempt from VAT. |
| earliestStart | Date | If the product is reoccurring, this is the minimum date that start can be set to. It is set to the first of the current month, when the currentInvoice is created through the API. |
| recurrence | String | Overrides the type of recurrence: NONE, MONTHLY, QUARTERLY, YEARLY. This is only valid for recurring invoice lines of product type 'AD_HOC'. |
| billingCustomer | ObjectID | Other customer this line can be invoiced to. Can only be used when creating AD_HOC lines |
Note that properties holding no value may be omitted from the object.
Example
{ _id: '1234567890ABCDEF12345678', customer: '123457890ABCDEF12345678', product: { _id: '123457890ABCDEF1234578', type: 'OTHER', productCode: 'SERV247', name: 'Service 24/7', unitType: 'MONTHS', recurrence: 'QUARTERLY', recurrenceFullMonth: false, cost: 100, wholesale: 125, price: 150 }, name: null, description: null, units: 6, unitCost: null, unitWholesale: 115, unitPrice: 130, start: '2015-01-12T00:00:00+0100', invoicedUntil: '2015-07-01T00:00:00+0100', terminate: null, locked: false, vatExempt: false, earliestStart: '2015-01-01T00:00:00+0100', recurrence: null }
Errors
| Error code | Message | Description |
|---|---|---|
| 400 | bad_request | Id not found in request URI |
| 422 | units | Units must be a number and not 0 |
| 422 | unitCost | Cost unit price is invalid |
| 422 | unitWholesale | Wholesale unit price is invalid |
| 422 | unitPrice | Price pr. unit is invalid |
| 404 | not_found | Current invoice item not found |
| 403 | locked | Current invoice item is locked |
| 404 | product | Product not found |
| 422 | terminate | Termination date must be a future date |
| 404 | billingCustomer | Billing customer not found. |
| 403 | access_denied | Access denied |
| 500 | internal_error | <Unspecified> |
api/invoice/current/update.txt · Last modified: 2023/03/21 14:41 by Joakim Andersen