public async Task Http_422_should_throw_EntityValidationException()
 {
     var ublModel = new UblBuilderModel
     {
         GeneralInfoModel = new GeneralInfoBaseModel()
         {
             Ettn               = Guid.NewGuid(),
             Prefix             = null,
             InvoiceNumber      = null,
             InvoiceProfileType = InvoiceProfileType.TEMELFATURA,
             IssueDate          = DateTime.Now,
             Type               = InvoiceType.SATIS,
             CurrencyCode       = "TRY"
         },
         AddressBook = new AddressBookModel()
         {
             Alias = "urn:mail:[email protected]",
             IdentificationNumber = "1234567801111111111", //invalid vkn
         }
     };
     await Assert.ThrowsAsync <EntityValidationException>(async() =>
     {
         await outboxInvoiceClient.Post(ublModel);
     });
 }
Пример #2
0
        public async Task <CreateInvoiceResponseModel> Update(Guid id, UblBuilderModel model)
        {
            var response = await flurlClient.Request($"/v1/outboxinvoice/update/{id.ToString()}")
                           .PutJsonAsync(model)
                           .ReceiveJson <CreateInvoiceResponseModel>();

            return(response);
        }
Пример #3
0
        public async Task <CreateInvoiceResponseModel> Post(UblBuilderModel model)
        {
            var reponseModel = await flurlClient.Request($"/v1/outboxinvoice/create")
                               .PostJsonAsync(model)
                               .ReceiveJson <CreateInvoiceResponseModel>();

            return(reponseModel);
        }
Пример #4
0
        public static UblBuilderModel fillUblModel()
        {
            var ublModel     = new UblBuilderModel();
            var invoiceLines = new List <InvoiceLineBaseModel <InvoiceLineTaxBaseModel> >();

            var generalInfo = new GeneralInfoBaseModel()
            {
                Ettn               = Guid.NewGuid(),
                Prefix             = null,
                InvoiceNumber      = null,
                InvoiceProfileType = InvoiceProfileType.TEMELFATURA,
                IssueDate          = DateTime.Now,
                Type               = InvoiceType.SATIS,
                CurrencyCode       = "TRY"
            };

            var addressBook = new AddressBookModel()
            {
                Alias = "urn:mail:[email protected]",
                IdentificationNumber  = "1234567801",
                ReceiverPersonSurName = "Medyasoft Test",
                Name             = "Test Kurum Üç",
                ReceiverCity     = "İstanbul",
                ReceiverDistrict = "Üsküdar",
                ReceiverCountry  = "Türkiye"
                                   // ReceiverCountryId = 1
            };

            var invoiceLine = new InvoiceLineBaseModel <InvoiceLineTaxBaseModel>()
            {
                Amount                 = 1,
                InventoryCard          = "Test",
                DiscountAmount         = 0,
                UnitCode               = "C62",
                UnitPrice              = 100,
                VatRate                = 10,
                VatExemptionReasonCode = "201"
            };

            invoiceLines.Add(invoiceLine);

            ublModel.Status = (int)InvoiceStatus.Queued;
            // ublModel.Status = (int)InvoiceStatus.Draft; // Taslak olarak kayıt etmek isterseniz.
            ublModel.XsltCode           = null;
            ublModel.UseManualInvoiceId = false;
            ublModel.GeneralInfoModel   = generalInfo;
            ublModel.AddressBook        = addressBook;
            ublModel.InvoiceLines       = invoiceLines;
            ublModel.RecordType         = (int)RecordType.Invoice;

            ublModel.GeneralInfoModel = generalInfo;
            ublModel.AddressBook      = addressBook;
            ublModel.InvoiceLines     = invoiceLines;

            return(ublModel);
        }