-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathon_select.jsonata
More file actions
98 lines (98 loc) · 3.88 KB
/
on_select.jsonata
File metadata and controls
98 lines (98 loc) · 3.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
(
$itemBody := message[0].itemsBody;
{
"context": $context(context, $action),
"message": {
"order": {
"provider": message.{
"id": $string(id),
"descriptor": {
"name": provider_name,
"short_desc": short_desc ? short_desc : "",
"long_desc": long_desc ? long_desc : "",
"additional_desc": {
"url": provider_uri
},
"images": items.image.{
"url": url?url:"https://abc.com",
"size_type": size_type?size_type:"sm"
}[]
},
"categories": category_ids. {
"id": $string(id),
"descriptor": {
"name": value
}
}[],
"rating": provider_rating,
"locations": $locations($append(location_id, [items.item_fulfillment_ids.location_id])),
"fulfillments": $fulfillments(fulfillments, items),
"rateable": true
},
"items": message.items.{
"id": $string(id),
"descriptor": {
"name": name ? name : "",
"code": code ? code : "",
"short_desc": short_desc ? short_desc : "",
"long_desc": long_desc ? long_desc : "",
"images": image.{
"url": url?url:"https://abc.com",
"size_type": size_type?size_type:"sm"
}[]
},
"rating":$string(sc_retail_product.average_rating),
"rateable": true,
"location_ids": $count(item_fulfillment_ids) > 0 ?
$map(item_fulfillment_ids, function($v){
$string($v.location_id.id)
})[] :
[],
"price": $price(sc_retail_product),
"quantity": sc_retail_product.{
"available": {
"count": stock_quantity ? stock_quantity : 0,
"measure":{
"value": $string(stock_quantity ? stock_quantity : 0),
"unit": quantity_unit
}
}
},
"category_ids": $map(
$filter(cat_attr_tag_relations, function($v) { $v.taxanomy = 'CATEGORY'}),
function($v) {
$string($v.taxanomy_id.id)
}
)[],
"fulfillment_ids": $count(item_fulfillment_ids) > 0 ?
$map(item_fulfillment_ids, function($v){
$string($v.fulfilment_id.id)
})[] :
[],
"tags": $tags(cat_attr_tag_relations),
"xinput": {
"form": {
"url": $xInput(%.%.context),
"mime_type": "text/html"
}
},
"time": {
"duration": service.time_slot_per_client_in_min ? $string(service.time_slot_per_client_in_min) : ""
}
}[],
"quote": $quotePrice(message[0].items, message[0].itemsBody, context),
"categories": $map(message.category_ids, function($v) {
{
"id": $string($v.id),
"value": $v.value,
"createdAt": $v.createdAt,
"updatedAt": $v.updatedAt,
"publishedAt": $v.publishedAt,
"category_code": $v.category_code
}
}),
"fulfillments": $fulfillments(message.fulfillments, message.items)
}
}
}
)