static void Main(string[] args) { AquariumLogin login = new AquariumLogin(); login.LoginToAquarium(); LoggedOnUserResult theUserResult = login.GetLoggedOnUserResult(); Datalayer.Xero.Interresolve.AquariumUserManagement.SessionDetails sessionDetails = new Datalayer.Xero.Interresolve.AquariumUserManagement.SessionDetails(); //set this from the logon //set the USER sesson sessionDetails.SessionKey = theUserResult.SessionKey; sessionDetails.Username = theUserResult.Username; sessionDetails.ThirdPartySystemId = 29; //map a custom session Datalayer.Xero.Interresolve.AquariumCustomProcessing.SessionDetails customSessionDetails = new Datalayer.Xero.Interresolve.AquariumCustomProcessing.SessionDetails(); customSessionDetails.SessionKey = sessionDetails.SessionKey; customSessionDetails.ThirdPartySystemId = 29; customSessionDetails.Username = theUserResult.Username; //set the session details here CustomProcessingSoapClient customSdk = new CustomProcessingSoapClient(); //now call the 'QueryInvoices Method OutboundInvoiceLineItemList theOutboundInvoices = new OutboundInvoiceLineItemList(); //gets all invoices theOutboundInvoices.Get(); //do something with them List<DataTable> InvoiceOptions = OutboundInvoiceLineItemList.GetInvoiceOptions(); /* //string InvoiceType = "Sales Invoice"; //map to xml var InvoicesThisMonth = (from invoice in theResults.AsEnumerable() .Where(x => x.Field<string>("WhenCreated").ToString().Substring(3, 5) == DateTime.Now.ToString("dd/MM/yy").Substring(3, 5)) //this month .Where(x => x.Field<string>("Invoice Type").ToString() = InvoiceType) //sales invoices .Where(x => x.Field<string>("Imported Into Sage").ToString().ToLower() == "false") //not been imported .Where( (x => x.Field<string>("Imported Into Sage").ToString() == "Claimant's InterResolve Scheme Fee")) select invoice ); //post */ }
public void PushDummyInvoiceToAllXeroCompanies() { List<InterResolveXeroService> AllTheInterResolveCompanies = new List<InterResolveXeroService>(); InterResolveXeroService InterResolve_LtdService = new InterResolveXeroService(InterResolveXeroService.InterResolveXeroOrganisation.InterResolve_Ltd); InterResolveXeroService MotorResolve_LtdService = new InterResolveXeroService(InterResolveXeroService.InterResolveXeroOrganisation.MotorResolve_Ltd); InterResolveXeroService InterMediation_Group_LtdService = new InterResolveXeroService(InterResolveXeroService.InterResolveXeroOrganisation.InterMediation_Group_Ltd); InterResolveXeroService InterResolve_Claims_LtdService = new InterResolveXeroService(InterResolveXeroService.InterResolveXeroOrganisation.InterResolve_Claims_Ltd); InterResolveXeroService InterResolve_Holdings_LtdService = new InterResolveXeroService(InterResolveXeroService.InterResolveXeroOrganisation.InterResolve_Holdings_Ltd); AllTheInterResolveCompanies.Add(InterResolve_LtdService); AllTheInterResolveCompanies.Add(MotorResolve_LtdService); AllTheInterResolveCompanies.Add(InterMediation_Group_LtdService); AllTheInterResolveCompanies.Add(InterResolve_Claims_LtdService); AllTheInterResolveCompanies.Add(InterResolve_Holdings_LtdService); OutboundInvoiceLineItemList someInvoices = new OutboundInvoiceLineItemList(); someInvoices.Get(); XeroApi.Model.Invoice anInvoice = OutboundInvoiceLineItem.ConvertSingleLineItemOutboundInvoiceToXeroInvoice(someInvoices.OutboundInvoiceLineItems.FirstOrDefault()); foreach (var company in AllTheInterResolveCompanies) { // Assert.IsTrue(company.PostOutboundInvoiceToXero(anInvoice)); } }
public void TestXeroLogin() { // var test = InboundInvoice.GetAllAquariumPurchaseInvoiceNumbers(); List<InterResolveXeroService> AllTheInterResolveCompanies = new List<InterResolveXeroService>(); InterResolveXeroService InterResolve_LtdService = new InterResolveXeroService(InterResolveXeroService.InterResolveXeroOrganisation.InterResolve_Ltd); InterResolveXeroService MotorResolve_LtdService = new InterResolveXeroService(InterResolveXeroService.InterResolveXeroOrganisation.MotorResolve_Ltd); InterResolveXeroService InterMediation_Group_LtdService = new InterResolveXeroService(InterResolveXeroService.InterResolveXeroOrganisation.InterMediation_Group_Ltd); InterResolveXeroService InterResolve_Claims_LtdService = new InterResolveXeroService(InterResolveXeroService.InterResolveXeroOrganisation.InterResolve_Claims_Ltd); // InterResolveXeroService InterResolve_Holdings_LtdService = new InterResolveXeroService(InterResolveXeroService.InterResolveXeroOrganisation.InterResolve_Holdings_Ltd); AllTheInterResolveCompanies.Add(InterResolve_LtdService); AllTheInterResolveCompanies.Add(MotorResolve_LtdService); AllTheInterResolveCompanies.Add(InterMediation_Group_LtdService); AllTheInterResolveCompanies.Add(InterResolve_Claims_LtdService); // AllTheInterResolveCompanies.Add(InterResolve_Holdings_LtdService); OutboundInvoiceLineItemList someInvoices = new OutboundInvoiceLineItemList(); someInvoices.Get(); XeroApi.Model.Invoice anInvoice = OutboundInvoiceLineItem.ConvertSingleLineItemOutboundInvoiceToXeroInvoice(someInvoices.OutboundInvoiceLineItems.FirstOrDefault()); foreach (var company in AllTheInterResolveCompanies) { company.LoginToXero(); anInvoice.LineItems.ElementAt(0).LineAmount = 20; anInvoice.LineItems.ElementAt(0).UnitAmount = 20; XeroApi.Model.Contact theXeroContact = new XeroApi.Model.Contact(); theXeroContact.Name = "Test Contact"; anInvoice.Contact = theXeroContact; var InvoiceResponse = company.XeroRepository.Create<XeroApi.Model.Invoice>(anInvoice); } }