Skip to content

shoxabbos/oc-click-plugin

Repository files navigation

You can find documentation in here http://docs.click.uz/

You can like this listen Plugin events and expand functionality

<?php
use Shohabbos\BookShop\Models\Order;

Event::listen('shohabbos.click.existsAccount', function ($accounts, &$result, &$message) {
    // find order or account
	$result = Order::find($accounts['order_id']);
});

// $result param by default is true
Event::listen('shohabbos.click.checkAmount', function ($accounts, $amount, &$result, &$message) {
    // check amount
    $order = Order::find($accounts['order_id']);
    
    if ($order->amount != $amount) {
	$result = false;	
    }
});

Event::listen('shohabbos.click.performTransaction', function ($transaction, &$result, &$message) {
    // check order as paid or fill user balance
	$order = Order::find($transaction->owner_id);
	$order->is_paid = 1;
	$result = $order->save();
});

Event::listen('shohabbos.click.cancelTransaction', function ($transaction, &$result, &$message) {
    // check order as cancelled or take away from user balance
	$order = Order::find($transaction->owner_id);
	$order->is_paid = 0;
	$result = $order->save();
});

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published