1. Go to this page and download the library: Download remp/crm-payments-module 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/ */
remp / crm-payments-module example snippets
class FooModule extends Crm\ApplicationModule\CrmModule
{
// ...
public function registerEventHandlers(League\Event\Emitter $emitter)
{
$emitter->removeListener(
\Crm\PaymentsModule\Events\RecurrentPaymentCardExpiredEvent::class,
$this->getInstance(\Crm\PaymentsModule\Events\RecurrentPaymentCardExpiredEventHandler::class)
);
// ...
}
}
namespace Crm\FooModule\Model;
use Crm\PaymentsModule\Model\PaymentCompleteRedirectResolver;
use Nette\Database\Table\ActiveRow;
class FooPaymentCompleteRedirectResolver implements PaymentCompleteRedirectResolver
{
public function wantsToRedirect(?ActiveRow $payment, string $status): bool
{
if ($payment && $status === self::PAID) {
return $payment->payment_gateway->code === 'foo_gateway';
}
return false;
}
public function redirectArgs(?ActiveRow $payment, string $status): array
{
if ($payment && $status === self::PAID) {
return [
':Foo:SalesFunnel:Success',
['variableSymbol' => $payment->variable_symbol],
];
}
throw new \Exception('unhandled status when requesting redirectArgs (did you check wantsToRedirect first?): ' . $status);
}
}