Skip to content

rust-le/RefundPlugin

 
 

Repository files navigation

Sylius Logo.

Refund Plugin

This plugin provides basic refunds functionality for Sylius application.


Documentation

📖 Full documentation is available here: 👉 Refund Plugin Documentation

Customization

Adding Custom Refund Types

If you need to add custom refund types (e.g., fees, commissions), you can extend the RefundType class:

  1. Create your custom RefundType class:
<?php

declare(strict_types=1);

namespace App\Model;

use Sylius\RefundPlugin\Model\RefundType as BaseRefundType;
use Sylius\RefundPlugin\Model\RefundTypeInterface;

class RefundType extends BaseRefundType implements RefundTypeInterface
{
    public const ORDER_FEES = 'commission';

    public static function commission(): self
    {
        return new self(self::ORDER_FEES);
    }
}
  1. Create your custom Doctrine RefundEnumType:
<?php

declare(strict_types=1);

namespace App\Doctrine\Type;

use App\Model\RefundType;
use Sylius\RefundPlugin\Entity\Type\RefundEnumType as BaseRefundEnumType;
use Sylius\RefundPlugin\Model\RefundTypeInterface;

class RefundEnumType extends BaseRefundEnumType
{
    protected function createType(string $value): RefundTypeInterface
    {
        return new RefundType($value);
    }
}
  1. Configure your application to use the custom classes:
# config/packages/sylius_refund.yaml
imports:
    - { resource: "@SyliusRefundPlugin/config/parameters.php" }

parameters:
    sylius_refund.refund_type: App\Model\RefundType
    sylius_refund.refund_enum_type: App\Doctrine\Type\RefundEnumType
  1. Clear the cache:
php bin/console cache:clear

Now you can use your custom refund type in templates and business logic.

Security issues

If you think that you have found a security issue, please do not use the issue tracker and do not post it publicly. Instead, all security issues must be sent to security@sylius.com.

Community

For online communication, we invite you to chat with us and other users on Sylius Slack.

License

This plugin is released under the MIT License.

About

Basic refunds functionality for Sylius

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 84.2%
  • Gherkin 10.6%
  • Twig 5.0%
  • Other 0.2%