Skip to content

Commit 4beaade

Browse files
committed
feat: setup app config, scope and procedures
1 parent b509b89 commit 4beaade

File tree

2 files changed

+20
-24
lines changed

2 files changed

+20
-24
lines changed

ecomplus-market.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"app": {
3-
"title": "",
4-
"short_description": "",
3+
"title": "Webhooks",
4+
"short_description": "Webhooks configuráveis para novos pedidos e atualizações de status",
55
"category": "tools"
66
}
77
}

functions/ecom.config.js

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
const app = {
99
app_id: 123113,
10-
title: 'My Awesome E-Com Plus App',
11-
slug: 'my-awesome-app',
10+
title: 'Webhooks',
11+
slug: 'webhooks',
1212
type: 'external',
1313
state: 'active',
1414
authentication: true,
@@ -75,21 +75,21 @@ const app = {
7575
// 'DELETE', // Delete categories
7676
],
7777
customers: [
78-
// 'GET', // List/read customers
78+
'GET', // List/read customers
7979
// 'POST', // Create customers
8080
// 'PATCH', // Edit customers
8181
// 'PUT', // Overwrite customers
8282
// 'DELETE', // Delete customers
8383
],
8484
orders: [
85-
// 'GET', // List/read orders with public and private fields
85+
'GET', // List/read orders with public and private fields
8686
// 'POST', // Create orders
8787
// 'PATCH', // Edit orders
8888
// 'PUT', // Overwrite orders
8989
// 'DELETE', // Delete orders
9090
],
9191
carts: [
92-
// 'GET', // List all carts (no auth needed to read specific cart only)
92+
'GET', // List all carts (no auth needed to read specific cart only)
9393
// 'POST', // Create carts
9494
// 'PATCH', // Edit carts
9595
// 'PUT', // Overwrite carts
@@ -138,37 +138,33 @@ const app = {
138138
},
139139

140140
admin_settings: {
141-
/**
142-
* JSON schema based fields to be configured by merchant and saved to app `data` / `hidden_data`, such as:
143-
144141
webhook_uri: {
145142
schema: {
146143
type: 'string',
147144
maxLength: 255,
148145
format: 'uri',
149-
title: 'Notifications URI',
150-
description: 'Unique notifications URI available on your Custom App dashboard'
146+
title: 'Webhook URI',
147+
description: 'URL de destino para os webhooks',
151148
},
152149
hide: true
153150
},
154-
token: {
151+
webhook_token: {
155152
schema: {
156153
type: 'string',
157154
maxLength: 50,
158-
title: 'App token'
155+
title: 'Token',
156+
description: 'Bearer token opcional para o cabeçalho Authorization',
159157
},
160158
hide: true
161159
},
162-
opt_in: {
160+
skip_pending: {
163161
schema: {
164162
type: 'boolean',
165163
default: false,
166-
title: 'Some config option'
164+
title: 'Ignorar pedidos pendentes',
167165
},
168-
hide: false
166+
hide: true
169167
},
170-
171-
*/
172168
}
173169
}
174170

@@ -181,18 +177,20 @@ const procedures = []
181177

182178
/**
183179
* Uncomment and edit code above to configure `triggers` and receive respective `webhooks`:
180+
*/
184181

185182
const { baseUri } = require('./__env')
186183

187184
procedures.push({
188185
title: app.title,
189186

190187
triggers: [
191-
// Receive notifications when new order is created:
188+
/* Receive notifications when new order is created:
192189
{
193190
resource: 'orders',
194191
action: 'create',
195192
},
193+
*/
196194

197195
// Receive notifications when order financial/fulfillment status are set or changed:
198196
// Obs.: you probably SHOULD NOT enable the orders triggers below and the one above (create) together.
@@ -205,7 +203,7 @@ procedures.push({
205203
field: 'fulfillment_status',
206204
},
207205

208-
// Receive notifications when products/variations stock quantity changes:
206+
/* Receive notifications when products/variations stock quantity changes:
209207
{
210208
resource: 'products',
211209
field: 'quantity',
@@ -229,6 +227,7 @@ procedures.push({
229227
},
230228
231229
// Feel free to create custom combinations with any Store API resource, subresource, action and field.
230+
*/
232231
],
233232

234233
webhooks: [
@@ -243,9 +242,6 @@ procedures.push({
243242
]
244243
})
245244

246-
* You may also edit `routes/ecom/webhook.js` to treat notifications properly.
247-
*/
248-
249245
exports.app = app
250246

251247
exports.procedures = procedures

0 commit comments

Comments
 (0)