-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[APP] Billbee - new components #18283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
103 changes: 103 additions & 0 deletions
103
components/billbee/actions/add-shipment-to-order/add-shipment-to-order.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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, | ||
| }; | ||
| }, | ||
| }; | ||
49 changes: 49 additions & 0 deletions
49
components/billbee/actions/change-order-state/change-order-state.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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, | ||
| }; | ||
| }, | ||
| }; |
62 changes: 62 additions & 0 deletions
62
components/billbee/actions/create-invoice-for-order/create-invoice-for-order.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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, | ||
| }; | ||
| }, | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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), | ||
| }); | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| $.export("$summary", `Successfully created order with ID \`${response.Data?.BillBeeOrderId}\``); | ||
|
|
||
| return response; | ||
| }, | ||
| }; | ||
33 changes: 33 additions & 0 deletions
33
components/billbee/actions/get-order-by-id/get-order-by-id.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
37
components/billbee/actions/list-customers/list-customers.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| }, | ||
| }; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.