« lib/WebService/Braintree/_/ApplePayCard.pm
↑ Summary
lib/WebService/Braintree/WebhookTestingGateway.pm »
| 1 | # vim: sw=4 ts=4 ft=perl | ||
| 2 | |||
| 3 | package WebService::Braintree::_::Subscription; | ||
| 4 | 22 | $WebService::Braintree::_::Subscription::VERSION = '1.7'; | |
| 5 | 22 | ▶ | use 5.010_001; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 22 | ▶ | use strictures 1; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | =head1 NAME | ||
| 9 | |||
| 10 | WebService::Braintree::_::Subscription | ||
| 11 | |||
| 12 | =head1 PURPOSE | ||
| 13 | |||
| 14 | This class represents a subscription. | ||
| 15 | |||
| 16 | This class will only be created as part of a L<response|WebService::Braintree::Result> or L<error response|WebService::Braintree::ErrorResult>. | ||
| 17 | |||
| 18 | =cut | ||
| 19 | |||
| 20 | 22 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 21 | 22 | ▶ | use MooX::Aliases; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 22 | |||
| 23 | 22 | extends 'WebService::Braintree::_'; | |
| 24 | |||
| 25 | =head1 ATTRIBUTES | ||
| 26 | |||
| 27 | =cut | ||
| 28 | |||
| 29 | 22 | ▶ | use Types::Standard qw(ArrayRef); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 30 | 22 | ▶ | use WebService::Braintree::Types qw( |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 31 | AddOn | ||
| 32 | Descriptor | ||
| 33 | Discount | ||
| 34 | Subscription_StatusDetail | ||
| 35 | Transaction | ||
| 36 | 22 | ); | |
| 37 | |||
| 38 | =head2 add_ons() | ||
| 39 | |||
| 40 | This returns the subscription's add-ons (if any). This will be an arrayref | ||
| 41 | of L<WebService::Braintree::_::AddOn/>. | ||
| 42 | |||
| 43 | =cut | ||
| 44 | |||
| 45 | 22 | has add_ons => ( | |
| 46 | is => 'ro', | ||
| 47 | isa => ArrayRef[AddOn], | ||
| 48 | coerce => 1, | ||
| 49 | ); | ||
| 50 | |||
| 51 | =head2 balance() | ||
| 52 | |||
| 53 | This is the balance for this subscription. | ||
| 54 | |||
| 55 | =cut | ||
| 56 | |||
| 57 | # Coerce to "big_decimal" | ||
| 58 | 22 | has balance => ( | |
| 59 | is => 'ro', | ||
| 60 | ); | ||
| 61 | |||
| 62 | =head2 billing_day_of_month() | ||
| 63 | |||
| 64 | This is the billing day of month for this subscription. | ||
| 65 | |||
| 66 | =cut | ||
| 67 | |||
| 68 | 22 | has billing_day_of_month => ( | |
| 69 | is => 'ro', | ||
| 70 | ); | ||
| 71 | |||
| 72 | =head2 billing_period_end_date() | ||
| 73 | |||
| 74 | This is the billing period end date for this subscription. | ||
| 75 | |||
| 76 | =cut | ||
| 77 | |||
| 78 | # Coerce this to DateTime | ||
| 79 | 22 | has billing_period_end_date => ( | |
| 80 | is => 'ro', | ||
| 81 | ); | ||
| 82 | |||
| 83 | =head2 billing_period_start_date() | ||
| 84 | |||
| 85 | This is the billing period start date for this subscription. | ||
| 86 | |||
| 87 | =cut | ||
| 88 | |||
| 89 | # Coerce this to DateTime | ||
| 90 | 22 | has billing_period_start_date => ( | |
| 91 | is => 'ro', | ||
| 92 | ); | ||
| 93 | |||
| 94 | =head2 created_at() | ||
| 95 | |||
| 96 | This is when this subscription was created. | ||
| 97 | |||
| 98 | =cut | ||
| 99 | |||
| 100 | # Coerce this to DateTime | ||
| 101 | 22 | has created_at => ( | |
| 102 | is => 'ro', | ||
| 103 | ); | ||
| 104 | |||
| 105 | =head2 current_billing_cycle() | ||
| 106 | |||
| 107 | This is the current billing cycle for this subscription. | ||
| 108 | |||
| 109 | =cut | ||
| 110 | |||
| 111 | 22 | has current_billing_cycle => ( | |
| 112 | is => 'ro', | ||
| 113 | ); | ||
| 114 | |||
| 115 | =head2 days_past_due() | ||
| 116 | |||
| 117 | This is the days past due for this subscription. | ||
| 118 | |||
| 119 | =cut | ||
| 120 | |||
| 121 | # Coerce this to Int | ||
| 122 | 22 | has days_past_due => ( | |
| 123 | is => 'ro', | ||
| 124 | ); | ||
| 125 | |||
| 126 | =head2 description() | ||
| 127 | |||
| 128 | This is the description for this subscription. | ||
| 129 | |||
| 130 | =cut | ||
| 131 | |||
| 132 | 22 | has description => ( | |
| 133 | is => 'ro', | ||
| 134 | ); | ||
| 135 | |||
| 136 | =head2 descriptor() | ||
| 137 | |||
| 138 | This returns the subscription's descriptor (if it exists). This will be an | ||
| 139 | object of type L<WebService::Braintree::_::Descriptor/>. | ||
| 140 | |||
| 141 | =cut | ||
| 142 | |||
| 143 | 22 | has descriptor => ( | |
| 144 | is => 'ro', | ||
| 145 | isa => Descriptor, | ||
| 146 | coerce => 1, | ||
| 147 | ); | ||
| 148 | |||
| 149 | =head2 discounts() | ||
| 150 | |||
| 151 | This returns the subscription's discounts (if any). This will be an arrayref | ||
| 152 | of L<WebService::Braintree::_::Discount/>. | ||
| 153 | |||
| 154 | =cut | ||
| 155 | |||
| 156 | 22 | has discounts => ( | |
| 157 | is => 'ro', | ||
| 158 | isa => ArrayRef[Discount], | ||
| 159 | coerce => 1, | ||
| 160 | ); | ||
| 161 | |||
| 162 | =head2 failure_count() | ||
| 163 | |||
| 164 | This is the failure count for this subscription. | ||
| 165 | |||
| 166 | =cut | ||
| 167 | |||
| 168 | # Coerce this to Int | ||
| 169 | 22 | has failure_count => ( | |
| 170 | is => 'ro', | ||
| 171 | ); | ||
| 172 | |||
| 173 | =head2 first_billing_date() | ||
| 174 | |||
| 175 | This is the first billing date for this subscription. | ||
| 176 | |||
| 177 | =cut | ||
| 178 | |||
| 179 | # Coerce this to DateTime | ||
| 180 | 22 | has first_billing_date => ( | |
| 181 | is => 'ro', | ||
| 182 | ); | ||
| 183 | |||
| 184 | =head2 id() | ||
| 185 | |||
| 186 | This is the id for this subscription. | ||
| 187 | |||
| 188 | =cut | ||
| 189 | |||
| 190 | 22 | has id => ( | |
| 191 | is => 'ro', | ||
| 192 | ); | ||
| 193 | |||
| 194 | =head2 merchant_account_id() | ||
| 195 | |||
| 196 | This is the merchant account id for this subscription. | ||
| 197 | |||
| 198 | =cut | ||
| 199 | |||
| 200 | 22 | has merchant_account_id => ( | |
| 201 | is => 'ro', | ||
| 202 | ); | ||
| 203 | |||
| 204 | =head2 never_expires() | ||
| 205 | |||
| 206 | This is true if this subscription never expires. | ||
| 207 | |||
| 208 | C<< is_never_expires() >> is an alias for this attribute. | ||
| 209 | |||
| 210 | =cut | ||
| 211 | |||
| 212 | 22 | has never_expires => ( | |
| 213 | is => 'ro', | ||
| 214 | alias => 'is_never_expires', | ||
| 215 | ); | ||
| 216 | |||
| 217 | =head2 next_billing_date() | ||
| 218 | |||
| 219 | This is the next_billing_date for this subscription. | ||
| 220 | |||
| 221 | =cut | ||
| 222 | |||
| 223 | # Coerce to DateTime | ||
| 224 | 22 | has next_billing_date => ( | |
| 225 | is => 'ro', | ||
| 226 | ); | ||
| 227 | |||
| 228 | =head2 next_billing_period_amount() | ||
| 229 | |||
| 230 | This is the next billing period amount for this subscription. | ||
| 231 | |||
| 232 | C<< next_bill_amount() >> is a deprecated alias for this attribute. | ||
| 233 | |||
| 234 | =cut | ||
| 235 | |||
| 236 | 22 | has next_billing_period_amount => ( | |
| 237 | is => 'ro', | ||
| 238 | ); | ||
| 239 | |||
| 240 | =head2 number_of_billing_cycles() | ||
| 241 | |||
| 242 | This is the number of billing cycles for this subscription. | ||
| 243 | |||
| 244 | =cut | ||
| 245 | |||
| 246 | # Coerce this to Int (?) | ||
| 247 | 22 | has number_of_billing_cycles => ( | |
| 248 | is => 'ro', | ||
| 249 | ); | ||
| 250 | |||
| 251 | =head2 paid_through_date() | ||
| 252 | |||
| 253 | This is the paid-through date for this subscription. | ||
| 254 | |||
| 255 | =cut | ||
| 256 | |||
| 257 | # Coerce this to DateTime | ||
| 258 | 22 | has paid_through_date => ( | |
| 259 | is => 'ro', | ||
| 260 | ); | ||
| 261 | |||
| 262 | =head2 payment_method_token() | ||
| 263 | |||
| 264 | This is the payment-method token for this subscription. | ||
| 265 | |||
| 266 | =cut | ||
| 267 | |||
| 268 | 22 | has payment_method_token => ( | |
| 269 | is => 'ro', | ||
| 270 | ); | ||
| 271 | |||
| 272 | =head2 plan_id() | ||
| 273 | |||
| 274 | This is the plan id for this subscription. | ||
| 275 | |||
| 276 | =cut | ||
| 277 | |||
| 278 | 22 | has plan_id => ( | |
| 279 | is => 'ro', | ||
| 280 | ); | ||
| 281 | |||
| 282 | =head2 price() | ||
| 283 | |||
| 284 | This is the price for this subscription. | ||
| 285 | |||
| 286 | =cut | ||
| 287 | |||
| 288 | # Coerce to "big_decimal" | ||
| 289 | 22 | has price => ( | |
| 290 | is => 'ro', | ||
| 291 | ); | ||
| 292 | |||
| 293 | =head2 status() | ||
| 294 | |||
| 295 | This is the status for this subscription. | ||
| 296 | |||
| 297 | =cut | ||
| 298 | |||
| 299 | 22 | has status => ( | |
| 300 | is => 'ro', | ||
| 301 | ); | ||
| 302 | |||
| 303 | =head2 status_history() | ||
| 304 | |||
| 305 | This returns the subscription's status history (if any). This will be an arrayref | ||
| 306 | of L<WebService::Braintree::_::Subscription::StatusDetail/>. | ||
| 307 | |||
| 308 | =cut | ||
| 309 | |||
| 310 | has status_history => ( | ||
| 311 | is => 'ro', | ||
| 312 | isa => ArrayRef[Subscription_StatusDetail], | ||
| 313 | coerce => 1, | ||
| 314 | 2 | ▶ | default => sub { [] }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 315 | 22 | ); | |
| 316 | |||
| 317 | =head2 transactions() | ||
| 318 | |||
| 319 | This returns the subscription's transactions (if any). This will be an arrayref | ||
| 320 | of L<WebService::Braintree::_::Transaction/>. | ||
| 321 | |||
| 322 | =cut | ||
| 323 | |||
| 324 | 22 | has transactions => ( | |
| 325 | is => 'ro', | ||
| 326 | isa => ArrayRef[Transaction], | ||
| 327 | coerce => 1, | ||
| 328 | ); | ||
| 329 | |||
| 330 | =head2 trial_duration() | ||
| 331 | |||
| 332 | This is the trial period duration for this subscription. | ||
| 333 | |||
| 334 | =cut | ||
| 335 | |||
| 336 | # Coerce this to Int (?) | ||
| 337 | 22 | has trial_duration => ( | |
| 338 | is => 'ro', | ||
| 339 | ); | ||
| 340 | |||
| 341 | =head2 trial_duration_unit() | ||
| 342 | |||
| 343 | This is the unit for the L</trial_duration> for this subscription. | ||
| 344 | |||
| 345 | =cut | ||
| 346 | |||
| 347 | 22 | has trial_duration_unit => ( | |
| 348 | is => 'ro', | ||
| 349 | ); | ||
| 350 | |||
| 351 | =head2 trial_period() | ||
| 352 | |||
| 353 | This is the trial period for this subscription. | ||
| 354 | |||
| 355 | =cut | ||
| 356 | |||
| 357 | 22 | has trial_period => ( | |
| 358 | is => 'ro', | ||
| 359 | ); | ||
| 360 | |||
| 361 | =head2 updated_at() | ||
| 362 | |||
| 363 | This is when this subscription was last updated. If it has never been updated, | ||
| 364 | then this should equal the L</created_at> date. | ||
| 365 | |||
| 366 | =cut | ||
| 367 | |||
| 368 | # Coerce this to a DateTime | ||
| 369 | 22 | has updated_at => ( | |
| 370 | is => 'ro', | ||
| 371 | ); | ||
| 372 | |||
| 373 | # This cannot be a Moose alias because both parameters are passed in. The Ruby | ||
| 374 | # SDK only takes the "next_billing_period_amount" parameter and has marked | ||
| 375 | # next_bill_amount as deprecated. | ||
| 376 | 0 | ▶ | sub next_bill_amount { shift->next_billing_period_amount } |
|
Subroutine
next_bill_amount: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 377 | |||
| 378 | 22 | __PACKAGE__->meta->make_immutable; | |
| 379 | |||
| 380 | 22 | 1; | |
| 381 | __END__ | ||