TaxPro GST Lib
User guide (Under Construction)
 
×
Menu
Index
APISession
Assembly and Namespace: TaxProGST.API
Dependency: RestSharp
 
APISession is very important class in TaxPro GST User Control Library and developer needs to have excellent understanding of APISession for using TaxPro GST User Control Library to develop multi TaxPayer application.
 
APISession Properties
 
Property
Description
Data Type
ApiSetting
Stores all variables required to access API endpoint along with.  ApiSetting would be fixed even for accessing API for Multiple TaxPayers and would not change depending on TaPayer. ApiSetting members are listed in table below.
TaxProGST.API.APISetting
ApiLoginDetails
Store all TaxPayer specific values viz. GSTIN, StateCode, UserID, Encryption Keys, Session Validity, etc
Members are listed in table below.
TaxProGST.API.
APILoginDetails
ReturnPeriod
ReturnPeriod in "MMyyyy" format. Required for all API access except for Authorization API.
String
TxnID
Unique Transaction ID. Internally generated on StartAPITxn call by API enabled control.
String
UserIP
Required to set if in case of hosted application accessed by number of users on internet. If not set, will be set to IP of ASP server or Desktop Application from where API is being accessed.
String
CancleApiTxn
Set to True if API transaction to be canceled in StartPITxn. Would be useful if user want to disable API access from single point (depending of active License, etc).
bool
CancelApiMsg
Set the message in this property if API transaction disabled by setting CancleApiTxn to True.
String
 
ApiSetting Members (Mandatory Fields marked with *)
Property
Description
Data Type
ID
Unique ID - Primary Key in case DbContext needs to be created on ApiSetting/
Int
ASPName
Friendly Name for ApiSetting
String
AspPassword
AspPassword or Security Key
 
IsActive
Indicates if API indicated by this setting is Active.
bool
IsDefault
Indicates if API is default API in case multiple API settings created.
bool
AspWebsite
Used to download APISetting using EditAPISetting control.
String
AspUserId
User ID on ASP/GSP
String
AspEK
Encryption Key used by ASP - GSP communication.
Stirng
AspDscPassword
DSC password in case ASP uses signed request to establish session.
Stirng
UrlAuth*
Authorization API Endpoint Url (full url with version number)
String
UrlReturn*
Returns API Endpoint Url (full url with version number)
String
UrlLedger*
Ledger API Endpoint Url (full url with version number)
String
UrlASPUtil
GSP Authorization and Services Endpoint  URL.
String
AspSessionID
ASP - GSP Session identifier.
String
AspSessionValidityMins
Validity of ASP / GSP Session in minutes.  AspSessionExp would be calculated by adding these many Minutes to current ASP / GSP refresh session call success time.
Int
AspSessionExp
API engine will refresh ASP / GSP session after this time at the begining of StartApiTxn call.
DateTime
 
 
 
ApiLoginDetails Members (All fields are mandatory)
Property
Description
Data Type
GSTIN
GSTIN of TaxPayer
String
GstPortalUserID
UserID of TaxPayer on GST Portal. Use same User Id that is used at the time of GST registration.
String
AppKey
AppKey used for obtaining OTP as a part of Authorization Token generation process.
String
AuthToken
Authorization Token obtained at the end of successful Authorization API Call.
String
TokenExp
DateTime the AuthToken expires.
DateTime
SessionEK
Session Encryption Key (EK) obtained at the end of successful Authorization API Call or Extend Session API Call.
String
Refer to TPSession class in Sample Project which demonstrates how to write wrapper with TaxPayer dependency injection in APISession to provide TaxPayer specific values to ApiLoginDetails members.  .
 
Events
 
Event
Description
StartingApiTxn
The event occurs as first step of StartApiTxn method call. May be used to set  CancelApiTxn property to false to cancel API Transaction.
 
Methods
Method
Description
StartApiTxn
Paramaters: RestRequest
StartApiTxn method performs below tasks:
1. Invoke StartingApiTxn Event
2. Generate unique TxnID for every call
3. Check for required ApiSetting and ApiLoginDetails paramaters.
4. Cancel the transaction if CancelApiTxn property set to false.
5. Check and refresh ASP-GSP session. (by calling GetKey API).
LogAPITxn
Paramaters: TaxProGST.API.
APITxnLogArgs
Virtual method with no base implementation.  TaxProGST.Controls.GSTSession  class derived from APISession impliments loging of API Transactions to file in program folder.
Override this method in wrapper class to impliment API Transaction logging. (Refer to TPSession class in Sample Project.