โ
โ
Online Installments SDKs for TBC OpenAPI
โ
โ
Repository contains the SDK for simplifying TBC Open API Online Installments 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 Installments endpoint, TBC Portal apikey and ClientSecret
โ
appsettings.json
โ
โ
"OnlineInstallments": {
โ
"BaseUrl": "https://tbcbank-test.apigee.net/v1/online-installments/",
โ
"ApiKey": "{apikey}",
"ClientSecret" : "{ClientSecret}"
โ
}
โโ
Then add Online Installments client as an dependency injection
โ
Program.cs
โ
โ
builder.Services.AddOnlineInstallmentsClient(builder.Configuration.GetSection("OnlineInstallments").Get<OnlineInstallmentsClientOptions>());
โโ After two steps above, setup is done and Online Installments client can be injected in any container class: โ Injection example: โ
โ
private readonly IOnlineInstallmentsClient _onlineInstallmentsClient;
โ
public TestController(IOnlineInstallmentsClient onlineInstallmentsClient)
โ
{
โ
_onlineInstallmentsClient = onlineInstallmentsClient;
โ
}
โโ Api invocation example: โ
โ
var result = await _onlineInstallmentsClient.GetApplicationStatus(
โ
new GetApplicationStatusRequest
{
MerchantKey = "aeb32470-4999-4f05-b271-b393325c8d8f",
SessionId = "3293a41f-1ad0-4542-968a-a8480495b2d6"
},
โ
cancellationToken
โ
);
โโ
โ
First step is to configure appsettings.json file with Online Installments endpoint, TBC Portal apikey and ClientSecret
โ
Web.config
โ
โ
<add key="OnlineInstallmentsUrl" value="https://tbcbank-test.apigee.net/v1/online-installments/" />
โ
<add key="OnlineInstallmentsKey" value="{apikey}" />
<add key="OnlineInstallmentsClientSecret" value="{clientSecret}" />
โโ
In the Global.asax file at Application_Start() add following code
โ
Global.asax
โ
โ
new OpenApiClientFactoryBuilder()
โ
.AddOnlineInstallmentsClient(new OnlineInstallmentsClientOptions
โ
{
โ
BaseUrl = ConfigurationManager.AppSettings["OnlineInstallmentsUrl"],
โ
ApiKey = ConfigurationManager.AppSettings["OnlineInstallmentsKey"],
ApiKey = ConfigurationManager.AppSettings["OnlineInstallmentsClientSecret"]
โ
})
โ
.Build();
โโ
This code reads config parameters and then creates singleton OpenApiClientFactory, which is used to instantiate Online Installments client.
โ
OnlineInstallmentsClient class instantiation and invocation example:
โ
โ
var onlineInstallmentsClient = OpenApiClientFactory.Instance.GetOnlineInstallmentsClient();
โ
var result = await onlineInstallmentsClient.GetApplicationStatus(new GetApplicationStatusRequest
{
MerchantKey = "aeb32470-4999-4f05-b271-b393325c8d8f",
SessionId = "3293a41f-1ad0-4542-968a-a8480495b2d6"
});
โโ For more details see examples in repo: โ โ