Line # Revision Author
1 358 ahitrov SUCCESS
2 <%once>
3
4 use Digest::MD5;
5
6 </%once>
7 <%args>
8
9 $MNT_ID => undef
10 $MNT_TRANSACTION_ID => undef
11 $MNT_OPERATION_ID => undef
12 $MNT_AMOUNT => 0
13 $MNT_CURRENCY_CODE => undef
14 $MNT_TEST_MODE => 0
15 $MNT_SIGNATURE => undef
16 $MNT_USER => undef
17 $MNT_CORRACCOUNT => undef
18 $MNT_CUSTOM1 => undef
19 $MNT_CUSTOM2 => undef
20 $MNT_CUSTOM3 => undef
21
22 </%args>
23 <%init>
24
25 warn Dumper \%ARGS if $DEBUG;
26 unless ( $MNT_ID && $MNT_TRANSACTION_ID && $MNT_OPERATION_ID && $MNT_AMOUNT && $MNT_CURRENCY_CODE ) {
27 $m->out('FAIL');
28 return;
29 }
30
31 my ($obj) = $keeper->get_documents(
32 class => 'monetaru::Transaction',
33 operation_id => $MNT_OPERATION_ID,
34 order_id => $MNT_TRANSACTION_ID,
35 limit => 1,
36 );
37 my $str = $MNT_ID . $MNT_TRANSACTION_ID . $MNT_OPERATION_ID . $MNT_AMOUNT . $MNT_CURRENCY_CODE . $MNT_TEST_MODE . $state->{monetaru}->{moneta_sig_code};
38 my $md5 = Digest::MD5::md5_hex ( $str );
39 unless ( $MNT_SIGNATURE eq $md5 ) {
40 $m->out('FAIL');
41 return;
42 }
43
44 unless ( $obj ) {
45 $obj = monetaru::Transaction->new( $keeper );
46 $obj->status( $MNT_TEST_MODE || 0 );
47 $obj->account_id( $MNT_ID );
48 $obj->order_id( $MNT_TRANSACTION_ID );
49 $obj->operation_id( $MNT_OPERATION_ID );
50 $obj->sum( $MNT_AMOUNT );
51 $obj->currency_code( $MNT_CURRENCY_CODE );
52 $obj->account_user( $MNT_USER );
53 $obj->account_corr( $MNT_CORRACCOUNT );
54 $obj->payment_system( $ARGS{'paymentSystem.unitId'} );
55 $obj->name( $MNT_CUSTOM1 );
56 $obj->custom1( $MNT_CUSTOM1 );
57 $obj->custom2( $MNT_CUSTOM2 );
58 $obj->custom3( $MNT_CUSTOM3 );
59 $obj->store;
60 }
61
62 </%init>