API 订单选项

订单选项使用的扩展说明。

BeMyGuest booking options infographic

下载 .pdf

  • 订单选项是您需要从客人处收集以及处理预订的信息。 请将每个订单选项视为动态生成的输入字段并添加到客户结账表单中。 有14种类型的订单选项,每种都有相应的HTML输入类型。 点击此处查看订单选项实施示例
    订单选项类型列表
    • type: "1" - "list" HTML输入类型 "select"
    • type: "2" - "list multiple" HTML输入类型 "select mutltiple"
    • type: "3" - "number" HTML输入类型 "text" 用数字验证
    • type: "4" - "string" HTML输入类型 "text" 用字符串验证
    • type: "5" - "boolean" HTML输入类型 checkbox
    • type: "6" - "date" HTML输入类型 "text" 用日期验证
    • type: "7" - "file" HTML输入类型 "file"
    • type: "8" - "image" HTML输入类型 " 具有图像类型验证的文件
    • type: "9" - "address" HTML输入类型 "text"
    • type: "10" - "time" HTML输入类型 "text" 用时间验证
    • type: "11" - "datetime" HTML输入类型 "text" 用日期时间验证
    • type: "12" - "string: country" HTML输入类型 "text"
    • type: "13" - 弃用
    • type: "14" - "string: flight no" HTML输入类型 "text" 飞机航班编号验证: ^[A-Z0-9][A-Z0-9][0-9]{0,4}$
    • 您可以根据自己的设计构建UI,例如使用单选按钮而不是选择等等。
  • 订单选项存在于产品类型级别,但在产品级别上,有两个标记用于标记其存在: 'hasOptions' 意味着至少有一种产品类型有选项. 'allProductTypesHaveOptions' 意味着所有产品类型都有选项.
    "hasOptions": true,
    "allProductTypesHaveOptions": true,

  • 在创建订单时,订单选项可以被设置成必填字段。 它们都有一个’required’字段: true/false (fig. 1)
    API demo示列如下
    product UUID: d3bfa3e1-edd4-5c24-a051-4d6c56aae621
    product-type UUID: 9a7b8133-6654-5a8d-94f2-e5680a030fa3

    "options": {
                "perBooking": [
                    {
                        "uuid": "6587c77f-97fb-47ed-b74b-bdd9f1e99bc1",
                        "name": "Flight Number",
                        "nameTranslated": "Flight Number",
                        "description": null,
                        "descriptionTranslated" : null
                        "required": true,
                        "addOn":false,
                        "formatRegex": null,
                        "inputType": 4,
                        "validFrom": null,
                        "validTo": null
                    },
                    {
                        "uuid": "e9d7f9ba-8528-4920-a4b0-632bf4cfa4f9",
                        "name": "Airport Name",
                        "nameTranslated": "Airport Name",
                        "description": null,
                        "descriptionTranslated" : null
                        "required": true,
                        "addOn":false,
                        "formatRegex": null,
                        "inputType": 4,
                        "validFrom": null,
                        "validTo": null
                    },
                    {
                        "uuid": "0cbebb60-fa25-4fc1-9712-fd7b716fc9d4",
                        "name": "Arrival Date/Time",
                        "nameTranslated": "Arrival Date/Time",
                        "description": null,
                        "descriptionTranslated": null,
                        "required": true,
                        "addOn":false,
                        "formatRegex": null,
                        "inputType": 11,
                        "validFrom": null,
                        "validTo": null
                    },
                    {
                        "uuid": "79c17fb7-3891-4705-98e5-c3a9459bf639",
                        "name": "Drop-off Address",
                        "nameTranslated": "Drop-off Address",
                        "description": null,
                        "descriptionTranslated": null,
                        "required": true,
                        "addOn": false,
                        "formatRegex": null,
                        "inputType": 9,
                        "validFrom": null,
                        "validTo": null
                    }
                ],
                "perPax": []
            }

  • 订单选项参数说明
    • `uuid` - 订单选项的uuid
    • `name` - 订单选项的标题 例如 "Full name"
    • `nameTranslated` - 订单选项的标题-根据所选的语言
    • `description` - 订单选项的描述。没有描述,为空字符串
    • `descriptionTranslated` - 订单选项的描述-根据所选的语言
    • `required` - true/false, 如果设置成’true’, 在创建订单时如果不包括选项,则无法进行订单创建
    • `addOn` - true/false, 如果设置成’true’, 您应该在产品详细信息页面上显示此选项
    • `formatRegex` - 额外用于在客户端进行验证。例如 flight number: '^[A-Z0-9][A-Z0-9][0-9]{0,4}$', 如果不适用,则为null
    • `inputType` - 整数,HTML输入类型 例如4:string,1:list
    • `validFrom` - 开始日期,如果预订选项在一些特定的时间段内才有效。如果不适用,则为null
    • `validTo` - 结束日期,如果预订选项在一些特定的时间段内才有效。如果不适用,则为null
  • 订单选项可以是每个预订per Booking `perBooking` 或/和 每位访客 `perGuest`. 如果按照每个预订,每个预订请求需要一个选项。如果是每位访客,则每位访客(成人,大人,小孩)都需要一个选项。

    API demo示列如下
    product UUID: d0ac2916-698c-54ef-bd1b-6ecf273c598f
    product-type UUID: b7883bc7-85c9-5ad9-b52f-cabba964e1ba
  • 到目前为止,有些产品是有可能需要订单选项。它们都列在定价端点上。
  • 订单选项可以有一个价格。价格可以是每个选项或每个项目。如果选项有价格,需要将预订选项价格添加到订单总价格中。
    API demo示列如下
    product UUID:
    d4398f47-9fc0-5f38-ba2d-d04a5fe8327e
    product-type UUID: 7b1fa020-2bac-56bc-b145-a3592493ac4f
    每个选项的定价
    "options": {
                "perBooking": [
                    {
                        "uuid": "383f0b49-e7dc-4c24-9640-5ed0370533a1",
                        "name": "Raincoat",
                        "nameTranslated": "Raincoat",
                        "description": "Good for rainy days",
                        "descriptionTranslated": "Good for rainy days",
                        "required": false,
                        "addOn": false,
                        "formatRegex": null,
                        "inputType": 5,
                        "validFrom": null,
                        "validTo": null,
                        "price": 5
                    }
                ],
                "perPax": []
            },

    Example on API demo
    product UUID: e8f0b93c-ee5d-54b7-8813-8004c26c658c1
    product-type UUID: 23fa0c48-17e9-5716-8dac-4a8bb142a17f
    每个项目的定价
    "options": {
                "perBooking": [
                    {
                        "uuid": "0b40932c-53e2-423d-bbf7-b12cc998342e",
                        "name": "Select pickup zone",
                        "nameTranslated": "Selected pickup zone",
                        "description": "Zone 1: Some description where to meet.\nZone 2: Some other description where is the meeting place for this zone.",
                        "descriptionTranslated": "Zone 1: Some description where to meet.\nZone 2: Some other description where is the meeting place for this zone.",
                        "required": true,
                        "addOn": false
                        "formatRegex": null,
                        "inputType": 1,
                        "validFrom": null,
                        "validTo": null,
                        "items": [
                            {
                                "label": "Zone 1 (SGD 10)",
                                "labelTranslated": "Zone 1 (SGD 10)",
                                "value": "Zone 1",
                                "price": 10
                            },
                            {
                                "label": "Zone 2 (SGD 5)",
                                "labelTranslated": "Zone 2 (SGD 5)",
                                "value": "Zone 2",
                                "price": 5
                            }
                        ]
                    }
                ],
                "perPax": []
            },

  • 在POST预订时,选项perBooking在数组中,选项perPax在一个数组中的数组 - 每个pax一个数组。
    {
      "productTypeUuid": "4dd361a3-a964-597a-8a99-06b2a2ca9224",
      "customer": {
        "email": "some.email@domain.com",
        "firstName": "Michal",
        "lastName": "S",
        "phone": "+65 0000 0000",
        "salutation": "Mr."
      },
      "adults": 1,
      "seniors": 0,
      "children": 2,
      "arrivalDate": "2018-08-07",
      "message": null,
      "partnerReference": null,
      "timeSlotUuid": "f1cc0983-e8ed-577c-8b93-a8a7bfdbff5c",
      "options": {
        "perBooking": [
            {
                "uuid": "46db421e-5727-46fc-9f2c-10679e026582",
                "value": "1"
            },
            {
                "uuid": "46db421e-5727-46fc-9f2c-10679e026582",
                "value": "2"
            }
                ],
        "perPax": [
          [
            {
                "uuid": "543f0e45-bdfe-4dc7-af73-e7fd5eda8246",
                "value": 5
            }],
            [
              {
                "uuid": "543f0e45-bdfe-4dc7-af73-e7fd5eda8246",
                "value": 9
              }
            ],
            [
              {
                "uuid": "543f0e45-bdfe-4dc7-af73-e7fd5eda8246",
                "value": 30
            }]
        ]
      }
    }