partner-it/dinero-php

dinero php 包装器

1.0.2 2015-11-11 12:30 UTC

This package is auto-updated.

Last update: 2024-09-19 09:36:33 UTC


README

Codeship Status for partner-it/dinero-php

安装

使用 Composer

composer require partner-it/dinero-php

使用方法

创建新实例

<?php

$Dinero = new \PartnerIT\Dinero\Dinero([
			'clientId'     => 'clientId',
			'clientSecret' => 'xxx',
			'apiKey'       => 'yyy'
		]);

请求新令牌

<?php
$Dinero->requestToken();

获取组织

<?php
$organizations = $Dinero->Organizations->getOrganizations();
$organizationId = $organizations[0]['id'];

创建新账本

<?php

$nextVoucherNumber = $Dinero->LedgerItems->getNextVoucherNumber($organizationId);
$data = [
	[
		"Amount" => -500,
		"Description" => "produkt, lille",
		"BalancingAccountVatCode" => null,
		"AccountNumber" => 1000,
		"BalancingAccountNumber" => null,
		"VoucherDate" => "2015-05-27",
		"VoucherNumber" => $nextVoucherNumber,
		"AccountVatCode" => "I25"
	]
];

$Dinero->LedgerItems->createLedgeritems($organizationId, $data);

运行手动调用

<?php

$result = $Dinero->call('/endpoint', 'GET', []);

链接

官方API文档

https://api.dinero.dk/docs