Class ScraperSession
Convenient base implementation with method stubs for IScraperSession.
public abstract class ScraperSession : HttpClient, IDisposable, IScraperSession, IScraperPersist, IScraperSessionAccountInformation, IScraperSessionPayments, IScraperSessionDocuments, IScraperSessionSecuritiesPortfolio
- Inheritance
-
HttpClientScraperSession
- Implements
- Derived
- Inherited Members
-
HttpClient.HttpSendRequestCompletedHttpClient.Dispose()HttpClient.SetProxy(HttpProxy)HttpClient.TimeoutHttpClient.ContentEncodingHttpClient.RefreshHttpClient.ContentTypeHttpClient.ContentDispositionFileNameHttpClient.LastHttpStatusHttpClient.CurrentLocationHttpClient.ReferrerPolicyHttpClient.AuthorizationHeaderHttpClient.ClearAuthentication()HttpClient.IgnoreSSLHttpClient.ThrowOnHttpErrorHttpClient.UserAgentHttpClient.OriginHttpClient.RedirectLocationHttpClient.AcceptHeaderHttpClient.AcceptEncodingHeaderHttpClient.AcceptLanguageHeaderHttpClient.AllowRedirectsHttpClient.JsonContentTypeHttpClient.JsonCharsetHttpClient.PendingAsyncRequestHttpClient.CancelAsync()HttpClient.ResetCookies()HttpClient.OnAddExtraHeaders(HttpRequest)HttpClient.OnHttpSendRequestCompleted(HttpSendRequestCompletedEventArgs)HttpClient.TraceLineEventHttpClient.TraceSwitchHttpClient.TraceOptionsHttpClient.OnTraceLine(HttpClientTraceEventArgs)
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()
public ScraperSession()
Fields
CREDENTIAL_CHALLENGERESPONSE
public const string CREDENTIAL_CHALLENGERESPONSE = "ChallengeResponse"
Field Value
CREDENTIAL_PASSWORD
public const string CREDENTIAL_PASSWORD = "Password"
Field Value
CREDENTIAL_USERID
public const string CREDENTIAL_USERID = "UserID"
Field Value
Properties
Accounts
Provides the account list from the most recent Login(JsonObject).
public JsonObject[] Accounts { get; }
Property Value
Remarks
If the scraper did not provide an account list, then this property is null.
Contact
public IScraperContact Contact { get; }
Property Value
IsDirty
public bool IsDirty { get; }
Property Value
MaxDocumentDays
public int MaxDocumentDays { get; protected set; }
Property Value
MaxStatementDays
public int MaxStatementDays { get; protected set; }
Property Value
State
public ScraperSessionState State { get; }
Property Value
UserAddresses
Convenient access to the Addresses array of the UserDetails.
public string[] UserAddresses { get; set; }
Property Value
- string[]
UserCardDetails
Convenient access to the CardDetails array of the UserDetails.
public JsonObject[] UserCardDetails { get; set; }
Property Value
UserDetails
public JsonObject UserDetails { get; protected set; }
Property Value
Remarks
If the scraper did not provide user details, then this property is null.
UserEMailAddresses
Convenient access to the EMailAddresses array of the UserDetails.
public string[] UserEMailAddresses { get; set; }
Property Value
- string[]
UserIdentification
Convenient access to the Identification field of the UserDetails.
public string UserIdentification { get; set; }
Property Value
UserName
Convenient access to the Name field of the UserDetails.
public string UserName { get; set; }
Property Value
UserPhoneNumbers
Convenient access to the PhoneNumbers array of the UserDetails.
public string[] UserPhoneNumbers { get; set; }
Property Value
- string[]
Methods
AddCardDetails(string, string, string)
Adds a new CardDetails object to the UserCardDetails.
protected JsonObject AddCardDetails(string sAccountNumber, string sCardHolderName, string sMaskedCardNumber)
Parameters
sAccountNumberstringOptional account number or some other identification of the account that these UserCardDetails are referring to.
sCardHolderNamestringOptional card holder name. If null or empty, then it won't be set in the CardDetails object.
sMaskedCardNumberstringOptional masked card number. If null or empty, then it won't be set in the CardDetails object.
Returns
- 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()
public ScraperResult CancelPayment()
Returns
ContinueDownloadStatement(out SepaDocument, JsonObject)
public ScraperResult ContinueDownloadStatement(out SepaDocument aCamtDoc, JsonObject jsAuthCredentials)
Parameters
aCamtDocSepaDocumentjsAuthCredentialsJsonObject
Returns
ContinueLogin(JsonObject)
Default implementation validates parameters and then calls OnContinueLogin(out SepaAccount[], JsonObject).
public ScraperResult ContinueLogin(JsonObject jsCredential)
Parameters
jsCredentialJsonObject
Returns
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).
public ScraperResult ContinuePayment(JsonObject jsAuthCredentials)
Parameters
jsAuthCredentialsJsonObject
Returns
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).
public ScraperResult DownloadBalances(out SepaBalance[] vaBalances, JsonObject jsAcct)
Parameters
vaBalancesSepaBalance[]jsAcctJsonObject
Returns
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).
public ScraperResult DownloadDocument(out byte[] vbPDF, JsonObject jsAcct, JsonObject jsDoc)
Parameters
vbPDFbyte[]jsAcctJsonObjectjsDocJsonObject
Returns
DownloadDocumentList(out JsonArray, JsonObject, DateTime)
Default implementation validates parameters and then calls OnDownloadDocumentList(out JsonArray, SepaAccount, DateTime).
public ScraperResult DownloadDocumentList(out JsonArray jsDocList, JsonObject jsAcct, DateTime tFromDate)
Parameters
jsDocListJsonArrayjsAcctJsonObjecttFromDateDateTime
Returns
Remarks
A concrete scraper implementation must override OnDownloadDocumentList(out JsonArray, SepaAccount, DateTime) and not this method.
DownloadPortfolio(out IEnumerable<JsonObject>, JsonObject)
public ScraperResult DownloadPortfolio(out IEnumerable<JsonObject> vPortfItems, JsonObject jsAcct)
Parameters
vPortfItemsIEnumerable<JsonObject>jsAcctJsonObject
Returns
DownloadStatement(out SepaDocument, JsonObject, DateTime)
Default implementation validates parameters and then calls OnDownloadStatement(out SepaStatement, SepaAccount, DateTime).
public ScraperResult DownloadStatement(out SepaDocument aCamtDoc, JsonObject jsAcct, DateTime tFromDate)
Parameters
aCamtDocSepaDocumentThe SepaStatement returned from the scraper is packaged into a full CAMT SepaDocument.
jsAcctJsonObjecttFromDateDateTime
Returns
Remarks
A concrete scraper implementation must override OnDownloadStatement(out SepaStatement, SepaAccount, DateTime) and not this method.
GetUserDetails(string)
protected string GetUserDetails(string sFieldName)
Parameters
sFieldNamestring
Returns
InitiatePayment(SepaDocument)
Default implementation validates parameters and then calls OnInitiatePayment(SepaDocument).
public ScraperResult InitiatePayment(SepaDocument aPainDoc)
Parameters
aPainDocSepaDocument
Returns
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).
public void Load(JsonObject js)
Parameters
jsJsonObject
Login(JsonObject)
Default implementation validates parameters and then calls OnLogin(out SepaAccount[], JsonObject).
public ScraperResult Login(JsonObject jsCredential)
Parameters
jsCredentialJsonObject
Returns
Remarks
A concrete scraper implementation must override OnLogin(out SepaAccount[], JsonObject) and not this method.
Logout()
public void Logout()
OnCancelPayment()
Always returns Subsembly.Scraper.ScraperResult.NotSupported.
public virtual ScraperResult OnCancelPayment()
Returns
OnContinueDownloadStatement(out SepaStatement, JsonObject)
public virtual ScraperResult OnContinueDownloadStatement(out SepaStatement aStmt, JsonObject jsCredential)
Parameters
aStmtSepaStatementjsCredentialJsonObject
Returns
OnContinueLogin(out SepaAccount[], JsonObject)
The default implementation always returns NotSupported.
public virtual ScraperResult OnContinueLogin(out SepaAccount[] vAccts, JsonObject jsCredential)
Parameters
vAcctsSepaAccount[]jsCredentialJsonObject
Returns
OnContinuePayment(JsonObject)
Always returns Subsembly.Scraper.ScraperResult.NotSupported.
public virtual ScraperResult OnContinuePayment(JsonObject jsAuthCredentials)
Parameters
jsAuthCredentialsJsonObject
Returns
OnDownloadBalances(out SepaBalance[], SepaAccount)
Always throws a NotImplementedException.
public virtual ScraperResult OnDownloadBalances(out SepaBalance[] vaBalances, SepaAccount aAcct)
Parameters
vaBalancesSepaBalance[]aAcctSepaAccount
Returns
OnDownloadDocument(out byte[], SepaAccount, JsonObject)
Always returns Subsembly.Scraper.ScraperResult.NotSupported.
public virtual ScraperResult OnDownloadDocument(out byte[] vbPDF, SepaAccount aAcct, JsonObject jsDoc)
Parameters
vbPDFbyte[]aAcctSepaAccountjsDocJsonObject
Returns
OnDownloadDocumentList(out JsonArray, SepaAccount, DateTime)
Always throws a NotImplementedException.
public virtual ScraperResult OnDownloadDocumentList(out JsonArray jsDocList, SepaAccount aAcct, DateTime tFromDate)
Parameters
jsDocListJsonArrayaAcctSepaAccounttFromDateDateTime
Returns
OnDownloadPortfolio(out IEnumerable<SupaRecordJson>, SepaAccount)
Always returns Subsembly.Scraper.ScraperResult.NotSupported.
public virtual ScraperResult OnDownloadPortfolio(out IEnumerable<SupaRecordJson> vPortfItems, SepaAccount aAcct)
Parameters
vPortfItemsIEnumerable<SupaRecordJson>aAcctSepaAccount
Returns
OnDownloadStatement(out SepaStatement, SepaAccount, DateTime)
Always throws a NotImplementedException.
public virtual ScraperResult OnDownloadStatement(out SepaStatement aStmt, SepaAccount aAcct, DateTime tFromDate)
Parameters
aStmtSepaStatementaAcctSepaAccounttFromDateDateTime
Returns
OnInitiatePayment(SepaDocument)
Always returns Subsembly.Scraper.ScraperResult.NotSupported.
public virtual ScraperResult OnInitiatePayment(SepaDocument aPainDoc)
Parameters
aPainDocSepaDocument
Returns
OnLoad(JsonObject)
Empty default implementation. May be provided by the derived class.
public virtual void OnLoad(JsonObject js)
Parameters
jsJsonObject
OnLogin(out SepaAccount[], JsonObject)
No default implementation. Must be provided by the derived class.
public abstract ScraperResult OnLogin(out SepaAccount[] vAccts, JsonObject jsCredential)
Parameters
vAcctsSepaAccount[]jsCredentialJsonObject
Returns
OnLogout()
No default implementation. Must be provided by the derived class.
public abstract void OnLogout()
OnSave(JsonObject)
Empty default implementation. May be provided by the derived class.
public virtual void OnSave(JsonObject js)
Parameters
jsJsonObject
Save()
Saves the HTTP state and then delegates to OnSave(JsonObject).
public JsonObject Save()
Returns
SetUserDetails(string, string)
protected void SetUserDetails(string sFieldName, string sFieldValue)