@commercelayer/cli-plugin-triggers 3.3.1 → 3.4.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 +154 -4
- package/lib/commands/payment_method/disable.d.ts +18 -0
- package/lib/commands/payment_method/disable.js +23 -0
- package/lib/commands/payment_method/enable.d.ts +18 -0
- package/lib/commands/payment_method/enable.js +23 -0
- package/lib/commands/payment_method/index.d.ts +18 -0
- package/lib/commands/payment_method/index.js +40 -0
- package/lib/commands/shipping_method/disable.d.ts +18 -0
- package/lib/commands/shipping_method/disable.js +23 -0
- package/lib/commands/shipping_method/enable.d.ts +18 -0
- package/lib/commands/shipping_method/enable.js +23 -0
- package/lib/commands/shipping_method/index.d.ts +18 -0
- package/lib/commands/shipping_method/index.js +40 -0
- package/lib/exec.d.ts +1 -1
- package/lib/triggers/orders.js +1 -1
- package/lib/triggers/payment_methods.d.ts +5 -0
- package/lib/triggers/payment_methods.js +15 -0
- package/lib/triggers/shipping_methods.d.ts +5 -0
- package/lib/triggers/shipping_methods.js +15 -0
- package/oclif.manifest.json +1 -1
- package/package.json +14 -14
package/README.md
CHANGED
|
@@ -16,11 +16,17 @@ Commerce Layer CLI Triggers plugin
|
|
|
16
16
|
<!-- usage -->
|
|
17
17
|
|
|
18
18
|
```sh-session
|
|
19
|
-
|
|
19
|
+
commercelayer COMMAND
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
commercelayer [COMMAND] (--help | -h) for detailed information about plugin commands.
|
|
22
22
|
```
|
|
23
23
|
<!-- usagestop -->
|
|
24
|
+
To install as a Commerce Layer CLI plugin run the following command:
|
|
25
|
+
|
|
26
|
+
```sh-session
|
|
27
|
+
$ commercelayer plugins:install triggers
|
|
28
|
+
```
|
|
29
|
+
|
|
24
30
|
## Commands
|
|
25
31
|
<!-- commands -->
|
|
26
32
|
|
|
@@ -79,6 +85,9 @@ $ commercelayer [COMMAND] (--help | -h) for detailed information about plugin co
|
|
|
79
85
|
* [`commercelayer order_subscription:activate ID`](#commercelayer-order_subscriptionactivate-id)
|
|
80
86
|
* [`commercelayer order_subscription:cancel ID`](#commercelayer-order_subscriptioncancel-id)
|
|
81
87
|
* [`commercelayer order_subscription:deactivate ID`](#commercelayer-order_subscriptiondeactivate-id)
|
|
88
|
+
* [`commercelayer payment_method ID`](#commercelayer-payment_method-id)
|
|
89
|
+
* [`commercelayer payment_method:disable ID`](#commercelayer-payment_methoddisable-id)
|
|
90
|
+
* [`commercelayer payment_method:enable ID`](#commercelayer-payment_methodenable-id)
|
|
82
91
|
* [`commercelayer return ID`](#commercelayer-return-id)
|
|
83
92
|
* [`commercelayer return:approve ID`](#commercelayer-returnapprove-id)
|
|
84
93
|
* [`commercelayer return:archive ID`](#commercelayer-returnarchive-id)
|
|
@@ -99,6 +108,9 @@ $ commercelayer [COMMAND] (--help | -h) for detailed information about plugin co
|
|
|
99
108
|
* [`commercelayer shipment:purchase ID`](#commercelayer-shipmentpurchase-id)
|
|
100
109
|
* [`commercelayer shipment:ready_to_ship ID`](#commercelayer-shipmentready_to_ship-id)
|
|
101
110
|
* [`commercelayer shipment:ship ID`](#commercelayer-shipmentship-id)
|
|
111
|
+
* [`commercelayer shipping_method ID`](#commercelayer-shipping_method-id)
|
|
112
|
+
* [`commercelayer shipping_method:disable ID`](#commercelayer-shipping_methoddisable-id)
|
|
113
|
+
* [`commercelayer shipping_method:enable ID`](#commercelayer-shipping_methodenable-id)
|
|
102
114
|
* [`commercelayer stock_transfer ID`](#commercelayer-stock_transfer-id)
|
|
103
115
|
* [`commercelayer stock_transfer:cancel ID`](#commercelayer-stock_transfercancel-id)
|
|
104
116
|
* [`commercelayer stock_transfer:complete ID`](#commercelayer-stock_transfercomplete-id)
|
|
@@ -945,7 +957,7 @@ _See code: [src/commands/order/cancel.ts](https://github.com/commercelayer/comme
|
|
|
945
957
|
|
|
946
958
|
### `commercelayer order:capture ID`
|
|
947
959
|
|
|
948
|
-
Send this attribute if you want to capture an
|
|
960
|
+
Send this attribute if you want to capture an authorized order.
|
|
949
961
|
|
|
950
962
|
```sh-session
|
|
951
963
|
USAGE
|
|
@@ -961,7 +973,7 @@ FLAGS
|
|
|
961
973
|
-u, --unformatted print JSON output without indentation
|
|
962
974
|
|
|
963
975
|
DESCRIPTION
|
|
964
|
-
Send this attribute if you want to capture an
|
|
976
|
+
Send this attribute if you want to capture an authorized order.
|
|
965
977
|
```
|
|
966
978
|
|
|
967
979
|
_See code: [src/commands/order/capture.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/order/capture.ts)_
|
|
@@ -1388,6 +1400,75 @@ DESCRIPTION
|
|
|
1388
1400
|
|
|
1389
1401
|
_See code: [src/commands/order_subscription/deactivate.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/order_subscription/deactivate.ts)_
|
|
1390
1402
|
|
|
1403
|
+
### `commercelayer payment_method ID`
|
|
1404
|
+
|
|
1405
|
+
Execute an action on a resource of type payment_methods.
|
|
1406
|
+
|
|
1407
|
+
```sh-session
|
|
1408
|
+
USAGE
|
|
1409
|
+
$ commercelayer payment_method [ID] -o <value> [-u [-j -p]]
|
|
1410
|
+
|
|
1411
|
+
ARGUMENTS
|
|
1412
|
+
ID the unique id of the resource
|
|
1413
|
+
|
|
1414
|
+
FLAGS
|
|
1415
|
+
-j, --json print result in JSON format
|
|
1416
|
+
-o, --organization=<value> (required) the slug of your organization
|
|
1417
|
+
-p, --print print out the modified resource
|
|
1418
|
+
-u, --unformatted print JSON output without indentation
|
|
1419
|
+
|
|
1420
|
+
DESCRIPTION
|
|
1421
|
+
execute an action on a resource of type payment_methods
|
|
1422
|
+
```
|
|
1423
|
+
|
|
1424
|
+
_See code: [src/commands/payment_method/index.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/payment_method/index.ts)_
|
|
1425
|
+
|
|
1426
|
+
### `commercelayer payment_method:disable ID`
|
|
1427
|
+
|
|
1428
|
+
Send this attribute if you want to mark the payment method as disabled.
|
|
1429
|
+
|
|
1430
|
+
```sh-session
|
|
1431
|
+
USAGE
|
|
1432
|
+
$ commercelayer payment_method:disable [ID] -o <value> [-u [-j -p]]
|
|
1433
|
+
|
|
1434
|
+
ARGUMENTS
|
|
1435
|
+
ID the unique id of the resource
|
|
1436
|
+
|
|
1437
|
+
FLAGS
|
|
1438
|
+
-j, --json print result in JSON format
|
|
1439
|
+
-o, --organization=<value> (required) the slug of your organization
|
|
1440
|
+
-p, --print print out the modified resource
|
|
1441
|
+
-u, --unformatted print JSON output without indentation
|
|
1442
|
+
|
|
1443
|
+
DESCRIPTION
|
|
1444
|
+
Send this attribute if you want to mark the payment method as disabled.
|
|
1445
|
+
```
|
|
1446
|
+
|
|
1447
|
+
_See code: [src/commands/payment_method/disable.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/payment_method/disable.ts)_
|
|
1448
|
+
|
|
1449
|
+
### `commercelayer payment_method:enable ID`
|
|
1450
|
+
|
|
1451
|
+
Send this attribute if you want to mark the payment method as enabled.
|
|
1452
|
+
|
|
1453
|
+
```sh-session
|
|
1454
|
+
USAGE
|
|
1455
|
+
$ commercelayer payment_method:enable [ID] -o <value> [-u [-j -p]]
|
|
1456
|
+
|
|
1457
|
+
ARGUMENTS
|
|
1458
|
+
ID the unique id of the resource
|
|
1459
|
+
|
|
1460
|
+
FLAGS
|
|
1461
|
+
-j, --json print result in JSON format
|
|
1462
|
+
-o, --organization=<value> (required) the slug of your organization
|
|
1463
|
+
-p, --print print out the modified resource
|
|
1464
|
+
-u, --unformatted print JSON output without indentation
|
|
1465
|
+
|
|
1466
|
+
DESCRIPTION
|
|
1467
|
+
Send this attribute if you want to mark the payment method as enabled.
|
|
1468
|
+
```
|
|
1469
|
+
|
|
1470
|
+
_See code: [src/commands/payment_method/enable.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/payment_method/enable.ts)_
|
|
1471
|
+
|
|
1391
1472
|
### `commercelayer return ID`
|
|
1392
1473
|
|
|
1393
1474
|
Execute an action on a resource of type returns.
|
|
@@ -1848,6 +1929,75 @@ DESCRIPTION
|
|
|
1848
1929
|
|
|
1849
1930
|
_See code: [src/commands/shipment/ship.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/shipment/ship.ts)_
|
|
1850
1931
|
|
|
1932
|
+
### `commercelayer shipping_method ID`
|
|
1933
|
+
|
|
1934
|
+
Execute an action on a resource of type shipping_methods.
|
|
1935
|
+
|
|
1936
|
+
```sh-session
|
|
1937
|
+
USAGE
|
|
1938
|
+
$ commercelayer shipping_method [ID] -o <value> [-u [-j -p]]
|
|
1939
|
+
|
|
1940
|
+
ARGUMENTS
|
|
1941
|
+
ID the unique id of the resource
|
|
1942
|
+
|
|
1943
|
+
FLAGS
|
|
1944
|
+
-j, --json print result in JSON format
|
|
1945
|
+
-o, --organization=<value> (required) the slug of your organization
|
|
1946
|
+
-p, --print print out the modified resource
|
|
1947
|
+
-u, --unformatted print JSON output without indentation
|
|
1948
|
+
|
|
1949
|
+
DESCRIPTION
|
|
1950
|
+
execute an action on a resource of type shipping_methods
|
|
1951
|
+
```
|
|
1952
|
+
|
|
1953
|
+
_See code: [src/commands/shipping_method/index.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/shipping_method/index.ts)_
|
|
1954
|
+
|
|
1955
|
+
### `commercelayer shipping_method:disable ID`
|
|
1956
|
+
|
|
1957
|
+
Send this attribute if you want to mark the shipping method as disabled.
|
|
1958
|
+
|
|
1959
|
+
```sh-session
|
|
1960
|
+
USAGE
|
|
1961
|
+
$ commercelayer shipping_method:disable [ID] -o <value> [-u [-j -p]]
|
|
1962
|
+
|
|
1963
|
+
ARGUMENTS
|
|
1964
|
+
ID the unique id of the resource
|
|
1965
|
+
|
|
1966
|
+
FLAGS
|
|
1967
|
+
-j, --json print result in JSON format
|
|
1968
|
+
-o, --organization=<value> (required) the slug of your organization
|
|
1969
|
+
-p, --print print out the modified resource
|
|
1970
|
+
-u, --unformatted print JSON output without indentation
|
|
1971
|
+
|
|
1972
|
+
DESCRIPTION
|
|
1973
|
+
Send this attribute if you want to mark the shipping method as disabled.
|
|
1974
|
+
```
|
|
1975
|
+
|
|
1976
|
+
_See code: [src/commands/shipping_method/disable.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/shipping_method/disable.ts)_
|
|
1977
|
+
|
|
1978
|
+
### `commercelayer shipping_method:enable ID`
|
|
1979
|
+
|
|
1980
|
+
Send this attribute if you want to mark the shipping method as enabled.
|
|
1981
|
+
|
|
1982
|
+
```sh-session
|
|
1983
|
+
USAGE
|
|
1984
|
+
$ commercelayer shipping_method:enable [ID] -o <value> [-u [-j -p]]
|
|
1985
|
+
|
|
1986
|
+
ARGUMENTS
|
|
1987
|
+
ID the unique id of the resource
|
|
1988
|
+
|
|
1989
|
+
FLAGS
|
|
1990
|
+
-j, --json print result in JSON format
|
|
1991
|
+
-o, --organization=<value> (required) the slug of your organization
|
|
1992
|
+
-p, --print print out the modified resource
|
|
1993
|
+
-u, --unformatted print JSON output without indentation
|
|
1994
|
+
|
|
1995
|
+
DESCRIPTION
|
|
1996
|
+
Send this attribute if you want to mark the shipping method as enabled.
|
|
1997
|
+
```
|
|
1998
|
+
|
|
1999
|
+
_See code: [src/commands/shipping_method/enable.ts](https://github.com/commercelayer/commercelayer-cli-plugin-triggers/blob/main/src/commands/shipping_method/enable.ts)_
|
|
2000
|
+
|
|
1851
2001
|
### `commercelayer stock_transfer ID`
|
|
1852
2002
|
|
|
1853
2003
|
Execute an action on a resource of type stock_transfers.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Command from '../../base';
|
|
2
|
+
export default class PaymentMethodDisable extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
organization: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
6
|
+
domain: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
7
|
+
accessToken: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
8
|
+
print: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
unformatted: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
};
|
|
12
|
+
static args: {
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
required: boolean;
|
|
16
|
+
}[];
|
|
17
|
+
run(): Promise<any>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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 exec_1 = tslib_1.__importDefault(require("../../exec"));
|
|
6
|
+
const payment_methods_1 = require("../../triggers/payment_methods");
|
|
7
|
+
const TRIGGER = 'disable';
|
|
8
|
+
class PaymentMethodDisable extends base_1.default {
|
|
9
|
+
async run() {
|
|
10
|
+
const { args, flags } = await this.parse(PaymentMethodDisable);
|
|
11
|
+
const res = await (0, exec_1.default)('payment_methods', args.id, TRIGGER, flags);
|
|
12
|
+
if (flags.print)
|
|
13
|
+
this.printOutput(res, flags);
|
|
14
|
+
this.successMessage('payment_method', TRIGGER, res.id);
|
|
15
|
+
return res;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.default = PaymentMethodDisable;
|
|
19
|
+
PaymentMethodDisable.description = payment_methods_1.triggers[TRIGGER].description;
|
|
20
|
+
PaymentMethodDisable.flags = Object.assign({}, base_1.default.flags);
|
|
21
|
+
PaymentMethodDisable.args = [
|
|
22
|
+
...base_1.default.args,
|
|
23
|
+
];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Command from '../../base';
|
|
2
|
+
export default class PaymentMethodEnable extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
organization: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
6
|
+
domain: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
7
|
+
accessToken: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
8
|
+
print: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
unformatted: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
};
|
|
12
|
+
static args: {
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
required: boolean;
|
|
16
|
+
}[];
|
|
17
|
+
run(): Promise<any>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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 exec_1 = tslib_1.__importDefault(require("../../exec"));
|
|
6
|
+
const payment_methods_1 = require("../../triggers/payment_methods");
|
|
7
|
+
const TRIGGER = 'enable';
|
|
8
|
+
class PaymentMethodEnable extends base_1.default {
|
|
9
|
+
async run() {
|
|
10
|
+
const { args, flags } = await this.parse(PaymentMethodEnable);
|
|
11
|
+
const res = await (0, exec_1.default)('payment_methods', args.id, TRIGGER, flags);
|
|
12
|
+
if (flags.print)
|
|
13
|
+
this.printOutput(res, flags);
|
|
14
|
+
this.successMessage('payment_method', TRIGGER, res.id);
|
|
15
|
+
return res;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.default = PaymentMethodEnable;
|
|
19
|
+
PaymentMethodEnable.description = payment_methods_1.triggers[TRIGGER].description;
|
|
20
|
+
PaymentMethodEnable.flags = Object.assign({}, base_1.default.flags);
|
|
21
|
+
PaymentMethodEnable.args = [
|
|
22
|
+
...base_1.default.args,
|
|
23
|
+
];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Command from '../../base';
|
|
2
|
+
export default class PaymentMethodIndex extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
organization: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
6
|
+
domain: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
7
|
+
accessToken: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
8
|
+
print: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
unformatted: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
};
|
|
12
|
+
static args: {
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
required: boolean;
|
|
16
|
+
}[];
|
|
17
|
+
run(): Promise<any>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
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 exec_1 = tslib_1.__importDefault(require("../../exec"));
|
|
6
|
+
const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
|
|
7
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
8
|
+
const payment_methods_1 = require("../../triggers/payment_methods");
|
|
9
|
+
const promptAction = async (id) => {
|
|
10
|
+
const answers = await inquirer_1.default.prompt([{
|
|
11
|
+
type: 'list',
|
|
12
|
+
name: 'trigger',
|
|
13
|
+
message: `Select an action to execute on payment method ${chalk_1.default.yellowBright(id)}:`,
|
|
14
|
+
choices: Object.keys(payment_methods_1.triggers).sort().map(a => {
|
|
15
|
+
return { name: a, value: a };
|
|
16
|
+
}),
|
|
17
|
+
loop: false,
|
|
18
|
+
pageSize: 10,
|
|
19
|
+
}]);
|
|
20
|
+
return answers.trigger;
|
|
21
|
+
};
|
|
22
|
+
class PaymentMethodIndex extends base_1.default {
|
|
23
|
+
async run() {
|
|
24
|
+
const { args, flags } = await this.parse(PaymentMethodIndex);
|
|
25
|
+
const id = args.id;
|
|
26
|
+
const action = await promptAction(id);
|
|
27
|
+
const fields = [];
|
|
28
|
+
const res = await (0, exec_1.default)('payment_methods', id, action, flags, fields);
|
|
29
|
+
this.log();
|
|
30
|
+
this.printOutput(res, flags);
|
|
31
|
+
this.successMessage('payment method', action, res.id);
|
|
32
|
+
return res;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.default = PaymentMethodIndex;
|
|
36
|
+
PaymentMethodIndex.description = 'execute an action on a resource of type payment_methods';
|
|
37
|
+
PaymentMethodIndex.flags = Object.assign({}, base_1.default.flags);
|
|
38
|
+
PaymentMethodIndex.args = [
|
|
39
|
+
...base_1.default.args,
|
|
40
|
+
];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Command from '../../base';
|
|
2
|
+
export default class ShippingMethodDisable extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
organization: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
6
|
+
domain: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
7
|
+
accessToken: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
8
|
+
print: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
unformatted: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
};
|
|
12
|
+
static args: {
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
required: boolean;
|
|
16
|
+
}[];
|
|
17
|
+
run(): Promise<any>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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 exec_1 = tslib_1.__importDefault(require("../../exec"));
|
|
6
|
+
const shipping_methods_1 = require("../../triggers/shipping_methods");
|
|
7
|
+
const TRIGGER = 'disable';
|
|
8
|
+
class ShippingMethodDisable extends base_1.default {
|
|
9
|
+
async run() {
|
|
10
|
+
const { args, flags } = await this.parse(ShippingMethodDisable);
|
|
11
|
+
const res = await (0, exec_1.default)('shipping_methods', args.id, TRIGGER, flags);
|
|
12
|
+
if (flags.print)
|
|
13
|
+
this.printOutput(res, flags);
|
|
14
|
+
this.successMessage('shipping_method', TRIGGER, res.id);
|
|
15
|
+
return res;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.default = ShippingMethodDisable;
|
|
19
|
+
ShippingMethodDisable.description = shipping_methods_1.triggers[TRIGGER].description;
|
|
20
|
+
ShippingMethodDisable.flags = Object.assign({}, base_1.default.flags);
|
|
21
|
+
ShippingMethodDisable.args = [
|
|
22
|
+
...base_1.default.args,
|
|
23
|
+
];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Command from '../../base';
|
|
2
|
+
export default class ShippingMethodEnable extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
organization: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
6
|
+
domain: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
7
|
+
accessToken: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
8
|
+
print: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
unformatted: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
};
|
|
12
|
+
static args: {
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
required: boolean;
|
|
16
|
+
}[];
|
|
17
|
+
run(): Promise<any>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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 exec_1 = tslib_1.__importDefault(require("../../exec"));
|
|
6
|
+
const shipping_methods_1 = require("../../triggers/shipping_methods");
|
|
7
|
+
const TRIGGER = 'enable';
|
|
8
|
+
class ShippingMethodEnable extends base_1.default {
|
|
9
|
+
async run() {
|
|
10
|
+
const { args, flags } = await this.parse(ShippingMethodEnable);
|
|
11
|
+
const res = await (0, exec_1.default)('shipping_methods', args.id, TRIGGER, flags);
|
|
12
|
+
if (flags.print)
|
|
13
|
+
this.printOutput(res, flags);
|
|
14
|
+
this.successMessage('shipping_method', TRIGGER, res.id);
|
|
15
|
+
return res;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.default = ShippingMethodEnable;
|
|
19
|
+
ShippingMethodEnable.description = shipping_methods_1.triggers[TRIGGER].description;
|
|
20
|
+
ShippingMethodEnable.flags = Object.assign({}, base_1.default.flags);
|
|
21
|
+
ShippingMethodEnable.args = [
|
|
22
|
+
...base_1.default.args,
|
|
23
|
+
];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Command from '../../base';
|
|
2
|
+
export default class ShippingMethodIndex extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
organization: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
6
|
+
domain: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
7
|
+
accessToken: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
8
|
+
print: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
unformatted: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
};
|
|
12
|
+
static args: {
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
required: boolean;
|
|
16
|
+
}[];
|
|
17
|
+
run(): Promise<any>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
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 exec_1 = tslib_1.__importDefault(require("../../exec"));
|
|
6
|
+
const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
|
|
7
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
8
|
+
const shipping_methods_1 = require("../../triggers/shipping_methods");
|
|
9
|
+
const promptAction = async (id) => {
|
|
10
|
+
const answers = await inquirer_1.default.prompt([{
|
|
11
|
+
type: 'list',
|
|
12
|
+
name: 'trigger',
|
|
13
|
+
message: `Select an action to execute on shipping method ${chalk_1.default.yellowBright(id)}:`,
|
|
14
|
+
choices: Object.keys(shipping_methods_1.triggers).sort().map(a => {
|
|
15
|
+
return { name: a, value: a };
|
|
16
|
+
}),
|
|
17
|
+
loop: false,
|
|
18
|
+
pageSize: 10,
|
|
19
|
+
}]);
|
|
20
|
+
return answers.trigger;
|
|
21
|
+
};
|
|
22
|
+
class ShippingMethodIndex extends base_1.default {
|
|
23
|
+
async run() {
|
|
24
|
+
const { args, flags } = await this.parse(ShippingMethodIndex);
|
|
25
|
+
const id = args.id;
|
|
26
|
+
const action = await promptAction(id);
|
|
27
|
+
const fields = [];
|
|
28
|
+
const res = await (0, exec_1.default)('shipping_methods', id, action, flags, fields);
|
|
29
|
+
this.log();
|
|
30
|
+
this.printOutput(res, flags);
|
|
31
|
+
this.successMessage('shipping method', action, res.id);
|
|
32
|
+
return res;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.default = ShippingMethodIndex;
|
|
36
|
+
ShippingMethodIndex.description = 'execute an action on a resource of type shipping_methods';
|
|
37
|
+
ShippingMethodIndex.flags = Object.assign({}, base_1.default.flags);
|
|
38
|
+
ShippingMethodIndex.args = [
|
|
39
|
+
...base_1.default.args,
|
|
40
|
+
];
|
package/lib/exec.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const executeAction: (resourceType: string, id: string, action: string, flags: any, fields?: string[]
|
|
1
|
+
declare const executeAction: (resourceType: string, id: string, action: string, flags: any, fields?: string[]) => Promise<any>;
|
|
2
2
|
export default executeAction;
|
package/lib/triggers/orders.js
CHANGED
|
@@ -45,7 +45,7 @@ exports.triggers = {
|
|
|
45
45
|
capture: {
|
|
46
46
|
action: 'capture',
|
|
47
47
|
trigger: '_capture',
|
|
48
|
-
description: 'Send this attribute if you want to capture an
|
|
48
|
+
description: 'Send this attribute if you want to capture an authorized order.',
|
|
49
49
|
},
|
|
50
50
|
refund: {
|
|
51
51
|
action: 'refund',
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.triggers = void 0;
|
|
4
|
+
exports.triggers = {
|
|
5
|
+
disable: {
|
|
6
|
+
action: 'disable',
|
|
7
|
+
trigger: '_disable',
|
|
8
|
+
description: 'Send this attribute if you want to mark the payment method as disabled.',
|
|
9
|
+
},
|
|
10
|
+
enable: {
|
|
11
|
+
action: 'enable',
|
|
12
|
+
trigger: '_enable',
|
|
13
|
+
description: 'Send this attribute if you want to mark the payment method as enabled.',
|
|
14
|
+
},
|
|
15
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.triggers = void 0;
|
|
4
|
+
exports.triggers = {
|
|
5
|
+
disable: {
|
|
6
|
+
action: 'disable',
|
|
7
|
+
trigger: '_disable',
|
|
8
|
+
description: 'Send this attribute if you want to mark the shipping method as disabled.',
|
|
9
|
+
},
|
|
10
|
+
enable: {
|
|
11
|
+
action: 'enable',
|
|
12
|
+
trigger: '_enable',
|
|
13
|
+
description: 'Send this attribute if you want to mark the shipping method as enabled.',
|
|
14
|
+
},
|
|
15
|
+
};
|