public void Can_get_paymentGatewaySettings()
        {
            // Arrange
            var brand = new AFT.RegoV2.Core.Payment.Data.Brand
            {
                Id         = new Guid("00000000-0000-0000-0000-000000000138"),
                LicenseeId = new Guid("4A557EA9-E6B7-4F1F-AEE5-49E170ADB7E0")
            };
            var repositorySettings = new PaymentGatewaySettings
            {
                Id    = new Guid("50797305-5320-4086-BA1C-9D062DDF53D9"),
                Brand = brand,
                OnlinePaymentMethodName = "Name",
                PaymentGatewayName      = "XXPAY",
                Channel         = 199,
                Remarks         = "Remark",
                EntryPoint      = "http://test.domain.com",
                Status          = Status.Active,
                CreatedBy       = "CreatedBy",
                DateCreated     = DateTime.Now,
                UpdatedBy       = "UpdatedBy",
                DateUpdated     = DateTime.Now,
                ActivatedBy     = "ActivatedBy",
                DateActivated   = DateTime.Now,
                DeactivatedBy   = "DeactivatedBy",
                DateDeactivated = DateTime.Now
            };

            _paymentRepository.PaymentGatewaySettings.Add(repositorySettings);

            // Act
            var data = _queries.GetPaymentGatewaySettingsById(repositorySettings.Id);

            //Assert
            data.Id.Should().Be(repositorySettings.Id);
            data.BrandId.Should().Be(repositorySettings.Brand.Id);
            data.LicenseeId.Should().Be(repositorySettings.Brand.LicenseeId);
            data.OnlinePaymentMethodName.Should().Be(repositorySettings.OnlinePaymentMethodName);
            data.PaymentGatewayName.Should().Be(repositorySettings.PaymentGatewayName);
            data.Channel.Should().Be(repositorySettings.Channel);
            data.Remarks.Should().Be(repositorySettings.Remarks);
            data.EntryPoint.Should().Be(repositorySettings.EntryPoint);
            data.Status.Should().Be(repositorySettings.Status);
            data.CreatedBy.Should().Be(repositorySettings.CreatedBy);
            data.DateCreated.Should().Be(repositorySettings.DateCreated);
            data.UpdatedBy.Should().Be(repositorySettings.UpdatedBy);
            data.DateUpdated.Should().Be(repositorySettings.DateUpdated);
            data.ActivatedBy.Should().Be(repositorySettings.ActivatedBy);
            data.DateActivated.Should().Be(repositorySettings.DateActivated);
            data.DeactivatedBy.Should().Be(repositorySettings.DeactivatedBy);
            data.DateDeactivated.Should().Be(repositorySettings.DateDeactivated);
        }
Beispiel #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
            });
        }