      returns 10,200.90
      **/
     class func getAmountFormatted(_ formattedString : String, thousandSeparator: String, decimalSeparator: String) -> String {
- 
+        
         let amount = self.getAmountDigits(formattedString, decimalSeparator : decimalSeparator)
         let length = amount.characters.count
         if length <= 3 {
             return amount
         }
-
-        let numberWithoutLastThreeDigits = String( Int(Double(formattedString)!/1000))
+        var numberWithoutLastThreeDigits: String = ""
+        if let amountString = Double(formattedString){
+            numberWithoutLastThreeDigits = String( Int(amountString/1000))
+        }
         let lastThreeDigits = formattedString.lastCharacters(number: 3)
         
         return  getAmountFormatted(numberWithoutLastThreeDigits, thousandSeparator: thousandSeparator, decimalSeparator:thousandSeparator).appending(thousandSeparator).appending(lastThreeDigits)
-
+        
     }
     
     /**
      Extract only amount digits
      Ex: formattedString = "1000.00" with decimalSeparator = "."
      returns 1000
-    **/
+     **/
     class func getAmountDigits(_ formattedString : String, decimalSeparator : String) -> String {
         let range = formattedString.range(of: decimalSeparator)
         if range != nil {

        }
        return formattedString
    }

    static internal func findPaymentMethodSearchItemInGroups(_ paymentMethodSearch : PaymentMethodSearch, paymentMethodId : String, paymentTypeId : PaymentTypeId?) -> PaymentMethodSearchItem? {
        if let result = Utils.findPaymentMethodSearchItemById(paymentMethodSearch.groups, paymentMethodId: paymentMethodId, paymentTypeId: paymentTypeId) {
            return result

            let centsIndex = formattedString.index(range!.lowerBound, offsetBy: 1)
            cents = formattedString.substring(from: centsIndex)
        }
        
        if cents.isEmpty || cents.characters.count < 2 {
            var missingZeros = 2 - cents.characters.count
            while missingZeros > 0 {
