public void TestRefund()
        {
            var gw       = PaymentGatewayFactory.CreateInstance("PayDollar");
            var settings = new PaymentGatewaySettings();

            gw.Init(settings);
            gw.Test();
            //keep confidential info else where in purpose
            var o    = System.IO.File.ReadAllText(@"D:\TestCase\PayDollar\trans1.json");
            var card = System.IO.File.ReadAllText(@"D:\TestCase\PayDollar\card.json");

            var m = new Money();

            m.Currency = "344";//hkd
            m.Amount   = 1;
            var cc      = JsonConvert.DeserializeObject <CreditCard>(card);
            var options = JsonConvert.DeserializeObject <PayDollarPaymentOptions>(o);
            var r       = gw.Purchase(m, cc, options);
            PayDollarPaymentResult result = (PayDollarPaymentResult)r;

            Assert.AreEqual(result.SuccessCode, "0", "payDollar Purchase failed");

            var cr = gw.Refund(m, result.GatewayRef, options);
            PayDollarPaymentResult refundResult = (PayDollarPaymentResult)cr;

            Assert.AreEqual(refundResult.SuccessCode, "0", "payDollar Refund failed");
        }
        public void Can_add_the_same_onlinePaymentMethodName_in_different_brands()
        {
            // Arrange
            var brand = Container.Resolve <BrandTestHelper>().CreateBrand(isActive: true);

            var repositorySettings = new PaymentGatewaySettings
            {
                Id      = new Guid("50797305-5320-4086-BA1C-9D062DDF53D9"),
                BrandId = brand.Id,
                OnlinePaymentMethodName = "OnlinePaymentMethodName",
                Status = Status.Active
            };

            _paymentRepository.PaymentGatewaySettings.Add(repositorySettings);

            var brand2 = Container.Resolve <BrandTestHelper>().CreateBrand(isActive: true);
            var savePaymentSettingsCommand = new SavePaymentGatewaysSettingsData
            {
                Brand                   = brand2.Id,
                Channel                 = 1,
                PaymentGatewayName      = "PG-NAME",
                OnlinePaymentMethodName = "OnlinePaymentMethodName",
                EntryPoint              = "http://domain.com"
            };

            // Act
            var response = _commands.ValidateThatPaymentGatewaySettingsCanBeAdded(savePaymentSettingsCommand);

            //Assert
            response.IsValid.Should().Be(true);
        }
        public void Should_return_false_if_the_same_setting_existed()
        {
            // Arrange
            var brand = Container.Resolve <BrandTestHelper>().CreateBrand(isActive: true);

            var repositorySettings = new PaymentGatewaySettings
            {
                Id      = new Guid("50797305-5320-4086-BA1C-9D062DDF53D9"),
                BrandId = brand.Id,
                OnlinePaymentMethodName = "OnlinePaymentMethodName",
                PaymentGatewayName      = "XPAY",
                Channel = 1,
                Status  = Status.Active
            };

            _paymentRepository.PaymentGatewaySettings.Add(repositorySettings);

            var savePaymentSettingsCommand = new SavePaymentGatewaysSettingsData
            {
                Brand = brand.Id,
                OnlinePaymentMethodName = "OnlinePaymentMethodName2",
                PaymentGatewayName      = "XPAY",
                Channel    = 1,
                EntryPoint = "http://domain.com"
            };

            // Act
            var response = _commands.ValidateThatPaymentGatewaySettingsCanBeAdded(savePaymentSettingsCommand);

            //Assert
            response.IsValid.Should().Be(false);
            response.Errors.First().ErrorMessage.Should().Be("PaymentGatewaySettingAlreadyExists");
        }
        public void Can_deactivate_paymentGatewaySettings()
        {
            // Arrange
            var brand = Container.Resolve <BrandTestHelper>().CreateBrand(isActive: true);

            var repositorySettings = new PaymentGatewaySettings
            {
                Id      = new Guid("50797305-5320-4086-BA1C-9D062DDF53D9"),
                BrandId = brand.Id,
                Status  = Status.Active
            };

            _paymentRepository.PaymentGatewaySettings.Add(repositorySettings);

            // Act
            _commands.Deactivate(new DeactivatePaymentGatewaySettingsData
            {
                Id      = repositorySettings.Id,
                Remarks = "remark"
            });

            //Assert
            var settings = _paymentRepository.PaymentGatewaySettings.Single(x => x.Id == repositorySettings.Id);

            settings.Status.Should().Be(Status.Inactive);
            settings.DeactivatedBy.ShouldBeEquivalentTo(_actorInfoProvider.Actor.UserName);
            settings.DateDeactivated.Should().BeCloseTo(DateTime.Now, 5000);
        }
Пример #5
0
 public static PaymentGatewaySettings Create(CreditCardProcessorType type)
 {
     PaymentGatewaySettings setting = new PaymentGatewaySettings();
     setting.EmailCustomer = ConfigurationSettings.EmailCustormer;
     setting.TestMode = ConfigurationSettings.IsTestMode;
     setting.Username = ConfigurationSettings.User_AuthorizeNET;
     setting.Password = ConfigurationSettings.Password_AuthorizeNET;
     return setting;
 }
        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);
        }
Пример #7
0
 public override void Init(PaymentGatewaySettings options)
 {
     if (options == null)
     {
         throw new ArgumentNullException("options");
     }
     Parameters.ShortName = "AmiPays";
     if (string.IsNullOrEmpty(options.BaseUrl))
     {
         options.BaseUrl = "https://www.Amipays.com/Api/Payin/";
     }
     Parameters.Options = options;
 }
Пример #8
0
        public override void Init(PaymentGatewaySettings options)
        {//https://test.paydollar.com/b2cDemo/eng/payment/payForm.jsp
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }
            Parameters.ShortName = "PayDollor";
            if (string.IsNullOrEmpty(options.BaseUrl))
            {
                options.BaseUrl = "https://www.paydollar.com/b2c2/eng";
            }
            Parameters.Options = options;

            System.Net.ServicePointManager.SecurityProtocol = (System.Net.SecurityProtocolType) 3072;
        }
        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());
        }
 public TefPayGateway(PaymentGatewaySettings settings)
 {
     Settings = settings;
 }