Gateway initialization example
            //The first step is bootstrapping the gateway sistem.
            RedsysGatewayBootstrapper.Register(RouteTable.Routes, "redsys/callback");
            
            const bool test = false;
            const string secret = "qasdfghjkwertyu";
            string callback = "http://mydomain.com/redsys/callback";

            //The second step is creating and populating our commerce data.
            Commerce commerce = new Commerce(); // New instance
            commerce.MerchantCode = 329312268; //Our commerce merchant code
            commerce.Terminal = 1; //Our commerce Terminal
            commerce.Secret = secret;  //Our commerce Secret code
            commerce.MerchantName = "qlikBar"; //Our commerce Merchant name
            commerce.NotificationUrl = callback; //Our commerce Notification url
            commerce.TestEnviroment = test; //Use test enviroment? true // false

            /* Recursive transactions repository:
             * The system will use this repository to send to Redsys successive
             * transaction requests base on witch recurring transactions needs to be charged. */
            commerce.RecurringTransactions = ServiceLocator.Current.GetInstance<IRecurringTransactionRepository>();

            /* Successive transactions repository:
             * The system will use this repository to find wich recurring
             * transactions needs to be charged.
             * Additionally, the system will create and save a new successive
             * transaction automatically when a charge notification is received. */
            commerce.SuccessiveTransactions =    ServiceLocator.Current.GetInstance<ISuccessiveTransactionRepository>();

            /* This is the event than will automatically fire when Redsys send us a notification.
             * We will see an example later. */
            commerce.OnNotificationReceived += redsysNotification => ServiceLocator.Current.GetInstance<RedsysService>()
                                                                                   .OnNotificationReceived(redsysNotification);
            //Last step is registering our commerce in the commerce manager
            CommerceManager.Register(commerce);

Last edited Nov 6, 2013 at 12:59 PM by zerosofadown, version 4