<?xml version="1.0" encoding="UTF-8"?>
{% load satchmo_util %}
<checkout-shopping-cart xmlns="http://checkout.google.com/schema/2">
  <shopping-cart>
    <merchant-private-data>
        <satchmo-order id="{{ order.id }}" />{% if order.contact %}
        <satchmo-contact id="{{ order.contact.id }}">{{ order.contact.full_name }}</satchmo-contact>{% else %}
        <satchmo-contact id="-1">anonymous</satchmo-contact>
        {% endif %}
    </merchant-private-data>
    <items>
        {% for orderitem in order.orderitem_set.all %}<item>
        <item-name>{{ orderitem.product.translated_name }}</item-name>
        <item-description>{{ orderitem.product.translated_description }}</item-description>
        <unit-price currency="{{ currency }}">{{ orderitem.unit_price|truncate_decimal:2 }}</unit-price>
        <quantity>{{ orderitem.quantity|truncate_decimal:0 }}</quantity>
      </item>{% endfor %}
      {% if order.discount != 0 %}
      <item>
          <item-name>Discount Code {{ order.discount_code }}</item-name>
          <item-description>Discount Code {{ order.discount_code }}</item-description>
          <unit-price currency="{{ currency }}">-{{ order.discount }}</unit-price>
          <quantity>1</quantity>
      </item>
      {% endif %}
    </items>
  </shopping-cart>
  <checkout-flow-support>
    <merchant-checkout-flow-support>{% if edit_cart_url %}
      <edit-cart-url>{{ edit_cart_url }}</edit-cart-url>{% endif %}{% if continue_shopping_url %}
      <continue-shopping-url>{{ continue_shopping_url }}</continue-shopping-url>{% endif %}
      <shipping-methods>
          <flat-rate-shipping name="{{ order.shipping_method }}">
              <price currency="{{ currency }}">{{ order.shipping_sub_total|truncate_decimal:2 }}</price>
          </flat-rate-shipping>
      </shipping-methods>
    </merchant-checkout-flow-support>
  </checkout-flow-support>
</checkout-shopping-cart>
