@commercelayer/cli-plugin-triggers 4.8.0 → 4.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -0
- package/lib/commands/authorization/cancel.d.ts +9 -0
- package/lib/commands/authorization/cancel.js +22 -0
- package/lib/commands/capture/cancel.d.ts +9 -0
- package/lib/commands/capture/cancel.js +22 -0
- package/lib/triggers/authorizations.d.ts +1 -1
- package/lib/triggers/authorizations.js +5 -0
- package/lib/triggers/captures.d.ts +1 -1
- package/lib/triggers/captures.js +5 -0
- package/oclif.manifest.json +177 -1
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -33,6 +33,7 @@ $ commercelayer plugins:install triggers
|
|
|
33
33
|
* [`commercelayer adyen_payment ID`](#commercelayer-adyen_payment-id)
|
|
34
34
|
* [`commercelayer adyen_payment:details ID`](#commercelayer-adyen_paymentdetails-id)
|
|
35
35
|
* [`commercelayer authorization ID`](#commercelayer-authorization-id)
|
|
36
|
+
* [`commercelayer authorization:cancel ID`](#commercelayer-authorizationcancel-id)
|
|
36
37
|
* [`commercelayer authorization:capture ID`](#commercelayer-authorizationcapture-id)
|
|
37
38
|
* [`commercelayer authorization:capture_amount_cents ID`](#commercelayer-authorizationcapture_amount_cents-id)
|
|
38
39
|
* [`commercelayer authorization:forward ID`](#commercelayer-authorizationforward-id)
|
|
@@ -46,6 +47,7 @@ $ commercelayer plugins:install triggers
|
|
|
46
47
|
* [`commercelayer buy_x_pay_y_promotion:disable ID`](#commercelayer-buy_x_pay_y_promotiondisable-id)
|
|
47
48
|
* [`commercelayer buy_x_pay_y_promotion:enable ID`](#commercelayer-buy_x_pay_y_promotionenable-id)
|
|
48
49
|
* [`commercelayer capture ID`](#commercelayer-capture-id)
|
|
50
|
+
* [`commercelayer capture:cancel ID`](#commercelayer-capturecancel-id)
|
|
49
51
|
* [`commercelayer capture:forward ID`](#commercelayer-captureforward-id)
|
|
50
52
|
* [`commercelayer capture:refund ID`](#commercelayer-capturerefund-id)
|
|
51
53
|
* [`commercelayer capture:refund_amount_cents ID`](#commercelayer-capturerefund_amount_cents-id)
|
|
@@ -271,6 +273,28 @@ DESCRIPTION
|
|
|
271
273
|
|
|
272
274
|
_See code: [src/commands/authorization/index.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/authorization/index.ts)_
|
|
273
275
|
|
|
276
|
+
### `commercelayer authorization:cancel ID`
|
|
277
|
+
|
|
278
|
+
Send this attribute if you want to void a succeeded authorization of a pending order (which is left unpaid).
|
|
279
|
+
|
|
280
|
+
```sh-session
|
|
281
|
+
USAGE
|
|
282
|
+
$ commercelayer authorization:cancel ID [-u [-j -p]]
|
|
283
|
+
|
|
284
|
+
ARGUMENTS
|
|
285
|
+
ID the unique id of the resource
|
|
286
|
+
|
|
287
|
+
FLAGS
|
|
288
|
+
-j, --json print result in JSON format
|
|
289
|
+
-p, --print print out the modified resource
|
|
290
|
+
-u, --unformatted print JSON output without indentation
|
|
291
|
+
|
|
292
|
+
DESCRIPTION
|
|
293
|
+
Send this attribute if you want to void a succeeded authorization of a pending order (which is left unpaid).
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
_See code: [src/commands/authorization/cancel.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/authorization/cancel.ts)_
|
|
297
|
+
|
|
274
298
|
### `commercelayer authorization:capture ID`
|
|
275
299
|
|
|
276
300
|
Send this attribute if you want to create a capture for this authorization.
|
|
@@ -560,6 +584,28 @@ DESCRIPTION
|
|
|
560
584
|
|
|
561
585
|
_See code: [src/commands/capture/index.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/capture/index.ts)_
|
|
562
586
|
|
|
587
|
+
### `commercelayer capture:cancel ID`
|
|
588
|
+
|
|
589
|
+
Send this attribute if you want to refund a succeeded capture of a pending order (which is left unpaid).
|
|
590
|
+
|
|
591
|
+
```sh-session
|
|
592
|
+
USAGE
|
|
593
|
+
$ commercelayer capture:cancel ID [-u [-j -p]]
|
|
594
|
+
|
|
595
|
+
ARGUMENTS
|
|
596
|
+
ID the unique id of the resource
|
|
597
|
+
|
|
598
|
+
FLAGS
|
|
599
|
+
-j, --json print result in JSON format
|
|
600
|
+
-p, --print print out the modified resource
|
|
601
|
+
-u, --unformatted print JSON output without indentation
|
|
602
|
+
|
|
603
|
+
DESCRIPTION
|
|
604
|
+
Send this attribute if you want to refund a succeeded capture of a pending order (which is left unpaid).
|
|
605
|
+
```
|
|
606
|
+
|
|
607
|
+
_See code: [src/commands/capture/cancel.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/capture/cancel.ts)_
|
|
608
|
+
|
|
563
609
|
### `commercelayer capture:forward ID`
|
|
564
610
|
|
|
565
611
|
Send this attribute if you want to forward a stuck transaction to succeeded and update associated order states accordingly.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import Command from '../../base';
|
|
2
|
+
export default class AuthorizationCancel extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {};
|
|
5
|
+
static args: {
|
|
6
|
+
id: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
run(): Promise<any>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const base_1 = tslib_1.__importDefault(require("../../base"));
|
|
5
|
+
const authorizations_1 = require("../../triggers/authorizations");
|
|
6
|
+
const TRIGGER = 'cancel';
|
|
7
|
+
class AuthorizationCancel extends base_1.default {
|
|
8
|
+
static description = authorizations_1.triggers[TRIGGER].description;
|
|
9
|
+
static flags = {};
|
|
10
|
+
static args = {
|
|
11
|
+
...base_1.default.args,
|
|
12
|
+
};
|
|
13
|
+
async run() {
|
|
14
|
+
const { args, flags } = await this.parse(AuthorizationCancel);
|
|
15
|
+
const res = await this.executeAction('authorizations', args.id, TRIGGER, flags);
|
|
16
|
+
if (flags.print)
|
|
17
|
+
this.printOutput(res, flags);
|
|
18
|
+
this.successMessage('authorization', TRIGGER, res.id);
|
|
19
|
+
return res;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.default = AuthorizationCancel;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import Command from '../../base';
|
|
2
|
+
export default class CaptureCancel extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {};
|
|
5
|
+
static args: {
|
|
6
|
+
id: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
run(): Promise<any>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const base_1 = tslib_1.__importDefault(require("../../base"));
|
|
5
|
+
const captures_1 = require("../../triggers/captures");
|
|
6
|
+
const TRIGGER = 'cancel';
|
|
7
|
+
class CaptureCancel extends base_1.default {
|
|
8
|
+
static description = captures_1.triggers[TRIGGER].description;
|
|
9
|
+
static flags = {};
|
|
10
|
+
static args = {
|
|
11
|
+
...base_1.default.args,
|
|
12
|
+
};
|
|
13
|
+
async run() {
|
|
14
|
+
const { args, flags } = await this.parse(CaptureCancel);
|
|
15
|
+
const res = await this.executeAction('captures', args.id, TRIGGER, flags);
|
|
16
|
+
if (flags.print)
|
|
17
|
+
this.printOutput(res, flags);
|
|
18
|
+
this.successMessage('capture', TRIGGER, res.id);
|
|
19
|
+
return res;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.default = CaptureCancel;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Trigger } from '../common';
|
|
2
2
|
export declare const triggers: Record<string, Trigger>;
|
|
3
|
-
export type ActionType = 'forward' | 'capture' | 'capture_amount_cents' | 'void';
|
|
3
|
+
export type ActionType = 'forward' | 'capture' | 'capture_amount_cents' | 'void' | 'cancel';
|
|
@@ -22,4 +22,9 @@ exports.triggers = {
|
|
|
22
22
|
trigger: '_void',
|
|
23
23
|
description: 'Send this attribute if you want to create a void for this authorization.',
|
|
24
24
|
},
|
|
25
|
+
cancel: {
|
|
26
|
+
action: 'cancel',
|
|
27
|
+
trigger: '_cancel',
|
|
28
|
+
description: 'Send this attribute if you want to void a succeeded authorization of a pending order (which is left unpaid).',
|
|
29
|
+
},
|
|
25
30
|
};
|
package/lib/triggers/captures.js
CHANGED
|
@@ -17,4 +17,9 @@ exports.triggers = {
|
|
|
17
17
|
trigger: '_refund_amount_cents',
|
|
18
18
|
description: 'Send this attribute as a value in cents if you want to overwrite the amount to be refunded.',
|
|
19
19
|
},
|
|
20
|
+
cancel: {
|
|
21
|
+
action: 'cancel',
|
|
22
|
+
trigger: '_cancel',
|
|
23
|
+
description: 'Send this attribute if you want to refund a succeeded capture of a pending order (which is left unpaid).',
|
|
24
|
+
},
|
|
20
25
|
};
|
package/oclif.manifest.json
CHANGED
|
@@ -196,6 +196,94 @@
|
|
|
196
196
|
"index.js"
|
|
197
197
|
]
|
|
198
198
|
},
|
|
199
|
+
"authorization:cancel": {
|
|
200
|
+
"aliases": [],
|
|
201
|
+
"args": {
|
|
202
|
+
"id": {
|
|
203
|
+
"description": "the unique id of the resource",
|
|
204
|
+
"name": "id",
|
|
205
|
+
"required": true
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
"description": "Send this attribute if you want to void a succeeded authorization of a pending order (which is left unpaid).",
|
|
209
|
+
"flags": {
|
|
210
|
+
"organization": {
|
|
211
|
+
"char": "o",
|
|
212
|
+
"description": "the slug of your organization",
|
|
213
|
+
"env": "CL_CLI_ORGANIZATION",
|
|
214
|
+
"hidden": true,
|
|
215
|
+
"name": "organization",
|
|
216
|
+
"required": true,
|
|
217
|
+
"hasDynamicHelp": false,
|
|
218
|
+
"multiple": false,
|
|
219
|
+
"type": "option"
|
|
220
|
+
},
|
|
221
|
+
"domain": {
|
|
222
|
+
"char": "d",
|
|
223
|
+
"dependsOn": [
|
|
224
|
+
"organization"
|
|
225
|
+
],
|
|
226
|
+
"env": "CL_CLI_DOMAIN",
|
|
227
|
+
"hidden": true,
|
|
228
|
+
"name": "domain",
|
|
229
|
+
"required": false,
|
|
230
|
+
"hasDynamicHelp": false,
|
|
231
|
+
"multiple": false,
|
|
232
|
+
"type": "option"
|
|
233
|
+
},
|
|
234
|
+
"accessToken": {
|
|
235
|
+
"env": "CL_CLI_ACCESS_TOKEN",
|
|
236
|
+
"hidden": true,
|
|
237
|
+
"name": "accessToken",
|
|
238
|
+
"required": true,
|
|
239
|
+
"hasDynamicHelp": false,
|
|
240
|
+
"multiple": false,
|
|
241
|
+
"type": "option"
|
|
242
|
+
},
|
|
243
|
+
"print": {
|
|
244
|
+
"char": "p",
|
|
245
|
+
"description": "print out the modified resource",
|
|
246
|
+
"name": "print",
|
|
247
|
+
"allowNo": false,
|
|
248
|
+
"type": "boolean"
|
|
249
|
+
},
|
|
250
|
+
"json": {
|
|
251
|
+
"char": "j",
|
|
252
|
+
"dependsOn": [
|
|
253
|
+
"print"
|
|
254
|
+
],
|
|
255
|
+
"description": "print result in JSON format",
|
|
256
|
+
"name": "json",
|
|
257
|
+
"allowNo": false,
|
|
258
|
+
"type": "boolean"
|
|
259
|
+
},
|
|
260
|
+
"unformatted": {
|
|
261
|
+
"char": "u",
|
|
262
|
+
"dependsOn": [
|
|
263
|
+
"json"
|
|
264
|
+
],
|
|
265
|
+
"description": "print JSON output without indentation",
|
|
266
|
+
"name": "unformatted",
|
|
267
|
+
"allowNo": false,
|
|
268
|
+
"type": "boolean"
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
"hasDynamicHelp": false,
|
|
272
|
+
"hiddenAliases": [],
|
|
273
|
+
"id": "authorization:cancel",
|
|
274
|
+
"pluginAlias": "@commercelayer/cli-plugin-triggers",
|
|
275
|
+
"pluginName": "@commercelayer/cli-plugin-triggers",
|
|
276
|
+
"pluginType": "core",
|
|
277
|
+
"strict": true,
|
|
278
|
+
"enableJsonFlag": false,
|
|
279
|
+
"isESM": false,
|
|
280
|
+
"relativePath": [
|
|
281
|
+
"lib",
|
|
282
|
+
"commands",
|
|
283
|
+
"authorization",
|
|
284
|
+
"cancel.js"
|
|
285
|
+
]
|
|
286
|
+
},
|
|
199
287
|
"authorization:capture": {
|
|
200
288
|
"aliases": [],
|
|
201
289
|
"args": {
|
|
@@ -1340,6 +1428,94 @@
|
|
|
1340
1428
|
"index.js"
|
|
1341
1429
|
]
|
|
1342
1430
|
},
|
|
1431
|
+
"capture:cancel": {
|
|
1432
|
+
"aliases": [],
|
|
1433
|
+
"args": {
|
|
1434
|
+
"id": {
|
|
1435
|
+
"description": "the unique id of the resource",
|
|
1436
|
+
"name": "id",
|
|
1437
|
+
"required": true
|
|
1438
|
+
}
|
|
1439
|
+
},
|
|
1440
|
+
"description": "Send this attribute if you want to refund a succeeded capture of a pending order (which is left unpaid).",
|
|
1441
|
+
"flags": {
|
|
1442
|
+
"organization": {
|
|
1443
|
+
"char": "o",
|
|
1444
|
+
"description": "the slug of your organization",
|
|
1445
|
+
"env": "CL_CLI_ORGANIZATION",
|
|
1446
|
+
"hidden": true,
|
|
1447
|
+
"name": "organization",
|
|
1448
|
+
"required": true,
|
|
1449
|
+
"hasDynamicHelp": false,
|
|
1450
|
+
"multiple": false,
|
|
1451
|
+
"type": "option"
|
|
1452
|
+
},
|
|
1453
|
+
"domain": {
|
|
1454
|
+
"char": "d",
|
|
1455
|
+
"dependsOn": [
|
|
1456
|
+
"organization"
|
|
1457
|
+
],
|
|
1458
|
+
"env": "CL_CLI_DOMAIN",
|
|
1459
|
+
"hidden": true,
|
|
1460
|
+
"name": "domain",
|
|
1461
|
+
"required": false,
|
|
1462
|
+
"hasDynamicHelp": false,
|
|
1463
|
+
"multiple": false,
|
|
1464
|
+
"type": "option"
|
|
1465
|
+
},
|
|
1466
|
+
"accessToken": {
|
|
1467
|
+
"env": "CL_CLI_ACCESS_TOKEN",
|
|
1468
|
+
"hidden": true,
|
|
1469
|
+
"name": "accessToken",
|
|
1470
|
+
"required": true,
|
|
1471
|
+
"hasDynamicHelp": false,
|
|
1472
|
+
"multiple": false,
|
|
1473
|
+
"type": "option"
|
|
1474
|
+
},
|
|
1475
|
+
"print": {
|
|
1476
|
+
"char": "p",
|
|
1477
|
+
"description": "print out the modified resource",
|
|
1478
|
+
"name": "print",
|
|
1479
|
+
"allowNo": false,
|
|
1480
|
+
"type": "boolean"
|
|
1481
|
+
},
|
|
1482
|
+
"json": {
|
|
1483
|
+
"char": "j",
|
|
1484
|
+
"dependsOn": [
|
|
1485
|
+
"print"
|
|
1486
|
+
],
|
|
1487
|
+
"description": "print result in JSON format",
|
|
1488
|
+
"name": "json",
|
|
1489
|
+
"allowNo": false,
|
|
1490
|
+
"type": "boolean"
|
|
1491
|
+
},
|
|
1492
|
+
"unformatted": {
|
|
1493
|
+
"char": "u",
|
|
1494
|
+
"dependsOn": [
|
|
1495
|
+
"json"
|
|
1496
|
+
],
|
|
1497
|
+
"description": "print JSON output without indentation",
|
|
1498
|
+
"name": "unformatted",
|
|
1499
|
+
"allowNo": false,
|
|
1500
|
+
"type": "boolean"
|
|
1501
|
+
}
|
|
1502
|
+
},
|
|
1503
|
+
"hasDynamicHelp": false,
|
|
1504
|
+
"hiddenAliases": [],
|
|
1505
|
+
"id": "capture:cancel",
|
|
1506
|
+
"pluginAlias": "@commercelayer/cli-plugin-triggers",
|
|
1507
|
+
"pluginName": "@commercelayer/cli-plugin-triggers",
|
|
1508
|
+
"pluginType": "core",
|
|
1509
|
+
"strict": true,
|
|
1510
|
+
"enableJsonFlag": false,
|
|
1511
|
+
"isESM": false,
|
|
1512
|
+
"relativePath": [
|
|
1513
|
+
"lib",
|
|
1514
|
+
"commands",
|
|
1515
|
+
"capture",
|
|
1516
|
+
"cancel.js"
|
|
1517
|
+
]
|
|
1518
|
+
},
|
|
1343
1519
|
"capture:forward": {
|
|
1344
1520
|
"aliases": [],
|
|
1345
1521
|
"args": {
|
|
@@ -15360,5 +15536,5 @@
|
|
|
15360
15536
|
]
|
|
15361
15537
|
}
|
|
15362
15538
|
},
|
|
15363
|
-
"version": "4.
|
|
15539
|
+
"version": "4.9.1"
|
|
15364
15540
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercelayer/cli-plugin-triggers",
|
|
3
3
|
"description": "Commerce Layer CLI Triggers plugin",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.9.1",
|
|
5
5
|
"author": "Pierluigi Viti <pierluigi@commercelayer.io>",
|
|
6
6
|
"homepage": "https://github.com/commercelayer/commercelayer-cli-plugin-triggers",
|
|
7
7
|
"repository": "commercelayer/commercelayer-cli-plugin-triggers",
|
|
@@ -56,32 +56,32 @@
|
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@commercelayer/cli-dev": "^3.0.6",
|
|
58
58
|
"@commercelayer/eslint-config-ts": "^1.4.5",
|
|
59
|
-
"@oclif/plugin-help": "^6.2.
|
|
59
|
+
"@oclif/plugin-help": "^6.2.18",
|
|
60
60
|
"@oclif/test": "^3.2.15",
|
|
61
61
|
"@semantic-release/changelog": "^6.0.3",
|
|
62
62
|
"@semantic-release/git": "^10.0.1",
|
|
63
63
|
"@types/chai": "^4.3.20",
|
|
64
64
|
"@types/inquirer": "^8.2.10",
|
|
65
65
|
"@types/lodash.snakecase": "^4.1.9",
|
|
66
|
-
"@types/mocha": "^10.0.
|
|
67
|
-
"@types/node": "^22.
|
|
66
|
+
"@types/mocha": "^10.0.10",
|
|
67
|
+
"@types/node": "^22.10.1",
|
|
68
68
|
"chai": "^4.5.0",
|
|
69
69
|
"eslint": "^8.57.1",
|
|
70
70
|
"inflector-js": "^1.0.1",
|
|
71
71
|
"lodash.snakecase": "^4.1.1",
|
|
72
|
-
"mocha": "^10.
|
|
72
|
+
"mocha": "^10.8.2",
|
|
73
73
|
"nyc": "^15.1.0",
|
|
74
|
-
"oclif": "^4.
|
|
75
|
-
"semantic-release": "^24.
|
|
76
|
-
"tsx": "^4.19.
|
|
74
|
+
"oclif": "^4.16.0",
|
|
75
|
+
"semantic-release": "^24.2.0",
|
|
76
|
+
"tsx": "^4.19.2",
|
|
77
77
|
"typescript": "5.5.4"
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
80
|
"@commercelayer/cli-core": "beta",
|
|
81
|
-
"@commercelayer/sdk": "^6.
|
|
81
|
+
"@commercelayer/sdk": "^6.25.2",
|
|
82
82
|
"@oclif/core": "^3.27.0",
|
|
83
83
|
"inquirer": "^8.2.6",
|
|
84
|
-
"tslib": "^2.8.
|
|
84
|
+
"tslib": "^2.8.1"
|
|
85
85
|
},
|
|
86
86
|
"publishConfig": {
|
|
87
87
|
"access": "public"
|