mangoweb-sylius/sylius-payment-fee-plugin
最新稳定版本:v0.3.0
Composer 安装命令:
composer require mangoweb-sylius/sylius-payment-fee-plugin
包简介
Payment fee plugin for Sylius.
README 文档
README
Payment Fee Plugin
Features
- Charge extra fee for using payment method.
- Typical usage: Cash on Delivery.
- Taxes are implemented the same way as taxes for shipping fees.
Installation
- Run
$ composer require mangoweb-sylius/sylius-payment-fee-plugin. - Register
\MangoSylius\PaymentFeePlugin\MangoSyliusPaymentFeePluginin your Kernel. - Your Entity
PaymentMethodhas to implement\MangoSylius\PaymentFeePlugin\Model\PaymentMethodWithFeeInterface. You can use TraitMangoSylius\PaymentFeePlugin\Model\PaymentMethodWithFeeTrait.
For guide how to use your own entity see Sylius docs - Customizing Models
Admin
- Add this to
@SyliusAdmin/PaymentMethod/_form.html.twigtemplate.
<div class="ui segment"> <h4 class="ui dividing header">{{ 'mango-sylius.ui.payment_charges'|trans }}</h4> {{ form_row(form.calculator) }} {% for name, calculatorConfigurationPrototype in form.vars.prototypes %} <div id="{{ form.calculator.vars.id }}_{{ name }}" data-container=".calculatorConfiguration" data-prototype="{{ form_widget(calculatorConfigurationPrototype)|e }}"> </div> {% endfor %} <div class="ui segment calculatorConfiguration"> {% if form.calculatorConfiguration is defined %} {% for field in form.calculatorConfiguration %} {{ form_row(field) }} {% endfor %} {% endif %} </div> </div>
- Add this to
AdminBundle/Resources/views/Order/Show/Summary/_totals.html.twig.
{% set paymentFeeAdjustment = constant('MangoSylius\\PaymentFeePlugin\\Model\\AdjustmentInterface::PAYMENT_ADJUSTMENT') %}
{% set paymentFeeAdjustments = order.getAdjustmentsRecursively(paymentFeeAdjustment) %}
{% if paymentFeeAdjustments is not empty %}
<tr>
<td colspan="4" id="payment-fee">
<div class="ui relaxed divided list">
{% for paymentFeeLabel, paymentFeeAmount in sylius_aggregate_adjustments(paymentFeeAdjustments) %}
<div class="item">
<div class="content">
<span class="header">{{ paymentFeeLabel }}</span>
<div class="description">
{{ money.format(paymentFeeAmount, order.currencyCode) }}
</div>
</div>
</div>
{% endfor %}
</div>
</td>
<td colspan="4" id="paymentFee-total" class="right aligned">
<strong>{{ 'mango-sylius.ui.paymentFee_total'|trans }}</strong>:
{{ money.format(order.getAdjustmentsTotal(paymentFeeAdjustment) ,order.currencyCode) }}
</td>
</tr>
{% endif %}
Development
Usage
- Create symlink from .env.dist to .env or create your own .env file
- Develop your plugin in
/src - See
bin/for useful commands
Testing
After your changes you must ensure that the tests are still passing.
- Easy Coding Standard
bin/ecs.sh
- PHPStan
bin/phpstan.sh
License
This library is under the MIT license.
Credits
Developed by manGoweb.
mangoweb-sylius/sylius-payment-fee-plugin 适用场景与选型建议
mangoweb-sylius/sylius-payment-fee-plugin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10.24k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2018 年 09 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 mangoweb-sylius/sylius-payment-fee-plugin 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mangoweb-sylius/sylius-payment-fee-plugin 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 10.24k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 21
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-09-20
