Skip to content

Commit 00d0e12

Browse files
committed
Refactor create-order and create-shipment actions
- Changed consigneeCompanyName type from "object" to "string" in create-order action. - Added a configuration error check in create-shipment action to ensure 'quantity' and 'parcels' parameters are mutually exclusive.
1 parent d341fdb commit 00d0e12

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

components/paazl/actions/create-order/create-order.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default {
1818
optional: true,
1919
},
2020
consigneeCompanyName: {
21-
type: "object",
21+
type: "string",
2222
label: "Consignee - Company Name",
2323
description: "The name of a company to which an order is shipped.",
2424
optional: true,

components/paazl/actions/create-shipment/create-shipment.mjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { ConfigurationError } from "@pipedream/platform";
12
import { parseObject } from "../../common/utils.mjs";
23
import paazl from "../../paazl.app.mjs";
34

@@ -41,7 +42,7 @@ export default {
4142
quantity: {
4243
type: "integer",
4344
label: "Quantity",
44-
description: " If quantity == 1 -> one extra label is generated. The default quantity value == 1. If quantity > 1 , extra labels are generated. It replaces packageCount in the POST order, if set. Extra labels are generated under 1 new shipment for each label. Mutually exclusive with `parcels`.",
45+
description: "If quantity == 1 -> one extra label is generated. The default quantity value == 1. If quantity > 1 , extra labels are generated. It replaces packageCount in the POST order, if set. Extra labels are generated under 1 new shipment for each label. Mutually exclusive with `parcels`.",
4546
optional: true,
4647
},
4748
parcels: {
@@ -52,6 +53,9 @@ export default {
5253
},
5354
},
5455
async run({ $ }) {
56+
if (this.quantity && this.parcels) {
57+
throw new ConfigurationError("The 'quantity' and 'parcels' parameters are mutually exclusive. Please provide only one.");
58+
}
5559
const response = await this.paazl.createShipment({
5660
$,
5761
orderId: this.orderId,

0 commit comments

Comments
 (0)