Example #1
0
        public void TestCloseOrder()
        {
            CreateOrderEuResponse response = WebpayConnection.CreateOrder(SveaConfig.GetDefaultConfig())
                                             .AddOrderRow(TestingTool.CreateExVatBasedOrderRow())
                                             .AddCustomerDetails(Item.IndividualCustomer()
                                                                 .SetNationalIdNumber(TestingTool.DefaultTestIndividualNationalIdNumber))
                                             .SetCountryCode(TestingTool.DefaultTestCountryCode)
                                             .SetClientOrderNumber(TestingTool.DefaultTestClientOrderNumber)
                                             .SetOrderDate(TestingTool.DefaultTestDate)
                                             .SetCurrency(TestingTool.DefaultTestCurrency)
                                             .UseInvoicePayment()
                                             .DoRequest();

            Assert.That(response.ResultCode, Is.EqualTo(0));
            Assert.That(response.Accepted, Is.True);

            CancelOrderResponse closeResponse = WebpayAdmin.CancelOrder(SveaConfig.GetDefaultConfig())
                                                .SetOrderId(response.CreateOrderResult.SveaOrderId)
                                                .SetCountryCode(TestingTool.DefaultTestCountryCode)
                                                .CancelInvoiceOrder()
                                                .DoRequest();

            Assert.That(closeResponse.ResultCode, Is.EqualTo(0));
            Assert.That(response.Accepted, Is.True);
        }
Example #2
0
        public void TestDeliverPaymentPlanOrderResult()
        {
            GetPaymentPlanParamsEuResponse paymentPlanParamResponse = WebpayConnection.GetPaymentPlanParams(SveaConfig.GetDefaultConfig())
                                                                      .SetCountryCode(TestingTool.DefaultTestCountryCode)
                                                                      .DoRequest();
            long code = paymentPlanParamResponse.CampaignCodes[0].CampaignCode;

            CreateOrderEuResponse createOrderResponse = WebpayConnection.CreateOrder(SveaConfig.GetDefaultConfig())
                                                        .AddOrderRow(TestingTool.CreatePaymentPlanOrderRow())
                                                        .AddCustomerDetails(
                TestingTool.CreateIndividualCustomer())
                                                        .SetCountryCode(TestingTool.DefaultTestCountryCode)
                                                        .SetCustomerReference(
                TestingTool.DefaultTestClientOrderNumber)
                                                        .SetClientOrderNumber(TestingTool.DefaultTestClientOrderNumber)
                                                        .SetOrderDate(TestingTool.DefaultTestDate)
                                                        .SetCurrency(TestingTool.DefaultTestCurrency)
                                                        .UsePaymentPlanPayment(code)
                                                        .DoRequest();

            DeliverOrderEuResponse deliverOrderResponse = WebpayConnection.DeliverOrder(SveaConfig.GetDefaultConfig())
                                                          .AddOrderRow(TestingTool.CreateExVatBasedOrderRow())
                                                          .SetOrderId(
                createOrderResponse.CreateOrderResult
                .SveaOrderId)
                                                          .SetNumberOfCreditDays(1)
                                                          .SetInvoiceDistributionType(
                InvoiceDistributionType.POST)
                                                          .SetCountryCode(TestingTool.DefaultTestCountryCode)
                                                          .DeliverPaymentPlanOrder()
                                                          .DoRequest();

            Assert.That(deliverOrderResponse.Accepted, Is.True);
        }
Example #3
0
        public void TestFailOnMissingCountryCodeOfCloseOrder()
        {
            CreateOrderEuResponse response = WebpayConnection.CreateOrder(SveaConfig.GetDefaultConfig())
                                             .AddOrderRow(TestingTool.CreateExVatBasedOrderRow())
                                             .AddCustomerDetails(Item.IndividualCustomer()
                                                                 .SetNationalIdNumber(TestingTool.DefaultTestIndividualNationalIdNumber))
                                             .SetCountryCode(TestingTool.DefaultTestCountryCode)
                                             .SetClientOrderNumber(TestingTool.DefaultTestClientOrderNumber)
                                             .SetOrderDate(TestingTool.DefaultTestDate)
                                             .SetCurrency(TestingTool.DefaultTestCurrency)
                                             .UseInvoicePayment()
                                             .DoRequest();

            long orderId = response.CreateOrderResult.SveaOrderId;

            Assert.That(response.ResultCode, Is.EqualTo(0));
            Assert.That(response.Accepted, Is.True);

            CloseOrder closeOrder = WebpayConnection.CloseOrder(SveaConfig.GetDefaultConfig())
                                    .SetOrderId(orderId)
                                    .CloseInvoiceOrder();

            const string expectedMsg = "MISSING VALUE - CountryCode is required, use SetCountryCode(...).\n";

            Assert.That(closeOrder.ValidateRequest(), Is.EqualTo(expectedMsg));
        }
Example #4
0
        public void TestInvoiceRequestUsingForNewVatFunctionCornerCase()
        {
            var useInvoicePayment = WebpayConnection
                                    .CreateOrder(SveaConfig.GetDefaultConfig())
                                    .AddOrderRow(Item
                                                 .OrderRow()
                                                 .SetArticleNumber("1")
                                                 .SetName("Prod")
                                                 .SetDescription("Specification")
                                                 .SetAmountIncVat(100.00M)
                                                 .SetQuantity(1)
                                                 .SetUnit("st")
                                                 .SetVatPercent(24)
                                                 .SetVatDiscount(0))
                                    .AddCustomerDetails(Item
                                                        .IndividualCustomer()
                                                        .SetNationalIdNumber(TestingTool.DefaultTestIndividualNationalIdNumber))
                                    .SetCountryCode(TestingTool.DefaultTestCountryCode)
                                    .SetOrderDate(TestingTool.DefaultTestDate)
                                    .SetClientOrderNumber(TestingTool.DefaultTestClientOrderNumber)
                                    .SetCurrency(TestingTool.DefaultTestCurrency)
                                    .SetCustomerReference(TestingTool.DefaultTestCustomerReferenceNumber)
                                    .UseInvoicePayment();
            var createOrderEuRequest       = useInvoicePayment.PrepareRequest();
            CreateOrderEuResponse response = useInvoicePayment
                                             .DoRequest();

            Assert.That(response.ResultCode, Is.EqualTo(0));
            Assert.That(response.Accepted, Is.True);
            Assert.That(response.CreateOrderResult.Amount, Is.EqualTo(100.00M)); // Old version gives 100.01
        }
Example #5
0
        public void TestFormatShippingFeeRowsZero()
        {
            CreateOrderEuResponse response = WebpayConnection.CreateOrder(SveaConfig.GetDefaultConfig())
                                             .AddOrderRow(Item.OrderRow()
                                                          .SetArticleNumber("1")
                                                          .SetQuantity(2)
                                                          .SetAmountExVat(10)
                                                          .SetDescription("Specification")
                                                          .SetName("Prod")
                                                          .SetVatPercent(0)
                                                          .SetDiscountPercent(0))
                                             .AddFee(Item.ShippingFee()
                                                     .SetShippingId("0")
                                                     .SetName("Tess")
                                                     .SetDescription("Tester")
                                                     .SetAmountExVat(0)
                                                     .SetVatPercent(0)
                                                     .SetUnit("st"))
                                             .AddCustomerDetails(Item.IndividualCustomer()
                                                                 .SetNationalIdNumber(TestingTool.DefaultTestIndividualNationalIdNumber))
                                             .SetCountryCode(TestingTool.DefaultTestCountryCode)
                                             .SetOrderDate(TestingTool.DefaultTestDate)
                                             .SetClientOrderNumber(TestingTool.DefaultTestClientOrderNumber)
                                             .SetCurrency(TestingTool.DefaultTestCurrency)
                                             .SetCustomerReference(TestingTool.DefaultTestCustomerReferenceNumber)
                                             .UseInvoicePayment()
                                             .DoRequest();

            Assert.That(response.ResultCode, Is.EqualTo(0));
            Assert.That(response.Accepted, Is.True);
        }
Example #6
0
        public void TestCalculationWithTwelvePercentVat()
        {
            CreateOrderEuResponse response = WebpayConnection.CreateOrder(SveaConfig.GetDefaultConfig())
                                             .AddOrderRow(Item.OrderRow()
                                                          .SetArticleNumber("1")
                                                          .SetQuantity(1)
                                                          .SetAmountExVat(45M)
                                                          .SetDescription("Specification")
                                                          .SetName("Prod")
                                                          .SetVatPercent(12M)
                                                          .SetDiscountPercent(5))
                                             .AddCustomerDetails(
                Item.IndividualCustomer()
                .SetNationalIdNumber(TestingTool.DefaultTestIndividualNationalIdNumber))
                                             .SetCountryCode(TestingTool.DefaultTestCountryCode)
                                             .SetOrderDate(TestingTool.DefaultTestDate)
                                             .SetClientOrderNumber(TestingTool.DefaultTestClientOrderNumber)
                                             .SetCurrency(TestingTool.DefaultTestCurrency)
                                             .UseInvoicePayment()
                                             .DoRequest();


            Assert.That(response.Accepted, Is.True);
            Assert.That(response.CreateOrderResult.Amount, Is.EqualTo(47.88m));
        }
Example #7
0
        public void Test_CreateOrder_NO_WithAllCustomerDetailsSet_ShouldNotSetIndividualIdentity()
        {
            CreateOrderBuilder createOrderBuilder = WebpayConnection.CreateOrder(SveaConfig.GetDefaultConfig())
                                                    .AddOrderRow(TestingTool.CreateExVatBasedOrderRow("1"))
                                                    .AddOrderRow(TestingTool.CreateExVatBasedOrderRow("2"))
                                                    .AddCustomerDetails(Item.IndividualCustomer()
                                                                        .SetNationalIdNumber("17054512066") // NO test individual "Ola Norrmann"
                                                                                                            // below taken from docs, not accurate
                                                                        .SetBirthDate("19460509")           //Required for individual customers in NL and DE
                                                                        .SetName("Tess", "Testson")         //Required for individual customers in NL and DE
                                                                        .SetInitials("SB")                  //Required for individual customers in NL
                                                                        .SetStreetAddress("Gatan", "23")    //Required in NL and DE
                                                                        .SetCoAddress("c/o Eriksson")       //Optional
                                                                        .SetZipCode("9999")                 //Required in NL and DE
                                                                        .SetLocality("Stan")                //Required in NL and DE
                                                                        .SetPhoneNumber("999999")           //Optional
                                                                        .SetEmail("*****@*****.**")          //Optional but desirable
                                                                        .SetIpAddress("123.123.123")        //Optional but desirable
                                                                        )
                                                    .SetCountryCode(CountryCode.NO)                         // NO
                                                    .SetOrderDate(TestingTool.DefaultTestDate)
                                                    .SetClientOrderNumber("33308")                          // NO Invoice
                                                    .SetCurrency(TestingTool.DefaultTestCurrency)
            ;
            CreateOrderEuRequest request = createOrderBuilder.UseInvoicePayment().PrepareRequest();

            Assert.IsNull(request.CreateOrderInformation.CustomerIdentity.IndividualIdentity);

            CreateOrderEuResponse order = createOrderBuilder.UseInvoicePayment().DoRequest();

            Assert.IsTrue(order.Accepted);
        }
Example #8
0
        public void TestInvoiceForIndividualFromNl()
        {
            CreateOrderEuResponse response = WebpayConnection.CreateOrder(SveaConfig.GetDefaultConfig())
                                             .AddOrderRow(TestingTool.CreateOrderRowNl())
                                             .AddCustomerDetails(TestingTool.CreateIndividualCustomer(CountryCode.NL))
                                             .SetCountryCode(CountryCode.NL)
                                             .SetClientOrderNumber(TestingTool.DefaultTestClientOrderNumber)
                                             .SetOrderDate(TestingTool.DefaultTestDate)
                                             .SetCurrency(Currency.EUR)
                                             .UseInvoicePayment()
                                             .DoRequest();

            Assert.That(response.ResultCode, Is.EqualTo(0));
            Assert.That(response.Accepted, Is.True);
            Assert.That(response.CreateOrderResult.SveaWillBuyOrder, Is.True);
            Assert.That(response.CreateOrderResult.Amount, Is.EqualTo(212.00));
            Assert.That(response.CreateOrderResult.OrderType, Is.EqualTo("Invoice"));

            //Returns hardcoded values that slightly differ from input
            Assert.That(response.CreateOrderResult.CustomerIdentity.Email, Is.EqualTo("*****@*****.**"));
            Assert.That(response.CreateOrderResult.CustomerIdentity.IpAddress, Is.Null);
            Assert.That(response.CreateOrderResult.CustomerIdentity.CountryCode, Is.EqualTo("NL"));
            Assert.That(response.CreateOrderResult.CustomerIdentity.HouseNumber, Is.EqualTo("42"));
            Assert.That(response.CreateOrderResult.CustomerIdentity.CustomerType, Is.EqualTo(CustomerType.Individual));
            Assert.That(response.CreateOrderResult.CustomerIdentity.PhoneNumber, Is.EqualTo("999999"));
            Assert.That(response.CreateOrderResult.CustomerIdentity.FullName, Is.EqualTo("Sneider Boasman"));
            Assert.That(response.CreateOrderResult.CustomerIdentity.Street, Is.EqualTo("Gate"));
            Assert.That(response.CreateOrderResult.CustomerIdentity.CoAddress, Is.Null);
            Assert.That(response.CreateOrderResult.CustomerIdentity.ZipCode, Is.EqualTo("1102 HG"));
            Assert.That(response.CreateOrderResult.CustomerIdentity.Locality, Is.EqualTo("BARENDRECHT"));
        }
Example #9
0
        private long CreateInvoiceAndReturnOrderId()
        {
            CreateOrderEuResponse response = WebpayConnection.CreateOrder(SveaConfig.GetDefaultConfig())
                                             .AddOrderRow(TestingTool.CreateExVatBasedOrderRow("1"))
                                             .AddCustomerDetails(Item.IndividualCustomer()
                                                                 .SetNationalIdNumber(TestingTool.DefaultTestIndividualNationalIdNumber))
                                             .SetCountryCode(TestingTool.DefaultTestCountryCode)
                                             .SetClientOrderNumber(TestingTool.DefaultTestClientOrderNumber)
                                             .SetOrderDate(TestingTool.DefaultTestDate)
                                             .SetCurrency(TestingTool.DefaultTestCurrency)
                                             .UseInvoicePayment()
                                             .DoRequest();

            return(response.CreateOrderResult.SveaOrderId);
        }
Example #10
0
        public void TestInvoiceRequestFailing()
        {
            CreateOrderEuResponse response = WebpayConnection.CreateOrder(SveaConfig.GetDefaultConfig())
                                             .AddOrderRow(TestingTool.CreateExVatBasedOrderRow())
                                             .AddCustomerDetails(
                Item.IndividualCustomer().SetNationalIdNumber(""))
                                             .SetCountryCode(TestingTool.DefaultTestCountryCode)
                                             .SetOrderDate(TestingTool.DefaultTestDate)
                                             .SetClientOrderNumber(TestingTool.DefaultTestClientOrderNumber)
                                             .SetCurrency(TestingTool.DefaultTestCurrency)
                                             .UseInvoicePayment()
                                             .DoRequest();

            Assert.That(response.Accepted, Is.False);
        }
Example #11
0
        public static async Task <CreateOrderEuResponse> CreateInvoiceOrderWithOneOrderRow()
        {
            CreateOrderBuilder createOrderBuilder = WebpayConnection.CreateOrder(SveaConfig.GetDefaultConfig())
                                                    .AddOrderRow(TestingTool.CreateExVatBasedOrderRow("1"))
                                                    .AddCustomerDetails(Item.IndividualCustomer()
                                                                        .SetNationalIdNumber(TestingTool.DefaultTestIndividualNationalIdNumber))
                                                    .SetCountryCode(TestingTool.DefaultTestCountryCode)
                                                    .SetOrderDate(TestingTool.DefaultTestDate)
                                                    .SetClientOrderNumber(TestingTool.DefaultTestClientOrderNumber)
                                                    .SetCurrency(TestingTool.DefaultTestCurrency)
            ;
            CreateOrderEuResponse order = await createOrderBuilder.UseInvoicePayment().DoRequest();

            return(order);
        }
Example #12
0
        public void TestConnectionWithTestConfiguration()
        {
            var conf = new ConfigurationProviderTestData();
            CreateOrderEuResponse response = WebpayConnection.CreateOrder(conf)
                                             .AddOrderRow(TestingTool.CreateExVatBasedOrderRow("1"))
                                             .AddOrderRow(TestingTool.CreateExVatBasedOrderRow("2"))
                                             .AddCustomerDetails(TestingTool.CreateIndividualCustomer())
                                             .SetCountryCode(TestingTool.DefaultTestCountryCode)
                                             .SetOrderDate(TestingTool.DefaultTestDate)
                                             .SetClientOrderNumber(TestingTool.DefaultTestClientOrderNumber)
                                             .SetCurrency(TestingTool.DefaultTestCurrency)
                                             .UseInvoicePayment()
                                             .DoRequest();

            Assert.That(response.Accepted, Is.True);
        }
Example #13
0
        public void TestInvoiceRequestUsingAmountIncVatWithZeroVatPercent()
        {
            CreateOrderEuResponse response = WebpayConnection.CreateOrder(SveaConfig.GetDefaultConfig())
                                             .AddOrderRow(TestingTool.CreateExVatBasedOrderRow("1"))
                                             .AddOrderRow(TestingTool.CreateExVatBasedOrderRow("2"))
                                             .AddCustomerDetails(Item.IndividualCustomer()
                                                                 .SetNationalIdNumber(TestingTool.DefaultTestIndividualNationalIdNumber))
                                             .SetCountryCode(TestingTool.DefaultTestCountryCode)
                                             .SetOrderDate(TestingTool.DefaultTestDate)
                                             .SetClientOrderNumber(TestingTool.DefaultTestClientOrderNumber)
                                             .SetCurrency(TestingTool.DefaultTestCurrency)
                                             .SetCustomerReference(TestingTool.DefaultTestCustomerReferenceNumber)
                                             .UseInvoicePayment()
                                             .DoRequest();

            Assert.That(response.ResultCode, Is.EqualTo(0));
            Assert.That(response.Accepted, Is.True);
        }
Example #14
0
        public void TestInvoiceDoRequestWithPeppolId()
        {
            CreateOrderEuResponse response = WebpayConnection.CreateOrder(SveaConfig.GetDefaultConfig())
                                             .AddOrderRow(TestingTool.CreateExVatBasedOrderRow("1"))
                                             .AddOrderRow(TestingTool.CreateExVatBasedOrderRow("2"))
                                             .AddCustomerDetails(Item.CompanyCustomer()
                                                                 .SetNationalIdNumber(TestingTool.DefaultTestCompanyNationalIdNumber))
                                             .SetCountryCode(TestingTool.DefaultTestCountryCode)
                                             .SetOrderDate(TestingTool.DefaultTestDate)
                                             .SetClientOrderNumber(TestingTool.DefaultTestClientOrderNumber)
                                             .SetPeppolId("1234:asdf")
                                             .SetCurrency(TestingTool.DefaultTestCurrency)
                                             .UseInvoicePayment()
                                             .DoRequest();

            Assert.That(response.ResultCode, Is.EqualTo(0));
            Assert.That(response.Accepted, Is.True);
        }
Example #15
0
        public void TestCompanyIdResponse()
        {
            CreateOrderEuResponse response = WebpayConnection.CreateOrder(SveaConfig.GetDefaultConfig())
                                             .AddOrderRow(TestingTool.CreateExVatBasedOrderRow())
                                             .AddCustomerDetails(Item.CompanyCustomer()
                                                                 .SetNationalIdNumber(TestingTool.DefaultTestCompanyNationalIdNumber))
                                             .SetCountryCode(TestingTool.DefaultTestCountryCode)
                                             .SetClientOrderNumber(
                TestingTool.DefaultTestClientOrderNumber)
                                             .SetOrderDate(TestingTool.DefaultTestDate)
                                             .SetCurrency(TestingTool.DefaultTestCurrency)
                                             .UseInvoicePayment()
                                             .DoRequest();

            Assert.That(response.CreateOrderResult.CustomerIdentity.CustomerType, Is.EqualTo(CustomerType.Company));
            Assert.IsNull(response.CreateOrderResult.CustomerIdentity.IndividualIdentity);
            Assert.IsNull(response.CreateOrderResult.CustomerIdentity.CompanyIdentity);
            Assert.That(response.Accepted, Is.True);
        }
Example #16
0
        public void Test_CreateOrder_NO_WithOnlyNationalIdNumber_ShouldNotSetIndividualIdentity()
        {
            CreateOrderBuilder createOrderBuilder = WebpayConnection.CreateOrder(SveaConfig.GetDefaultConfig())
                                                    .AddOrderRow(TestingTool.CreateExVatBasedOrderRow("1"))
                                                    .AddOrderRow(TestingTool.CreateExVatBasedOrderRow("2"))
                                                    .AddCustomerDetails(Item.IndividualCustomer()
                                                                        .SetNationalIdNumber("17054512066")) // NO test individual "Ola Norrmann"
                                                    .SetCountryCode(CountryCode.NO)                          // NO
                                                    .SetOrderDate(TestingTool.DefaultTestDate)
                                                    .SetClientOrderNumber("33308")                           // NO Invoice
                                                    .SetCurrency(TestingTool.DefaultTestCurrency)
            ;
            CreateOrderEuRequest request = createOrderBuilder.UseInvoicePayment().PrepareRequest();

            Assert.IsNull(request.CreateOrderInformation.CustomerIdentity.IndividualIdentity);

            CreateOrderEuResponse order = createOrderBuilder.UseInvoicePayment().DoRequest();

            Assert.IsTrue(order.Accepted);
        }
Example #17
0
        private long createPaymentPlanAndReturnOrderId()
        {
            GetPaymentPlanParamsEuResponse paymentPlanParam = WebpayConnection.GetPaymentPlanParams(SveaConfig.GetDefaultConfig())
                                                              .SetCountryCode(TestingTool.DefaultTestCountryCode)
                                                              .DoRequest();
            long code = paymentPlanParam.CampaignCodes[0].CampaignCode;

            CreateOrderEuResponse response = WebpayConnection.CreateOrder(SveaConfig.GetDefaultConfig())
                                             .AddOrderRow(TestingTool.CreatePaymentPlanOrderRow())
                                             .AddCustomerDetails(TestingTool.CreateIndividualCustomer())
                                             .SetCountryCode(TestingTool.DefaultTestCountryCode)
                                             .SetCustomerReference(TestingTool.DefaultTestCustomerReferenceNumber)
                                             .SetClientOrderNumber(TestingTool.DefaultTestClientOrderNumber)
                                             .SetOrderDate(TestingTool.DefaultTestDate)
                                             .SetCurrency(TestingTool.DefaultTestCurrency)
                                             .UsePaymentPlanPayment(code)
                                             .DoRequest();

            return(response.CreateOrderResult.SveaOrderId);
        }
Example #18
0
        public void TestPaymentPlanRequestReturnsAcceptedResult()
        {
            GetPaymentPlanParamsEuResponse paymentPlanParam = WebpayConnection.GetPaymentPlanParams(SveaConfig.GetDefaultConfig())
                                                              .SetCountryCode(TestingTool.DefaultTestCountryCode)
                                                              .DoRequest();
            long code = paymentPlanParam.CampaignCodes[0].CampaignCode;

            CreateOrderEuResponse response = WebpayConnection.CreateOrder(SveaConfig.GetDefaultConfig())
                                             .AddOrderRow(TestingTool.CreatePaymentPlanOrderRow())
                                             .AddCustomerDetails(TestingTool.CreateIndividualCustomer())
                                             .SetCountryCode(TestingTool.DefaultTestCountryCode)
                                             .SetCustomerReference(TestingTool.DefaultTestCustomerReferenceNumber)
                                             .SetClientOrderNumber(TestingTool.DefaultTestClientOrderNumber)
                                             .SetOrderDate(TestingTool.DefaultTestDate)
                                             .SetCurrency(TestingTool.DefaultTestCurrency)
                                             .SetCountryCode(TestingTool.DefaultTestCountryCode)
                                             .UsePaymentPlanPayment(code)
                                             .DoRequest();

            Assert.That(response.Accepted, Is.True);
        }
Example #19
0
        public static async Task <CreateOrderEuResponse> CreatePaymentPlanOrderWithOneOrderRow()
        {
            // get campaigns
            var campaigns = await WebpayConnection.GetPaymentPlanParams(SveaConfig.GetDefaultConfig())
                            .SetCountryCode(TestingTool.DefaultTestCountryCode)
                            .DoRequest();

            // create order
            CreateOrderBuilder createOrderBuilder = WebpayConnection.CreateOrder(SveaConfig.GetDefaultConfig())
                                                    .AddOrderRow(TestingTool.CreatePaymentPlanOrderRow())
                                                    .AddCustomerDetails(Item.IndividualCustomer()
                                                                        .SetNationalIdNumber(TestingTool.DefaultTestIndividualNationalIdNumber))
                                                    .SetCountryCode(TestingTool.DefaultTestCountryCode)
                                                    .SetOrderDate(TestingTool.DefaultTestDate)
                                                    .SetClientOrderNumber(TestingTool.DefaultTestClientOrderNumber)
                                                    .SetCurrency(TestingTool.DefaultTestCurrency)
            ;
            CreateOrderEuResponse order = await createOrderBuilder.UsePaymentPlanPayment(campaigns.CampaignCodes[0].CampaignCode).DoRequest();

            return(order);
        }
        public void TestAmountIncVatWithRelativeDiscount()
        {
            CreateOrderEuResponse response = WebpayConnection.CreateOrder(SveaConfig.GetDefaultConfig())
                                             .AddOrderRow(Item.OrderRow()
                                                          .SetQuantity(1)
                                                          .SetAmountIncVat(100.00M)
                                                          .SetVatPercent(25.00M)
                                                          )
                                             .AddDiscount(Item.RelativeDiscount()
                                                          .SetDiscountPercent(50))
                                             .AddCustomerDetails(Item.IndividualCustomer()
                                                                 .SetNationalIdNumber("4605092222"))
                                             .SetCountryCode(CountryCode.SE)
                                             .SetCustomerReference("dotnet-integration")
                                             .SetClientOrderNumber("RelativeDiscountIncVat")
                                             .SetOrderDate(new DateTime(2012, 12, 12))
                                             .UseInvoicePayment()
                                             .DoRequest();

            Assert.That(response.CreateOrderResult.Amount, Is.EqualTo(50.0M));
        }
Example #21
0
        public void TestNlCompanyIdentity()
        {
            CreateOrderEuResponse response = WebpayConnection.CreateOrder(SveaConfig.GetDefaultConfig())
                                             .AddOrderRow(TestingTool.CreateOrderRowNl())
                                             .AddCustomerDetails(Item.CompanyCustomer()
                                                                 .SetCompanyName("Svea bakkerij 123")
                                                                 .SetVatNumber("NL123456789A12")
                                                                 .SetStreetAddress("broodstraat",
                                                                                   "1")
                                                                 .SetZipCode("1111 CD")
                                                                 .SetLocality("BARENDRECHT"))
                                             .SetCountryCode(CountryCode.NL)
                                             .SetClientOrderNumber(
                TestingTool.DefaultTestClientOrderNumber)
                                             .SetOrderDate(TestingTool.DefaultTestDate)
                                             .SetCurrency(Currency.EUR)
                                             .UseInvoicePayment()
                                             .DoRequest();

            Assert.That(response.ResultCode, Is.EqualTo(0));
            Assert.That(response.CreateOrderResult.CustomerIdentity.CustomerType, Is.EqualTo(CustomerType.Company));
            Assert.That(response.Accepted, Is.True);
        }
Example #22
0
        public void TestDeCompanyIdentity()
        {
            CreateOrderEuResponse response = WebpayConnection.CreateOrder(SveaConfig.GetDefaultConfig())
                                             .AddOrderRow(TestingTool.CreateOrderRowDe())
                                             .AddCustomerDetails(Item.CompanyCustomer()
                                                                 .SetNationalIdNumber("12345")
                                                                 .SetVatNumber("DE123456789")
                                                                 .SetStreetAddress(
                                                                     "Adalbertsteinweg", "1")
                                                                 .SetZipCode("52070")
                                                                 .SetLocality("AACHEN"))
                                             .SetCountryCode(CountryCode.DE)
                                             .SetClientOrderNumber(
                TestingTool.DefaultTestClientOrderNumber)
                                             .SetOrderDate(TestingTool.DefaultTestDate)
                                             .SetCurrency(Currency.EUR)
                                             .UseInvoicePayment()
                                             .DoRequest();

            Assert.That(response.ResultCode, Is.EqualTo(0));
            Assert.That(response.CreateOrderResult.CustomerIdentity.CustomerType, Is.EqualTo(CustomerType.Company));
            Assert.That(response.Accepted, Is.True);
        }
Example #23
0
        public void TestInvoiceCompanySe()
        {
            CreateOrderEuResponse response = WebpayConnection.CreateOrder(SveaConfig.GetDefaultConfig())
                                             .SetCountryCode(TestingTool.DefaultTestCountryCode)
                                             .SetOrderDate(TestingTool.DefaultTestDate)
                                             .SetCurrency(TestingTool.DefaultTestCurrency)
                                             .AddCustomerDetails(Item.CompanyCustomer()
                                                                 .SetNationalIdNumber(TestingTool.DefaultTestCompanyNationalIdNumber))
                                             .AddOrderRow(Item.OrderRow()
                                                          .SetArticleNumber("1")
                                                          .SetQuantity(2)
                                                          .SetAmountExVat(100.00M)
                                                          .SetDescription("Specification")
                                                          .SetName("Prod")
                                                          .SetVatPercent(25)
                                                          .SetDiscountPercent(0))
                                             .UseInvoicePayment()
                                             .DoRequest();

            Assert.That(response.ResultCode, Is.EqualTo(0));
            Assert.That(response.Accepted, Is.True);
            Assert.That(response.CreateOrderResult.SveaWillBuyOrder, Is.True);
            Assert.That(response.CreateOrderResult.CustomerIdentity.CountryCode, Is.EqualTo("SE"));
        }