private static string ValidateInvoiceDetails(DeliverOrderBuilder order)
 {
     if (order.GetOrderId() > 0 && order.GetOrderType() == OrderType.INVOICE &&
         (order.GetInvoiceDistributionType() == InvoiceDistributionType.NONE ||
          !Enum.IsDefined(typeof (InvoiceDistributionType), order.GetInvoiceDistributionType())))
     {
         return "MISSING VALUE - SetInvoiceDistributionType is required for DeliverInvoiceOrder.";
     }
     return "";
 }
Exemplo n.º 2
0
 private static string ValidateInvoiceDetails(DeliverOrderBuilder order)
 {
     if (order.GetOrderId() > 0 && order.GetOrderType() == OrderType.INVOICE &&
         (order.GetInvoiceDistributionType() == InvoiceDistributionType.NONE ||
          !Enum.IsDefined(typeof(InvoiceDistributionType), order.GetInvoiceDistributionType())))
     {
         return("MISSING VALUE - SetInvoiceDistributionType is required for DeliverInvoiceOrder.");
     }
     return("");
 }
Exemplo n.º 3
0
        private DeliverOrderEuRequest PrepareRequestInternal(bool useIncVatRequestIfPossible)
        {
            var errors = ValidateOrder();

            if (errors.Length > 0)
            {
                throw new SveaWebPayValidationException(errors);
            }

            var formatter = new WebServiceRowFormatter <DeliverOrderBuilder>(_order, useIncVatRequestIfPossible);

            DeliverInvoiceDetails deliverInvoiceDetails = null;

            if (_order.GetOrderType() == CONST.OrderType.INVOICE)
            {
                deliverInvoiceDetails = new DeliverInvoiceDetails
                {
                    InvoiceDistributionType = ConvertInvoiceDistributionType(_order.GetInvoiceDistributionType()),
                    InvoiceIdToCredit       = _order.GetCreditInvoice(),
                    IsCreditInvoice         = _order.GetCreditInvoice().HasValue,
                    NumberOfCreditDays      = _order.GetNumberOfCreditDays(),
                    OrderRows = formatter.FormatRows().ToArray()
                };
            }

            _orderInformation = new DeliverOrderInformation
            {
                DeliverInvoiceDetails = deliverInvoiceDetails,
                OrderType             = ConvertOrderType(_order.GetOrderType()),
                SveaOrderId           = _order.GetOrderId()
            };

            _sveaDeliverOrder = new DeliverOrderEuRequest
            {
                Auth = GetStoreAuthorization(),
                DeliverOrderInformation = _orderInformation
            };

            return(_sveaDeliverOrder);
        }
        private static string ValidateInvoiceDetails(DeliverOrderBuilder order)
        {
            string errors = "";

            if (order.GetOrderId() > 0 && order.GetOrderType() == OrderType.INVOICE &&
                (order.GetInvoiceDistributionType() == DistributionType.NONE ||
                 !Enum.IsDefined(typeof(DistributionType), order.GetInvoiceDistributionType())))
            {
                errors += "MISSING VALUE - SetInvoiceDistributionType is required for DeliverInvoiceOrder.\n";
            }

            if (order.GetInvoiceDistributionType() == DistributionType.EINVOICEB2B && order.GetCountryCode() != CountryCode.NO)
            {
                errors += "NOT VALID - Invalid country code, must be CountryCode.NO if InvoiceDistributionType is DistributionType.EInvoiceB2B.\n";
            }

            if (order.GetInvoiceDistributionType() == DistributionType.EINVOICEB2B && order.GetOrderType() == OrderType.PAYMENTPLAN)
            {
                errors += "NOT VALID - Invalid payment method, DistributionType.EINVOICEB2B can only be used when payment method is invoice.\n";
            }

            return(errors);
        }
 private static string ValidateOrderId(DeliverOrderBuilder order)
 {
     return order.GetOrderId() <= 0 ? "MISSING VALUE - SetOrderId is required." : "";
 }
Exemplo n.º 6
0
 private static string ValidateOrderId(DeliverOrderBuilder order)
 {
     return(order.GetOrderId() <= 0 ? "MISSING VALUE - SetOrderId is required." : "");
 }
Exemplo n.º 7
0
        public void TestBuildRequest()
        {
            DeliverOrderBuilder request = _order.SetOrderId(54086L);

            Assert.That(request.GetOrderId(), Is.EqualTo(54086L));
        }