Skip to content

Repository files navigation

JibitSharp

CI NuGet License: MIT

Unofficial C# SDK for Jibit's APIs, generated from its OpenAPI spec with Kiota and wrapped with per-module authentication, automatic token refresh, and a typed error model.

Module Product Credentials
Alpha Biometric authentication none
Cobank Accounts / co-bank apiKey + secretKey
Directdebit Direct debit apiKey + secretKey
Ide Inquiry services (card, IBAN, identity, OCR, ...) apiKey + secretKey
Mzahub Digital contract / signature apiKey + secretKey
Ppg Payment gateway apiKey + secretKey
Pulse SMS apiKey + secretKey

Install

dotnet add package JibitSharp

Or add it directly to your .csproj:

<ItemGroup>
  <PackageReference Include="JibitSharp" Version="*" />
</ItemGroup>

Targets net8.0, net9.0, and net10.0.

Usage

var client = new JibitClient(new JibitClientOptions
{
    Cobank = new JibitCredentials(apiKey, secretKey),
    // only configure the modules you actually use — Alpha needs none
});

var result = await client.Cobank.V1.Orders.Settlement.PostAsync(new SettlementRequestDTO
{
    // ...
});

Credentials are per module (Cobank, Ppg, Ide, Directdebit, Pulse, Mzahub) — each is an independent apiKey/secretKey pair with its own token lifecycle, which JibitClient manages automatically (generation, caching, and refresh on expiry or a 401). Alpha has no token flow and needs no credentials.

Every one of the 147 generated operations is reachable through client.{Alpha,Cobank,Directdebit,Ide,Mzahub,Ppg,Pulse} following the same URL-shaped navigation Kiota generates, e.g. client.Ppg.V3.Purchases.PostAsync(...).

Dependency injection

services.AddJibitSharp(options =>
{
    options.Cobank = new JibitCredentials(apiKey, secretKey);
});

Registers a singleton JibitClient backed by a pooled, resilient HttpClient (Microsoft.Extensions.Http.Resilience's standard handler: retry, timeout, circuit breaker).

Errors

Every operation throws JibitApiException (an alias for the generated Error model) on a non-2xx response, exposing Code, Message, and ResponseStatusCode — one exception type regardless of which product raised it.

Known spec limitations

The vendored OpenAPI document (openapi/document.json) has a few confirmed defects, worked around by JibitSharp.SpecNormalizer at build time:

  • POST /ide/v1/services/ocr/national-card's response (OcrNationalCardResponse) is a provisional best-guess shape (firstName, lastName, nationalCode, confidence, plus AdditionalData for anything else Jibit actually returns) since the real schema is missing from the spec.

  • /mzahub/v1/merchant/contract-sign/* operations require an X-REAL-IP header per the spec. Kiota does not generate a typed convenience parameter for it, but you can set it via the generic requestConfiguration.Headers mechanism:

    await client.Mzahub.V1.Merchant.ContractSign.VoiceCaptcha.PostAsync(
        body,
        rc => rc.Headers.Add("X-REAL-IP", ip));

    Custom headers are automatically preserved across token-refresh retries.

See JibitSharp/README.md (the package readme shipped on NuGet) for more detail.

Repository layout

  • JibitSharp/ — the SDK itself (this is what gets packed and published).
  • JibitSharp.Tests/ — unit and smoke tests.
  • JibitSharp.SpecNormalizer/ — build-time tool that patches known defects in openapi/document.json before Kiota generates the client.
  • openapi/document.json — the vendored Jibit OpenAPI spec.
  • scripts/generate.sh — regenerates the Kiota-generated client.

Development

dotnet restore
dotnet build
dotnet test

After changing openapi/document.json, regenerate the client:

./scripts/generate.sh

Requires the Microsoft.OpenApi.Kiota global tool (installed automatically by the script if missing, pinned to 1.34.1).

License

MIT — see LICENSE.

About

The Most Compelte lib for jibit API in C# https://developers.jibit.ir/

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages