public static AustralianPayroll CreatePayrollClient(X509Certificate2 certificate) { var payrollClient = new AustralianPayroll(XeroEndpoint, new PrivateAuthenticator(certificate), new Consumer(Key, Secret), null, new DefaultMapper(), new DefaultMapper()); return(payrollClient); }
public static void CreateNewPayrun(AustralianPayroll payrollClient) { // Create a payrun using a calendar, in our case a fortnight calendar var calendar = GetPayrollCalendar(payrollClient); var newPayrun = new PayRun { PayrollCalendarId = calendar.Id }; payrollClient.PayRuns.Create(newPayrun); }
public static bool AreThereAnyPayrunsToProcess(AustralianPayroll payrollClient) { return(GetPayRuns(payrollClient).Any(i => i.PayRunStatus == PayRunStatus.Draft)); }
public static IEnumerable <PayRun> GetPayRuns(AustralianPayroll payrollClient) { return(payrollClient.PayRuns.Find()); }
public static PayrollCalendar GetPayrollCalendar(AustralianPayroll payrollClient) { return(payrollClient.PayrollCalendars.Find().Single(c => c.CalendarType == CalendarType.Fortnightly)); }
public static PayRun GetPayRunToProcess(AustralianPayroll payrollClient) { return(GetPayRuns(payrollClient).First(p => p.PayRunStatus == PayRunStatus.Draft)); }
public static void Pay(AustralianPayroll payrollClient, PayRun payrun) { // Complete Payrun payrun.PayRunStatus = PayRunStatus.Posted; payrollClient.PayRuns.Update(payrun); }