File Coverage

lib/Net/API/Stripe/Mandate.pm
Criterion Covered Total %
statement 19 29 65.5
branch n/a
condition n/a
subroutine 7 17 41.1
pod 9 10 90.0
total 35 56 62.5


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/usr/local/src/perl/Net-API-Stripe/lib/Net/API/Stripe/Mandate.pm
3             ## Version v0.101.0
4             ## Copyright(c) 2020 DEGUEST Pte. Ltd.
5             ## Author: Jacques Deguest <jack@deguest.jp>
6             ## Created 2019/12/25
7             ## Modified 2020/11/28
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             BEGIN
14             {
15             use strict;
16 2     2   24172663 use warnings;
  2         15  
  2         64  
17 2     2   10 use parent qw( Net::API::Stripe::Generic );
  2         5  
  2         57  
18 2     2   11 use vars qw( $VERSION );
  2         4  
  2         12  
19 2     2   141 our( $VERSION ) = 'v0.101.0';
  2         5  
  2         124  
20 2     2   46 };
21              
22             use strict;
23 2     2   11 use warnings;
  2         3  
  2         38  
24 2     2   20  
  2         5  
  2         608  
25              
26 0     0 1    
27             {
28 0     0 1   accepted_at => { type => "datetime" },
29             offline => { type => "hash" },
30 0     0 1   online => {
31             definition => {
32             ip_address => { type => "scalar" },
33             user_agent => { type => "scalar" },
34             },
35             type => "class",
36             },
37             type => { type => "scalar" },
38             }, @_ ) ); }
39              
40              
41             # NOTE: multi_use needs to be an object, so we make it a dynamic class even though it has no properties as of 2022-08-10
42              
43              
44 0     0 0    
45             {
46             return( shift->_set_get_class( 'single_use',
47 0     0 1   {
48             amount => { type => 'number' },
49 0     0 1   currency => { type => 'scalar' },
50             }, @_ )
51 0     0 1   );
52             }
53              
54              
55 0     0 1    
56             1;
57              
58              
59             =encoding utf8
60              
61             =head1 NAME
62              
63 0     0 1   Net::API::Stripe::Mandate - A Stripe Mandate Object
64              
65 0     0 1   =head1 SYNOPSIS
66              
67             my $mandate = $stripe->mandate({
68             customer_acceptance =>
69             {
70             accepted_at => '2020-04-12T07:30:45',
71             offline => {},
72             online => {},
73             type => 'online',
74             },
75             payment_method => $payment_method_object,
76             single_use =>
77             {
78             amount => 2000,
79             currency => 'jpy',
80             },
81             status => 'active',
82             type => 'mandate',
83             });
84              
85             See documentation in L<Net::API::Stripe> for example to make api calls to Stripe to create those objects.
86              
87             =head1 VERSION
88              
89             v0.101.0
90              
91             =head1 DESCRIPTION
92              
93             A Mandate is a record of the permission a customer has given you to debit their payment method.
94              
95             =head1 CONSTRUCTOR
96              
97             =head2 new( %ARG )
98              
99             Creates a new L<Net::API::Stripe::Mandate> object.
100             It may also take an hash like arguments, that also are method of the same name.
101              
102             =head1 METHODS
103              
104             =head2 id string
105              
106             Unique identifier for the object.
107              
108             =head2 object string, value is "mandate"
109              
110             String representing the object’s type. Objects of the same type share the same value.
111              
112             =head2 customer_acceptance hash
113              
114             Details about the customer's acceptance of the mandate.
115              
116             It has the following properties:
117              
118             =over 4
119              
120             =item I<accepted_at> timestamp
121              
122             The time at which the customer accepted the Mandate.
123              
124             =item I<offline> hash
125              
126             If this is a Mandate accepted offline, this hash contains details about the offline acceptance.
127              
128             =over 8
129              
130             =item I<offline>
131              
132             This is an empty hash.
133              
134             =back
135              
136             =item I<online> hash
137              
138             If this is a Mandate accepted online, this hash contains details about the online acceptance.
139              
140             =over 8
141              
142             =item I<ip_address> string
143              
144             The IP address from which the Mandate was accepted by the customer.
145              
146             =item I<user_agent> string
147              
148             The user agent of the browser from which the Mandate was accepted by the customer.
149              
150             =back
151              
152             =item I<type> string
153              
154             The type of customer acceptance information included with the Mandate. One of C<online> or C<offline>.
155              
156             =back
157              
158             head2 livemode boolean
159              
160             Has the value true if the object exists in live mode or the value false if the object exists in test mode.
161              
162             =head2 multi_use hash
163              
164             If this is a multi_use mandate, this hash contains details about the mandate.
165              
166             =head2 payment_method string expandable
167              
168             ID of the payment method associated with this mandate.
169              
170             =head2 payment_method_details object
171              
172             Additional mandate information specific to the payment method type.
173              
174             This is a L<Net::API::Stripe::Payment::Method> object.
175              
176             =head2 single_use hash
177              
178             If this is a single_use mandate, this hash contains details about the mandate.
179              
180             =over 4
181              
182             =item I<amount> integer
183              
184             On a single use mandate, the amount of the payment.
185              
186             =item I<currency> currency
187              
188             On a single use mandate, the currency of the payment.
189              
190             =back
191              
192             =head2 status string
193              
194             The status of the Mandate, one of active, inactive, or pending. The Mandate can be used to initiate a payment only if status=active.
195              
196             =head2 type string
197              
198             The type of the mandate, one of multi_use or single_use
199              
200             =head1 API SAMPLE
201              
202             {
203             "id": "mandate_123456789",
204             "object": "mandate",
205             "customer_acceptance": {
206             "accepted_at": 123456789,
207             "online": {
208             "ip_address": "127.0.0.0",
209             "user_agent": "device"
210             },
211             "type": "online"
212             },
213             "livemode": false,
214             "multi_use": {},
215             "payment_method": "pm_123456789",
216             "payment_method_details": {
217             "sepa_debit": {
218             "reference": "123456789",
219             "url": ""
220             },
221             "type": "sepa_debit"
222             },
223             "status": "active",
224             "type": "multi_use"
225             }
226              
227             =head1 HISTORY
228              
229             =head2 v0.1
230              
231             Initial version
232              
233             =head1 AUTHOR
234              
235             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
236              
237             =head1 SEE ALSO
238              
239             Stripe API documentation:
240              
241             L<https://stripe.com/docs/api>, L<https://stripe.com/docs/api/mandates/object>
242              
243             =head1 COPYRIGHT & LICENSE
244              
245             Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
246              
247             You can use, copy, modify and redistribute this package and associated
248             files under the same terms as Perl itself.
249              
250             =cut