Revision 405
- Date:
- 2014/01/21 12:50:51
- Files:
Legend:
- Added
- Removed
- Modified
-
utf8/plugins/payments/comps/www/payment.backend/xsolla_v2_pay.xml
32 32 <%once> 33 33 34 34 use Digest::MD5; 35 use Net::Subnet; 36 35 37 my @valid_ips = @{$state->{payments}{xsolla_valid_ips}}; 36 38 my %codes = ( 37 39 '0' => 'Success', … … 40 42 '30' => 'Temporary error', 41 43 '40' => 'Fatal error', 42 44 ); 45 my @valid_subnets = grep { index($_, '/') > 0 } @valid_ips; 46 my $subnet_matcher; 47 if ( @valid_subnets ) { 48 $subnet_matcher = subnet_matcher @valid_subnets; 49 @valid_ips = grep { index($_, '/') == -1 } @valid_ips; 50 } 43 51 44 52 </%once> 45 53 <%args> … … 74 82 my $ip = $r->header_in('X-Real-IP'); 75 83 warn "From IP=$ip\n" if $DEBUG; 76 84 my $transaction; 77 if ( $md5 eq $sign && grep { $ip eq $_ } @valid_ips ) { 85 my $security_check = $md5 eq $sign ? 1 : 0; 86 if ( $security_check ) { 87 if ( grep { $ip eq $_ } @valid_ips ) { 88 } elsif ( @valid_subnets ) { 89 $security_check = $subnet_matcher->($ip); 90 warn "IP [$ip] didn't match any of ".Dumper(\@valid_subnets)." subnets nor ".Dumper(\@valid_ips)." single IPs\n"; 91 } else { 92 $security_check = 0; 93 warn "IP [$ip] didn't match any of ".Dumper(\@valid_ips)." single IPs\n"; 94 } 95 } 96 if ( $security_check ) { 78 97 my $last = $keeper->{payments}->check( $v1 ); 79 98 if ( $last->name eq 'cancel' ) { 80 99 $code = 40; -
utf8/plugins/payments/lib/payments/Provider/Xsolla.pm
8 8 use payments::Keeper; 9 9 use Digest::MD5; 10 10 use Data::Dumper; 11 use Net::Subnet; 11 12 12 13 13 sub get_iframe { 14 14 my $self = shift; 15 15 my (%opts) = @_;