fond-of-oryx/gift-card-proportional-value-payone-connector
最新稳定版本:2.0.1
Composer 安装命令:
composer require fond-of-oryx/gift-card-proportional-value-payone-connector
包简介
GiftCardProportionalValuePayoneConnector module.
README 文档
README
In our case, we need the proportional gift card values for every item in order, if a gift card was redeemed. For orders paid with payone and redeemed gift card, the spryker-eco/payone split the gift card amount proportional to the item amounts.
For example you made an order with three items, each item has a total price of 39,90 Euro and you use a 20 Euro gift card. The amount of 20 Euro will be split by 33,3333333%. One proportional amount will be 6,66 Euro and two times 6,67 Euro.
Another example you buy two items, one item 10 Euro and one item 30 Euro and you use a 20 Euro gift card. The proportional amount for this would be 5 Euro for the 10 Euro item and 15 Euro for the 30 Euro item.
For this, we use the calculation from the spryker-eco/payone package but had to create a fork (https://github.com/fond-of/payone/tree/feature/add-service) and make the calculation accessible from outside. A PR is also open (spryker-eco/payone#81) and we hope they will accept it soon. At the moment, this package requires the fork!
This package provides a calculation plugin for the fond-of-oryx/gift-card-proportional-value.
Installation
...
"repositories": [
{
"type": "vcs",
"url": "https://github.com/fond-of/payone"
}
],
"require": {
...
"spryker-eco/payone": "dev-master-fondof as 4.4.2",
...
},
...
...
composer require fond-of-oryx/gift-card-proportional-value-payone-connector
Configuration
<?php
namespace Pyz\Zed\GiftCardProportionalValue;
use FondOfOryx\Zed\GiftCardProportionalValue\GiftCardProportionalValueDependencyProvider as FooGiftCardProportionalValueDependencyProvider;
use FondOfOryx\Zed\GiftCardProportionalValuePayoneConnector\Communication\Plugin\GiftCardProportionalValue\PayoneProportionalValueCalculationPlugin;
class GiftCardProportionalValueDependencyProvider extends FooGiftCardProportionalValueDependencyProvider
{
/**
* @return array|\FondOfOryx\Zed\GiftCardProportionalValueExtension\Dependency\Plugin\ProportionalValueCalculationPluginInterface[]
*/
protected function getProportionalValueCalulationPlugins(): array
{
$plugins = [
new PayoneProportionalValueCalculationPlugin(),
];
return array_merge(parent::getProportionalValueCalulationPlugins(), $plugins);
}
}
You must allow in config some payone payment methods (by default empty)
$config[GiftCardProportionalValuePayoneConnectorConstants::LISTENING_PAYMENT_METHODS] = [
PayoneApiConstants::PAYMENT_METHOD_CREDITCARD,
PayoneApiConstants::PAYMENT_METHOD_E_WALLET,
];
or listen to every payone payment method. It is set to false by default
$config[GiftCardProportionalValuePayoneConnectorConstants::LISTENING_TO_ALL_PAYONE_METHODS] = true;
统计信息
- 总下载量: 12.84k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-06-15