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);
}
}
$country = $this->countriesRepository->findByIsoCode('SK');
// currently valid vat rates for country
$currentVatRates = $this->vatRatesRepository->getByCountry($country);
// country vat rates valid when payment was paid
$pastVatRates = $this->vatRatesRepository->getByCountryAndDate($country, $payment->created_at);
sh
# upsert all EU members; API key loaded from config.neon
php bin/command.php payments:upsert_eu_vat_rates
# upsert all EU members; API key loaded from option
php bin/command.php payments:upsert_eu_vat_rates --vatstack_api_key={VAT-STACK-PUBLIC-API-KEY}
# upsert only one country (Slovakia in this example)
php bin/command.php payments:upsert_eu_vat_rates --country_code=SK
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.