freelabois / webservicecaixa
联邦经济银行基本操作的 Web 服务
0.0.1
2019-09-23 16:46 UTC
Requires
- php: >=7.0.0
- ext-dom: *
- ext-soap: *
- laravel/framework: ^5.0
This package is auto-updated.
Last update: 2024-09-05 03:39:45 UTC
README
访问联邦经济银行 Web 服务中注册的查询、添加和修改收费的基本操作。
使用方法
$ws = new WebserviceCaixa($parametros_do_emissor); $ws->Inclui($parametros_de_inclusao); return $ws->GetUrlBoleto();
查看示例文件以了解如何根据CEF 使用手册中的说明构建指定的参数。
BoletoPHP
要使用 BoletoPHP,下载必要的文件
mkdir -p phpboleto/include curl -s https://raw.githubusercontent.com/CobreGratis/boletophp/master/boleto_cef.php -o phpboleto/boleto_cef.php curl -s https://raw.githubusercontent.com/CobreGratis/boletophp/master/include/funcoes_cef.php -o phpboleto/include/funcoes_cef.php
在代码中调用方法 $ws->GeraBoletoPHP()
$ws = new WebserviceCaixa($parametros_do_emissor); $ws->Inclui($parametros_de_inclusao); $ws->GeraBoletoPHP(); // exibe boleto na tela
配置
要覆盖默认配置,请修改配置文件
php artisan vendor:publish alterar config webservice_caixa.php
调试
$ws = new WebserviceCaixa($parametros_do_emissor); // realize a operação print_r($ws->GetMensagemRetorno()); // mensagem de retorno print_r($ws->GetExcecao()); // exceção print_r($ws->consulta); // consulta realizada print_r($ws->resposta); // resposta obtida print_r($ws->nusoap); // objeto NuSOAP
请检查是否有人之前遇到过同样的问题。
常见错误代码
在可能的输出中,对于 $ws->GetMensagemRetorno()
(54) 操作不允许 - HASH 不匹配:存在与生成 HASH_AUTENTICACAO
字段相关的字段问题。请确认在手册中提供的 CODIGO_BENEFICIARIO
、NOSSO_NUMERO
、DATA_VENCIMENTO
、VALOR
和 CNPJ
值是否有效且长度正确。
(X5) 用户未授权执行交易:当提供无效的 CODIGO_BENEFICIARIO
时发生。请与联邦经济银行的 HelpDesk 确认所使用的代码是否已正确授权用于该服务。
(X5) 交易暂时不可用:可能会事先没有通知,在一段时间后恢复正常。这表明联邦经济银行系统可能不可用。
理解异常消息
组织 print_r($ws->GetExcecao())
的输出,通常类似以下内容
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> [...] <soapenv:Body> [..] <DADOS> <EXCECAO> EXCECAO NO BAR_MANUTENCAO_COBRANCA_BANCARIA_WS.SOAPInput_Empresas_Externas. DETALHES: ParserException(1) - Funcao: ImbDataFlowNode::createExceptionList, Texto Excecao: Node throwing exception, Texto de Insercao (1) - BAR_MANUTENCAO_COBRANCA_BANCARIA_WS.SOAPInput_Empresas_Externas.ParserException (2) - Funcao: ImbSOAPInputNode::validateData, Texto Excecao: Error occurred in ImbSOAPInputHelper::validateSOAPInput(), Texto de Insercao(1) - BAR_MANUTENCAO_COBRANCA_BANCARIA_WS.SOAPInput_Empresas_Externas.ParserException (3) - Funcao: ImbRootParser::parseNextItem, Texto Excecao: Exception whilst parsing.ParserException (4) - Funcao: ImbSOAPParser::createSoapShapedTree, Texto Excecao: problem creating SOAP tree from bitstream.ParserException (5) - Funcao: ImbXMLNSCParser::parseLastChild, Texto Excecao: XML Parsing Errors have occurred.ParserException (6) - Funcao: ImbXMLNSCDocHandler::handleParseErrors, Texto Excecao: A schema validation error has occurred while parsing the XML document, Texto de Insercao (1) - 6012, Texto de Insercao (2) - 1, Texto de Insercao (3) - 28, Texto de Insercao (4) - 43, Texto de Insercao aqui ---> (5) - cvc-enumeration-valid: The value "ISENTO" is not valid with respect to the enumeration facet for type "#Anonymous". It must be a value from the enumeration., Texto de Insercao (6) - /XMLNSC/{http://schemas.xmlsoap.org/soap/envelope/}:Envelope/{http://schemas.xmlsoap.org/soap/envelope/}:Body/{http://caixa.gov.br/sibar/manutencao_cobranca_bancaria/boleto/externo}:SERVICO_ENTRADA/DADOS/INCLUI_BOLETO/TITULO/JUROS_MORA/TIPO. [...]
相关的部分通常位于跟踪堆栈的末尾,由序列 (1) ... (2) ... (3) ...
标识
在此示例中,为 ISENTO
字段提供的值无效,而在手册中指定了这些值
The value "ISENTO" is not valid with respect to the enumeration facet for type "#Anonymous".
It must be a value from the enumeration.
其他情况,如未填写关键字段、特殊字符和无效类型等,也会在此结构中报告。