定制 goosfraba/kontomatik-sdk 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

goosfraba/kontomatik-sdk

最新稳定版本:1.0.0

Composer 安装命令:

composer require goosfraba/kontomatik-sdk

包简介

README 文档

README

This repository provides the PHP SDK for Kontomatik.

Installation

Via composer

composer require goosfraba/kontomatik-sdk

Usage

ApiFactory

In order to create the particular API, first you need the ApiFactory instance.

<?php
use Goosfraba\Kontomatik\Common\ApiFactory;

$apiFactory = new ApiFactory(
    $logger = null // optionally, provide the logger to catch the raw responses from the API, it needs to work with level "Debug"
);

ImportingApi

Get the ImportingApi instance

<?php
use Goosfraba\Kontomatik\Common\Dsn;

$importingApi = $apiFactory->importingApi(
    Dsn::parse(
        "kontomatik://your-api-key@prod" // or "kontomatik://your-api-key@test"
    );
);

Supported methods:

  • defaultImport
  • getCommand
  • getData
  • removeData
  • signOut

LendingApi

Get the ImportingApi instance

<?php
use Goosfraba\Kontomatik\Common\Dsn;

$api = $apiFactory->lendingApi(
    Dsn::parse(
        "kontomatik://your-api-key@prod" // or "kontomatik://your-api-key@test"
    );
);

Supported methods:

  • getScores

Importing data use case / scoring

use Goosfraba\Kontomatik\Importing\Session;

$commandReply = $importingApi->defaultImport(
    new Session("known-id", "known-signature"),
    date_create_immutable("now - 6 months") // import data for last 6 months
);

$commandId = $commandReply->getCommand()->getId();
$ownerExternalId = $commandReply->getOwnerExternalId();

do {
    /** @var \Goosfraba\Kontomatik\Importing\CommandReply $commandReply */
    $commandReply = $importingApi->getCommand($commandId));
} while(!$commandReply->getCommand()->isFinished() && sleep(5) === 0);

if ($commandReply->isSuccessful()) {
    $ownerScoreReply = $lendingApi->getScore($ownerExternalId);
}

Contribution

Feel free to add unsupported endpoints or fix the bugs found.

统计信息

  • 总下载量: 2.57k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-05-24