forked from lightward/mechanic-tasks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbulk-capture-by-order-number.json
18 lines (18 loc) · 1.21 KB
/
bulk-capture-by-order-number.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{
"docs": "The merchant who created this task uses another app for validating orders in bulk, resulting in a list of order numbers that should be captured. This task prompts the merchant for a list of order numbers, which Mechanic then captures one by one.",
"halt_action_run_sequence_on_error": false,
"name": "Bulk capture orders by order number",
"online_store_javascript": null,
"options": {},
"order_status_javascript": null,
"perform_action_runs_in_sequence": false,
"script": "{% capture newline %}\n{% endcapture %}\n\n{% assign order_numbers = event.data | split: newline %}\n\n{% for authorized_order in shop.orders.authorized %}\n {% capture order_number_string %}{{ authorized_order.order_number }}{% endcapture %}\n {% if order_numbers contains order_number_string %}\n {\n \"action\": {\n \"type\": \"shopify\",\n \"options\": [\n \"post\",\n \"/admin/orders/{{ authorized_order.id }}/transactions.json\",\n { \"transaction\": { \"kind\": \"capture\" } }\n ]\n }\n }\n {% endif %}\n{% endfor %}",
"subscriptions": [
"mechanic/user/text"
],
"subscriptions_template": "mechanic/user/text",
"tags": [
"Bulk",
"Orders"
]
}