File Coverage

blib/lib/Business/Payment/Result.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 8 8 100.0


line stmt bran cond sub pod time code
1             package Business::Payment::Result;
2 4     4   1440 use Moose;
  4         5  
  4         22  
3              
4             has error_code => (
5             is => 'ro',
6             isa => 'Num'
7             );
8              
9             has error_message => (
10             is => 'ro',
11             isa => 'Str'
12             );
13              
14             has success => (
15             is => 'ro',
16             isa => 'Bool',
17             required => 1
18             );
19              
20             has extra => (
21             is => 'rw',
22             isa => 'HashRef'
23             );
24              
25             has 'avs_response' => (
26             is => 'rw',
27             isa => 'Str'
28             );
29              
30 4     4   19679 no Moose;
  4         6  
  4         15  
31             __PACKAGE__->meta->make_immutable;
32              
33             =head1 NAME
34              
35             Business::Payment::Result - Result of a handled charge
36              
37             =head1 SYNOPSIS
38              
39             use Business::Payment;
40              
41             my $bp = Business::Payment->new(
42             processor => Business::Payment::Processor::Test::True->new
43             );
44              
45             my $charge = Business::Payment::Charge->new(
46             amount => 10.00 # Something Math::Currency can parse
47             );
48              
49             my $result = $bp->handle($charge);
50             if($result->success) {
51             print "Success!\n";
52             } else {
53             print "Failed: ".$result->error_code.": ".$result->error_message."\n";
54             }
55              
56             =head1 DESCRIPTION
57              
58             Business::Payment::Result contains the results of a handled charge. It's most
59             basic indicator is the C<success> attribute. If the charge was not successful
60             then the C<success> attribute will be false and the C<error_message> and
61             C<error_code> attribute should be set.
62              
63             =head1 AUTHOR
64              
65             Cory G Watson, C<< <gphat@cpan.org> >>
66              
67             =head1 COPYRIGHT & LICENSE
68              
69             Copyright 2009 Cold Hard Code, LLC, all rights reserved.
70              
71             This program is free software; you can redistribute it and/or modify it
72             under the same terms as Perl itself.