Ogone.pm

filter: Statementstmt 84.4% 114 / 135 Branchbran 59.3% 38 / 64 Conditioncond 47.9% 23 / 48 MC/DCmcdc 14.8% 4 / 27 Subroutinesub 84.6% 11 / 13 Podpod 50.0% 1 / 2 totaltotal 66.0% 191 / 289 CC 52 SCAR 47.0
CC
52
Cov
71%
submit
140.0
__ANON__
2.0
_info
2.0
CRAP 109.7
↑ Summary Ogone/Status.pm »
1 package Business::OnlinePayment::Ogone;
2 4 our $AUTHORITY = 'cpan:ESSELENS';
3 4 ▶use parent 'Business::OnlinePayment::HTTPS';
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use strict; # keep Perl::Critic happy over common::sense;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use common::sense;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 4 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 ▶use XML::Simple qw/:strict/;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 ▶use Digest::SHA qw/sha1_hex sha256_hex sha512_hex/;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 4 ▶use MIME::Base64;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 # ABSTRACT: Online payment processing via Ogone
12 4 our $VERSION = 0.2;
13 4 our $API_VERSION = 4.9;
14  
15 # Ogone config defaults and info ######################################################################################
16  
17 1 our %defaults = (
18 server => 'secure.ogone.com',
19 port => 443,
20 );
21  
22 1 our %info = (
23 'info_compat' => '0.01', # always 0.01 for now,
24 'gateway_name' => 'Ogone',
25 'gateway_url' => 'http://www.ogone.com/',
26 'module_version' => $VERSION,
27 'supported_types' => [ qw( CC ) ],
28 'token_support' => 0, #card storage/tokenization support
29 'test_transaction' => 1, #set true if ->test_transaction(1) works
30 'supported_actions' => [
31 'Authorization Only',
32 'Post Authorization',
33 'Query',
34 'Credit',
35 ]
36 );
37  
38 # Methods #############################################################################################################
39  
40 0 ▶sub _info {
Subroutine _info: not called CC=1 SCAR=6.9
41 0 return \%info;
42 }
43  
44 15 ▶sub set_defaults {
Subroutine set_defaults: called CC=2 SCAR=6.9
Pod undocumented
45 15 my $self = shift;
46 15 my %data = @_;
47 15 $self->{$_} = $defaults{$_} for keys %defaults;
48  
49 15 $self->build_subs(qw/http_args result_xml/);
50 }
51  
52  
53 13 ▶sub submit {
Subroutine submit: called CC=50 SCAR=49.4
Pod documented
54 13 my $self = shift;
55 13 my %data = $self->content();
56  
57 # do not allow submitting same object twice
58 13 ▶ croak 'submitting same object twice is not allowed' if $self->{_dirty}; $self->{_dirty} = 1;
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_dirty"} 0 13 13
59  
60 # Turn the data into a format usable by the online processor
61 13 ▶ croak 'no action parameter defined in content' unless exists $self->{_content}->{action};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"_content"}{"action"} 1 12 13
62  
63 # Default currency to Euro
64 12 ▶ $self->{_content}->{currency} ||= 'EUR';
Condition50%1/2
$self->{"_content"}{"currency"} ||= "EUR"
l!l
012
MC/DC0%0/1
$self->{"_content"}{"currency"} ||= "EUR"
$self->{"_content"}{"currency"}
Truth table50%1/2
A
A= $self->{"_content"}{"currency"}
Aresult
11
00
65  
66 # Table to translate from Business::OnlinePayment::Ogone args to Ogone API args
67 # The values of this hash are also used as a list of allowed args for the HTTP POST request, thus preventing information leakage
68 12 my %ogone_api_args = (
69 # credentials
70 login => 'USERID',
71 password => 'PSWD',
72 PSPID => 'PSPID',
73
74 # primary identifier
75 invoice_number => 'orderID',
76
77 # transaction identifiers (action = query)
78 payid => 'PAYID',
79 payidsub => 'PAYIDSUB',
80
81 # credit card data
82 card_number => 'CARDNO',
83 cvc => 'CVC',
84 expiration => 'ED',
85 alias => 'ALIAS',
86
87 # financial data
88 currency => 'Currency',
89 amount => 'amount',
90
91 # Ogone specific arguments
92 operation => 'Operation', # REN, DEL, DES, SAL, SAS, RFD, RFS
93 eci => 'ECI', # defaults 7: e-commerce with ssl (9: recurring e-commerce)
94 accepturl => 'accepturl',
95 declineurl => 'declineurl',
96 exceptionurl => 'exceptionurl',
97 paramplus => 'paramplus',
98 complus => 'complus',
99 language => 'LANGUAGE',
100  
101 # Business::OnlinePayment common
102 description => 'COM',
103 name => 'CN',
104 email => 'EMAIL',
105 address => 'Owneraddress',
106 zip => 'OwnerZip',
107 city => 'ownertown',
108 country => 'ownercty',
109 phone => 'ownertelno',
110  
111 # client authentication (not used directly, only here as valid HTTP POST arg)
112 SHASign => 'SHASign', # see sha_key, sha_type
113
114 # 3d secure arguments
115 flag3d => 'FLAG3D',
116 win3ds => 'win3ds',
117 http_accept => 'HTTP_ACCEPT',
118 http_user_agent => 'HTTP_USER_AGENT',
119  
120 # recurrent fields
121 subscription_id => 'SUBSCRIPTION_ID',
122 subscription_orderid => 'SUB_ORDERID',
123 subscription_status => 'SUBSCRIPTION_STATUS',
124 startdate => 'SUB_STARTDATE',
125 enddate => 'SUB_ENDDATE',
126 status => 'SUB_STATUS',
127 period_unit => 'SUB_PERIOD_UNIT', # 'd', 'ww', 'm' (yes two 'w's) for resp daily weekly monthly
128 period_moment => 'SUB_PERIOD_MOMENT', # Integer, the moment in time on which the payment is (0-7 when period_unit is ww, 1-31 for d, 1-12 for m?)
129 period_number => 'SUB_PERIOD_NUMBER',
130 );
131  
132 # Only allow max of 2 digits after comma as we need to int ( $amount * 100 ) for Ogone
133 12 ▶ croak 'max 2 digits after comma (or dot) allowed' if $self->{_content}->{amount} =~ m/[\,\.]\d{3}/;
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_content"}{"amount"} =~ /[\,\.]\d{3}/u 0 12 12
134  
135 # Ogone has multiple users per login, defaults to login
136 12 ▶ $self->{_content}->{PSPID} ||= $self->{pspid} || $self->{PSPID} || $self->{login} || $self->{_content}->{login};
Condition41%5/12
$self->{"_content"}{"PSPID"} ||= $self->{"pspid"} || $self->{"PSPID"} || $self->{"login"} || $self->{"_content"}{"login"}
l!l&&r!l&&!r
1002
$self->{'pspid'} || $self->{'PSPID'} || $self->{'login'} || $self->{'_content'}{'login'}
l!l&&r!l&&!r
002
$self->{"pspid"} or $self->{"PSPID"} or $self->{"login"}
l!l&&r!l&&!r
002
$self->{"pspid"} or $self->{"PSPID"}
l!l&&r!l&&!r
002
MC/DC0%0/5
$self->{"_content"}{"PSPID"} ||= $self->{"pspid"} || $self->{"PSPID"} || $self->{"login"} || $self->{"_content"}{"login"}
$self->{"_content"}{"PSPID"} $self->{"pspid"} $self->{"PSPID"} $self->{"login"} $self->{'_content'}{'login'}
Truth table0%0/6
A ||= B or C or D || E
A= $self->{"_content"}{"PSPID"}B= $self->{"pspid"}C= $self->{"PSPID"}D= $self->{"login"}E= $self->{'_content'}{'login'}
ABCDEresult
1XXXX1
01XXX1
001XX1
0001X1
000011
000000
137  
138 # Login information, default to constructor values
139 12 ▶ $self->{_content}->{login} ||= $self->{login};
Condition66%2/3
$self->{"_content"}{"login"} ||= $self->{"login"}
l!l&&r!l&&!r
1002
MC/DC50%1/2
$self->{"_content"}{"login"} ||= $self->{"login"}
$self->{"_content"}{"login"} $self->{"login"}
Truth table66%2/3
A ||= B
A= $self->{"_content"}{"login"}B= $self->{"login"}
ABresult
1X1
011
000
140 12 ▶ $self->{_content}->{password} ||= $self->{password};
Condition66%2/3
$self->{"_content"}{"password"} ||= $self->{"password"}
l!l&&r!l&&!r
1002
MC/DC50%1/2
$self->{"_content"}{"password"} ||= $self->{"password"}
$self->{"_content"}{"password"} $self->{"password"}
Truth table66%2/3
A ||= B
A= $self->{"_content"}{"password"}B= $self->{"password"}
ABresult
1X1
011
000
141  
142 # Default Operation request for authorization (RES) for authorization only, (capture full and close) SAS for post authorization
143 12 ▶ $self->{_content}->{operation} ||= 'RES' if $self->{_content}->{action} =~ m/authorization only/;
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_content"}{"action"} =~ /authorization only/u 5 7 12
Condition50%1/2
$self->{"_content"}{"operation"} ||= "RES"
l!l
05
MC/DC0%0/1
$self->{"_content"}{"operation"} ||= "RES"
$self->{"_content"}{"operation"}
Truth table50%1/2
A
A= $self->{"_content"}{"operation"}
Aresult
11
00
144 12 ▶ $self->{_content}->{operation} ||= 'SAL' if $self->{_content}->{action} =~ m/normal authorization/;
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_content"}{"action"} =~ /normal authorization/u 0 12 12
Condition0%0/2
$self->{"_content"}{"operation"} ||= "SAL"
l!l
00
MC/DC0%0/1
$self->{"_content"}{"operation"} ||= "SAL"
$self->{"_content"}{"operation"}
Truth table0%0/2
A
A= $self->{"_content"}{"operation"}
Aresult
11
00
145 12 ▶ $self->{_content}->{operation} ||= 'SAS' if $self->{_content}->{action} =~ m/post authorization/;
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_content"}{"action"} =~ /post authorization/u 4 8 12
Condition100%2/2
$self->{"_content"}{"operation"} ||= "SAS"
l!l
22
MC/DC100%1/1
$self->{"_content"}{"operation"} ||= "SAS"
$self->{"_content"}{"operation"}
Truth table100%2/2
A
A= $self->{"_content"}{"operation"}
Aresult
11
00
146  
147 # Default ECI is SSL e-commerce (7) or Recurring with e-commerce (9) if subscription_id exists
148 12 ▶ $self->{_content}->{eci} ||= $self->{_content}->{subscription_id} ? 9 : 7;
Branch: 1 branch
BranchTrueFalseTotal
$self->{'_content'}{'subscription_id'} ? : 0 12 12
Condition33%1/3
$self->{"_content"}{"eci"} ||= $self->{"_content"}{"subscription_id"} ? 9 : 7
l!l&&r!l&&!r
0120
MC/DC0%0/2
$self->{"_content"}{"eci"} ||= $self->{"_content"}{"subscription_id"} ? 9 : 7
$self->{"_content"}{"eci"} $self->{"_content"}{"subscription_id"} ? 9 : 7
Truth table33%1/3
A ||= B
A= $self->{"_content"}{"eci"}B= $self->{"_content"}{"subscription_id"} ? 9 : 7
ABresult
1X1
011
000
149  
150 # Remap the fields to their Ogone-API counterparts ie: cvc => CVC
151 12 $self->remap_fields(%ogone_api_args);
152  
153 12 ▶ croak "no sha_key provided" if $self->{_content}->{sha_type} && ! $self->{_content}->{sha_key};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_content"}{"sha_type"} and not $self->{"_content"}{"sha_key"} 0 12 12
Condition66%2/3
$self->{"_content"}{"sha_type"} and not $self->{"_content"}{"sha_key"}
!ll&&!rl&&r
390
MC/DC0%0/2
$self->{"_content"}{"sha_type"} and not $self->{"_content"}{"sha_key"}
$self->{"_content"}{"sha_type"} not $self->{"_content"}{"sha_key"}
Truth table66%2/3
A and not(B)
A= $self->{"_content"}{"sha_type"}B= not $self->{"_content"}{"sha_key"}
ABresult
0X0
100
111
154
155 # These fields are required by Businiess::OnlinePayment::Ogone
156 12 my @args_basic = (qw/login password PSPID action/);
157 12 my @args_ccard = (qw/card_number expiration cvc/);
158 12 my @args_alias = (qw/alias cvc/);
159 my @args_recur = (@args_basic, qw/name subscription_id subscription_orderid invoice_number amount currency startdate enddate period_unit period_moment period_number/, $self->{_content}->{card_numer} ? @args_ccard : @args_alias ),
160 12 ▶ my @args_new = (@args_basic, qw/invoice_number amount currency/, $self->{_content}->{card_number} ? @args_ccard : @args_alias);
Branch: 2 branches
BranchTrueFalseTotal
$self->{'_content'}{'card_numer'} ? : 0 12 12
$self->{'_content'}{'card_number'} ? : 8 4 12
161 12 my @args_post = (@args_basic, qw/invoice_number/);
162 12 my @query = (@args_basic, qw/invoice_number/);
163  
164 # Poor man's given/when
165 12 my %action_arguments = (
166 qr/normal authorization/i => \@args_new,
167 qr/authorization only/i => \@args_new,
168 qr/post authorization/i => \@args_post,
169 qr/query/i => \@query,
170 qr/recurrent authorization/i => \@args_recur
171 );
172  
173 # Compile a list of required arguments
174 11 my @args = map { @{$action_arguments{$_}} } # lookup value using regex, return dereffed arrayref
175 12 grep { $self->{_content}->{action} =~ $_ } # compare action input against regex key
176 keys %action_arguments; # extract regular expressions
177  
178 12 ▶ croak 'unable to determine HTTP POST @args, is the action parameter one of ( authorization only | normal authorization | post authorization | query | recurrent authorization )' unless @args;
Branch: 1 branch
BranchTrueFalseTotal
unless @args 1 11 12
179  
180 # Enforce the field requirements by calling parent
181 11 my @undefs = grep { ! defined $self->{_content}->{$_} } @args;
182
183 11 ▶ croak "missing required args: ". join(',',@undefs) if scalar @undefs;
Branch: 1 branch
BranchTrueFalseTotal
if scalar @undefs 1 10 11
184  
185 # Your module should check to see if the require_avs() function returns true, and turn on AVS checking if it does.
186 10 ▶ if ( $self->require_avs() ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->require_avs) 0 10 10
187 0 $self->{_content}->{CHECK_AAV} = 1;
188 0 $self->{_content}->{CAVV_3D} = 1;
189 }
190  
191 # Define all possible arguments for http request
192 10 my @all_http_args = (values %ogone_api_args);
193  
194 # Construct the HTTP POST parameters by selecting the ones which are defined from all_http_args
195 127 my %http_req_args = map { $_ => $self->{_content}{$_} }
196 420 grep { defined $self->{_content}{$_} }
197 10 ▶ map { $ogone_api_args{$_} || $_ } @all_http_args;
Condition66%2/3
$ogone_api_args{$_} || $_
l!l&&r!l&&!r
903300
MC/DC0%0/2
$ogone_api_args{$_} || $_
$ogone_api_args{$_} $_
Truth table66%2/3
A || B
A= $ogone_api_args{$_}B= $_
ABresult
1X1
011
000
198  
199 # Ogone accepts the amount as 100 fold in integer form.
200 # # Adding 0.5 to amount to prevent "rounding" errors, see http://stackoverflow.com/a/1274692 or perldoc -q round
201 10 ▶ $http_req_args{amount} = int(100 * $http_req_args{amount} + 0.5) if exists $http_req_args{amount};
Branch: 1 branch
BranchTrueFalseTotal
if exists $http_req_args{"amount"} 9 1 10
202  
203 # Map normal fields to their SUB_ counterparts when recurrent authorization is used
204 10 ▶ if($self->{_content}->{action} =~ m/recurrent authorization/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"_content"}{"action"} =~ /recurrent authorization/u) 0 10 10
205 0 ▶ $http_req_args{SUB_COMMENT} = $http_req_args{COM} if exists $http_req_args{COM};
Branch: 1 branch
BranchTrueFalseTotal
if exists $http_req_args{"COM"} 0 0 0
206 0 $http_req_args{SUB_AMOUNT} = $http_req_args{amount};
207 0 $http_req_args{SUB_ORDERID} = $http_req_args{orderID};
208 }
209  
210 # PSPID might be entered in lowercase (as per old documentation)
211 10 ▶ $http_req_args{PSPID} = $self->{_content}{pspid} if defined $self->{_content}{pspid};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"_content"}{"pspid"} 0 10 10
212  
213 # Calculate sha1 by default, but has to be enabled in the Ogone backend to have any effect
214 10 my ($sha_type) = ($self->{_content}->{sha_type} =~ m/^(1|256|512)$/);
215  
216 # Create a reference to the correct sha${sha_type}_hex function, default to SHA-1
217 4 ▶ my $sha_hex = sub { my $type = shift; no strict; &{"sha".($type || 1)."_hex"}(@_); use strict; };
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: not called CC=2 SCAR=7.0
Condition0%0/2
$type || 1
l!l
00
MC/DC0%0/1
$type || 1
$type
Truth table0%0/2
A
A= $type
Aresult
11
00
218  
219 # Algo: make a list of "KEY=value$passphrase" sort alphabetically
220 my $signature = join('',
221 10 ▶ sort map { uc($_) . "=" . $http_req_args{$_} . ($self->{_content}{sha_key} || '') }
Condition100%2/2
$self->{'_content'}{'sha_key'} || ''
l!l
1198
MC/DC100%1/1
$self->{'_content'}{'sha_key'} || ''
$self->{'_content'}{'sha_key'}
Truth table100%2/2
A
A= $self->{'_content'}{'sha_key'}
Aresult
11
00
222 keys %http_req_args);
223  
224 10 $http_req_args{SHASign} = $sha_hex->($sha_type,$signature);
225  
226 # Construct the URL to query, taking into account the action and test_transaction values
227 10 my %action_file = (
228 qr/normal authorization/i => 'orderdirect.asp',
229 qr/authorization only/i => 'orderdirect.asp',
230 qr/recurrent authorization/i => 'orderdirect.asp',
231 qr/post authorization/i => 'maintenancedirect.asp',
232 qr/query/i => 'querydirect.asp',
233 );
234  
235 10 ▶ my $uri_dir = $self->test_transaction() ? 'test' : 'prod';
Branch: 1 branch
BranchTrueFalseTotal
$self->test_transaction ? : 10 0 10
236 10 my ($uri_file) = map { $action_file{$_} }
237 10 grep { $self->{_content}->{action} =~ $_ }
238 keys %action_file;
239  
240 10 ▶ croak 'unable to determine URI path, is the action parameter one of ( authorization only | normal authorization | post authorization | query | recueent authorization)' unless $uri_file;
Branch: 1 branch
BranchTrueFalseTotal
unless $uri_file 0 10 10
241
242 # Construct the path to be used in https_post
243 10 $self->{path} = '/ncol/'.$uri_dir.'/'.$uri_file;
244  
245 # Save the http args for later inspection
246 10 $self->http_args(\%http_req_args);
247  
248 # Submit the transaction to the processor and collect a response.
249 10 my ($page, $response_code, %reply_headers) = $self->https_post(%http_req_args);
250  
251 # Call server_response() with a copy of the entire unprocessed response
252 10 $self->server_response([$response_code, \%reply_headers, $page]);
253  
254 10 my $xml = XMLin($page, ForceArray => [], KeyAttr => [] );
255  
256 # Store the result xml for later inspection
257 10 $self->result_xml($xml);
258  
259 10 ▶ croak 'Ogone refused SHA digest' if $xml->{NCERRORPLUS} =~ m#^unknown order/1/s#;
Branch: 1 branch
BranchTrueFalseTotal
if $xml->{"NCERRORPLUS"} =~ m[^unknown order/1/s]u 0 10 10
260  
261 # Call is_success() with either a true or false value, indicating if the transaction was successful or not.
262 10 ▶ if ( $response_code =~ m/^200/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($response_code =~ /^200/u) { } 10 0 10
263 10 $self->is_success(0); # defaults to fail
264  
265  
266 # croak 'incorrect credentials. WARNING: continuing with bad credentials will block your account s: '.$xml->{STATUS}.'{}'.$xml->{NCERROR} if $xml->{NCERROR} eq '50001119';
267  
268 0 ▶ if ( $xml->{STATUS} == 46 ) { $self->is_success(1) } # identification required
Branch: 1 branch
BranchTrueFalseTotal
if ($xml->{"STATUS"} == 46) 0 10 10
269 0 ▶ if ( $xml->{STATUS} == 5 ) { $self->is_success(1) } # authorization accepted
Branch: 1 branch
BranchTrueFalseTotal
if ($xml->{"STATUS"} == 5) 0 10 10
270 0 ▶ if ( $xml->{STATUS} == 9 ) { $self->is_success(1) } # payment accepted
Branch: 1 branch
BranchTrueFalseTotal
if ($xml->{"STATUS"} == 9) 0 10 10
271 0 ▶ if ( $xml->{STATUS} == 91 ) { $self->is_success(1) } # partial payment accepted
Branch: 1 branch
BranchTrueFalseTotal
if ($xml->{"STATUS"} == 91) 0 10 10
272 0 ▶ if ( $xml->{STATUS} == 61 ) { $self->is_success(1) } # Author. deletion waiting
Branch: 1 branch
BranchTrueFalseTotal
if ($xml->{"STATUS"} == 61) 0 10 10
273 0 ▶ if ( $xml->{STATUS} == 2 ) { $self->failure_status('refused') } # authorization refused
Branch: 1 branch
BranchTrueFalseTotal
if ($xml->{"STATUS"} == 2) 0 10 10
274 0 ▶ if ( $xml->{STATUS} == 0 && $xml->{NCERROR} eq '50001134' ) { $self->failure_status('declined') } # 3d secure wrong identification
Branch: 1 branch
BranchTrueFalseTotal
if ($xml->{"STATUS"} == 0 and $xml->{"NCERROR"} eq 50001134) 0 10 10
Condition33%1/3
$xml->{"STATUS"} == 0 and $xml->{"NCERROR"} eq 50001134
!ll&&!rl&&r
0100
MC/DC0%0/2
$xml->{"STATUS"} == 0 and $xml->{"NCERROR"} eq 50001134
$xml->{"STATUS"} == 0 $xml->{"NCERROR"} eq 50001134
Truth table33%1/3
A and B
A= $xml->{"STATUS"} == 0B= $xml->{"NCERROR"} eq 50001134
ABresult
0X0
100
111
275 10 ▶ if ( $xml->{STATUS} == 0 && $xml->{NCERRORPLUS} =~ m/status \(91\)/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($xml->{"STATUS"} == 0 and $xml->{"NCERRORPLUS"} =~ /status \(91\)/u) 0 10 10
Condition33%1/3
$xml->{"STATUS"} == 0 and $xml->{"NCERRORPLUS"} =~ /status \(91\)/u
!ll&&!rl&&r
0100
MC/DC0%0/2
$xml->{"STATUS"} == 0 and $xml->{"NCERRORPLUS"} =~ /status \(91\)/u
$xml->{"STATUS"} == 0 $xml->{"NCERRORPLUS"} =~ /status \(91\)/u
Truth table33%1/3
A and B
A= $xml->{"STATUS"} == 0B= $xml->{"NCERRORPLUS"} =~ /status \(91\)/u
ABresult
0X0
100
111
276 0 $self->failure_status('declined');
277 0 $self->error_message('Operation only allowed on fully completed transactions (status may not be 91)'); }
278  
279 } else {
280 0 warn "remote server did not respond with HTTP 200 status code";
281 0 $self->is_success(0)
282 }
283  
284 # Extract the base64 encoded HTML part
285 10 ▶ if ( $xml->{STATUS} == 46 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($xml->{"STATUS"} == 46) 0 10 10
286 0 my $html = decode_base64($xml->{HTML_ANSWER});
287 # remove sillyness
288 0 $html =~ s/
289 //g;
290 0 $html =~ s///g;
291  
292 # TODO: parse
293 #open my $fh, '>', '/tmp/ogone_'.$self->{_content}->{win3ds}.'.html';
294 #print $fh $html;
295 }
296
297 # Call result_code() with the servers result code
298 10 $self->result_code($xml->{NCERROR});
299  
300 # If the transaction was successful, call authorization() with the authorization code the processor provided.
301 10 ▶ if ( $self->is_success() ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->is_success) 0 10 10
302 0 $self->authorization($xml->{PAYID});
303 }
304  
305 # If the transaction was not successful, call error_message() with either the processor provided error message, or some error message to indicate why it failed.
306 10 ▶ if ( not $self->is_success() and $xml->{NCERRORPLUS} ne '!' ) { # '!' == no errorplus
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->is_success and $xml->{"NCERRORPLUS"} ne "!") 10 0 10
Condition33%1/3
not $self->is_success and $xml->{"NCERRORPLUS"} ne "!"
!ll&&!rl&&r
0010
MC/DC0%0/2
not $self->is_success and $xml->{"NCERRORPLUS"} ne "!"
not $self->is_success $xml->{"NCERRORPLUS"} ne "!"
Truth table33%1/3
not(A) and B
A= not $self->is_successB= $xml->{"NCERRORPLUS"} ne "!"
ABresult
0X0
100
111
307 10 $self->error_message($xml->{NCERRORPLUS});
308 }
309 }
310  
311 1 42;
312 __END__
↑ Summary Ogone/Status.pm »