Sales with Services

Sales with Services

Only available with the Service module enabled.

To create sales with services, the sale creation request payload must contain the service_fields attribute.

The following attributes are accepted inside the service_fields:

  • service_line_items - Labor and parts for the service. This is basically the same as register_sale_products but for services.
  • service_action - Indicates which service action to take
  • service_agenda - Indicates the service agenda details
  • service_item - Indicates the service item details and location

Make sure that the register_sale_products object is empty when creating a sale with services.

{
    "service_fields": {
        "service_line_items": [
            {
                "id": "0f6799a5-3a64-b3f7-11f0-09ab49481c0b",
                "product_id": "e77b347e-ee9e-458b-b483-305aec7a6660",
                "price": "32.87671",
                "price_set": 0,
                "discount": "4.00000",
                "tax": "3.12329",
                "tax_id": "0242ac00-002c-11ef-f54f-ea1d24c32a2a",
                "loyalty_value": "3.60000",
                "quantity": "1",
                "sequence": 0,
                "status": "CONFIRMED",
                "attributes": [
                    {
                        "name": "line_note",
                        "value": "Lorem ipsum dolor sit amet."
                    }
                ],
                "tax_components": [
                    {
                        "rate_id": "24c31d96-ea1d-11ef-954f-0242ac000005",
                        "total_tax": 3.123287671232877
                    }
                ],
                "promotions": [
                    {
                        "promotion_id": "1889746722415099904",
                        "name": "Test Promo",
                        "amount": -4,
                        "promo_code": "somepromocode",
                        "promo_code_id": "1889746722419294208"
                    }
                ]
            }
        ],
        "service_action": "CREATE_JOB",
        "service_agenda": {
            "date": "2023-01-01 23:35:34",
            "minutes_scheduled": 60
        },
        "service_item": {
            "item_details": {
                "item_id": "06e35f89-3783-11e6-ec7e-13193f7bd2ed",
                "item_name": "Red bike",
                "serial_number": "1F5SAA2",
                "description": "Red mountain bike, with brakes on the left side of the handlebars",
                "initial_condition": "Broken seat"
            },
            "location": "Shelf 1"
        }
    }
}

Full payload with service fields

Following is a payload with the attributes that can be used to create a sale with service fields.

{
    "register_id": "b1e198a9-f019-11e3-a0f5-b8ca3a64f8f4",
    "customer_id": "06e35f89-3783-11e6-ec7e-13193f7bd2ed",
    "user_id": "b1ed6158-f019-11e3-a0f5-b8ca3a64f8f4",
    "outlet_id": "348fff91-8c43-4599-812b-13636760895a",
    "sale_date": "2016-05-05 23:35:34",
    "note": "",
    "status": "LAYBY",
    "short_code": "mlzs94",
    "invoice_number": "MR-1484-NZ",
    "invoice_sequence": 1484,
    "register_sale_products": [],
    "register_sale_payments": [
        {
            "register_id": "b1e198a9-f019-11e3-a0f5-b8ca3a64f8f4",
            "retailer_payment_type_id": "b1e1d70e-f019-11e3-a0f5-b8ca3a64f8f4",
            "payment_date": "2016-05-05 23:35:34",
            "amount": 5
        }
    ],
    "service_fields": {
        "service_line_items": [
            {
                "id": "0f6799a5-3a64-b3f7-11f0-09ab49481c0b",
                "product_id": "e77b347e-ee9e-458b-b483-305aec7a6660",
                "price": "32.87671",
                "price_set": 0,
                "discount": "4.00000",
                "tax": "3.12329",
                "tax_id": "0242ac00-002c-11ef-f54f-ea1d24c32a2a",
                "loyalty_value": "3.60000",
                "quantity": "1",
                "sequence": 0,
                "status": "CONFIRMED",
                "attributes": [
                    {
                        "name": "line_note",
                        "value": "Lorem ipsum dolor sit amet."
                    }
                ],
                "tax_components": [
                    {
                        "rate_id": "24c31d96-ea1d-11ef-954f-0242ac000005",
                        "total_tax": 3.123287671232877
                    }
                ],
                "promotions": [
                    {
                        "promotion_id": "1889746722415099904",
                        "name": "Test Promo",
                        "amount": -4,
                        "promo_code": "somepromocode",
                        "promo_code_id": "1889746722419294208"
                    }
                ]
            }
        ],
        "service_action": "CREATE_JOB",
        "service_agenda": {
            "date": "2016-05-05 23:35:34",
            "minutes_scheduled": 60
        },
        "service_item": {
            "item_details": {
                "item_id": "06e35f89-3783-11e6-ec7e-13193f7bd2ed",
                "item_name": "Red bike",
                "serial_number": "1F5SAA2",
                "description": "Red mountain bike, with brakes on the left side of the handlebars",
                "initial_condition": "Broken seat"
            },
            "location": "Shelf 1"
        }
    }
}

Definitions

The sale object

Visit Sales 101 for the sale object attribute definitions.

The service fields object

AttributeSample ValueReq/OptDescription
service_line_itemsSame as The register sale product objectrequiredLabor and parts for the service.
service_action"CREATE_JOB"requiredAction to take: CREATE_JOB, UPDATE_JOB.
service_agendaSee belowoptionalService duration and schedule.
service_itemSee belowoptionalService item and location.

The service agenda in service fields object

AttributeSample ValueReq/OptDescription
date"2016-05-05 23:35:34"requiredDate on which the service is going to be processed.
minutes_scheduled60requiredAmount of time in minutes required to finish the service.

The service item in service fields object

AttributeSample ValueReq/OptDescription
item_detailsSee belowoptionalDetails of the item
location"Shelf 1"optionalLocation of the item or service

The item details in service item object

AttributeSample ValueReq/OptDescription
item_id"b1e198a9-f019-11e3-a0f5-b8ca3a64f8f4"optionalid of an already existing item
item_name"Red bike"optionalItem name
serial_number"1F5SAA2"optionalItem serial number
description"Red mountain bike, with brakes on the left side of the handlebars"optionalItem description
initial_condition"Broken seat"optionalItem's initial condition