diff --git a/components/printful/actions/calculate-shipping-rates/calculate-shipping-rates.mjs b/components/printful/actions/calculate-shipping-rates/calculate-shipping-rates.mjs new file mode 100644 index 0000000000000..a2aaeb7dce023 --- /dev/null +++ b/components/printful/actions/calculate-shipping-rates/calculate-shipping-rates.mjs @@ -0,0 +1,92 @@ +import { LOCALE_OPTIONS } from "../../common/constants.mjs"; +import { parseObject } from "../../common/utils.mjs"; +import printful from "../../printful.app.mjs"; + +export default { + key: "printful-calculate-shipping-rates", + name: "Calculate Shipping Rates", + description: "Fetches available shipping rates for a given destination. [See the documentation](https://developers.printful.com/docs/#tag/Shipping-Rate-API/operation/calculateShippingRates)", + version: "0.0.1", + type: "action", + props: { + printful, + storeId: { + propDefinition: [ + printful, + "storeId", + ], + }, + address1: { + label: "Address 1", + description: "The address 1", + type: "string", + }, + city: { + label: "City", + description: "The city", + type: "string", + }, + stateCode: { + label: "State Code", + description: "The state code. E.g. `SC`", + type: "string", + }, + countryCode: { + label: "Country Code", + description: "The country code. E.g. `BR`", + type: "string", + }, + zip: { + label: "ZIP/Postal Code", + description: "The ZIP/postal code. E.g. `89221525`", + type: "string", + }, + phone: { + label: "Phone", + description: "The phone number", + type: "string", + optional: true, + }, + items: { + type: "string[]", + label: "Items", + description: "A list of items in JSON format. **Example: [{\"variant_id\": \"123456\", \"external_variant_id\": \"123456\", \"quantity\": 123, \"value\": \"12345\" }]**", + }, + currency: { + type: "string", + label: "Currency", + description: "3 letter currency code (optional), required if the rates need to be converted to another currency instead of store default currency", + optional: true, + }, + locale: { + type: "string", + label: "Locale", + description: "Locale in which shipping rate names will be returned", + options: LOCALE_OPTIONS, + optional: true, + }, + }, + async run({ $ }) { + const shippingRates = await this.printful.fetchShippingRates({ + $, + headers: { + "X-PF-Store-Id": this.storeId, + }, + data: { + recipient: { + address1: this.address1, + city: this.city, + state_code: this.stateCode, + country_code: this.countryCode, + zip: this.zip, + phone: this.phone, + }, + items: parseObject(this.items), + currency: this.currency, + locale: this.locale, + }, + }); + $.export("$summary", "Fetched shipping rates successfully"); + return shippingRates; + }, +}; diff --git a/components/printful/actions/create-order/create-order.mjs b/components/printful/actions/create-order/create-order.mjs new file mode 100644 index 0000000000000..4338776e08d03 --- /dev/null +++ b/components/printful/actions/create-order/create-order.mjs @@ -0,0 +1,144 @@ +import { parseObject } from "../../common/utils.mjs"; +import printful from "../../printful.app.mjs"; + +export default { + name: "Create Order", + version: "0.0.1", + key: "printful-create-order", + description: "Creates a new order in your Printful account. [See the documentaion](https://developers.printful.com/docs/#operation/createOrder)", + type: "action", + props: { + printful, + storeId: { + propDefinition: [ + printful, + "storeId", + ], + }, + externalId: { + label: "External ID", + description: "Order ID from the external system", + type: "string", + optional: true, + }, + recipientName: { + label: "Recipient Name", + description: "The recipient full name", + type: "string", + }, + recipientCompanyName: { + label: "Recipient Company Name", + description: "The recipient company name", + type: "string", + optional: true, + }, + address1: { + label: "Address 1", + description: "The address 1", + type: "string", + }, + address2: { + label: "Address 2", + description: "The address 2", + type: "string", + optional: true, + }, + city: { + label: "City", + description: "The city", + type: "string", + }, + stateCode: { + label: "State Code", + description: "The state code. E.g. `SC`", + type: "string", + }, + countryCode: { + label: "Country Code", + description: "The country code. E.g. `BR`", + type: "string", + reloadProps: true, + }, + taxNumber: { + label: "Tax Number", + description: "TAX number (`optional`, but in case of Brazil country this field becomes `required` and will be used as CPF/CNPJ number)", + type: "string", + optional: true, + }, + zip: { + label: "ZIP/Postal Code", + description: "The ZIP/postal code. E.g. `89221525`", + type: "string", + reloadProps: true, + }, + phone: { + label: "Phone", + description: "The phone number", + type: "string", + optional: true, + }, + email: { + label: "Email", + description: "The email", + type: "string", + optional: true, + }, + giftSubject: { + label: "Gift Subject", + description: "Gift message title", + type: "string", + optional: true, + }, + giftMessage: { + label: "Gift Message", + description: "Gift message text", + type: "string", + optional: true, + }, + items: { + label: "Items", + description: "Array of items in the order. E.g. `[ { \"id\": 1, \"variant_id\": 2, \"quantity\": 3, \"price\": \"13.60\", \"retail_price\": \"9.90\", \"name\": \"Beauty Poster\", \"product\": { \"product_id\": 301, \"variant_id\": 500, \"name\": \"Red T-Shirt\" }, \"files\": [{\"url\": \"https://file.com/060b204a37f.png\"}] } ]`", + type: "string[]", + }, + }, + additionalProps(props) { + props.taxNumber.optional = this.countryCode != "BR"; + return {}; + }, + async run({ $ }) { + const response = await this.printful.createOrder({ + $, + headers: { + "X-PF-Store-Id": this.storeId, + }, + data: { + external_id: this.externalId, + shipping: "STANDARD", + recipient: { + name: this.recipientName, + company: this.recipientCompanyName, + address1: this.address1, + address2: this.address2, + city: this.city, + state_code: this.stateCode, + country_code: this.countryCode, + zip: this.zip, + phone: this.phone, + email: this.email, + tax_number: this.taxNumber, + }, + gift: { + subject: this.giftSubject, + message: this.giftMessage, + }, + items: parseObject(this.items), + }, + }); + + if (response) { + $.export("$summary", `Successfully created order with id ${response.result.id}`); + } + + return response; + }, +}; diff --git a/components/printful/actions/update-product/update-product.mjs b/components/printful/actions/update-product/update-product.mjs new file mode 100644 index 0000000000000..31843cc4f5f36 --- /dev/null +++ b/components/printful/actions/update-product/update-product.mjs @@ -0,0 +1,63 @@ +import { parseObject } from "../../common/utils.mjs"; +import printful from "../../printful.app.mjs"; + +export default { + key: "printful-update-product", + name: "Update Product", + description: "Updates an existing product in your Printful store. [See the documentation](https://developers.printful.com/docs/#tag/Products-API/operation/updateSyncProduct)", + version: "0.0.1", + type: "action", + props: { + printful, + storeId: { + propDefinition: [ + printful, + "storeId", + ], + }, + productId: { + propDefinition: [ + printful, + "productId", + ({ storeId }) => ({ + storeId, + }), + ], + }, + alert: { + type: "alert", + alertType: "warning", + content: `Please note that in the request body you only need to specify the fields that need to be changed. + \nFurthermore, if you want to update existing sync variants, then in the sync variants array you must specify the IDs of all existing sync variants. + \nAll omitted existing sync variants will be deleted. All new sync variants without an ID will be created.`, + }, + syncProduct: { + type: "object", + label: "Sync Product", + description: "Information about the SyncProduct. **Example: {\"external_id\": \"4235234213\", \"name\": \"T-shirt\", \"thumbnail\": \"http://your-domain.com/path/to/thumbnail.png\", \"is_ignored\": true}**", + optional: true, + }, + syncVariants: { + type: "string[]", + label: "Sync Variants", + description: "Information about the Sync Variants. **Example: [{\"external_id\": \"12312414\", \"variant_id\": 3001, \"retail_price\": \"29.99\", \"is_ignored\": true, \"sku\": \"SKU1234\", \"files\": [{ \"type\": \"default\", \"url\": \"​https://www.example.com/files/tshirts/example.png\", \"options\": [{ \"id\": \"template_type\", \"value\": \"native\" }], \"filename\": \"shirt1.png\", \"visible\": true }], \"options\": [{ \"id\": \"embroidery_type\", \"value\": \"flat\" }], \"availability_status\": \"active\" }]**", + optional: true, + }, + }, + async run({ $ }) { + + const response = await this.printful.updateProduct({ + $, + headers: { + "X-PF-Store-Id": this.storeId, + }, + productId: this.productId, + data: { + sync_product: parseObject(this.syncProduct), + sync_variants: parseObject(this.syncVariants), + }, + }); + $.export("$summary", `Updated product ${this.productId}`); + return response; + }, +}; diff --git a/components/printful/common/constants.mjs b/components/printful/common/constants.mjs new file mode 100644 index 0000000000000..2591c9bc759fb --- /dev/null +++ b/components/printful/common/constants.mjs @@ -0,0 +1,11 @@ +export const LIMIT = 100; +export const LOCALE_OPTIONS = [ + { + label: "English (US)", + value: "en_US", + }, + { + label: "Spanish (Spain)", + value: "es_ES", + }, +]; diff --git a/components/printful/common/utils.mjs b/components/printful/common/utils.mjs new file mode 100644 index 0000000000000..dcc9cc61f6f41 --- /dev/null +++ b/components/printful/common/utils.mjs @@ -0,0 +1,24 @@ +export const parseObject = (obj) => { + if (!obj) return undefined; + + if (Array.isArray(obj)) { + return obj.map((item) => { + if (typeof item === "string") { + try { + return JSON.parse(item); + } catch (e) { + return item; + } + } + return item; + }); + } + if (typeof obj === "string") { + try { + return JSON.parse(obj); + } catch (e) { + return obj; + } + } + return obj; +}; diff --git a/components/printful/package.json b/components/printful/package.json new file mode 100644 index 0000000000000..f4b8d85c67412 --- /dev/null +++ b/components/printful/package.json @@ -0,0 +1,18 @@ +{ + "name": "@pipedream/printful", + "version": "0.1.0", + "description": "Pipedream Printful Components", + "main": "printful.app.mjs", + "keywords": [ + "pipedream", + "printful" + ], + "homepage": "https://pipedream.com/apps/printful", + "author": "Pipedream (https://pipedream.com/)", + "publishConfig": { + "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^3.0.3" + } +} diff --git a/components/printful/printful.app.mjs b/components/printful/printful.app.mjs index fa42a5dcdfc21..0566f37c3a737 100644 --- a/components/printful/printful.app.mjs +++ b/components/printful/printful.app.mjs @@ -1,11 +1,123 @@ +import { axios } from "@pipedream/platform"; +import { LIMIT } from "./common/constants.mjs"; + export default { type: "app", app: "printful", - propDefinitions: {}, + propDefinitions: { + storeId: { + type: "string", + label: "Store ID", + description: "Select a store or provide s store ID to use for the request", + async options({ page }) { + const { result } = await this.listStores({ + params: { + offset: LIMIT * page, + limit: LIMIT, + }, + }); + + return result.map(({ + id: value, name: label, + }) => ({ + label, + value, + })); + }, + }, + productId: { + type: "string", + label: "Product ID", + description: "Sync Product ID (integer) or External ID (if prefixed with @)", + async options({ + storeId, page, + }) { + const { result } = await this.listProducts({ + headers: { + "X-PF-Store-Id": storeId, + }, + params: { + offset: LIMIT * page, + limit: LIMIT, + }, + }); + + return result.map(({ + id: value, name: label, + }) => ({ + label, + value, + })); + }, + }, + }, methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); + _baseUrl() { + return "https://api.printful.com"; + }, + _headers(headers = {}) { + return { + ...headers, + authorization: `Bearer ${this.$auth.api_key}`, + }; + }, + _makeRequest({ + $ = this, path, headers, ...opts + }) { + return axios($, { + url: this._baseUrl() + path, + headers: this._headers(headers), + ...opts, + }); + }, + createOrder(opts = {}) { + return this._makeRequest({ + path: "/orders", + method: "post", + ...opts, + }); + }, + listStores(opts = {}) { + return this._makeRequest({ + path: "/stores", + ...opts, + }); + }, + listProducts(opts = {}) { + return this._makeRequest({ + path: "/store/products", + ...opts, + }); + }, + fetchShippingRates(opts = {}) { + return this._makeRequest({ + method: "POST", + path: "/shipping/rates", + ...opts, + }); + }, + updateProduct({ + productId, ...opts + }) { + return this._makeRequest({ + method: "PUT", + path: `/store/products/${productId}`, + ...opts, + }); + }, + createWebhook(opts = {}) { + return this._makeRequest({ + method: "POST", + path: "/webhooks", + ...opts, + }); + }, + deleteWebhook(opts = {}) { + return this._makeRequest({ + method: "DELETE", + path: "/webhooks", + ...opts, + }); }, }, }; diff --git a/components/printful/sources/common/base.mjs b/components/printful/sources/common/base.mjs new file mode 100644 index 0000000000000..9b3904c1a623d --- /dev/null +++ b/components/printful/sources/common/base.mjs @@ -0,0 +1,52 @@ +import printful from "../../printful.app.mjs"; + +export default { + props: { + printful, + http: { + type: "$.interface.http", + customResponse: true, + }, + db: "$.service.db", + alert: { + type: "alert", + alertType: "warning", + content: "**Note** that only one webhook URL can be active for a store, so all existing webhook configuration will be disabled upon creating this source.", + }, + storeId: { + propDefinition: [ + printful, + "storeId", + ], + }, + }, + hooks: { + async activate() { + await this.printful.createWebhook({ + headers: { + "X-PF-Store-Id": this.storeId, + }, + data: { + url: this.http.endpoint, + types: this.getEventType(), + }, + }); + }, + async deactivate() { + await this.printful.deleteWebhook({ + headers: { + "X-PF-Store-Id": this.storeId, + }, + }); + }, + }, + async run({ body }) { + const modelField = this.getModelField(); + const ts = body.created; + this.$emit(body, { + id: `${body.data[modelField].id}-${ts}`, + summary: this.getSummary(body), + ts, + }); + }, +}; diff --git a/components/printful/sources/new-order-instant/new-order-instant.mjs b/components/printful/sources/new-order-instant/new-order-instant.mjs new file mode 100644 index 0000000000000..0ad9abd5714cf --- /dev/null +++ b/components/printful/sources/new-order-instant/new-order-instant.mjs @@ -0,0 +1,27 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "printful-new-order-instant", + name: "New Order Created (Instant)", + description: "Emit new event when a new order is created in your Printful account.", + version: "0.0.1", + type: "source", + dedupe: "unique", + methods: { + ...common.methods, + getEventType() { + return [ + "order_created", + ]; + }, + getModelField() { + return "order"; + }, + getSummary(body) { + return `New order: ${body.data.order.id}`; + }, + }, + sampleEmit, +}; diff --git a/components/printful/sources/new-order-instant/test-event.mjs b/components/printful/sources/new-order-instant/test-event.mjs new file mode 100644 index 0000000000000..3d06351d72e66 --- /dev/null +++ b/components/printful/sources/new-order-instant/test-event.mjs @@ -0,0 +1,217 @@ +export default { + "type": "order_created", + "created": 1622456737, + "retries": 2, + "store": 12, + "data": { + "order": { + "id": 13, + "external_id": "4235234213", + "store": 10, + "status": "draft", + "shipping": "STANDARD", + "shipping_service_name": "Flat Rate (3-4 business days after fulfillment)", + "created": 1602607640, + "updated": 1602607640, + "recipient": { + "name": "John Smith", + "company": "John Smith Inc", + "address1": "19749 Dearborn St", + "address2": "string", + "city": "Chatsworth", + "state_code": "CA", + "state_name": "California", + "country_code": "US", + "country_name": "United States", + "zip": "91311", + "phone": "2312322334", + "email": "firstname.secondname@domain.com", + "tax_number": "123.456.789-10" + }, + "items": [ + { + "id": 1, + "external_id": "item-1", + "variant_id": 1, + "sync_variant_id": 1, + "external_variant_id": "variant-1", + "warehouse_product_variant_id": 1, + "product_template_id": 1, + "quantity": 1, + "price": "13.00", + "retail_price": "13.00", + "name": "Enhanced Matte Paper Poster 18×24", + "product": { + "variant_id": 3001, + "product_id": 301, + "image": "https://files.cdn.printful.com/products/71/5309_1581412541.jpg", + "name": "Bella + Canvas 3001 Unisex Short Sleeve Jersey T-Shirt with Tear Away Label (White / 4XL)" + }, + "files": [ + { + "type": "default", + "id": 10, + "url": "​https://www.example.com/files/tshirts/example.png", + "options": [ + { + "id": "template_type", + "value": "native" + } + ], + "hash": "ea44330b887dfec278dbc4626a759547", + "filename": "shirt1.png", + "mime_type": "image/png", + "size": 45582633, + "width": 1000, + "height": 1000, + "dpi": 300, + "status": "ok", + "created": 1590051937, + "thumbnail_url": "https://files.cdn.printful.com/files/ea4/ea44330b887dfec278dbc4626a759547_thumb.png", + "preview_url": "https://files.cdn.printful.com/files/ea4/ea44330b887dfec278dbc4626a759547_thumb.png", + "visible": true, + "is_temporary": false + } + ], + "options": [ + { + "id": "OptionKey", + "value": "OptionValue" + } + ], + "sku": null, + "discontinued": true, + "out_of_stock": true + } + ], + "branding_items": [ + { + "id": 1, + "external_id": "item-1", + "variant_id": 1, + "sync_variant_id": 1, + "external_variant_id": "variant-1", + "warehouse_product_variant_id": 1, + "product_template_id": 1, + "quantity": 1, + "price": "13.00", + "retail_price": "13.00", + "name": "Enhanced Matte Paper Poster 18×24", + "product": { + "variant_id": 3001, + "product_id": 301, + "image": "https://files.cdn.printful.com/products/71/5309_1581412541.jpg", + "name": "Bella + Canvas 3001 Unisex Short Sleeve Jersey T-Shirt with Tear Away Label (White / 4XL)" + }, + "files": [ + { + "type": "default", + "id": 10, + "url": "https://www.example.com/files/tshirts/example.png", + "options": [ + { + "id": "template_type", + "value": "native" + } + ], + "hash": "ea44330b887dfec278dbc4626a759547", + "filename": "shirt1.png", + "mime_type": "image/png", + "size": 45582633, + "width": 1000, + "height": 1000, + "dpi": 300, + "status": "ok", + "created": 1590051937, + "thumbnail_url": "https://files.cdn.printful.com/files/ea4/ea44330b887dfec278dbc4626a759547_thumb.png", + "preview_url": "https://files.cdn.printful.com/files/ea4/ea44330b887dfec278dbc4626a759547_thumb.png", + "visible": true, + "is_temporary": false + } + ], + "options": [ + { + "id": "OptionKey", + "value": "OptionValue" + } + ], + "sku": null, + "discontinued": true, + "out_of_stock": true + } + ], + "incomplete_items": [ + { + "name": "Red T-Shirt", + "quantity": 1, + "sync_variant_id": 70, + "external_variant_id": "external-id", + "external_line_item_id": "external-line-item-id" + } + ], + "costs": { + "currency": "USD", + "subtotal": "10.00", + "discount": "0.00", + "shipping": "5.00", + "digitization": "0.00", + "additional_fee": "0.00", + "fulfillment_fee": "0.00", + "retail_delivery_fee": "0.00", + "tax": "0.00", + "vat": "0.00", + "total": "15.00" + }, + "retail_costs": { + "currency": "USD", + "subtotal": "10.00", + "discount": "0.00", + "shipping": "5.00", + "tax": "0.00", + "vat": "0.00", + "total": "15.00" + }, + "pricing_breakdown": [ + { + "customer_pays": "3.75", + "printful_price": "6", + "profit": "-2.25", + "currency_symbol": "USD" + } + ], + "shipments": [ + { + "id": 10, + "carrier": "FEDEX", + "service": "FedEx SmartPost", + "tracking_number": 0, + "tracking_url": "https://www.fedex.com/fedextrack/?tracknumbers=0000000000", + "created": 1588716060, + "ship_date": "2020-05-05", + "shipped_at": 1588716060, + "reshipment": false, + "items": [ + { + "item_id": 1, + "quantity": 1, + "picked": 1, + "printed": 1 + } + ] + } + ], + "gift": { + "subject": "To John", + "message": "Have a nice day" + }, + "packing_slip": { + "email": "your-name@your-domain.com", + "phone": "+371 28888888", + "message": "Message on packing slip", + "logo_url": "http://www.your-domain.com/packing-logo.png", + "store_name": "Your store name", + "custom_order_id": "kkk2344lm" + } + } + } +} \ No newline at end of file diff --git a/components/printful/sources/new-product-added-instant/new-product-added-instant.mjs b/components/printful/sources/new-product-added-instant/new-product-added-instant.mjs new file mode 100644 index 0000000000000..d20d4b27d22e3 --- /dev/null +++ b/components/printful/sources/new-product-added-instant/new-product-added-instant.mjs @@ -0,0 +1,27 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "printful-new-product-added-instant", + name: "New Product Added (Instant)", + description: "Emit new event when a new product is added to your Printful store catalog.", + version: "0.0.1", + type: "source", + dedupe: "unique", + methods: { + ...common.methods, + getEventType() { + return [ + "product_synced", + ]; + }, + getModelField() { + return "sync_product"; + }, + getSummary(body) { + return `New product added: ${body.data.sync_product.name}`; + }, + }, + sampleEmit, +}; diff --git a/components/printful/sources/new-product-added-instant/test-event.mjs b/components/printful/sources/new-product-added-instant/test-event.mjs new file mode 100644 index 0000000000000..09206b7df0277 --- /dev/null +++ b/components/printful/sources/new-product-added-instant/test-event.mjs @@ -0,0 +1,17 @@ +export default { + "type": "product_synced", + "created": 1622456737, + "retries": 2, + "store": 12, + "data": { + "sync_product": { + "id": 13, + "external_id": "4235234213", + "name": "T-shirt", + "variants": 10, + "synced": 10, + "thumbnail_url": "https://your-domain.com/path/to/image.png", + "is_ignored": true + } + } +} \ No newline at end of file diff --git a/components/printful/sources/order-status-updated-instant/order-status-updated-instant.mjs b/components/printful/sources/order-status-updated-instant/order-status-updated-instant.mjs new file mode 100644 index 0000000000000..e5d0ebb8f11a3 --- /dev/null +++ b/components/printful/sources/order-status-updated-instant/order-status-updated-instant.mjs @@ -0,0 +1,27 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "printful-order-status-updated-instant", + name: "Order Status Updated (Instant)", + description: "Emit new event when the status of an existing Printful order is updated.", + version: "0.0.1", + type: "source", + dedupe: "unique", + methods: { + ...common.methods, + getEventType() { + return [ + "order_updated", + ]; + }, + getModelField() { + return "order"; + }, + getSummary(body) { + return `Order ${body.data.order.id} status updated to ${body.data.order.status}`; + }, + }, + sampleEmit, +}; diff --git a/components/printful/sources/order-status-updated-instant/test-event.mjs b/components/printful/sources/order-status-updated-instant/test-event.mjs new file mode 100644 index 0000000000000..3cfc9a3320bab --- /dev/null +++ b/components/printful/sources/order-status-updated-instant/test-event.mjs @@ -0,0 +1,217 @@ +export default { + "type": "order_updated", + "created": 1622456737, + "retries": 2, + "store": 12, + "data": { + "order": { + "id": 13, + "external_id": "4235234213", + "store": 10, + "status": "draft", + "shipping": "STANDARD", + "shipping_service_name": "Flat Rate (3-4 business days after fulfillment)", + "created": 1602607640, + "updated": 1602607640, + "recipient": { + "name": "John Smith", + "company": "John Smith Inc", + "address1": "19749 Dearborn St", + "address2": "string", + "city": "Chatsworth", + "state_code": "CA", + "state_name": "California", + "country_code": "US", + "country_name": "United States", + "zip": "91311", + "phone": "2312322334", + "email": "firstname.secondname@domain.com", + "tax_number": "123.456.789-10" + }, + "items": [ + { + "id": 1, + "external_id": "item-1", + "variant_id": 1, + "sync_variant_id": 1, + "external_variant_id": "variant-1", + "warehouse_product_variant_id": 1, + "product_template_id": 1, + "quantity": 1, + "price": "13.00", + "retail_price": "13.00", + "name": "Enhanced Matte Paper Poster 18×24", + "product": { + "variant_id": 3001, + "product_id": 301, + "image": "https://files.cdn.printful.com/products/71/5309_1581412541.jpg", + "name": "Bella + Canvas 3001 Unisex Short Sleeve Jersey T-Shirt with Tear Away Label (White / 4XL)" + }, + "files": [ + { + "type": "default", + "id": 10, + "url": "https://www.example.com/files/tshirts/example.png", + "options": [ + { + "id": "template_type", + "value": "native" + } + ], + "hash": "ea44330b887dfec278dbc4626a759547", + "filename": "shirt1.png", + "mime_type": "image/png", + "size": 45582633, + "width": 1000, + "height": 1000, + "dpi": 300, + "status": "ok", + "created": 1590051937, + "thumbnail_url": "https://files.cdn.printful.com/files/ea4/ea44330b887dfec278dbc4626a759547_thumb.png", + "preview_url": "https://files.cdn.printful.com/files/ea4/ea44330b887dfec278dbc4626a759547_thumb.png", + "visible": true, + "is_temporary": false + } + ], + "options": [ + { + "id": "OptionKey", + "value": "OptionValue" + } + ], + "sku": null, + "discontinued": true, + "out_of_stock": true + } + ], + "branding_items": [ + { + "id": 1, + "external_id": "item-1", + "variant_id": 1, + "sync_variant_id": 1, + "external_variant_id": "variant-1", + "warehouse_product_variant_id": 1, + "product_template_id": 1, + "quantity": 1, + "price": "13.00", + "retail_price": "13.00", + "name": "Enhanced Matte Paper Poster 18×24", + "product": { + "variant_id": 3001, + "product_id": 301, + "image": "https://files.cdn.printful.com/products/71/5309_1581412541.jpg", + "name": "Bella + Canvas 3001 Unisex Short Sleeve Jersey T-Shirt with Tear Away Label (White / 4XL)" + }, + "files": [ + { + "type": "default", + "id": 10, + "url": "https://www.example.com/files/tshirts/example.png", + "options": [ + { + "id": "template_type", + "value": "native" + } + ], + "hash": "ea44330b887dfec278dbc4626a759547", + "filename": "shirt1.png", + "mime_type": "image/png", + "size": 45582633, + "width": 1000, + "height": 1000, + "dpi": 300, + "status": "ok", + "created": 1590051937, + "thumbnail_url": "https://files.cdn.printful.com/files/ea4/ea44330b887dfec278dbc4626a759547_thumb.png", + "preview_url": "https://files.cdn.printful.com/files/ea4/ea44330b887dfec278dbc4626a759547_thumb.png", + "visible": true, + "is_temporary": false + } + ], + "options": [ + { + "id": "OptionKey", + "value": "OptionValue" + } + ], + "sku": null, + "discontinued": true, + "out_of_stock": true + } + ], + "incomplete_items": [ + { + "name": "Red T-Shirt", + "quantity": 1, + "sync_variant_id": 70, + "external_variant_id": "external-id", + "external_line_item_id": "external-line-item-id" + } + ], + "costs": { + "currency": "USD", + "subtotal": "10.00", + "discount": "0.00", + "shipping": "5.00", + "digitization": "0.00", + "additional_fee": "0.00", + "fulfillment_fee": "0.00", + "retail_delivery_fee": "0.00", + "tax": "0.00", + "vat": "0.00", + "total": "15.00" + }, + "retail_costs": { + "currency": "USD", + "subtotal": "10.00", + "discount": "0.00", + "shipping": "5.00", + "tax": "0.00", + "vat": "0.00", + "total": "15.00" + }, + "pricing_breakdown": [ + { + "customer_pays": "3.75", + "printful_price": "6", + "profit": "-2.25", + "currency_symbol": "USD" + } + ], + "shipments": [ + { + "id": 10, + "carrier": "FEDEX", + "service": "FedEx SmartPost", + "tracking_number": 0, + "tracking_url": "https://www.fedex.com/fedextrack/?tracknumbers=0000000000", + "created": 1588716060, + "ship_date": "2020-05-05", + "shipped_at": 1588716060, + "reshipment": false, + "items": [ + { + "item_id": 1, + "quantity": 1, + "picked": 1, + "printed": 1 + } + ] + } + ], + "gift": { + "subject": "To John", + "message": "Have a nice day" + }, + "packing_slip": { + "email": "your-name@your-domain.com", + "phone": "+371 28888888", + "message": "Message on packing slip", + "logo_url": "http://www.your-domain.com/packing-logo.png", + "store_name": "Your store name", + "custom_order_id": "kkk2344lm" + } + } + } +} \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0175fcf2a536f..93022903614cd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5884,8 +5884,7 @@ importers: specifier: ^1.2.1 version: 1.6.6 - components/lightpanda: - specifiers: {} + components/lightpanda: {} components/lightspeed_retail_pos: dependencies: @@ -8198,6 +8197,12 @@ importers: specifier: ^1.1.1 version: 1.6.6 + components/printful: + dependencies: + '@pipedream/platform': + specifier: ^3.0.3 + version: 3.0.3 + components/printful_oauth: dependencies: '@pipedream/platform':