| # Copyright 2023 Red Hat, Inc. and/or its affiliates |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| kind: ConfigMap |
| apiVersion: v1 |
| metadata: |
| name: orderprocessing-subflows |
| data: |
| fraud-handling.sw.yaml: |- |
| id: fraudhandling |
| name: Fraud Handling |
| expressionLang: jsonpath |
| start: FraudHandling |
| version: "1.0" |
| events: |
| - kind: produced |
| name: FraudEvaluation |
| type: fraudEvaluation |
| source: fraudEvaluation |
| states: |
| - name: FraudHandling |
| type: switch |
| dataConditions: |
| - condition: "{{ $.[?(@.total > 1000)] }}" |
| transition: FraudVerificationNeeded |
| - condition: "{{ $.[?(@.total <= 1000)] }}" |
| end: true |
| - name: FraudVerificationNeeded |
| type: inject |
| data: |
| fraudEvaluation: true |
| end: |
| produceEvents: |
| - eventRef: FraudEvaluation |
| shipping-handling.sw.yaml: |- |
| id: shippinghandling |
| name: Shipping Handling |
| expressionLang: jsonpath |
| start: ShippingHandling |
| version: "1.0" |
| events: |
| - kind: produced |
| name: InternationalShippingOrder |
| type: internationalShipping |
| source: internationalShipping |
| - kind: produced |
| name: DomesticShippingOrder |
| type: domesticShipping |
| source: domesticShipping |
| states: |
| - name: ShippingHandling |
| type: switch |
| dataConditions: |
| - condition: "${ $.[?(@.country == 'US')] }" |
| transition: DomesticShipping |
| - condition: "${ $.[?(@.country != 'US')] }" |
| transition: InternationalShipping |
| - name: DomesticShipping |
| type: inject |
| data: |
| shipping: "domestic" |
| end: |
| produceEvents: |
| - eventRef: DomesticShippingOrder |
| - name: InternationalShipping |
| type: inject |
| data: |
| shipping: "international" |
| end: |
| produceEvents: |
| - eventRef: "InternationalShippingOrder" |