rocheleedenis / laravel-notazz
Laravel 与 Notazz 集成包
v1.0
2021-03-15 00:35 UTC
Requires
- php: >=7.2
- guzzlehttp/guzzle: ^6.2
- illuminate/support: ~5.8.0|^6.0|^7.0|^8.0
Requires (Dev)
- phpunit/phpunit: ^7.5|^8.0
This package is auto-updated.
Last update: 2024-09-15 08:21:01 UTC
README
Laravel Notazz
方便与发票开具系统 Notazz 集成的 Laravel 包。
安装
需求
通过命令行安装
$ composer require rocheleedenis/laravel-notazz
使用方法
目前只能生成产品增值税专用发票。以下是一个使用必填字段的示例
$notaFiscal = app(NotaFiscalBuilder::class); $notaFiscal ->nfe() ->apiKey('b5b8f576a8075442d75be165b0447ace') ->destination() ->name('Beatriz Isabelly Mendes') ->taxid('01708781390') ->taxtype('F') ->street('Rua João Soares Lima') ->number('S/N') ->district('Centro') ->city('Águas Belas') ->uf('CE') ->zipcode('63887-973') ->email('beatriz.isabelly@gmail.com') ->phone('(88) 2592-2647') ->document() ->basevalue(70.30) ->description('Venda') ->products() ->add() ->cod(123) ->name('Escova de dente Cepacol') ->qtd(2) ->unitaryValue(15.20) ->save() ->add() ->cod(124) ->name('Pano de prato para cozinha') ->qtd(1) ->unitaryValue(55.10) ->save();
在使用主要方法 document()
、destination()
和 products()
之后使用的所有方法名称与 Notazz 官方文档中描述的属性名称完全相同,但去除了实体前缀。任何未在示例中出现的属性都遵循此逻辑提供。
测试
默认情况下,调用 Notazz API 的函数返回总是包含 成功 消息,根据调用方法进行个性化,如果环境不是 'production'。
可用方法
实例化 Notazz 类后,可以调用以下方法
$notaFiscal = new \RocheleEdenis\LaravelNotazz\Builders\NotaFiscalBuilder; // Retorna a soma do valor dos itens da nota fiscal $notaFiscal->sumItemsValue(); // Retorna o array com a nota ja montada $notaFiscal->toArray()
实例化 Notazz 类后,可以调用以下方法
$notazz = new \RocheleEdenis\LaravelNotazz; // Envia a requisição para o Notazz para registrar a nova nota $notaFiscal = new NotaFiscalBuilder; ... $notazz->register($notaFiscal);
注意!由于我们曾遇到过许多由于不同数据类型导致的向 Notazz 发送信息的问题,因此在发送之前,所有属性都将转换为 string
类型,无论接收到的数据类型如何!
官方文档
这是一个非官方 API。它基于 Notazz 提供的 文档 构建。
致谢
本项目基于 SDK PHP Notazz 构建。
支持
要报告任何错误或提出建议,请在 github 上创建一个新问题。
许可
基于 MIT 许可证发布。复制、粘贴、修改、改进和共享!