Skip to content

sbarbat/SyliusSagepayPlugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

This plugins provides integration for Direct (server) Sagepay integrations. It supports 3D Secure.

This plugin is been used at least on one production website with over 10,000 successfully processed transactions.

Sylius sagepay integration

Installation

$ composer require sbarbat/sylius-sagepay-plugin

Add plugin dependencies to your AppKernel.php file:

public function registerBundles()
{
    return array_merge(parent::registerBundles(), [
        ...
        
        new \Sbarbat\SyliusSagepayPlugin\SbarbatSyliusSagepayPlugin(),
    ]);
}

Optional Installation steps

Money Amount Conversion

By default sylius stores prices as integer values representing the amount in cents/pence or smallest unit.

If you have modified sylius to store money amounts in a different format, or with a different precision, then you will need to override.

Example, if your copy of sylius stores 4 decimals instead of 2, then you will need to override the class like this:

<?php declare(strict_types = 1);

namespace App\Provider\Sagepay;

use Sbarbat\SyliusSagepayPlugin\Provider\AmountProvider as BaseAmountProvider;
use Sylius\Component\Core\Model\PaymentInterface;


class AmountProvider extends BaseAmountProvider
{
	public function getAmount(PaymentInterface $payment): string
	{
		return (string) ($payment->getAmount() / 10000);
	}
}

and add an entry to your service config to point to it:

    Sbarbat\SyliusSagepayPlugin\Provider\AmountProvider:
        class: App\Provider\Sagepay\AmountProvider

Test Cards

Sagepay Direct Integration Protocol and Guidelines

Sagepay Form Integration Protocol and Guidelines

Support

Do you want us to customize this plugin for your specific needs? Write us an email on [email protected]