simp2/sdk

SDK 用于从连接器与 simp2 进行通信

v5.0.2 2023-12-13 00:04 UTC

README

安装

composer require simp2/sdk

使用

由于 SDK 的方法都是静态的,因此可以从任何文件中调用而无需实例化。

例如

use SIMP2\SDK\SIMP2SDK;

$sdk = new SIMP2SDK();
$sdk->setCompanyTransactionToken($cct);
$debts = $sdk->getDebtsOfClient($client_identifier);

方法

每个方法都与 SIMP2 的一个端点相对应

POST /payments/notify

notifyPayment(string $unique_reference): void

POST /payments/confirm

confirmPayment(string $unique_reference): Response

POST /reverse/notify

notifyRollbackPayment(string $unique_reference): Response

POST /reverse/confirm

confirmRollbackPayment(string $unique_reference): Response

POST /integrations/metadata

createMetadata(string $key, string|array $value): void

POST /events/info

infoEvent(string $unique_reference, string $observations, ?string $category, TypeDescription $type_description, LogLevel $logLevel, int $overwriteLogLevel = null)

POST /events/error

errorEvent(string $unique_reference, string $observations, ?string $category, TypeDescription $type_description, LogLevel $logLevel, int $overwriteLogLevel = null)

GET /integrations/metadata/{key}

getMetadata(string $key): string|array|null

GET /debt/{code}

getDebtInfo($code): ?Debt

GET /client/{ccf_client_id}/debts

getDebtsOfClient(string $ccf_client_id): array

GET /debt/unique/{uniqueReference}

getSubdebt(string $unique_reference): Debt

GET /debt/barcode/{barcode}

getSubdebtByBarcode(string $barcode): Debt

返回债务所属的客户

getClientData(array $debts): Client