-
Notifications
You must be signed in to change notification settings - Fork 0
/
Actions.php
51 lines (35 loc) · 1.41 KB
/
Actions.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php namespace components\payment; if(!defined('TX')) die('No direct access.');
class Actions extends \dependencies\BaseComponent
{
protected
$permissions = array(
// 'rabobank_omnikassa_return' => 0,
// 'rabobank_omnikassa_report' => 0,
'paypal_express_checkout' => 0,
'paypal_express_checkout_return' => 0
);
protected function paypal_express_checkout($data)
{
mk('Component')->load('payment', 'methods\\paypal\\PayPalHandler', false);
$tx = mk('Sql')->table('payment', 'Transactions')
->where('transaction_reference', "'".mk('Data')->get->tx."'")
->execute_single();
if($tx->is_empty())
throw \exception\NotFound('No transaction with this reference.');
$handler = methods\paypal\PayPalHandler::get_handler();
$handler->set_express_checkout($tx);
exit;
}
protected function paypal_express_checkout_return($data)
{
mk('Component')->load('payment', 'methods\\paypal\\PayPalHandler', false);
$handler = methods\paypal\PayPalHandler::get_handler();
$tx = $handler->transaction_callback(mk('Data')->request);
if($tx === false)
exit;
mk('Url')->redirect(url(
mk('Data')->session->payment->tx_return_urls->{$tx->transaction_reference->get()}->get()
,true));
mk('Data')->session->payment->tx_return_urls->{$tx->transaction_reference->get()}->un_set();
}
}