Skip to content

Instantly share code, notes, and snippets.

@timstephenson
Last active December 17, 2015 13:19
Show Gist options
  • Save timstephenson/5616559 to your computer and use it in GitHub Desktop.
Save timstephenson/5616559 to your computer and use it in GitHub Desktop.
DVR Offer Something like this might work... I had already put a little thought into it, I hope you don't mind.
runDealRules: function(){
this.freeDVRForExistingCustomers();
this.kmaBoxPricing();
this.showPaqueBundlesIfQualified();
this.txKMABundlesSwap();
this.freeDVRForDirectSalesExludingTX();
},
// If the environment is direct sales and there is no tx offer,
// Add the free DVR offer.
freeDVRForDirectSalesExludingTX: function() {
var environment = bb.config.get('bundle_builder_name'),
indicators = bb.localization.get('indicators'),
getsTxOffer = _.contains(indicators, "TX_OFFERS");
if ( environment === 'direct_sales' && !getsTxOffer ) {
this.setFreeDVRService();
}
},
freeDVRForExistingCustomers: function() {
var environment = bb.config.get('bundle_builder_name'),
isExistingCustomer = bb.localization.get('isExistingCustomer'),
doesNotHaveExistingCableService = (bb.localization.get('customerHasTVService') === false);
if (environment === 'spanish' &&
isExistingCustomer &&
doesNotHaveExistingCableService) {
// Reset DVR Service choice ID
this.setFreeDVRService();
}
},
setFreeDVRService: function(){
// Reset DVR Service choice ID
_.each(bb.config.get('bundles').models, function(bundle) {
var dvr;
try {
dvr = bundle.get('products').byID('14');
dvr.set('charter_choice_id', 2055333);
dvr.set('price', '0.00');
console.log(dvr);
}
catch(e){
console.log('includedProducts',e.message);
}
});
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment