From 5be7aafeb013a21380594ca5fff69c509a6d89df Mon Sep 17 00:00:00 2001 From: Pkatiyar30 <102517223+Pkatiyar30@users.noreply.github.com> Date: Fri, 26 Jul 2024 12:04:26 +0000 Subject: [PATCH] usecases for Zoho inventory (#490) * Add files via upload * Add files via upload * Update template-metadata.json * Update Create a package in Zoho Inventory for new Shopify orders_instructions.md * Update Create a sales order in Zoho Inventory for each new Square payment_instructions.md * Update Create a package in Zoho Inventory for new Shopify orders.yaml * Update template-metadata.json --------- Co-authored-by: ireneapeter <158272585+ireneapeter@users.noreply.github.com> Co-authored-by: Deepak Ayilliath <87267785+Deepak-Ayilliath@users.noreply.github.com> --- ...Zoho Inventory for new Shopify orders.yaml | 1179 +++++++++++++++++ ...Inventory for each new Square payment.yaml | 923 +++++++++++++ ...ory for new Shopify orders_instructions.md | 10 + ...or each new Square payment_instructions.md | 10 + resources/template-metadata.json | 21 +- 5 files changed, 2141 insertions(+), 2 deletions(-) create mode 100644 resources/Create a package in Zoho Inventory for new Shopify orders.yaml create mode 100644 resources/Create a sales order in Zoho Inventory for each new Square payment.yaml create mode 100644 resources/markdown/Create a package in Zoho Inventory for new Shopify orders_instructions.md create mode 100644 resources/markdown/Create a sales order in Zoho Inventory for each new Square payment_instructions.md diff --git a/resources/Create a package in Zoho Inventory for new Shopify orders.yaml b/resources/Create a package in Zoho Inventory for new Shopify orders.yaml new file mode 100644 index 000000000..aa4c416d6 --- /dev/null +++ b/resources/Create a package in Zoho Inventory for new Shopify orders.yaml @@ -0,0 +1,1179 @@ +$integration: http://ibm.com/appconnect/integration/v2/integrationFile +integration: + type: trigger-action + trigger-interfaces: + trigger-interface-1: + connector-type: streaming-connector-scheduler + type: event-trigger + triggers: + SCHEDULE: + input-context: + data: scheduler + assembly: + $ref: '#/integration/assemblies/assembly-1' + options: + subscription: + scheduleConfiguration: + interval: + unit: minute + value: 1 + runOnceOncheck: true + days: + - MON + - TUE + - WED + - THU + - FRI + - SAT + - SUN + timeZone: UTC + action-interfaces: + action-interface-1: + type: api-action + business-object: order + connector-type: shopify + actions: + RETRIEVEALL: {} + action-interface-4: + type: api-action + business-object: customer + connector-type: shopify + actions: + RETRIEVEALL: {} + action-interface-3: + type: api-action + business-object: getContacts_model + connector-type: zohoinventory + actions: + RETRIEVEALL: {} + action-interface-5: + type: api-action + business-object: postContacts_model + connector-type: zohoinventory + actions: + postContacts: {} + action-interface-6: + type: api-action + business-object: postContacts_model + connector-type: zohoinventory + actions: + postContacts: {} + action-interface-2: + type: api-action + business-object: getItems_model + connector-type: zohoinventory + actions: + RETRIEVEALL: {} + action-interface-7: + type: api-action + business-object: postItems_model + connector-type: zohoinventory + actions: + postItems: {} + action-interface-8: + type: api-action + business-object: postSalesorders_model + connector-type: zohoinventory + actions: + postSalesorders: {} + action-interface-9: + type: api-action + business-object: postPackages_model + connector-type: zohoinventory + actions: + postPackages: {} + action-interface-10: + type: api-action + business-object: postPackages_model + connector-type: zohoinventory + actions: + postPackages: {} + assemblies: + assembly-1: + assembly: + execute: + - retrieve-action: + name: Shopify Retrieve orders + target: + $ref: '#/integration/action-interfaces/action-interface-1' + filter: + where: + created_at_min: '{{$Trigger.lastEventTime}}' + input: + - variable: Trigger + $ref: '#/trigger/payload' + - variable: flowDetails + $ref: '#/flowDetails' + limit: 10 + allow-truncation: true + pagination-type: TOKEN + allow-empty-output: true + - for-each: + name: For each + assembly: + $ref: '#/integration/assemblies/assembly-2' + source: + expression: '$ShopifyRetrieveorders ' + input: + - variable: Trigger + $ref: '#/trigger/payload' + - variable: flowDetails + $ref: '#/flowDetails' + mode: sequential + continue-on-error: true + map: + $map: http://ibm.com/appconnect/map/v1 + customSchemas: + properties.`output`: + type: object + properties: + id: + type: string + Cusotmer_ID: + type: string + input: + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Trigger + $ref: '#/trigger/payload' + - variable: ShopifyRetrievecustomers + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response/payload + - variable: ShopifyRetrievecustomersMetadata + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response + - variable: If + $ref: '#/block/For each/node-output/If/response/payload' + - variable: ZohoBooksCreateinvoice + $ref: >- + #/block/For each/node-output/Zoho Books Create + invoice/response/payload + - variable: GmailSendemail + $ref: >- + #/block/For each/node-output/Gmail Send + email/response/payload + - variable: ShopifyRetrieveorders + $ref: '#/node-output/Shopify Retrieve orders/response/payload' + - variable: ShopifyRetrieveordersMetadata + $ref: '#/node-output/Shopify Retrieve orders/response' + - variable: flowDetails + $ref: '#/flowDetails' + mappings: + - output: + mappings: + - Cusotmer_ID: + template: '{{$If.Customer_ID}}' + - id: + template: ' {{$ZohoBooksCreateinvoice.invoice_number}}' + display-name: Shopify order + - logging: + name: Log + map: + $map: http://ibm.com/appconnect/map/v1 + mappings: + - logLevel: + template: Info + - logMessage: + template: Order Number=> {{$ShopifyRetrieveorders.id}} + input: + - variable: Trigger + $ref: '#/trigger/payload' + - variable: Foreach + $ref: '#/node-output/For each/response/payload' + - variable: flowDetails + $ref: '#/flowDetails' + tags: + - incomplete + assembly-2: + assembly: + execute: + - retrieve-action: + name: Shopify Retrieve customers + target: + $ref: '#/integration/action-interfaces/action-interface-4' + filter: + where: + id: '{{$Foreachitem.customer.id}}' + input: + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Trigger + $ref: '#/trigger/payload' + - variable: ShopifyRetrieveorders + $ref: '#/node-output/Shopify Retrieve orders/response/payload' + - variable: ShopifyRetrieveordersMetadata + $ref: '#/node-output/Shopify Retrieve orders/response' + - variable: flowDetails + $ref: '#/flowDetails' + limit: 10 + allow-truncation: true + pagination-type: TOKEN + allow-empty-output: false + - retrieve-action: + name: Zoho Inventory Retrieve contacts + target: + $ref: '#/integration/action-interfaces/action-interface-3' + filter: + where: + contact_name: '{{$ShopifyRetrievecustomers[0].first_name}}' + input: + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Trigger + $ref: '#/trigger/payload' + - variable: ShopifyRetrievecustomers + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response/payload + - variable: ShopifyRetrievecustomersMetadata + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response + - variable: ShopifyRetrieveorders + $ref: '#/node-output/Shopify Retrieve orders/response/payload' + - variable: ShopifyRetrieveordersMetadata + $ref: '#/node-output/Shopify Retrieve orders/response' + - variable: flowDetails + $ref: '#/flowDetails' + limit: 10 + allow-truncation: false + pagination-type: SKIP_LIMIT + allow-empty-output: true + - if: + name: If + input: + - variable: Trigger + $ref: '#/trigger/payload' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: flowDetails + $ref: '#/flowDetails' + branch: + - condition: + '{{$ZohoInventoryRetrievecontactsMetadata."status-code"}}': '204' + execute: + - custom-action: + name: Zoho Inventory Create contact + target: + $ref: '#/integration/action-interfaces/action-interface-5' + action: postContacts + map: + mappings: + - contact_name: + template: '{{$ShopifyRetrievecustomers[0].first_name}}' + - contact_persons: + foreach: + input: '[{}]' + iterator: contact_personsItem + mappings: + - email: + template: '{{$ShopifyRetrievecustomers[0].email}}' + $map: http://ibm.com/appconnect/map/v1 + input: + - variable: Trigger + $ref: '#/trigger/payload' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: flowDetails + $ref: '#/flowDetails' + map: + $map: http://ibm.com/appconnect/map/v1 + input: + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Trigger + $ref: '#/trigger/payload' + - variable: ZohoInventoryCreatecontact + $ref: >- + #/block/If/node-output/Zoho Inventory Create + contact/response/payload + - variable: ShopifyRetrievecustomers + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response/payload + - variable: ShopifyRetrievecustomersMetadata + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response + - variable: ZohoInventoryRetrievecontacts + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response/payload + - variable: ZohoInventoryRetrievecontactsMetadata + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response + - variable: ShopifyRetrieveorders + $ref: '#/node-output/Shopify Retrieve orders/response/payload' + - variable: ShopifyRetrieveordersMetadata + $ref: '#/node-output/Shopify Retrieve orders/response' + - variable: flowDetails + $ref: '#/flowDetails' + mappings: + - customer_id: + template: '{{$ZohoInventoryCreatecontact.contact_id}}' + else: + execute: + - for-each: + name: For each 3 + assembly: + $ref: '#/integration/assemblies/assembly-4' + source: + expression: '$ZohoInventoryRetrievecontacts ' + input: + - variable: Trigger + $ref: '#/trigger/payload' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: flowDetails + $ref: '#/flowDetails' + mode: sequential + continue-on-error: true + map: + $map: http://ibm.com/appconnect/map/v1 + customSchemas: + properties.`output`: + type: object + properties: + customer_id: + type: string + input: + - variable: Foreach3item + $ref: '#/block/For each 3/current-item' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Trigger + $ref: '#/trigger/payload' + - variable: If2 + $ref: >- + #/block/For each 3/node-output/If + 2/response/payload + - variable: ShopifyRetrievecustomers + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response/payload + - variable: ShopifyRetrievecustomersMetadata + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response + - variable: ZohoInventoryRetrievecontacts + $ref: >- + #/block/For each/node-output/Zoho Inventory + Retrieve contacts/response/payload + - variable: ZohoInventoryRetrievecontactsMetadata + $ref: >- + #/block/For each/node-output/Zoho Inventory + Retrieve contacts/response + - variable: ShopifyRetrieveorders + $ref: >- + #/node-output/Shopify Retrieve + orders/response/payload + - variable: ShopifyRetrieveordersMetadata + $ref: '#/node-output/Shopify Retrieve orders/response' + - variable: flowDetails + $ref: '#/flowDetails' + mappings: + - output: + mappings: + - customer_id: + template: '{{$If2.customer_id}}' + display-name: Contacts Loop + map: + mappings: + - customer_id: + template: '{{$Foreach3.output.customer_id}}' + $map: http://ibm.com/appconnect/map/v1 + input: + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Trigger + $ref: '#/trigger/payload' + - variable: Foreach3 + $ref: '#/block/If/node-output/For each 3/response/payload' + - variable: ShopifyRetrievecustomers + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response/payload + - variable: ShopifyRetrievecustomersMetadata + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response + - variable: ZohoInventoryRetrievecontacts + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response/payload + - variable: ZohoInventoryRetrievecontactsMetadata + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response + - variable: ShopifyRetrieveorders + $ref: '#/node-output/Shopify Retrieve orders/response/payload' + - variable: ShopifyRetrieveordersMetadata + $ref: '#/node-output/Shopify Retrieve orders/response' + - variable: flowDetails + $ref: '#/flowDetails' + output-schema: + type: object + properties: + customer_id: + type: string + required: [] + - for-each: + name: For each 2 + assembly: + $ref: '#/integration/assemblies/assembly-3' + source: + expression: '$Foreachitem.line_items ' + input: + - variable: Trigger + $ref: '#/trigger/payload' + - variable: If + $ref: '#/block/For each/node-output/If/response/payload' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: flowDetails + $ref: '#/flowDetails' + mode: sequential + continue-on-error: true + map: + $map: http://ibm.com/appconnect/map/v1 + customSchemas: + properties.`output`: + type: object + properties: + Line_Items: + type: array + items: + type: object + properties: + item_id: + type: string + quantity: + type: number + weight: + type: number + input: + - variable: Foreach2item + $ref: '#/block/For each 2/current-item' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Trigger + $ref: '#/trigger/payload' + - variable: ZohoInventoryRetrieveitems + $ref: >- + #/block/For each 2/node-output/Zoho Inventory Retrieve + items/response/payload + - variable: ZohoInventoryRetrieveitemsMetadata + $ref: >- + #/block/For each 2/node-output/Zoho Inventory Retrieve + items/response + - variable: If3 + $ref: '#/block/For each 2/node-output/If 3/response/payload' + - variable: ShopifyRetrievecustomers + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response/payload + - variable: ShopifyRetrievecustomersMetadata + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response + - variable: ZohoInventoryRetrievecontacts + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response/payload + - variable: ZohoInventoryRetrievecontactsMetadata + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response + - variable: If + $ref: '#/block/For each/node-output/If/response/payload' + - variable: ShopifyRetrieveorders + $ref: '#/node-output/Shopify Retrieve orders/response/payload' + - variable: ShopifyRetrieveordersMetadata + $ref: '#/node-output/Shopify Retrieve orders/response' + - variable: flowDetails + $ref: '#/flowDetails' + mappings: + - output: + mappings: + - Line_Items: + foreach: + input: '[{}]' + iterator: Line_ItemsItem + mappings: + - item_id: + template: '{{$If3.Line_Items.item_id}}' + - quantity: + expression: '$If3.Line_Items.qty ' + - weight: + expression: '$Foreach2item.grams ' + display-name: Shopify item loop + - custom-action: + name: Zoho Inventory Create sales order + target: + $ref: '#/integration/action-interfaces/action-interface-8' + action: postSalesorders + map: + mappings: + - customer_id: + template: '{{$If.customer_id}}' + - line_items: + foreach: + input: '$Foreach2.output.Line_Items ' + iterator: line_itemsItem + mappings: + - description: + template: '{{$line_itemsItem.weight}}' + - item_id: + template: '{{$line_itemsItem.item_id}}' + $map: http://ibm.com/appconnect/map/v1 + input: + - variable: Trigger + $ref: '#/trigger/payload' + - variable: If + $ref: '#/block/For each/node-output/If/response/payload' + - variable: Foreach2 + $ref: '#/block/For each/node-output/For each 2/response/payload' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: flowDetails + $ref: '#/flowDetails' + - for-each: + name: For each 4 + assembly: + $ref: '#/integration/assemblies/assembly-5' + source: + expression: '$ZohoInventoryCreatesalesorder.___line_items ' + input: + - variable: Trigger + $ref: '#/trigger/payload' + - variable: If + $ref: '#/block/For each/node-output/If/response/payload' + - variable: Foreach2 + $ref: '#/block/For each/node-output/For each 2/response/payload' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: flowDetails + $ref: '#/flowDetails' + mode: sequential + continue-on-error: true + map: + $map: http://ibm.com/appconnect/map/v1 + customSchemas: + properties.`output`: + type: object + properties: + line_items: + type: array + items: + type: object + properties: + line_item_id: + type: string + qty: + type: number + input: + - variable: Foreach4item + $ref: '#/block/For each 4/current-item' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Trigger + $ref: '#/trigger/payload' + - variable: If5 + $ref: '#/block/For each 4/node-output/If 5/response/payload' + - variable: ShopifyRetrievecustomers + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response/payload + - variable: ShopifyRetrievecustomersMetadata + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response + - variable: ZohoInventoryRetrievecontacts + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response/payload + - variable: ZohoInventoryRetrievecontactsMetadata + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response + - variable: If + $ref: '#/block/For each/node-output/If/response/payload' + - variable: Foreach2 + $ref: '#/block/For each/node-output/For each 2/response/payload' + - variable: ZohoInventoryCreatesalesorder + $ref: >- + #/block/For each/node-output/Zoho Inventory Create sales + order/response/payload + - variable: ShopifyRetrieveorders + $ref: '#/node-output/Shopify Retrieve orders/response/payload' + - variable: ShopifyRetrieveordersMetadata + $ref: '#/node-output/Shopify Retrieve orders/response' + - variable: flowDetails + $ref: '#/flowDetails' + mappings: + - output: + mappings: + - line_items: + foreach: + input: '[{}]' + iterator: line_itemsItem + mappings: + - line_item_id: + template: '{{$If5.line_items.line_item_id}}' + - qty: + expression: '$If5.line_items.qty ' + display-name: Zoho line items + - custom-action: + name: Zoho Inventory Create package + target: + $ref: '#/integration/action-interfaces/action-interface-9' + action: postPackages + map: + mappings: + - date: + template: '{{$split( $Foreachitem.created_at , "T")[0]}}' + - line_items: + foreach: + mappings: + - quantity: + expression: '$line_itemsItem.qty ' + - so_line_item_id: + template: '{{$line_itemsItem.line_item_id}}' + input: '$Foreach4.output.line_items ' + iterator: line_itemsItem + - package_number: + template: '{{$Foreachitem.id}}' + - salesorder_id: + template: '{{$ZohoInventoryCreatesalesorder.salesorder_id}}' + $map: http://ibm.com/appconnect/map/v1 + input: + - variable: Trigger + $ref: '#/trigger/payload' + - variable: If + $ref: '#/block/For each/node-output/If/response/payload' + - variable: Foreach2 + $ref: '#/block/For each/node-output/For each 2/response/payload' + - variable: Foreach4 + $ref: '#/block/For each/node-output/For each 4/response/payload' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: flowDetails + $ref: '#/flowDetails' + assembly-4: + assembly: + execute: + - if: + name: If 2 + input: + - variable: Trigger + $ref: '#/trigger/payload' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Foreach3item + $ref: '#/block/For each 3/current-item' + - variable: flowDetails + $ref: '#/flowDetails' + branch: + - condition: + '{{$Foreach3item.contact_type}}': customer + execute: [] + map: + $map: http://ibm.com/appconnect/map/v1 + input: + - variable: Foreach3item + $ref: '#/block/For each 3/current-item' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Trigger + $ref: '#/trigger/payload' + - variable: ShopifyRetrievecustomers + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response/payload + - variable: ShopifyRetrievecustomersMetadata + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response + - variable: ZohoInventoryRetrievecontacts + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response/payload + - variable: ZohoInventoryRetrievecontactsMetadata + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response + - variable: ShopifyRetrieveorders + $ref: '#/node-output/Shopify Retrieve orders/response/payload' + - variable: ShopifyRetrieveordersMetadata + $ref: '#/node-output/Shopify Retrieve orders/response' + - variable: flowDetails + $ref: '#/flowDetails' + mappings: + - customer_id: + template: '{{$Foreach3item.contact_id}}' + else: + execute: + - custom-action: + name: Zoho Inventory Create contact 2 + target: + $ref: '#/integration/action-interfaces/action-interface-6' + action: postContacts + map: + mappings: + - contact_name: + template: '{{$ShopifyRetrievecustomers[0].first_name}}' + - contact_persons: + foreach: + input: '[{}]' + iterator: contact_personsItem + mappings: + - email: + template: '{{$ShopifyRetrievecustomers[0].email}}' + $map: http://ibm.com/appconnect/map/v1 + input: + - variable: Trigger + $ref: '#/trigger/payload' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Foreach3item + $ref: '#/block/For each 3/current-item' + - variable: flowDetails + $ref: '#/flowDetails' + map: + $map: http://ibm.com/appconnect/map/v1 + input: + - variable: Foreach3item + $ref: '#/block/For each 3/current-item' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Trigger + $ref: '#/trigger/payload' + - variable: ZohoInventoryCreatecontact2 + $ref: >- + #/block/If 2/node-output/Zoho Inventory Create contact + 2/response/payload + - variable: ShopifyRetrievecustomers + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response/payload + - variable: ShopifyRetrievecustomersMetadata + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response + - variable: ZohoInventoryRetrievecontacts + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response/payload + - variable: ZohoInventoryRetrievecontactsMetadata + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response + - variable: ShopifyRetrieveorders + $ref: '#/node-output/Shopify Retrieve orders/response/payload' + - variable: ShopifyRetrieveordersMetadata + $ref: '#/node-output/Shopify Retrieve orders/response' + - variable: flowDetails + $ref: '#/flowDetails' + mappings: + - customer_id: + template: '{{$ZohoInventoryCreatecontact2.contact_id}}' + output-schema: + type: object + properties: + customer_id: + type: string + required: [] + assembly-3: + assembly: + execute: + - retrieve-action: + name: Zoho Inventory Retrieve items + target: + $ref: '#/integration/action-interfaces/action-interface-2' + filter: + where: + name: '{{$Foreach2item.title}}' + input: + - variable: Foreach2item + $ref: '#/block/For each 2/current-item' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Trigger + $ref: '#/trigger/payload' + - variable: ShopifyRetrievecustomers + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response/payload + - variable: ShopifyRetrievecustomersMetadata + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response + - variable: ZohoInventoryRetrievecontacts + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response/payload + - variable: ZohoInventoryRetrievecontactsMetadata + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response + - variable: If + $ref: '#/block/For each/node-output/If/response/payload' + - variable: ShopifyRetrieveorders + $ref: '#/node-output/Shopify Retrieve orders/response/payload' + - variable: ShopifyRetrieveordersMetadata + $ref: '#/node-output/Shopify Retrieve orders/response' + - variable: flowDetails + $ref: '#/flowDetails' + limit: 10 + allow-truncation: true + pagination-type: SKIP_LIMIT + allow-empty-output: true + - if: + name: If 3 + input: + - variable: Trigger + $ref: '#/trigger/payload' + - variable: If + $ref: '#/block/For each/node-output/If/response/payload' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Foreach2item + $ref: '#/block/For each 2/current-item' + - variable: flowDetails + $ref: '#/flowDetails' + branch: + - condition: + '{{$ZohoInventoryRetrieveitemsMetadata."status-code"}}': '204' + execute: + - custom-action: + name: Zoho Inventory Create item + target: + $ref: '#/integration/action-interfaces/action-interface-7' + action: postItems + map: + mappings: + - name: + template: '{{$Foreach2item.title}}' + - rate: + expression: '$Foreach2item.price ' + $map: http://ibm.com/appconnect/map/v1 + input: + - variable: Trigger + $ref: '#/trigger/payload' + - variable: If + $ref: '#/block/For each/node-output/If/response/payload' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Foreach2item + $ref: '#/block/For each 2/current-item' + - variable: flowDetails + $ref: '#/flowDetails' + map: + mappings: + - Line_Items: + foreach: + input: '[{}]' + iterator: Line_ItemsItem + mappings: + - item_id: + template: '{{$ZohoInventoryCreateitem.item_id}}' + - qty: + expression: '$Foreach2item.quantity ' + $map: http://ibm.com/appconnect/map/v1 + input: + - variable: Foreach2item + $ref: '#/block/For each 2/current-item' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Trigger + $ref: '#/trigger/payload' + - variable: ZohoInventoryCreateitem + $ref: >- + #/block/If 3/node-output/Zoho Inventory Create + item/response/payload + - variable: ZohoInventoryRetrieveitems + $ref: >- + #/block/For each 2/node-output/Zoho Inventory Retrieve + items/response/payload + - variable: ZohoInventoryRetrieveitemsMetadata + $ref: >- + #/block/For each 2/node-output/Zoho Inventory Retrieve + items/response + - variable: ShopifyRetrievecustomers + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response/payload + - variable: ShopifyRetrievecustomersMetadata + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response + - variable: ZohoInventoryRetrievecontacts + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response/payload + - variable: ZohoInventoryRetrievecontactsMetadata + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response + - variable: If + $ref: '#/block/For each/node-output/If/response/payload' + - variable: ShopifyRetrieveorders + $ref: '#/node-output/Shopify Retrieve orders/response/payload' + - variable: ShopifyRetrieveordersMetadata + $ref: '#/node-output/Shopify Retrieve orders/response' + - variable: flowDetails + $ref: '#/flowDetails' + else: + execute: + - if: + name: If 4 + input: + - variable: Trigger + $ref: '#/trigger/payload' + - variable: If + $ref: '#/block/For each/node-output/If/response/payload' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Foreach2item + $ref: '#/block/For each 2/current-item' + - variable: flowDetails + $ref: '#/flowDetails' + branch: + - condition: + '{{$Foreach2item.grams}}': + gt: '100' + execute: [] + else: + execute: [] + output-schema: {} + map: + mappings: + - Line_Items: + foreach: + input: '[{}]' + iterator: Line_ItemsItem + mappings: + - item_id: + template: '{{$ZohoInventoryRetrieveitems[0].item_id}}' + - qty: + expression: '$Foreach2item.quantity ' + $map: http://ibm.com/appconnect/map/v1 + input: + - variable: Foreach2item + $ref: '#/block/For each 2/current-item' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Trigger + $ref: '#/trigger/payload' + - variable: ZohoInventoryRetrieveitems + $ref: >- + #/block/For each 2/node-output/Zoho Inventory Retrieve + items/response/payload + - variable: ZohoInventoryRetrieveitemsMetadata + $ref: >- + #/block/For each 2/node-output/Zoho Inventory Retrieve + items/response + - variable: ShopifyRetrievecustomers + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response/payload + - variable: ShopifyRetrievecustomersMetadata + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response + - variable: ZohoInventoryRetrievecontacts + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response/payload + - variable: ZohoInventoryRetrievecontactsMetadata + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response + - variable: If + $ref: '#/block/For each/node-output/If/response/payload' + - variable: ShopifyRetrieveorders + $ref: '#/node-output/Shopify Retrieve orders/response/payload' + - variable: ShopifyRetrieveordersMetadata + $ref: '#/node-output/Shopify Retrieve orders/response' + - variable: flowDetails + $ref: '#/flowDetails' + output-schema: + type: object + properties: + Line_Items: + type: array + items: + type: object + properties: + item_id: + type: string + qty: + type: number + required: [] + required: [] + assembly-5: + assembly: + execute: + - set-variable: + name: Set variable + map: + $map: http://ibm.com/appconnect/map/v1 + customSchemas: + properties.`variable`: + type: object + properties: + Weight: + type: number + input: + - variable: Trigger + $ref: '#/trigger/payload' + - variable: If + $ref: '#/block/For each/node-output/If/response/payload' + - variable: Foreach2 + $ref: '#/block/For each/node-output/For each 2/response/payload' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Foreach4item + $ref: '#/block/For each 4/current-item' + - variable: flowDetails + $ref: '#/flowDetails' + mappings: + - variable: + mappings: + - Weight: + expression: '$Foreach4item.description ' + - if: + name: If 5 + input: + - variable: Trigger + $ref: '#/trigger/payload' + - variable: If + $ref: '#/block/For each/node-output/If/response/payload' + - variable: Foreach2 + $ref: '#/block/For each/node-output/For each 2/response/payload' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Setvariable + $ref: '#/block/For each 4/node-output/Set variable/response/payload' + - variable: Foreach4item + $ref: '#/block/For each 4/current-item' + - variable: flowDetails + $ref: '#/flowDetails' + branch: + - condition: + '{{$Setvariable.variable.Weight}}': + gte: '5000' + execute: + - custom-action: + name: Zoho Inventory Create package 2 + target: + $ref: '#/integration/action-interfaces/action-interface-10' + action: postPackages + map: + mappings: + - date: + template: '{{$split( $Foreachitem.created_at , "T")[0]}}' + - line_items: + foreach: + input: '[{}]' + iterator: line_itemsItem + mappings: + - quantity: + expression: '$Foreach4item.quantity ' + - so_line_item_id: + template: '{{$Foreach4item.line_item_id}}' + - package_number: + template: '{{$Foreachitem.id}}+ {{$Foreach4item.item_id}}' + - salesorder_id: + template: >- + {{$ZohoInventoryCreatesalesorder.salesorder_id}} + $map: http://ibm.com/appconnect/map/v1 + input: + - variable: Trigger + $ref: '#/trigger/payload' + - variable: If + $ref: '#/block/For each/node-output/If/response/payload' + - variable: Foreach2 + $ref: >- + #/block/For each/node-output/For each + 2/response/payload + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Setvariable + $ref: >- + #/block/For each 4/node-output/Set + variable/response/payload + - variable: Foreach4item + $ref: '#/block/For each 4/current-item' + - variable: flowDetails + $ref: '#/flowDetails' + else: + execute: [] + map: + mappings: + - line_items: + foreach: + input: '[{}]' + iterator: line_itemsItem + mappings: + - line_item_id: + template: '{{$Foreach4item.line_item_id}}' + - qty: + expression: '$Foreach4item.quantity ' + $map: http://ibm.com/appconnect/map/v1 + input: + - variable: Foreach4item + $ref: '#/block/For each 4/current-item' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Trigger + $ref: '#/trigger/payload' + - variable: ShopifyRetrievecustomers + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response/payload + - variable: ShopifyRetrievecustomersMetadata + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response + - variable: ZohoInventoryRetrievecontacts + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response/payload + - variable: ZohoInventoryRetrievecontactsMetadata + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response + - variable: If + $ref: '#/block/For each/node-output/If/response/payload' + - variable: Foreach2 + $ref: '#/block/For each/node-output/For each 2/response/payload' + - variable: ZohoInventoryCreatesalesorder + $ref: >- + #/block/For each/node-output/Zoho Inventory Create sales + order/response/payload + - variable: ShopifyRetrieveorders + $ref: '#/node-output/Shopify Retrieve orders/response/payload' + - variable: ShopifyRetrieveordersMetadata + $ref: '#/node-output/Shopify Retrieve orders/response' + - variable: flowDetails + $ref: '#/flowDetails' + output-schema: + type: object + properties: + line_items: + type: array + items: + type: object + properties: + line_item_id: + type: string + qty: + type: number + required: [] + required: [] + name: Create a package in Zoho Inventory for new Shopify orders +models: {} diff --git a/resources/Create a sales order in Zoho Inventory for each new Square payment.yaml b/resources/Create a sales order in Zoho Inventory for each new Square payment.yaml new file mode 100644 index 000000000..49c6d8ab3 --- /dev/null +++ b/resources/Create a sales order in Zoho Inventory for each new Square payment.yaml @@ -0,0 +1,923 @@ +$integration: http://ibm.com/appconnect/integration/v2/integrationFile +integration: + type: trigger-action + trigger-interfaces: + trigger-interface-1: + connector-type: streaming-connector-scheduler + type: event-trigger + triggers: + SCHEDULE: + input-context: + data: scheduler + assembly: + $ref: '#/integration/assemblies/assembly-1' + options: + subscription: + scheduleConfiguration: + interval: + unit: minute + value: 1 + runOnceOncheck: true + days: + - MON + - TUE + - WED + - THU + - FRI + - SAT + - SUN + timeZone: UTC + action-interfaces: + action-interface-3: + type: api-action + business-object: getContacts_model + connector-type: zohoinventory + actions: + RETRIEVEALL: {} + action-interface-5: + type: api-action + business-object: postContacts_model + connector-type: zohoinventory + actions: + postContacts: {} + action-interface-6: + type: api-action + business-object: postContacts_model + connector-type: zohoinventory + actions: + postContacts: {} + action-interface-2: + type: api-action + business-object: getItems_model + connector-type: zohoinventory + actions: + RETRIEVEALL: {} + action-interface-7: + type: api-action + business-object: postItems_model + connector-type: zohoinventory + actions: + postItems: {} + action-interface-8: + type: api-action + business-object: postSalesorders_model + connector-type: zohoinventory + actions: + postSalesorders: {} + action-interface-10: + type: api-action + business-object: payments + connector-type: square + actions: + RETRIEVEALL: {} + action-interface-1: + type: api-action + business-object: customers + connector-type: square + actions: + RETRIEVEALL: {} + action-interface-4: + type: api-action + business-object: orders + connector-type: square + actions: + RETRIEVEALL: {} + assemblies: + assembly-1: + assembly: + execute: + - retrieve-action: + name: Square Retrieve payments + target: + $ref: '#/integration/action-interfaces/action-interface-10' + filter: + where: + and: + - begin_time: '{{$split($Trigger.lastEventTime , "+")[0]}}' + - location_id: L3P9SDXM9H8V4 + input: + - variable: Trigger + $ref: '#/trigger/payload' + - variable: flowDetails + $ref: '#/flowDetails' + limit: 100 + allow-truncation: true + pagination-type: TOKEN + allow-empty-output: false + - for-each: + name: For each + assembly: + $ref: '#/integration/assemblies/assembly-2' + source: + expression: '$SquareRetrievepayments ' + input: + - variable: Trigger + $ref: '#/trigger/payload' + - variable: flowDetails + $ref: '#/flowDetails' + mode: sequential + continue-on-error: true + map: + $map: http://ibm.com/appconnect/map/v1 + customSchemas: + properties.`output`: + type: object + properties: + id: + type: string + Cusotmer_ID: + type: string + input: + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Trigger + $ref: '#/trigger/payload' + - variable: ShopifyRetrievecustomers + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response/payload + - variable: ShopifyRetrievecustomersMetadata + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response + - variable: If + $ref: '#/block/For each/node-output/If/response/payload' + - variable: ZohoBooksCreateinvoice + $ref: >- + #/block/For each/node-output/Zoho Books Create + invoice/response/payload + - variable: GmailSendemail + $ref: >- + #/block/For each/node-output/Gmail Send + email/response/payload + - variable: ShopifyRetrieveorders + $ref: '#/node-output/Shopify Retrieve orders/response/payload' + - variable: ShopifyRetrieveordersMetadata + $ref: '#/node-output/Shopify Retrieve orders/response' + - variable: flowDetails + $ref: '#/flowDetails' + mappings: + - output: + mappings: + - Cusotmer_ID: + template: '{{$If.Customer_ID}}' + - id: + template: ' {{$ZohoBooksCreateinvoice.invoice_number}}' + display-name: Square payments + tags: + - incomplete + assembly-2: + assembly: + execute: + - retrieve-action: + name: Square Retrieve customers + target: + $ref: '#/integration/action-interfaces/action-interface-1' + filter: + where: + customer_id: '{{$Foreachitem.customer_id}}' + input: + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Trigger + $ref: '#/trigger/payload' + - variable: SquareRetrievepayments + $ref: '#/node-output/Square Retrieve payments/response/payload' + - variable: SquareRetrievepaymentsMetadata + $ref: '#/node-output/Square Retrieve payments/response' + - variable: flowDetails + $ref: '#/flowDetails' + limit: 1 + allow-truncation: false + pagination-type: TOKEN + allow-empty-output: false + - retrieve-action: + name: Zoho Inventory Retrieve contacts + target: + $ref: '#/integration/action-interfaces/action-interface-3' + filter: + where: + email: '{{$SquareRetrievecustomers.email_address}}' + input: + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Trigger + $ref: '#/trigger/payload' + - variable: SquareRetrievecustomers + $ref: >- + #/block/For each/node-output/Square Retrieve + customers/response/payload + - variable: SquareRetrievecustomersMetadata + $ref: >- + #/block/For each/node-output/Square Retrieve + customers/response + - variable: SquareRetrievepayments + $ref: '#/node-output/Square Retrieve payments/response/payload' + - variable: SquareRetrievepaymentsMetadata + $ref: '#/node-output/Square Retrieve payments/response' + - variable: flowDetails + $ref: '#/flowDetails' + limit: 10 + allow-truncation: false + pagination-type: SKIP_LIMIT + allow-empty-output: true + - if: + name: If + input: + - variable: Trigger + $ref: '#/trigger/payload' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: flowDetails + $ref: '#/flowDetails' + branch: + - condition: + '{{$ZohoInventoryRetrievecontactsMetadata."status-code"}}': '204' + execute: + - custom-action: + name: Zoho Inventory Create contact + target: + $ref: '#/integration/action-interfaces/action-interface-5' + action: postContacts + map: + mappings: + - contact_name: + template: '{{$SquareRetrievecustomers.family_name}}' + - contact_persons: + foreach: + input: '[{}]' + iterator: contact_personsItem + mappings: + - email: + template: >- + {{$SquareRetrievecustomers.email_address}} + $map: http://ibm.com/appconnect/map/v1 + input: + - variable: Trigger + $ref: '#/trigger/payload' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: flowDetails + $ref: '#/flowDetails' + map: + $map: http://ibm.com/appconnect/map/v1 + input: + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Trigger + $ref: '#/trigger/payload' + - variable: ZohoInventoryCreatecontact + $ref: >- + #/block/If/node-output/Zoho Inventory Create + contact/response/payload + - variable: ShopifyRetrievecustomers + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response/payload + - variable: ShopifyRetrievecustomersMetadata + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response + - variable: ZohoInventoryRetrievecontacts + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response/payload + - variable: ZohoInventoryRetrievecontactsMetadata + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response + - variable: ShopifyRetrieveorders + $ref: '#/node-output/Shopify Retrieve orders/response/payload' + - variable: ShopifyRetrieveordersMetadata + $ref: '#/node-output/Shopify Retrieve orders/response' + - variable: flowDetails + $ref: '#/flowDetails' + mappings: + - customer_id: + template: '{{$ZohoInventoryCreatecontact.contact_id}}' + else: + execute: + - for-each: + name: For each 3 + assembly: + $ref: '#/integration/assemblies/assembly-4' + source: + expression: '$ZohoInventoryRetrievecontacts ' + input: + - variable: Trigger + $ref: '#/trigger/payload' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: flowDetails + $ref: '#/flowDetails' + mode: sequential + continue-on-error: true + map: + $map: http://ibm.com/appconnect/map/v1 + customSchemas: + properties.`output`: + type: object + properties: + customer_id: + type: string + input: + - variable: Foreach3item + $ref: '#/block/For each 3/current-item' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Trigger + $ref: '#/trigger/payload' + - variable: If2 + $ref: >- + #/block/For each 3/node-output/If + 2/response/payload + - variable: ShopifyRetrievecustomers + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response/payload + - variable: ShopifyRetrievecustomersMetadata + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response + - variable: ZohoInventoryRetrievecontacts + $ref: >- + #/block/For each/node-output/Zoho Inventory + Retrieve contacts/response/payload + - variable: ZohoInventoryRetrievecontactsMetadata + $ref: >- + #/block/For each/node-output/Zoho Inventory + Retrieve contacts/response + - variable: ShopifyRetrieveorders + $ref: >- + #/node-output/Shopify Retrieve + orders/response/payload + - variable: ShopifyRetrieveordersMetadata + $ref: '#/node-output/Shopify Retrieve orders/response' + - variable: flowDetails + $ref: '#/flowDetails' + mappings: + - output: + mappings: + - customer_id: + template: '{{$If2.customer_id}}' + display-name: Contacts Loop + map: + mappings: + - customer_id: + template: '{{$Foreach3.output.customer_id}}' + $map: http://ibm.com/appconnect/map/v1 + input: + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Trigger + $ref: '#/trigger/payload' + - variable: Foreach3 + $ref: '#/block/If/node-output/For each 3/response/payload' + - variable: ShopifyRetrievecustomers + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response/payload + - variable: ShopifyRetrievecustomersMetadata + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response + - variable: ZohoInventoryRetrievecontacts + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response/payload + - variable: ZohoInventoryRetrievecontactsMetadata + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response + - variable: ShopifyRetrieveorders + $ref: '#/node-output/Shopify Retrieve orders/response/payload' + - variable: ShopifyRetrieveordersMetadata + $ref: '#/node-output/Shopify Retrieve orders/response' + - variable: flowDetails + $ref: '#/flowDetails' + output-schema: + type: object + properties: + customer_id: + type: string + required: [] + - retrieve-action: + name: Square Retrieve orders + target: + $ref: '#/integration/action-interfaces/action-interface-4' + filter: + where: + and: + - order_id: '{{$Foreachitem.order_id}}' + - location_id: L3P9SDXM9H8V4 + input: + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Trigger + $ref: '#/trigger/payload' + - variable: SquareRetrievecustomers + $ref: >- + #/block/For each/node-output/Square Retrieve + customers/response/payload + - variable: SquareRetrievecustomersMetadata + $ref: >- + #/block/For each/node-output/Square Retrieve + customers/response + - variable: ZohoInventoryRetrievecontacts + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response/payload + - variable: ZohoInventoryRetrievecontactsMetadata + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response + - variable: If + $ref: '#/block/For each/node-output/If/response/payload' + - variable: SquareRetrievepayments + $ref: '#/node-output/Square Retrieve payments/response/payload' + - variable: SquareRetrievepaymentsMetadata + $ref: '#/node-output/Square Retrieve payments/response' + - variable: flowDetails + $ref: '#/flowDetails' + limit: 1 + allow-truncation: false + pagination-type: TOKEN + allow-empty-output: false + - for-each: + name: For each 2 + assembly: + $ref: '#/integration/assemblies/assembly-3' + source: + expression: '$SquareRetrieveorders.line_items ' + input: + - variable: Trigger + $ref: '#/trigger/payload' + - variable: If + $ref: '#/block/For each/node-output/If/response/payload' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: flowDetails + $ref: '#/flowDetails' + mode: sequential + continue-on-error: true + map: + $map: http://ibm.com/appconnect/map/v1 + customSchemas: + properties.`output`: + type: object + properties: + Line_Items: + type: array + items: + type: object + properties: + item_id: + type: string + quantity: + type: number + input: + - variable: Foreach2item + $ref: '#/block/For each 2/current-item' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Trigger + $ref: '#/trigger/payload' + - variable: ZohoInventoryRetrieveitems + $ref: >- + #/block/For each 2/node-output/Zoho Inventory Retrieve + items/response/payload + - variable: ZohoInventoryRetrieveitemsMetadata + $ref: >- + #/block/For each 2/node-output/Zoho Inventory Retrieve + items/response + - variable: If3 + $ref: '#/block/For each 2/node-output/If 3/response/payload' + - variable: SquareRetrievecustomers + $ref: >- + #/block/For each/node-output/Square Retrieve + customers/response/payload + - variable: SquareRetrievecustomersMetadata + $ref: >- + #/block/For each/node-output/Square Retrieve + customers/response + - variable: ZohoInventoryRetrievecontacts + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response/payload + - variable: ZohoInventoryRetrievecontactsMetadata + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response + - variable: If + $ref: '#/block/For each/node-output/If/response/payload' + - variable: SquareRetrieveorders + $ref: >- + #/block/For each/node-output/Square Retrieve + orders/response/payload + - variable: SquareRetrieveordersMetadata + $ref: >- + #/block/For each/node-output/Square Retrieve + orders/response + - variable: SquareRetrievepayments + $ref: '#/node-output/Square Retrieve payments/response/payload' + - variable: SquareRetrievepaymentsMetadata + $ref: '#/node-output/Square Retrieve payments/response' + - variable: flowDetails + $ref: '#/flowDetails' + mappings: + - output: + mappings: + - Line_Items: + foreach: + input: '[{}]' + iterator: Line_ItemsItem + mappings: + - item_id: + template: '{{$If3.Line_Items.item_id}}' + - quantity: + expression: '$If3.Line_Items.qty ' + display-name: Sqaure Item loop + - custom-action: + name: Zoho Inventory Create sales order + target: + $ref: '#/integration/action-interfaces/action-interface-8' + action: postSalesorders + map: + mappings: + - customer_id: + template: '{{$If.customer_id}}' + - line_items: + foreach: + input: '$Foreach2.output.Line_Items ' + iterator: line_itemsItem + mappings: + - item_id: + template: '{{$line_itemsItem.item_id}}' + - reference_number: + template: '{{$Foreachitem.id}}' + $map: http://ibm.com/appconnect/map/v1 + input: + - variable: Trigger + $ref: '#/trigger/payload' + - variable: If + $ref: '#/block/For each/node-output/If/response/payload' + - variable: Foreach2 + $ref: '#/block/For each/node-output/For each 2/response/payload' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: flowDetails + $ref: '#/flowDetails' + assembly-4: + assembly: + execute: + - if: + name: If 2 + input: + - variable: Trigger + $ref: '#/trigger/payload' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Foreach3item + $ref: '#/block/For each 3/current-item' + - variable: flowDetails + $ref: '#/flowDetails' + branch: + - condition: + '{{$Foreach3item.contact_type}}': customer + execute: [] + map: + $map: http://ibm.com/appconnect/map/v1 + input: + - variable: Foreach3item + $ref: '#/block/For each 3/current-item' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Trigger + $ref: '#/trigger/payload' + - variable: ShopifyRetrievecustomers + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response/payload + - variable: ShopifyRetrievecustomersMetadata + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response + - variable: ZohoInventoryRetrievecontacts + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response/payload + - variable: ZohoInventoryRetrievecontactsMetadata + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response + - variable: ShopifyRetrieveorders + $ref: '#/node-output/Shopify Retrieve orders/response/payload' + - variable: ShopifyRetrieveordersMetadata + $ref: '#/node-output/Shopify Retrieve orders/response' + - variable: flowDetails + $ref: '#/flowDetails' + mappings: + - customer_id: + template: '{{$Foreach3item.contact_id}}' + else: + execute: + - custom-action: + name: Zoho Inventory Create contact 2 + target: + $ref: '#/integration/action-interfaces/action-interface-6' + action: postContacts + map: + mappings: + - contact_name: + template: '{{$SquareRetrievecustomers.family_name}}' + - contact_persons: + foreach: + input: '[{}]' + iterator: contact_personsItem + mappings: + - email: + template: >- + {{$SquareRetrievecustomers.email_address}} + $map: http://ibm.com/appconnect/map/v1 + input: + - variable: Trigger + $ref: '#/trigger/payload' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Foreach3item + $ref: '#/block/For each 3/current-item' + - variable: flowDetails + $ref: '#/flowDetails' + map: + $map: http://ibm.com/appconnect/map/v1 + input: + - variable: Foreach3item + $ref: '#/block/For each 3/current-item' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Trigger + $ref: '#/trigger/payload' + - variable: ZohoInventoryCreatecontact2 + $ref: >- + #/block/If 2/node-output/Zoho Inventory Create contact + 2/response/payload + - variable: ShopifyRetrievecustomers + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response/payload + - variable: ShopifyRetrievecustomersMetadata + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response + - variable: ZohoInventoryRetrievecontacts + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response/payload + - variable: ZohoInventoryRetrievecontactsMetadata + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response + - variable: ShopifyRetrieveorders + $ref: '#/node-output/Shopify Retrieve orders/response/payload' + - variable: ShopifyRetrieveordersMetadata + $ref: '#/node-output/Shopify Retrieve orders/response' + - variable: flowDetails + $ref: '#/flowDetails' + mappings: + - customer_id: + template: '{{$ZohoInventoryCreatecontact2.contact_id}}' + output-schema: + type: object + properties: + customer_id: + type: string + required: [] + assembly-3: + assembly: + execute: + - retrieve-action: + name: Zoho Inventory Retrieve items + target: + $ref: '#/integration/action-interfaces/action-interface-2' + filter: + where: + name: '{{$Foreach2item.name}}' + input: + - variable: Foreach2item + $ref: '#/block/For each 2/current-item' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Trigger + $ref: '#/trigger/payload' + - variable: SquareRetrievecustomers + $ref: >- + #/block/For each/node-output/Square Retrieve + customers/response/payload + - variable: SquareRetrievecustomersMetadata + $ref: >- + #/block/For each/node-output/Square Retrieve + customers/response + - variable: ZohoInventoryRetrievecontacts + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response/payload + - variable: ZohoInventoryRetrievecontactsMetadata + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response + - variable: If + $ref: '#/block/For each/node-output/If/response/payload' + - variable: SquareRetrieveorders + $ref: >- + #/block/For each/node-output/Square Retrieve + orders/response/payload + - variable: SquareRetrieveordersMetadata + $ref: >- + #/block/For each/node-output/Square Retrieve + orders/response + - variable: SquareRetrievepayments + $ref: '#/node-output/Square Retrieve payments/response/payload' + - variable: SquareRetrievepaymentsMetadata + $ref: '#/node-output/Square Retrieve payments/response' + - variable: flowDetails + $ref: '#/flowDetails' + limit: 10 + allow-truncation: true + pagination-type: SKIP_LIMIT + allow-empty-output: true + - if: + name: If 3 + input: + - variable: Trigger + $ref: '#/trigger/payload' + - variable: If + $ref: '#/block/For each/node-output/If/response/payload' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Foreach2item + $ref: '#/block/For each 2/current-item' + - variable: flowDetails + $ref: '#/flowDetails' + branch: + - condition: + '{{$ZohoInventoryRetrieveitemsMetadata."status-code"}}': '204' + execute: + - custom-action: + name: Zoho Inventory Create item + target: + $ref: '#/integration/action-interfaces/action-interface-7' + action: postItems + map: + mappings: + - name: + template: '{{$Foreach2item.name}}' + - rate: + expression: >- + ($Foreach2item.base_price_money.amount + /100)*80 + $map: http://ibm.com/appconnect/map/v1 + input: + - variable: Trigger + $ref: '#/trigger/payload' + - variable: If + $ref: '#/block/For each/node-output/If/response/payload' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Foreach2item + $ref: '#/block/For each 2/current-item' + - variable: flowDetails + $ref: '#/flowDetails' + map: + mappings: + - Line_Items: + foreach: + input: '[{}]' + iterator: Line_ItemsItem + mappings: + - item_id: + template: '{{$ZohoInventoryCreateitem.item_id}}' + - qty: + expression: '$Foreach2item.quantity ' + $map: http://ibm.com/appconnect/map/v1 + input: + - variable: Foreach2item + $ref: '#/block/For each 2/current-item' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Trigger + $ref: '#/trigger/payload' + - variable: ZohoInventoryCreateitem + $ref: >- + #/block/If 3/node-output/Zoho Inventory Create + item/response/payload + - variable: ZohoInventoryRetrieveitems + $ref: >- + #/block/For each 2/node-output/Zoho Inventory Retrieve + items/response/payload + - variable: ZohoInventoryRetrieveitemsMetadata + $ref: >- + #/block/For each 2/node-output/Zoho Inventory Retrieve + items/response + - variable: SquareRetrievecustomers + $ref: >- + #/block/For each/node-output/Square Retrieve + customers/response/payload + - variable: SquareRetrievecustomersMetadata + $ref: >- + #/block/For each/node-output/Square Retrieve + customers/response + - variable: ZohoInventoryRetrievecontacts + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response/payload + - variable: ZohoInventoryRetrievecontactsMetadata + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response + - variable: If + $ref: '#/block/For each/node-output/If/response/payload' + - variable: SquareRetrieveorders + $ref: >- + #/block/For each/node-output/Square Retrieve + orders/response/payload + - variable: SquareRetrieveordersMetadata + $ref: >- + #/block/For each/node-output/Square Retrieve + orders/response + - variable: SquareRetrievepayments + $ref: >- + #/node-output/Square Retrieve + payments/response/payload + - variable: SquareRetrievepaymentsMetadata + $ref: '#/node-output/Square Retrieve payments/response' + - variable: flowDetails + $ref: '#/flowDetails' + else: + execute: [] + map: + mappings: + - Line_Items: + foreach: + input: '[{}]' + iterator: Line_ItemsItem + mappings: + - item_id: + template: '{{$ZohoInventoryRetrieveitems[0].item_id}}' + - qty: + expression: '$Foreach2item.quantity ' + $map: http://ibm.com/appconnect/map/v1 + input: + - variable: Foreach2item + $ref: '#/block/For each 2/current-item' + - variable: Foreachitem + $ref: '#/block/For each/current-item' + - variable: Trigger + $ref: '#/trigger/payload' + - variable: ZohoInventoryRetrieveitems + $ref: >- + #/block/For each 2/node-output/Zoho Inventory Retrieve + items/response/payload + - variable: ZohoInventoryRetrieveitemsMetadata + $ref: >- + #/block/For each 2/node-output/Zoho Inventory Retrieve + items/response + - variable: ShopifyRetrievecustomers + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response/payload + - variable: ShopifyRetrievecustomersMetadata + $ref: >- + #/block/For each/node-output/Shopify Retrieve + customers/response + - variable: ZohoInventoryRetrievecontacts + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response/payload + - variable: ZohoInventoryRetrievecontactsMetadata + $ref: >- + #/block/For each/node-output/Zoho Inventory Retrieve + contacts/response + - variable: If + $ref: '#/block/For each/node-output/If/response/payload' + - variable: ShopifyRetrieveorders + $ref: '#/node-output/Shopify Retrieve orders/response/payload' + - variable: ShopifyRetrieveordersMetadata + $ref: '#/node-output/Shopify Retrieve orders/response' + - variable: flowDetails + $ref: '#/flowDetails' + output-schema: + type: object + properties: + Line_Items: + type: array + items: + type: object + properties: + item_id: + type: string + qty: + type: number + required: [] + required: [] + name: Create a sales order in Zoho Inventory for each new Square payment +models: {} diff --git a/resources/markdown/Create a package in Zoho Inventory for new Shopify orders_instructions.md b/resources/markdown/Create a package in Zoho Inventory for new Shopify orders_instructions.md new file mode 100644 index 000000000..2d74452af --- /dev/null +++ b/resources/markdown/Create a package in Zoho Inventory for new Shopify orders_instructions.md @@ -0,0 +1,10 @@ +To refer to these instructions while editing the flow, open [the GitHub page](https://github.com/ot4i/app-connect-templates/blob/main/resources/markdown/Create%20a%20package%20in%20Zoho%20Inventory%20for%20new%20Shopify%20orders_instructions.md) (opens in a new window). + +1. Click **Use this template** to start using the template. +2. Connect to the following accounts by using your credentials: + - [Shopify](https://ibm.biz/acshopify) + - [Zoho Inventory](https://ibm.biz/aczohoinventory) + +3. To start the flow, in the banner click **Start flow**. + +Use this template to create a package in Zoho Inventory for new Shopify orders. diff --git a/resources/markdown/Create a sales order in Zoho Inventory for each new Square payment_instructions.md b/resources/markdown/Create a sales order in Zoho Inventory for each new Square payment_instructions.md new file mode 100644 index 000000000..7daffb652 --- /dev/null +++ b/resources/markdown/Create a sales order in Zoho Inventory for each new Square payment_instructions.md @@ -0,0 +1,10 @@ +To refer to these instructions while editing the flow, open [the GitHub page](https://github.com/ot4i/app-connect-templates/blob/main/resources/markdown/Create%20a%20sales%20order%20in%20Zoho%20Inventory%20for%20each%20new%20Square%20payment_instructions.md) (opens in a new window). + +1. Click **Use this template** to start using the template. +2. Connect to the following accounts by using your credentials: + - [Square](https://ibm.biz/acsquare) + - [Zoho Inventory](https://ibm.biz/aczohoinventory) + +3. To start the flow, in the banner click **Start flow**. + +Use this template to create a sales order in Zoho Inventory for each new Square payment. diff --git a/resources/template-metadata.json b/resources/template-metadata.json index 41a49fb5f..161154753 100644 --- a/resources/template-metadata.json +++ b/resources/template-metadata.json @@ -3694,10 +3694,27 @@ "description": "Use this template to download an employee file in BambooHR and send the report for approval to DocuSign.", "summary": "1 flow using 2 applications", "sourceApp": "api", - "targetApps": ["docusign", "bamboohr"], "targetApps": ["bamboohr", "docusign"], "tags": ["bamboohr", "docusign", "api"], "offerings": ["app connect professional"] - } +}, +{ + "name": "Create a sales order in Zoho Inventory for each new Square payment", + "description": "Use this template to create a sales order in Zoho Inventory for each new Square payment.", + "summary": "Scheduler to 2 applications", + "sourceApp": "streaming-connector-scheduler", + "targetApps": ["square", "zohoinventory"], + "tags": ["streaming-connector-scheduler", "square", "zohoinventory", "if", "foreach"], + "offerings": ["app connect professional"] +}, +{ + "name": "Create a package in Zoho Inventory for new Shopify orders", + "description": "Use this template to create a package in Zoho Inventory for new Shopify orders.", + "summary": "Scheduler to 2 applications", + "sourceApp": "streaming-connector-scheduler", + "targetApps": ["shopify", "zohoinventory"], + "tags": ["streaming-connector-scheduler", "shopify", "zohoinventory", "if", "foreach", "log", "setVariable"], + "offerings": ["app connect professional"] +} ] }