<?xml version="1.0"?>
<!--
/**
 * PHP version 7
* Copyright © Mobegic Inc. DBA Unbound Commerce.
 * All rights reserved.
 */
-->
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Webapi:etc/webapi.xsd">

    <!-- Managing Transaction Information -->
    <route url="/V1/googlepay/mine/transaction-information" method="POST">
        <service class="UnboundCommerce\GooglePay\Api\TransactionInformationManagementInterface" method="calculate"/>
        <resources>
            <resource ref="self" />
        </resources>
        <data>
            <parameter name="cartId" force="true">%cart_id%</parameter>
        </data>
    </route>

    <!-- Managing Guest Transaction Information -->
    <route url="/V1/googlepay/guest/:cartId/transaction-information" method="POST">
        <service class="UnboundCommerce\GooglePay\Api\GuestTransactionInformationManagementInterface" method="calculate"/>
        <resources>
            <resource ref="anonymous" />
        </resources>
    </route>

    <!-- Managing Checkout -->
    <route url="/V1/googlepay/mine/place-order" method="POST">
        <service class="UnboundCommerce\GooglePay\Api\OrderManagementInterface" method="placeOrder"/>
        <resources>
            <resource ref="self" />
        </resources>
        <data>
            <parameter name="cartId" force="true">%cart_id%</parameter>
        </data>
    </route>

    <!-- Managing Guest Checkout -->
    <route url="/V1/googlepay/guest/:cartId/place-order" method="POST">
        <service class="UnboundCommerce\GooglePay\Api\GuestOrderManagementInterface" method="placeOrder"/>
        <resources>
            <resource ref="anonymous" />
        </resources>
    </route>
</routes>
