yuriizee/sensebank-installment-sdk

PHP SDK library for Sensebank installment

v1.2.0 2024-03-05 18:35 UTC

This package is auto-updated.

Last update: 2024-04-16 12:12:40 UTC


README

Tests Total Downloads Latest Stable Version License

This library provides a clean, flexible and robust way to integrate with the SenseBank Installment SDK. It wraps up various SDK features into easy-to-use PHP classes and methods, minimizing the effort required to interact with the SDK and improving the maintainability of your project.

Installation

composer require yuriizee/sensebank-installment-sdk

Features

Below are some features provided by this library:

  • Order creation/cancellation (Order class)
  • Statement management (Statement class)
  • Managing guarantees (Guarantee class)
  • Singleton client access (InstallmentSDK class)

Requirements

  • PHP >= 8.2

API Documentation

Link to detailed API documentation.

Usage

<?php

declare(strict_types=1);

use Yuriizee\SenseBankInstallmentSDK\Client;
use Yuriizee\SenseBankInstallmentSDK\Config;
use Yuriizee\SenseBankInstallmentSDK\DataObjects\Order\CreateOrderRequest;
use Yuriizee\SenseBankInstallmentSDK\Enums\OrderLimits;
use Yuriizee\SenseBankInstallmentSDK\Helper\Money;
use Yuriizee\SenseBankInstallmentSDK\InstallmentSDK;

require __DIR__ . '/../vendor/autoload.php';

$config = new Config(
    url: 'https://retailapi.sensebank.com.ua:8243/api/PartnerInstallment/v1.0/',
    partnerId: 'partner',
    password: '!PaRt_Ne09_R#'
);
/**
 * You can create instance with own Psr\Http\Client\ClientInterface implemented class
 */
$client = (new Client($config))->getClient();

$sdk = InstallmentSDK::getInstance($config, $client);

$request = new CreateOrderRequest(
    mPhone: '+380670000000',
    panEnd: '0000',
    orderId: rand(),
    orderSum: Money::toKopecks(
        rand(OrderLimits::MIN_SUM->value, OrderLimits::MAX_SUM->value)
    ),
    orderTerm: rand(2, 5),
    callBackURL: 'https://example.dev',
    eMailPartner: 'test@example.dev'
);

$response = $sdk->order()->createOrder($request);

License

SENSEBANK INSTALLMENT SDK PHP Library is open source software licensed under MIT

Config Class

Config class is used to set the configuration for the API client:

  • url
  • partnerId
  • password

These parameters should be obtained directly from Sens Bank

Contributing

Contributions are welcome! Please feel free to open issues for bug reports, feature requests or submit a pull request.

Contact information

yuriyzee@gmail.com