clubfixinsurtech/susep-sandbox-api

1.0.7 2024-08-08 19:09 UTC

This package is not auto-updated.

Last update: 2024-09-19 19:38:00 UTC


README

Maintainer Source Code PHP from Packagist Latest Version Software License Build Total Downloads

SRD/SUSEP API组件。

SUSEP API在Sandbox程序中的使用。Sandbox程序是一个用于保险、补充养老和资本市场的测试环境。目的是允许企业在产品和服务投入生产前进行测试。此组件提供了向SUSEP发送财务报告文件所需的功能。

亮点

  • 简单安装(安装简单)
  • Composer准备就绪且符合PSR-2规范(兼容Composer和PSR-2)

安装

此组件可通过Composer获取

composer require clubfixinsurtech/susep-sandbox-api

文档

基本用法
<?php

// Inicialize o Connector definindo o ambiente de trabalho
// 

$connector = new Susep\Connector(production: false);

// Definindo o Token de Acesso
$auth = new \Susep\Requests\Auth(
    clientId: $env('SUSEP_CLIENT_ID'),
    clientSecret: $env('SUSEP_CLIENT_SECRET'),
    username: $env('SUSEP_USERNAME'),
    password: $env('SUSEP_PASSWORD')
);

$authResponse = $connector->send($auth);
$token = $authResponse->json('access_token');

$connector->withTokenAuth($token);


// Obtendo os dados da Agenda com suas respectivas competências

$agendaInfoRequest = $connector->send(new \Susep\Requests\AgendaInfo);

$agenda = $agendaInfo->json();
$agendaId = $agenda['agendaEntidadeId'];

// Enviando os dados de acordo com um competência

$sendFileReq = new \Susep\Requests\SendFile(
    agendaId: $agendaInfo->json('id'),
    files: json_encode([/*...*/])
);

$responseSentFile = $connector->send($sendFileReq);

$response = $responseSentFile->json();

致谢

许可证

MIT许可证(MIT)。有关更多信息,请参阅许可证文件