+ $DB::single = 1;
+ $som->match('/Envelope/Body/SendAndCommitResponse/SendAndCommitResult');
+ my $result = $som->valueof; # hashref of the result properties
+ $self->is_success( $result->{Transaction_Approved} );
+ $self->authorization( $result->{Authorization_Num} );
+ $self->order_number( $result->{SequenceNo} );
+ $self->avs_code( $result->{AVS} );
+ $self->cvv2_response( $result->{CVV2} );
+
+ if (!$self->is_success) {
+ # note spelling of "EXact_Resp_Code"
+ if ($result->{EXact_Resp_Code} ne '00') {
+ # then there's something wrong with the transaction inputs
+ # (invalid card number, malformed amount, attempt to refund a
+ # transaction that didn't happen, etc.)
+ $self->error_message($result->{EXact_Message});
+ $self->result_code($result->{EXact_Resp_Code});
+ $self->failure_status('');
+ # not a decline, as the transaction was never really detected
+ } else {
+ $self->error_message($result->{Bank_Message});
+ $self->result_code($result->{Bank_Resp_Code});
+ $self->failure_status(
+ $failure_status{$result->{Bank_Resp_Code}} || 'declined'
+ );
+ }
+ }