{
    "retailerId": "{{users.retailer.id}}",
    "version": "{{version}}",
    "entityType": "BILLING_ACCOUNT",
    "entitySubtype": "CUSTOMER",
    "description": "Default Billing Account workflow",
    "name": "BILLING_ACCOUNT::CUSTOMER",
    "rulesets": [
        {
            "name": "CREATE",
            "description": "CREATE BILLING_ACCOUNT",
            "type": "BILLING_ACCOUNT",
            "subtype": "CUSTOMER",
            "eventType": "NORMAL",
            "rules": [
                {
                    "name": "FLUENTRETAIL.base.ChangeStateGQL",
                    "props": {
                        "status": "ACTIVE"
                    }
                }
            ],
            "triggers": [
                {
                    "status": "CREATED"
                }
            ],
            "userActions": []
        },
        {
            "name": "ProcessCreditForReturn",
            "description": "ProcessCreditForReturn",
            "type": "BILLING_ACCOUNT",
            "subtype": "CUSTOMER",
            "eventType": "NORMAL",
            "rules": [
                {
                    "name": "FLUENTRETAIL.base.CreateCreditMemoFromReturnOrder",
                    "props": {
                        "creditMemoType": "RETURN",
                        "creditMemoItemType": "RETURN_ITEM"
                    }
                }
            ],
            "triggers": [
                {
                    "status": "ACTIVE"
                }
            ],
            "userActions": []
        },
        {
            "name": "CREATE",
            "description": "CREATE CREDIT MEMO",
            "eventType": "NORMAL",
            "type": "CREDIT_MEMO",
            "rules": [
                {
                    "name": "FLUENTRETAIL.base.ChangeStateGQL",
                    "props": {
                        "status": "PENDING_REFUND"
                    }
                }
            ],
            "triggers": [
                {
                    "status": "CREATED"
                }
            ],
            "userActions": []
        },
        {
            "name": "RefundComplete",
            "description": "RefundComplete",
            "type": "CREDIT_MEMO",
            "subtype": "RETURN",
            "eventType": "NORMAL",
            "rules": [
                {
                    "name": "FLUENTRETAIL.base.ChangeStateGQL",
                    "props": {
                        "status": "REFUND_COMPLETE"
                    }
                },
                {
                    "name": "FLUENTRETAIL.base.SendEventForCreditMemoToReturn",
                    "props": {
                        "eventName": "RefundComplete"
                    }
                }
            ],
            "triggers": [
                {
                    "status": "PENDING_REFUND"
                },
                {
                    "status": "CREATED"
                }
            ],
            "userActions": [
                {
                    "eventName": "RefundComplete",
                    "context": [
                        {
                            "label": "Approve Refund",
                            "type": "PRIMARY",
                            "modules": [
                                "adminconsole"
                            ],
                            "confirm": true
                        }
                    ],
                    "attributes": []
                }
            ]
        },
        {
            "name": "RefundFailed",
            "description": "RefundFailed",
            "type": "CREDIT_MEMO",
            "subtype": "RETURN",
            "eventType": "NORMAL",
            "rules": [
                {
                    "name": "FLUENTRETAIL.base.ChangeStateGQL",
                    "props": {
                        "status": "REFUND_FAILED"
                    }
                },
                {
                    "name": "FLUENTRETAIL.base.SendEventForCreditMemoToReturn",
                    "props": {
                        "eventName": "RefundRejected"
                    }
                }
            ],
            "triggers": [
                {
                    "status": "PENDING_REFUND"
                },
                {
                    "status": "CREATED"
                }
            ],
            "userActions": [
                {
                    "eventName": "RefundFailed",
                    "context": [
                        {
                            "label": "Decline Refund",
                            "type": "PRIMARY",
                            "modules": [
                                "adminconsole"
                            ],
                            "confirm": true
                        }
                    ],
                    "attributes": []
                }
            ]
        }
    ],
    "statuses": [
        {
            "name": "CREATED",
            "category": "BOOKING",
            "entityType": "BILLING_ACCOUNT"
        },
        {
            "name": "ACTIVE",
            "category": "BOOKING",
            "entityType": "BILLING_ACCOUNT"
        },
        {
            "name": "REFUND_COMPLETE",
            "category": "BOOKING",
            "entityType": "CREDIT_MEMO"
        },
        {
            "name": "REFUND_FAILED",
            "category": "BOOKING",
            "entityType": "CREDIT_MEMO"
        },
        {
            "name": "CREATED",
            "category": "",
            "entityType": "CREDIT_MEMO"
        },
        {
            "name": "PENDING_REFUND",
            "category": "BOOKING",
            "entityType": "CREDIT_MEMO"
        }
    ]
}