/// <summary> /// Initializes a new instance of the <see cref="MarketingApiController"/> class. /// </summary> /// <param name="merchelloContext"> /// The merchello context. /// </param> public MarketingApiController(IMerchelloContext merchelloContext) : base(merchelloContext) { _offerSettingsService = merchelloContext.Services.OfferSettingsService; this._providerResolver = OfferProviderResolver.Current; this._componentResolver = OfferComponentResolver.Current; }
/// <summary> /// The initialize. /// </summary> /// <exception cref="Exception"> /// Throws an exception if the offer component resolver has not been instantiated /// </exception> private void Initialize() { if (!OfferComponentResolver.HasCurrent) { throw new Exception("OfferComponentResolver has not been instantiated."); } _componentResolver = OfferComponentResolver.Current; if (!OfferProcessorFactory.HasCurrent) { throw new Exception("OfferProcessorFactory has not been instantiated"); } this._offerProcessorFactory = OfferProcessorFactory.Current; // wire up the offer processor _offerProcessor = new Lazy <IOfferProcessor>(() => _offerProcessorFactory.Build(this)); }