File Coverage

lib/Net/API/Stripe/SetupAttempt.pm
Criterion Covered Total %
statement 25 40 62.5
branch n/a
condition n/a
subroutine 9 24 37.5
pod 15 15 100.0
total 49 79 62.0


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/lib/Net/API/Stripe/SetupAttempt.pm
3             ## Version v0.2.0
4             ## Copyright(c) 2020 DEGUEST Pte. Ltd.
5             ## Author: Jacques Deguest <jack@deguest.jp>
6             ## Created 2020/11/20
7             ## Modified 2022/10/29
8             ## All rights reserved
9             ##
10             ## This program is free software; you can redistribute it and/or modify it
11             ## under the same terms as Perl itself.
12             ##----------------------------------------------------------------------------
13             package Net::API::Stripe::SetupAttempt;
14             BEGIN
15             {
16 2     2   21566604 use strict;
  2         14  
  2         63  
17 2     2   11 use warnings;
  2         4  
  2         59  
18 2     2   11 use parent qw( Net::API::Stripe::Generic );
  2         4  
  2         11  
19 2     2   151 use vars qw( $VERSION );
  2         4  
  2         125  
20 2     2   41 our( $VERSION ) = 'v0.2.0';
21             };
22              
23 2     2   17 use strict;
  2         17  
  2         49  
24 2     2   12 use warnings;
  2         4  
  2         68  
25              
26 2     2   13 use strict;
  2         4  
  2         42  
27 2     2   11 use warnings;
  2         4  
  2         1165  
28              
29 0     0 1   sub id { return( shift->_set_get_scalar( 'id', @_ ) ); }
30              
31 0     0 1   sub object { return( shift->_set_get_scalar( 'object', @_ ) ); }
32              
33 0     0 1   sub application { return( shift->_set_get_scalar_or_object( 'application', 'Net::API::Stripe::Connect::Account', @_ ) ); }
34              
35 0     0 1   sub attach_to_self { return( shift->_set_get_boolean( 'attach_to_self', @_ ) ); }
36              
37 0     0 1   sub created { return( shift->_set_get_datetime( 'created', @_ ) ); }
38              
39 0     0 1   sub customer { return( shift->_set_get_scalar_or_object( 'customer', 'Net::API::Stripe::Customer', @_ ) ); }
40              
41 0     0 1   sub flow_directions { return( shift->_set_get_array( 'flow_directions', @_ ) ); }
42              
43 0     0 1   sub livemode { return( shift->_set_get_boolean( 'livemode', @_ ) ); }
44              
45 0     0 1   sub on_behalf_of { return( shift->_set_get_scalar_or_object( 'on_behalf_of', 'Net::API::Stripe::Connect::Account', @_ ) ); }
46              
47 0     0 1   sub payment_method { return( shift->_set_get_scalar_or_object( 'payment_method', 'Net::API::Stripe::Payment::Method', @_ ) ); }
48              
49 0     0 1   sub payment_method_details { return( shift->_set_get_class( 'payment_method_details',
50             {
51             bancontact => {
52             definition => {
53             bank_code => { type => "scalar" },
54             bank_name => { type => "scalar" },
55             bic => { type => "scalar" },
56             generated_sepa_debit => {
57             package => "Net::API::Stripe::Payment::Method",
58             type => "scalar_or_object",
59             },
60             generated_sepa_debit_mandate => { package => "Net::API::Stripe::Mandate", type => "scalar_or_object" },
61             iban_last4 => { type => "scalar" },
62             preferred_language => { type => "scalar" },
63             verified_name => { type => "scalar" },
64             },
65             type => "class",
66             },
67             card => {
68             definition => {
69             three_d_secure => {
70             definition => {
71             authentication_flow => { type => "scalar" },
72             result => { type => "scalar" },
73             result_reason => { type => "scalar" },
74             version => { type => "scalar" },
75             },
76             type => "class",
77             },
78             },
79             type => "class",
80             },
81             ideal => {
82             definition => {
83             bank => { type => "scalar" },
84             bic => { type => "scalar" },
85             generated_sepa_debit => {
86             package => "Net::API::Stripe::Payment::Method",
87             type => "scalar_or_object",
88             },
89             generated_sepa_debit_mandate => { package => "Net::API::Stripe::Mandate", type => "scalar_or_object" },
90             iban_last4 => { type => "scalar" },
91             verified_name => { type => "scalar" },
92             },
93             type => "class",
94             },
95             sofort => {
96             definition => {
97             bank_code => { type => "scalar" },
98             bank_name => { type => "scalar" },
99             bic => { type => "scalar" },
100             generated_sepa_debit => {
101             package => "Net::API::Stripe::Payment::Method",
102             type => "scalar_or_object",
103             },
104             generated_sepa_debit_mandate => { package => "Net::API::Stripe::Mandate", type => "scalar_or_object" },
105             iban_last4 => { type => "scalar" },
106             preferred_language => { type => "scalar" },
107             verified_name => { type => "scalar" },
108             },
109             type => "class",
110             },
111             type => { type => "scalar" },
112             }, @_ ) ); }
113              
114 0     0 1   sub setup_error { return( shift->_set_get_class( 'setup_error',
115             {
116             code => { type => "scalar" },
117             decline_code => { type => "scalar" },
118             doc_url => { type => "scalar" },
119             message => { type => "scalar" },
120             param => { type => "scalar" },
121             payment_method => { package => "Net::API::Stripe::Payment::Method", type => "object" },
122             payment_method_type => { type => "scalar" },
123             type => { type => "scalar" },
124             }, @_ ) ); }
125              
126 0     0 1   sub setup_intent { return( shift->_set_get_scalar_or_object( 'setup_intent', 'Net::API::Stripe::Payment::Intent::Setup', @_ ) ); }
127              
128 0     0 1   sub status { return( shift->_set_get_scalar( 'status', @_ ) ); }
129              
130 0     0 1   sub usage { return( shift->_set_get_scalar( 'usage', @_ ) ); }
131              
132             1;
133              
134             __END__
135              
136             =encoding utf8
137              
138             =head1 NAME
139              
140             Net::API::Stripe::SetupAttempt - The SetupAttempt object
141              
142             =head1 SYNOPSIS
143              
144             my $setup = $stripe->setup_attempt({
145             ## Net::API::Stripe::Connect::Account
146             application => $connect_account_object,
147             created => '2020-11-17T12:15:20',
148             ## Net::API::Stripe::Customer
149             customer => $customer_id_or_object,
150             livemode => $stripe->true,
151             on_behalf_of => $account_object,
152             payment_method => $stripe_pm_id,
153             payment_method_details => $hash,
154             setup_error => $hash,
155             ## Net::API::Stripe::Payment::Intent::Setup
156             setup_intent => $intent_id_or_object,
157             status => 'succeeded',
158             usage => 'off_session',
159             });
160              
161             =head1 VERSION
162              
163             v0.2.0
164              
165             =head1 DESCRIPTION
166              
167             A SetupAttempt describes one attempted confirmation of a SetupIntent, whether that confirmation was successful or unsuccessful. You can use SetupAttempts to inspect details of a specific attempt at setting up a payment method using a SetupIntent.
168              
169             =head1 METHODS
170              
171             =head2 id string
172              
173             Unique identifier for the object.
174              
175             =head2 object string
176              
177             String representing the object's type. Objects of the same type share the same value.
178              
179             =head2 application expandable
180              
181             The value of L<application|https://stripe.com/docs/api/setup_intents/object#setup_intent_object-application> on the SetupIntent at the time of this confirmation.
182              
183             When expanded this is an L<Net::API::Stripe::Connect::Account> object.
184              
185             =head2 attach_to_self boolean
186              
187             If present, the SetupIntent's payment method will be attached to the in-context Stripe Account.
188              
189             It can only be used for this Stripe Account’s own money movement flows like InboundTransfer and OutboundTransfers. It cannot be set to true when setting up a PaymentMethod for a Customer, and defaults to false when attaching a PaymentMethod to a Customer.
190              
191             =head2 created timestamp
192              
193             Time at which the object was created. Measured in seconds since the Unix epoch.
194              
195             =head2 customer expandable
196              
197             The value of L<customer|https://stripe.com/docs/api/setup_intents/object#setup_intent_object-customer> on the SetupIntent at the time of this confirmation.
198              
199             When expanded this is an L<Net::API::Stripe::Customer> object.
200              
201             =head2 flow_directions array
202              
203             Indicates the directions of money movement for which this payment method is intended to be used.
204              
205             Include C<inbound> if you intend to use the payment method as the origin to pull funds from. Include C<outbound> if you intend to use the payment method as the destination to send funds to. You can include both if you intend to use the payment method for both purposes.
206              
207             =head2 livemode boolean
208              
209             Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
210              
211             =head2 on_behalf_of expandable
212              
213             The value of L<on_behalf_of|https://stripe.com/docs/api/setup_intents/object#setup_intent_object-on_behalf_of> on the SetupIntent at the time of this confirmation.
214              
215             When expanded this is an L<Net::API::Stripe::Connect::Account> object.
216              
217             =head2 payment_method expandable
218              
219             ID of the payment method used with this SetupAttempt.
220              
221             When expanded this is an L<Net::API::Stripe::Payment::Method> object.
222              
223             =head2 payment_method_details hash
224              
225             Details about the payment method at the time of SetupIntent confirmation.
226              
227             It has the following properties:
228              
229             =over 4
230              
231             =item I<bancontact> hash
232              
233             If this is a C<bancontact> payment method, this hash contains confirmation-specific information for the C<bancontact> payment method.
234              
235             =over 8
236              
237             =item I<bank_code> string
238              
239             Bank code of bank associated with the bank account.
240              
241             =item I<bank_name> string
242              
243             Name of the bank associated with the bank account.
244              
245             =item I<bic> string
246              
247             Bank Identifier Code of the bank associated with the bank account.
248              
249             =item I<generated_sepa_debit> string expandable
250              
251             The ID of the SEPA Direct Debit PaymentMethod which was generated by this SetupAttempt.
252              
253             When expanded this is an L<Net::API::Stripe::Payment::Method> object.
254              
255             =item I<generated_sepa_debit_mandate> string expandable
256              
257             The mandate for the SEPA Direct Debit PaymentMethod which was generated by this SetupAttempt.
258              
259             When expanded this is an L<Net::API::Stripe::Mandate> object.
260              
261             =item I<iban_last4> string
262              
263             Last four characters of the IBAN.
264              
265             =item I<preferred_language> string
266              
267             Preferred language of the Bancontact authorization page that the customer is redirected to.
268             Can be one of C<en>, C<de>, C<fr>, or C<nl>
269              
270             =item I<verified_name> string
271              
272             Owner's verified full name. Values are verified or provided by Bancontact directly (if supported) at the time of authorization or settlement. They cannot be set or mutated.
273              
274             =back
275              
276             =item I<card> hash
277              
278             If this is a C<card> payment method, this hash contains confirmation-specific information for the C<card> payment method.
279              
280             =over 8
281              
282             =item I<three_d_secure> hash
283              
284             Populated if this authorization used 3D Secure authentication.
285              
286             =over 12
287              
288             =item I<authentication_flow> string
289              
290             For authenticated transactions: how the customer was authenticated by the issuing bank.
291              
292             =item I<result> string
293              
294             Indicates the outcome of 3D Secure authentication.
295              
296             =item I<result_reason> string
297              
298             Additional information about why 3D Secure succeeded or failed based on the `result`.
299              
300             =item I<version> string
301              
302             The version of 3D Secure that was used.
303              
304             =back
305              
306             =back
307              
308             =item I<ideal> hash
309              
310             If this is a C<ideal> payment method, this hash contains confirmation-specific information for the C<ideal> payment method.
311              
312             =over 8
313              
314             =item I<bank> string
315              
316             The customer's bank. Can be one of C<abn_amro>, C<asn_bank>, C<bunq>, C<handelsbanken>, C<ing>, C<knab>, C<moneyou>, C<rabobank>, C<regiobank>, C<sns_bank>, C<triodos_bank>, or C<van_lanschot>.
317              
318             =item I<bic> string
319              
320             The Bank Identifier Code of the customer's bank.
321              
322             =item I<generated_sepa_debit> string expandable
323              
324             The ID of the SEPA Direct Debit PaymentMethod which was generated by this SetupAttempt.
325              
326             When expanded this is an L<Net::API::Stripe::Payment::Method> object.
327              
328             =item I<generated_sepa_debit_mandate> string expandable
329              
330             The mandate for the SEPA Direct Debit PaymentMethod which was generated by this SetupAttempt.
331              
332             When expanded this is an L<Net::API::Stripe::Mandate> object.
333              
334             =item I<iban_last4> string
335              
336             Last four characters of the IBAN.
337              
338             =item I<verified_name> string
339              
340             Owner's verified full name. Values are verified or provided by iDEAL directly (if supported) at the time of authorization or settlement. They cannot be set or mutated.
341              
342             =back
343              
344             =item I<sofort> hash
345              
346             If this is a C<sofort> payment method, this hash contains confirmation-specific information for the C<sofort> payment method.
347              
348             =over 8
349              
350             =item I<bank_code> string
351              
352             Bank code of bank associated with the bank account.
353              
354             =item I<bank_name> string
355              
356             Name of the bank associated with the bank account.
357              
358             =item I<bic> string
359              
360             Bank Identifier Code of the bank associated with the bank account.
361              
362             =item I<generated_sepa_debit> string expandable
363              
364             The ID of the SEPA Direct Debit PaymentMethod which was generated by this SetupAttempt.
365              
366             When expanded this is an L<Net::API::Stripe::Payment::Method> object.
367              
368             =item I<generated_sepa_debit_mandate> string expandable
369              
370             The mandate for the SEPA Direct Debit PaymentMethod which was generated by this SetupAttempt.
371              
372             When expanded this is an L<Net::API::Stripe::Mandate> object.
373              
374             =item I<iban_last4> string
375              
376             Last four characters of the IBAN.
377              
378             =item I<preferred_language> string
379              
380             Preferred language of the Sofort authorization page that the customer is redirected to.
381             Can be one of C<en>, C<de>, C<fr>, or C<nl>
382              
383             =item I<verified_name> string
384              
385             Owner's verified full name. Values are verified or provided by Sofort directly (if supported) at the time of authorization or settlement. They cannot be set or mutated.
386              
387             =back
388              
389             =item I<type> string
390              
391             The type of the payment method used in the SetupIntent (e.g., C<card>). An additional hash is included on C<payment_method_details> with a name matching this value. It contains confirmation-specific information for the payment method.
392              
393             =back
394              
395             =head2 setup_error hash
396              
397             The error encountered during this attempt to confirm the SetupIntent, if any.
398              
399             It has the following properties:
400              
401             =over 4
402              
403             =item I<code> string
404              
405             For some errors that could be handled programmatically, a short string indicating the [error code](/docs/error-codes) reported.
406              
407             =item I<decline_code> string
408              
409             For card errors resulting from a card issuer decline, a short string indicating the L<card issuer's reason for the decline|https://stripe.com/docs/declines#issuer-declines> if they provide one.
410              
411             =item I<doc_url> string
412              
413             A URL to more information about the L<error code|https://stripe.com/docs/error-codes> reported.
414              
415             =item I<message> string
416              
417             A human-readable message providing more details about the error. For card errors, these messages can be shown to your users.
418              
419             =item I<param> string
420              
421             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.
422              
423             =item I<payment_method> hash
424              
425             The PaymentMethod object for errors returned on a request involving a PaymentMethod.
426              
427             When expanded, this is a L<Net::API::Stripe::Payment::Method> object.
428              
429             =item I<payment_method_type> string
430              
431             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.
432              
433             =item I<type> string
434              
435             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>
436              
437             =back
438              
439             =head2 setup_intent expandable
440              
441             ID of the SetupIntent that this attempt belongs to.
442              
443             When expanded this is an L<Net::API::Stripe::Payment::Intent::Setup> object.
444              
445             =head2 status string
446              
447             Status of this SetupAttempt, one of C<requires_confirmation>, C<requires_action>, C<processing>, C<succeeded>, C<failed>, or C<abandoned>.
448              
449             =head2 usage string
450              
451             The value of L<usage|https://stripe.com/docs/api/setup_intents/object#setup_intent_object-usage> on the SetupIntent at the time of this confirmation, one of C<off_session> or C<on_session>.
452              
453             =head1 API SAMPLE
454              
455             {
456             "id": "setatt_1ErTsH2eZvKYlo2CI7ukcoF7",
457             "object": "setup_attempt",
458             "application": null,
459             "created": 1562004309,
460             "customer": null,
461             "livemode": false,
462             "on_behalf_of": null,
463             "payment_method": "pm_1ErTsG2eZvKYlo2CH0DNen59",
464             "payment_method_details": {
465             "card": {
466             "three_d_secure": null
467             },
468             "type": "card"
469             },
470             "setup_error": null,
471             "setup_intent": "seti_1ErTsG2eZvKYlo2CKaT8MITz",
472             "status": "succeeded",
473             "usage": "off_session"
474             }
475              
476             =head1 HISTORY
477              
478             =head2 v0.1.0
479              
480             Initial version
481              
482             =head1 AUTHOR
483              
484             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
485              
486             =head1 SEE ALSO
487              
488             Stripe API documentation:
489              
490             L<https://stripe.com/docs/api#setup_attempt_object>
491              
492             =head1 COPYRIGHT & LICENSE
493              
494             Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
495              
496             You can use, copy, modify and redistribute this package and associated
497             files under the same terms as Perl itself.
498              
499             =cut