File Coverage

lib/Net/API/Stripe/Error.pm
Criterion Covered Total %
statement 19 31 61.2
branch n/a
condition n/a
subroutine 7 19 36.8
pod 12 12 100.0
total 38 62 61.2


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/lib/Net/API/Stripe/Error.pm
3             ## Version v0.100.0
4             ## Copyright(c) 2019 DEGUEST Pte. Ltd.
5             ## Author: Jacques Deguest <jack@deguest.jp>
6             ## Created 2019/11/02
7             ## Modified 2020/05/15
8             ##
9             ##----------------------------------------------------------------------------
10             BEGIN
11             {
12             use strict;
13 2     2   24057254 use warnings;
  2         13  
  2         60  
14 2     2   11 use parent qw( Net::API::Stripe::Generic );
  2         5  
  2         61  
15 2     2   11 use vars qw( $VERSION );
  2         5  
  2         8  
16 2     2   140 our( $VERSION ) = 'v0.100.0';
  2         5  
  2         114  
17 2     2   44 };
18              
19             use strict;
20 2     2   16 use warnings;
  2         4  
  2         37  
21 2     2   11  
  2         5  
  2         552  
22              
23 0     0 1    
24              
25 0     0 1    
26              
27 0     0 1    
28              
29 0     0 1    
30              
31 0     0 1    
32              
33 0     0 1    
34             1;
35 0     0 1   # NOTE: POD
36              
37 0     0 1   =encoding utf8
38              
39 0     0 1   =head1 NAME
40              
41 0     0 1   Net::API::Stripe::Error - A Stripe Error Object
42              
43 0     0 1   =head1 SYNOPSIS
44              
45 0     0 1   my $err = $stripe->payment_intent->last_payment_error({
46             type => 'card_error',
47             charge => 'ch_fake1234567890',
48             code => 402,
49             doc_url => 'https://stripe.com/docs/api/errors',
50             message => 'Some human readable message',
51             payment_intent => $payment_intent_object,
52             source => $source_object,
53             });
54              
55             =head1 VERSION
56              
57             v0.100.0
58              
59             =head1 DESCRIPTION
60              
61             This is a Stripe Error object instantiated by method B<last_setup_error> in module L<Net::API::Stripe::Payment::Intent::Setup>, and method B<last_payment_error> in module L<Net::API::Stripe::Payment::Intent>
62              
63             This is different from the error generated elsewhere in L<Net::API::Stripe>
64              
65             =head1 CONSTRUCTOR
66              
67             =head2 new
68              
69             Creates a new L<Net::API::Stripe::Error> object.
70              
71             It may also take an hash like arguments, that also are method of the same name.
72              
73             =head1 METHODS
74              
75             =head2 type string
76              
77             The type of error returned. One of api_connection_error, api_error, authentication_error, card_error, idempotency_error, invalid_request_error, or rate_limit_error
78              
79             =head2 charge string
80              
81             For card errors, the ID of the failed charge. Not always present. Exists in L<Net::API::Stripe::Payment::Intent>, but not in L<Net::API::Stripe::Payment::Intent::Setup>
82              
83             =head2 code string
84              
85             For some errors that could be handled programmatically, a short string indicating the error code reported.
86              
87             =head2 decline_code string
88              
89             For card errors resulting from a card issuer decline, a short string indicating the card issuer’s reason for the decline if they provide one.
90              
91             =head2 doc_url string
92              
93             A URL to more information about the error code reported. This is a C<URI> object.
94              
95             =head2 message string
96              
97             A human-readable message providing more details about the error. For card errors, these messages can be shown to your users.
98              
99             =head2 param string
100              
101             If the error is parameter-specific, the parameter related to the error. For example, you can use this to display a message near the correct form field.
102              
103             =head2 payment_intent hash
104              
105             The PaymentIntent object for errors returned on a request involving a PaymentIntent.
106              
107             When set, this is a L<Net::API::Stripe::Payment::Intent> object.
108              
109             =head2 payment_method hash
110              
111             The PaymentMethod object for errors returned on a request involving a PaymentMethod.
112              
113             When set, this is a L<Net::API::Stripe::Payment::Method> object.
114              
115             =head2 payment_method_type string
116              
117             If the error is specific to the type of payment method, the payment method type that had a problem. This field is only populated for invoice-related errors.
118              
119             =head2 setup_intent hash
120              
121             The SetupIntent object for errors returned on a request involving a SetupIntent.
122              
123             When set, this is a L<Net::API::Stripe::Payment::Intent::Setup> object.
124              
125             =head2 source hash
126              
127             The source object for errors returned on a request involving a source.
128              
129             When set this is a L<Net::API::Stripe::Payment::Source> object.
130              
131             =head2 type string
132              
133             The type of error returned. One of C<api_connection_error>, C<api_error>, C<authentication_error>, C<card_error>, C<idempotency_error>, C<invalid_request_error>, or C<rate_limit_error>
134              
135             =head1 HISTORY
136              
137             =head2 v0.100.0
138              
139             Initial version
140              
141             =head1 AUTHOR
142              
143             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
144              
145             =head1 SEE ALSO
146              
147             Stripe API documentation:
148              
149             L<https://stripe.com/docs/api/errors>
150              
151             =head1 COPYRIGHT & LICENSE
152              
153             Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
154              
155             You can use, copy, modify and redistribute this package and associated
156             files under the same terms as Perl itself.
157              
158             =cut
159