3creativessas/tc-ubl21dian
Composer 安装命令:
composer require 3creativessas/tc-ubl21dian
包简介
Core for electronic invoicing pre-validation - DIAN UBL 2.1
关键字:
README 文档
README
Core for electronic invoicing pre-validation - DIAN UBL 2.1.
Tags
- 1.0: Contains valid tests with binary security token (SOAP) and XAdES signature (XML) with algorithms sha1, sha256 and sha512.
- 1.1: Contains main templates for Web Service consumption, require curl as a dependency.
- 1.1.1: Canonization error is solved.
- 1.2: Contains valid proofs for the sending of credit notes and calculation of the CUDE.
- 1.3: License LGPL.
- 2.0: Contains valid proofs for the sending of debit notes and document name standard.
Resources
Documentation
Última actualización Nov 16, 2019 at 3:09PM | Publicado en Jun 30, 2019
Núcleo de Facturación Electrónica Validación Previa DIAN UBL 2.1.
Tags:
- 1.0: Contiene pruebas válidas con el token de seguridad binario (SOAP) y la firma XAdES (XML) con los algoritmos sha1, sha256 y sha512.
- 1.1: Contiene las plantillas principales para el consumo del servicio web, requiere curl como una dependencia.
- 11.1.1: Se soluciona el error de canonización.
- 1.2: Contiene pruebas válidas para el envío de notas de crédito y el cálculo del CUDE.
- 1.3: Licencia LGPL.
- 2.0: Contiene pruebas válidas para el envío de notas de débito y el nombre del documento estándar.
Cómo instalar:
Instalar con composer
composer require 3creativessas/tc-ubl21dian
SOAP uso básico:
use DOMDocument;
use Stenfrank\UBL21dian\BinarySecurityToken\SOAP;
$xmlString = <<<XML
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:wcf="http://wcf.dian.colombia">
<soap:Header/>
<soap:Body>
<wcf:GetStatus>
<!--Optional:-->
<wcf:trackId>123456666</wcf:trackId>
</wcf:GetStatus>
</soap:Body>
</soap:Envelope>
XML;
$pathCertificate = 'PATH_CERTIFICATE.p12';
$passwors = 'PASSWORS_CERTIFICATE';
$domDocument = new DOMDocument();
$domDocument->loadXML($xmlString);
$soap = new SOAP($pathCertificate, $passwors);
$soap->Action = 'http://wcf.dian.colombia/IWcfDianCustomerServices/GetStatus';
$soap->sign($domDocument->saveXML());
file_put_contents('./SOAPDIAN21.xml', $soap->xml);
XAdES SHA1 uso básico:
use DOMDocument;
use Stenfrank\UBL21dian\XAdES\SignInvoice;
$xmlString = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<Invoice>
<ext:UBLExtensions>
<ext:UBLExtension>
<ext:ExtensionContent/>
</ext:UBLExtension>
<ext:UBLExtension>
<ext:ExtensionContent/>
</ext:UBLExtension>
</ext:UBLExtensions>
</Invoice>
XML;
$pathCertificate = 'PATH_CERTIFICATE.p12';
$passwors = 'PASSWORS_CERTIFICATE';
$domDocument = new DOMDocument();
$domDocument->loadXML($xmlString);
$signInvoice = new SignInvoice($pathCertificate, $passwors, $xmlString, SignInvoice::ALGO_SHA1);
file_put_contents('./SING1.xml', $signInvoice->xml);
XAdES SHA256 uso básico:
use DOMDocument;
use Stenfrank\UBL21dian\XAdES\SignInvoice;
$xmlString = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<Invoice>
<ext:UBLExtensions>
<ext:UBLExtension>
<ext:ExtensionContent/>
</ext:UBLExtension>
<ext:UBLExtension>
<ext:ExtensionContent/>
</ext:UBLExtension>
</ext:UBLExtensions>
</Invoice>
XML;
$pathCertificate = 'PATH_CERTIFICATE.p12';
$passwors = 'PASSWORS_CERTIFICATE';
$domDocument = new DOMDocument();
$domDocument->loadXML($xmlString);
$signInvoice = new SignInvoice($pathCertificate, $passwors, $xmlString);
file_put_contents('./SING256.xml', $signInvoice->xml);
XAdES SHA512 uso básico:
use DOMDocument;
use Stenfrank\UBL21dian\XAdES\SignInvoice;
$xmlString = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<Invoice>
<ext:UBLExtensions>
<ext:UBLExtension>
<ext:ExtensionContent/>
</ext:UBLExtension>
<ext:UBLExtension>
<ext:ExtensionContent/>
</ext:UBLExtension>
</ext:UBLExtensions>
</Invoice>
XML;
$pathCertificate = 'PATH_CERTIFICATE.p12';
$passwors = 'PASSWORS_CERTIFICATE';
$domDocument = new DOMDocument();
$domDocument->loadXML($xmlString);
$signInvoice = new SignInvoice($pathCertificate, $passwors, $xmlString, SignInvoice::ALGO_SHA512);
file_put_contents('./SING512.xml', $signInvoice->xml);
Calcular el código de seguridad del software:
// If you assign the values "softwareID" and "pin" the library will calculate and assign "Software Security Code" at the moment of signing the document.
$xadesDIAN->softwareID = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';
$xadesDIAN->pin = '12345';
Calcular «UUID» (CUFE):
// If you assign the value "technicalKey" the library will calculate and assign "UUID" (CUFE) at the moment of signing the document
$xadesDIAN->technicalKey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
Calcular «UUID» (CUDE):
// If you assign the value "pin" the library will calculate and assign "UUID" (CUDE) at the moment of signing the document
$signCreditNote->pin = 'xxxxx';
Consumo de servicios web (Cliente): {#web-service}
use Stenfrank\UBL21dian\Client;
use Stenfrank\UBL21dian\Templates\SOAP\GetStatusZip;
$pathCertificate = 'PATH_CERTIFICATE.p12';
$passwors = 'PASSWORS_CERTIFICATE';
$getStatusZip = new GetStatusZip($pathCertificate, $passwors);
$getStatusZip->trackId = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';
// Sign
$getStatusZip->sign();
$client = new Client($getStatusZip);
// DIAN Response Web Service
return $client;
Consumo de servicios web (Plantilla):
use Stenfrank\UBL21dian\Templates\SOAP\GetStatusZip;
$pathCertificate = 'PATH_CERTIFICATE.p12';
$passwors = 'PASSWORS_CERTIFICATE';
$getStatusZip = new GetStatusZip($pathCertificate, $passwors);
$getStatusZip->trackId = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';
// Sign to send - DIAN Response Web Service
return $getStatusZip->signToSend();
Authors
- Frank Aguirre - Maintainer - Stenfrank
- Helbert Arias - Accomplice - helbertDev3c
Donation
If this library help you reduce time to develop, you can give me a cup of coffee 😃.
3creativessas/tc-ubl21dian 适用场景与选型建议
3creativessas/tc-ubl21dian 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 81 次下载、GitHub Stars 达 1, 最近一次更新时间为 2020 年 08 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「xml」 「web service」 「core」 「ubl」 「soap dian」 「dian」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 3creativessas/tc-ubl21dian 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 3creativessas/tc-ubl21dian 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 3creativessas/tc-ubl21dian 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Model of a web-based resource
Load DOM document safety
A fast and intuitive dependency injection container.
Registry service.
Retrieve a WebResourceInterface instance over HTTP
swagger-php - Generate interactive documentation for your RESTful API using phpdoc annotations
统计信息
- 总下载量: 81
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 15
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0
- 更新时间: 2020-08-05