1 |
554 |
ahitrov |
<%once> |
2 |
|
|
|
3 |
|
|
my %NAMES = ( |
4 |
|
|
'MerchantBlock' => 'Authorized', |
5 |
|
|
'MerchantPay' => 'Charged', |
6 |
|
|
'MerchantRefund' => 'Refunded', |
7 |
|
|
); |
8 |
|
|
|
9 |
|
|
</%once> |
10 |
|
|
<%args> |
11 |
|
|
|
12 |
|
|
$SessionId => undef |
13 |
|
|
$OrderId => undef |
14 |
|
|
$Notification => undef |
15 |
|
|
$Success => undef |
16 |
|
|
$Amount => undef |
17 |
|
|
$CardNumber => undef |
18 |
|
|
$MerchantContract => undef |
19 |
|
|
|
20 |
|
|
</%args> |
21 |
|
|
<%init> |
22 |
|
|
|
23 |
|
|
warn Dumper \%ARGS; |
24 |
|
|
|
25 |
|
|
my $provider = payments::Provider::PayTure->new; |
26 |
|
|
my (@operations, $transaction); |
27 |
|
|
if ( $OrderId ) { |
28 |
|
|
@operations = $keeper->get_documents( |
29 |
|
|
class => 'payments::Operation', |
30 |
|
|
order_id => $OrderId, |
31 |
|
|
order_by => 'ctime', |
32 |
|
|
); |
33 |
|
|
($transaction) = $keeper->get_documents ( |
34 |
|
|
class => 'payments::Transaction', |
35 |
|
|
provider => $provider->payment_system, |
36 |
|
|
order_id => $OrderId, |
37 |
|
|
order_by => 'ctime desc', |
38 |
|
|
limit => 1, |
39 |
|
|
); |
40 |
|
|
} |
41 |
|
|
if ( ref $transaction ) { |
42 |
|
|
$transaction->name( $NAMES{$Notification} ); |
43 |
|
|
$transaction->success( $Success eq 'True' ? 1 : 0 ); |
44 |
|
|
$transaction->store; |
45 |
|
|
|
46 |
563 |
ahitrov |
if ( $transaction->success && $keeper->can('_payture_handler') ) { |
47 |
554 |
ahitrov |
$keeper->_payture_handler( $transaction ); |
48 |
|
|
} |
49 |
|
|
} |
50 |
|
|
|
51 |
|
|
</%init> |