Generate Invoice
Generates the invoice for the provided yard, carrier and period. This can take long if the number of movements is high. If an invoice already exists for the given parameters, an error will be returned
Responses
-
200 application/json
OK
-
400 application/json
Bad Request already exists, eg. tried to generate an invoice for a yard, carrier and period when it already exists (Use PUT method if you want to automatically replace it)
-
412 application/json
Bad Request Conflict, eg. tried to generate an invoice for a yard when is disabled by config
-
409 application/json
Bad Request Precondition Failed, eg. tried to generate an invoice for a yard/carrier when config is missing
-
Not Authorized
-
Not Allowed
POST
/api/billing/invoice/yard/{yardId}/carrier/{carrierId}/periodCode/{periodCode}
curl \
-X POST https://api-dev.gatego.io/api/billing/invoice/yard/{yardId}/carrier/{carrierId}/periodCode/{periodCode}
Response examples (200)
{
"id": 12345,
"yard_id": 67890,
"carrier_id": 11223,
"invoice_number": "IN23456",
"invoice_date": "2022-01-01",
"period_code": "202401",
"period_start": "2022-01-01T00:00:00Z",
"period_end": "2022-01-31T23:59:59Z",
"truck_config": {
"rate_type": "FLAT",
"flat_billing": {
"rate_per_month": "500.00",
"spots": 8,
"overage_rate_per_day_and_spot": "20.00",
"grace_period": "PT1H",
"day_calculation": "MODE_24HOUR_ROUNDING"
},
"daily_billing": {
"rate_per_day": "20.00",
"grace_period": "PT1H",
"day_calculation": "MODE_24HOUR_ROUNDING"
}
},
"trucks_section": {
"daily_billing": {
"invoice_lines": [
{
"vehicle_number": "VH12345",
"check_in_before_billing_period": true,
"check_in_date_time": "2022-01-01T08:00:00Z",
"check_out_date_time": "2022-01-05T20:00:00Z",
"check_out_after_billing_period": true,
"billable_start_date_time": "2022-01-01T08:00:00Z",
"billable_end_date_time": "2022-01-05T20:00:00Z",
"billable_days": 5,
"spot_number": 52,
"overage_days": 0,
"took_reserved_spot_at_check_in": true,
"took_reserved_spot_that_became_available_while_in_yard": true,
"vehicle_number_that_left": "string",
"check_out_movement_id_of_vehicle_that_left": 42
}
],
"billable_days": 165
},
"flat_billing": {
"invoice_lines": [
{
"vehicle_number": "VH12345",
"check_in_before_billing_period": true,
"check_in_date_time": "2022-01-01T08:00:00Z",
"check_out_date_time": "2022-01-05T20:00:00Z",
"check_out_after_billing_period": true,
"billable_start_date_time": "2022-01-01T08:00:00Z",
"billable_end_date_time": "2022-01-05T20:00:00Z",
"billable_days": 5,
"spot_number": 52,
"overage_days": 0,
"took_reserved_spot_at_check_in": true,
"took_reserved_spot_that_became_available_while_in_yard": true,
"vehicle_number_that_left": "string",
"check_out_movement_id_of_vehicle_that_left": 42
}
],
"amount_flat_only": 5000.0,
"overage_days": 62,
"overage_amount": 500.0
},
"amount": 42.0
},
"trucks_missing_checkin_section": {
"missing_checkin_invoice_lines": [
{
"check_out_date_time": "2022-01-05T20:00:00Z",
"vehicle_number": "VH12345"
}
]
},
"trailer_config": {
"rate_type": "FLAT",
"flat_billing": {
"rate_per_month": "500.00",
"spots": 8,
"overage_rate_per_day_and_spot": "20.00",
"grace_period": "PT1H",
"day_calculation": "MODE_24HOUR_ROUNDING"
},
"daily_billing": {
"rate_per_day": "20.00",
"grace_period": "PT1H",
"day_calculation": "MODE_24HOUR_ROUNDING"
}
},
"trailers_section": {
"daily_billing": {
"invoice_lines": [
{
"vehicle_number": "VH12345",
"check_in_before_billing_period": true,
"check_in_date_time": "2022-01-01T08:00:00Z",
"check_out_date_time": "2022-01-05T20:00:00Z",
"check_out_after_billing_period": true,
"billable_start_date_time": "2022-01-01T08:00:00Z",
"billable_end_date_time": "2022-01-05T20:00:00Z",
"billable_days": 5,
"spot_number": 52,
"overage_days": 0,
"took_reserved_spot_at_check_in": true,
"took_reserved_spot_that_became_available_while_in_yard": true,
"vehicle_number_that_left": "string",
"check_out_movement_id_of_vehicle_that_left": 42
}
],
"billable_days": 165
},
"flat_billing": {
"invoice_lines": [
{
"vehicle_number": "VH12345",
"check_in_before_billing_period": true,
"check_in_date_time": "2022-01-01T08:00:00Z",
"check_out_date_time": "2022-01-05T20:00:00Z",
"check_out_after_billing_period": true,
"billable_start_date_time": "2022-01-01T08:00:00Z",
"billable_end_date_time": "2022-01-05T20:00:00Z",
"billable_days": 5,
"spot_number": 52,
"overage_days": 0,
"took_reserved_spot_at_check_in": true,
"took_reserved_spot_that_became_available_while_in_yard": true,
"vehicle_number_that_left": "string",
"check_out_movement_id_of_vehicle_that_left": 42
}
],
"amount_flat_only": 5000.0,
"overage_days": 62,
"overage_amount": 500.0
},
"amount": 42.0
},
"trailers_missing_checkin_section": {
"missing_checkin_invoice_lines": [
{
"check_out_date_time": "2022-01-05T20:00:00Z",
"vehicle_number": "VH12345"
}
]
},
"adjustments_section": {
"adjustments": [
{
"id": 42,
"period_code": "string",
"description": "string",
"amount": 42.0
}
],
"amount": 42.0
},
"total_amount": 42.0,
"currency": "USD"
}
Response examples (400)
{
"error_code": "bad-request-already-exists"
}
Response examples (412)
{
"error_code": "bad-request-billing-config-disabled"
}
Response examples (409)
{
"error_code": "bad-request-billing-config-missing"
}