GET /api/daily_allowances/:id
Show daily allowance details


PUT /api/daily_allowances/:id/approve
Approve daily allowance. If daily allowance params are present, updates the daily allowance before approval

Approves expense. If params of the expense are present, updates the expense before approval


POST /api/daily_allowances/:id/disapprove
Disapprove daily allowance

Disapprove expense with a comment

Params

Param name Description
comment
optional

The reason of expense disapproval; will be displayed to user

Validations:

  • Must be a String


GET /api/daily_allowances/:id/conditional_values
Get values for the conditional fields of the daily allowance


GET /api/daily_allowances
Get the list of daily allowances

Get the list of all daily allowances accessible by the current user. Can be paginated and/or filtered by daily allowance state

Params

Param name Description
archived_after
optional

Return only daily allowances accounted on and after the supplied date. Date format: YYYYMMDD (example: 20180702)

Validations:

  • Must be a String

page
optional

Return only one page of daily allowances. Default per-page is 10

Validations:

  • Must be a Integer

per_page
optional

Number of daily allowances returned per page. Works only in combination with “page” param. Default value is 10

Validations:

  • Must be a Integer

state
optional

Validations:

  • Must be one of: draft, reviewing, unapproved, queue, accounting.


POST /api/daily_allowances/calculate_cost
Get the cost of the Daily Allowance

Get the total cost, deduction cost, and taxalbe with tax (Swedish calculator only) of the daily allowance in cents, based on year values, entries, and free meals.

Examples

[
  {
    "entries": [
      {
        "country_id": 1,
        "start_time": 1716890400,
        "end_time": 1716976800
      }
    ],
    "year":2024,
    "free_meal_days": [
      {
        "date": "2024-05-28",
        "is_full": true,
        "had_lunch": true,
        "had_dinner": true
      }
      ],
      "user_id": 1,
      "time_zone": "Europe/Helsinki",
      "is_reverse": false
  }
] 

Params

Param name Description
user_id
required

Allowance User id

Validations:

  • Must be a Integer

time_zone
optional

Used Timezone

Validations:

  • Must be a Integer

year
required

Year in which allowance happens.

Validations:

  • Must be a Integer

is_reverse
required

If the allowance is a reverse of the other allowance

Validations:

  • Must be one of: true, false, 1, 0.

free_meal_days
required

An array with the specific meals attributes. At least one item should be present

Validations:

  • Must be a String

date
required

Date in YYYY-MM-DD format.

Validations:

  • Must be a String

is_full
required

Whether the day corresponding to that “free meal day” is a “full day” or a “half day”.

Validations:

  • Must be one of: true, false, 1, 0.

had_breakfast
optional

True if user had breakfast on that day. Only specific Allowance countries have breakfast free meals enabled.

Validations:

  • Must be one of: true, false, 1, 0.

had_lunch
optional

True if user had lunch on that day.

Validations:

  • Must be one of: true, false, 1, 0.

had_dinner
optional

True if user had dinner on that day.

Validations:

  • Must be one of: true, false, 1, 0.

breakfast_is_taxable
optional

Defines if breakfast is taxable (Swedish calculator only).

Validations:

  • Must be one of: true, false, 1, 0.

lunch_is_taxable
optional

Defines if lunch is taxable (Swedish calculator only).

Validations:

  • Must be one of: true, false, 1, 0.

dinner_is_taxable
optional

Defines if dinner is taxable (Swedish calculator only).

Validations:

  • Must be one of: true, false, 1, 0.

entries
required

An array with the specific entry attributes (country, start/end time in UNIX format) to pass to calculator. At least one item should be present in array

Validations:

  • Must be an Array of nested elements

entries[country_id]
required

ID of the Allowance country

Validations:

  • Must be a Integer

entries[start_time]
required

Start time in unix format: the seconds timestamp of the given date.

Validations:

  • Must be a Integer

entries[end_time]
required

End time in unix format: the seconds timestamp of the given date.

Validations:

  • Must be a Integer

Returns

Code: 200

Description:

Daily Allowance costs break down in cents

Param name Description
subtotal
required

Total cost of the Daily Allowance.

Validations:

  • Must be a Integer

deduction
required

Meal Deduction cost of the Daily Allowance.

Validations:

  • Must be a Integer

taxable
required

Total amount for taxalbe meals, including tax (Swedish calculator only).

Validations:

  • Must be a Integer

tax
required

Total tax (Swedish calculator only).

Validations:

  • Must be a Integer