-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.php
executable file
·26 lines (21 loc) · 914 Bytes
/
init.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
use RainLab\User\Models\User;
Event::listen('shohabbos.payme.existsAccount', function ($accounts, &$result, &$message) {
// find order or account
$result = User::find($accounts['user_id']);
});
// $result param by default is true
Event::listen('shohabbos.payme.checkAmount', function ($accounts, $amount, &$result, &$message) {
});
Event::listen('shohabbos.payme.performTransaction', function ($transaction, &$result, &$message) {
// check order as paid or fill user balance
$user = User::find($transaction->owner_id);
$user->balance += ($transaction->amount / 100);
$result = $user->save();
});
Event::listen('shohabbos.payme.cancelTransaction', function ($transaction, &$result, &$message) {
// check order as paid or fill user balance
$user = User::find($transaction->owner_id);
$user->balance -= ($transaction->amount / 100);
$result = $user->save();
});