-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kartik
committed
Sep 12, 2023
1 parent
e44934b
commit d0f8bcc
Showing
3 changed files
with
235 additions
and
0 deletions.
There are no files selected for viewing
216 changes: 216 additions & 0 deletions
216
...der in Square, retrieve order from Square and create expense report in the Expensify.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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' |
10 changes: 10 additions & 0 deletions
10
...ve order from Square and create expense report in the Expensify_instructions.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters