Jump to content

Recommended Posts

Hi guys,

It's been almost two days since I try to figure it out the best way I can...

 

Here is what what i'm doing:

 

IonicApp - using POST method with the following:

 

this.cart = {
  order_id: orderID,
  allow_seperated_package: 0,
  associations: {cart_rows: {element[spam-filter],
  id_address_delivery: 2070,
  id_address_invoice: 2070,
  id_carrier: 0,
  id_currency: 3,
  id_customer: this.userProvider.user.id,
  id_guest: 0,
  id_lang: 3,
  id_shop: 1,
  id_shop_group: 1,
}

[app-scripts] [12:07:09]  console.log: ---- RESPONSE: 
[app-scripts]             {"_body":"{\"cart\":{\"id\":\"18382\",\"id_address_delivery\":\"2070\",\"id_address_invoice\":\"2070\",\"id_currency\":\"3\",\"id_customer\":\"1808\",\"id_guest\":\"0\",\"id_lang\":\"3\",\"id_shop_group\":\"1\",\"id_shop\":\"1\",\"id_carrier\":\"0\",\"recyclable\":null,\"gift\":null,\"gift_message\":null,\"mobile_theme\":null,\"delivery_option\":null,\"secure_key\":null,\"allow_seperated_package\":\"0\",\"date_add\":\"2018-10-18
[app-scripts]             12:07:09\",\"date_upd\":\"2018-10-18 
[app-scripts]             12:07:09\",\"associations\":{\"cart_rows\":[{\"id_product\":\"174\",\"id_product_attribute\":\"1327\",\"id_address_delivery\":\"0\",\"quantity\":\"1\"}][spam-filter]}","status":201,"ok":true,"statusText":"Created","headers":{"date":["Thu","
[app-scripts]             18 Oct 2018 09:07:09 
[app-scripts]             GMT"] 

 

I get the CART ID as soon as I add it to the cart in this case the ID of the cart is 18382

 

this.order = {
  id_cart: responseData.cart.id,
  id_address_delivery: (formValues.deliveryType == 76 ? formValues.deliveryAddresses : 0),
  id_address_invoice: 0,
  id_carrier: 0,
  id_currency: 3,
  id_customer: this.userProvider.user.id,
  id_guest: 0,
  id_lang: 3,
  id_shop: 1,
  id_shop_group: 1,
  valid: 1,
  current_state: 3,
  module: 'cashondelivery',
  payment: 'Numerar',
  total_paid: Math.round(this.totalCart  * 100) / 100,
  total_paid_real: Math.round(this.totalCart * 100) / 100,
  total_products: this.totalItems,
  total_products_wt: 0,
  conversion_rate: 0,
};

 

this is the output XML:

 

[app-scripts] [12:07:09]  console.log: --- orderObject <root> <orders> <id_cart>18382</id_cart> 
[app-scripts]             <id_address_delivery>2468</id_address_delivery> <id_address_invoice>0</id_address_invoice> 
[app-scripts]             <id_carrier>0</id_carrier> <id_currency>3</id_currency> <id_customer>1808</id_customer> 
[app-scripts]             <id_guest>0</id_guest> <id_lang>3</id_lang> <id_shop>1</id_shop> <id_shop_group>1</id_shop_group> 
[app-scripts]             <valid>1</valid> <current_state>3</current_state> <module>cashondelivery</module> <payment>Numerar</payment> 
[app-scripts]             <total_paid>84</total_paid> <total_paid_real>84</total_paid_real> <total_products>1</total_products> 
[app-scripts]             <total_products_wt>0</total_products_wt> <conversion_rate>0</conversion_rate> </orders> </root> 
 

 

and this is the error:

 

[app-scripts] [12:07:09]  console.log: ---- RESPONSE: {"_body":"\nFatal error: Uncaught PrestaShopException: Can't save Order in 
[app-scripts]             /var/www/origini.com.ro/live/classes/PaymentModule.php:350\nStack trace:\n#0 
[app-scripts]             /var/www/origini.com.ro/live/classes/order/Order.php(1572): PaymentModuleCore->validateOrder('18382', '12', 
[app-scripts]             84, 'Numerar', NULL, Array, NULL, false, '')\n#1 
[app-scripts]             /var/www/origini.com.ro/live/classes/webservice/WebserviceRequest.php(1478): OrderCore->addWs()\n#2 
[app-scripts]             /var/www/origini.com.ro/live/classes/webservice/WebserviceRequest.php(1292): 
[app-scripts]             WebserviceRequestCore->saveEntityFromXml(201)\n#3 
[app-scripts]             /var/www/origini.com.ro/live/classes/webservice/WebserviceRequest.php(518): 
[app-scripts]             WebserviceRequestCore->executeEntityPost()\n#4 /var/www/origini.com.ro/live/webservice/dispatcher.php(87): 
[app-scripts]             WebserviceRequestCore->fetch('72APUNKDX6C29TX...', 'POST', 'orders', Array, false, '<root>\\n <ord...')\n#5 
[app-scripts]             {main}\n thrown in /var/www/origini.com.ro/live/classes/PaymentModule.php on line 
[app-scripts]             350\n","status":200,"ok":true,"statusText":"OK","headers":{"date":["Thu"," 18 Oct 2018 09:07:09 
[app-scripts]             GMT"],"content-encoding":["gzip"],"server":["nginx"],"x-powered-by":["PHP/7.0.28-0ubuntu0.16.04.1"],"vary":["Accept-Encoding"],"content-type":["text/html;
[app-scripts]             charset=utf-8"],"transfer-encoding":["chunked"],"connection":["keep-alive"],"keep-alive":["timeout=20"]}

 

Any help or hints here please?

 

Thank you,

Razvan

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...