How levhryhoriev/prostor-test works
Prostor_CumDiscount is a Magento 2 module that applies a separate cumulative cart discount to eligible products for signed-in customers. During quote-total collection, it reads website configuration, gets the customer’s 90-day loyalty spend (using a cache before the API), selects a threshold, excludes marked products, and calculates the total. Magento then exposes that total to the cart display. The README documents graceful no-discount behavior on failures. The graph uses sampled collector/client code and README-described caching; unsampled module links are limited to supported roles and paths.
Main entry points: Cumulative.php Cumulative collector · CacheBackedLoyaltySnapshotProvider.php Snapshot provider · LoyaltyHttpClient.php Loyalty HTTP client · LoyaltyConfig.php Loyalty configuration
Components 19
Cart discount
- Cumulative collector
src/app/code/Prostor/CumDiscount/Model/Quote/Address/Total/Cumulative.php - Threshold table
src/app/code/Prostor/CumDiscount/Model/Discount/ThresholdTable.php - Discount calculator
src/app/code/Prostor/CumDiscount/Model/Discount/DiscountCalculator.php
Loyalty spend
- Snapshot provider
src/app/code/Prostor/CumDiscount/Model/Loyalty/CacheBackedLoyaltySnapshotProvider.php - Loyalty cache
src/app/code/Prostor/CumDiscount/Model/Cache/Type.php - Loyalty HTTP client
src/app/code/Prostor/CumDiscount/Model/Loyalty/LoyaltyHttpClient.php - Snapshot parser
src/app/code/Prostor/CumDiscount/Model/Loyalty/LoyaltySnapshotPayloadParser.php
Configuration
- Loyalty configuration
src/app/code/Prostor/CumDiscount/Model/Config/LoyaltyConfig.php - Configuration mapper
src/app/code/Prostor/CumDiscount/Model/Config/LoyaltyConfigurationMapper.php - Admin settings
src/app/code/Prostor/CumDiscount/etc/adminhtml/system.xml
Product eligibility
- Excluded product lookup
src/app/code/Prostor/CumDiscount/Model/Quote/PromoExcludedProductIds.php - Exclusion attribute setup
src/app/code/Prostor/CumDiscount/Setup/Patch/Data/AddPromoExcludedProductAttribute.php
Cart presentation
- Cart total display
src/app/code/Prostor/CumDiscount/view/frontend/web/js/view/cart/totals/cumulative.js - Cart total template
src/app/code/Prostor/CumDiscount/view/frontend/web/template/cart/totals/cumulative.html
Other components
- Signed-in shopper
- Magento quote totals
- Loyalty API
- Magento product catalog
- Local loyalty mock
docker/loyalty-mock/server.php
Connections 20
- Signed-in shopper → Magento quote totals: updates cart
- Magento quote totals → Cumulative collector: collects totals
- Cumulative collector → Loyalty configuration: reads settings
- Cumulative collector → Snapshot provider: requests spend
- Cumulative collector → Excluded product lookup: checks products
- Cumulative collector → Threshold table: selects rate
- Cumulative collector → Discount calculator: calculates discount
- Cumulative collector → Magento quote totals: adds cart total
- Loyalty configuration → Configuration mapper: maps settings
- Admin settings → Loyalty configuration: sets options
- Snapshot provider → Loyalty cache: reads and writes
- Snapshot provider → Loyalty HTTP client: fetches on miss
- Loyalty HTTP client → Snapshot parser: parses response
- Loyalty HTTP client → Loyalty API: requests spend
- Loyalty API → Snapshot provider: returns snapshot
- Local loyalty mock → Loyalty API: serves locally
- Excluded product lookup → Magento product catalog: reads attribute
- Exclusion attribute setup → Magento product catalog: defines attribute
- Magento quote totals → Cart total display: provides total
- Cart total display → Cart total template: renders total