public void Can_not_activate_activated_paymentGatewaySettings()
        {
            // Arrange
            var repositorySettings = new PaymentGatewaySettings {
                Id = new Guid("50797305-5320-4086-BA1C-9D062DDF53D9"), Status = Status.Active
            };

            _paymentRepository.PaymentGatewaySettings.Add(repositorySettings);

            // Act
            var response = _commands.ValidateThatPaymentGatewaySettingsCanBeActivated(new ActivatePaymentGatewaySettingsData
            {
                Id      = repositorySettings.Id,
                Remarks = "remark"
            });

            //Assert
            response.IsValid.Should().BeFalse();
            response.Errors.FirstOrDefault().ErrorMessage.Should().Be(PaymentGatewaySettingsErrors.AlreadyActive.ToString());
        }
예제 #2
0
        public ActivatePaymentGatewaySettingsResponse Activate(ActivatePaymentGatewaySettingsRequest request)
        {
            VerifyPermission(Permissions.Activate, Modules.PaymentGatewaySettings);

            var model = Mapper.DynamicMap <Core.Payment.Interface.Data.Commands.ActivatePaymentGatewaySettingsData>(request);

            var validatResult = _paymentGatewaySettingsCommands.ValidateThatPaymentGatewaySettingsCanBeActivated(model);

            if (false == validatResult.IsValid)
            {
                return(ValidationErrorResponse <ActivatePaymentGatewaySettingsResponse>(validatResult));
            }

            var setting = _paymentGatewaySettingsQueries.GetPaymentGatewaySettingsById(request.Id);

            CheckBrand(setting.BrandId);

            _paymentGatewaySettingsCommands.Activate(model);
            return(new ActivatePaymentGatewaySettingsResponse
            {
                Success = true
            });
        }