Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

usecase for ZohoBooks #453

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
$integration: http://ibm.com/appconnect/integration/v2/integrationFile
integration:
type: trigger-action
trigger-interfaces:
trigger-interface-1:
type: event-trigger
triggers:
SCHEDULE:
input-context:
data: scheduler
assembly:
$ref: '#/integration/assemblies/assembly-1'
options:
subscription:
scheduleConfiguration:
interval:
unit: minute
value: 1
runOnceOncheck: false
days:
- MON
- TUE
- WED
- THU
- FRI
- SAT
- SUN
timeZone: UTC
connector-type: streaming-connector-scheduler
action-interfaces:
action-interface-1:
type: api-action
business-object: payments
connector-type: square
actions:
RETRIEVEALL: {}
action-interface-2:
type: api-action
business-object: getExpenses_model
connector-type: zohobooks
actions:
RETRIEVEALL: {}
action-interface-3:
type: api-action
business-object: postExpense_model
connector-type: zohobooks
actions:
postExpense: {}
assemblies:
assembly-1:
assembly:
execute:
- retrieve-action:
name: Square Retrieve payments
target:
$ref: '#/integration/action-interfaces/action-interface-1'
filter:
where:
and:
- begin_time: '{{$split($Trigger.lastEventTime , "+")[0]}}'
- location_id: LS78PYWXTAFK2
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
mappings: []
display-name: Square payments
- logging:
name: Log
map:
$map: http://ibm.com/appconnect/map/v1
mappings:
- logLevel:
template: Info
- logMessage:
template: Expenses are created
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: Zoho Books List expenses
target:
$ref: '#/integration/action-interfaces/action-interface-2'
filter:
where:
reference_number: '{{$Foreachitem.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: 10
allow-truncation: true
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:
'{{$ZohoBooksListexpensesMetadata."status-code"}}': '204'
execute:
- custom-action:
name: Zoho Books Create expense
target:
$ref: '#/integration/action-interfaces/action-interface-3'
action: postExpense
map:
mappings:
- account_id:
template: '1332619000000000570'
- amount:
expression: '$Foreachitem.amount_money.amount '
- date:
template: '{{$split($Foreachitem.updated_at , "T")[0]}}'
- description:
template: >-
{{$Foreachitem.statement_description_identifier}}
- paid_through_account_id:
template: '1332619000000015012'
- reference_number:
template: '{{$Foreachitem.id}}'
$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'
else:
execute: []
output-schema: {}
name: Create an expense in Zoho Books for each new payment in Square
models: {}
Loading