File Coverage

lib/Net/API/Stripe/Billing/PortalConfiguration.pm
Criterion Covered Total %
statement 19 32 59.3
branch n/a
condition n/a
subroutine 7 20 35.0
pod 13 13 100.0
total 39 65 60.0


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/lib/Net/API/Stripe/Billing/Plan/PortalConfiguration.pm
3             ## Version v0.2.0
4             ## Copyright(c) 2019 DEGUEST Pte. Ltd.
5             ## Author: Jacques Deguest <jack@deguest.jp>
6             ## Created 2019/11/02
7             ## Modified 2022/10/29
8             ##
9             ##----------------------------------------------------------------------------
10             package Net::API::Stripe::Billing::PortalConfiguration;
11             BEGIN
12             {
13 2     2   21202934 use strict;
  2         14  
  2         63  
14 2     2   10 use warnings;
  2         9  
  2         61  
15 2     2   10 use parent qw( Net::API::Stripe::Generic );
  2         4  
  2         10  
16 2     2   150 use vars qw( $VERSION );
  2         5  
  2         112  
17 2     2   35 our( $VERSION ) = 'v0.2.0';
18             };
19              
20 2     2   11 use strict;
  2         5  
  2         37  
21 2     2   9 use warnings;
  2         4  
  2         825  
22              
23 0     0 1   sub id { return( shift->_set_get_scalar( 'id', @_ ) ); }
24              
25 0     0 1   sub object { return( shift->_set_get_scalar( 'object', @_ ) ); }
26              
27 0     0 1   sub active { return( shift->_set_get_boolean( 'active', @_ ) ); }
28              
29 0     0 1   sub application { return( shift->_set_get_scalar_or_object( 'application', 'Net::API::Stripe::Connect::Account', @_ ) ); }
30              
31 0     0 1   sub business_profile { return( shift->_set_get_class( 'business_profile',
32             {
33             headline => { type => 'scalar' },
34             privacy_policy_url => { type => 'uri' },
35             terms_of_service_url => { type => 'uri' },
36             }, @_ ) ); }
37              
38 0     0 1   sub created { return( shift->_set_get_datetime( 'created', @_ ) ); }
39              
40 0     0 1   sub default_return_url { return( shift->_set_get_uri( 'default_return_url', @_ ) ); }
41              
42 0     0 1   sub features { return( shift->_set_get_class( 'features',
43             {
44             customer_update => {
45             definition => {
46             allowed_updates => { type => "array" },
47             enabled => { type => "boolean" },
48             },
49             type => "class",
50             },
51             invoice_history => {
52             package => "Net::API::Stripe::Payment::Installment",
53             type => "object",
54             },
55             payment_method_update => {
56             package => "Net::API::Stripe::Payment::Installment",
57             type => "object",
58             },
59             subscription_cancel => {
60             definition => {
61             cancellation_reason => {
62             definition => { enabled => { type => "boolean" }, options => { type => "array" } },
63             type => "class",
64             },
65             enabled => { type => "boolean" },
66             mode => { type => "scalar" },
67             proration_behavior => { type => "scalar" },
68             },
69             type => "class",
70             },
71             subscription_pause => {
72             package => "Net::API::Stripe::Payment::Installment",
73             type => "object",
74             },
75             subscription_update => {
76             definition => {
77             default_allowed_updates => { type => "array" },
78             enabled => { type => "boolean" },
79             products => {
80             definition => { prices => { type => "array" }, product => { type => "scalar" } },
81             type => "class_array",
82             },
83             proration_behavior => { type => "scalar" },
84             },
85             type => "class",
86             },
87             }, @_ ) ); }
88              
89 0     0 1   sub is_default { return( shift->_set_get_boolean( 'is_default', @_ ) ); }
90              
91 0     0 1   sub livemode { return( shift->_set_get_boolean( 'livemode', @_ ) ); }
92              
93 0     0 1   sub login_page { return( shift->_set_get_class( 'login_page',
94             { enabled => { type => "boolean" }, url => { type => "uri" } }, @_ ) ); }
95              
96 0     0 1   sub metadata { return( shift->_set_get_hash_as_mix_object( 'metadata', @_ ) ); }
97              
98 0     0 1   sub updated { return( shift->_set_get_datetime( 'updated', @_ ) ); }
99              
100             1;
101              
102             __END__
103              
104             =encoding utf8
105              
106             =head1 NAME
107              
108             Net::API::Stripe::Billing::PortalConfiguration - The portal configuration object
109              
110             =head1 SYNOPSIS
111              
112             my $portal = $stripe->portal_conffiguration({
113             created => 'now',
114             active => $stripe->true,
115             application => 'acct_fake123456789',
116             business_profile =>
117             {
118             headline = q{Welcome to Example Business payment portal},
119             privacy_policy_url => q{https://example.com/privacy-policy/},
120             terms_of_service_url => q{https://example.com/tos/},
121             },
122             default_return_url => 'https://example.com/ec/df63685a-6cd2-4c5d-9d4c-81b417646a58',
123             features =>
124             {
125             customer_update =>
126             {
127             allowed_updates => [qw( email address shipping phone tax_id )],
128             enabled => 1,
129             },
130             invoice_history =>
131             {
132             enabled => 1,
133             },
134             payment_method_update =>
135             {
136             enabled => 1,
137             },
138             subscription_cancel =>
139             {
140             cancellation_reason =>
141             {
142             enabled => 1,
143             options => [qw( too_expensive missing_features switched_service unused customer_service too_complex low_quality other )],
144             },
145             enabled => 1,
146             mode => [qw( immediately at_period_end )],
147             # Can also be 'none'
148             proration_behavior => 'create_prorations',
149             },
150             subscription_pause =>
151             {
152             enabled => 0,
153             },
154             subscription_update =>
155             {
156             default_allowed_updates => [qw( price quantity promotion_code )],
157             enabled => 1,
158             products => [
159             { prices => [qw( price12345 price6789 )], product => 'prod123456789' },
160             ],
161             # Can also be 'none' and 'always_invoice'
162             proration_behavior => 'create_prorations',
163             },
164             },
165             is_default => 1,
166             livemode => $stripe->false,
167             metadata => { my_db_key => 123456789 },
168             });
169              
170             =head1 VERSION
171              
172             v0.2.0
173              
174             =head1 DESCRIPTION
175              
176             A portal configuration describes the functionality and features that you want to provide to your customers through the portal.
177              
178             =head1 METHODS
179              
180             =head2 id string
181              
182             Unique identifier for the object.
183              
184             =head2 object string
185              
186             String representing the object's type. Objects of the same type share the same value.
187              
188             =head2 active boolean
189              
190             Whether the configuration is active and can be used to create portal sessions.
191              
192             =head2 application string
193              
194             Expandable "application" (Connect only)
195              
196             ID of the Connect Application that created the configuration.
197              
198             =head2 business_profile hash
199              
200             The business information shown to customers in the portal.
201              
202             =over 4
203              
204             =item * C<headline> string
205              
206             The messaging shown to customers in the portal.
207              
208             =item * C<privacy_policy_url> string
209              
210             A link to the business’s publicly available privacy policy.
211              
212             =item * C<terms_of_service_url> string
213              
214             A link to the business’s publicly available terms of service.
215              
216             =back
217              
218             =head2 created timestamp
219              
220             Time at which the object was created. Measured in seconds since the Unix epoch.
221              
222             =head2 default_return_url string
223              
224             The default URL to redirect customers to when they click on the portal’s link to return to your website. This can be overriden when creating the session.
225              
226             =head2 features hash
227              
228             Information about the features available in the portal.
229              
230             It has the following properties:
231              
232             =over 4
233              
234             =item C<customer_update> hash
235              
236             Information about updating customer details in the portal.
237              
238             =over 8
239              
240             =item C<allowed_updates> array
241              
242             The types of customer updates that are supported. When empty, customers are not updateable.
243              
244             =item C<enabled> boolean
245              
246             Whether the feature is enabled.
247              
248              
249             =back
250              
251             =item C<invoice_history> hash
252              
253             Information about showing invoice history in the portal.
254              
255             When expanded, this is a L<Net::API::Stripe::Payment::Installment> object.
256              
257             =item C<payment_method_update> hash
258              
259             Information about updating payment methods in the portal. View the list of supported payment methods in the L<docs|https://stripe.com/docs/billing/subscriptions/integrating-customer-portal#supported-payment-methods>.
260              
261             When expanded, this is a L<Net::API::Stripe::Payment::Installment> object.
262              
263             =item C<subscription_cancel> hash
264              
265             Information about canceling subscriptions in the portal.
266              
267             =over 8
268              
269             =item C<cancellation_reason> hash
270              
271             Whether the cancellation reasons will be collected in the portal and which options are exposed to the customer
272              
273             =over 12
274              
275             =item C<enabled> boolean
276              
277             Whether the feature is enabled.
278              
279             =item C<options> array
280              
281             Which cancellation reasons will be given as options to the customer.
282              
283              
284             =back
285              
286             =item C<enabled> boolean
287              
288             Whether the feature is enabled.
289              
290             =item C<mode> string
291              
292             Whether to cancel subscriptions immediately or at the end of the billing period.
293              
294             =item C<proration_behavior> string
295              
296             Whether to create prorations when canceling subscriptions. Possible values are C<none> and C<create_prorations>.
297              
298              
299             =back
300              
301             =item C<subscription_pause> hash
302              
303             Information about pausing subscriptions in the portal.
304              
305             When expanded, this is a L<Net::API::Stripe::Payment::Installment> object.
306              
307             =item C<subscription_update> hash
308              
309             Information about updating subscriptions in the portal.
310              
311             =over 8
312              
313             =item C<default_allowed_updates> array
314              
315             The types of subscription updates that are supported for items listed in the C<products> attribute. When empty, subscriptions are not updateable.
316              
317             =item C<enabled> boolean
318              
319             Whether the feature is enabled.
320              
321             =item C<products> array
322              
323             The list of products that support subscription updates.
324              
325             =over 12
326              
327             =item C<prices> string_array
328              
329             The list of price IDs which, when subscribed to, a subscription can be updated.
330              
331             =item C<product> string
332              
333             The product ID.
334              
335              
336             =back
337              
338             =item C<proration_behavior> string
339              
340             Determines how to handle prorations resulting from subscription updates. Valid values are C<none>, C<create_prorations>, and C<always_invoice>.
341              
342              
343             =back
344              
345             =back
346              
347             =head2 is_default boolean
348              
349             Whether the configuration is the default. If true, this configuration can be managed in the Dashboard and portal sessions will use this configuration unless it is overriden when creating the session.
350              
351             =head2 livemode boolean
352              
353             Has the value C<true> if the object exists in live mode or the value C<false> if the object exists in test mode.
354              
355             =head2 login_page hash
356              
357             The hosted login page for this configuration. Learn more about the portal login page in our L<integration docs|https://stripe.com/docs/billing/subscriptions/integrating-customer-portal#share>.
358              
359             It has the following properties:
360              
361             =over 4
362              
363             =item C<enabled> boolean
364              
365             If C<true>, a shareable C<url> will be generated that will take your customers to a hosted login page for the customer portal.
366              
367             If C<false>, the previously generated C<url>, if any, will be deactivated.
368              
369             =item C<url> string
370              
371             A shareable URL to the hosted portal login page. Your customers will be able to log in with their L<email|https://stripe.com/docs/api/customers/object#customer_object-email> and receive a link to their customer portal.
372              
373             =back
374              
375             =head2 metadata hash
376              
377             Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
378              
379             =head2 updated timestamp
380              
381             Time at which the object was last updated. Measured in seconds since the Unix epoch.
382              
383             =head1 API SAMPLE
384              
385             {
386             "id": "bpc_1LJnbGCeyNCl6fY2uCGtb5z5",
387             "object": "billing_portal.configuration",
388             "active": true,
389             "application": null,
390             "business_profile": {
391             "headline": null,
392             "privacy_policy_url": "https://example.com/privacy",
393             "terms_of_service_url": "https://example.com/terms"
394             },
395             "created": 1657411334,
396             "default_return_url": null,
397             "features": {
398             "customer_update": {
399             "allowed_updates": [
400             "email",
401             "tax_id"
402             ],
403             "enabled": true
404             },
405             "invoice_history": {
406             "enabled": true
407             },
408             "payment_method_update": {
409             "enabled": false
410             },
411             "subscription_cancel": {
412             "cancellation_reason": {
413             "enabled": false,
414             "options": []
415             },
416             "enabled": false,
417             "mode": "at_period_end",
418             "proration_behavior": "none"
419             },
420             "subscription_pause": {
421             "enabled": false
422             },
423             "subscription_update": {
424             "default_allowed_updates": [],
425             "enabled": false,
426             "proration_behavior": "none"
427             }
428             },
429             "is_default": true,
430             "livemode": true,
431             "metadata": null,
432             "updated": 1657411334
433             }
434              
435             =head1 HISTORY
436              
437             =head2 v0.1.0
438              
439             Initial version
440              
441             =head1 AUTHOR
442              
443             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
444              
445             =head1 SEE ALSO
446              
447             Stripe API documentation:
448              
449             L<https://stripe.com/docs/api/customer_portal/configuration>
450              
451             =head1 COPYRIGHT & LICENSE
452              
453             Copyright (c) 2019-2022 DEGUEST Pte. Ltd.
454              
455             You can use, copy, modify and redistribute this package and associated
456             files under the same terms as Perl itself.
457              
458             =cut