| 1 | ##---------------------------------------------------------------------------- | ||
| 2 | ## Stripe API - ~/lib/Net/API/Stripe/Issuing/Card.pm | ||
| 3 | ## Version v0.200.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/issuing/cards/object | ||
| 11 | package Net::API::Stripe::Issuing::Card; | ||
| 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.200.0'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 17 | }; | ||
| 18 | |||
| 19 | 0 | ▶ | sub id { shift->_set_get_scalar( 'id', @_ ); } |
|
Subroutine
id: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 20 | |||
| 21 | 0 | ▶ | sub object { shift->_set_get_scalar( 'object', @_ ); } |
|
Subroutine
object: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 22 | |||
| 23 | 0 | ▶ | sub authorization_controls { shift->_set_get_object( 'authorization_controls', 'Net::API::Stripe::Issuing::Card::AuthorizationsControl', @_ ); } |
|
Subroutine
authorization_controls: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 24 | |||
| 25 | 0 | ▶ | sub brand { shift->_set_get_scalar( 'brand', @_ ); } |
|
Subroutine
brand: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 26 | |||
| 27 | 0 | ▶ | sub cardholder { shift->_set_get_object( 'cardholder', 'Net::API::Stripe::Issuing::Card::Holder', @_ ); } |
|
Subroutine
cardholder: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 28 | |||
| 29 | 0 | ▶ | sub created { shift->_set_get_datetime( 'created', @_ ); } |
|
Subroutine
created: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 30 | |||
| 31 | 0 | ▶ | sub currency { shift->_set_get_scalar( 'currency', @_ ); } |
|
Subroutine
currency: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 32 | |||
| 33 | 0 | ▶ | sub exp_month { shift->_set_get_scalar( 'exp_month', @_ ); } |
|
Subroutine
exp_month: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 34 | |||
| 35 | 0 | ▶ | sub exp_year { shift->_set_get_scalar( 'exp_year', @_ ); } |
|
Subroutine
exp_year: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 36 | |||
| 37 | 0 | ▶ | sub last4 { shift->_set_get_scalar( 'last4', @_ ); } |
|
Subroutine
last4: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 38 | |||
| 39 | 0 | ▶ | sub livemode { shift->_set_get_boolean( 'livemode', @_ ); } |
|
Subroutine
livemode: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 40 | |||
| 41 | 0 | ▶ | sub metadata { shift->_set_get_hash( 'metadata', @_ ); } |
|
Subroutine
metadata: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 42 | |||
| 43 | 0 | ▶ | sub name { shift->_set_get_scalar( 'name', @_ ); } |
|
Subroutine
name: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 44 | |||
| 45 | 0 | ▶ | sub pin { return( shift->_set_get_hash_as_object( 'pin', 'Net::API::Stripe::Issuing::Card::PinInfo', @_ ) ); } |
|
Subroutine
pin: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 46 | |||
| 47 | 0 | ▶ | sub replacement_for { return( shift->_set_get_scalar_or_object( 'replacement_for', 'Net::API::Stripe::Issuing::Card', @_ ) ); } |
|
Subroutine
replacement_for: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 48 | |||
| 49 | 0 | ▶ | sub replacement_reason { return( shift->_set_get_scalar( 'replacement_reason', @_ ) ); } |
|
Subroutine
replacement_reason: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 50 | |||
| 51 | 0 | ▶ | sub shipping { shift->_set_get_object( 'shipping', 'Net::API::Stripe::Shipping', @_ ); } |
|
Subroutine
shipping: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 52 | |||
| 53 | sub spending_controls | ||
| 54 | { | ||
| 55 | 0 | ▶ | return( shift->_set_get_class( 'spending_controls', |
|
Subroutine
spending_controls: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 56 | { | ||
| 57 | allowed_categories => { type => 'array' }, | ||
| 58 | blocked_categories => { type => 'array' }, | ||
| 59 | spending_limits => | ||
| 60 | { | ||
| 61 | type => 'class', definition => | ||
| 62 | { | ||
| 63 | amount => { type => 'number' }, | ||
| 64 | categories => { type => 'array' }, | ||
| 65 | interval => { type => 'scalar' }, | ||
| 66 | } | ||
| 67 | }, | ||
| 68 | spending_limits_currency => { type => 'scalar' }, | ||
| 69 | }, @_ ) ); | ||
| 70 | } | ||
| 71 | |||
| 72 | 0 | ▶ | sub status { shift->_set_get_scalar( 'status', @_ ); } |
|
Subroutine
status: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 73 | |||
| 74 | 0 | ▶ | sub type { shift->_set_get_scalar( 'type', @_ ); } |
|
Subroutine
type: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 75 | |||
| 76 | 1 | 1; | |
| 77 | |||
| 78 | __END__ | ||
| 79 | |||
| 80 | =encoding utf8 | ||
| 81 | |||
| 82 | =head1 NAME | ||
| 83 | |||
| 84 | Net::API::Stripe::Issuing::Card - A Stripe Issued Card Object | ||
| 85 | |||
| 86 | =head1 SYNOPSIS | ||
| 87 | |||
| 88 | my $card = $stripe->card({ | ||
| 89 | authorization_controls => $authorization_controls_objet, | ||
| 90 | brand => 'visa', | ||
| 91 | cardholder => $cardholder_object, | ||
| 92 | currency => 'jpy', | ||
| 93 | exp_month => 12, | ||
| 94 | exp_year => 2030, | ||
| 95 | last4 => 123, | ||
| 96 | metadata => { transaction_id => 123 }, | ||
| 97 | name => 'John Doe', | ||
| 98 | replacement_for => $card_object, | ||
| 99 | replacement_reason => 'loss', | ||
| 100 | shipping => $address_object, | ||
| 101 | status => 'active', | ||
| 102 | type => 'physical', | ||
| 103 | }); | ||
| 104 | |||
| 105 | See documentation in L<Net::API::Stripe> for example to make api calls to Stripe to create those objects. | ||
| 106 | |||
| 107 | =head1 VERSION | ||
| 108 | |||
| 109 | v0.200.0 | ||
| 110 | |||
| 111 | =head1 DESCRIPTION | ||
| 112 | |||
| 113 | You can create physical or virtual cards that are issued to cardholders. | ||
| 114 | |||
| 115 | This Module bears some resemblance with L<Net::API::Stripe::Connect::ExternalAccount::Card>, but is quite different, so it stands on its own. | ||
| 116 | |||
| 117 | =head1 CONSTRUCTOR | ||
| 118 | |||
| 119 | =over 4 | ||
| 120 | |||
| 121 | =item B<new>( %ARG ) | ||
| 122 | |||
| 123 | Creates a new L<Net::API::Stripe::Issuing::Card> object. | ||
| 124 | It may also take an hash like arguments, that also are method of the same name. | ||
| 125 | |||
| 126 | =back | ||
| 127 | |||
| 128 | =head1 METHODS | ||
| 129 | |||
| 130 | =over 4 | ||
| 131 | |||
| 132 | =item B<id> string | ||
| 133 | |||
| 134 | Unique identifier for the object. | ||
| 135 | |||
| 136 | =item B<object> string, value is "issuing.card" | ||
| 137 | |||
| 138 | String representing the object’s type. Objects of the same type share the same value. | ||
| 139 | |||
| 140 | =item B<authorization_controls> hash | ||
| 141 | |||
| 142 | Spending rules that give you some control over how your cards can be used. Refer to L<Stripe's authorizations documentation|https://stripe.com/docs/issuing/purchases/authorizations> for more details. | ||
| 143 | |||
| 144 | This is a L<Net::API::Stripe::Issuing::Card::AuthorizationsControl> object. | ||
| 145 | |||
| 146 | =item B<brand> string | ||
| 147 | |||
| 148 | The brand of the card. | ||
| 149 | |||
| 150 | =item B<cardholder> hash | ||
| 151 | |||
| 152 | The Cardholder object to which the card belongs. | ||
| 153 | |||
| 154 | This is a L<Net::API::Stripe::Issuing::Card::Holder> object. | ||
| 155 | |||
| 156 | =item B<created> timestamp | ||
| 157 | |||
| 158 | Time at which the object was created. Measured in seconds since the Unix epoch. | ||
| 159 | |||
| 160 | =item B<currency> currency | ||
| 161 | |||
| 162 | Three-letter ISO currency code, in lowercase. Must be a supported currency. | ||
| 163 | |||
| 164 | =item B<exp_month> integer | ||
| 165 | |||
| 166 | The expiration month of the card. | ||
| 167 | |||
| 168 | =item B<exp_year> integer | ||
| 169 | |||
| 170 | The expiration year of the card. | ||
| 171 | |||
| 172 | =item B<last4> string | ||
| 173 | |||
| 174 | The last 4 digits of the card number. | ||
| 175 | |||
| 176 | =item B<livemode> boolean | ||
| 177 | |||
| 178 | Has the value true if the object exists in live mode or the value false if the object exists in test mode. | ||
| 179 | |||
| 180 | =item B<metadata> hash | ||
| 181 | |||
| 182 | 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. | ||
| 183 | |||
| 184 | =item B<name> string | ||
| 185 | |||
| 186 | The name of the cardholder, printed on the card. | ||
| 187 | |||
| 188 | =item B<pin> hash | ||
| 189 | |||
| 190 | Metadata about the PIN on the card. | ||
| 191 | |||
| 192 | This is a virtual L<Net::API::Stripe::Issuing::Card::PinInfo> object. | ||
| 193 | |||
| 194 | It contains the following property: | ||
| 195 | |||
| 196 | =over 8 | ||
| 197 | |||
| 198 | =item I<status> string | ||
| 199 | |||
| 200 | The status of the pin. One of blocked or active. | ||
| 201 | |||
| 202 | =back | ||
| 203 | |||
| 204 | =item B<replacement_for> string (expandable) | ||
| 205 | |||
| 206 | The card this card replaces, if any. When expanded, this is a L<Net::API::Stripe::Issuing::Card> object. | ||
| 207 | |||
| 208 | =item B<replacement_reason> string | ||
| 209 | |||
| 210 | Why the card that this card replaces (if any) needed to be replaced. One of damage, expiration, loss, or theft. | ||
| 211 | |||
| 212 | =item B<shipping> hash | ||
| 213 | |||
| 214 | Where and how the card will be shipped. | ||
| 215 | |||
| 216 | This is a L<Net::API::Stripe::Shipping> object. | ||
| 217 | |||
| 218 | =item B<spending_controls> hash | ||
| 219 | |||
| 220 | This is a hash whose properties are accessible as a dynamic class methods | ||
| 221 | |||
| 222 | =over 8 | ||
| 223 | |||
| 224 | =item I<amount> positive integer | ||
| 225 | |||
| 226 | Maximum amount allowed to spend per time interval. | ||
| 227 | |||
| 228 | =item I<categories> array | ||
| 229 | |||
| 230 | Array of strings containing categories on which to apply the spending limit. Leave this blank to limit all charges. | ||
| 231 | |||
| 232 | =item I<interval> enum | ||
| 233 | |||
| 234 | The time interval or event with which to apply this spending limit towards. | ||
| 235 | |||
| 236 | =over 12 | ||
| 237 | |||
| 238 | =item I<per_authorization> | ||
| 239 | |||
| 240 | A maximum amount for each authorization. | ||
| 241 | |||
| 242 | =item I<daily> | ||
| 243 | |||
| 244 | A maximum within a day. A day start at midnight UTC. | ||
| 245 | |||
| 246 | =item I<weekly> | ||
| 247 | |||
| 248 | A maximum within a week. The first day of a week is Monday. | ||
| 249 | |||
| 250 | =item I<monthly> | ||
| 251 | |||
| 252 | A maximum within a month. Starts on the first of that month. | ||
| 253 | |||
| 254 | =item I<yearly> | ||
| 255 | |||
| 256 | A maximum amount within a year. Starts January 1st. | ||
| 257 | |||
| 258 | =item I<all_time> | ||
| 259 | |||
| 260 | A maximum amount for all transactions. | ||
| 261 | |||
| 262 | =back | ||
| 263 | |||
| 264 | =item I<spending_limits_currency> currency | ||
| 265 | |||
| 266 | Currency for the amounts within spending_limits. Locked to the currency of the card. | ||
| 267 | |||
| 268 | =back | ||
| 269 | |||
| 270 | =item B<status> string | ||
| 271 | |||
| 272 | One of active, inactive, canceled, lost, or stolen. | ||
| 273 | |||
| 274 | =item B<type> string | ||
| 275 | |||
| 276 | One of virtual or physical. | ||
| 277 | |||
| 278 | =back | ||
| 279 | |||
| 280 | =head1 API SAMPLE | ||
| 281 | |||
| 282 | { | ||
| 283 | "id": "ic_fake123456789", | ||
| 284 | "object": "issuing.card", | ||
| 285 | "authorization_controls": { | ||
| 286 | "allowed_categories": null, | ||
| 287 | "blocked_categories": null, | ||
| 288 | "currency": "usd", | ||
| 289 | "max_amount": 10000, | ||
| 290 | "max_approvals": 1, | ||
| 291 | "spending_limits": [], | ||
| 292 | "spending_limits_currency": null | ||
| 293 | }, | ||
| 294 | "brand": "Visa", | ||
| 295 | "cardholder": { | ||
| 296 | "id": "ich_fake123456789", | ||
| 297 | "object": "issuing.cardholder", | ||
| 298 | "authorization_controls": { | ||
| 299 | "allowed_categories": [], | ||
| 300 | "blocked_categories": [], | ||
| 301 | "spending_limits": [], | ||
| 302 | "spending_limits_currency": null | ||
| 303 | }, | ||
| 304 | "billing": { | ||
| 305 | "address": { | ||
| 306 | "city": "Beverly Hills", | ||
| 307 | "country": "US", | ||
| 308 | "line1": "123 Fake St", | ||
| 309 | "line2": "Apt 3", | ||
| 310 | "postal_code": "90210", | ||
| 311 | "state": "CA" | ||
| 312 | }, | ||
| 313 | "name": "Jenny Rosen" | ||
| 314 | }, | ||
| 315 | "company": null, | ||
| 316 | "created": 1540111055, | ||
| 317 | "email": "jenny@example.com", | ||
| 318 | "individual": null, | ||
| 319 | "is_default": false, | ||
| 320 | "livemode": false, | ||
| 321 | "metadata": {}, | ||
| 322 | "name": "Jenny Rosen", | ||
| 323 | "phone_number": "+18008675309", | ||
| 324 | "requirements": { | ||
| 325 | "disabled_reason": null, | ||
| 326 | "past_due": [] | ||
| 327 | }, | ||
| 328 | "status": "active", | ||
| 329 | "type": "individual" | ||
| 330 | }, | ||
| 331 | "created": 1571480456, | ||
| 332 | "currency": "usd", | ||
| 333 | "exp_month": 8, | ||
| 334 | "exp_year": 2020, | ||
| 335 | "last4": "4242", | ||
| 336 | "livemode": false, | ||
| 337 | "metadata": {}, | ||
| 338 | "name": "Jenny Rosen", | ||
| 339 | "pin": null, | ||
| 340 | "replacement_for": null, | ||
| 341 | "replacement_reason": null, | ||
| 342 | "shipping": null, | ||
| 343 | "status": "active", | ||
| 344 | "type": "physical" | ||
| 345 | } | ||
| 346 | |||
| 347 | =head1 HISTORY | ||
| 348 | |||
| 349 | =head2 v0.1 | ||
| 350 | |||
| 351 | Initial version | ||
| 352 | |||
| 353 | =head2 v0.2 | ||
| 354 | |||
| 355 | Added method L</"spending_controls"> that was added on Stripe api. | ||
| 356 | |||
| 357 | =head1 AUTHOR | ||
| 358 | |||
| 359 | Jacques Deguest E<lt>F<jack@deguest.jp>E<gt> | ||
| 360 | |||
| 361 | =head1 SEE ALSO | ||
| 362 | |||
| 363 | Stripe API documentation: | ||
| 364 | |||
| 365 | L<https://stripe.com/docs/api/issuing/cards> | ||
| 366 | |||
| 367 | =head1 COPYRIGHT & LICENSE | ||
| 368 | |||
| 369 | Copyright (c) 2019-2020 DEGUEST Pte. Ltd. | ||
| 370 | |||
| 371 | You can use, copy, modify and redistribute this package and associated | ||
| 372 | files under the same terms as Perl itself. | ||
| 373 | |||
| 374 | =cut | ||