示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
 public static bool AreThereAnyPayrunsToProcess(AustralianPayroll payrollClient)
 {
     return(GetPayRuns(payrollClient).Any(i => i.PayRunStatus == PayRunStatus.Draft));
 }
示例#4
0
 public static IEnumerable <PayRun> GetPayRuns(AustralianPayroll payrollClient)
 {
     return(payrollClient.PayRuns.Find());
 }
示例#5
0
 public static PayrollCalendar GetPayrollCalendar(AustralianPayroll payrollClient)
 {
     return(payrollClient.PayrollCalendars.Find().Single(c => c.CalendarType == CalendarType.Fortnightly));
 }
示例#6
0
 public static PayRun GetPayRunToProcess(AustralianPayroll payrollClient)
 {
     return(GetPayRuns(payrollClient).First(p => p.PayRunStatus == PayRunStatus.Draft));
 }
示例#7
0
 public static void Pay(AustralianPayroll payrollClient, PayRun payrun)
 {
     // Complete Payrun
     payrun.PayRunStatus = PayRunStatus.Posted;
     payrollClient.PayRuns.Update(payrun);
 }