PHP code example of infinite-software / sylius-ecommpay-plugin
1. Go to this page and download the library: Download infinite-software/sylius-ecommpay-plugin library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
infinite-software / sylius-ecommpay-plugin example snippets
public function registerBundles()
{
return array_merge(parent::registerBundles(), [
...
new IS\SyliusEcommpayPlugin\ISSyliusEcommpayPlugin(),
]);
}
namespace App\Payment\Ecommpay;
//use ...;
final class ConvertPaymentAction implements ActionInterface, ApiAwareInterface
{
...
/**
* {@inheritDoc}
*
* @param Convert $request
*/
public function execute($request)
{
RequestNotSupportedException::assertSupports($this, $request);
/** @var PaymentInterface $payment */
$payment = $request->getSource();
/** @var OrderInterface $order */
$params = [
'payment_id' => $payment->getNumber(),
'payment_amount' => $payment->getTotalAmount(),
'payment_currency' => $payment->getCurrencyCode(),
'project_id' => $this->api['projectId'],
'customer_id' => $payment->getClientId(),
// my extra parameter
'force_payment_method' => 'card'
];
$request->setResult($params);
}
...
}