PeacemakerWeb.AdminController (Peacemaker v3.3.5-rc.7) View Source
Link to this section Summary
Functions
Provides support for ForestAdmin to create new classes available for purchase.
Link to this section Functions
Provides support for ForestAdmin to create new classes available for purchase.
This is primarily used for the process of turning a Live-Class into a new On-Demand class that customers are able to purchase.
To ensure that we're working with the freshest sets of data, we perform the following:
Create a new product in Sticky (via Prismic.sync_class)
Ensure that ALL products in Sticky.io are synced with the WealthFit Database. Any products that are deleted through Sticky's dashboard should also be deleted. (via Peacemaker.Product.sync_products)
With the new Product created in Sticky and synced to the WealthFit database, we can then cleanly add the new product to the existing Sticky offer. Perform those syncing prior to updating the Offers is crucial in catching the case where we manually remove a product from the offer's list via Sticky.io's dashboard. Sticky's API requires the end-state of products to be attached to the offer(as opposed to appending them). This makes updating offers through the API a bit cumbersome because we need to ensure that we know exactly which products we want to be set as the offer when we submit the request.
We make a call to Sticky to get a list of all products attached to the Tripwire Offer Id (the primary offer containing all our single-class purchases), and compare them with all Tripwire Products in the WealthFit database to produce the final list of products we want to set into the offer.
Tripwire products are currently determined where their sku contains "TW-INV"