๐ŸŒ AIๆœ็ดข & ไปฃ็† ไธป้กต
Skip to content

TBCBank/TBC.OpenAPI.SDK.OnlineInstallments

Repository files navigation

TBC.OpenAPI.SDK.OnlineInstallments

โ€‹ NuGet version (TBC.OpenAPI.SDK.OnlineInstallments) CI
โ€‹ Online Installments SDKs for TBC OpenAPI โ€‹

Online Installments SDK

โ€‹ 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. โ€‹

Prerequisites

โ€‹ 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 โ€‹

.Net Core Usage

โ€‹ 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
โ€‹
);
โ€‹

โ€‹

NetFramework Usage

โ€‹ 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: โ€‹ โ€‹

CoreApiAppExample โ€‹

CoreConsoleAppExample โ€‹

NetFrameworkExample

About

TBC Open API Online Installments client SDK

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 5

Languages