Exemplo n.º 1
0
 private static ISequenceStartingWithOne <Invoice> SimplifiedInvoiceForCustomer()
 {
     return(SequenceStartingWithOne.FromPreordered(NonEmptyEnumerable.Create(
                                                       new Invoice(SimplifiedInvoice.Create(
                                                                       info: CreateInvoiceInfo(),
                                                                       revenueItems: SequenceStartingWithOne.FromPreordered(NonEmptyEnumerable.Create(
                                                                                                                                NonNegativeRevenue.Create(NonNegativeAmount.Create(20.50m).Success.Get(), NonNegativeAmount.Create(10.50m).Success.Get(), CreateRevenueInfo(TaxType.Vat13, RevenueType.Products)).Success.Get(),
                                                                                                                                NonNegativeRevenue.Create(NonNegativeAmount.Create(20.50m).Success.Get(), NonNegativeAmount.Create(10.50m).Success.Get(), CreateRevenueInfo(TaxType.Vat13, RevenueType.Services)).Success.Get(),
                                                                                                                                NonNegativeRevenue.Create(NonNegativeAmount.Create(20.50m).Success.Get(), NonNegativeAmount.Create(10.50m).Success.Get(), CreateRevenueInfo(TaxType.Vat13, RevenueType.Other)).Success.Get()
                                                                                                                                )),
                                                                       payments: NonEmptyEnumerable.Create(
                                                                           NonNegativePayment.Create(NonNegativeAmount.Create(31m).Success.Get(), PaymentType.Cash).Success.Get(),
                                                                           NonNegativePayment.Create(NonNegativeAmount.Create(31m).Success.Get(), PaymentType.OnCredit).Success.Get(),
                                                                           NonNegativePayment.Create(NonNegativeAmount.Create(31m).Success.Get(), PaymentType.DomesticPaymentsAccountNumber).Success.Get()
                                                                           )
                                                                       ).Success.Get())
                                                       )));
 }
 private LRfacturasEmitidasType Convert(SimplifiedInvoice invoice)
 {
     return(new LRfacturasEmitidasType
     {
         PeriodoLiquidacion = Convert(invoice.TaxPeriod),
         IDFactura = Convert(invoice.Id),
         FacturaExpedida = new FacturaExpedidaType
         {
             TipoFactura = ClaveTipoFacturaType.F2,
             ClaveRegimenEspecialOTrascendencia = Convert(invoice.SchemeOrEffect),
             ImporteTotal = invoice.TotalAmount.Serialize(),
             DescripcionOperacion = invoice.Description.Value,
             TipoDesglose = Convert(invoice.TaxBreakdown),
             EmitidaPorTercerosODestinatarioSpecified = true,
             EmitidaPorTercerosODestinatario = Convert(invoice.IssuedByThirdParty)
         }
     });
 }
Exemplo n.º 3
0
        /// <summary>
        /// Create simplified invoice
        /// </summary>
        /// <param name="client">Client identification</param>
        /// <param name="invoice">Purchase information</param>
        /// <param name="isToClose">Should the document be closed (true) in which case it cannot be later changed and a PDF and document number are generated or should the document be created as a draft (false) in which case no PDF or document number are generated.</param>
        /// <param name="sentTo">Upon closing the document an email can be sent with a notification of the document to an email address.</param>
        public APIDocumentCreateResponse InvoiceSimplifiedCreate(Models.Client client, SimplifiedInvoice invoice, bool isToClose, string sentTo)
        {
            Invoicing_v2.InvoicingSoapClient apiClient = GetAPIClient();
            Invoicing_v2.Client invoiceClient          = ToInvoicingClient(client);

            DocumentIn document = ToInvoicingDocument(invoice);

            var serviceResponse = apiClient.DocumentCreateAsync(GetAuthenticationCredentials(), invoiceClient, document, isToClose, sentTo).Result;

            return(new APIDocumentCreateResponse(serviceResponse));
        }