From d0f8bcce05845a4c6bec8ab49e0c2d2ec83c301b Mon Sep 17 00:00:00 2001 From: Kartik Date: Tue, 12 Sep 2023 14:55:58 +0530 Subject: [PATCH] update: usecase template square --- ...reate expense report in the Expensify.yaml | 216 ++++++++++++++++++ ...se report in the Expensify_instructions.md | 10 + resources/template-metadata.json | 9 + 3 files changed, 235 insertions(+) create mode 100644 resources/Create an order in Square, retrieve order from Square and create expense report in the Expensify.yaml create mode 100644 resources/markdown/Create an order in Square, retrieve order from Square and create expense report in the Expensify_instructions.md diff --git a/resources/Create an order in Square, retrieve order from Square and create expense report in the Expensify.yaml b/resources/Create an order in Square, retrieve order from Square and create expense report in the Expensify.yaml new file mode 100644 index 000000000..a5ee2d34b --- /dev/null +++ b/resources/Create an order in Square, retrieve order from Square and create expense report in the Expensify.yaml @@ -0,0 +1,216 @@ +$integration: http://ibm.com/appconnect/integration/v2/integrationFile +integration: + type: api + trigger-interfaces: + trigger-interface-1: + triggers: + createCreate_order: + assembly: + $ref: '#/integration/assemblies/assembly-1' + input-context: + data: create_order + output-context: + data: create_order + options: + resources: + - business-object: create_order + model: + $ref: '#/models/create_order' + triggers: + create: createCreate_order + type: api-trigger + action-interfaces: + action-interface-4: + type: api-action + business-object: orders + connector-type: square + actions: + CREATE: {} + action-interface-1: + type: api-action + business-object: orders + connector-type: square + actions: + RETRIEVEALL: {} + action-interface-2: + type: api-action + business-object: postCreateReport_model + connector-type: expensify + actions: + postCreateReport: {} + assemblies: + assembly-1: + assembly: + execute: + - create-action: + name: Square Create order + target: + $ref: '#/integration/action-interfaces/action-interface-4' + map: + mappings: + - customer_id: + template: '{{$Request.idempotency_key}}' + - idempotency_key: + template: '{{$Request.idempotency_key}}' + - line_items: + foreach: + input: '[{}]' + iterator: line_itemsItem + mappings: + - base_price_money: + mappings: + - amount: + expression: '$Request.line_items.amount ' + - currency: + template: '{{$Request.line_items.currency}}' + - name: + template: xyz + - quantity: + template: '{{$Request.line_items.quantity}}' + - location_id: + template: LJ21W5C350JKN + $map: http://ibm.com/appconnect/map/v1 + input: + - variable: Request + $ref: '#/trigger/payload' + - variable: flowDetails + $ref: '#/flowDetails' + - retrieve-action: + name: Square Retrieve orders + target: + $ref: '#/integration/action-interfaces/action-interface-1' + filter: + where: + and: + - order_id: '{{$SquareCreateorder.order_id}}' + - location_id: LJ21W5C350JKN + input: + - variable: Request + $ref: '#/trigger/payload' + - variable: SquareCreateorder + $ref: '#/node-output/Square Create order/response/payload' + - variable: flowDetails + $ref: '#/flowDetails' + limit: 1 + allow-truncation: true + pagination-type: TOKEN + allow-empty-output: false + - custom-action: + name: Expensify Create report + target: + $ref: '#/integration/action-interfaces/action-interface-2' + action: postCreateReport + map: + mappings: + - inputSettings: + mappings: + - employeeEmail: + template: '{{$Request.email}}' + - expenses: + foreach: + input: '$SquareRetrieveorders.line_items ' + iterator: expensesItem + mappings: + - amount: + expression: $expensesItem.total_money.amount + - currency: + template: '{{$expensesItem.total_money.currency}}' + - date: + template: '{{$Request.date}}' + - merchant: + template: '{{$Request.email}}' + - policyID: + template: '{{$Request.policy_id}}' + - report: + mappings: + - title: + template: '{{$Request.line_items.name}}' + $map: http://ibm.com/appconnect/map/v1 + input: + - variable: Request + $ref: '#/trigger/payload' + - variable: SquareCreateorder + $ref: '#/node-output/Square Create order/response/payload' + - variable: SquareRetrieveorders + $ref: '#/node-output/Square Retrieve orders/response/payload' + - variable: SquareRetrieveordersMetadata + $ref: '#/node-output/Square Retrieve orders/response' + - variable: flowDetails + $ref: '#/flowDetails' + - response: + name: response-1 + reply-maps: + - title: create_order successfully created + status-code: 201 + map: + $map: http://ibm.com/appconnect/map/v1 + input: + - variable: Request + $ref: '#/trigger/payload' + - variable: SquareCreateorder + $ref: '#/node-output/Square Create order/response/payload' + - variable: SquareRetrieveorders + $ref: '#/node-output/Square Retrieve orders/response/payload' + - variable: SquareRetrieveordersMetadata + $ref: '#/node-output/Square Retrieve orders/response' + - variable: ExpensifyCreatereport + $ref: '#/node-output/Expensify Create report/response/payload' + - variable: flowDetails + $ref: '#/flowDetails' + mappings: + - id: + template: '{{$ExpensifyCreatereport.reportID}}' + input: [] + name: Usecase1 +models: + create_order: + name: create_order + properties: + id: + required: false + id: true + type: string + idempotency_key: + required: false + id: false + type: string + customer_id: + required: false + id: false + type: string + line_items: + required: false + id: false + type: + name: + required: false + id: false + type: string + quantity: + required: false + id: false + type: number + amount: + required: false + id: false + type: string + currency: + required: false + id: false + type: string + email: + required: false + id: false + type: string + date: + required: false + id: false + type: string + policy_id: + required: false + id: false + type: string + plural: create_order + description: ' ' + operations: + create: '#/integration/assemblies/assembly-1' diff --git a/resources/markdown/Create an order in Square, retrieve order from Square and create expense report in the Expensify_instructions.md b/resources/markdown/Create an order in Square, retrieve order from Square and create expense report in the Expensify_instructions.md new file mode 100644 index 000000000..73b1df377 --- /dev/null +++ b/resources/markdown/Create an order in Square, retrieve order from Square and create expense report in the Expensify_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/tree/master/resources/markdown/Create%20an%20order%20in%20Square,%20retrieve%20order%20from%20Square%20and%20create%20expense%20report%20in%20the%20Expensify_instructions.md) (opens in a new window). + + +1. Click **Create flow** to start using the template. +2. Connect to the following accounts by using your credentials: + - [Square](https://www.ibm.com/docs/en/app-connect/containers_cd?topic=apps-square) + - [Expensify](https://www.ibm.com/docs/en/app-connect/containers_cd?topic=apps-expensify) +3. To start the flow, in the banner, click **Start flow**. + +For more information, visit the IBM Integration Community for this use case. See, [Using IBM® App Connect to interact with Expensify](https://community.ibm.com/community/user/integration/blogs/deepak-ayilliath/2023/05/28/using-ibm-app-connect-to-connect-with-expensify). \ No newline at end of file diff --git a/resources/template-metadata.json b/resources/template-metadata.json index 2ecc576ba..7f62421c5 100644 --- a/resources/template-metadata.json +++ b/resources/template-metadata.json @@ -1969,6 +1969,15 @@ "targetApps": ["oracleebs"], "tags": ["msdynamicscrmrest", "oracleebs"], "offerings": ["app connect professional"] + }, + { + "name": "Create an order in Square, retrieve order from Square and create expense report in the Expensify", + "description": "Use this template to create an order in square, retrieve order from Square and create expense report in the Expensify", + "summary": "Square to 2 applications", + "sourceApp": "square", + "targetApps": ["square", "expensify"], + "tags": ["square", "expensify"], + "offerings": ["app connect professional"] } ] }