Revision 407
- Date:
- 2014/01/22 14:28:44
- Files:
Legend:
- Added
- Removed
- Modified
-
utf8/plugins/payments/comps/www/payment.backend/xsolla_v2_pay.xml
37 37 my @valid_ips = @{$state->{payments}{xsolla_valid_ips}}; 38 38 my %codes = ( 39 39 '0' => 'Success', 40 '10' => 'Another delivery attempt', 41 '20' => 'Wrong parameters', 40 '20' => 'Wrong order identity', 42 41 '30' => 'Temporary error', 43 42 '40' => 'Fatal error', 44 43 ); … … 95 94 } 96 95 if ( $security_check ) { 97 96 my $last = $keeper->{payments}->check( $v1 ); 98 if ( $last->name eq 'cancel' ) { 99 $code = 40; 100 } elsif ( $last->name eq 'suspend' ) { 101 $code = 20; 102 } 103 unless ( $code ) { 104 ($transaction) = $keeper->get_documents( 105 class => 'payments::Transaction', 106 order_id => $v1, 107 operation_id => $id, 108 provider => 'xsolla', 109 limit => 1, 110 ); 111 if ( ref $transaction ) { 112 $code = 10; 113 } else { 114 my $dt = $datetime =~ /^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ ? "$1-$2-$3 $4:$5:$6" : ''; 115 $transaction = payments::Transaction->new( $keeper ); 116 $transaction->status( $test || 0 ); 117 $transaction->provider( 'xsolla' ); 118 $transaction->order_id( $v1 ); 119 $transaction->operation_id( $id ); 120 $transaction->sum( $amount ); 121 $transaction->currency_code( $currency ); 122 $transaction->dtime( $dt ) if $dt; 123 $transaction->custom1( $v2 ); 124 $transaction->custom2( $v3 ); 125 $transaction->name( $v2 || $v3 ); 126 $transaction->store(); 97 if ( $last ) { 98 if ( $last->name eq 'cancel' || $last->name eq 'suspend') { 99 $code = 20; 100 } 101 unless ( $code ) { 102 ($transaction) = $keeper->get_documents( 103 class => 'payments::Transaction', 104 order_id => $v1, 105 operation_id => $id, 106 provider => 'xsolla', 107 limit => 1, 108 ); 109 if ( ref $transaction ) { 110 $code = 0; 111 } else { 112 my $dt = $datetime =~ /^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ ? "$1-$2-$3 $4:$5:$6" : ''; 113 $transaction = payments::Transaction->new( $keeper ); 114 $transaction->status( $test || 0 ); 115 $transaction->provider( 'xsolla' ); 116 $transaction->order_id( $v1 ); 117 $transaction->operation_id( $id ); 118 $transaction->sum( $amount ); 119 $transaction->currency_code( $currency ); 120 $transaction->dtime( $dt ) if $dt; 121 $transaction->custom1( $v2 ); 122 $transaction->custom2( $v3 ); 123 $transaction->name( $v2 || $v3 ); 124 $transaction->store(); 127 125 128 if ( $keeper->can('_xsolla_handler') ) { 129 unless ( $keeper->_xsolla_handler( $transaction ) ) { 130 $code = 30; 126 if ( $keeper->can('_xsolla_handler') ) { 127 unless ( $keeper->_xsolla_handler( $transaction ) ) { 128 $code = 30; 129 } 131 130 } 132 131 } 133 132 } 133 } else { 134 $code = 20; 134 135 } 135 136 } else { 136 137 warn "Wrong transaction parameters: IP=$ip. Available ip list [".Dumper(\@valid_ips)."]. String: $str. MD5: $md5. Sign: $sign\n"; 137 $code = 20; 138 $code = 40; 138 139 } 139 140 140 141 </%init>