Sourcing Package
What do we mean by sourcing
Sourcing is about finding the "best" possible location,
where a product or an ordered item should be fulfilled from.
A sourcing logic is therefore also used to allocate your ordered items to the best source locations.
Different things can play a role while figuring out the correct source location(s):
- available stock (or replenished stock)
- cost of delivery (e.g. pick warehouses close to delivery location)
- synergies regarding the complete order
(e.g. source the order from a warehouse where most of the items are available)
- delivery time (if time is more important than cost -
then picking the source location that can deliver the fastest)
...
Typical Use cases in e-commerce
For your shop it is helpful to have access to the Sourcing logic for advanced use cases like:
About this package
Provides Port for Sourcing logic, that can be implemented according to your project needs.
The main Port is the "SourcingService" interface that you can provide a custom adapter and have all possible freedom to design your sourcing logic.
Configurations
commerce:
sourcing:
# use the DefaultSourcingService (default: true)
useDefaultSourcingService: true
DefaultSourcingService
The package also offers a "DefaultSourcingService" that does sourcing based on two inputs:
- The theoretical available or possible sourcelocations for a given delivery
- The available stock for a specific sourcelocations
For this two inputs the DefaultSourcingService offers also Ports where you can provide individual adapters.
Based on this the DefaultSourcingService fetches the possible sourcelocations and will source items based on the available stock on that locations (starting from the first sourcelocation retrieved).
Fake SourcingService
Enabled by adding:
commerce:
sourcing:
fake:
enable: true
When enabled overrides other fake services and user should provide fake data json by
commerce:
sourcing:
fake:
jsonPath: <your_json_path_here>
JSON structure example:
{
"deliveryCodes": {
"inflight": 5
},
"products": {
"0f0asdf-0asd0a9sd-askdlj123rw": 10,
"0f0asdf-0asd0a9sd-askdlj123rx": 15
}
}