public OperationResult CreateInvoice(InvoiceCreate invoiceCreateRequest, Guid processId) { OperationResult responseObject = new OperationResult(); try { InvoiceCreate invoiceCreateProperties = invoiceCreateRequest; if (invoiceCreateProperties != null) { JObject newInvoice = this.GetCreateInvoiceJsonStructure(invoiceCreateProperties, processId); responseObject = this.InvoiceCreateRequest(newInvoice, processId); } } catch (Exception ex) { LogEventInfo log = new LogEventInfo(LogLevel.Error, Logger.Name, null, "", null, new Exception(ex.ToString())); log.Properties["ProcessID"] = processId; log.Properties["AppID"] = AboxDynamicsBase.Classes.Constants.ApplicationIdWebAPI; log.Properties["MethodName"] = System.Reflection.MethodBase.GetCurrentMethod().Name; Logger.Log(log); //Logger.Error(ex,""); responseObject.Code = ""; responseObject.Message = ex.ToString(); responseObject.IsSuccessful = false; responseObject.Data = null; } return(responseObject); }
public override bool CanExecute(object parameter) { if (parameter.ToString() == "AddGuest") { return(InvoiceCreate.IsGeldig()); } return(true); }
public ActionResult Index(InvoiceCreateViewModel Model) { //1. 設定開立發票資訊 InvoiceCreate invc = new InvoiceCreate(); invc.MerchantID = Model.MerchantID; invc.RelateNumber = Model.RelateNumber; invc.AllPayMid = Model.AllPayMid; invc.CarruerNum = Model.CarruerNum; invc.ClearanceMark = Model.ClearanceMark; invc.carruerType = Model.CarruerType; invc.CarruerNum = Model.CarruerNum; invc.Print = Model.Print; invc.Donation = Model.Donation; invc.CustomerID = Model.CustomerID; invc.CustomerIdentifier = Model.CustomerIdentifier; invc.CustomerAddr = Model.CustomerAddr; invc.CustomerName = Model.CustomerName; invc.CustomerPhone = Model.CustomerPhone; invc.CustomerEmail = Model.CustomerEmail; invc.SalesAmount = Model.SalesAmount; invc.LoveCode = Model.LoveCode; invc.vat = Model.vat; invc.TaxType = Model.TaxType; invc.invType = Model.InvType; invc.Items.Add(new Item() { ItemName = Model.ItemName, ItemPrice = Model.ItemPrice, ItemCount = Model.ItemCount, ItemWord = Model.ItemWord, ItemAmount = Model.ItemAmount }); //2. 初始化發票Service物件 Invoice <InvoiceCreate> inv = new Invoice <InvoiceCreate>(); //3. 指定測試環境, 上線時請記得改Prod inv.Environment = EInvoice.Integration.Enumeration.EnvironmentEnum.Stage; //4. 設定歐付寶提供的 Key 和 IV inv.HashIV = "q9jcZX8Ib9LM8wYk"; inv.HashKey = "ejCk326UnaZWKisg"; //5. 執行API的回傳結果(JSON)字串 string json = inv.post(invc); //6. 解序列化,還原成物件使用 //InvoiceCreateReturn obj = new InvoiceCreateReturn(); //obj = JsonConvert.DeserializeObject<InvoiceCreateReturn>(json); //obj.XXX; // ... ViewBag.message = json; return(View()); }
public ActionResult Index(InvoiceCreateViewModel Model) { //1. 設定開立發票資訊 InvoiceCreate invc = new InvoiceCreate(); invc.MerchantID = Model.MerchantID; invc.RelateNumber = Model.RelateNumber; invc.AllPayMid = Model.AllPayMid; invc.CarruerNum = Model.CarruerNum; invc.ClearanceMark = Model.ClearanceMark; invc.carruerType = Model.CarruerType; invc.CarruerNum = Model.CarruerNum; invc.Print = Model.Print; invc.Donation = Model.Donation; invc.CustomerID = Model.CustomerID; invc.CustomerIdentifier = Model.CustomerIdentifier; invc.CustomerAddr = Model.CustomerAddr; invc.CustomerName = Model.CustomerName; invc.CustomerPhone = Model.CustomerPhone; invc.CustomerEmail = Model.CustomerEmail; invc.SalesAmount = Model.SalesAmount; invc.LoveCode = Model.LoveCode; invc.vat = Model.vat; invc.TaxType = Model.TaxType; invc.invType = Model.InvType; invc.Items.Add(new Item() { ItemName = Model.ItemName, ItemPrice = Model.ItemPrice, ItemCount = Model.ItemCount, ItemWord = Model.ItemWord, ItemAmount = Model.ItemAmount }); //2. 初始化發票Service物件 Invoice<InvoiceCreate> inv = new Invoice<InvoiceCreate>(); //3. 指定測試環境, 上線時請記得改Prod inv.Environment = EInvoice.Integration.Enumeration.EnvironmentEnum.Stage; //4. 設定歐付寶提供的 Key 和 IV inv.HashIV = "q9jcZX8Ib9LM8wYk"; inv.HashKey = "ejCk326UnaZWKisg"; //5. 執行API的回傳結果(JSON)字串 string json = inv.post(invc); //6. 解序列化,還原成物件使用 //InvoiceCreateReturn obj = new InvoiceCreateReturn(); //obj = JsonConvert.DeserializeObject<InvoiceCreateReturn>(json); //obj.XXX; // ... ViewBag.message = json; return View(); }
public IHttpActionResult Create([FromBody] InvoiceCreate invoiceCreateRequest) { Guid processId = Guid.NewGuid(); LogEventInfo log = new LogEventInfo(LogLevel.Debug, Logger.Name, $"ProcessID: {processId} Request hacia {Request.RequestUri} con el JSON:**START** {JsonConvert.SerializeObject(invoiceCreateRequest)} **END**"); log.Properties["ProcessID"] = processId; log.Properties["AppID"] = AboxDynamicsBase.Classes.Constants.ApplicationIdWebAPI; log.Properties["MethodName"] = System.Reflection.MethodBase.GetCurrentMethod().Name; Logger.Log(log); EInvoice invoiceProcedures = new EInvoice(); OperationResult response = null; try { if (invoiceCreateRequest != null) { response = invoiceProcedures.CreateInvoice(invoiceCreateRequest, processId); if (response.IsSuccessful) { return(Ok(response)); } else { return(Content(HttpStatusCode.InternalServerError, response)); } } else { return(Content(HttpStatusCode.BadRequest, new OperationResult { Code = "", IsSuccessful = false, Data = null, Message = "La solicitud JSON enviada es incorrecta" })); } } catch (Exception ex) { LogEventInfo logEx = new LogEventInfo(LogLevel.Error, Logger.Name, null, $"Request hacia {Request.RequestUri} con el JSON:**START** {JsonConvert.SerializeObject(invoiceCreateRequest)} **END**", null, new Exception(ex.ToString())); logEx.Properties["ProcessID"] = processId; logEx.Properties["AppID"] = Constants.ApplicationIdWebAPI; logEx.Properties["MethodName"] = System.Reflection.MethodBase.GetCurrentMethod().Name; Logger.Log(logEx); return(Content(HttpStatusCode.InternalServerError, new OperationResult { IsSuccessful = false, Data = null, Message = ex.ToString(), Code = "" })); } }
public void GetXmlTest() { string expected = @"<?xml version=""1.0"" encoding=""utf-8""?> <function controlid=""unittest""> <create_invoice> <customerid>CUSTOMER1</customerid> <datecreated> <year>2015</year> <month>06</month> <day>30</day> </datecreated> <termname>N30</termname> <invoiceitems> <lineitem> <glaccountno /> <amount>76343.43</amount> </lineitem> </invoiceitems> </create_invoice> </function>"; Stream stream = new MemoryStream(); XmlWriterSettings xmlSettings = new XmlWriterSettings(); xmlSettings.Encoding = Encoding.UTF8; xmlSettings.Indent = true; xmlSettings.IndentChars = " "; IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings); InvoiceCreate record = new InvoiceCreate("unittest"); record.CustomerId = "CUSTOMER1"; record.TransactionDate = new DateTime(2015, 06, 30); record.PaymentTerm = "N30"; InvoiceLineCreate line1 = new InvoiceLineCreate(); line1.TransactionAmount = 76343.43M; record.Lines.Add(line1); record.WriteXml(ref xml); xml.Flush(); stream.Position = 0; StreamReader reader = new StreamReader(stream); Diff xmlDiff = DiffBuilder.Compare(expected).WithTest(reader.ReadToEnd()) .WithDifferenceEvaluator(DifferenceEvaluators.Default) .Build(); Assert.IsFalse(xmlDiff.HasDifferences(), xmlDiff.ToString()); }
public IHttpActionResult PostInvoice([FromBody] InvoiceCreate invoice) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var service = new InvoiceService(); if (!service.CreateInvoice(invoice)) { return(InternalServerError()); } return(Ok("Invoice successfully added.")); }
public IHttpActionResult CreateInvoice(InvoiceCreate invoice) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var svc = CreateInvoiceService(); if (!svc.CreateInvoice(invoice)) { return(InternalServerError()); } return(Ok("201")); }
public bool CreateInvoice(InvoiceCreate model) { var entity = new Invoice() { MemberID = model.MemberID, InvoiceDescription = model.InvoiceDescription, InvoiceDueDate = model.InvoiceDueDate, MonthlyFee = model.MonthlyFee, InvoiceIsPaid = model.InvoiceIsPaid, }; using (var ctx = new ApplicationDbContext()) { ctx.Invoices.Add(entity); return(ctx.SaveChanges() == 1); } }
public bool CreateInvoice(InvoiceCreate model) { var entity = new Invoice() { OwnerId = _userId, CompanyName = model.CompanyName, CompanyAddress = model.CompanyAddress, BillName = model.BillName, BillAddress = model.BillAddress, CreatedUtc = DateTimeOffset.Now }; using (var ctx = new ApplicationDbContext()) { ctx.Invoices.Add(entity); return(ctx.SaveChanges() == 1); } }
public ActionResult Create(InvoiceCreate model) { if (!ModelState.IsValid) { return(View(model)); } var svc = CreateInvoiceService(); if (svc.CreateInvoice(model)) { TempData["SaveResult"] = "Your invoice was created!"; return(RedirectToAction("Index")); } ModelState.AddModelError("", "Invoice was unable to be created"); return(View(model)); }
public async Task <OperationResult <InvoiceDetails> > AddInvoice(InvoiceCreate invoiceToCreate, CancellationToken cancellationToken) { var result = new OperationResult <InvoiceDetails>(); try { _unitOfWork.BeginTransaction(); var createInvoice = _mapper.Map <InvoiceCreate, Invoice>(invoiceToCreate); var invoiceAdded = _unitOfWork.GetRepository <Invoice>().Add(createInvoice); _unitOfWork.SaveChanges(); _unitOfWork.Commit(); result.Entity = _mapper.Map <Invoice, InvoiceDetails>(invoiceAdded); } catch (Exception) { _unitOfWork.Rollback(); result.Errors.Add("ServerErrorMessage", "Server error occurred"); throw; } return(result); }
public void GetXmlTest() { string expected = @"<?xml version=""1.0"" encoding=""utf-8""?> <function controlid=""unittest""> <create_invoice> <customerid>CUSTOMER1</customerid> <datecreated> <year>2015</year> <month>06</month> <day>30</day> </datecreated> <termname>N30</termname> <invoiceitems> <lineitem> <glaccountno /> <amount>76343.43</amount> </lineitem> </invoiceitems> </create_invoice> </function>"; InvoiceCreate record = new InvoiceCreate("unittest") { CustomerId = "CUSTOMER1", TransactionDate = new DateTime(2015, 06, 30), PaymentTerm = "N30" }; InvoiceLineCreate line1 = new InvoiceLineCreate { TransactionAmount = 76343.43M }; record.Lines.Add(line1); this.CompareXml(expected, record); }
public async Task <IActionResult> CreateInvoice([FromBody] InvoiceCreate invoiceCreate, CancellationToken cancellationToken) { return(Resolve(await _invoiceService.AddInvoice(invoiceCreate, cancellationToken), HttpStatusCode.Created)); }
public void TestInvoiceCreate() { //1. 設定開立發票資訊 var invoice = new InvoiceCreate { //廠商編號。 MerchantID = "2000132", //商家自訂訂單編號 RelateNumber = "ecPay" + new Random().Next(0, 99999), //客戶代號 CustomerID = "", //統一編號 CustomerIdentifier = "", //客戶名稱 CustomerName = "", //客戶地址 CustomerAddr = "客戶地址", //客戶手機號碼 CustomerPhone = "0912345678", //客戶電子信箱 CustomerEmail = "*****@*****.**", //通關方式 //ClearanceMark = CustomsClearanceMarkEnum.None; //列印註記 Print = PrintEnum.No, //捐贈註記 Donation = DonationEnum.No, //愛心碼 LoveCode = "", //載具類別 carruerType = CarruerTypeEnum.PhoneBarcode, //依API說明,把+號換成空白 CarruerNum = "/6G+X3LQ".Replace('+', ' '), //課稅類別 //TaxType = TaxTypeEnum.DutyFree; //發票金額。含稅總金額。 SalesAmount = "300", //備註 InvoiceRemark = "(qwrrg)", //發票字軌類別 invType = TheWordTypeEnum.Normal, //商品單價是否含稅 //vat = VatEnum.No, }; //2. 商品資訊(Item)的集合類別。 invoice.Items.Add(new Item { ItemName = "糧食", //商品名稱 ItemCount = "1", //商品數量 ItemWord = "個", //單位 ItemPrice = "100.1", //商品單價 //ItemTaxType =TaxTypeEnum.DutyFree//商品課稅別 ItemAmount = "100.1", //總金額 }); invoice.Items.Add(new Item { ItemName = "糧食", //商品名稱 ItemPrice = "200", //商品單價 ItemCount = "1", //商品數量 ItemWord = "個", //單位 ItemAmount = "200", //總金額 //ItemTaxType = TaxTypeEnum.DutyFree//商品課稅別 }); //3. 執行API的回傳結果 var response = Client.Post <InvoiceCreateReturn, InvoiceCreate>(invoice); //表示成功 Assert.AreEqual("1", response.RtnCode); //要有時間 Assert.AreNotEqual("", response.InvoiceDate); //要有號碼 Assert.AreNotEqual("", response.InvoiceNumber); //要有隨機碼 Assert.AreNotEqual("", response.RandomNumber); }
public void GetAllXmlTest() { string expected = @"<?xml version=""1.0"" encoding=""utf-8""?> <function controlid=""unittest""> <create_invoice> <customerid>CUSTOMER1</customerid> <datecreated> <year>2015</year> <month>06</month> <day>30</day> </datecreated> <dateposted> <year>2015</year> <month>06</month> <day>30</day> </dateposted> <datedue> <year>2020</year> <month>09</month> <day>24</day> </datedue> <termname>N30</termname> <action>Submit</action> <batchkey>20323</batchkey> <invoiceno>234</invoiceno> <ponumber>234235</ponumber> <onhold>true</onhold> <description>Some description</description> <externalid>20394</externalid> <billto> <contactname>28952</contactname> </billto> <shipto> <contactname>289533</contactname> </shipto> <basecurr>USD</basecurr> <currency>USD</currency> <exchratedate> <year>2015</year> <month>06</month> <day>30</day> </exchratedate> <exchratetype>Intacct Daily Rate</exchratetype> <nogl>false</nogl> <supdocid>6942</supdocid> <customfields> <customfield> <customfieldname>customfield1</customfieldname> <customfieldvalue>customvalue1</customfieldvalue> </customfield> </customfields> <invoiceitems> <lineitem> <glaccountno /> <amount>76343.43</amount> </lineitem> </invoiceitems> </create_invoice> </function>"; Stream stream = new MemoryStream(); XmlWriterSettings xmlSettings = new XmlWriterSettings(); xmlSettings.Encoding = Encoding.UTF8; xmlSettings.Indent = true; xmlSettings.IndentChars = " "; IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings); InvoiceCreate record = new InvoiceCreate("unittest") { CustomerId = "CUSTOMER1", TransactionDate = new DateTime(2015, 06, 30), GlPostingDate = new DateTime(2015, 06, 30), DueDate = new DateTime(2020, 09, 24), PaymentTerm = "N30", Action = "Submit", SummaryRecordNo = 20323, InvoiceNumber = "234", ReferenceNumber = "234235", OnHold = true, Description = "Some description", ExternalId = "20394", BillToContactName = "28952", ShipToContactName = "289533", BaseCurrency = "USD", TransactionCurrency = "USD", ExchangeRateDate = new DateTime(2015, 06, 30), ExchangeRateType = "Intacct Daily Rate", DoNotPostToGL = false, AttachmentsId = "6942", CustomFields = new Dictionary <string, dynamic> { { "customfield1", "customvalue1" } }, }; InvoiceLineCreate line1 = new InvoiceLineCreate(); line1.TransactionAmount = 76343.43M; record.Lines.Add(line1); record.WriteXml(ref xml); xml.Flush(); stream.Position = 0; StreamReader reader = new StreamReader(stream); Diff xmlDiff = DiffBuilder.Compare(expected).WithTest(reader.ReadToEnd()) .WithDifferenceEvaluator(DifferenceEvaluators.Default) .Build(); Assert.IsFalse(xmlDiff.HasDifferences(), xmlDiff.ToString()); }
private JObject GetCreateInvoiceJsonStructure(InvoiceCreate invoiceProperties, Guid processId) { OperationResult result = new OperationResult(); JObject jObject = new JObject(); CountryEntity countryEntity = new CountryEntity(); try { if (invoiceProperties != null) { if (invoiceProperties.billDate != null) { DateTime date = DateTime.Parse(invoiceProperties.billDate); jObject.Add($"{InvoiceFields.PurchaseDate}", date.ToString("yyyy-MM-dd")); } if (invoiceProperties.patientId > 0) { jObject.Add($"{InvoiceSchemas.CustomerIdSchema}@odata.bind", $"/{contactEntity.EntityPluralName}({ContactFields.IdAboxPatient}={invoiceProperties.patientId})"); } if (invoiceProperties.patientId > 0) { jObject.Add($"{InvoiceSchemas.CustomerContactSchema}@odata.bind", $"/{contactEntity.EntityPluralName}({ContactFields.IdAboxPatient}={invoiceProperties.patientId})"); } if (!(String.IsNullOrEmpty(invoiceProperties.billImageUrl))) { jObject.Add(InvoiceFields.InvoiceImageWebUrl, invoiceProperties.billImageUrl); } if (!(String.IsNullOrEmpty(invoiceProperties.pharmacyId))) { jObject.Add($"{InvoiceSchemas.Pharmacy}@odata.bind", $"/{pharmacyEntity.EntityPluralName}({PharmacyFields.Id}='{invoiceProperties.pharmacyId}')"); } if (!(String.IsNullOrEmpty(invoiceProperties.billId))) { jObject.Add(InvoiceFields.InvoiceNumber, invoiceProperties.billId); } if (invoiceProperties.products != null) { var serialized = JsonConvert.SerializeObject(invoiceProperties.products); jObject.Add($"{InvoiceFields.ProductsSelectedJson}", serialized); } if (invoiceProperties.nonAboxProducts != null) { var serialized = JsonConvert.SerializeObject(invoiceProperties.nonAboxProducts); jObject.Add($"{InvoiceFields.NonAboxProductsSelectedJson}", serialized); } if (invoiceProperties.idFromDatabase != null) { jObject.Add($"{InvoiceFields.IdAboxInvoice}", invoiceProperties.idFromDatabase); } if (!(String.IsNullOrEmpty(invoiceProperties.country))) { jObject.Add($"{InvoiceSchemas.Country}@odata.bind", $"/{countryEntity.EntityPluralName}({CountryFields.IdCountry}='{invoiceProperties.country}')"); } if (!String.IsNullOrEmpty(invoiceProperties.status)) { int status = sharedMethods.GetInvoiceStatusValue(invoiceProperties.status); if (status > -1) { jObject.Add(InvoiceFields.StatusCode, status); } } if (!String.IsNullOrEmpty(invoiceProperties.statusReason)) { jObject.Add(InvoiceFields.StatusReason, invoiceProperties.statusReason); } if (invoiceProperties.revisionTime1 != null && invoiceProperties.revisionTime1 > -1) { jObject.Add(InvoiceFields.RevisionTime1, invoiceProperties.revisionTime1); } if (invoiceProperties.revisionTime2 != null && invoiceProperties.revisionTime2 > -1) { jObject.Add(InvoiceFields.RevisionTime2, invoiceProperties.revisionTime2); } if (invoiceProperties.totalAmount != null) { jObject.Add(InvoiceFields.TotalAmount, invoiceProperties.totalAmount); } if (!String.IsNullOrEmpty(invoiceProperties.purchaseMethod)) { int purchaseMethodCode = sharedMethods.GetInvoicePurchaseMethodValue(invoiceProperties.purchaseMethod); if (purchaseMethodCode > -1) { jObject.Add(InvoiceFields.PurchaseMethod, purchaseMethodCode); } } //////////// } return(jObject); } catch (Exception ex) { LogEventInfo log = new LogEventInfo(LogLevel.Error, Logger.Name, null, "", null, new Exception(ex.ToString())); log.Properties["ProcessID"] = processId; log.Properties["AppID"] = AboxDynamicsBase.Classes.Constants.ApplicationIdWebAPI; log.Properties["MethodName"] = System.Reflection.MethodBase.GetCurrentMethod().Name; Logger.Log(log); jObject = null; return(jObject); } }
public ActionResult Index() { //1. 設定開立發票資訊 InvoiceCreate invc = new InvoiceCreate(); invc.MerchantID = "2000132"; //廠商編號。 invc.RelateNumber = "ecPay" + new Random().Next(0, 99999).ToString(); //商家自訂訂單編號 invc.CustomerID = ""; //客戶代號 invc.CustomerIdentifier = ""; //統一編號 invc.CustomerName = ""; //客戶名稱 invc.CustomerAddr = "客戶地址"; //客戶地址 invc.CustomerPhone = "0912345678"; //客戶手機號碼 invc.CustomerEmail = "*****@*****.**"; //客戶電子信箱 //invc.ClearanceMark = CustomsClearanceMarkEnum.None;//通關方式 invc.Print = PrintEnum.No; //列印註記 invc.Donation = DonationEnum.No; //捐贈註記 invc.LoveCode = ""; //愛心碼 invc.carruerType = CarruerTypeEnum.PhoneBarcode; //載具類別 invc.CarruerNum = "/6G+X3LQ"; //invc.CarruerNum = invc.CarruerNum.Replace('+', ' '); //依API說明,把+號換成空白 //invc.TaxType = TaxTypeEnum.DutyFree;//課稅類別 invc.SalesAmount = "30"; //發票金額。含稅總金額。 invc.InvoiceRemark = "(qwrrg)"; //備註 invc.invType = TheWordTypeEnum.Normal; //發票字軌類別 invc.vat = VatEnum.Yes; //商品單價是否含稅 //商品資訊(Item)的集合類別。 invc.Items.Add(new Item() { ItemName = "魚骨幣", //商品名稱 ItemCount = "1", //商品數量 ItemWord = "箱", //單位 ItemPrice = "30", //商品單價 //ItemTaxType =TaxTypeEnum.DutyFree//商品課稅別 ItemAmount = "30", //總金額 ItemTaxType = TaxTypeEnum.Taxable.ToString() }); /* invc.Items.Add(new Item() * { * ItemName = "糧食",//商品名稱 * ItemPrice = "200",//商品單價 * ItemCount = "1",//商品數量 * ItemWord = "個",//單位 * ItemAmount = "200",//總金額 * //ItemTaxType =TaxTypeEnum.DutyFree//商品課稅別 * });*/ //2. 初始化發票Service物件 Invoice <InvoiceCreate> inv = new Invoice <InvoiceCreate>(); //3. 指定測試環境, 上線時請記得改Prod inv.Environment = AllPay.EInvoice.Integration.Enumeration.EnvironmentEnum.Stage; //4. 設定歐付寶提供的 Key 和 IV inv.HashIV = "q9jcZX8Ib9LM8wYk"; inv.HashKey = "ejCk326UnaZWKisg"; //5. 執行API的回傳結果(JSON)字串 string json = inv.post(invc); bool check = isJSON2(json); string temp = string.Empty; if (check) //判斷是不是json格式 { //6. 解序列化,還原成物件使用 InvoiceCreateReturn obj = new InvoiceCreateReturn(); obj = JsonConvert.DeserializeObject <InvoiceCreateReturn>(json); temp = string.Format("開立發票結果<br> InvoiceDate={0}<br> InvoiceNumber={1}<br> RandomNumber={2}<br> RtnCode={3} <br> RtnCode={4} ", obj.InvoiceDate, obj.InvoiceNumber, obj.RandomNumber, obj.RtnCode, obj.RtnMsg); } else { temp = json; } Response.Write(temp); return(View()); }
public IHttpActionResult Create(InvoiceCreate request) { var invoice = _invoiceService.Create(request); return(Ok(invoice)); }
public void GetAllXmlTest() { string expected = @"<?xml version=""1.0"" encoding=""utf-8""?> <function controlid=""unittest""> <create_invoice> <customerid>CUSTOMER1</customerid> <datecreated> <year>2015</year> <month>06</month> <day>30</day> </datecreated> <dateposted> <year>2015</year> <month>06</month> <day>30</day> </dateposted> <datedue> <year>2020</year> <month>09</month> <day>24</day> </datedue> <termname>N30</termname> <action>Submit</action> <batchkey>20323</batchkey> <invoiceno>234</invoiceno> <ponumber>234235</ponumber> <onhold>true</onhold> <description>Some description</description> <externalid>20394</externalid> <billto> <contactname>28952</contactname> </billto> <shipto> <contactname>289533</contactname> </shipto> <basecurr>USD</basecurr> <currency>USD</currency> <exchratedate> <year>2015</year> <month>06</month> <day>30</day> </exchratedate> <exchratetype>Intacct Daily Rate</exchratetype> <nogl>false</nogl> <supdocid>6942</supdocid> <customfields> <customfield> <customfieldname>customfield1</customfieldname> <customfieldvalue>customvalue1</customfieldvalue> </customfield> </customfields> <invoiceitems> <lineitem> <glaccountno /> <amount>76343.43</amount> </lineitem> </invoiceitems> </create_invoice> </function>"; InvoiceCreate record = new InvoiceCreate("unittest") { CustomerId = "CUSTOMER1", TransactionDate = new DateTime(2015, 06, 30), GlPostingDate = new DateTime(2015, 06, 30), DueDate = new DateTime(2020, 09, 24), PaymentTerm = "N30", Action = "Submit", SummaryRecordNo = 20323, InvoiceNumber = "234", ReferenceNumber = "234235", OnHold = true, Description = "Some description", ExternalId = "20394", BillToContactName = "28952", ShipToContactName = "289533", BaseCurrency = "USD", TransactionCurrency = "USD", ExchangeRateDate = new DateTime(2015, 06, 30), ExchangeRateType = "Intacct Daily Rate", DoNotPostToGl = false, AttachmentsId = "6942", CustomFields = new Dictionary <string, dynamic> { { "customfield1", "customvalue1" } }, }; InvoiceLineCreate line1 = new InvoiceLineCreate { TransactionAmount = 76343.43M }; record.Lines.Add(line1); this.CompareXml(expected, record); }
public async Task <IActionResult> Create([FromBody] InvoiceCreate invoice) { return(Ok(await _invoices.CreateAsync(invoice.FromWalletId, invoice.ToWalletId, invoice.Amount, invoice.Comment))); }
public async Task<InvoiceCreate.response> InvoiceCreate(InvoiceCreate.request request, CancellationToken? token = null) { return await SendAsync<InvoiceCreate.response>(request.ToXmlString(), token.GetValueOrDefault(CancellationToken.None)); }