Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import app from "../../billbee.app.mjs";

export default {
key: "billbee-add-shipment-to-order",
name: "Add Shipment To Order",
description: "Add a shipment to an existing order. [See the documentation](https://app.billbee.io//swagger/ui/index#/Orders/OrderApi_AddShipment)",
type: "action",
version: "0.0.1",
props: {
app,
orderId: {
propDefinition: [
app,
"orderId",
],
},
shippingProviderId: {
propDefinition: [
app,
"shippingProviderId",
],
},
shippingProviderProductId: {
label: "Shipping Provider Product ID",
description: "The ID of the shipping provider product/service",
propDefinition: [
app,
"shipment",
({
orderId, shippingProviderId,
}) => ({
orderId,
shippingProviderId,
mapper: ({ ShippingProviderProductId: value }) => value,
}),
],
},
shippingId: {
label: "Shipping ID",
description: "The ID of the shipment",
propDefinition: [
app,
"shipment",
({
orderId, shippingProviderId,
}) => ({
orderId,
shippingProviderId,
mapper: ({ ShippingId: value }) => value,
}),
],
},
carrierId: {
propDefinition: [
app,
"carrierId",
],
},
shipmentType: {
propDefinition: [
app,
"shipmentType",
],
},
comment: {
type: "string",
label: "Comment",
description: "Additional comment for the shipment",
optional: true,
},
},
async run({ $ }) {
const {
app,
orderId,
shippingProviderId,
shippingProviderProductId,
comment,
shippingId,
carrierId,
shipmentType,
} = this;

await app.addShipmentToOrder({
$,
orderId,
data: {
ShippingProviderId: shippingProviderId,
ShippingProviderProductId: shippingProviderProductId,
Comment: comment,
ShippingId: shippingId,
CarrierId: carrierId,
ShipmentType: shipmentType,
},
});

$.export("$summary", `Successfully added shipment to order \`${orderId}\``);

return {
success: true,
};
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import app from "../../billbee.app.mjs";

export default {
key: "billbee-change-order-state",
name: "Change Order State",
description: "Change the state of an order. [See the documentation](https://app.billbee.io//swagger/ui/index#/Orders/OrderApi_UpdateState)",
type: "action",
version: "0.0.1",
props: {
app,
orderId: {
propDefinition: [
app,
"orderId",
],
},
newStateId: {
type: "string",
label: "New Order State",
description: "The new state for the order",
optional: false,
propDefinition: [
app,
"orderStateId",
],
},
},
async run({ $ }) {
const {
app,
orderId,
newStateId,
} = this;

await app.changeOrderState({
$,
orderId,
data: {
NewStateId: parseInt(newStateId),
},
});

$.export("$summary", "Successfully changed order state");

return {
success: true,
};
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import app from "../../billbee.app.mjs";

export default {
key: "billbee-create-invoice-for-order",
name: "Create Invoice For Order",
description: "Create an invoice for an existing order. [See the documentation](https://app.billbee.io//swagger/ui/index#/Orders/OrderApi_CreateInvoice)",
type: "action",
version: "0.0.1",
props: {
app,
orderId: {
propDefinition: [
app,
"orderId",
],
},
templateId: {
type: "string",
label: "Template ID",
description: "The ID of the invoice template to use",
optional: true,
},
includeInvoicePdf: {
type: "boolean",
label: "Include Invoice PDF",
description: "If true, the PDF is included in the response as base64 encoded string",
optional: true,
},
sendToCloudId: {
label: "Send To Cloud ID",
propDefinition: [
app,
"cloudStorageId",
],
},
},
async run({ $ }) {
const {
app,
orderId,
templateId,
includeInvoicePdf,
sendToCloudId,
} = this;

await app.createInvoiceForOrder({
$,
orderId,
data: {
TemplateId: templateId,
IncludeInvoicePdf: includeInvoicePdf,
SendToCloudId: sendToCloudId,
},
});

$.export("$summary", `Successfully created invoice for order \`${orderId}\``);

return {
success: true,
};
},
};
55 changes: 55 additions & 0 deletions components/billbee/actions/create-order/create-order.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import app from "../../billbee.app.mjs";
import utils from "../../common/utils.mjs";

export default {
key: "billbee-create-order",
name: "Create Order",
description: "Create a new order. [See the documentation](https://app.billbee.io//swagger/ui/index#/Orders/OrderApi_PostNewOrder)",
type: "action",
version: "0.0.1",
props: {
app,
orderData: {
type: "object",
label: "Order Data",
description: `The data for the order. [See the documentation](https://app.billbee.io//swagger/ui/index#/Orders/OrderApi_PostNewOrder)

**Example:**
\`\`\`json
{
"State": 1,
"CreatedAt": "2025-09-04T00:00:00.000Z",
"PaymentMethod": 1,
"ShippingCost": 0,
"TotalCost": 0,
"OrderItems": [
{
"Product": {
"Title": "Test 1"
},
"Quantity": 1,
"TotalPrice": 0,
"TaxAmount": 0,
"TaxIndex": 19
}
]
}
\`\`\``,
},
},
async run({ $ }) {
const {
app,
orderData,
} = this;

const response = await app.createOrder({
$,
data: utils.parse(orderData),
});

$.export("$summary", `Successfully created order with ID \`${response.Data?.BillBeeOrderId}\``);

return response;
},
};
33 changes: 33 additions & 0 deletions components/billbee/actions/get-order-by-id/get-order-by-id.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import app from "../../billbee.app.mjs";

export default {
key: "billbee-get-order-by-id",
name: "Get Order By ID",
description: "Retrieve a specific order by its ID from Billbee. [See the documentation](https://app.billbee.io//swagger/ui/index#/Orders/OrderApi_Get)",
type: "action",
version: "0.0.1",
props: {
app,
orderId: {
propDefinition: [
app,
"orderId",
],
},
},
async run({ $ }) {
const {
app,
orderId,
} = this;

const response = await app.getOrder({
$,
orderId,
});

$.export("$summary", `Successfully retrieved order with ID \`${response.Data?.BillBeeOrderId}\``);

return response;
},
};
37 changes: 37 additions & 0 deletions components/billbee/actions/list-customers/list-customers.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import app from "../../billbee.app.mjs";

export default {
key: "billbee-list-customers",
name: "List Customers",
description: "Retrieve a list of customers. [See the documentation](https://app.billbee.io/swagger/ui/index#/Customers/Customer_GetAll)",
type: "action",
version: "0.0.1",
props: {
app,
max: {
type: "integer",
label: "Maximum Results",
description: "Maximum number of customers to return",
optional: true,
},
},
async run({ $ }) {
const {
app,
max,
} = this;

const customers = await app.paginate({
resourcesFn: app.listCustomers,
resourcesFnArgs: {
$,
},
resourceName: "Data",
max,
});

$.export("$summary", `Successfully retrieved \`${customers.length}\` customers`);

return customers;
},
};
Loading
Loading