churakovmike/yii2-free-kassa

Yii2 extension for Free Kassa

Installs: 531

Dependents: 0

Suggesters: 0

Security: 0

Stars: 3

Watchers: 1

Forks: 0

Open Issues: 0

Type:yii2-extension

1.3 2020-03-25 12:54 UTC

This package is auto-updated.

Last update: 2024-10-25 23:18:31 UTC


README

Yii2 free kassa extension. This packages provide to you forms, action filters, and component.

Latest Stable Version License

Getting started

install

The package is available on packagist.

composer require churakovmike/yii2-free-kassa

or add to require section

"churakovmike/yii2-free-kassa": "~1.3"

Add components to config

You need to add component config in main-local.php

'freeKassaComponent' => [
    'class' => \ChurakovMike\Freekassa\FreeKassaComponent::class,
    'merchantId' => 'merchant-id',
    'firstSecret' => 'your-first-secret',
    'secondSecret' => 'your-second-secret',
],

Add action filter(optional)

If you want to check callback sender, you need to add CheckIpFilter to behaviours

public function behaviors()
{
    return [
        ChurakovMike\Freekassa\filters\CheckIpFilter::class,
     ]
}

Forms usage

This package provide to you form for fast load and validate free-kassa callback.

$form = new ChurakovMike\Freekassa\forms\SuccessPayForm();
$form->setAttributes(\Yii::$app->request->post());
$form->validate();

Components usage

/** @var FreeKassaComponent $component */
$component = \Yii::$app->freeKassaComponent;

Check signature with component

/** @var FreeKassaComponent $component */
$component = \Yii::$app->freeKassaComponent;
$component->validateSignature($amount, $orderId, $signature);

You can take signature from SuccessPayForm in property $form->sign

Generate pyment link

/** @var FreeKassaComponent $component */
$component = \Yii::$app->freeKassaComponent;
$component->generatePaymentLink($orderId, $sum, $description);

Export orders to xml

$orders = $component->exportOrders($limit, $offset, $status, $dateFrom, $dateTo);

Check balance

$balance = $component->getBalance();

Check order

$balance = $component->getOrder($orderId, $intid);

Withdraw money

$withdraw = $component->withdraw($amount, $currency);

Invoicing

$invoice = $component->invoice($email, $amount, $description);

Get wallet balance

$balance = $component->getWalletBalance();

Withdraw money from wallet

$withdraw = $component->walletWithdraw($purse, $amount, $currency, $desc, $disableExchange);

Get wallet operation status

$status = $component->getOperationStatus($paymentId);

Transfer money to another wallet

$transfer = $component->transferMoney($purse, $amount);

Payment for online services

$payment = $component->onlinePayment($serviceId, $account, $amount);

Get list of services for online payment

$list = $component->getOnlineServices();

Check status online payment

$status = $component->getOnlinePaymentStatus($paymentId);

Create crypto walllet address

$btc = $component->createBTCAddress();
$ltc = $component->createLTCAddress();
$eth = $component->createETHAddress();

Get crypto wallet address

$btc = $component->getBTCAddress();
$ltc = $component->getLTCAddress();
$eth = $component->getETHAddress();

Get information about transaction

$btcTransaction = $component->getBTCTransaction();
$ltcTransaction = $component->getLTCTransaction();
$ethTransaction = $component->getETHTransaction();