public DifiCertificateValidator(Mode mode) { this.mode = mode; try { var file = new FileInfo(mode.GetValue("security.pki")); this.validator = ValidatorLoader.NewInstance().Build(file); } catch (ValidatorParsingException e) { throw new PeppolLoadingException("Unable to initiate PKI.", e); } }
/// <summary> /// Creates the base request. Prepares a request of a type that inherits from /// <see cref="AbstractRequest" /> class. /// Sets Language, Merchant (ApiKey y ApiLogin) and Url's. /// </summary> /// <typeparam name="T">Classes that inherit from AbstractRequest.</typeparam> /// <param name="serverType">Type of the server.</param> /// <returns> /// Instance of a type T /// </returns> protected virtual T CreateBaseRequest <T>(ServerType serverType) where T : AbstractRequest { T request = Activator.CreateInstance <T>(); request.Language = PayU.Language; request.Merchant = new Merchant() { Id = PayU.MerchantId, ApiKey = PayU.ApiKey, ApiLogin = PayU.ApiLogin }; request.Url = Enviroment.GetUrl(serverType); request.IsTest = PayU.IsTest; ValidatorLoader.Load(); this.CreateCulture(request); return(request); }