Jump to content

Webservice order BUG


ziostanko

Recommended Posts

PRESTASHOP 1.6.1.4

 

it is not possible to add an order through webservice without writing to ps_order_payment!

 

for example if  i want to add an order with bankwire payment it always set order state to payment error because prestashop always writes a row in ps_order_payment even if it is not required (bankwire payment).

 

Does anybody worked this around????

 

Please help us  we're stuck on this developing a mobile app.

 

Thanks

Edited by ziostanko (see edit history)
Link to comment
Share on other sites

<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<order>
	<id/>
	<id_address_delivery>9</id_address_delivery>
	<id_address_invoice>9</id_address_invoice>
	<id_cart>709</id_cart>
	<id_currency>1</id_currency>
	<id_lang>1</id_lang>
	<id_customer>1</id_customer>
	<id_carrier>25</id_carrier>
	<current_state/>
	<module>bankwire</module>
	<invoice_number/>
	<invoice_date/>
	<delivery_number/>
	<delivery_date/>
	<valid/>
	<date_add/>
	<date_upd/>
	<shipping_number/>
	<id_shop_group/>
	<id_shop/>
	<secure_key/>
	<payment>Bonifico bancario</payment>
	<recyclable/>
	<gift/>
	<gift_message/>
	<mobile_theme/>
	<total_discounts/>
	<total_discounts_tax_incl/>
	<total_discounts_tax_excl/>
	<total_paid>0</total_paid>
	<total_paid_tax_incl/>
	<total_paid_tax_excl/>
	<total_paid_real>0</total_paid_real>
	<total_products>0</total_products>
	<total_products_wt>0</total_products_wt>
	<total_shipping/>
	<total_shipping_tax_incl/>
	<total_shipping_tax_excl/>
	<carrier_tax_rate/>
	<total_wrapping/>
	<total_wrapping_tax_incl/>
	<total_wrapping_tax_excl/>
	<round_mode/>
	<round_type/>
	<conversion_rate>1</conversion_rate>
	<reference/>
<associations>
<order_rows>
	<order_row>
	<id/>
	<product_id/>
	<product_attribute_id/>
	<product_quantity/>
	<product_name/>
	<product_reference/>
	<product_ean13/>
	<product_upc/>
	<product_price/>
	<unit_price_tax_incl/>
	<unit_price_tax_excl/>
	</order_row>
</order_rows>
</associations>
</order>
</prestashop>

am i missing something?

Link to comment
Share on other sites

found that webservice orders are validated by

public function addWs($autodate = true, $null_values = false)
    {
        /** @var PaymentModule $payment_module */
        $payment_module = Module::getInstanceByName($this->module);
        $customer = new Customer($this->id_customer);
        $payment_module->validateOrder($this->id_cart, Configuration::get('PS_OS_WS_PAYMENT'), $this->total_paid, $this->payment, null, array(), null, false, $customer->secure_key);
        $this->id = $payment_module->currentOrder;
        return true;
    }

in order class...

 

this method sets the state of the order to Configuration::get('PS_OS_WS_PAYMENT') that is 12 (remote payment accepted or something like that) by default... is that for security reasons?

why this method does not read the current_state from xml ws???

 

i had to write an override for this method using custom states based on payment module.

 

thanx

Edited by ziostanko (see edit history)
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...