File Coverage

blib/lib/Net/API/Stripe/Payment/Intent/NextAction.pm
Criterion Covered Total %
statement 7 10 70.0
branch n/a
condition n/a
subroutine 3 6 50.0
pod 3 3 100.0
total 13 19 68.4


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/lib/Net/API/Stripe/Payment/Intent/NextAction.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::Payment::Intent::NextAction;
11             BEGIN
12             {
13 1     1   837 use strict;
  1         2  
  1         28  
14 1     1   5 use parent qw( Net::API::Stripe::Generic );
  1         2  
  1         4  
15 1     1   138 our( $VERSION ) = 'v0.100.0';
16             };
17              
18             # sub redirect_to_url { shift->_set_get_hash( 'redirect_to_url', @_ ); }
19             sub redirect_to_url
20             {
21             return( shift->_set_get_class(
22             {
23 0     0 1   return_url => { type => 'uri' },
24             url => { type => 'uri' },
25             }, @_ ) );
26             }
27              
28 0     0 1   sub type { shift->_set_get_scalar( 'type', @_ ); }
29              
30 0     0 1   sub use_stripe_sdk { shift->_set_get_hash( 'use_stripe_sdk', @_ ); }
31              
32             1;
33              
34             __END__
35              
36             =encoding utf8
37              
38             =head1 NAME
39              
40             Net::API::Stripe::Payment::Intent::NextAction - A Stripe Payment Next Action Object
41              
42             =head1 SYNOPSIS
43              
44             my $next = $stripe->payment_intent->next_action({
45             redirect_to_url =>
46             {
47             return_url => 'https://example.com/pay/return',
48             url => 'https://example.com/pay/auth',
49             },
50             type => 'redirect_to_url',
51             });
52              
53             =head1 VERSION
54              
55             v0.100.0
56              
57             =head1 DESCRIPTION
58              
59             If present, this property tells you what actions you need to take in order for your customer to fulfill a payment using the provided source.
60              
61             It used to be NextSourceAction, but the naming changed in Stripe API as of 2019-02-11
62              
63             This is instantiated by method B<next_action> in module L<Net::API::Stripe::Payment::Intent>
64              
65             =head1 CONSTRUCTOR
66              
67             =over 4
68              
69             =item B<new>( %ARG )
70              
71             Creates a new L<Net::API::Stripe::Payment::Intent::NextAction> object.
72             It may also take an hash like arguments, that also are method of the same name.
73              
74             =back
75              
76             =head1 METHODS
77              
78             =over 4
79              
80             =item B<redirect_to_url> hash
81              
82             Contains instructions for authenticating a payment by redirecting your customer to another page or application.
83              
84             This is actually a dynamic class L<Net::API::Stripe::Payment::Intent::NextAction::RedirectToUrl> so the following property can be accessed as methods:
85              
86             =over 8
87              
88             =item I<return_url> string
89              
90             If the customer does not exit their browser while authenticating, they will be redirected to this specified URL after completion.
91              
92             =item I<url> string
93              
94             The URL you must redirect your customer to in order to authenticate the payment.
95              
96             =back
97              
98             =item B<type> string
99              
100             Type of the next action to perform, one of redirect_to_url or use_stripe_sdk.
101              
102             =item B<use_stripe_sdk> hash
103              
104             When confirming a PaymentIntent with Stripe.js, Stripe.js depends on the contents of this dictionary to invoke authentication flows. The shape of the contents is subject to change and is only intended to be used by Stripe.js.
105              
106             =back
107              
108             =head1 API SAMPLE
109              
110             {
111             "id": "pi_fake123456789",
112             "object": "payment_intent",
113             "amount": 1099,
114             "amount_capturable": 0,
115             "amount_received": 0,
116             "application": null,
117             "application_fee_amount": null,
118             "canceled_at": null,
119             "cancellation_reason": null,
120             "capture_method": "automatic",
121             "charges": {
122             "object": "list",
123             "data": [],
124             "has_more": false,
125             "url": "/v1/charges?payment_intent=pi_fake123456789"
126             },
127             "client_secret": "pi_fake123456789_secret_ksjfjfbsjbfsmbfmf",
128             "confirmation_method": "automatic",
129             "created": 1556596976,
130             "currency": "jpy",
131             "customer": null,
132             "description": null,
133             "invoice": null,
134             "last_payment_error": null,
135             "livemode": false,
136             "metadata": {},
137             "next_action": null,
138             "on_behalf_of": null,
139             "payment_method": null,
140             "payment_method_options": {},
141             "payment_method_types": [
142             "card"
143             ],
144             "receipt_email": null,
145             "review": null,
146             "setup_future_usage": null,
147             "shipping": null,
148             "statement_descriptor": null,
149             "statement_descriptor_suffix": null,
150             "status": "requires_payment_method",
151             "transfer_data": null,
152             "transfer_group": null
153             }
154              
155             =head1 HISTORY
156              
157             =head2 v0.1
158              
159             Initial version
160              
161             =head1 AUTHOR
162              
163             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
164              
165             =head1 SEE ALSO
166              
167             Stripe API documentation:
168              
169             L<https://stripe.com/docs/api/payment_intents/object>
170              
171             =head1 COPYRIGHT & LICENSE
172              
173             Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
174              
175             You can use, copy, modify and redistribute this package and associated
176             files under the same terms as Perl itself.
177              
178             =cut