Jump to content

Webservice Orders


Zangetsu

Recommended Posts

Buenos días,

estoy intentando crear pedidos por webservice. El cliente, transportista y direcciones son siempre las mismas.

Primero creo por webservice el carrito

<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<cart>
    <id></id>
    <id_address_delivery>4</id_address_delivery>
    <id_address_invoice>4</id_address_invoice>
    <id_currency>1</id_currency>
    <id_customer>1</id_customer>
    <id_guest>1</id_guest>
    <id_lang>1</id_lang>
    <id_shop_group>1</id_shop_group>
    <id_shop>1</id_shop>
    <id_carrier>2</id_carrier>
    <recyclable>0</recyclable>
    <gift>0</gift>
    <gift_message></gift_message>
    <mobile_theme>0</mobile_theme>
    <delivery_option></delivery_option>
    <secure_key></secure_key>
    <allow_seperated_package>0</allow_seperated_package>
    <date_add>2018-02-13 10:30:46</date_add>
    <date_upd>2018-02-13 10:30:46</date_upd>
<associations>
</associations>
</cart>
</prestashop> 

 

Y el id que me genera el carrito anterior se lo paso al pedido

 

<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<order>
    <id></id>
    <id_address_delivery xlink:href="http://localhost/tienda2/api/addresses/4"><![CDATA[4]]></id_address_delivery>
    <id_address_invoice xlink:href="http://localhost/tienda2/api/addresses/4"><![CDATA[4]]></id_address_invoice>
    <id_cart><![CDATA[48]]></id_cart>
    <id_currency xlink:href="http://localhost/tienda2/api/currencies/1"><![CDATA[1]]></id_currency>
    <id_lang xlink:href="http://localhost/tienda2/api/languages/1"><![CDATA[1]]></id_lang>
    <id_customer xlink:href="http://localhost/tienda2/api/customers/1"><![CDATA[1]]></id_customer>
    <id_carrier xlink:href="http://localhost/tienda2/api/carriers/2"><![CDATA[2]]></id_carrier>
    <current_state xlink:href="http://localhost/tienda2/api/order_states/3"><![CDATA[3]]></current_state>
    <module><![CDATA[cashondelivery]]></module>
    <invoice_number><![CDATA[0]]></invoice_number>
    <invoice_date><![CDATA[0000-00-00 00:00:00]]></invoice_date>
    <delivery_number><![CDATA[0]]></delivery_number>
    <delivery_date><![CDATA[0000-00-00 00:00:00]]></delivery_date>
    <valid><![CDATA[0]]></valid>
    <date_add><![CDATA[2018-02-13 10:35:47]]></date_add>
    <date_upd><![CDATA[2018-02-13 10:35:47]]></date_upd>
    <shipping_number></shipping_number>
    <id_shop_group><![CDATA[1]]></id_shop_group>
    <id_shop><![CDATA[1]]></id_shop>
    <secure_key></secure_key>
    <payment><![CDATA[Cash on delivery (COD)]]></payment>
    <recyclable><![CDATA[0]]></recyclable>
    <gift><![CDATA[0]]></gift>
    <gift_message></gift_message>
    <mobile_theme><![CDATA[0]]></mobile_theme>
    <total_discounts><![CDATA[0.000000]]></total_discounts>
    <total_discounts_tax_incl><![CDATA[0.000000]]></total_discounts_tax_incl>
    <total_discounts_tax_excl><![CDATA[0.000000]]></total_discounts_tax_excl>
    <total_paid><![CDATA[55.000000]]></total_paid>
    <total_paid_tax_incl><![CDATA[55.000000]]></total_paid_tax_incl>
    <total_paid_tax_excl><![CDATA[55.000000]]></total_paid_tax_excl>
    <total_paid_real><![CDATA[0.000000]]></total_paid_real>
    <total_products><![CDATA[53.000000]]></total_products>
    <total_products_wt><![CDATA[53.000000]]></total_products_wt>
    <total_shipping><![CDATA[2.000000]]></total_shipping>
    <total_shipping_tax_incl><![CDATA[2.000000]]></total_shipping_tax_incl>
    <total_shipping_tax_excl><![CDATA[2.000000]]></total_shipping_tax_excl>
    <carrier_tax_rate><![CDATA[0.000]]></carrier_tax_rate>
    <total_wrapping><![CDATA[0.000000]]></total_wrapping>
    <total_wrapping_tax_incl><![CDATA[0.000000]]></total_wrapping_tax_incl>
    <total_wrapping_tax_excl><![CDATA[0.000000]]></total_wrapping_tax_excl>
    <round_mode><![CDATA[0]]></round_mode>
    <round_type><![CDATA[0]]></round_type>
    <conversion_rate><![CDATA[1.000000]]></conversion_rate>
    <reference><![CDATA[pruebaws]]></reference>
<associations>
<order_rows nodeType="order_row" virtualEntity="true">
    <order_row>
    <product_id><![CDATA[2]]></product_id>
    <product_attribute_id><![CDATA[10]]></product_attribute_id>
    <product_quantity><![CDATA[1]]></product_quantity>
    <product_name><![CDATA[Blouse - Color : White, Size : M]]></product_name>
    <product_reference><![CDATA[demo_2]]></product_reference>
    <product_ean13></product_ean13>
    <product_upc></product_upc>
    <product_price><![CDATA[26.999852]]></product_price>
    <unit_price_tax_incl><![CDATA[27.000000]]></unit_price_tax_incl>
    <unit_price_tax_excl><![CDATA[27.000000]]></unit_price_tax_excl>
    </order_row>
    <order_row>  
    <product_id><![CDATA[3]]></product_id>
    <product_attribute_id><![CDATA[13]]></product_attribute_id>
    <product_quantity><![CDATA[1]]></product_quantity>
    <product_name><![CDATA[Printed Dress - Color : Orange, Size : S]]></product_name>
    <product_reference><![CDATA[demo_3]]></product_reference>
    <product_ean13></product_ean13>
    <product_upc></product_upc>
    <product_price><![CDATA[25.999852]]></product_price>
    <unit_price_tax_incl><![CDATA[26.000000]]></unit_price_tax_incl>
    <unit_price_tax_excl><![CDATA[26.000000]]></unit_price_tax_excl>
    </order_row>
</order_rows>
</associations>
</order>
</prestashop>

 

El problema que tengo es que me devuelve siempre el siguiente error:

Fatal error: Uncaught exception 'PrestaShopException' with message 'Can't save Order Payment' 

¿Alguien me podría decir como solucionarlo?

Gracias!!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...