News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Create an order based on IPN data

Started by ruudjonk, September 16, 2014, 10:29:18 AM

Previous topic - Next topic

ruudjonk

Hello All,

Does anyone know if/how we can create an order without having anything in session?

Here is what I want to do:
A PSP provides a 'Google wallet' type of system, this system needs to create the order within VM after the transaction is completed. With this we need to keep in mind that the customer not always returns back to the store to transfer his cart to an order, so the order has to be created based on the data that is available within the IPN data.

To do this, the transaction request requires all cart data like products, fees and all other items that can adjust the price.

I looked at the default PayPal plugin (express part) but I can't figure out how it can be done. It would be nice to have something like:

$order = $VmPlugin->createOrder();
$order->setproduct($productObject);
$order->setCustomer($customerObject);
$order->setAddress('Shipping', $shippingAddress);
$order->setAddress('Billing', $billingAddress);
$order->setShipping($methodId);
etc etc.

Hope this is clear and that someone can help me out with this.

Thanks.

ruudjonk

Hey All,

I'm getting somewhere now. I decided to convert the cart to an order with empty customer data because I can't see how to manually create an order without a cart.

So, at this point I created the order and I'm using the VirtueMartModelOrders->UpdateOrderHead($orderid, $orderdata); to set the customer BT, ST, Shippingmethod and Paymentmethod. All works nice if I do it this way, the only thing I need is to recalculate and adjust the order totals based on the new information (paymentmethod_id and shipping_method_id etc).

Does anyone know if VM 2 has a function that I can use to recalculate the order totals?

Thanks,

Ruud