Stripe/Error.pm

filter: Statementstmt 42.1% 8 / 19 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 21.4% 3 / 14 Podpod 100% 11 / 11 totaltotal 50.0% 22 / 44 CC 1 SCAR 5.8
CC
1
Cov
42%
type
2.0
charge
2.0
code
2.0
CRAP 1.8
« Stripe/Billing/Subscription/Item.pm ↑ Summary Stripe/Issuing/Dispute.pm »
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 <@sitael.tokyo.deguest.jp>
6 ## Created 2019/11/02
7 ## Modified 2020/05/15
8 ##
9 ##----------------------------------------------------------------------------
10 package Net::API::Stripe::Error;
11 BEGIN
12 {
13 1 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶ use parent qw( Net::API::Stripe::Generic );
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶ our( $VERSION ) = 'v0.100.0';
Subroutine BEGIN: called CC=1 SCAR=0.0
16 };
17  
18 0 ▶sub type { return( shift->_set_get_scalar( 'type', @_ ) ); }
Subroutine type: not called CC=1 SCAR=6.9
Pod documented
19  
20 0 ▶sub charge { return( shift->_set_get_scalar( 'charge', @_ ) ); }
Subroutine charge: not called CC=1 SCAR=6.9
Pod documented
21  
22 0 ▶sub code { return( shift->_set_get_scalar( 'code', @_ ) ); }
Subroutine code: not called CC=1 SCAR=6.9
Pod documented
23  
24 0 ▶sub decline_code { return( shift->_set_get_scalar( 'decline_code', @_ ) ); }
Subroutine decline_code: not called CC=1 SCAR=6.9
Pod documented
25  
26 0 ▶sub doc_url { return( shift->_set_get_uri( 'doc_url', @_ ) ); }
Subroutine doc_url: not called CC=1 SCAR=6.9
Pod documented
27  
28 0 ▶sub message { return( shift->_set_get_scalar( 'message', @_ ) ); }
Subroutine message: not called CC=1 SCAR=6.9
Pod documented
29  
30 0 ▶sub param { return( shift->_set_get_scalar( 'param', @_ ) ); }
Subroutine param: not called CC=1 SCAR=6.9
Pod documented
31  
32 0 ▶sub payment_intent { return( shift->_set_get_object( 'payment_intent', 'Net::API::Stripe::Payment::Intent', @_ ) ); }
Subroutine payment_intent: not called CC=1 SCAR=6.9
Pod documented
33  
34 0 ▶sub payment_method { return( shift->_set_get_object( 'payment_method', 'Net::API::Stripe::Payment::Method', @_ ) ); }
Subroutine payment_method: not called CC=1 SCAR=6.9
Pod documented
35  
36 0 ▶sub setup_intent { return( shift->_set_get_object( 'setup_intent', 'Net::API::Stripe::Payment::Intent::Setup', @_ ) ); }
Subroutine setup_intent: not called CC=1 SCAR=6.9
Pod documented
37  
38 0 ▶sub source { return( shift->_set_get_object( 'source', 'Net::API::Stripe::Payment::Source', @_ ) ); }
Subroutine source: not called CC=1 SCAR=6.9
Pod documented
39  
40 1 1;
41  
42 __END__
43  
44 =encoding utf8
45  
46 =head1 NAME
47  
48 Net::API::Stripe::Error - A Stripe Error Object
49  
50 =head1 SYNOPSIS
51  
52 my $err = $stripe->payment_intent->last_payment_error({
53 type => 'card_error',
54 charge => 'ch_fake1234567890',
55 code => 402,
56 doc_url => 'https://stripe.com/docs/api/errors',
57 message => 'Some human readable message',
58 payment_intent => $payment_intent_object,
59 source => $source_object,
60 });
61  
62 =head1 VERSION
63  
64 v0.100.0
65  
66 =head1 DESCRIPTION
67  
68 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>
69  
70 This is different from the error generated elsewhere in L<Net::API::Stripe>
71  
72 =head1 CONSTRUCTOR
73  
74 =over 4
75  
76 =item B<new>( %ARG )
77  
78 Creates a new L<Net::API::Stripe::Error> object.
79 It may also take an hash like arguments, that also are method of the same name.
80  
81 =back
82  
83 =head1 METHODS
84  
85 =over 4
86  
87 =item B<type> string
88  
89 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
90  
91 =item B<charge> string
92  
93 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>
94  
95 =item B<code> string
96  
97 For some errors that could be handled programmatically, a short string indicating the error code reported.
98  
99 =item B<decline_code> string
100  
101 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.
102  
103 =item B<doc_url> string
104  
105 A URL to more information about the error code reported. This is a C<URI> object.
106  
107 =item B<message> string
108  
109 A human-readable message providing more details about the error. For card errors, these messages can be shown to your users.
110  
111 =item B<param> string
112  
113 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.
114  
115 =item B<payment_intent> hash
116  
117 The PaymentIntent object for errors returned on a request involving a PaymentIntent.
118  
119 When set, this is a L<Net::API::Stripe::Payment::Intent> object.
120  
121 =item B<payment_method> hash
122  
123 The PaymentMethod object for errors returned on a request involving a PaymentMethod.
124  
125 When set, this is a L<Net::API::Stripe::Payment::Method> object.
126  
127 =item B<setup_intent> hash
128  
129 The SetupIntent object for errors returned on a request involving a SetupIntent.
130  
131 When set, this is a L<Net::API::Stripe::Payment::Intent::Setup> object.
132  
133 =item B<source> hash
134  
135 The source object for errors returned on a request involving a source.
136  
137 When set this is a L<Net::API::Stripe::Payment::Source> object.
138  
139 =back
140  
141 =head1 HISTORY
142  
143 =head2 v0.100.0
144  
145 Initial version
146  
147 =head1 AUTHOR
148  
149 Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
150  
151 =head1 SEE ALSO
152  
153 Stripe API documentation:
154  
155 L<https://stripe.com/docs/api/errors>
156  
157 =head1 COPYRIGHT & LICENSE
158  
159 Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
160  
161 You can use, copy, modify and redistribute this package and associated
162 files under the same terms as Perl itself.
163  
164 =cut
165  
« Stripe/Billing/Subscription/Item.pm ↑ Summary Stripe/Issuing/Dispute.pm »