2022-01-10 Pricing Flow: Difference between revisions

From Izara Wiki
Jump to navigation Jump to search
(Created page with "Service Stack - Products = Filtered List of Sell Offers = * eg: from Browse Catalog == Sorted SearchResult: sellOffer == * Final result expected is a list of Sell Offe...")
 
No edit summary
Line 49: Line 49:
== SellOfferManager - FindSellOfferFilterComplete ==
== SellOfferManager - FindSellOfferFilterComplete ==


* receives complexFilterComplete message for sellOffer level complexFilter that lists all unique sellOffers that have planDeliveryPaymentCombination (any combination of given paymentMethodIds/deliveryMethodIds)
* receives complexFilterComplete message for sellOffer level complexFilter that lists all unique sellOffers that have planDeliveryPaymentCombination (any combination of given paymentMethodIds/deliveryMethodIds), initiated in Logical aggregatedSellOfferPrices
* for each logicalResultMain found, send request to CreatePerSellOfferSortedPriceRequests
* for each logicalResultMain found, send request to CreatePerSellOfferSortedPriceRequests


Line 62: Line 62:
* once sellOfferQuantityLocationIdCombinations completes per sellOfferId triggers CreateOrderPriceCombinations (set callingFlow = this service's CreateOrderPriceCombinations)
* once sellOfferQuantityLocationIdCombinations completes per sellOfferId triggers CreateOrderPriceCombinations (set callingFlow = this service's CreateOrderPriceCombinations)


== Logical: SellOfferManager - orderPrice - sellOfferQuantityLocationIdCombinations ==
* passes on to planDeliveryPaymentCombination complexFilter, finding all combinations for only the requested sellOfferId
* will use the same results as aggregatedSellOfferPrices for the planDeliveryPaymentCombination logicalTag
* once planDeliveryPaymentCombination complexFilter complete triggers SellOfferManager - CreateOrderPriceCombinations
== SellOfferManager - CreateOrderPriceCombinations ==
* find all logicalResultMains (ie: sellOfferId+orderQuantity+deliverToLocationIds+deliveryMethodIds+paymentMethodIds+excludeEmpty request) that are waiting for this sellOfferId+planDeliveryPaymentCombination filter
* for each logicalResultMain's planDeliveryPaymentCombination, iterate the logicalResultMain's deliverToLocationIds to create orderPriceId
* make sure an orderPrice record exists for the calculated orderPriceId
* this will result in multiple orderPriceIds being created/checked exist for one logicalResultMain
* complete each sellOfferQuantityLocationIdCombinations logicalResultMain
* for each logicalResultMain found, the logical complete message will trigger FindData for orderPrice - "price" field (original request created in createPerSellOfferSortedPriceRequests)
== FindData: SellOfferManager - orderPrice - price ==
* orderPrice record should always exist when entering here, eg created by CreateOrderPriceCombinations
* finds the sellOffer subtotal for the orderPrice (not delivery/payment method costs yet) and saves into orderPrice record
* passes on to a sorted searchResult request for sellOfferPlanDeliveryMethodLink with fixed dataIds being a list of deliveryMethodLinkIds (no complexFilter), sorted by price (minDeliveryPrice)
* require minimum DeliveryPrice because there might be multiple locationIds found and we want to use the lowest priced one
* searchResult requiredData is "minDeliveryPrice", which is required for the sorting
* once we have the sorted results we actually want the maximum of the (minDeliveryPrice) results, because there might be multiple deliveryMethodLinkIds found in the given sellOfferQuantities, and we want to return the highest priced one
* once sellOfferPlanDeliveryMethodLink sorted searchResult completes triggers ProcessFindDataSortedRequest (set callingFlow = this service's ProcessFindDataSortedRequest)
== ProcessFindDataSortedRequest: SellOfferManager - orderPrice - price - sellOfferPlanDeliveryMethodLink ==
* saves into orderPrice record: deliveryPrice and sellOfferPlanDeliveryMethodLinkId
* passes on to a sorted searchResult request for sellOfferPlanUserPaymentMethodLink with fixed dataIds being a list of userPaymentMethodLinkIds (no complexFilter), sorted by price (paymentPrice)
* searchResult requiredData is "paymentPrice", which is required for the sorting
* once we have the sorted results we actually want the maximum of the (paymentPrice) results, because there might be multiple userPaymentMethodLinkIds found in the given sellOfferQuantities, and we want to return the highest priced one
* once sellOfferPlanUserPaymentMethodLink sorted searchResult completes triggers ProcessFindDataSortedRequest (set callingFlow = this service's ProcessFindDataSortedRequest)
== ProcessFindDataSortedRequest: SellOfferManager - orderPrice - price - sellOfferPlanUserPaymentMethodLink ==
* saves into orderPrice record: paymentPrice and sellOfferPlanUserPaymentMethodLinkId
* calculates final orderPrice value
* completes the "orderPrice - price" FindData record, this is where one orderPrice is completed
* FindData records are from the sellOfferQuantityLocationIdCombinations searchResult requests, initiated in CreatePerSellOfferSortedPriceRequests
* each CreatePerSellOfferSortedPriceRequests triggers AwaitingMultipleSteps link in





Revision as of 10:36, 10 January 2022

Service Stack - Products

Filtered List of Sell Offers

  • eg: from Browse Catalog

Sorted SearchResult: sellOffer

  • Final result expected is a list of Sell Offer Ids and their pricing (eg min or max), along with any other fields wanted
  • Original request is sent to SellOffer Search Result service which uses SellOfferManager service to process Logicals and FindData
  • Request might originate higher up, eg Product/VariantProduct level, for pricing the SellOffer level is the important start point
  • sellOffer searchType / sellOffer filterType
  • sellOffer types can have fields maxPrice/minPrice
  • has child searchResult/complexFilter type orderPrice
  • use translateIds to find matching sellOfferIds from orderPrice complexFilter
  • use searchResult/findData's child id structure to copy aggregated price up from orderPrice level to sellOffer level
  • so entry point into pricing flow is begun by orderPrice level filter/requiredData
  • orderPrice level does not need to be sorted, can be a standard searchResult, but sellOffer level could layer sorting on top of the orderPrice searchResult data according to it's needs

SearchResult: orderPrice

Logical: SellOfferManager - orderPrice - maxPrice / minPrice

  • passes on to a sorted searchResult request for orderPrice that has logicalTag = aggregatedSellOfferPrices, sorted by price (ascending)
  • requires sorted aggregatedSellOfferPrices so can perform it's comparison
  • searchResult requiredData is "price" and "status", these will invoke FindData after aggregatedSellOfferPrices complexFilter complete
  • once aggregatedSellOfferPrices completes triggers ProcessLogicalSortedRequest (set callingFlow = this service's ProcessLogicalSortedRequest), which will trigger SortResult's CopyDataToExternalTable lambda
  • CopyDataToExternalTable will copy records to SellOfferManager's LogicalResults table
  • SellOfferManager's CompleteLogicalSortedRequest lambda subscribes to sortResult's CopyDataToExternalTableComplete topic, and completes the Logical request

Logical: SellOfferManager - orderPrice - aggregatedSellOfferPrices

  • passes on to sellOffer complexFilter with child complexFilter type planDeliveryPaymentCombination
  • we add this step to reduce the number of sellOfferIds that we dig prices combinations for, to only sellOfferIds that have a plan that points to given paymentMethodIds/deliveryMethodIds
  • complexFilter will find all unique sellOfferIds that offer requested delivery and payment methods
  • sellOffer complexFilter passes down to planDeliveryPaymentCombination filterType handled by SellOfferPlan service
  • sellOffer complexFilter will trigger FindSellOfferFilterComplete lambda (callingFlow = this service's FindSellOfferFilterComplete)

Logical: SellOfferPlan - planDeliveryPaymentCombination - planDeliveryPaymentCombination

  • invokes sellOfferPlan's FindPlanDeliveryPaymentCombinations lambda

sellOfferPlan - FindPlanDeliveryPaymentCombinations

  • queries graph for all sellOfferPlanId + sellOfferPlanDeliveryMethodLinkId + sellOfferPlanPaymentMethodLinkId combinations that match given paymentMethodIds/deliveryMethodIds
  • saves each combination into it's LogicalResultsData table
  • completes it's logical, which completes the planDeliveryPaymentCombination complexFilter which completes the sellOffer complexFilter, which triggers SellOfferManager's FindSellOfferFilterComplete lambda

SellOfferManager - FindSellOfferFilterComplete

  • receives complexFilterComplete message for sellOffer level complexFilter that lists all unique sellOffers that have planDeliveryPaymentCombination (any combination of given paymentMethodIds/deliveryMethodIds), initiated in Logical aggregatedSellOfferPrices
  • for each logicalResultMain found, send request to CreatePerSellOfferSortedPriceRequests

SellOfferManager - CreatePerSellOfferSortedPriceRequests

  • for one logicalResultMain, iterates all sellOfferIds found in sellOffer-planDeliveryPaymentCombination complexFilter results
  • passes on to a sorted searchResult request for orderPrice that has logicalTag = sellOfferQuantityLocationIdCombinations, sorted by price (ascending)
  • for each sellOfferId we need an ordered list of prices that come from the different deliverToLocationIds/paymentMethodIds/deliveryMethodIds combinations
  • searchResult requiredData is "price", will invoke FindData after sellOfferQuantityLocationIdCombinations complexFilter complete
  • saves each sellOfferQuantityLocationIdCombinations request into AwaitingMultipleStep for this logicalResultId
  • sends searchResult request to SellOfferManager searchResult service
  • once sellOfferQuantityLocationIdCombinations completes per sellOfferId triggers CreateOrderPriceCombinations (set callingFlow = this service's CreateOrderPriceCombinations)

Logical: SellOfferManager - orderPrice - sellOfferQuantityLocationIdCombinations

  • passes on to planDeliveryPaymentCombination complexFilter, finding all combinations for only the requested sellOfferId
  • will use the same results as aggregatedSellOfferPrices for the planDeliveryPaymentCombination logicalTag
  • once planDeliveryPaymentCombination complexFilter complete triggers SellOfferManager - CreateOrderPriceCombinations

SellOfferManager - CreateOrderPriceCombinations

  • find all logicalResultMains (ie: sellOfferId+orderQuantity+deliverToLocationIds+deliveryMethodIds+paymentMethodIds+excludeEmpty request) that are waiting for this sellOfferId+planDeliveryPaymentCombination filter
  • for each logicalResultMain's planDeliveryPaymentCombination, iterate the logicalResultMain's deliverToLocationIds to create orderPriceId
  • make sure an orderPrice record exists for the calculated orderPriceId
  • this will result in multiple orderPriceIds being created/checked exist for one logicalResultMain
  • complete each sellOfferQuantityLocationIdCombinations logicalResultMain
  • for each logicalResultMain found, the logical complete message will trigger FindData for orderPrice - "price" field (original request created in createPerSellOfferSortedPriceRequests)

FindData: SellOfferManager - orderPrice - price

  • orderPrice record should always exist when entering here, eg created by CreateOrderPriceCombinations
  • finds the sellOffer subtotal for the orderPrice (not delivery/payment method costs yet) and saves into orderPrice record
  • passes on to a sorted searchResult request for sellOfferPlanDeliveryMethodLink with fixed dataIds being a list of deliveryMethodLinkIds (no complexFilter), sorted by price (minDeliveryPrice)
  • require minimum DeliveryPrice because there might be multiple locationIds found and we want to use the lowest priced one
  • searchResult requiredData is "minDeliveryPrice", which is required for the sorting
  • once we have the sorted results we actually want the maximum of the (minDeliveryPrice) results, because there might be multiple deliveryMethodLinkIds found in the given sellOfferQuantities, and we want to return the highest priced one
  • once sellOfferPlanDeliveryMethodLink sorted searchResult completes triggers ProcessFindDataSortedRequest (set callingFlow = this service's ProcessFindDataSortedRequest)

ProcessFindDataSortedRequest: SellOfferManager - orderPrice - price - sellOfferPlanDeliveryMethodLink

  • saves into orderPrice record: deliveryPrice and sellOfferPlanDeliveryMethodLinkId
  • passes on to a sorted searchResult request for sellOfferPlanUserPaymentMethodLink with fixed dataIds being a list of userPaymentMethodLinkIds (no complexFilter), sorted by price (paymentPrice)
  • searchResult requiredData is "paymentPrice", which is required for the sorting
  • once we have the sorted results we actually want the maximum of the (paymentPrice) results, because there might be multiple userPaymentMethodLinkIds found in the given sellOfferQuantities, and we want to return the highest priced one
  • once sellOfferPlanUserPaymentMethodLink sorted searchResult completes triggers ProcessFindDataSortedRequest (set callingFlow = this service's ProcessFindDataSortedRequest)

ProcessFindDataSortedRequest: SellOfferManager - orderPrice - price - sellOfferPlanUserPaymentMethodLink

  • saves into orderPrice record: paymentPrice and sellOfferPlanUserPaymentMethodLinkId
  • calculates final orderPrice value
  • completes the "orderPrice - price" FindData record, this is where one orderPrice is completed
  • FindData records are from the sellOfferQuantityLocationIdCombinations searchResult requests, initiated in CreatePerSellOfferSortedPriceRequests
  • each CreatePerSellOfferSortedPriceRequests triggers AwaitingMultipleSteps link in