public function onCheckout($cart)
    {
        if (!isset($this->creditCard))
            throw new CheckoutException('Credit Card is not set.', 0);

        if (!in_array($this->creditCard->getType(), $this->validTypes))
            throw new CheckoutException('Credit Card is not supported.', 1);

        if ($this->getPatternType($this->creditCard->getNumber()) != $this->creditCard->getType())
            throw new CheckoutException('Credit Card is invalid.', 2);
    }