Skip to content

Commit

Permalink
Documented the item event / discount edit webhook
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Jackson committed Dec 22, 2016
1 parent e93873e commit 3e34cc1
Show file tree
Hide file tree
Showing 6 changed files with 330 additions and 31 deletions.
59 changes: 31 additions & 28 deletions docs/examples/response/webhook-booking.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,35 +46,38 @@
}
},
"items": {
"item": [{
"@attributes": {
"line_id": "1",
"item_id": "6"
},
"start_date": "1394128800",
"end_date": "1394128800",
"sku": "paddle",
"slip": {},
"package_id": "1",
"status": "HOLD",
"total": "6.30",
"tax_total": "0.30",
"qty": "2"
}, {
"@attributes": {
"line_id": "2",
"item_id": "8"
"item": [
{
"@attributes": {
"line_id": "1",
"item_id": "6"
},
"start_date": "1394128800",
"end_date": "1394128800",
"sku": "paddle",
"slip": {},
"package_id": "1",
"status": "HOLD",
"total": "6.30",
"tax_total": "0.30",
"qty": "2"
},
"start_date": "1394092800",
"end_date": "1394092800",
"sku": "paddleboard",
"slip": {},
"package_id": "1",
"status": "HOLD",
"total": "42.00",
"tax_total": "2.00",
"qty": "2"
}]
{
"@attributes": {
"line_id": "2",
"item_id": "8"
},
"start_date": "1394092800",
"end_date": "1394092800",
"sku": "paddleboard",
"slip": {},
"package_id": "1",
"status": "HOLD",
"total": "42.00",
"tax_total": "2.00",
"qty": "2"
}
]
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion docs/examples/response/webhook-booking.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" ?>
<checkfront-notify version="3.0" host="your-company.checkfront.com">
<booking booking_id="157">
<status>HOLD</status><code>KMVQ-060314</code>
<status>HOLD</status>
<code>KMVQ-060314</code>
<created_date>1394156618</created_date>
<staff_id>1</staff_id>
<source_ip>66.228.55.142</source_ip>
Expand Down
70 changes: 70 additions & 0 deletions docs/examples/response/webhook-item-event-edit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"version": "3.11.0.0",
"host": "test.checkfront.com",
"type": "rate",
"action": "update",
"rate": {
"rate_id": 8,
"name": "Max 3 Days",
"start_date": 20161221,
"end_date": 0,
"span": 0,
"price_src": "Yield",
"dynamic_rate": 10,
"status": "A",
"type": "SP",
"repeat_id": "W",
"enabled": 1,
"details": {
"thresholds": [
{
"threshold": {
"level": 5,
"rate": 150.5
}
},
{
"threshold": {
"level": 2,
"rate": 200
}
}
]
},
"repeat": {
"days": {
"tue": 1,
"sat": 1
}
},
"rule_set_id": 1,
"dynamic_type": "P",
"apply_to": {
"items": [
{
"id": 14
},
{
"id": 16
},
{
"id": 35
},
{
"id": 36
},
{
"id": 37
}
],
"categories": [
{
"id": 3
},
{
"id": 5
}
]
}
}
}
51 changes: 51 additions & 0 deletions docs/examples/response/webhook-item-event-edit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<checkfront-notify version="3.11.0.0" host="test.checkfront.com">
<type>rate</type>
<action>update</action>
<rate>
<rate_id>8</rate_id>
<name>Max 3 Days</name>
<start_date>20161221</start_date>
<end_date>0</end_date>
<span>0</span>
<price_src>Yield</price_src>
<dynamic_rate>10</dynamic_rate>
<status>A</status>
<type>SP</type>
<repeat_id>W</repeat_id>
<enabled>1</enabled>
<details>
<thresholds>
<threshold>
<level>5</level>
<rate>150.5</rate>
</threshold>
<threshold>
<level>2</level>
<rate>200</rate>
</threshold>
</thresholds>
</details>
<repeat>
<days>
<tue>1</tue>
<sat>1</sat>
</days>
</repeat>
<rule_set_id>1</rule_set_id>
<dynamic_type>P</dynamic_type>
<apply_to>
<items>
<id>14</id>
<id>16</id>
<id>35</id>
<id>36</id>
<id>37</id>
</items>
<categories>
<id>3</id>
<id>5</id>
</categories>
</apply_to>
</rate>
</checkfront-notify>
174 changes: 174 additions & 0 deletions docs/ref/webhook/item-event.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,176 @@
Item Event/Discount Edit
^^^^^^^^^^^^^^^^^^^^^^^^

This webhook is triggered whenever any item events or discounts are altered on your account.
Because of their similarities, **Item Events and Discounts are both called "rates"**. When
fields have specific meanings for either Item Events or Discounts, those differences are defined
in the Description column.

A **JSON**, **XML**, or **x-www-form-urlencoded** object containing the following export fields can
be found in directly in the **raw body** of the POST request to your server:

rate
----
+---------------------------+---------------+------------------------------------------------------+
| Field | Type | Description |
+===========================+===============+======================================================+
| **rate_id** | *integer* | A unique code used to refer to this rate |
+---------------------------+---------------+------------------------------------------------------+
| **name** | *string* | The name of this rate |
+---------------------------+---------------+------------------------------------------------------+
| **type** | *string* | Item Events: "SP" for "Special" events, "SE" for |
| | | "Seasonal" events. |
| | | Discounts: "DC" for "Discount" |
+---------------------------+---------------+------------------------------------------------------+
| **start_date** | *integer* | The date *(yyyymmdd)* when this rate starts to apply |
+---------------------------+---------------+------------------------------------------------------+
| **end_date** | *integer* | The date *(yyyymmdd)* when this rate stops applying |
| | | (0 if the rate has no end date) |
+---------------------------+---------------+------------------------------------------------------+
| **span** | *integer* | The "Force item length to |
| | | the above start and end dates" option |
| | | (1 if selected, 0 if not selected) |
+---------------------------+---------------+------------------------------------------------------+
| **price_src** | *string* | If applicable, the type of price modification for |
| | | this rate ("Base Price" is "B", |
| | | "Create new Price Point" is "N", "Dynamic" is "D", |
| | | "Yield" is "Yield") |
+---------------------------+---------------+------------------------------------------------------+
| **dynamic_rate** | *decimal* | If this event is a "Dynamic" price rate |
| | | (*price_src* is "D"), this value holds the |
| | | rate's percent change or fixed amount price. |
+---------------------------+---------------+------------------------------------------------------+
| **dynamic_type** | *string* | Dynamic Price rates: "P" for percent, "F" for |
| | | fixed amount |
+---------------------------+---------------+------------------------------------------------------+
| **status** | *string* | Item Events: whether this is an available ("A") |
| | | or unavailable ("U") event. |
| | | Discounts: always available ("A") |
+---------------------------+---------------+------------------------------------------------------+
| **repeat_id** | *string* | If the rate is not recurring, this value is blank. |
| | | Weekly recurring events are "W", "Always" recurring |
| | | events are "*". |
+---------------------------+---------------+------------------------------------------------------+
| **enabled** | *integer* | If the rate is enabled, 1, otherwise |
| | | 0 when disabled. |
+---------------------------+---------------+------------------------------------------------------+
| **rule_set_id** | *integer* | The ruleset id applying to this |
| | | event. The default ruleset id is 1. |
+---------------------------+---------------+------------------------------------------------------+
| **vouchers** | *integer* | Discounts: the |
| | | number of vouchers attached to this discount. |
+---------------------------+---------------+------------------------------------------------------+
| **details** | *object* | See :ref:`note-rate-details` below. |
+---------------------------+---------------+------------------------------------------------------+
| **repeat** | *object* | See :ref:`note-rate-repeat` below. |
+---------------------------+---------------+------------------------------------------------------+
| **apply_to** | *object* | See :ref:`note-rate-apply-to` below. |
+---------------------------+---------------+------------------------------------------------------+

.. _note-rate-details:

rate.details
------------
+---------------------------+---------------+------------------------------------------------------+
| Field | Type | Description |
+===========================+===============+======================================================+
| **thresholds** | *object* | If this is rate has a "Yield" **price_src**, |
| | | this element will contain a list of objects |
| | | containing a level and rate pair for each threshold. |
| | | See :ref:`note-rate-details-thresholds` below |
+---------------------------+---------------+------------------------------------------------------+

.. _note-rate-details-thresholds:

rate.details.thresholds
-----------------------
+---------------------------+---------------+------------------------------------------------------+
| Field | Type | Description |
+===========================+===============+======================================================+
| **threshold** | *object* | This contains a pair of level and rate values for a |
| | | threshold. |
| | | See :ref:`note-rate-details-threshold-pair` below |
+---------------------------+---------------+------------------------------------------------------+

.. _note-rate-details-threshold-pair:

rate.details.thresholds.threshold
---------------------------------
+---------------------------+---------------+------------------------------------------------------+
| Field | Type | Description |
+===========================+===============+======================================================+
| **level** | *integer* | The inventory threshold at which this Yield priced |
| | | rate applies |
+---------------------------+---------------+------------------------------------------------------+
| **rate** | *decimal* | The percentage price multiplier for this threshold |
+---------------------------+---------------+------------------------------------------------------+

.. _note-rate-repeat:

rate.repeat
-----------
+---------------------------+---------------+------------------------------------------------------+
| Field | Type | Description |
+===========================+===============+======================================================+
| **days** | *object* | If set, this rate repeats on specific days of the |
| | | week. See :ref:`note-rate-repeat-days` below. |
+---------------------------+---------------+------------------------------------------------------+

.. _note-rate-repeat-days:

rate.repeat.days
----------------
+---------------------------+---------------+------------------------------------------------------+
| Field | Type | Description |
+===========================+===============+======================================================+
| **<day of week | *integer* | The rate repeats for this day of the week. |
| abbreviation>** | | |
| (e.g., mon, tue,...) | | |
+---------------------------+---------------+------------------------------------------------------+

.. _note-rate-apply-to:

rate.apply_to
-------------
+---------------------------+---------------+------------------------------------------------------+
| Field | Type | Description |
+===========================+===============+======================================================+
| **items** / **categories**| *object* | This object contains a list of the items or |
| | | categories which this rate applies to. |
| | | See :ref:`note-rate-apply-to-values` below. |
+---------------------------+---------------+------------------------------------------------------+

.. _note-rate-apply-to-values:

rate.apply_to.items
-------------------
+---------------------------+---------------+------------------------------------------------------+
| Field | Type | Description |
+===========================+===============+======================================================+
| **id** | *integer* | An item_id which this rate applies to |
+---------------------------+---------------+------------------------------------------------------+

rate.apply_to.categories
------------------------
+---------------------------+---------------+------------------------------------------------------+
| Field | Type | Description |
+===========================+===============+======================================================+
| **id** | *integer* | This contains a category_id which this rate has |
| | | completely selected. **This rate will apply to any |
| | | new items that are added to this category.** |
+---------------------------+---------------+------------------------------------------------------+

Sample Rate Notification
------------------------

JSON
~~~~
.. literalinclude:: ../../examples/response/webhook-item-event-edit.json
:language: json
:linenos:

XML
~~~
.. literalinclude:: ../../examples/response/webhook-item-event-edit.xml
:language: xml
:linenos:
4 changes: 2 additions & 2 deletions docs/ref/webhook/payment.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
New Payment/Refund
^^^^^^^^^^^^^^^^^^

This webhook is triggered whenever any transactions are added or refunded on your account.
This webhook is triggered whenever any transactions are created or refunded on your account.

A **JSON**, **XML**, or **x-www-form-urlencoded** object containing the following export fields can
be found in directly in the **raw body** of the POST request to your server:
Expand All @@ -24,7 +24,7 @@ payment
| | | transaction |
+---------------------------+---------------+---------------------------------------------------+
| **payment_mask** | *integer* | The last four digits of the card, or |
| | | (POS) for a POS transaction. |
| | | (POS) for a POS transaction |
+---------------------------+---------------+---------------------------------------------------+
| **payment_type** | *string* | The type of card used, or the type of POS |
| | | transaction |
Expand Down

0 comments on commit 3e34cc1

Please sign in to comment.