Pricing Table
Where pricing table is used? 1 powr.io/pricing 2 powr.io/plugins/form-builder/standalone? => any plugin for users that do not have BUSINESS subscription 3 powr.io/tutorials => any plugin 4 in emails => accessed by subscription_discount_helper.rb (not a great name, but it was so forever)
Pricing table back end: all data collected from subscription_discount_helper.rb
Pricing Front End: 1 features_table_ajax.html.haml => html skeleton of Pricing table 2 payment_accordion.html.haml => html skeleton for checkout 3 static.js => show price, change price depending on changes of period and plan, rendering checkout, making ajax calls to backend to make PayPal/braintree charges.
Price changes on clicking SELECT PLAN => $(‘.upgradeButton’) => static.js 487 Backend data is attached to .pricingTablev2.row{'data-price-metrics'=>"#{@pricing_table.to_json}"} => this happens on features_table_ajax.html.haml
REQUIRED functions on PRICING TABLE VIEW (features_table_ajax.html.haml): 1 clicks on app_type => should render price for selected app 2 clicks on period => "MONTHLY", "YEARLY" (selected), "BIENNIALLY" 3 clicks on SELECT PLAN (when user select PREMIUM/PRO/BUSINESS), that will render checkout view
PRICING TABLE should have following info: 1 PLAN name 2 plan description 3 saving amount 4 monthly payment: calc in static.js: $('#powrPay .plan.' + plan + ' .plan__price .paymentPrice').html(
priceAsString(final_price)
);
where final_price =
pricing_data[plan][frequency + '_monthly_final_price'] / 100;
where pricing_data = $('#powrPay .pricingTablev2').data('price-metrics'); 5 SELECT PLAN button which on click will render checkout view, depending on selected plan and frequency (monthly/yearly/2yr) 6 CANCEL ANYTIME notification 7 features table, which is rendered in features_table_ajax.html.haml
CHECKOUT (payment_accordion.html.haml): Checkout is rendered by features_table_ajax.html.haml, it will be hidden until static.js calls it with $(document).on('click', '.upgradeButton', function(){})
REQUIRED functions on CHECKOUT: 1 payment with new Credit Card 2 payment with saved Credit Card 3 payment with PAYPAL 4 GO BACK button, which should take user back to
Checkout should have following data: 1 Monthly price 2 if user chose YEARLY/BIENNIAL payments then monthly price multiplied by 12 or 24 accordingly 3 available discounts 4 available credits 5 total price ^^ all this data is pulled from pricing_data and rendered by static.js
@pricing_table has price for plans (premium, pro, business) and by period (monthly, yearly, biennially) 
 @pricing_table looks like this (all price are in hundreds, needs to be divided by 100 on front end): {"optional": {"available_credit_amount":0}, "premium": {"monthly_original_price":899, "monthly_discount_name":null, "monthly_discount_amount":0, "monthly_cheapest_price":719.1999999999999, "monthly_discount_price":0, "monthly_used_credit_amount":0, "monthly_monthly_final_price":899, "monthly_total_price":899, "monthly_total_price_with_credit":899, "monthly_total_summary":"$8.99/mo", "monthly_saved_amount":0, "yearly_original_price":10788, "yearly_discount_name":"40% off all yearly subscriptions", "yearly_discount_amount":40, "yearly_discount_price":359.6, "yearly_monthly_final_price":539.4, "yearly_total_price_with_credit":6472.799999999999, "yearly_total_price":6472.799999999999, "yearly_total_summary":"$64.72/yr for the first year, then $107.88/yr", "yearly_saved_amount":4315.200000000001, "yearly_10_discount":9709.2, "biennially_original_price":21576, "biennially_discount_name":null, "biennially_discount_amount":0, "biennially_discount_price":179.8, "biennially_monthly_final_price":719.2, "biennially_total_price_with_credit":17260.800000000003, "biennially_total_price":17260.800000000003, "biennially_total_summary":"$172.60/2yr", "biennially_saved_amount":4315.199999999997, "biennially_20_discount":17260.8}, "pro": {"monthly_original_price":1599, "monthly_discount_name":null, "monthly_discount_amount":0, "monthly_used_credit_amount":0, "monthly_cheapest_price":1279.2, "monthly_discount_price":0, "monthly_monthly_final_price":1599, "monthly_total_price_with_credit":1599, "monthly_total_price":1599, "monthly_total_summary":"$15.99/mo", "monthly_saved_amount":0, "yearly_original_price":19188, "yearly_discount_name":"40% off all yearly subscriptions", "yearly_discount_amount":40, "yearly_discount_price":639.6, "yearly_monthly_final_price":959.4, "yearly_total_price_with_credit":11512.8, "yearly_total_price":11512.8, "yearly_total_summary":"$115.12/yr for the first year, then $191.88/yr", "yearly_saved_amount":7675.200000000001, "yearly_10_discount":17269.2, "biennially_original_price":38376, "biennially_discount_name":null, "biennially_discount_amount":0, "biennially_discount_price":319.8, "biennially_monthly_final_price":1279.2, "biennially_total_price_with_credit":30700.800000000003, "biennially_total_price":30700.800000000003, "biennially_total_summary":"$307.00/2yr", "biennially_saved_amount":7675.199999999997, "biennially_20_discount":30700.8}, "enterprise": {"monthly_original_price":4999, "monthly_discount_name":null, "monthly_discount_amount":0, "monthly_used_credit_amount":0, "monthly_cheapest_price":3999.2, "monthly_discount_price":0, "monthly_monthly_final_price":4999, "monthly_total_price_with_credit":4999, "monthly_total_price":4999, "monthly_total_summary":"$49.99/mo", "monthly_saved_amount":0, "yearly_original_price":59988, "yearly_discount_name":"40% off all yearly subscriptions", "yearly_discount_amount":40, "yearly_discount_price":1999.6000000000001, "yearly_monthly_final_price":2999.4, "yearly_total_price_with_credit":35992.8, "yearly_total_price":35992.8, "yearly_total_summary":"$359.92/yr for the first year, then $599.88/yr", "yearly_saved_amount":23995.199999999997, "yearly_10_discount":53989.2, "biennially_original_price":119976, "biennially_discount_name":null, "biennially_discount_amount":0, "biennially_discount_price":999.8000000000001, "biennially_monthly_final_price":3999.2, "biennially_total_price_with_credit":95980.79999999999, "biennially_total_price":95980.79999999999, "biennially_total_summary":"$959.80/2yr", "biennially_saved_amount":23995.20000000001, "biennially_20_discount":95980.8}}