Billing rulesets

A billing ruleset describing the rules for billing a service user, service user contact of location contact.

Billing rulsets can either relate to a single contact (e.g service user, service user contact or location contact) or they can be shared allowing them to be assigned to any contact.

The billing ruleset object

Attributes

  • _id
    string

    A unique Id for the billing ruleset.

  • absent_discount_rate
    float

    The percentage discount applied to the contract fee for the service user being absent (e.g 20%, 100%).

  • apply_absent_discount_after
    integer

    The number of days a service user must be absent before any discount for being absent applies.

  • apply_absent_discount_for
    list of strings

    A list of absence reasons during which the service user should be billed at a discount rate.

  • archived
    boolean

    Flag indiciating if the billing ruleset has been archived.

  • billing_per
    string

    Whether the contract is billed per day or night; day, night.

  • contribution_types
    list of strings

    A list of contribution types that can be used with this billing ruleset; local_authority, contribution, fnc, chc, lifestyle, top_up, block_bed, dta_spot, fpc.

  • created
    string

    The date/time the billing ruleset was created.

  • days_after_death_invoice_item_type
    string

    An invoice item type used when generating an invoice line item for days billed after death fees.

  • days_billed_after_death
    integer

    The number of days that the billing party will be billed for if the service user dies whilst a resident is at the home.

  • invoice_item_types
    list of strings

    A list of invoice item type that can be used with this billing ruleset.

  • location_contact
    string

    The location contact the billing ruleset relates to.

  • modified
    string

    The date/time the billing ruleset was modified.

  • name
    string

    A name assigned to the billing ruleset to make it easier to identify. Shared billing rulesets cannot share the same name, dedicated rulesets can share names provided they are not for the same contact.

  • service_user
    string

    The service user the billing ruleset relates to.

  • service_user_contact
    string

    The service user contact the billing ruleset relates to.

  • shared
    boolean

    Flag indiciating if the billing ruleset is shared as opposed to specific to a billing party.

The billing ruleset object
{
    "_id": "6724fbd04f73a2cebf638e32",
    "absent_discount_rate": 20,
    "apply_absent_discount_after": 5,
    "apply_absent_discount_for": [
        "6724fbc74f73a2cebf637712"
    ],
    "archived": false,
    "billing_per": "day",
    "contribution_types": [
        "contribution",
        "lifestyle",
        "top_up"
    ],
    "created": "2024-11-01 16:03:28",
    "days_after_death_invoice_item_type": null,
    "days_billed_after_death": 7,
    "invoice_item_types": [
        "6724fbc74f73a2cebf6377ee"
    ],
    "location_contact": null,
    "modified": "2024-11-01 16:03:28",
    "name": "Private (care)",
    "service_user": null,
    "service_user_contact": null,
    "shared": true
}

List all billing rulesets

Return a list of billing rulesets.

Parameters

  • attributes
    optional
    default ['_id']

    A list of attributes to include for fetched objects.

  • filters-archived
    optional
    default no

    A filter that allows rulesets that are currently archived to be included or excluded.

    • unset
    • yes
    • no
  • filters-ids
    optional

    A filter that accepts a list of Ids and filters the items returned to those with an Id in the list.

  • filters-location_contact
    optional

    A filter that accepts a list of location contact Ids and filters billing rulesets to those where the billing party is one of the location contacts.

  • filters-modified_after
    optional

    A filter that accepts a date/time and filters the items returned to those modified after the date/time.

  • filters-modified_before
    optional

    A filter that accepts a date/time and filters the items returned to those modified before the date/time.

  • filters-q
    optional

    A case insensitive keyword filter applied to the following fields; name.

  • filters-service_user
    optional

    A filter that accepts a list of service user Ids and filters billing rulesets by the service user they are for.

  • filters-service_user_contact
    optional

    A filter that accepts a list of service user contact Ids and filters billing rulesets to those where the billing party is one of the service user contacts.

  • filters-shared
    optional
    default unset

    A filter that allows billing rulesets to be filtered by whether the ruleset is shared or specific to a billing party.

    • unset
    • yes
    • no
  • page
    optional
    default 1

    The page number to fetch.

  • per_page
    optional
    default 10

    The number of items to return per page.

  • sort_by
    optional
    default _id

    A list of fields the returned items can be sorted by. Fields prefixed with minus (-) sign are sorted in descending order.

    • _id
    • created
    • billing_period_start_date
    • modified

Response

Returns a page of billing rulesets.

GET
/v1/billing-rulesets
var billingRulesets = apiClient.Request(
    HttpMethod.Get,
    "billing-rulesets",
    new MultiValueDict()
        .Add("attributes", "name", "days_billed_after_death")
        .Add("filters-shared", "yes")
);
<?php

$billing_rulesets = $api_client->request(
    'GET',
    'billing-rulesets',
    [
        'attributes'=>['name', 'days_billed_after_death'],
        'filters-shared'=>'yes'
    ]
);
billing_rulesets = api_client(
    'GET',
    'billing-rulesets',
    params={
        'attributes': ['name', 'days_billed_after_death'],
        'filters-shared': 'yes'
    }
)
billing_rulesets = api_client.request(
    'GET',
    'billing-rulesets',
    params: {
        'attributes' => ['name', 'days_billed_after_death'],
        'filters-shared' => 'yes'
    }
)
Response
{
    "item_count": 2,
    "items": [
        {
            "_id": "6724fbd04f73a2cebf638e2c",
            "days_billed_after_death": 0,
            "name": "FNC"
        },
        {
            "_id": "6724fbd04f73a2cebf638e32",
            "days_billed_after_death": 7,
            "name": "Private (care)"
        }
    ],
    "page": 1,
    "page_count": 1,
    "per_page": 10
}

Retrieve a billing ruleset

Retrieve a billing ruleset object.

Response

Returns a billing ruleset object.

GET
/v1/billing-rulesets/<billing_ruleset_id>
var billingRuleset = apiClient.Request(
    HttpMethod.Get,
    $"billing-rulesets/{billingRulesetId}"
);
<?php

$billing_ruleset = $api_client->request(
    'GET',
    'billing-rulesets/' . $billing_ruleset_id
);
billing_ruleset = api_client(
    'GET',
    f'billing-rulesets/{billing_ruleset_id}'
)
billing_ruleset = api_client.request(
    'GET',
    "billing-rulesets/#{billing_ruleset_id}"
)
Response
{
    "_id": "6724fbd04f73a2cebf638e32",
    "absent_discount_rate": 20,
    "apply_absent_discount_after": 5,
    "apply_absent_discount_for": [
        "6724fbc74f73a2cebf637712"
    ],
    "archived": false,
    "billing_per": "day",
    "contribution_types": [
        "contribution",
        "lifestyle",
        "top_up"
    ],
    "created": "2024-11-01 16:03:28",
    "days_after_death_invoice_item_type": null,
    "days_billed_after_death": 7,
    "invoice_item_types": [
        "6724fbc74f73a2cebf6377ee"
    ],
    "location_contact": null,
    "modified": "2024-11-01 16:03:28",
    "name": "Private (care)",
    "service_user": null,
    "service_user_contact": null,
    "shared": true
}