public override void OnActionExecuting(ActionExecutingContext context) { var mid = context.HttpContext.Request.Headers["MerchantId"]; var mkey = context.HttpContext.Request.Headers["MerchantKey"]; _merchantFinder = (IMerchantFinder)context.HttpContext.RequestServices.GetService(typeof(IMerchantFinder)); if (!Guid.TryParse(mid, out var merchantId)) { context.Result = new UnauthorizedResult(); } var merchant = _merchantFinder.FindByIdAsync(merchantId).Result; if (merchant == null || !merchant.Key.Equals(mkey)) { context.Result = new UnauthorizedResult(); } base.OnActionExecuting(context); }
public MerchantConfigurationAcquirerFinder(IMerchantFinder merchantFinder) { MerchantFinder = merchantFinder ?? throw new ArgumentNullException(nameof(merchantFinder)); }