/// <summary> /// Collect the change in the cash dispenser. /// </summary> /// <param name="request">The cash dispenser request value.</param> /// <returns>Returns success if the change is collected.</returns> public bool CollectChange(CashDispenserRequest request) { ThrowIf.Null(request, "request"); ICashDispenser cashDispenser = CompositionManager.Instance.GetComponent <ICashDispenser>("WINDOWS"); string deviceName = request.DeviceName; if (string.IsNullOrWhiteSpace(deviceName)) { deviceName = CashDispenserController.CashDispenserTestName; } if (cashDispenser != null) { try { cashDispenser.Open(deviceName, null); cashDispenser.CollectChange(request.Change, request.Currency); return(true); } catch (Exception ex) { RetailLogger.Log.HardwareStationActionFailure("Hardware station an exception occurred when operating on cash dispenser.", ex); throw new PeripheralException("Microsoft_Dynamics_Commerce_HardwareStation_CashDispenser_Error", ex.Message, ex); } finally { cashDispenser.Close(); } } else { throw new PeripheralException("Microsoft_Dynamics_Commerce_HardwareStation_CashDispenser_Error"); } }