Class ScraperSession
Convenient base implementation with method stubs for IScraperSession.
Inheritance
Implements
Inherited Members
Namespace: Subsembly.Scraper
Assembly: Subsembly.Scraper.dll
Syntax
public abstract class ScraperSession : HttpClient, IDisposable, IScraperSession, IScraperPersist, IScraperSessionAccountInformation, IScraperSessionPayments, IScraperSessionDocuments
Remarks
A scraper implementation shall derive from this class and override the appropriate virtual OnXxx methods with its implementation.
This base class automatically maintains the scraper State and validates the state in all public methods. Hence, a derived class can be assured that its OnXxx methods are only called in applicable states.
Constructors
ScraperSession()
Declaration
public ScraperSession()
Fields
CREDENTIAL_CHALLENGERESPONSE
Declaration
public const string CREDENTIAL_CHALLENGERESPONSE = "ChallengeResponse"
Field Value
Type | Description |
---|---|
System.String |
CREDENTIAL_PASSWORD
Declaration
public const string CREDENTIAL_PASSWORD = "Password"
Field Value
Type | Description |
---|---|
System.String |
CREDENTIAL_USERID
Declaration
public const string CREDENTIAL_USERID = "UserID"
Field Value
Type | Description |
---|---|
System.String |
Properties
Accounts
Provides the account list from the most recent Login(JsonObject).
Declaration
public JsonObject[] Accounts { get; }
Property Value
Type | Description |
---|---|
JsonObject[] |
Remarks
If the scraper did not provide an account list, then this property is null
.
Contact
Declaration
public IScraperContact Contact { get; }
Property Value
Type | Description |
---|---|
IScraperContact |
IsDirty
Declaration
public bool IsDirty { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
MaxDocumentDays
Declaration
public int MaxDocumentDays { get; protected set; }
Property Value
Type | Description |
---|---|
System.Int32 |
MaxStatementDays
Declaration
public int MaxStatementDays { get; protected set; }
Property Value
Type | Description |
---|---|
System.Int32 |
State
Declaration
public ScraperSessionState State { get; }
Property Value
Type | Description |
---|---|
ScraperSessionState |
UserAddresses
Convenient access to the Addresses array of the UserDetails.
Declaration
public string[] UserAddresses { get; set; }
Property Value
Type | Description |
---|---|
System.String[] |
UserCardDetails
Convenient access to the CardDetails array of the UserDetails.
Declaration
public JsonObject[] UserCardDetails { get; set; }
Property Value
Type | Description |
---|---|
JsonObject[] |
UserDetails
Declaration
public JsonObject UserDetails { get; protected set; }
Property Value
Type | Description |
---|---|
JsonObject |
Remarks
If the scraper did not provide user details, then this property is null
.
UserEMailAddresses
Convenient access to the EMailAddresses array of the UserDetails.
Declaration
public string[] UserEMailAddresses { get; set; }
Property Value
Type | Description |
---|---|
System.String[] |
UserIdentification
Convenient access to the Identification field of the UserDetails.
Declaration
public string UserIdentification { get; set; }
Property Value
Type | Description |
---|---|
System.String |
UserName
Convenient access to the Name field of the UserDetails.
Declaration
public string UserName { get; set; }
Property Value
Type | Description |
---|---|
System.String |
UserPhoneNumbers
Convenient access to the PhoneNumbers array of the UserDetails.
Declaration
public string[] UserPhoneNumbers { get; set; }
Property Value
Type | Description |
---|---|
System.String[] |
Methods
AddCardDetails(String, String)
Adds a new CardDetails object to the UserCardDetails.
Declaration
protected JsonObject AddCardDetails(string sCardHolderName, string sMaskedCardNumber)
Parameters
Type | Name | Description |
---|---|---|
System.String | sCardHolderName | Optional card holder name. If null or empty, then it won't be set in the CardDetails object. |
System.String | sMaskedCardNumber | Optional masked card number. If null or empty, then it won't be set in the CardDetails object. |
Returns
Type | Description |
---|---|
JsonObject | Returns the newly created CardDetails object that has already been added to the UserCardDetails. The returned object may be used to add further custom fields to the object. |
CancelPayment()
Declaration
public ScraperResult CancelPayment()
Returns
Type | Description |
---|---|
ScraperResult |
ContinueDownloadStatement(out SepaDocument, JsonObject)
Declaration
public ScraperResult ContinueDownloadStatement(out SepaDocument aCamtDoc, JsonObject jsAuthCredentials)
Parameters
Type | Name | Description |
---|---|---|
SepaDocument | aCamtDoc | |
JsonObject | jsAuthCredentials |
Returns
Type | Description |
---|---|
ScraperResult |
ContinueLogin(JsonObject)
Default implementation validates parameters and then calls OnContinueLogin(out SepaAccount[], JsonObject).
Declaration
public ScraperResult ContinueLogin(JsonObject jsCredential)
Parameters
Type | Name | Description |
---|---|---|
JsonObject | jsCredential |
Returns
Type | Description |
---|---|
ScraperResult |
Remarks
A concrete scraper implementation must override OnContinueLogin(out SepaAccount[], JsonObject) and not this method.
ContinuePayment(JsonObject)
Default implementation validates parameters and then calls OnContinuePayment(JsonObject).
Declaration
public ScraperResult ContinuePayment(JsonObject jsAuthCredentials)
Parameters
Type | Name | Description |
---|---|---|
JsonObject | jsAuthCredentials |
Returns
Type | Description |
---|---|
ScraperResult |
Remarks
A concrete scraper implementation must override OnContinuePayment(JsonObject) and not this method.
DownloadBalances(out SepaBalance[], JsonObject)
Default implementation validates parameters and then calls OnDownloadBalances(out SepaBalance[], SepaAccount).
Declaration
public ScraperResult DownloadBalances(out SepaBalance[] vaBalances, JsonObject jsAcct)
Parameters
Type | Name | Description |
---|---|---|
SepaBalance[] | vaBalances | |
JsonObject | jsAcct |
Returns
Type | Description |
---|---|
ScraperResult |
Remarks
A concrete scraper implementation must override OnDownloadBalances(out SepaBalance[], SepaAccount) and not this method.
DownloadDocument(out Byte[], JsonObject, JsonObject)
Default implementation validates parameters and then calls OnDownloadDocument(out Byte[], SepaAccount, JsonObject).
Declaration
public ScraperResult DownloadDocument(out byte[] vbPDF, JsonObject jsAcct, JsonObject jsDoc)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | vbPDF | |
JsonObject | jsAcct | |
JsonObject | jsDoc |
Returns
Type | Description |
---|---|
ScraperResult |
DownloadDocumentList(out JsonArray, JsonObject, DateTime)
Default implementation validates parameters and then calls OnDownloadDocumentList(out JsonArray, SepaAccount, DateTime).
Declaration
public ScraperResult DownloadDocumentList(out JsonArray jsDocList, JsonObject jsAcct, DateTime tFromDate)
Parameters
Type | Name | Description |
---|---|---|
JsonArray | jsDocList | |
JsonObject | jsAcct | |
System.DateTime | tFromDate |
Returns
Type | Description |
---|---|
ScraperResult |
Remarks
A concrete scraper implementation must override OnDownloadDocumentList(out JsonArray, SepaAccount, DateTime) and not this method.
DownloadStatement(out SepaDocument, JsonObject, DateTime)
Default implementation validates parameters and then calls OnDownloadStatement(out SepaStatement, SepaAccount, DateTime).
Declaration
public ScraperResult DownloadStatement(out SepaDocument aCamtDoc, JsonObject jsAcct, DateTime tFromDate)
Parameters
Type | Name | Description |
---|---|---|
SepaDocument | aCamtDoc | The SepaStatement returned from the scraper is packaged into a full CAMT SepaDocument. |
JsonObject | jsAcct | |
System.DateTime | tFromDate |
Returns
Type | Description |
---|---|
ScraperResult |
Remarks
A concrete scraper implementation must override OnDownloadStatement(out SepaStatement, SepaAccount, DateTime) and not this method.
GetUserDetails(String)
Declaration
protected string GetUserDetails(string sFieldName)
Parameters
Type | Name | Description |
---|---|---|
System.String | sFieldName |
Returns
Type | Description |
---|---|
System.String |
InitiatePayment(SepaDocument)
Default implementation validates parameters and then calls OnInitiatePayment(SepaDocument).
Declaration
public ScraperResult InitiatePayment(SepaDocument aPainDoc)
Parameters
Type | Name | Description |
---|---|---|
SepaDocument | aPainDoc |
Returns
Type | Description |
---|---|
ScraperResult |
Remarks
A concrete scraper implementation must override OnInitiatePayment(SepaDocument) and not this method.
Load(JsonObject)
Loads the HTTP state and then delegates to OnLoad(JsonObject).
Declaration
public void Load(JsonObject js)
Parameters
Type | Name | Description |
---|---|---|
JsonObject | js |
Login(JsonObject)
Default implementation validates parameters and then calls OnLogin(out SepaAccount[], JsonObject).
Declaration
public ScraperResult Login(JsonObject jsCredential)
Parameters
Type | Name | Description |
---|---|---|
JsonObject | jsCredential |
Returns
Type | Description |
---|---|
ScraperResult |
Remarks
A concrete scraper implementation must override OnLogin(out SepaAccount[], JsonObject) and not this method.
Logout()
Declaration
public void Logout()
OnCancelPayment()
Always returns Subsembly.Scraper.ScraperResult.NotSupported.
Declaration
public virtual ScraperResult OnCancelPayment()
Returns
Type | Description |
---|---|
ScraperResult |
OnContinueDownloadStatement(out SepaStatement, JsonObject)
Declaration
public virtual ScraperResult OnContinueDownloadStatement(out SepaStatement aStmt, JsonObject jsCredential)
Parameters
Type | Name | Description |
---|---|---|
SepaStatement | aStmt | |
JsonObject | jsCredential |
Returns
Type | Description |
---|---|
ScraperResult |
OnContinueLogin(out SepaAccount[], JsonObject)
The default implementation always returns NotSupported.
Declaration
public virtual ScraperResult OnContinueLogin(out SepaAccount[] vAccts, JsonObject jsCredential)
Parameters
Type | Name | Description |
---|---|---|
SepaAccount[] | vAccts | |
JsonObject | jsCredential |
Returns
Type | Description |
---|---|
ScraperResult |
OnContinuePayment(JsonObject)
Always returns Subsembly.Scraper.ScraperResult.NotSupported.
Declaration
public virtual ScraperResult OnContinuePayment(JsonObject jsAuthCredentials)
Parameters
Type | Name | Description |
---|---|---|
JsonObject | jsAuthCredentials |
Returns
Type | Description |
---|---|
ScraperResult |
OnDownloadBalances(out SepaBalance[], SepaAccount)
Always throws a NotImplementedException
.
Declaration
public virtual ScraperResult OnDownloadBalances(out SepaBalance[] vaBalances, SepaAccount aAcct)
Parameters
Type | Name | Description |
---|---|---|
SepaBalance[] | vaBalances | |
SepaAccount | aAcct |
Returns
Type | Description |
---|---|
ScraperResult |
OnDownloadDocument(out Byte[], SepaAccount, JsonObject)
Always returns Subsembly.Scraper.ScraperResult.NotSupported.
Declaration
public virtual ScraperResult OnDownloadDocument(out byte[] vbPDF, SepaAccount aAcct, JsonObject jsDoc)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | vbPDF | |
SepaAccount | aAcct | |
JsonObject | jsDoc |
Returns
Type | Description |
---|---|
ScraperResult |
OnDownloadDocumentList(out JsonArray, SepaAccount, DateTime)
Always throws a NotImplementedException
.
Declaration
public virtual ScraperResult OnDownloadDocumentList(out JsonArray jsDocList, SepaAccount aAcct, DateTime tFromDate)
Parameters
Type | Name | Description |
---|---|---|
JsonArray | jsDocList | |
SepaAccount | aAcct | |
System.DateTime | tFromDate |
Returns
Type | Description |
---|---|
ScraperResult |
OnDownloadStatement(out SepaStatement, SepaAccount, DateTime)
Always throws a NotImplementedException
.
Declaration
public virtual ScraperResult OnDownloadStatement(out SepaStatement aStmt, SepaAccount aAcct, DateTime tFromDate)
Parameters
Type | Name | Description |
---|---|---|
SepaStatement | aStmt | |
SepaAccount | aAcct | |
System.DateTime | tFromDate |
Returns
Type | Description |
---|---|
ScraperResult |
OnInitiatePayment(SepaDocument)
Always returns Subsembly.Scraper.ScraperResult.NotSupported.
Declaration
public virtual ScraperResult OnInitiatePayment(SepaDocument aPainDoc)
Parameters
Type | Name | Description |
---|---|---|
SepaDocument | aPainDoc |
Returns
Type | Description |
---|---|
ScraperResult |
OnLoad(JsonObject)
Empty default implementation. May be provided by the derived class.
Declaration
public virtual void OnLoad(JsonObject js)
Parameters
Type | Name | Description |
---|---|---|
JsonObject | js |
OnLogin(out SepaAccount[], JsonObject)
No default implementation. Must be provided by the derived class.
Declaration
public abstract ScraperResult OnLogin(out SepaAccount[] vAccts, JsonObject jsCredential)
Parameters
Type | Name | Description |
---|---|---|
SepaAccount[] | vAccts | |
JsonObject | jsCredential |
Returns
Type | Description |
---|---|
ScraperResult |
OnLogout()
No default implementation. Must be provided by the derived class.
Declaration
public abstract void OnLogout()
OnSave(JsonObject)
Empty default implementation. May be provided by the derived class.
Declaration
public virtual void OnSave(JsonObject js)
Parameters
Type | Name | Description |
---|---|---|
JsonObject | js |
Save()
Saves the HTTP state and then delegates to OnSave(JsonObject).
Declaration
public JsonObject Save()
Returns
Type | Description |
---|---|
JsonObject |
SetUserDetails(String, String)
Declaration
protected void SetUserDetails(string sFieldName, string sFieldValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | sFieldName | |
System.String | sFieldValue |