Hi,
I'm not sure what you mean by each point in
Order demand
Payment
Payment and Order insertion on database
Order creation
Notification
I'm actually not even sure of what you mean by "the major steps to records a purchase on my system".
Because, to record an order in HikaShop, all you need is to call the save function of class.order with the necessary $order object properly formatted as it is done in the createFromCart function in class.order.
HikaShop will then handle the rest for you.
Now regarding the general workflow when an order is created at the end of the checkout, here is how it goes:
- the customer clicks on the "finish" button of the checkout
- the checkout system checks that everything has been properly entered/selected in the checkout
- it loads the cart and converts it into an order object
- the order creation process starts
- plugins are called with the onBeforeOrderCreate trigger
- if there was a credit card form on the checkout, the payment plugin will usually do the payment at that point and if the payment fails, it will cancel the order creation. If it succeeds, it ill usually change the status of the order to confirmed
- the order is added in the database
- the stock is updated for each order
- plugins are called with the onAfterOrderCreate trigger
- the order creation notification email is sent
- the onAfterOrderConfirm trigger of the selected payment plugin is called
- the plugin usually returns a redirect HTML form so that HikaShop displays it to the customer to be redirected to the payment gateway
- the customer fill his credit card information on the payment gateway
- the payment gateway sends a notification to the onPaymentNotification trigger of the payment plugin so that it can change the status of the order to confirmed and HikaShop will then send the order status notification email to the customer.
- the customer is redirected back to the website with the thank you page.