/// <summary>
        /// Payment with basic authentication
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        protected PaymentResult CreatePaymentResultFromFile(string fileName)
        {
            var client         = CreateMockTestClientRequest(fileName);
            var payment        = new Payment(client);
            var paymentRequest = MockPaymentData.CreateFullPaymentRequest();
            var paymentResult  = payment.Authorise(paymentRequest);

            return(GetAdditionaData(paymentResult));
        }
Exemple #2
0
        public void TestPaymentRequestApplicationInfo()
        {
            var paymentRequest = MockPaymentData.CreateFullPaymentRequest();



            Assert.IsNotNull(paymentRequest.ApplicationInfo);
            Assert.AreEqual(paymentRequest.ApplicationInfo.AdyenLibrary.Name, ClientConfig.LibName);
            Assert.AreEqual(paymentRequest.ApplicationInfo.AdyenLibrary.Version, ClientConfig.LibVersion);
        }
Exemple #3
0
        public void TestAuthoriseSuccess3DMocked()
        {
            var client         = CreateMockTestClientRequest("Mocks/authorise-success-3d.json");
            var payment        = new Payment(client);
            var paymentRequest = MockPaymentData.CreateFullPaymentRequest();
            var paymentResult  = payment.Authorise(paymentRequest);

            Assert.IsNotNull(paymentResult.Md);
            Assert.IsNotNull(paymentResult.IssuerUrl);
            Assert.IsNotNull(paymentResult.PaRequest);
        }
Exemple #4
0
        public static PaymentRequest CreateOpenInvoicePaymentRequest()
        {
            DateTime dateOfBirth = DateTime.Parse("1970-07-10");

            PaymentRequest paymentRequest = MockPaymentData.CreateFullPaymentRequest();

            // Set Shopper Data
            paymentRequest.ShopperEmail     = "*****@*****.**";
            paymentRequest.DateOfBirth      = dateOfBirth;
            paymentRequest.TelephoneNumber  = "0612345678";
            paymentRequest.ShopperReference = "4";

            // Set Shopper Info
            Name shopperName = new Name
            {
                FirstName = "Testperson-nl",
                LastName  = "Approved",
                Gender    = GenderEnum.MALE
            };

            paymentRequest.ShopperName = shopperName;

            // Set Billing and Delivery address
            Address address = new Address
            {
                City              = "Gravenhage",
                Country           = "NL",
                HouseNumberOrName = "1",
                PostalCode        = "2521VA",
                StateOrProvince   = "Zuid-Holland",
                Street            = "Neherkade"
            };

            paymentRequest.DeliveryAddress = address;
            paymentRequest.BillingAddress  = address;

            // Use OpenInvoice Provider (klarna, ratepay)
            paymentRequest.SelectedBrand = "klarna";

            long itemAmount        = long.Parse("9000");
            long itemVatAmount     = long.Parse("1000");
            long itemVatPercentage = long.Parse("1000");

            List <InvoiceLine> invoiceLines = new List <InvoiceLine>();

            // invoiceLine1
            InvoiceLine invoiceLine = new InvoiceLine
            {
                CurrencyCode      = ("EUR"),
                Description       = ("Test product"),
                VatAmount         = (itemVatAmount),
                ItemAmount        = (itemAmount),
                ItemVatPercentage = (itemVatPercentage),
                VatCategory       = (VatCategory.None),
                NumberOfItems     = (1),
                ItemId            = ("1234")
            };

            // invoiceLine2
            // invoiceLine1
            InvoiceLine invoiceLine2 = new InvoiceLine
            {
                CurrencyCode      = ("EUR"),
                Description       = ("Test product2"),
                VatAmount         = (itemVatAmount),
                ItemAmount        = (itemAmount),
                ItemVatPercentage = (itemVatPercentage),
                VatCategory       = (VatCategory.None),
                NumberOfItems     = (1),
                ItemId            = ("456")
            };

            invoiceLines.Add(invoiceLine);
            invoiceLines.Add(invoiceLine2);

            paymentRequest.InvoiceLines(invoiceLines);

            return(paymentRequest);
        }