protected function getErrorCode($error)
    {
        $code = Arr::get($error, 'code', $error['type']);

        switch ($code) {
            case 'invalid_expiry_month':
            case 'invalid_expiry_year':
                return new ErrorCode('invalid_expiry_date');
                break;
            case 'invalid_number':
            case 'incorrect_number':
            case 'invalid_cvc':
            case 'incorrect_zip':
            case 'card_declined':
            case 'expired_card':
            case 'processing_error':
                return new ErrorCode($code);
                break;
            case 'missing':
                return new ErrorCode('config_error');
                break;
        }
    }