Online Mortgage SDKs for TBC OpenAPI
Repository contains the SDK for simplifying TBC Open API Online Mortgage API invocations on C# client application side.
Library is written in the C # programming language and is compatible with .netstandard2.0 and .net6.0.
In order to use the SDK it is mandatory to have apikey from TBC Bank's OpenAPI Devportal.
See more details how to get apikey
First step is to configure appsettings.json file with Online Mortgage endpoint, TBC Portal apikey and ClientSecret
appsettings.json
"OnlineMortgage": {
"BaseUrl": "https://tbcbank-test.apigee.net/v1/online-mortgage/",
"ApiKey": "{apikey}",
"ClientSecret" : "{ClientSecret}"
}
Then add Online Mortgage client as an dependency injection
Program.cs
builder.Services.AddOnlineMortgageClient(builder.Configuration.GetSection("OnlineMortgage").Get<OnlineMortgageClientOptions>());
After two steps above, setup is done and Online Mortgage client can be injected in any container class: Injection example:
private readonly IOnlineMortgageClient _OnlineMortgageClient;
public TestController(IOnlineMortgageClient OnlineMortgageClient)
{
_OnlineMortgageClient = OnlineMortgageClient;
}
Api invocation example:
var result = await _OnlineMortgageClient.InitiateOnlineMortgageLeads(new InitiateMortgageLeadsRequest
{
Url = "http://my.ge/myhome/ka/pr/10872462/iyideba-mshenebare-bina",
RealEstateCode = "FLAT",
CompanyCode = "M2",
OtherCompanyName = "",
PropertyPrice = "196200.00",
PropertyPriceCurrencyCode = "GEL",
DownPaymentAmount = 19620.00f,
DownPaymentAmountCurrencyCode = "GEL",
TermInMonths = 120
}).GetAwaiter().GetResult();
First step is to configure appsettings.json file with Online Mortgage endpoint, TBC Portal apikey and ClientSecret
Web.config
<add key="OnlineMortgageUrl" value="https://tbcbank-test.apigee.net/v1/online-mortgage/" />
<add key="OnlineMortgageKey" value="{apikey}" />
<add key="OnlineMortgageClientSecret" value="{clientSecret}" />
In the Global.asax file at Application_Start() add following code
Global.asax
new OpenApiClientFactoryBuilder()
.AddOnlineMortgageClient(new OnlineMortgageClientOptions
{
BaseUrl = ConfigurationManager.AppSettings["OnlineMortgageUrl"],
ApiKey = ConfigurationManager.AppSettings["OnlineMortgageKey"],
ApiKey = ConfigurationManager.AppSettings["OnlineMortgageClientSecret"]
})
.Build();
This code reads config parameters and then creates singleton OpenApiClientFactory, which is used to instantiate Online Mortgage client.
OnlineMortgageClient class instantiation and invocation example:
var OnlineMortgageClient = OpenApiClientFactory.Instance.GetOnlineMortgageClient();
var result = await OnlineMortgageClient.GetApplicationStatus(new GetApplicationStatusRequest
{
MerchantKey = "aeb32470-4999-4f05-b271-b393325c8d8f",
SessionId = "3293a41f-1ad0-4542-968a-a8480495b2d6"
});
For more details see examples in repo: