private async Task <TaxpayerResponse> CreateTaxpayer(TaxlabApiClient client, string fName, string lName, string tfn) { string firstName = fName; string lastName = lName; string taxFileNumber = tfn; const int taxYear = 2021; var balanceDate = new LocalDate(2021, 6, 30); var startDate = balanceDate.PlusYears(-1).PlusDays(-1); Console.WriteLine("== Step: Creating taxpayer =========================================================="); var taxpayerService = new TaxpayerRepository(client); var taxpayerResponse = await taxpayerService.CreateAsync(taxYear, firstName, lastName, taxFileNumber); var taxpayer = taxpayerResponse.Content; client.TaxpayerId = taxpayer.Id; client.Taxyear = taxYear; Console.WriteLine("== Step: Creating tax return =========================================================="); var taxReturnRepository = new TaxReturnRepository(client); var taxReturnResponse = await taxReturnRepository.CreateAsync(taxpayer.Id, taxYear, balanceDate, startDate); if (taxReturnResponse.Success == false) { throw new Exception(taxReturnResponse.Message); } Console.WriteLine("== Step: Populating taxpayer details workpaper =========================================================="); var details = new TaxpayerDetailsRepository(client); await details.CreateAsync(taxpayer.Id, taxYear, dateOfBirth : new LocalDate(1975, 4, 12), dateOfDeath : new LocalDate(2020, 12, 31), finalReturn : true, mobilePhoneNumber : "0402698741", daytimeAreaPhoneCode : "613", daytimePhoneNumber : "54835123", emailAddress : "*****@*****.**", bsbNumber : "553026", bankAccountName : "Bank of Melbourne", bankAccountNumber : "15987456" ); return(taxpayerResponse); }
private const int TaxYear = 2021; // Change this to your taxYear private static async Task Main(string[] args) { var authService = new AuthService(); Client = new TaxlabApiClient(BaseUrl, HttpClient, authService); Console.WriteLine("== Step: Getting existing taxpayers =========================================================="); var getAllTaxpayers = await Client.Taxpayers_GetTaxpayersAsync().ConfigureAwait(false); var taxpayerService = new TaxpayerRepository(Client); var taxpayers = taxpayerService.SearchByTfn("123456789"); var allTaxpayers = taxpayerService.GetAllTaxpayers(); Console.WriteLine("== Step: Create taxpayer who is an employee with lots of deductions =========================================================="); var employeeWithDeductions = new Personas.EmployeeWithDeductions(); await employeeWithDeductions.CreateAsync(Client).ConfigureAwait(false); Console.WriteLine("== Step: Create deceased taxpayer =========================================================="); var deceasedTaxpayerPersonaFactory = new Personas.DeceasedEmployeePersona(); var deceased = await deceasedTaxpayerPersonaFactory.CreateAsync(Client).ConfigureAwait(false); Console.WriteLine("== Step: Create taxpayer with dividend =========================================================="); var investorPersonaFactory = new Personas.SingleDividend(); var investor = await investorPersonaFactory.CreateAsync(Client).ConfigureAwait(false); Console.WriteLine("== Step: Create taxpayer with lots of workpapers =========================================================="); var complexPersonaFactory = new Personas.ComplexEmployee(); var complex = await complexPersonaFactory.CreateAsync(Client).ConfigureAwait(false); var couplePersonaFactory = new Personas.MarriedCouple(); var complexMarriedCoupleObject = await couplePersonaFactory.CreateAsync(Client).ConfigureAwait(false); Console.WriteLine("== Step: Get All adjustment workpapers for complex taxpayer =========================================================="); // Gets a list of all adjustment workpapers for this taxpayer. // This does not create any new workpapers. var allAdjustmentWorkpapers = await Client.Workpapers_AdjustmentWorkpapersAsync(complex.Id, TaxYear, null) .ConfigureAwait(false); Console.WriteLine(Environment.NewLine); Console.WriteLine("== Step: Get All Taxyear workpapers for complex taxpayer =========================================================="); // Gets a list of all Taxyear workpapers for this taxpayer. // This does not create any new workpapers. var allATaxYearWorkpapers = await Client.Workpapers_TaxYearWorkpapersAsync(complex.Id, TaxYear, null) .ConfigureAwait(false); }
public async Task <TaxpayerDto> CreateAsync(TaxlabApiClient client) { const string firstName = "John"; const string lastName = "Citizen"; const string taxFileNumber = "32989432"; const int taxYear = 2021; var balanceDate = new LocalDate(2021, 6, 30); var startDate = balanceDate.PlusYears(-1).PlusDays(-1); Console.WriteLine("== Step: Creating taxpayer =========================================================="); var taxpayerService = new TaxpayerRepository(client); var taxpayerResponse = await taxpayerService.CreateAsync(taxYear, firstName, lastName, taxFileNumber); var taxpayer = taxpayerResponse.Content; client.TaxpayerId = taxpayer.Id; client.Taxyear = taxYear; Console.WriteLine("== Step: Creating tax return =========================================================="); var taxReturnRepository = new TaxReturnRepository(client); var taxReturnResponse = await taxReturnRepository.CreateAsync(taxpayer.Id, taxYear, balanceDate, startDate); Console.WriteLine("== Step: Creating Uniform workpaper =========================================================="); var deductionWorkpaper = new OtherDeductionRepository(client); await deductionWorkpaper.CreateAsync(taxpayer.Id, taxYear, -180m, ReturnDisclosureTypes.AUIndividualWorkRelatedClothingProtective, "Nice looking uniform" ); if (taxReturnResponse.Success == false) { throw new Exception(taxReturnResponse.Message); } var listOfDeductionTypes = new Dictionary <ReturnDisclosureTypes, string>(); listOfDeductionTypes.Add(ReturnDisclosureTypes.AUIndividualCostOfManagingTaxAffairsATOInterest, "Interest charged by the ATO"); listOfDeductionTypes.Add(ReturnDisclosureTypes.AUIndividualCostOfManagingTaxAffairsLitigation, "Litigation costs"); listOfDeductionTypes.Add(ReturnDisclosureTypes.AUIndividualCostOfManagingTaxAffairsOther, "Other expenses incurred in managing your tax affairs"); listOfDeductionTypes.Add(ReturnDisclosureTypes.DepreciationPool, "Deduction for project pool"); listOfDeductionTypes.Add(ReturnDisclosureTypes.AUIndividualDividendDeductions, "Dividend deductions"); listOfDeductionTypes.Add(ReturnDisclosureTypes.FarmingIncomeRepaymentsDeposits, "Deductible deposits"); listOfDeductionTypes.Add(ReturnDisclosureTypes.AUIndividualForestryManagement, "Forestry managed investment"); listOfDeductionTypes.Add(ReturnDisclosureTypes.AUIndividualGiftsOrDonations, "Gifts or donations"); listOfDeductionTypes.Add(ReturnDisclosureTypes.AUIndividualInterestDeductions, "Interest deductions"); listOfDeductionTypes.Add(ReturnDisclosureTypes.AUIndividualLowValuePoolDeductionOther, "Other low value pool deductions"); listOfDeductionTypes.Add(ReturnDisclosureTypes.AUIndividualLowValuePoolDeductionFinancialInvestment, "Relating to financial Investment"); listOfDeductionTypes.Add(ReturnDisclosureTypes.AUIndividualLowValuePoolDeductionRentalPool, "Relating to rental property"); listOfDeductionTypes.Add(ReturnDisclosureTypes.AUInvestmentIncomeDeduction, "Deduction relating to financial investment"); listOfDeductionTypes.Add(ReturnDisclosureTypes.AUIndividualElectionExpenses, "Election expenses"); listOfDeductionTypes.Add(ReturnDisclosureTypes.InsurancePremiumDeduction, "Income protection, sickness and accident insurance premiums"); listOfDeductionTypes.Add(ReturnDisclosureTypes.OtherDeductibleExpenses, "Other deductible expenses"); listOfDeductionTypes.Add(ReturnDisclosureTypes.AUIndividualWorkRelatedClothingUniformCompulsory, "Compulsory uniform"); listOfDeductionTypes.Add(ReturnDisclosureTypes.AUIndividualWorkRelatedClothingUniformNonCompulsory, "Non-compulsory uniform"); listOfDeductionTypes.Add(ReturnDisclosureTypes.AUIndividualWorkRelatedClothingOccupationSpecific, "Occupation-specific clothing"); listOfDeductionTypes.Add(ReturnDisclosureTypes.AUIndividualWorkRelatedClothingProtective, "Protective clothing"); listOfDeductionTypes.Add(ReturnDisclosureTypes.AUIndividualWorkRelatedTravelExpenses, "Work-related travel expenses"); listOfDeductionTypes.Add(ReturnDisclosureTypes.AUIndividualOtherWorkRelatedExpenses, "Other work-related expenses"); foreach (var item in listOfDeductionTypes) { await AddWorkpaper(client, taxYear, taxpayer.Id, item.Key, item.Value); await Task.Delay(2000); } return(taxpayer); }
public async Task <TaxpayerDto> CreateAsync(TaxlabApiClient client) { const string firstName = "John"; const string lastName = "Citizen"; const string taxFileNumber = "32989432"; const int taxYear = 2021; var balanceDate = new LocalDate(2021, 6, 30); var startDate = balanceDate.PlusYears(-1).PlusDays(-1); Console.WriteLine("== Step: Creating taxpayer =========================================================="); var taxpayerService = new TaxpayerRepository(client); var taxpayerResponse = await taxpayerService.CreateAsync(taxYear, firstName, lastName, taxFileNumber); var taxpayer = taxpayerResponse.Content; client.TaxpayerId = taxpayer.Id; client.Taxyear = taxYear; Console.WriteLine("== Step: Creating tax return =========================================================="); var taxReturnRepository = new TaxReturnRepository(client); var taxReturnResponse = await taxReturnRepository.CreateAsync(taxpayer.Id, taxYear, balanceDate, startDate); if (taxReturnResponse.Success == false) { throw new Exception(taxReturnResponse.Message); } Console.WriteLine("== Step: Populating taxpayer details workpaper =========================================================="); var details = new TaxpayerDetailsRepository(client); await details.CreateAsync(taxpayer.Id, taxYear, dateOfBirth : new LocalDate(1975, 4, 12), dateOfDeath : new LocalDate(2020, 12, 31), finalReturn : true, mobilePhoneNumber : "0402698741", daytimeAreaPhoneCode : "613", daytimePhoneNumber : "54835123", emailAddress : "*****@*****.**", bsbNumber : "553026", bankAccountName : "Bank of Melbourne", bankAccountNumber : "15987456" ); Console.WriteLine("== Step: Creating employment income workpaper =========================================================="); var employmentIncomeWorkpaperFactory = new EmploymentIncomeRepository(client); await employmentIncomeWorkpaperFactory.CreateAsync(taxpayer.Id, taxYear, employerName : "Cloud IT Specialists", governmentIdentifier : "", salaryAndWagesIncome : 36690m, salaryAndWagesTaxWithheld : -21300m, allowanceIncome : 310m ); Console.WriteLine("== Step: Creating declarations workpaper =========================================================="); var declarationsWorkpaperFactory = new DeclarationsRepository(client); await declarationsWorkpaperFactory.CreateAsync(taxpayer.Id, taxYear, taxAgentNumber : "", taxAgentAbn : "", taxAgentDeclarationStatementAccepted : true, taxAgentContactFirstName : "Jason", taxAgentContactLastName : "Campbell", taxAgentContactPhoneAreaCode : "03", taxAgentContactPhoneNumber : "88435751", taxAgentClientReference : "CR010011JC", taxPayerDeclarationStatementAccepted : true, taxAgentSignatureFirstName : "John", taxAgentSignatureLastName : "Citizen" ); return(taxpayer); }
public async Task <TaxpayerDto> CreateAsync(TaxlabApiClient client, string firstName, string lastName, string taxFileNumber, int taxYear) { var balanceDate = new LocalDate(taxYear, 6, 30); var startDate = balanceDate.PlusYears(-1).PlusDays(-1); Console.WriteLine("== Step: Creating taxpayer =========================================================="); var taxpayerService = new TaxpayerRepository(client); var taxpayerResponse = await taxpayerService.CreateAsync(taxYear, firstName, lastName, taxFileNumber); var taxpayer = taxpayerResponse.Content; client.TaxpayerId = taxpayer.Id; client.Taxyear = taxYear; Console.WriteLine("== Step: Creating tax return =========================================================="); var taxReturnRepository = new TaxReturnRepository(client); var taxReturnResponse = await taxReturnRepository.CreateAsync(taxpayer.Id, taxYear, balanceDate, startDate); if (taxReturnResponse.Success == false) { throw new Exception(taxReturnResponse.Message); } Console.WriteLine("== Step: Creating Capital Gains workpaper =========================================================="); var rentalPropertySale = new CapitalGainOrLossTransactionRepository(client); await rentalPropertySale.CreateAsync(taxpayerId : taxpayer.Id, taxYear : taxYear, description : "Real estate in AU", category : "5", purchaseDate : new LocalDate(2019, 5, 1), purchaseAmount : 10000m, purchaseAdjustment : 0m, disposalDate : new LocalDate(2021, 5, 31), disposalAmount : 130000m, discountAmount : 0m, currentYearLossApplied : -1000, priorLossApplied : -27915.64m, capitalLossesTransferredInApplied : -10000, isEligibleForDiscount : true, isEligibleForActiveAssetReduction : true, isEligibleForRetirementExemption : true, retirementExemptionAmount : -5000, isEligibleForRolloverConcession : true, rolloverConcessionAmount : -3000 ); Console.WriteLine("== Step: Creating another Capital Gains workpaper =========================================================="); var shareSale = new CapitalGainOrLossTransactionRepository(client); await shareSale.CreateAsync(taxpayerId : taxpayer.Id, taxYear : taxYear, description : "Shares on ASX", category : "1", purchaseDate : new LocalDate(2019, 5, 1), purchaseAmount : 2000m, disposalDate : new LocalDate(2021, 5, 31), disposalAmount : 85896.52m, priorLossApplied : -1000m, isEligibleForDiscount : true ); Console.WriteLine("== Step: Populating taxpayer details workpaper =========================================================="); var details = new TaxpayerDetailsRepository(client); await details.CreateAsync(taxpayer.Id, taxYear, dateOfBirth : new LocalDate(1975, 4, 12), dateOfDeath : new LocalDate(2020, 12, 31), finalReturn : true, mobilePhoneNumber : "0402698741", daytimeAreaPhoneCode : "613", daytimePhoneNumber : "54835123", emailAddress : "*****@*****.**", bsbNumber : "553026", bankAccountName : "Bank of Melbourne", bankAccountNumber : "15987456" ); Console.WriteLine("== Step: Creating declarations workpaper =========================================================="); var declarationsWorkpaperFactory = new DeclarationsRepository(client); await declarationsWorkpaperFactory.CreateAsync(taxpayer.Id, taxYear, taxAgentNumber : "", taxAgentAbn : "", taxAgentDeclarationStatementAccepted : true, taxAgentContactFirstName : "Jason", taxAgentContactLastName : "Campbell", taxAgentContactPhoneAreaCode : "03", taxAgentContactPhoneNumber : "88435751", taxAgentClientReference : "CR010011JC", taxPayerDeclarationStatementAccepted : true, taxAgentSignatureFirstName : "John", taxAgentSignatureLastName : "Citizen" ); return(taxpayer); }
public async Task <TaxpayerDto> CreateAsync(TaxlabApiClient client, string firstName, string lastName, string taxFileNumber, int taxYear) { var balanceDate = new LocalDate(taxYear, 6, 30); var startDate = balanceDate.PlusYears(-1).PlusDays(-1); Console.WriteLine("== Step: Creating taxpayer =========================================================="); var taxpayerService = new TaxpayerRepository(client); var taxpayerResponse = await taxpayerService.CreateAsync(taxYear, firstName, lastName, taxFileNumber); var taxpayer = taxpayerResponse.Content; client.TaxpayerId = taxpayer.Id; client.Taxyear = taxYear; Console.WriteLine("== Step: Creating tax return =========================================================="); var taxReturnRepository = new TaxReturnRepository(client); var taxReturnResponse = await taxReturnRepository.CreateAsync(taxpayer.Id, taxYear, balanceDate, startDate); if (taxReturnResponse.Success == false) { throw new Exception(taxReturnResponse.Message); } Console.WriteLine("== Step: Creating Distributions workpaper =========================================================="); var distribution1 = new DistributionsRepository(client); await distribution1.CreateAsync(taxpayerId : taxpayer.Id, taxYear : taxYear, taxpayerName : "Distribution From Trust ABC", typeOfTrustCode : "C", shareOfIncomeNonPrimaryProduction : 10000m, frankingCredit : -1000m ); Console.WriteLine("== Step: Creating Distributions workpaper =========================================================="); var distribution2 = new DistributionsRepository(client); await distribution2.CreateAsync(taxpayerId : taxpayer.Id, taxYear : taxYear, taxpayerName : "Distribution From Trust XYZ", typeOfTrustCode : "C", shareOfIncomeNonPrimaryProduction : 20000m, frankingCredit : -2000m ); Console.WriteLine("== Step: Populating taxpayer details workpaper =========================================================="); var details = new TaxpayerDetailsRepository(client); await details.CreateAsync(taxpayer.Id, taxYear, dateOfBirth : new LocalDate(1975, 4, 12), dateOfDeath : new LocalDate(2020, 12, 31), finalReturn : true, mobilePhoneNumber : "0402698741", daytimeAreaPhoneCode : "613", daytimePhoneNumber : "54835123", emailAddress : "*****@*****.**", bsbNumber : "553026", bankAccountName : "Bank of Melbourne", bankAccountNumber : "15987456" ); Console.WriteLine("== Step: Creating declarations workpaper =========================================================="); var declarationsWorkpaperFactory = new DeclarationsRepository(client); await declarationsWorkpaperFactory.CreateAsync(taxpayer.Id, taxYear, taxAgentNumber : "", taxAgentAbn : "", taxAgentDeclarationStatementAccepted : true, taxAgentContactFirstName : "Jason", taxAgentContactLastName : "Campbell", taxAgentContactPhoneAreaCode : "03", taxAgentContactPhoneNumber : "88435751", taxAgentClientReference : "CR010011JC", taxPayerDeclarationStatementAccepted : true, taxAgentSignatureFirstName : "John", taxAgentSignatureLastName : "Citizen" ); return(taxpayer); }
public async void MapTaxPayerImports() { string baseUrl = "https://preview.taxlab.online/api-internal/"; HttpClient httpclient = new HttpClient(); var authService = new AuthService(); TaxlabApiClient client = new TaxlabApiClient(baseUrl, httpclient, authService); var filename = "ImportData.xlsx"; var importService = new ExcelImportService(); List <TaxpayerImport> imports = importService.CreateTaxpayerFromExcelAsync(filename); const int taxYear = 2021; var balanceDate = new LocalDate(2021, 6, 30); var startDate = balanceDate.PlusYears(-1).PlusDays(-1); foreach (var import in imports) { if (import.Import) { Console.WriteLine("== Step: Creating taxpayer =========================================================="); var taxpayerService1 = new TaxpayerRepository(client); var taxpayerResponse = await taxpayerService1.CreateAsync(taxYear, import.TaxpayerOrFirstName, import.LastName, import.TaxNumber, entityType : import.EntityType); var taxpayer = taxpayerResponse.Content; client.TaxpayerId = taxpayer.Id; client.Taxyear = taxYear; Console.WriteLine("== Step: Creating tax return =========================================================="); var taxReturnRepository = new TaxReturnRepository(client); var taxReturnResponse = await taxReturnRepository.CreateAsync(taxpayer.Id, taxYear, balanceDate, startDate); if (taxReturnResponse.Success == false) { throw new Exception(taxReturnResponse.Message); } Console.WriteLine("== Step: Populating taxpayer details workpaper =========================================================="); var details = new TaxpayerDetailsRepository(client); await details.CreateAsync(taxpayer.Id, taxYear, dateOfBirth : import.DateOfBirth, dateOfDeath : new LocalDate(2020, 12, 31), finalReturn : true, mobilePhoneNumber : "0402698741", daytimeAreaPhoneCode : "613", daytimePhoneNumber : "54835123", emailAddress : "*****@*****.**", bsbNumber : import.BsbNumber, bankAccountName : import.BalanceAccountName, bankAccountNumber : import.BankAccountNumber, baseRateEntityIndicator : import.BaseRateEntityIndicator, familyTrustElectionYear : import.FamilyTrustElectionYear, familyTrustElection : import.FamilyTrustElection ); Console.WriteLine("== Step: Creating declarations workpaper =========================================================="); var declarationsWorkpaperFactory = new DeclarationsRepository(client); await declarationsWorkpaperFactory.CreateAsync(taxpayer.Id, taxYear, taxAgentNumber : "", taxAgentAbn : "", taxAgentDeclarationStatementAccepted : true, taxAgentContactFirstName : "Jason", taxAgentContactLastName : "Campbell", taxAgentContactPhoneAreaCode : "03", taxAgentContactPhoneNumber : "88435751", taxAgentClientReference : "CR010011JC", taxPayerDeclarationStatementAccepted : true, taxAgentSignatureFirstName : "John", taxAgentSignatureLastName : "Citizen", noticesRecipientCorporateName : import.NoticesRecipientCorporateName, noticesRecipientCorporateABN : import.NoticesRecipientCorporateABN, noticesRecipientIndividualFirstName : import.NoticesRecipientIndividualFirstName, noticesRecipientIndividualLastName : import.NoticesRecipientIndividualLastName ); } } }