<?xml version="1.0" encoding="UTF-8"?>
<!--
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>Common Application Components Shipment Services</description>
    <vendor>OFBiz</vendor>
    <version>1.0</version>

    <!-- UPS Rate API Services -->
    <service name="upsRateEstimate" engine="java"
            location="org.apache.ofbiz.shipment.thirdparty.ups.UpsServices" invoke="upsRateInquire" auth="false">
            <description>UPS On-Line rate inquire tool.  Also supports rate shopping by setting upsRateInquireMode to 'Shop', and upsRateCodeMap
                will return a Map of serviceCode -> rate</description>
        <implements service="calcShipmentEstimateInterface"/>
        <attribute name="upsRateInquireMode" type="String" mode="IN" optional="true"/>
        <!-- Passing in a list of package weights will override the splitting of packages and calculation of package weights by item -->
        <attribute name="packageWeights" type="List" mode="IN" optional="true"/>
        <attribute name="upsRateCodeMap" type="Map" mode="OUT" optional="false"/>
    </service>

    <!-- UPS XPCI API Services -->
    <service name="upsShipmentConfirm" engine="java"
            location="org.apache.ofbiz.shipment.thirdparty.ups.UpsServices" invoke="upsShipmentConfirm" auth="true">
        <description>UPS Shipment Confirm</description>
        <auto-attributes entity-name="ShipmentRouteSegment" include="pk" mode="IN" optional="false"/>
    </service>
    <service name="upsShipmentAccept" engine="java"
            location="org.apache.ofbiz.shipment.thirdparty.ups.UpsServices" invoke="upsShipmentAccept" auth="true">
        <description>UPS Shipment Accept</description>
        <auto-attributes entity-name="ShipmentRouteSegment" include="pk" mode="IN" optional="false"/>
    </service>
    <service name="upsVoidShipment" engine="java"
            location="org.apache.ofbiz.shipment.thirdparty.ups.UpsServices" invoke="upsVoidShipment" auth="true">
        <description>UPS Void Shipment</description>
        <auto-attributes entity-name="ShipmentRouteSegment" include="pk" mode="IN" optional="false"/>
    </service>
    <service name="upsTrackShipment" engine="java"
            location="org.apache.ofbiz.shipment.thirdparty.ups.UpsServices" invoke="upsTrackShipment" auth="true">
        <description>UPS Track Shipment</description>
        <auto-attributes entity-name="ShipmentRouteSegment" include="pk" mode="IN" optional="false"/>
    </service>
    <service name="upsEmailReturnLabel" engine="java"
            location="org.apache.ofbiz.shipment.thirdparty.ups.UpsServices" invoke="upsEmailReturnLabel" auth="true">
        <description>Email UPS Retrun Label</description>
        <auto-attributes entity-name="ShipmentRouteSegment" include="pk" mode="IN" optional="false"/>
    </service>

    <!-- UPS Rate Estimate -->
    <service name="upsRateEstimateByPostalCode" engine="java"
        location="org.apache.ofbiz.shipment.thirdparty.ups.UpsServices" invoke="upsRateInquireByPostalCode" auth="false">
        <description>UPS On-Line rate inquire tool.  Also supports rate shopping by setting upsRateInquireMode to 'Shop', and upsRateCodeMap
            will return a Map of serviceCode -> rate</description>
        <attribute name="serviceConfigProps" type="String" mode="IN" optional="true"/>
        <attribute name="initialEstimateAmt" type="BigDecimal" mode="IN" optional="true"/>
        <!-- The postal code must not be required or service validation could create an exception and break other things.  It will
        be checked in the service and a Failure (not Error) will be returned if it is null -->
        <attribute name="shippingPostalCode" type="String" mode="IN" optional="true"/>
        <attribute name="shipmentMethodTypeId" type="String" mode="IN" optional="false"/>
        <attribute name="carrierPartyId" type="String" mode="IN" optional="false"/>
        <attribute name="carrierRoleTypeId" type="String" mode="IN" optional="false"/>
        <attribute name="productStoreId" type="String" mode="IN" optional="false"/>
        <!-- Passing in a list of package weights will override the splitting of packages and calculation of package weights by item -->
        <attribute name="packageWeights" type="List" mode="IN" optional="true"/>
        <attribute name="shippableItemInfo" type="List" mode="IN" optional="false"/>
        <attribute name="shippableWeight" type="BigDecimal" mode="IN" optional="false"/>
        <attribute name="shippableQuantity" type="BigDecimal" mode="IN" optional="false"/>
        <attribute name="shippableTotal" type="BigDecimal" mode="IN" optional="false"/>
        <attribute name="shippingEstimateAmount" type="BigDecimal" mode="OUT" optional="false"/>
        <attribute name="upsRateInquireMode" type="String" mode="IN" optional="true"/>
        <attribute name="upsRateCodeMap" type="Map" mode="OUT" optional="false"/>
        <attribute name="isResidentialAddress" type="String" mode="IN" optional="true"/>
        <attribute name="shippingCountryCode" type="String" mode="IN" optional="true"/>
        <!-- Allow specifying a from address if different from product store's facility address. -->
        <attribute name="shipFromAddress" type="org.apache.ofbiz.entity.GenericValue" mode="IN" optional="true"/>
        <attribute name="shipmentGatewayConfigId" type="String" mode="IN" optional="true"/>
    </service>

    <!-- UPS Address Validation -->
    <service name="upsAddressValidation" engine="java"
        location="org.apache.ofbiz.shipment.thirdparty.ups.UpsServices" invoke="upsAddressValidation" auth="false">
        <attribute name="city" type="String" mode="IN" optional="true"/>
        <attribute name="stateProvinceGeoId" type="String" mode="IN" optional="true"/>
        <attribute name="postalCode" type="String" mode="IN" optional="true"/>
        <attribute name="matches" type="List" mode="OUT" optional="true"/>
    </service>
    
    <service name="upsShipmentAlternateRatesEstimate" engine="java"
            location="org.apache.ofbiz.shipment.thirdparty.ups.UpsServices" invoke="upsShipmentAlternateRatesInquiry" auth="false">
            <description>UPS On-Line rate inquire tool. Supports rate shopping where  upsRateInquireMode is set to 'Shop', and shippingRates 
                will return a List of Maps, of serviceCode -> rate for the shipping methods which are configured in ProductStoreShipmentMeth entity</description>
        <attribute name="productStoreId" type="String" mode="IN" optional="false"/>
        <attribute name="shipmentId" type="String" mode="IN" optional="false"/>
        <attribute name="shipmentRouteSegmentId" type="String" mode="IN" optional="true"/>
        <attribute name="shippingRates" type="List" mode="OUT" optional="false"/>
    </service>
 
</services>
