public SimplifyPaymentProcessor( SimplifyPaymentSettings simplifyPaymentSettings, ISettingService settingService, IPaymentService paymentService, IStoreContext storeContext, ICurrencyService currencyService, CurrencySettings currencySettings, IOrderService orderService, ILocalizationService localizationService, IEncryptionService encryptionService, ILogger logger ) { this._simplifyPaymentSettings = simplifyPaymentSettings; this._settingService = settingService; this._paymentService = paymentService; this._storeContext = storeContext; this._currencyService = currencyService; this._currencySettings = currencySettings; this._orderService = orderService; this._localizationService = localizationService; this._encryptionService = encryptionService; this._logger = logger; this._paymentsApi = new PaymentsApi(); }
/// <summary> /// Install plugin /// </summary> public override void Install() { _logger.Information("Installing Simplify Commerce payment plugin"); // Default settings var settings = new SimplifyPaymentSettings() { HostedMode = true, LiveMode = true, SandboxPublicKey = "", SandboxPrivateKey = "", LivePublicKey = "", LivePrivateKey = "", DebugEnabled = false }; _settingService.SaveSetting(settings); // Locales this.AddOrUpdatePluginLocaleResource("Plugins.Payments.Simplify.Notes", "Simplify Commerce payment processing. Sign up for an account at <a href=\"http://www.simplify.com\" target=\"_blank\">www.simplify.com</a>"); this.AddOrUpdatePluginLocaleResource("Plugins.Payments.Simplify.RedirectionTip", "You will be redirected to Simplify Commerce site to complete the order."); this.AddOrUpdatePluginLocaleResource("Plugins.Payments.Simplify.Fields.HostedMode", "Enable Hosted Mode"); this.AddOrUpdatePluginLocaleResource("Plugins.Payments.Simplify.Fields.HostedMode.Hint", "In hosted mode, securely accept payment on a form hosted by Simplify Commerce. Customer card details are not sent to your site. You must use a hosted payment sandbox or live API key which can be obtained by logging into Simplify Commerce (http://www.simplify.com)."); this.AddOrUpdatePluginLocaleResource("Plugins.Payments.Simplify.Fields.LiveMode", "Enable Live Mode"); this.AddOrUpdatePluginLocaleResource("Plugins.Payments.Simplify.Fields.LiveMode.Hint", "In live mode your live API keys are used to make real payments. Otherwise your sandbox API keys are used to make test payments."); this.AddOrUpdatePluginLocaleResource("Plugins.Payments.Simplify.Fields.SandboxPublicKey", "Sandbox Public Key"); this.AddOrUpdatePluginLocaleResource("Plugins.Payments.Simplify.Fields.SandboxPublicKey.Hint", "Your Simplify Commerce public sandbox API key"); this.AddOrUpdatePluginLocaleResource("Plugins.Payments.Simplify.Fields.SandboxPrivateKey", "Sandbox Private Key"); this.AddOrUpdatePluginLocaleResource("Plugins.Payments.Simplify.Fields.SandboxPrivateKey.Hint", "Your Simplify Commerce private sandbox private API key"); this.AddOrUpdatePluginLocaleResource("Plugins.Payments.Simplify.Fields.LivePublicKey", "Live Public Key"); this.AddOrUpdatePluginLocaleResource("Plugins.Payments.Simplify.Fields.LivePublicKey.Hint", "Your Simplify Commerce public live API key"); this.AddOrUpdatePluginLocaleResource("Plugins.Payments.Simplify.Fields.LivePrivateKey", "Live Private Key"); this.AddOrUpdatePluginLocaleResource("Plugins.Payments.Simplify.Fields.LivePrivateKey.Hint", "Your Simplify Commerce private live private API key"); this.AddOrUpdatePluginLocaleResource("Plugins.Payments.Simplify.Fields.DebugEnabled", "Enable Debug Mode"); this.AddOrUpdatePluginLocaleResource("Plugins.Payments.Simplify.Fields.DebugEnabled.Hint", "Enables debug logging for this plugin"); this.AddOrUpdatePluginLocaleResource("Plugins.Payments.Simplify.Payment.CardNumber", "Card Number"); this.AddOrUpdatePluginLocaleResource("Plugins.Payments.Simplify.Payment.CardNumber.Hint", "The card number on the front or back of the card."); this.AddOrUpdatePluginLocaleResource("Plugins.Payments.Simplify.Payment.CardExpiry", "Expiry Date"); this.AddOrUpdatePluginLocaleResource("Plugins.Payments.Simplify.Payment.CardExpiry.Hint", "The expiration date on the front of the card. Month and Year."); this.AddOrUpdatePluginLocaleResource("Plugins.Payments.Simplify.Payment.CardSecurityCode", "Security Code"); this.AddOrUpdatePluginLocaleResource("Plugins.Payments.Simplify.Payment.CardSecurityCode.Hint", "The card security code. Usually 3-4 digits printed on the front of the card on on the signature strip on the back."); this.AddOrUpdatePluginLocaleResource("Plugins.Payments.Simplify.Payment.Description", "{0} order {1}"); this.AddOrUpdatePluginLocaleResource("Plugins.Payments.Simplify.Payment.Exception", "Unable to process payment - an error has occured"); this.AddOrUpdatePluginLocaleResource("Plugins.Payments.Simplify.Refund.Reason", "Refund from {0}"); this.AddOrUpdatePluginLocaleResource("Plugins.Payments.Simplify.Refund.Exception", "Unable to process refund - an error has occured"); this.AddOrUpdatePluginLocaleResource("Plugins.Payments.Simplify.Payment.Error.Currency", "Currency {0} is not supported."); this.AddOrUpdatePluginLocaleResource("Plugins.Payments.Simplify.Payment.Error.Token", "Unable to process payment - no card token generated."); this.AddOrUpdatePluginLocaleResource("Plugins.Payments.Simplify.Payment.Error.Store", "Unable to process payment - store is not the current context."); this.AddOrUpdatePluginLocaleResource("Plugins.Payments.Simplify.Payment.Declined", "Payment declined"); base.Install(); }