@commercelayer/cli-plugin-triggers 4.8.0 → 4.9.0

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 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
  };
@@ -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' | 'refund' | 'refund_amount_cents';
3
+ export type ActionType = 'forward' | 'refund' | 'refund_amount_cents' | 'cancel';
@@ -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
  };
@@ -196,7 +196,7 @@
196
196
  "index.js"
197
197
  ]
198
198
  },
199
- "authorization:capture": {
199
+ "axerve_payment": {
200
200
  "aliases": [],
201
201
  "args": {
202
202
  "id": {
@@ -205,7 +205,7 @@
205
205
  "required": true
206
206
  }
207
207
  },
208
- "description": "Send this attribute if you want to create a capture for this authorization.",
208
+ "description": "execute an action on a resource of type axerve_payments",
209
209
  "flags": {
210
210
  "organization": {
211
211
  "char": "o",
@@ -270,7 +270,7 @@
270
270
  },
271
271
  "hasDynamicHelp": false,
272
272
  "hiddenAliases": [],
273
- "id": "authorization:capture",
273
+ "id": "axerve_payment",
274
274
  "pluginAlias": "@commercelayer/cli-plugin-triggers",
275
275
  "pluginName": "@commercelayer/cli-plugin-triggers",
276
276
  "pluginType": "core",
@@ -280,11 +280,11 @@
280
280
  "relativePath": [
281
281
  "lib",
282
282
  "commands",
283
- "authorization",
284
- "capture.js"
283
+ "axerve_payment",
284
+ "index.js"
285
285
  ]
286
286
  },
287
- "authorization:capture_amount_cents": {
287
+ "axerve_payment:update": {
288
288
  "aliases": [],
289
289
  "args": {
290
290
  "id": {
@@ -293,7 +293,7 @@
293
293
  "required": true
294
294
  }
295
295
  },
296
- "description": "Send this attribute as a value in cents if you want to overwrite the amount to be captured.",
296
+ "description": "Send this attribute if you want to update the payment with fresh order data.",
297
297
  "flags": {
298
298
  "organization": {
299
299
  "char": "o",
@@ -358,7 +358,95 @@
358
358
  },
359
359
  "hasDynamicHelp": false,
360
360
  "hiddenAliases": [],
361
- "id": "authorization:capture_amount_cents",
361
+ "id": "axerve_payment:update",
362
+ "pluginAlias": "@commercelayer/cli-plugin-triggers",
363
+ "pluginName": "@commercelayer/cli-plugin-triggers",
364
+ "pluginType": "core",
365
+ "strict": true,
366
+ "enableJsonFlag": false,
367
+ "isESM": false,
368
+ "relativePath": [
369
+ "lib",
370
+ "commands",
371
+ "axerve_payment",
372
+ "update.js"
373
+ ]
374
+ },
375
+ "authorization:cancel": {
376
+ "aliases": [],
377
+ "args": {
378
+ "id": {
379
+ "description": "the unique id of the resource",
380
+ "name": "id",
381
+ "required": true
382
+ }
383
+ },
384
+ "description": "Send this attribute if you want to void a succeeded authorization of a pending order (which is left unpaid).",
385
+ "flags": {
386
+ "organization": {
387
+ "char": "o",
388
+ "description": "the slug of your organization",
389
+ "env": "CL_CLI_ORGANIZATION",
390
+ "hidden": true,
391
+ "name": "organization",
392
+ "required": true,
393
+ "hasDynamicHelp": false,
394
+ "multiple": false,
395
+ "type": "option"
396
+ },
397
+ "domain": {
398
+ "char": "d",
399
+ "dependsOn": [
400
+ "organization"
401
+ ],
402
+ "env": "CL_CLI_DOMAIN",
403
+ "hidden": true,
404
+ "name": "domain",
405
+ "required": false,
406
+ "hasDynamicHelp": false,
407
+ "multiple": false,
408
+ "type": "option"
409
+ },
410
+ "accessToken": {
411
+ "env": "CL_CLI_ACCESS_TOKEN",
412
+ "hidden": true,
413
+ "name": "accessToken",
414
+ "required": true,
415
+ "hasDynamicHelp": false,
416
+ "multiple": false,
417
+ "type": "option"
418
+ },
419
+ "print": {
420
+ "char": "p",
421
+ "description": "print out the modified resource",
422
+ "name": "print",
423
+ "allowNo": false,
424
+ "type": "boolean"
425
+ },
426
+ "json": {
427
+ "char": "j",
428
+ "dependsOn": [
429
+ "print"
430
+ ],
431
+ "description": "print result in JSON format",
432
+ "name": "json",
433
+ "allowNo": false,
434
+ "type": "boolean"
435
+ },
436
+ "unformatted": {
437
+ "char": "u",
438
+ "dependsOn": [
439
+ "json"
440
+ ],
441
+ "description": "print JSON output without indentation",
442
+ "name": "unformatted",
443
+ "allowNo": false,
444
+ "type": "boolean"
445
+ }
446
+ },
447
+ "hasDynamicHelp": false,
448
+ "hiddenAliases": [],
449
+ "id": "authorization:cancel",
362
450
  "pluginAlias": "@commercelayer/cli-plugin-triggers",
363
451
  "pluginName": "@commercelayer/cli-plugin-triggers",
364
452
  "pluginType": "core",
@@ -369,10 +457,10 @@
369
457
  "lib",
370
458
  "commands",
371
459
  "authorization",
372
- "capture_amount_cents.js"
460
+ "cancel.js"
373
461
  ]
374
462
  },
375
- "authorization:forward": {
463
+ "authorization:capture": {
376
464
  "aliases": [],
377
465
  "args": {
378
466
  "id": {
@@ -381,7 +469,7 @@
381
469
  "required": true
382
470
  }
383
471
  },
384
- "description": "Send this attribute if you want to forward a stuck transaction to succeeded and update associated order states accordingly.",
472
+ "description": "Send this attribute if you want to create a capture for this authorization.",
385
473
  "flags": {
386
474
  "organization": {
387
475
  "char": "o",
@@ -446,7 +534,7 @@
446
534
  },
447
535
  "hasDynamicHelp": false,
448
536
  "hiddenAliases": [],
449
- "id": "authorization:forward",
537
+ "id": "authorization:capture",
450
538
  "pluginAlias": "@commercelayer/cli-plugin-triggers",
451
539
  "pluginName": "@commercelayer/cli-plugin-triggers",
452
540
  "pluginType": "core",
@@ -457,10 +545,10 @@
457
545
  "lib",
458
546
  "commands",
459
547
  "authorization",
460
- "forward.js"
548
+ "capture.js"
461
549
  ]
462
550
  },
463
- "authorization": {
551
+ "authorization:capture_amount_cents": {
464
552
  "aliases": [],
465
553
  "args": {
466
554
  "id": {
@@ -469,7 +557,7 @@
469
557
  "required": true
470
558
  }
471
559
  },
472
- "description": "execute an action on a resource of type authorizations",
560
+ "description": "Send this attribute as a value in cents if you want to overwrite the amount to be captured.",
473
561
  "flags": {
474
562
  "organization": {
475
563
  "char": "o",
@@ -534,7 +622,7 @@
534
622
  },
535
623
  "hasDynamicHelp": false,
536
624
  "hiddenAliases": [],
537
- "id": "authorization",
625
+ "id": "authorization:capture_amount_cents",
538
626
  "pluginAlias": "@commercelayer/cli-plugin-triggers",
539
627
  "pluginName": "@commercelayer/cli-plugin-triggers",
540
628
  "pluginType": "core",
@@ -545,10 +633,10 @@
545
633
  "lib",
546
634
  "commands",
547
635
  "authorization",
548
- "index.js"
636
+ "capture_amount_cents.js"
549
637
  ]
550
638
  },
551
- "authorization:void": {
639
+ "authorization:forward": {
552
640
  "aliases": [],
553
641
  "args": {
554
642
  "id": {
@@ -557,7 +645,7 @@
557
645
  "required": true
558
646
  }
559
647
  },
560
- "description": "Send this attribute if you want to create a void for this authorization.",
648
+ "description": "Send this attribute if you want to forward a stuck transaction to succeeded and update associated order states accordingly.",
561
649
  "flags": {
562
650
  "organization": {
563
651
  "char": "o",
@@ -622,7 +710,7 @@
622
710
  },
623
711
  "hasDynamicHelp": false,
624
712
  "hiddenAliases": [],
625
- "id": "authorization:void",
713
+ "id": "authorization:forward",
626
714
  "pluginAlias": "@commercelayer/cli-plugin-triggers",
627
715
  "pluginName": "@commercelayer/cli-plugin-triggers",
628
716
  "pluginType": "core",
@@ -633,10 +721,10 @@
633
721
  "lib",
634
722
  "commands",
635
723
  "authorization",
636
- "void.js"
724
+ "forward.js"
637
725
  ]
638
726
  },
639
- "axerve_payment": {
727
+ "authorization": {
640
728
  "aliases": [],
641
729
  "args": {
642
730
  "id": {
@@ -645,7 +733,7 @@
645
733
  "required": true
646
734
  }
647
735
  },
648
- "description": "execute an action on a resource of type axerve_payments",
736
+ "description": "execute an action on a resource of type authorizations",
649
737
  "flags": {
650
738
  "organization": {
651
739
  "char": "o",
@@ -710,7 +798,7 @@
710
798
  },
711
799
  "hasDynamicHelp": false,
712
800
  "hiddenAliases": [],
713
- "id": "axerve_payment",
801
+ "id": "authorization",
714
802
  "pluginAlias": "@commercelayer/cli-plugin-triggers",
715
803
  "pluginName": "@commercelayer/cli-plugin-triggers",
716
804
  "pluginType": "core",
@@ -720,11 +808,11 @@
720
808
  "relativePath": [
721
809
  "lib",
722
810
  "commands",
723
- "axerve_payment",
811
+ "authorization",
724
812
  "index.js"
725
813
  ]
726
814
  },
727
- "axerve_payment:update": {
815
+ "authorization:void": {
728
816
  "aliases": [],
729
817
  "args": {
730
818
  "id": {
@@ -733,7 +821,7 @@
733
821
  "required": true
734
822
  }
735
823
  },
736
- "description": "Send this attribute if you want to update the payment with fresh order data.",
824
+ "description": "Send this attribute if you want to create a void for this authorization.",
737
825
  "flags": {
738
826
  "organization": {
739
827
  "char": "o",
@@ -798,7 +886,7 @@
798
886
  },
799
887
  "hasDynamicHelp": false,
800
888
  "hiddenAliases": [],
801
- "id": "axerve_payment:update",
889
+ "id": "authorization:void",
802
890
  "pluginAlias": "@commercelayer/cli-plugin-triggers",
803
891
  "pluginName": "@commercelayer/cli-plugin-triggers",
804
892
  "pluginType": "core",
@@ -808,8 +896,8 @@
808
896
  "relativePath": [
809
897
  "lib",
810
898
  "commands",
811
- "axerve_payment",
812
- "update.js"
899
+ "authorization",
900
+ "void.js"
813
901
  ]
814
902
  },
815
903
  "bundle:compute_compare_at_amount": {
@@ -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.8.0"
15539
+ "version": "4.9.0"
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.8.0",
4
+ "version": "4.9.0",
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",
@@ -64,14 +64,14 @@
64
64
  "@types/inquirer": "^8.2.10",
65
65
  "@types/lodash.snakecase": "^4.1.9",
66
66
  "@types/mocha": "^10.0.9",
67
- "@types/node": "^22.7.7",
67
+ "@types/node": "^22.7.9",
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
72
  "mocha": "^10.7.3",
73
73
  "nyc": "^15.1.0",
74
- "oclif": "^4.15.9",
74
+ "oclif": "^4.15.12",
75
75
  "semantic-release": "^24.1.3",
76
76
  "tsx": "^4.19.1",
77
77
  "typescript": "5.5.4"