Company public service methods: Difference between revisions
No edit summary |
|||
| Line 14: | Line 14: | ||
* <code>id</code> - The id of the request it is responding to. | * <code>id</code> - The id of the request it is responding to. | ||
Example | Example | ||
<pre> | <pre> | ||
| Line 33: | Line 33: | ||
"duration": "60", | "duration": "60", | ||
"hide_duration": "0", | "hide_duration": "0", | ||
"description": "<p> | "description": "<p>Если Вы хотите попробовать себя в роли модели, но не определились с образом. <br /> 5-7 отретушированных и готовых к печати фотографий + отснятый материал на диске</p>", | ||
"picture": "a200edab10b669225e22d2b3803a38b5.jpg", | "picture": "a200edab10b669225e22d2b3803a38b5.jpg", | ||
"is_public": "1", | "is_public": "1", | ||
| Line 84: | Line 84: | ||
===Authentication=== | ===Authentication=== | ||
Using Simplybook API methods require an authentification. To authorize in Simplybook API you need to get an access key — access-token. In order to get this access-token you should call the JSON-RPC method <code>[[Authentication#getToken|getToken]]</code> API method on https://user-api.simplybook.me/login service passing your personal API-key. You can copy your API-key at admin interface: go to the 'Plugins' link and select [[Plugins#API|API plugin]] 'Settings'. | Using Simplybook API methods require an authentification. To authorize in Simplybook API you need to get an access key — access-token. In order to get this access-token you should call the JSON-RPC method <code>[[Authentication#getToken|getToken]]</code> API method on https://user-api.simplybook.me/login service passing your personal API-key. You can copy your API-key at admin interface: go to the 'Plugins' link and select [[Plugins#API|API plugin]] 'Settings'. | ||
== Methods == | == Methods == | ||
| Line 126: | Line 126: | ||
* [http://wiki.simplybook.me/index.php/Settings#Timeframe Timeframe information] | * [http://wiki.simplybook.me/index.php/Settings#Timeframe Timeframe information] | ||
---- | ---- | ||
| Line 219: | Line 202: | ||
---- | ---- | ||
=== | === confirmBookingCart === | ||
<code> | <code>confirmBookingCart($cartId, $paymentProcessor, $sign)</code> | ||
Parameters: | Parameters: | ||
* '''$ | * '''$cartId''' Integer - cart id | ||
* '''$paymentProcessor''' String | * '''$paymentProcessor''' String - payment processor name | ||
* '''$sign''' String | * '''$sign''' String - signature. (md5($cartId . $cartHash . $secretKey)) | ||
Returns Boolean. | Returns Boolean. | ||
Confirm booking payment. Signature is required. | Confirm booking cart. Use it to confirm payment. Signature is required. | ||
---- | ---- | ||
=== | === confirmBookingPayment === | ||
<code> | <code>confirmBookingPayment($id, $paymentProcessor, $sign)</code> | ||
Parameters: | Parameters: | ||
* '''$ | * '''$id''' Integer | ||
* '''$paymentProcessor''' String | |||
* '''$sign''' String | |||
Returns | Returns Boolean. | ||
Confirm booking payment. Signature is required.$sign = md5($bookingId . $bookingHash . $secretKey); | |||
Call this method from server side only | |||
---- | ---- | ||
=== | === getBooking === | ||
<code> | <code>getBooking($id, $sign)</code> | ||
Parameters: | Parameters: | ||
* '''$ | * '''$id''' Integer | ||
* '''$ | * '''$sign''' String | ||
Returns | Returns Object. | ||
Returns | Returns an object with details information about booking. <code>$sign</code> parameter must be a string created | ||
with formula: <code>md5($bookingId . $bookingHash . $secretKey)</code>. You can get <code>$bookingHash</code> | |||
value as result of <code>[[#book|book]]</code> API method call. Method return an error with code -32080 | |||
(Appointment couldn't be found) if record with specified id not exists. Methods returns an error with code -32085 | |||
(Signature error) if <code>$sign</code> parameter is wrong. | |||
---- | ---- | ||
=== | === getBookingCart === | ||
<code> | <code>getBookingCart($bookingIds)</code> | ||
Parameters: | Parameters: | ||
* '''$ | * '''$bookingIds''' Array | ||
Returns Object. | Returns Object. | ||
Returns | Returns cart information by bookings ids.<code>cart_id</code> and <code>cart_hash</code> is used to create secure signature to confirm cart payment. | ||
<code>amount</code> - is total amount to payment | |||
<code>currency</code> - cart currency | |||
( | <code>cart</code> - contains cart items. You can use them to provide information for payment system. Each item is object with following fields: | ||
<code>id</code> - booking id | |||
<code>event_id</code> - service id | |||
<code>name</code> - event name + start date time (use it to provide cart information for payment system) | |||
<code>price</code> - booking price | |||
<code>qty</code> - qty of bookings | |||
| Line 355: | Line 310: | ||
Returns Array. | Returns Array. | ||
{@inheritdoc} | |||
| Line 414: | Line 326: | ||
Returns Array. | Returns Array. | ||
{@inheritdoc} | |||
| Line 438: | Line 333: | ||
=== getLocationsList === | === getLocationsList === | ||
<code>getLocationsList($isPublic)</code> | <code>getLocationsList($isPublic, $asArray)</code> | ||
Parameters: | Parameters: | ||
* '''$isPublic''' Boolean | * '''$isPublic''' Boolean | ||
* '''$asArray''' | |||
Returns Array. | Returns Array. | ||
{@inheritdoc} | |||
| Line 464: | Line 358: | ||
Returns payment processor config | Returns payment processor config | ||
| Line 519: | Line 378: | ||
---- | ---- | ||
=== | === getPromotionRewardInfo === | ||
<code> | <code>getPromotionRewardInfo($commonPromotionId, $clientId, $hash)</code> | ||
Parameters: | Parameters: | ||
* '''$ | * '''$commonPromotionId''' Integer | ||
* '''$clientId''' Integer | |||
* '''$hash''' String | |||
* '''$ | |||
* '''$ | |||
Returns | Returns Array|null. | ||
Returns | Returns promotion reward by common promotion id, client id and hash. | ||
---- | ---- | ||
=== | === getRecurringDatetimes === | ||
<code> | <code>getRecurringDatetimes($eventId, $unitId, $date, $time, $recurringData)</code> | ||
Parameters: | Parameters: | ||
* '''$eventId''' Integer | * '''$eventId''' Integer | ||
* '''$unitId''' | * '''$unitId''' Integer | ||
* '''$ | * '''$date''' String | ||
* '''$time''' String | |||
* '''$recurringData''' Array | |||
Returns | Returns Array. | ||
Get list of dates for recurring booking | |||
| Line 586: | Line 425: | ||
Returns Array. | Returns Array. | ||
{@inheritdoc} | |||
---- | ---- | ||
=== | === getUserLicenseText === | ||
<code> | <code>getUserLicenseText()</code> | ||
No arguments. | |||
Returns String. | |||
Returns | |||
Returns | Returns user license text if user license plugin is turned on, | ||
otherwise throws exception | |||
| Line 654: | Line 467: | ||
Return true if event payments plugin is turned on and prices were set, | Return true if event payments plugin is turned on and prices were set, | ||
else return false. | else return false. | ||
| Line 718: | Line 516: | ||
* -32011 Params is not array | * -32011 Params is not array | ||
* -32012 Sheduler id not found | * -32012 Sheduler id not found | ||
* -32015 Passed event id is not reccuren | |||
* -32020 Sorry, you have no permissions to perform this action | * -32020 Sorry, you have no permissions to perform this action | ||
* -32030 Invalid promotion code | * -32030 Invalid promotion code | ||
| Line 762: | Line 561: | ||
* allow_event_day_break | * allow_event_day_break | ||
*: <code>true</code> if service can extend over closing hours | *: <code>true</code> if service can extend over closing hours | ||
* changable_prefix_by_client | |||
* company_timezone | * company_timezone | ||
* date_format | * date_format | ||
| Line 791: | Line 591: | ||
** classic | ** classic | ||
*: Please note that <code>classic</code> timeline type is deprecated and not supported anymore. | *: Please note that <code>classic</code> timeline type is deprecated and not supported anymore. | ||
---- | ---- | ||
| Line 960: | Line 761: | ||
* modern_week | * modern_week | ||
* classic | * classic | ||
* classes | |||
<code> | Please note that <code>classic</code> timeline type is deprecated and not supported anymore. | ||
<code>description</code> field contains raw data of company's description which can include HTML tags. <code>description_text</code> field contains only text information without HTML tags. | <code>description</code> field contains raw data of company's description which can include HTML tags. <code>description_text</code> field contains only text information without HTML tags. | ||
For information about <code>timeframe</code>, <code>timezone</code>, <code>allow_event_day_break</code> and <code>allow_event_breaktime_break</code> see [[#Company params|Company params section]]. | |||
---- | ---- | ||
| Line 996: | Line 799: | ||
<code>service_ids</code> contains a list of services for wich promotion discount can be applied. | <code>service_ids</code> contains a list of services for wich promotion discount can be applied. | ||
---- | |||
====getLocationsList response==== | |||
{ | |||
"1": { | |||
"id": "1", | |||
"title": "location 1", | |||
"description": null, | |||
"picture": "e1e9409fe9682c78b2f8f294dc151af0.jpg", | |||
"address1": null, | |||
"address2": "Saint Margaret Street", | |||
"city": "London", | |||
"zip": null, | |||
"country_id": "GB", | |||
"lat": "51.50013000000000000000", | |||
"lng": "-0.12630500000000000000", | |||
"phone": "", | |||
"position": "1", | |||
"is_default": "1", | |||
"file_id": "4", | |||
"picture_sub_path": "\/image_files", | |||
"picture_path": "\/uploads\/mycompany\/image_files\/small\/e1e9409fe9682c78b2f8f294dc151af0.jpg", | |||
"units": ["1", "3", "4", "5"] | |||
}, | |||
... | |||
} | |||
<code>position</code> property of location object used for order list. <code>units</code> array contains list of performers ids associated with location. | |||