buddha-code / buco-order-documents-api
此包已被弃用且不再维护。未建议替代包。
Shopware 插件,添加 REST API 端点以访问和删除订单文档
dev-master
2019-05-27 06:59 UTC
Requires
- php: >=7.0
- composer/installers: ^1.0
This package is auto-updated.
Last update: 2020-08-27 10:19:44 UTC
README
Shopware 插件,添加 REST API 端点以访问和删除订单文档。
功能
此插件添加了新的 REST API 端点,用于访问和删除订单文档及其属性。目前尚未实现创建和修改订单文档。可以通过用户管理器中的访问控制列表(ACL)资源 BucoOrderDocuments
和权限 read
以及 delete
来限制对端点的访问。
可以通过以下方式访问 REST API
-
GET /api/BucoOrderDocuments/
返回一个 列表。可以应用已知的限制、排序和查询参数。示例输出
{ "data": [ { "id": 11756, "date": "2017-07-31T00:00:00+0200", "typeId": 1, "customerId": 6, "orderId": 1, "amount": 1598, "documentId": "55483", "hash": "7d2431092sadsa3a8047756edf0fec2da", "attribute": { // null, if no attributes available "id": 11668, "documentId": 11756, "someExampleAttribute": 42, } }, { ... } ], "total": 1337, "success": true }
-
GET /api/BucoOrderDocuments/{id}
返回一个 特定的 订单文档,其中包含直接在 JSON 响应中编码的 PDF 文档的 base64 表示形式。要直接检索 PDF 文档而不包含元数据,请在请求头Accept
中包含或设置 MIME 类型application/pdf
。示例输出(JSON 表示形式)
{ "data": { "id": 11756, "date": "2017-07-31T00:00:00+0200", "typeId": 1, "customerId": 6, "orderId": 1, "amount": 1598, "documentId": "55483", "hash": "7d2431092sadsa3a8047756edf0fec2da", "attribute": { // null, if no attributes available "id": 11668, "documentId": 11756, "someExampleAttribute": 42, }, "pdfDocument": "some random base64 encoded data[...]" // null, if file do not exist }, "success": true }
-
DELETE /api/BucoOrderDocuments/{id}
删除一个 特定的 订单文档。示例输出{ "success": true }
功能想法
- 实现 POST 和 PUT 方法
POST
通过 Shopware 生成文档POST
上传外部生成的文档PUT
操作元数据,如金额和属性PUT
上传 PDF 文件
兼容性
- Shopware >= 5.2.0
- PHP >= 7.0
安装
Git 版本
- 在
/custom/plugins/BucoOrderDocumentsApi
中检出插件 - 使用插件管理器安装并激活插件
使用 composer 安装
- 切换到 Shopware 的根安装目录
- 运行命令
composer require buddha-code/buco-order-documents-api
- 使用
./bin/console sw:plugin:install --activate BucoOrderDocumentsApi
安装并激活插件
贡献
请随意进行分支并提交 pull request!
许可证
本项目使用 GPLv3 许可证。