Example #1
0
 public static Task <List <ExpenseReport> > GetAllAsync(this IExpenseReports expenseReports,
                                                        string?approvalCode        = null,
                                                        string?startDate           = null,
                                                        string?endDate             = null,
                                                        string?batchId             = null,
                                                        uint?processed             = null,
                                                        string?reimbursed          = null,
                                                        string?reimbursedstartdate = null,
                                                        string?reimbursedenddate   = null)
 =>
 CertifyClient.GetAllAsync(async(pageNumber) =>
 {
     var actualPage = await expenseReports
                      .GetPageAsync(
         approvalCode,
         startDate,
         endDate,
         batchId,
         pageNumber,
         processed,
         reimbursed,
         reimbursedstartdate,
         reimbursedenddate)
                      .ConfigureAwait(false);
     return(new GenericPage <ExpenseReport>
     {
         TotalPageCount = actualPage.TotalPageCount,
         TotalRecordCount = actualPage.TotalRecordCount,
         Items = actualPage.ExpenseReports
     });
 });
Example #2
0
 public static Task <List <Expense> > GetAllAsync(this IExpenses expenses,
                                                  string?startDate        = null,
                                                  string?endDate          = null,
                                                  string?batchId          = null,
                                                  uint?processed          = null,
                                                  uint?includeDisapproved = null
                                                  )
 =>
 CertifyClient.GetAllAsync(async(pageNumber) =>
 {
     var actualPage = await expenses
                      .GetPageAsync(
         startDate,
         endDate,
         batchId,
         processed,
         pageNumber,
         includeDisapproved)
                      .ConfigureAwait(false);
     return(new GenericPage <Expense>
     {
         TotalPageCount = actualPage.TotalPageCount,
         TotalRecordCount = actualPage.TotalRecordCount,
         Items = actualPage.Expenses
     });
 });
Example #3
0
        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    CertifyClient.Dispose();
                }

                disposedValue = true;
            }
        }
Example #4
0
        public TestConfig(ILogger logger)
        {
            logger.LogDebug("Loading config...");
            var location = typeof(TestConfig).GetTypeInfo().Assembly.Location;
            var dirPath  = Path.Combine(Path.GetDirectoryName(location) ?? string.Empty, "../../..");
            var builder  = new ConfigurationBuilder()
                           .SetBasePath(dirPath)
                           .AddJsonFile("appsettings.json");
            var configuration = builder.Build();

            logger.LogDebug("Creating client...");
            CertifyClient = new CertifyClient(configuration["Config:Credentials:ApiKey"], configuration["Config:Credentials:ApiSecret"]);
            Logger        = logger;
        }
Example #5
0
        public CertifyConnectedSystemManager(
            ConnectedSystem connectedSystem,
            State state,
            TimeSpan maxFileAge,
            ILoggerFactory loggerFactory)
            : base(connectedSystem, state, maxFileAge, loggerFactory.CreateLogger <CertifyConnectedSystemManager>())
        {
            _certifyClient = new CertifyClient(connectedSystem.Credentials.PublicText, connectedSystem.Credentials.PrivateText, new CertifyClientOptions {
                Timeout = TimeSpan.FromMinutes(2)
            });

            // FixerSharp for exchange rate conversion, if configured
            if (connectedSystem.Configuration.ContainsKey(FixerApiKey))
            {
                var fixerApiKey = connectedSystem.Configuration[FixerApiKey];
                Fixer.SetApiKey(fixerApiKey);
            }
        }
Example #6
0
 public static Task <List <User> > GetAllAsync(this IUsers users,
                                               string?username = null,
                                               uint?active     = null,
                                               string?role     = null)
 =>
 CertifyClient.GetAllAsync(async(pageNumber) =>
 {
     var actualPage = await users
                      .GetPageAsync(
         username,
         active,
         role,
         pageNumber)
                      .ConfigureAwait(false);
     return(new GenericPage <User>
     {
         TotalPageCount = actualPage.TotalPageCount,
         TotalRecordCount = actualPage.TotalRecordCount,
         Items = actualPage.Users
     });
 });
Example #7
0
 public static Task <List <ExpenseReportGld> > GetAllAsync(this IExpenseReportGlds expenseReportGlds,
                                                           uint index,
                                                           string?name = null,
                                                           string?code = null,
                                                           uint?active = null)
 =>
 CertifyClient.GetAllAsync(async(pageNumber) =>
 {
     var actualPage = await expenseReportGlds
                      .GetPageAsync(
         index,
         name,
         code,
         active,
         pageNumber)
                      .ConfigureAwait(false);
     return(new GenericPage <ExpenseReportGld>
     {
         TotalPageCount = actualPage.TotalPageCount,
         TotalRecordCount = actualPage.TotalRecordCount,
         Items = actualPage.ExpenseReportGlds
     });
 });
Example #8
0
 internal async Task <Preferences> GetPreferences()
 {
     return(await CertifyClient.GetPreferences());
 }