petslane/php-bondora-api

Bondora API使用的PHP库

dev-master 2018-04-25 17:26 UTC

This package is not auto-updated.

Last update: 2024-09-28 18:35:17 UTC


README

Bondora API使用的PHP库

安装

Composer

将php-bondora-api添加到您的项目中

php composer.phar require petslane/php-bondora-api

加载composer自动加载器

require_once 'vendor/autoload.php';

手册

下载并解压库到目标文件夹。加载php-bondora-api自动加载器

require_once 'path/to/library/bondoraApi.php';

使用

文档:http://petslane.github.io/php-bondora-api/doc/

use Petslane\Bondora;

$config = array(
    'auth' => array(
        'url_base' => 'https://www.bondora.com',
        'client_id' => 'client_id_123',
        'secret' => 'secret_123',
        'scope' => 'BidsEdit BidsRead Investments SmBuy SmSell',
    ),
    'api_base' => 'https://api.bondora.com',
);
$api = new Bondora\Api($config);

// Get login url
$url = $api->getAuthUrl();
// redirect user to $url. After login, user will be redirected back with get parameter 'code'

// get token from 'code' provided after user successful login. Store access_token and refresh_token
$token_object = $api->getToken($code);

// reuse access_token acquired before
$api->setToken($access_token);

// in case access_token is expired, get new access_token from refresh_token
$token_object = $api->refreshToken($refresh_token);

// get account balance
$balance = $api->accountBalance();

// get all investments
$investments = $api->accountInvestments();

// Get list of all auctions
$auctions = $api->auctions(array(
  'countries' => array('EE'),
  'interestMin' => 10,
));

// Get one auction by auction_id
$auction = $api->auction('3551302b-3f37-49f7-b97b-a4fb00f503a1');

// Bid on 2 auctions
$request = array(
  new Bondora\Definition\Bid(array(
    'AuctionId' => '3551302b-3f37-49f7-b97b-a4fb00f503a1',
    'Amount' => 25,
    'MinAmount' => 10,
  )),
  new Bondora\Definition\Bid(array(
    'AuctionId' => '88270e55-c2c3-431b-9870-a4fe00976b7d',
    'Amount' => 15,
  )),
);
$api->bidPost($request);

// Get list of all bids placed
$bids = $api->bids();

// get secondary market listing
$sm_deals = $api->secondaryMarket(array(
    'countries' => array('EE', 'FI'),
    'interestMin' => 12,
    'incomeVerificationStatus' => Petslane\Bondora\Enum\IncomeVerificationStatus::VerifiedByPhone,
));

// Gets events that have been made with current access token
$events = $api->getEventlog();

// DataExport - get daily dataset of all loan data that is not covered by the data protection laws
$dataset = $api->loandataset(array(
    'countries' => 'EE',
));

// List of all reports
$reports = $api->reports();

// Get report data by report id
$report = $api->report($reports[0]->ReportId);

// Generate report
$reportResponse = $api->createReport(ReportType::Investments);

// revoke token
$api->revokeToken();

当前问题

请告诉我!

  • report()现在返回空的Result和空的GeneratedOn属性的Report对象,如果报告仍在生成中。
    之前它返回错误,错误码404("报告Id ... 未找到"),当报告尚未准备好时。
    如果设置了GeneratedOn属性,则报告已准备好,所有数据都在Result属性中。
    这种行为在Bondora中没有文档记录。

Bondora API支持

Bondora API更改日志 - https://api.bondora.com/ChangeLog

支持的版本
  • v1.0.1.6 (08.09.2016)
  • v1.0.1.5 (15.07.2016)
    • 重命名枚举类
      • AuctionQuestionEducation -> Education
      • AuctionQuestionEmploymentStatus -> EmploymentStatus
      • AuctionQuestionHomeOwnershipType -> HomeOwnershipType
      • AuctionIncomeVerificationStatus -> IncomeVerificationStatus
      • AuctionQuestionMaritalStatus -> MaritalStatus
      • AuctionQuestionOccupationArea -> OccupationArea
  • v1.0.1.4 (09.07.2016)
  • v1.0.1.3 (25.05.2016)
  • v1.0.1.2 (22.03.2016)
  • v1.0.1.1 (29.01.2016)
  • v1.0.1.0 (14.01.2016)
  • v1.0.0.6 (07.01.2016)
  • v1.0.0.5 (21.12.2015)
  • v1.0.0.4 (10.12.2015)
  • v1.0.0.3 (01.12.2015)
  • v1.0.0.2 (25.11.2015)
  • v1.0.0.1 (18.11.2015)
  • v1.0 (12.11.2015)
  • v1.0 Beta (03.09.2015)

Bondora API文档

https://api.bondora.com/doc?v=1