-
Notifications
You must be signed in to change notification settings - Fork 7
Services architecture
The Stall framework consists of many parts, and one of them is its "Services".
Those services are used by the controllers, and can be overriden to customize their behavior by using the stall:service generator. e.g. rails g stall:service cart_payment_validation.
They also can be used in your own controllers or from the rails console when needed.
The services are the following :
- Add to cart
- Cart update
- Shipping fee calculator
- Payment notification
- Cart payment validation
- Product list staleness handling
- Shipping notification
- Credit usage
- Cart credit note creation
It's used by the LineItems controller to add a given sellable to the cart with the provided quantity.
It's used to handle the async cart update form and update quantities, delete appropriate line items, handle shipping fee and discounts calculation etc.
It calculates the shipping fee to apply to a given cart depending on the chosen shipping method
It handles gateways' payment notification by finding the appropriate gateway class to handle the response.
If the notification is valid and the payment is successful, it calls the Cart payment validation service to proceed to the cart's payment.
It handles cart payment and e-mail notifications that must be sent to the customers and admins when a cart is paid.
It is called on every cart loading and updating of the cart while it is not paid. It works as a hook that allows you to handle posible product prices changes, discount codes staleness and other updates.
It is called in the admin panel when you send a shipping notification.
It can be overriden to add more fields to the shipping notification modal.
It can also be used to automate shipping notifications in your system.
It allows to use a customer's credit notes in a cart.
It allows to create credit notes from a cart that have a negative total price.