示例#1
0
        public void Test_PayIns_Get_PayPal()
        {
            try
            {
                PayInDTO       payIn  = null;
                WalletDTO      wallet = this.GetJohnsWallet();
                UserNaturalDTO user   = this.GetJohn();

                PayInPayPalPostDTO payInPost = new PayInPayPalPostDTO(user.Id, new Money {
                    Amount = 1000, Currency = CurrencyIso.EUR
                }, new Money {
                    Amount = 0, Currency = CurrencyIso.EUR
                }, wallet.Id, "http://test/test");

                payIn = this.Api.PayIns.CreatePayPal(payInPost);

                Assert.IsTrue(payIn.Id.Length > 0);
                Assert.IsTrue(payIn.PaymentType == PayInPaymentType.PAYPAL);
                Assert.IsTrue(payIn.ExecutionType == PayInExecutionType.WEB);

                PayInPayPalDTO getPayIn = this.Api.PayIns.GetPayPal(payIn.Id);

                Assert.IsNotNull(getPayIn);
                Assert.IsTrue(getPayIn.Id == payIn.Id);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
示例#2
0
        public async Task Test_PayIns_Get_PayPal_WithShippingAddress()
        {
            try
            {
                PayInDTO  payIn  = null;
                WalletDTO wallet = await this.GetJohnsWallet();

                UserNaturalDTO user = await this.GetJohn();

                Address AddressForShippingAddress = new Address
                {
                    AddressLine1 = "Address line 1",
                    AddressLine2 = "Address line 2",
                    City         = "City",
                    Country      = CountryIso.PL,
                    PostalCode   = "11222",
                    Region       = "Region"
                };
                PayInPayPalPostDTO payInPost = new PayInPayPalPostDTO(user.Id, new Money {
                    Amount = 1000, Currency = CurrencyIso.EUR
                }, new Money {
                    Amount = 0, Currency = CurrencyIso.EUR
                }, wallet.Id, "http://test/test")
                {
                    ShippingAddress = new ShippingAddress("recipient name", AddressForShippingAddress)
                };
                payIn = await this.Api.PayIns.CreatePayPalAsync(payInPost);

                PayInPayPalDTO getPayIn = await this.Api.PayIns.GetPayPalAsync(payIn.Id);

                Assert.IsNotNull(getPayIn.ShippingAddress);
                Assert.AreEqual("recipient name", getPayIn.ShippingAddress.RecipientName);
                Assert.IsNotNull(getPayIn.ShippingAddress.Address);
                Assert.AreEqual("Address line 1", getPayIn.ShippingAddress.Address.AddressLine1);
                Assert.AreEqual("Address line 2", getPayIn.ShippingAddress.Address.AddressLine2);
                Assert.AreEqual("City", getPayIn.ShippingAddress.Address.City);
                Assert.AreEqual(CountryIso.PL, getPayIn.ShippingAddress.Address.Country);
                Assert.AreEqual("11222", getPayIn.ShippingAddress.Address.PostalCode);
                Assert.AreEqual("Region", getPayIn.ShippingAddress.Address.Region);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
示例#3
0
        public void Test_PayIns_Get_PayPal_WithPayPalBuyerAccountEmail()
        {
            try
            {
                string         payInId          = "54088959";
                string         payPalBuyerEmail = "*****@*****.**";
                PayInPayPalDTO payIn            = Api.PayIns.GetPayPal(payInId);

                Assert.NotNull(payIn);
                Assert.NotNull(payIn.Id);
                Assert.NotNull(payIn.PaypalBuyerAccountEmail);
                Assert.AreEqual(payInId, payIn.Id);
                Assert.AreEqual(payPalBuyerEmail, payIn.PaypalBuyerAccountEmail);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
        public void Test_PayIns_Get_PayPal_WithPayPalBuyerAccountEmail()
        {
            try
            {
                string         payInId          = "54088959";
                string         payPalBuyerEmail = "*****@*****.**";
                PayInPayPalDTO payIn            = _objectToTest.GetPayPal(payInId).Result;

                Assert.NotNull(payIn);
                Assert.NotNull(payIn.Id);
                Assert.NotNull(payIn.PaypalBuyerAccountEmail);
                Assert.Equal(payInId, payIn.Id);
                Assert.Equal(payPalBuyerEmail, payIn.PaypalBuyerAccountEmail);
            }
            catch (Exception ex)
            {
                Assert.True(false, ex.Message);
            }
        }
        public void Test_PayIns_Get_PayPal_WithShippingAddress()
        {
            try
            {
                PayInDTO       payIn  = null;
                WalletDTO      wallet = TestHelper.GetJohnsWallet();
                UserNaturalDTO user   = TestHelper.GetJohn();
                Address        AddressForShippingAddress = new Address
                {
                    AddressLine1 = "Address line 1",
                    AddressLine2 = "Address line 2",
                    City         = "City",
                    Country      = CountryIso.PL,
                    PostalCode   = "11222",
                    Region       = "Region"
                };
                PayInPayPalPostDTO payInPost = new PayInPayPalPostDTO(user.Id, new Money {
                    Amount = 1000, Currency = CurrencyIso.EUR
                }, new Money {
                    Amount = 0, Currency = CurrencyIso.EUR
                }, wallet.Id, "http://test/test");
                payInPost.ShippingAddress = new ShippingAddress("recipient name", AddressForShippingAddress);
                payIn = _objectToTest.CreatePayPal(payInPost).Result;

                PayInPayPalDTO getPayIn = _objectToTest.GetPayPal(payIn.Id).Result;

                Assert.NotNull(getPayIn.ShippingAddress);
                Assert.Equal("recipient name", getPayIn.ShippingAddress.RecipientName);
                Assert.NotNull(getPayIn.ShippingAddress.Address);
                Assert.Equal("Address line 1", getPayIn.ShippingAddress.Address.AddressLine1);
                Assert.Equal("Address line 2", getPayIn.ShippingAddress.Address.AddressLine2);
                Assert.Equal("City", getPayIn.ShippingAddress.Address.City);
                Assert.Equal(CountryIso.PL, getPayIn.ShippingAddress.Address.Country);
                Assert.Equal("11222", getPayIn.ShippingAddress.Address.PostalCode);
                Assert.Equal("Region", getPayIn.ShippingAddress.Address.Region);
            }
            catch (Exception ex)
            {
                Assert.True(false, ex.Message);
            }
        }