Stripe/Billing/Coupon.pm

filter: Statementstmt 33.3% 8 / 24 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 15.7% 3 / 19 Podpod 100% 16 / 16 totaltotal 45.7% 27 / 59 CC 1 SCAR 6.1
CC
1
Cov
33%
id
2.0
object
2.0
amount_off
2.0
CRAP 1.8
« Stripe/Balance/Transaction.pm ↑ Summary Stripe/Connect/TopUp.pm »
1 ##----------------------------------------------------------------------------
2 ## Stripe API - ~/lib/Net/API/Stripe/Billing/Coupon.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 ## https://stripe.com/docs/api/coupons/object
11 package Net::API::Stripe::Billing::Coupon;
12 BEGIN
13 {
14 1 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶ use parent qw( Net::API::Stripe::Generic );
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 ▶ our( $VERSION ) = 'v0.100.0';
Subroutine BEGIN: called CC=1 SCAR=0.0
17 };
18  
19 0 ▶sub id { return( shift->_set_get_scalar( 'id', @_ ) ); }
Subroutine id: not called CC=1 SCAR=6.9
Pod documented
20  
21 0 ▶sub object { return( shift->_set_get_scalar( 'object', @_ ) ); }
Subroutine object: not called CC=1 SCAR=6.9
Pod documented
22  
23 0 ▶sub amount_off { return( shift->_set_get_number( 'amount_off', @_ ) ); }
Subroutine amount_off: not called CC=1 SCAR=6.9
Pod documented
24  
25 0 ▶sub created { return( shift->_set_get_datetime( 'created', @_ ) ); }
Subroutine created: not called CC=1 SCAR=6.9
Pod documented
26  
27 0 ▶sub currency { return( shift->_set_get_scalar( 'currency', @_ ) ); }
Subroutine currency: not called CC=1 SCAR=6.9
Pod documented
28  
29 0 ▶sub deleted { return( shift->_set_get_boolean( 'deleted', @_ ) ); }
Subroutine deleted: not called CC=1 SCAR=6.9
Pod documented
30  
31 0 ▶sub duration { return( shift->_set_get_scalar( 'duration', @_ ) ); }
Subroutine duration: not called CC=1 SCAR=6.9
Pod documented
32  
33 0 ▶sub duration_in_months { return( shift->_set_get_scalar( 'duration_in_months', @_ ) ); }
Subroutine duration_in_months: not called CC=1 SCAR=6.9
Pod documented
34  
35 0 ▶sub livemode { return( shift->_set_get_boolean( 'livemode', @_ ) ); }
Subroutine livemode: not called CC=1 SCAR=6.9
Pod documented
36  
37 0 ▶sub max_redemptions { return( shift->_set_get_scalar( 'max_redemptions', @_ ) ); }
Subroutine max_redemptions: not called CC=1 SCAR=6.9
Pod documented
38  
39 0 ▶sub metadata { return( shift->_set_get_hash( 'metadata', @_ ) ); }
Subroutine metadata: not called CC=1 SCAR=6.9
Pod documented
40  
41 0 ▶sub name { return( shift->_set_get_scalar( 'name', @_ ) ); }
Subroutine name: not called CC=1 SCAR=6.9
Pod documented
42  
43 0 ▶sub percent_off { return( shift->_set_get_scalar( 'percent_off', @_ ) ); }
Subroutine percent_off: not called CC=1 SCAR=6.9
Pod documented
44  
45 0 ▶sub redeem_by { return( shift->_set_get_datetime( 'redeem_by', @_ ) ); }
Subroutine redeem_by: not called CC=1 SCAR=6.9
Pod documented
46  
47 0 ▶sub times_redeemed { return( shift->_set_get_scalar( 'times_redeemed', @_ ) ); }
Subroutine times_redeemed: not called CC=1 SCAR=6.9
Pod documented
48  
49 0 ▶sub valid { return( shift->_set_get_boolean( 'valid', @_ ) ); }
Subroutine valid: not called CC=1 SCAR=6.9
Pod documented
50  
51 1 1;
52  
53 __END__
54  
55 =encoding utf8
56  
57 =head1 NAME
58  
59 Net::API::Stripe::Billing::Coupon - A Stripe Coupon Object
60  
61 =head1 SYNOPSIS
62  
63 my $coupon = $stripe->coupons( create =>
64 {
65 id => 'SUMMER10POFF',
66 currency => 'usd',
67 duration_in_months => 2,
68 max_redemptions => 12,
69 name => 'Summer 10% reduction',
70 percent_off => 10,
71 valid => 1
72 }) || die( $stripe->error );
73  
74 =head1 VERSION
75  
76 v0.100.0
77  
78 =head1 DESCRIPTION
79  
80 A coupon contains information about a percent-off or amount-off discount you might want to apply to a customer. Coupons may be applied to invoices (L<Net::API::Stripe::Billing::Invoice> / L<https://stripe.com/docs/api/coupons#invoices>) or orders (L<Net::API::Stripe::Order> / L<https://stripe.com/docs/api/coupons#create_order-coupon>). Coupons do not work with conventional one-off charges (L<Net::API::Stripe::Charge> / L<https://stripe.com/docs/api/coupons#create_charge>), but you can implement a custom coupon system (L<https://stripe.com/docs/recipes/coupons-for-charges>) in your application.
81  
82 =head1 CONSTRUCTOR
83  
84 =over 4
85  
86 =item B<new>( %ARG )
87  
88 Creates a new L<Net::API::Stripe::Billing::Coupon> object.
89 It may also take an hash like arguments, that also are method of the same name.
90  
91 =back
92  
93 =head1 METHODS
94  
95 =over 4
96  
97 =item B<id> string
98  
99 Unique identifier for the object.
100  
101 =item B<object> string, value is "coupon"
102  
103 String representing the object’s type. Objects of the same type share the same value.
104  
105 =item B<amount_off> positive integer
106  
107 Amount (in the currency specified) that will be taken off the subtotal of any invoices for this customer.
108  
109 =item B<created> timestamp
110  
111 Time at which the object was created. Measured in seconds since the Unix epoch.
112  
113 =item B<currency> currency
114  
115 If amount_off has been set, the three-letter ISO code for the currency of the amount to take off.
116  
117 =item B<deleted> boolean
118  
119 This property exists only when the object has been deleted.
120  
121 =item B<duration> string
122  
123 One of forever, once, and repeating. Describes how long a customer who applies this coupon will get the discount.
124  
125 =item B<duration_in_months> positive integer
126  
127 If duration is repeating, the number of months the coupon applies. Null if coupon duration is forever or once.
128  
129 =item B<livemode> boolean
130  
131 Has the value true if the object exists in live mode or the value false if the object exists in test mode.
132  
133 =item B<max_redemptions> positive integer
134  
135 Maximum number of times this coupon can be redeemed, in total, across all customers, before it is no longer valid.
136  
137 =item B<metadata> hash
138  
139 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.
140  
141 =item B<name> string
142  
143 Name of the coupon displayed to customers on for instance invoices or receipts.
144  
145 =item B<percent_off> decimal
146  
147 Percent that will be taken off the subtotal of any invoices for this customer for the duration of the coupon. For example, a coupon with percent_off of 50 will make a ¥100 invoice ¥50 instead.
148  
149 =item B<redeem_by> timestamp
150  
151 Date after which the coupon can no longer be redeemed. This is a C<DateTime> object.
152  
153 =item B<times_redeemed> positive integer or zero
154  
155 Number of times this coupon has been applied to a customer.
156  
157 =item B<valid> boolean
158  
159 Taking account of the above properties, whether this coupon can still be applied to a customer.
160  
161 =back
162  
163 =head1 API SAMPLE
164  
165 {
166 "id": "25_5OFF",
167 "object": "coupon",
168 "amount_off": null,
169 "created": 1571397911,
170 "currency": null,
171 "duration": "repeating",
172 "duration_in_months": 3,
173 "livemode": false,
174 "max_redemptions": null,
175 "metadata": {},
176 "name": "25.5% off",
177 "percent_off": 25.5,
178 "redeem_by": null,
179 "times_redeemed": 0,
180 "valid": true
181 }
182  
183 =head1 HISTORY
184  
185 =head2 v0.1
186  
187 Initial version
188  
189 =head1 STRIPE HISTORY
190  
191 =head2 2018-07-27
192  
193 The percent_off field of coupons was changed from Integer to Float, with a precision of two decimal places.
194  
195 =head1 AUTHOR
196  
197 Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
198  
199 =head1 SEE ALSO
200  
201 Stripe API documentation:
202  
203 L<https://stripe.com/docs/api/coupons/object>
204  
205 =head1 COPYRIGHT & LICENSE
206  
207 Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
208  
209 You can use, copy, modify and redistribute this package and associated
210 files under the same terms as Perl itself.
211  
212 =cut
213  
« Stripe/Balance/Transaction.pm ↑ Summary Stripe/Connect/TopUp.pm »