1. 10
  1.  

  2. 3

    Most of the time I could guess how a bug was present in code, but I’m a bit stumped on this one.

    I don’t understand how something like this is possible on a code level. Surely you do at least a couple seconds of pre-validation of the payment? Maybe you don’t do any payment logic at first. But how do you end up with code that could properly check credit card payments but not properly check for a payment method that doesn’t exist? There is surely some obtuse code path somewhere that caused this.

    I bet this was some silly JS-related error (or some leftover mock code?), but it’s still pretty shocking.

    1. 3
      errors = []
      
      if payment_type_id == 'card'
        # validate and append any errors
      end
      
      if payment_type_id == 'cash'
        # validate and append any errors
      end
      
      if errors.length == 0
        # book a cab
      end
      
    2. -2

      would have been way more useful if I could still use it