public SpendSummary GetTotalSpend(int supplierId)
        {
            ISupplierInvoice supplierInvoiceFactory = new SupplierInvoiceFactory();

            ISpendService spendService = supplierInvoiceFactory.GetSupplierInvoice(supplierId);

            return(spendService.GetTotalSpend());
            //return null;
        }
Esempio n. 2
0
 public SpendSummary GetTotalSpend(int supplierId)
 {
     _logger.LogInformation($"Calling Total spend for {supplierId}");
     try
     {
         var supplier = _supplierService.GetById(supplierId);
         _spendService = supplier.IsExternal ? (ISpendService) new ExternalServiceWrapper(_failoverInvoiceService) : new InvoiceRepository();
         return(_spendService.GetTotalSpend(supplierId));
     }
     catch (CustomException)
     {
         _logger.LogError($"GetTotalSpend is failed to acquire data for external supplier {supplierId} from both locations.");
         return(null); // sending out null intentionally.
     }
     catch (Exception ex)
     {
         _logger.LogError($"Error occured. Error message is {ex.Message}");
         throw;
     }
 }
Esempio n. 3
0
 public SpendSummary Get(int id)
 {
     return(spendService.GetTotalSpend(id));
 }