Class ScraperResult

Namespace
Subsembly.Scraper
Assembly
Subsembly.Scraper.dll

Information about a success or failure result, returned from scraper methods.

public sealed class ScraperResult
Inheritance
ScraperResult
Inherited Members

Remarks

A scraper method that is declared to return an instance of ScraperResult must never return null. For convenience there are two static result instances that indicate Subsembly.Scraper.ScraperResult.Success or Subsembly.Scraper.ScraperResult.Failure. The latter should rarely be used, if at all. An implementation shall always try to return as much error information as possible. As an additional convenience, the constructor ScraperResult(Exception) can be used to easily convert runtime exceptions to a ScraperResult.

Constructors

ScraperResult(ScraperResultChallengeType, string, byte[])

Creates a ChallengeResponseNeeded result.

public ScraperResult(ScraperResultChallengeType nChallengeType, string sDisplayText, byte[] vbChallengeData)

Parameters

nChallengeType ScraperResultChallengeType
sDisplayText string
vbChallengeData byte[]

ScraperResult(ScraperResultChallengeType, string, byte[], string)

Creates a ChallengeResponseNeeded result.

public ScraperResult(ScraperResultChallengeType nChallengeType, string sDisplayText, byte[] vbChallengeData, string sChallengeMimeType)

Parameters

nChallengeType ScraperResultChallengeType
sDisplayText string
vbChallengeData byte[]
sChallengeMimeType string

ScraperResult(ScraperResultCode, string, string)

public ScraperResult(ScraperResultCode nCode, string sDisplayText = null, string sDiagnosticTrace = null)

Parameters

nCode ScraperResultCode

Value for Code.

sDisplayText string

Value for DisplayText.

sDiagnosticTrace string

Value for DiagnosticTrace.

ScraperResult(Exception)

public ScraperResult(Exception x)

Parameters

x Exception

Fields

MIMETYPE_HHD13

Special value for ChallengeMimeType to indicate a ChipTAN challenge according to HHD 1.3.

public const string MIMETYPE_HHD13 = "application/x-hhd13"

Field Value

string

MIMETYPE_HHD14

Special value for ChallengeMimeType to indicate a ChipTAN challenge according to HHD 1.4.

public const string MIMETYPE_HHD14 = "application/x-hhd14"

Field Value

string

Properties

public Uri ChallengeAlternateLink { get; }

Property Value

Uri

ChallengeData

If the Code is ChallengeResponseNeeded, then this property provides the optional challenge data from the service.

public byte[] ChallengeData { get; }

Property Value

byte[]

Remarks

The interpretation of this data blob depends on the actual ChallengeType that is in effect. For some challenge/response methods this might even be null.

ChallengeMimeType

If the Code is ChallengeResponseNeeded, then this property indicates the MIME-type of the challenge data, if any, this might even be 'null'.

public string ChallengeMimeType { get; }

Property Value

string

ChallengeResponseLabel

The text input label that shall be used to collect the ChallengeResponse from the user.

public string ChallengeResponseLabel { get; }

Property Value

string

Remarks

If this is not set by a particular implementation, then the default string "TAN" is returned, so the returned string is never null.

ChallengeType

If the Code is ChallengeResponseNeeded, then this property indicates the type of challenge/response mechanism that is used.

public ScraperResultChallengeType ChallengeType { get; }

Property Value

ScraperResultChallengeType

Code

Success or failure code.

public ScraperResultCode Code { get; }

Property Value

ScraperResultCode

DecoupledResponseNeeded

Indicates that a decoupled challenge response is needed.

public bool DecoupledResponseNeeded { get; }

Property Value

bool

Remarks

This is true whenever Code is ChallengeResponseNeeded, and ChallengeType is NoTAN.

DiagnosticTrace

Diagnostic trace output to be captured in a log file.

public string DiagnosticTrace { get; }

Property Value

string

Remarks

This should not be displayed to the user, but should be available for supporting problems.

DisplayText

Error text to display to the user. This should be brief and carefully worded.

public string DisplayText { get; }

Property Value

string

Remarks

Although this is optional and may be null, it should always be set for non-successful result. For a successful result it should be null.

IsSuccess

public bool IsSuccess { get; }

Property Value

bool

QueryChoices

Optional list of choices from which the user can pick. Only set if Code is QueryResponseNeeded. If this is null, then the user should be able to enter arbitrary text.

public ScraperResultQueryChoice[] QueryChoices { get; }

Property Value

ScraperResultQueryChoice[]

QueryFieldName

The name of the credential field, that must be supplied from a query. Only set if Code is QueryResponseNeeded.

public string QueryFieldName { get; }

Property Value

string

QueryHeading

Short heading text for the query. Only set if Code is QueryResponseNeeded.

public string QueryHeading { get; }

Property Value

string

QueryLabel

Optional label for query text input field. This is not used, when QueryChoices are provided.

public string QueryLabel { get; }

Property Value

string

QueryPrompt

Long prompt text to be presented to the user for a query. Only set if Code is QueryResponseNeeded.

public string QueryPrompt { get; }

Property Value

string

Methods

SetQuery(string, string, string, string, ScraperResultQueryChoice[])

public void SetQuery(string sQueryFieldName, string sQueryHeading, string sQueryPrompt, string sQueryLabel, ScraperResultQueryChoice[] vQueryChoices)

Parameters

sQueryFieldName string
sQueryHeading string
sQueryPrompt string
sQueryLabel string
vQueryChoices ScraperResultQueryChoice[]