<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you 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.
-->

<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
    <description>Order Return Services</description>
    <vendor>OFBiz</vendor>
    <version>1.0</version>

    <!-- Order Return Services -->
    <service name="quickReturnOrder" engine="groovy"
            location="component://order/src/main/groovy/org/apache/ofbiz/order/order/OrderReturnServicesScript.groovy" invoke="quickReturnFromOrder">
        <description>Quick Return Order</description>
        <attribute name="orderId" type="String" mode="IN" optional="false"/>
        <attribute name="returnReasonId" type="String" mode="IN" optional="true"/>
        <attribute name="returnTypeId" type="String" mode="IN" optional="true"/>
        <attribute name="returnHeaderTypeId" type="String" mode="IN" optional="false"/>
        <attribute name="receiveReturn" type="Boolean" mode="IN" optional="true"/>
        <attribute name="returnId" type="String" mode="OUT" optional="false"/>
    </service>
    <service name="createReturnHeader" default-entity-name="ReturnHeader" engine="groovy"
            location="component://order/src/main/groovy/org/apache/ofbiz/order/order/OrderReturnServicesScript.groovy" invoke="createReturnHeader">
        <description>Create a new ReturnHeader</description>
        <auto-attributes include="pk" mode="OUT" optional="false"/>
        <auto-attributes include="nonpk" mode="IN" optional="true"/>
        <override name="returnHeaderTypeId" optional="false"/>
    </service>
    <service name="updateReturnHeader" default-entity-name="ReturnHeader" engine="groovy"
            location="component://order/src/main/groovy/org/apache/ofbiz/order/order/OrderReturnServicesScript.groovy" invoke="updateReturnHeader">
        <description>Update a ReturnHeader</description>
        <permission-service service-name="returnPermissionCheck" main-action="UPDATE"/>
        <auto-attributes include="pk" mode="IN" optional="false"/>
        <auto-attributes include="nonpk" mode="IN" optional="true"/>
        <attribute name="oldStatusId" type="String" mode="OUT" optional="false"/>
    </service>
    <service name="createReturnItemBilling" engine="entity-auto" default-entity-name="ReturnItemBilling" invoke="create">
        <description>Create a new return item billing record</description>
        <auto-attributes include="pk" mode="IN" optional="false"/>
        <auto-attributes include="nonpk" mode="IN" optional="true"/>
    </service>

    <service name="createReturnItem" engine="groovy"
            location="component://order/src/main/groovy/org/apache/ofbiz/order/order/OrderReturnServicesScript.groovy" invoke="createReturnItem">
        <description>Create a new ReturnItem in the RETURN_REQUESTED status, based on returnableQuantity and returnablePrice from the
                     getReturnableQuantity service.  This can be called by the customer to request a return for himself or by a user with
                     ORDERMGR_CREATE, but, if the former, the returnPrice will be overriden by the returnablePrice from getReturnableQuantity.</description>
        <auto-attributes entity-name="ReturnItem" include="all" mode="IN" optional="true">
            <exclude field-name="returnItemSeqId"/>
        </auto-attributes>
        <attribute name="includeAdjustments" type="String" mode="IN" optional="true"/> <!-- The default is "Y": the adjustments associated with the item are included in the return -->
        <attribute name="returnItemSeqId" type="String" mode="OUT" optional="false"/>
        <override name="returnId" optional="false"/>
        <override name="returnTypeId" optional="false"/>
        <override name="returnItemTypeId" optional="false"/>
        <override name="orderId" optional="false"/>
        <override name="returnQuantity" optional="false"/>
    </service>
    <service name="updateReturnItem" engine="groovy" default-entity-name="ReturnItem"
            location="component://order/src/main/groovy/org/apache/ofbiz/order/order/OrderReturnServicesScript.groovy" invoke="updateReturnItem">
        <description>Update a ReturnItem and related adjustments</description>
        <permission-service service-name="returnPermissionCheck" main-action="UPDATE"/>
        <auto-attributes include="pk" mode="IN" optional="false"/>
        <auto-attributes include="nonpk" mode="IN" optional="true"/>
        <attribute name="oldStatusId" type="String" mode="OUT" optional="false"/>
    </service>
    <service name="updateReturnItemsStatus" engine="groovy"
            location="component://order/src/main/groovy/org/apache/ofbiz/order/order/OrderReturnServicesScript.groovy" invoke="updateReturnItemsStatus">
        <description>Update ReturnItem(s) Status</description>
        <permission-service service-name="returnPermissionCheck" main-action="UPDATE"/>
        <attribute name="returnId" type="String" mode="IN" optional="false"/>
        <attribute name="statusId" type="String" mode="IN" optional="false"/>
    </service>
    <service name="removeReturnItem" engine="groovy"
            location="component://order/src/main/groovy/org/apache/ofbiz/order/order/OrderReturnServicesScript.groovy" invoke="removeReturnItem">
        <description>Remove a ReturnItem and related adjustments</description>
        <permission-service service-name="returnPermissionCheck" main-action="DELETE"/>
        <auto-attributes entity-name="ReturnItem" include="pk" mode="IN" optional="false"/>
    </service>
    <service name="createReturnItemResponse" engine="entity-auto" invoke="create" default-entity-name="ReturnItemResponse">
            <description>Creates a ReturnItemResponse record.</description>
        <auto-attributes include="nonpk" mode="IN" optional="true"/>
        <attribute name="returnItemResponseId" type="String" mode="OUT" optional="false"/>
    </service>
    <service name="createPaymentApplicationsFromReturnItemResponse" engine="java"
            location="org.apache.ofbiz.order.order.OrderReturnServices" invoke="createPaymentApplicationsFromReturnItemResponse">
            <description>Creates PaymentApplications for each return item billing related to the return response until
                the responseAmount is reached or all items are paid.</description>
        <attribute name="returnItemResponseId" type="String" mode="IN" optional="false"/>
    </service>
    <service name="cancelReturnItems" engine="groovy"
            location="component://order/src/main/groovy/org/apache/ofbiz/order/order/OrderReturnServicesScript.groovy" invoke="cancelReturnItems">
        <description>Cancel ReturnItems and set their status to "RETURN_CANCELLED"</description>
        <permission-service service-name="returnPermissionCheck" main-action="UPDATE"/>
        <attribute name="returnId" type="String" mode="IN" optional="false"/>
    </service>

    <service name="cancelReplacementOrderItems" engine="groovy"
            location="component://order/src/main/groovy/org/apache/ofbiz/order/order/OrderReturnServicesScript.groovy" invoke="cancelReplacementOrderItems">
        <description>Cancel the associated OrderItems of the replacement order, if any.</description>
        <permission-service service-name="returnPermissionCheck" main-action="UPDATE"/>
        <auto-attributes entity-name="ReturnItem" include="pk" mode="IN" optional="false"/>
    </service>

    <!-- services for return adjustments -->
    <service name="returnAdjustmentInterface" engine="interface" location="" invoke="">
        <description>Return Adjustment Interface</description>
        <auto-attributes mode="IN" include="all" entity-name="ReturnAdjustment" optional="true"/>
    </service>
    <service name="createReturnAdjustment" engine="java" location="org.apache.ofbiz.order.order.OrderReturnServices"
             invoke="createReturnAdjustment">
         <description>Simple create service</description>
         <implements service="returnAdjustmentInterface"/>
         <override name="returnAdjustmentId" mode="OUT" optional="false"/>
    </service>
    <service name="updateReturnAdjustment" engine="java" location="org.apache.ofbiz.order.order.OrderReturnServices"
             invoke="updateReturnAdjustment">
        <description></description>
        <implements service="returnAdjustmentInterface"/>
        <attribute name="originalReturnPrice" type="BigDecimal" mode="IN" optional="true"/>
        <attribute name="originalReturnQuantity" type="BigDecimal" mode="IN" optional="true"/>
        <override name="returnAdjustmentId" optional="false"/>
    </service>
    <service name="removeReturnAdjustment" engine="entity-auto" default-entity-name="ReturnAdjustment"
                 invoke="delete">
        <description>Simple remove service</description>
        <permission-service service-name="returnPermissionCheck" main-action="DELETE"/>
        <auto-attributes entity-name="ReturnAdjustment" include="pk" mode="IN" optional="false"/>
    </service>
    <service name="createReturnAndItemOrAdjustment" engine="groovy" location="component://order/src/main/groovy/org/apache/ofbiz/order/order/OrderReturnServicesScript.groovy"
                 invoke="createReturnAndItemOrAdjustment">
        <description>If returnId is null, create a return; then create Return Item or Adjustment based on the parameters passed in</description>
        <auto-attributes mode="IN" include="nonpk" entity-name="ReturnHeader" optional="true"/>
        <auto-attributes mode="IN" include="all" entity-name="ReturnAdjustment" optional="true"/>
        <auto-attributes mode="IN" include="all" entity-name="ReturnItem" optional="true"/>
        <attribute name="returnAdjustmentId" type="String" mode="OUT" optional="true"/>
        <attribute name="returnItemSeqId" type="String" mode="OUT" optional="true"/>
        <attribute name="returnId" type="String" mode="OUT" optional="true"/>
    </service>
    <service name="createReturnItemOrAdjustment" engine="java"
             location="org.apache.ofbiz.order.order.OrderReturnServices" invoke="createReturnItemOrAdjustment">
        <description>create Return Item or Adjustment based on the parameters passed in</description>
        <auto-attributes mode="IN" include="all" entity-name="ReturnAdjustment" optional="true"/>
        <auto-attributes mode="IN" include="all" entity-name="ReturnItem" optional="true"/>
        <attribute name="returnAdjustmentId" type="String" mode="OUT" optional="true"/>
        <attribute name="returnItemSeqId" type="String" mode="OUT" optional="true"/>
    </service>
    <service name="updateReturnItemOrAdjustment" engine="java"
             location="org.apache.ofbiz.order.order.OrderReturnServices" invoke="updateReturnItemOrAdjustment">
        <description>update Return Item or Adjustment based on the parameters passed in</description>
        <auto-attributes mode="IN" include="all" entity-name="ReturnAdjustment" optional="true"/>
        <auto-attributes mode="IN" include="all" entity-name="ReturnItem" optional="true"/>
        <attribute name="oldStatusId" type="String" mode="OUT" optional="true"/>
    </service>

    <!-- services to verify that returns refunds aren't issued more than once -->
    <service name="getReturnAmountByOrder" engine="java"
             location="org.apache.ofbiz.order.order.OrderReturnServices" invoke="getReturnAmountByOrder">
        <description>Finds the refunded or credited payment amounts for each order on a return</description>
        <attribute name="returnId" type="String" mode="IN" optional="false"/>
        <attribute name="orderReturnAmountMap" type="Map" mode="OUT"/>
    </service>
    <service name="checkPaymentAmountForRefund" engine="java"
             location="org.apache.ofbiz.order.order.OrderReturnServices" invoke="checkPaymentAmountForRefund">
        <description>Makes sure the return is not over-refunding/crediting any order, or return an error</description>
        <attribute name="returnId" type="String" mode="IN" optional="false"/>
    </service>

    <service name="getReturnItemInitialCost" engine="java"
            location="org.apache.ofbiz.order.order.OrderReturnServices" invoke="getReturnItemInitialCost">
        <description>Gets the item's initial cost based on the inventory item record associated with the order item or 0.00 if none found.</description>
        <attribute name="returnId" type="String" mode="IN" optional="false"/>
        <attribute name="returnItemSeqId" type="String" mode="IN" optional="false"/>
        <attribute name="initialItemCost" type="BigDecimal" mode="OUT" optional="false"/>
    </service>

    <service name="checkReturnComplete" engine="java"
            location="org.apache.ofbiz.order.order.OrderReturnServices" invoke="checkReturnComplete">
        <description>Checks if all items on a return are complete/cancelled and updates the header status</description>
        <attribute name="returnId" type="String" mode="IN" optional="false"/>
        <attribute name="statusId" type="String" mode="OUT" optional="true"/>
    </service>

    <!-- return notification services -->
    <service name="sendReturnAcceptNotification" engine="java" max-retry="3"
            location="org.apache.ofbiz.order.order.OrderReturnServices" invoke="sendReturnAcceptNotification">
        <description>Send a notification that a return has been accepted</description>
        <attribute name="returnId" type="String" mode="IN" optional="false"/>
        <attribute name="communicationEventId" type="String" mode="OUT" optional="true"/>
    </service>
    <service name="sendReturnCompleteNotification" engine="java" max-retry="3"
            location="org.apache.ofbiz.order.order.OrderReturnServices" invoke="sendReturnCompleteNotification">
        <description>Send a notification that a return has been completed</description>
        <attribute name="returnId" type="String" mode="IN" optional="false"/>
        <attribute name="communicationEventId" type="String" mode="OUT" optional="true"/>
    </service>
     <service name="sendReturnCancelNotification" engine="java" max-retry="3"
            location="org.apache.ofbiz.order.order.OrderReturnServices" invoke="sendReturnCancelNotification">
        <description>Send a notification that a return has been cancelled</description>
        <attribute name="returnId" type="String" mode="IN" optional="false"/>
        <attribute name="communicationEventId" type="String" mode="OUT" optional="true"/>
    </service>
    <service name="autoCancelReplacementOrders" engine="java" max-retry="3" transaction-timeout="36000"
            location="org.apache.ofbiz.order.order.OrderReturnServices" invoke="autoCancelReplacementOrders">
        <description>Automatic cancellation of replacement order if return is not received within 30 days</description>
    </service>

    <!-- return processing services -->
    <service name="processCreditReturn" engine="java" auth="true"
            location="org.apache.ofbiz.order.order.OrderReturnServices" invoke="processCreditReturn">
        <description>Process the credits in a return</description>
        <attribute name="returnId" type="String" mode="IN" optional="false"/>
    </service>
    <service name="processRefundReturn" engine="java" auth="true"
            location="org.apache.ofbiz.order.order.OrderReturnServices" invoke="processRefundReturn">
        <description>Process the refunds in a return</description>
        <attribute name="returnId" type="String" mode="IN" optional="false"/>
        <attribute name="returnTypeId" type="String" mode="IN" optional="false"/>
    </service>
    <service name="processReplacementReturn" engine="java" auth="true"
            location="org.apache.ofbiz.order.order.OrderReturnServices" invoke="processReplacementReturn">
        <description>Process the replacements in a return</description>
        <attribute name="returnId" type="String" mode="IN" optional="false"/>
        <attribute name="returnTypeId" type="String" mode="IN" optional="false"/>
    </service>
    <service name="processWaitReplacementReturn" engine="groovy" auth="true"
            location="component://order/src/main/groovy/org/apache/ofbiz/order/order/OrderReturnServicesScript.groovy" invoke="processWaitReplacementReservedReturn">
        <description>Process the replacements in a wait return</description>
        <attribute name="returnId" type="String" mode="IN" optional="false"/>
    </service>
    <service name="processWaitReplacementReservedReturn" engine="groovy" auth="true"
            location="component://order/src/main/groovy/org/apache/ofbiz/order/order/OrderReturnServicesScript.groovy" invoke="processWaitReplacementReservedReturn">
        <description>Process the replacements in a wait reserved return when the return is accepted and then received</description>
        <attribute name="returnId" type="String" mode="IN" optional="false"/>
    </service>
    <service name="processCrossShipReplacementReturn" engine="groovy" auth="true"
            location="component://order/src/main/groovy/org/apache/ofbiz/order/order/OrderReturnServicesScript.groovy" invoke="processCrossShipReplacementReturn">
        <description>Process the replacements in a cross-ship return</description>
        <attribute name="returnId" type="String" mode="IN" optional="false"/>
    </service>
    <service name="processRepairReplacementReturn" engine="groovy" auth="true"
            location="component://order/src/main/groovy/org/apache/ofbiz/order/order/OrderReturnServicesScript.groovy" invoke="processRepairReplacementReturn">
        <description>Process the replacements in a repair return</description>
        <attribute name="returnId" type="String" mode="IN" optional="false"/>
    </service>
    <service name="processReplaceImmediatelyReturn" engine="groovy" auth="true"
            location="component://order/src/main/groovy/org/apache/ofbiz/order/order/OrderReturnServicesScript.groovy" invoke="processReplaceImmediatelyReturn">
        <description>Process the replacements in a Immediate Return</description>
        <attribute name="returnId" type="String" mode="IN" optional="false"/>
    </service>
    <service name="processRefundOnlyReturn" engine="groovy"  auth="true"
            location="component://order/src/main/groovy/org/apache/ofbiz/order/order/OrderReturnServicesScript.groovy" invoke="processRefundOnlyReturn">
        <description>Process the Refund in a return</description>    
        <attribute name="returnId" type="String" mode="IN" optional="false"/>
    </service>
    <service name="processRefundImmediatelyReturn" engine="groovy"  auth="true"
            location="component://order/src/main/groovy/org/apache/ofbiz/order/order/OrderReturnServicesScript.groovy" invoke="processRefundImmediatelyReturn">
        <description>Process the Immediate Refund in a return</description>    
        <attribute name="returnId" type="String" mode="IN" optional="false"/>
    </service>
    <service name="processSubscriptionReturn" engine="java" auth="true"
            location="org.apache.ofbiz.order.order.OrderReturnServices" invoke="processSubscriptionReturn">
        <description>Process subscription changes from a return</description>
        <attribute name="returnId" type="String" mode="IN" optional="false"/>
    </service>
    <service name="processRefundReturnForReplacement" engine="java" auth="true"
            location="org.apache.ofbiz.order.order.OrderReturnServices" invoke="processRefundReturnForReplacement">
        <description>Process the refund return for replacement order</description>
        <attribute name="orderId" type="String" mode="IN" optional="false"/>
    </service>

    <!-- other return services -->
    <service name="updateReturnStatusFromReceipt" engine="groovy"
            location="component://order/src/main/groovy/org/apache/ofbiz/order/order/OrderReturnServicesScript.groovy" invoke="updateReturnStatusFromReceipt">
        <description>Update return/item status when items have been received</description>
        <permission-service service-name="returnPermissionCheck" main-action="UPDATE"/>
        <attribute name="returnId" type="String" mode="IN" optional="false"/>
        <attribute name="returnHeaderStatus" type="String" mode="OUT" optional="false"/>
    </service>
    <service name="getReturnableQuantity" engine="java"
            location="org.apache.ofbiz.order.order.OrderReturnServices" invoke="getReturnableQuantity">
        <description>Get the quantity allowed for an item to be returned</description>
        <attribute name="orderItem" type="org.apache.ofbiz.entity.GenericValue" mode="IN" optional="false"/>
        <attribute name="returnableQuantity" type="BigDecimal" mode="OUT" optional="false"/>
        <attribute name="returnablePrice" type="BigDecimal" mode="OUT" optional="true"/>
    </service>
    <service name="getReturnableItems" engine="java"
            location="org.apache.ofbiz.order.order.OrderReturnServices" invoke="getReturnableItems">
        <description>Get a map of returnable items orderItem => quantity available to return</description>
        <attribute name="orderId" type="String" mode="IN" optional="false"/>
        <attribute name="returnableItems" type="Map" mode="OUT" optional="false"/>
    </service>

    <service name="getOrderAvailableReturnedTotal" engine="java"
            location="org.apache.ofbiz.order.order.OrderReturnServices" invoke="getOrderAvailableReturnedTotal">
        <description>Get the total amount of all returns for an order: orderTotal, returnTotal - totals so far.  availableReturnTotal = orderTotal - returnTotal - adjustment.  Used for checking if the return total has gone over the order total.  If countNewReturnItems is set to Boolean.TRUE then return items in the CREATED state will be counted.  This should only be the case during quickRefundEntireOrder.</description>
        <attribute name="orderId" type="String" mode="IN" optional="false"/>
        <attribute name="adjustment" type="BigDecimal" mode="IN" optional="true"/>
        <attribute name="countNewReturnItems" type="Boolean" mode="IN" optional="true"/>
        <attribute name="orderTotal" type="BigDecimal" mode="OUT" optional="false"/>
        <attribute name="returnTotal" type="BigDecimal" mode="OUT" optional="false"/>
        <attribute name="availableReturnTotal" type="BigDecimal" mode="OUT" optional="false"/>
    </service>

    <service name="refundBillingAccountPayment" engine="java"
            location="org.apache.ofbiz.order.order.OrderReturnServices" invoke="refundBillingAccountPayment" auth="true">
        <description>Refunds A Billing Account Payment</description>
        <attribute name="orderPaymentPreference" type="org.apache.ofbiz.entity.GenericValue" mode="IN" optional="false"/>
        <attribute name="refundAmount" type="BigDecimal" mode="IN" optional="false"/>
        <attribute name="paymentId" type="String" mode="OUT" optional="false"/>
    </service>

    <service name="createReturnItemShipment" engine="entity-auto" default-entity-name="ReturnItemShipment" invoke="create">
        <description>Create a new ReturnItemShipment</description>
        <permission-service service-name="returnPermissionCheck" main-action="CREATE"/>
        <auto-attributes include="all" mode="IN" optional="false"/>
    </service>

    <service name="getStatusItemsForReturn" engine="groovy"
            location="component://order/src/main/groovy/org/apache/ofbiz/order/order/OrderReturnServicesScript.groovy" invoke="getStatusItemsForReturn">
        <description>Get the return status associated with customer/vendor return</description>
        <attribute name="returnHeaderTypeId" type="String" mode="IN" optional="false"/>
        <attribute name="statusItems" type="List" mode="OUT" optional="false"/>
    </service>

    <service name="createExchangeOrderAssoc" engine="groovy"
            location="component://order/src/main/groovy/org/apache/ofbiz/order/order/OrderReturnServicesScript.groovy" invoke="createExchangeOrderAssoc">
        <description>Associate exchange order with original order in OrderItemAssoc entity</description>
        <attribute name="orderId" type="String" mode="IN" optional="false"/>
        <attribute name="originOrderId" type="String" mode="IN" optional="false"/>
    </service>

    <service name="addProductsBackToCategory" engine="groovy"
            location="component://order/src/main/groovy/org/apache/ofbiz/order/order/OrderReturnServicesScript.groovy" invoke="addProductsBackToCategory">
        <description>Add product(s) back to category if it has no active category</description>
        <attribute name="returnId" type="String" mode="IN" optional="true"/>
        <attribute name="inventoryItemId" type="String" mode="IN" optional="true"/>
    </service>
    <service name="createReturnStatus" engine="groovy"
            location="component://order/src/main/groovy/org/apache/ofbiz/order/order/OrderReturnServicesScript.groovy" invoke="createReturnStatus">
        <description>Create Return Status</description>
        <attribute name="returnId" type="String" mode="IN" optional="false"/>
        <attribute name="returnItemSeqId" type="String" mode="IN" optional="true"/>
    </service>

    <!-- Return ContactMech Services -->
    <service name="createReturnContactMech" default-entity-name="ReturnContactMech" engine="entity-auto" invoke="create" auth="true">
        <description>Create a ReturnContactMech</description>
        <auto-attributes include="pk" mode="IN" optional="false"/>
        <auto-attributes include="nonpk" mode="IN" optional="true"/>
    </service>
    <service name="updateReturnContactMech" engine="groovy"
            location="component://order/src/main/groovy/org/apache/ofbiz/order/order/OrderReturnServicesScript.groovy" invoke="updateReturnContactMech" auth="true" default-entity-name="ReturnContactMech">
        <description>Update Return Contact Mech</description>
        <permission-service service-name="returnPermissionCheck" main-action="UPDATE"/>
        <auto-attributes include="pk" mode="IN" optional="false"/>
        <attribute name="oldContactMechId" type="String" mode="IN" optional="true"/>
    </service>
    <service name="deleteReturnContactMech" default-entity-name="ReturnContactMech" engine="entity-auto" invoke="delete" auth="true">
        <description>Delete a ReturnContactMech</description>
        <auto-attributes include="pk" mode="IN" optional="false"/>
    </service>

    <!-- Item Return Service -->
    <service name="createReturnItemForRental" engine="groovy"
            location="component://order/src/main/groovy/org/apache/ofbiz/order/order/OrderReturnServicesScript.groovy" invoke="createReturnItemForRental">
        <description>Create the return item for rental (which items has product type is ASSET_USAGE_OUT_IN)</description>
        <attribute name="orderId" type="String" mode="IN" optional="false"/>
        <attribute name="returnId" type="String" mode="OUT" optional="false"/>
    </service>

    <service name="createReturnAdjustmentType" engine="entity-auto" invoke="create" default-entity-name="ReturnAdjustmentType" auth="true">
        <description>Create a ReturnAdjustmentType record</description>
        <auto-attributes include="pk" mode="INOUT" optional="true"/>
        <auto-attributes include="nonpk" mode="IN" optional="true"/>
    </service>
    <service name="updateReturnAdjustmentType" engine="entity-auto" invoke="update" default-entity-name="ReturnAdjustmentType" auth="true">
        <description>Update a ReturnAdjustmentType record</description>
        <auto-attributes include="pk" mode="IN"/>
        <auto-attributes include="nonpk" mode="IN" optional="true"/>
    </service>
    <service name="deleteReturnAdjustmentType" engine="entity-auto" invoke="delete" default-entity-name="ReturnAdjustmentType" auth="true">
        <description>Delete a ReturnAdjustmentType record</description>
        <auto-attributes include="pk" mode="IN"/>
    </service>

    <service name="createReturnHeaderType" engine="entity-auto" invoke="create" default-entity-name="ReturnHeaderType" auth="true">
        <description>Create a ReturnHeaderType record</description>
        <auto-attributes include="pk" mode="INOUT" optional="true"/>
        <auto-attributes include="nonpk" mode="IN" optional="true"/>
    </service>
    <service name="updateReturnHeaderType" engine="entity-auto" invoke="update" default-entity-name="ReturnHeaderType" auth="true">
        <description>Update a ReturnHeaderType record</description>
        <auto-attributes include="pk" mode="IN"/>
        <auto-attributes include="nonpk" mode="IN" optional="true"/>
    </service>
    <service name="deleteReturnHeaderType" engine="entity-auto" invoke="delete" default-entity-name="ReturnHeaderType" auth="true">
        <description>Delete a ReturnHeaderType record</description>
        <auto-attributes include="pk" mode="IN"/>
    </service>

    <service name="createReturnItemType" engine="entity-auto" invoke="create" default-entity-name="ReturnItemType" auth="true">
        <description>Create a ReturnItemType record</description>
        <auto-attributes include="pk" mode="INOUT" optional="true"/>
        <auto-attributes include="nonpk" mode="IN" optional="true"/>
    </service>
    <service name="updateReturnItemType" engine="entity-auto" invoke="update" default-entity-name="ReturnItemType" auth="true">
        <description>Update a ReturnItemType record</description>
        <auto-attributes include="pk" mode="IN"/>
        <auto-attributes include="nonpk" mode="IN" optional="true"/>
    </service>
    <service name="deleteReturnItemType" engine="entity-auto" invoke="delete" default-entity-name="ReturnItemType" auth="true">
        <description>Delete a ReturnItemType record</description>
        <auto-attributes include="pk" mode="IN"/>
    </service>

    <service name="createReturnItemTypeMap" engine="entity-auto" invoke="create" default-entity-name="ReturnItemTypeMap" auth="true">
        <description>Create a ReturnItemTypeMap record</description>
        <auto-attributes include="pk" mode="IN"/>
        <auto-attributes include="nonpk" mode="IN" optional="true"/>
    </service>
    <service name="updateReturnItemTypeMap" engine="entity-auto" invoke="update" default-entity-name="ReturnItemTypeMap" auth="true">
        <description>Update a ReturnItemTypeMap record</description>
        <auto-attributes include="pk" mode="IN"/>
        <auto-attributes include="nonpk" mode="IN" optional="true"/>
    </service>
    <service name="deleteReturnItemTypeMap" engine="entity-auto" invoke="delete" default-entity-name="ReturnItemTypeMap" auth="true">
        <description>Delete a ReturnItemTypeMap record</description>
        <auto-attributes include="pk" mode="IN"/>
    </service>

    <service name="createReturnReason" engine="entity-auto" invoke="create" default-entity-name="ReturnReason" auth="true">
        <description>Create a ReturnReason record</description>
        <auto-attributes include="pk" mode="INOUT"  optional="true"/>
        <auto-attributes include="nonpk" mode="IN" optional="true"/>
    </service>
    <service name="updateReturnReason" engine="entity-auto" invoke="update" default-entity-name="ReturnReason" auth="true">
        <description>Update a ReturnReason record</description>
        <auto-attributes include="pk" mode="IN"/>
        <auto-attributes include="nonpk" mode="IN" optional="true"/>
    </service>
    <service name="deleteReturnReason" engine="entity-auto" invoke="delete" default-entity-name="ReturnReason" auth="true">
        <description>Delete a ReturnReason record</description>
        <auto-attributes include="pk" mode="IN"/>
    </service>

    <service name="createReturnType" engine="entity-auto" invoke="create" default-entity-name="ReturnType" auth="true">
        <description>Create a ReturnType record</description>
        <auto-attributes include="pk" mode="INOUT"  optional="true"/>
        <auto-attributes include="nonpk" mode="IN" optional="true"/>
    </service>
    <service name="updateReturnType" engine="entity-auto" invoke="update" default-entity-name="ReturnType" auth="true">
        <description>Update a ReturnType record</description>
        <auto-attributes include="pk" mode="IN"/>
        <auto-attributes include="nonpk" mode="IN" optional="true"/>
    </service>
    <service name="deleteReturnType" engine="entity-auto" invoke="delete" default-entity-name="ReturnType" auth="true">
        <description>Delete a ReturnType record</description>
        <auto-attributes include="pk" mode="IN"/>
    </service>
    
    <service name="createCommunicationEventReturn" default-entity-name="CommunicationEventReturn" engine="entity-auto" invoke="create" auth="true">
        <description>Create a Communication Event Return</description>
        <auto-attributes entity-name="CommunicationEventReturn" include="pk" mode="IN"/>
    </service>
    <service name="removeCommunicationEventReturn" default-entity-name="CommunicationEventReturn" engine="entity-auto" invoke="delete" auth="true">
        <description>Remove a Communication Event Return</description>
        <auto-attributes entity-name="CommunicationEventReturn" include="pk" mode="IN"/>
    </service>
</services>
