Handaling Multiple Taxpayers
If host application needs to support multiple TaxPayer, it needs to store ApiLoginDetails for multiple TaxPayer and needs to implement a class lets call TPSession Class
i,e creating different session object for each TaxPayer.
public class TPEWBSession : EWBSession
{
public int TaxPayerID { get; set; }
public string TaxPayerName { get; set; } //Optional if you want Name in Session
public TPEWBSession(int TPID) : base(true, false)//Parameterised constructor inheriting base class EWBSession keeping read Api setting from config file is true and read login detail from config false
{
TaxPayerID = TPID;
LoadEwbLoginDetail(TaxPayerID);
RefreshAuthTokenCompleted += SaveNewAuthToken;
}
private void LoadEwbLoginDetail(int id)
{
EwbApiLoginDetails = new EWBAPILoginDetails();
EwbApiLoginDetails.EwbGstin = "GSTIN for id";
EwbApiLoginDetails.EwbUserID = "EwbUserID for id";
EwbApiLoginDetails.EwbPassword = "EwbPassword for id";
EwbApiLoginDetails.EwbAppKey = "EwbAppKey for id";
EwbApiLoginDetails.EwbSEK = "EwbSEK for id";
EwbApiLoginDetails.EwbTokenExp = "EwbTokenExp for id";
EwbApiLoginDetails.EwbAuthToken = "EwbAuthToken for id";
TaxPayerName = "TaxPayerName for id";
}
private void SaveNewAuthToken(object sender, EventArgs e)
{
//Write your code to save New AuthToken to DB, etc to TaxPayerID
}
public override void LogAPITxn(APITxnLogArgs e)
{
//Write your code to Log API Txn
}
}
}