fond-of-oryx/gift-card-proportional-value-no-payment-connector

GiftCardProportionalValueNoPaymentConnector module.

2.0.0 2023-01-24 12:59 UTC

This package is auto-updated.

Last update: 2024-10-27 12:44:33 UTC


README

CI license

In our case, we need the proportional gift card values for every item in order, if a gift card was redeemed. Completely paid orders with gift cards will be handled in our case as paid orders and uses the no payment workflow.

This package provides a calculation plugin for the fond-of-oryx/gift-card-proportional-value package and sets the item amount as proportional value for orders with payment method paid.

Installation

composer require fond-of-oryx/gift-card-proportional-value-no-payment-connector

Configuration

<?php

namespace Pyz\Zed\GiftCardProportionalValue;

use FondOfOryx\Zed\GiftCardProportionalValue\GiftCardProportionalValueDependencyProvider as FooGiftCardProportionalValueDependencyProvider;
use FondOfOryx\Zed\GiftCardProportionalValueNoPaymentConnector\Communication\Plugin\GiftCardProportionalValue\NoPaymentProportionalValueCalculationPlugin;

class GiftCardProportionalValueDependencyProvider extends FooGiftCardProportionalValueDependencyProvider
{
    /**
     * @return array|\FondOfOryx\Zed\GiftCardProportionalValueExtension\Dependency\Plugin\ProportionalValueCalculationPluginInterface[]
     */
    protected function getProportionalValueCalulationPlugins(): array
    {
        $plugins = [
            ...
            new NoPaymentProportionalValueCalculationPlugin(),
        ];

        return array_merge(parent::getProportionalValueCalulationPlugins(), $plugins);
    }

}