Class: AdvancedBilling::SubscriptionGroupSignupResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/advanced_billing/models/subscription_group_signup_response.rb

Overview

SubscriptionGroupSignupResponse Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(uid: SKIP, scheme: SKIP, customer_id: SKIP, payment_profile_id: SKIP, subscription_ids: SKIP, primary_subscription_id: SKIP, next_assessment_at: SKIP, state: SKIP, cancel_at_end_of_period: SKIP, subscriptions: SKIP, payment_collection_method: SKIP, additional_properties: {}) ⇒ SubscriptionGroupSignupResponse

Returns a new instance of SubscriptionGroupSignupResponse.



312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
# File 'lib/advanced_billing/models/subscription_group_signup_response.rb', line 312

def initialize(uid: SKIP, scheme: SKIP, customer_id: SKIP,
               payment_profile_id: SKIP, subscription_ids: SKIP,
               primary_subscription_id: SKIP, next_assessment_at: SKIP,
               state: SKIP, cancel_at_end_of_period: SKIP,
               subscriptions: SKIP, payment_collection_method: SKIP,
               additional_properties: {})
  # Add additional model properties to the instance.
  additional_properties.each do |_name, _value|
    instance_variable_set("@#{_name}", _value)
  end

  @uid = uid unless uid == SKIP
  @scheme = scheme unless scheme == SKIP
  @customer_id = customer_id unless customer_id == SKIP
  @payment_profile_id = payment_profile_id unless payment_profile_id == SKIP
  @subscription_ids = subscription_ids unless subscription_ids == SKIP
  @primary_subscription_id = primary_subscription_id unless primary_subscription_id == SKIP
  @next_assessment_at = next_assessment_at unless next_assessment_at == SKIP
  @state = state unless state == SKIP
  @cancel_at_end_of_period = cancel_at_end_of_period unless cancel_at_end_of_period == SKIP
  @subscriptions = subscriptions unless subscriptions == SKIP
  unless payment_collection_method == SKIP
    @payment_collection_method =
      payment_collection_method
  end
end

Instance Attribute Details

#cancel_at_end_of_periodTrueClass | FalseClass

The state of a subscription.

  • **Live States**

    * `active` - A normal, active subscription. It is not in a trial and
    

is paid and up to date.

* `assessing` - An internal (transient) state that indicates a

subscription is in the middle of periodic assessment. Do not base any access decisions in your app on this state, as it may not always be exposed.

* `pending` - An internal (transient) state that indicates a

subscription is in the creation process. Do not base any access decisions in your app on this state, as it may not always be exposed.

* `trialing` - A subscription in trialing state has a valid trial

subscription. This type of subscription may transition to active once payment is received when the trial has ended. Otherwise, it may go to a Problem or End of Life state.

* `paused` - An internal state that indicates that your account with

Advanced Billing is in arrears.

  • **Problem States**

    * `past_due` - Indicates that the most recent payment has failed, and
    

payment is past due for this subscription. If you have enabled our automated dunning, this subscription will be in the dunning process (additional status and callbacks from the dunning process will be available in the future). If you are handling dunning and payment updates yourself, you will want to use this state to initiate a payment update from your customers.

* `soft_failure` - Indicates that normal assessment/processing of the

subscription has failed for a reason that cannot be fixed by the Customer. For example, a Soft Fail may result from a timeout at the gateway or incorrect credentials on your part. The subscriptions should be retried automatically. An interface is being built for you to review problems resulting from these events to take manual action when needed.

* `unpaid` - Indicates an unpaid subscription. A subscription is

marked unpaid if the retry period expires and you have configured your [Dunning](maxio.zendesk.com/hc/en-us/articles/24287076583565-Dunni ng-Overview) settings to have a Final Action of ‘mark the subscription unpaid`.

  • **End of Life States**

    * `canceled` - Indicates a canceled subscription. This may happen at
    

your request (via the API or the web interface) or due to the expiration of the [Dunning](maxio.zendesk.com/hc/en-us/articles/24287076583565-Dunni ng-Overview) process without payment. See the [Reactivation](maxio.zendesk.com/hc/en-us/articles/24252109503629- Reactivating-and-Resuming) documentation for info on how to restart a canceled subscription.

While a subscription is canceled, its period will not advance, it will

not accrue any new charges, and Advanced Billing will not attempt to collect the overdue balance.

* `expired` - Indicates a subscription that has expired due to running

its normal life cycle. Some products may be configured to have an expiration period. An expired subscription then is one that stayed active until it fulfilled its full period.

* `failed_to_create` - Indicates that signup has failed. (You may see

this state in a signup_failure webhook.)

* `on_hold` - Indicates that a subscription’s billing has been

temporarily stopped. While it is expected that the subscription will resume and return to active status, this is still treated as an “End of Life” state because the customer is not paying for services during this time.

* `suspended` - Indicates that a prepaid subscription has used up all

their prepayment balance. If a prepayment is applied, it will return to an active state.

* `trial_ended` - A subscription in a trial_ended state is a

subscription that completed a no-obligation trial and did not have a card on file at the expiration of the trial period. See [Product Pricing – No Obligation Trials](maxio.zendesk.com/hc/en-us/articles/24261076617869-Product -Editing) for more details. See [Subscription States](maxio.zendesk.com/hc/en-us/articles/24252119027853-Subscri ption-States) for more info about subscription states and state transitions.

Returns:

  • (TrueClass | FalseClass)


189
190
191
# File 'lib/advanced_billing/models/subscription_group_signup_response.rb', line 189

def cancel_at_end_of_period
  @cancel_at_end_of_period
end

#customer_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


23
24
25
# File 'lib/advanced_billing/models/subscription_group_signup_response.rb', line 23

def customer_id
  @customer_id
end

#next_assessment_atDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


39
40
41
# File 'lib/advanced_billing/models/subscription_group_signup_response.rb', line 39

def next_assessment_at
  @next_assessment_at
end

#payment_collection_methodCollectionMethod

The type of payment collection to be used in the subscription. For legacy Statements Architecture valid options are - ‘invoice`, `automatic`. For current Relationship Invoicing Architecture valid options are - `remittance`, `automatic`, `prepaid`.

Returns:



271
272
273
# File 'lib/advanced_billing/models/subscription_group_signup_response.rb', line 271

def payment_collection_method
  @payment_collection_method
end

#payment_profile_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


27
28
29
# File 'lib/advanced_billing/models/subscription_group_signup_response.rb', line 27

def payment_profile_id
  @payment_profile_id
end

#primary_subscription_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


35
36
37
# File 'lib/advanced_billing/models/subscription_group_signup_response.rb', line 35

def primary_subscription_id
  @primary_subscription_id
end

#schemeInteger

TODO: Write general description for this method

Returns:

  • (Integer)


19
20
21
# File 'lib/advanced_billing/models/subscription_group_signup_response.rb', line 19

def scheme
  @scheme
end

#stateSubscriptionState

The state of a subscription.

  • **Live States**

    * `active` - A normal, active subscription. It is not in a trial and
    

is paid and up to date.

* `assessing` - An internal (transient) state that indicates a

subscription is in the middle of periodic assessment. Do not base any access decisions in your app on this state, as it may not always be exposed.

* `pending` - An internal (transient) state that indicates a

subscription is in the creation process. Do not base any access decisions in your app on this state, as it may not always be exposed.

* `trialing` - A subscription in trialing state has a valid trial

subscription. This type of subscription may transition to active once payment is received when the trial has ended. Otherwise, it may go to a Problem or End of Life state.

* `paused` - An internal state that indicates that your account with

Advanced Billing is in arrears.

  • **Problem States**

    * `past_due` - Indicates that the most recent payment has failed, and
    

payment is past due for this subscription. If you have enabled our automated dunning, this subscription will be in the dunning process (additional status and callbacks from the dunning process will be available in the future). If you are handling dunning and payment updates yourself, you will want to use this state to initiate a payment update from your customers.

* `soft_failure` - Indicates that normal assessment/processing of the

subscription has failed for a reason that cannot be fixed by the Customer. For example, a Soft Fail may result from a timeout at the gateway or incorrect credentials on your part. The subscriptions should be retried automatically. An interface is being built for you to review problems resulting from these events to take manual action when needed.

* `unpaid` - Indicates an unpaid subscription. A subscription is

marked unpaid if the retry period expires and you have configured your [Dunning](maxio.zendesk.com/hc/en-us/articles/24287076583565-Dunni ng-Overview) settings to have a Final Action of ‘mark the subscription unpaid`.

  • **End of Life States**

    * `canceled` - Indicates a canceled subscription. This may happen at
    

your request (via the API or the web interface) or due to the expiration of the [Dunning](maxio.zendesk.com/hc/en-us/articles/24287076583565-Dunni ng-Overview) process without payment. See the [Reactivation](maxio.zendesk.com/hc/en-us/articles/24252109503629- Reactivating-and-Resuming) documentation for info on how to restart a canceled subscription.

While a subscription is canceled, its period will not advance, it will

not accrue any new charges, and Advanced Billing will not attempt to collect the overdue balance.

* `expired` - Indicates a subscription that has expired due to running

its normal life cycle. Some products may be configured to have an expiration period. An expired subscription then is one that stayed active until it fulfilled its full period.

* `failed_to_create` - Indicates that signup has failed. (You may see

this state in a signup_failure webhook.)

* `on_hold` - Indicates that a subscription’s billing has been

temporarily stopped. While it is expected that the subscription will resume and return to active status, this is still treated as an “End of Life” state because the customer is not paying for services during this time.

* `suspended` - Indicates that a prepaid subscription has used up all

their prepayment balance. If a prepayment is applied, it will return to an active state.

* `trial_ended` - A subscription in a trial_ended state is a

subscription that completed a no-obligation trial and did not have a card on file at the expiration of the trial period. See [Product Pricing – No Obligation Trials](maxio.zendesk.com/hc/en-us/articles/24261076617869-Product -Editing) for more details. See [Subscription States](maxio.zendesk.com/hc/en-us/articles/24252119027853-Subscri ption-States) for more info about subscription states and state transitions.

Returns:



114
115
116
# File 'lib/advanced_billing/models/subscription_group_signup_response.rb', line 114

def state
  @state
end

#subscription_idsArray[Integer]

TODO: Write general description for this method

Returns:

  • (Array[Integer])


31
32
33
# File 'lib/advanced_billing/models/subscription_group_signup_response.rb', line 31

def subscription_ids
  @subscription_ids
end

#subscriptionsArray[SubscriptionGroupItem]

The state of a subscription.

  • **Live States**

    * `active` - A normal, active subscription. It is not in a trial and
    

is paid and up to date.

* `assessing` - An internal (transient) state that indicates a

subscription is in the middle of periodic assessment. Do not base any access decisions in your app on this state, as it may not always be exposed.

* `pending` - An internal (transient) state that indicates a

subscription is in the creation process. Do not base any access decisions in your app on this state, as it may not always be exposed.

* `trialing` - A subscription in trialing state has a valid trial

subscription. This type of subscription may transition to active once payment is received when the trial has ended. Otherwise, it may go to a Problem or End of Life state.

* `paused` - An internal state that indicates that your account with

Advanced Billing is in arrears.

  • **Problem States**

    * `past_due` - Indicates that the most recent payment has failed, and
    

payment is past due for this subscription. If you have enabled our automated dunning, this subscription will be in the dunning process (additional status and callbacks from the dunning process will be available in the future). If you are handling dunning and payment updates yourself, you will want to use this state to initiate a payment update from your customers.

* `soft_failure` - Indicates that normal assessment/processing of the

subscription has failed for a reason that cannot be fixed by the Customer. For example, a Soft Fail may result from a timeout at the gateway or incorrect credentials on your part. The subscriptions should be retried automatically. An interface is being built for you to review problems resulting from these events to take manual action when needed.

* `unpaid` - Indicates an unpaid subscription. A subscription is

marked unpaid if the retry period expires and you have configured your [Dunning](maxio.zendesk.com/hc/en-us/articles/24287076583565-Dunni ng-Overview) settings to have a Final Action of ‘mark the subscription unpaid`.

  • **End of Life States**

    * `canceled` - Indicates a canceled subscription. This may happen at
    

your request (via the API or the web interface) or due to the expiration of the [Dunning](maxio.zendesk.com/hc/en-us/articles/24287076583565-Dunni ng-Overview) process without payment. See the [Reactivation](maxio.zendesk.com/hc/en-us/articles/24252109503629- Reactivating-and-Resuming) documentation for info on how to restart a canceled subscription.

While a subscription is canceled, its period will not advance, it will

not accrue any new charges, and Advanced Billing will not attempt to collect the overdue balance.

* `expired` - Indicates a subscription that has expired due to running

its normal life cycle. Some products may be configured to have an expiration period. An expired subscription then is one that stayed active until it fulfilled its full period.

* `failed_to_create` - Indicates that signup has failed. (You may see

this state in a signup_failure webhook.)

* `on_hold` - Indicates that a subscription’s billing has been

temporarily stopped. While it is expected that the subscription will resume and return to active status, this is still treated as an “End of Life” state because the customer is not paying for services during this time.

* `suspended` - Indicates that a prepaid subscription has used up all

their prepayment balance. If a prepayment is applied, it will return to an active state.

* `trial_ended` - A subscription in a trial_ended state is a

subscription that completed a no-obligation trial and did not have a card on file at the expiration of the trial period. See [Product Pricing – No Obligation Trials](maxio.zendesk.com/hc/en-us/articles/24261076617869-Product -Editing) for more details. See [Subscription States](maxio.zendesk.com/hc/en-us/articles/24252119027853-Subscri ption-States) for more info about subscription states and state transitions.

Returns:



264
265
266
# File 'lib/advanced_billing/models/subscription_group_signup_response.rb', line 264

def subscriptions
  @subscriptions
end

#uidString

TODO: Write general description for this method

Returns:

  • (String)


15
16
17
# File 'lib/advanced_billing/models/subscription_group_signup_response.rb', line 15

def uid
  @uid
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
# File 'lib/advanced_billing/models/subscription_group_signup_response.rb', line 340

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  uid = hash.key?('uid') ? hash['uid'] : SKIP
  scheme = hash.key?('scheme') ? hash['scheme'] : SKIP
  customer_id = hash.key?('customer_id') ? hash['customer_id'] : SKIP
  payment_profile_id =
    hash.key?('payment_profile_id') ? hash['payment_profile_id'] : SKIP
  subscription_ids =
    hash.key?('subscription_ids') ? hash['subscription_ids'] : SKIP
  primary_subscription_id =
    hash.key?('primary_subscription_id') ? hash['primary_subscription_id'] : SKIP
  next_assessment_at = if hash.key?('next_assessment_at')
                         (DateTimeHelper.from_rfc3339(hash['next_assessment_at']) if hash['next_assessment_at'])
                       else
                         SKIP
                       end
  state = hash.key?('state') ? hash['state'] : SKIP
  cancel_at_end_of_period =
    hash.key?('cancel_at_end_of_period') ? hash['cancel_at_end_of_period'] : SKIP
  # Parameter is an array, so we need to iterate through it
  subscriptions = nil
  unless hash['subscriptions'].nil?
    subscriptions = []
    hash['subscriptions'].each do |structure|
      subscriptions << (SubscriptionGroupItem.from_hash(structure) if structure)
    end
  end

  subscriptions = SKIP unless hash.key?('subscriptions')
  payment_collection_method =
    hash.key?('payment_collection_method') ? hash['payment_collection_method'] : SKIP

  # Clean out expected properties from Hash.
  additional_properties = hash.reject { |k, _| names.value?(k) }

  # Create object from extracted values.
  SubscriptionGroupSignupResponse.new(uid: uid,
                                      scheme: scheme,
                                      customer_id: customer_id,
                                      payment_profile_id: payment_profile_id,
                                      subscription_ids: subscription_ids,
                                      primary_subscription_id: primary_subscription_id,
                                      next_assessment_at: next_assessment_at,
                                      state: state,
                                      cancel_at_end_of_period: cancel_at_end_of_period,
                                      subscriptions: subscriptions,
                                      payment_collection_method: payment_collection_method,
                                      additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
# File 'lib/advanced_billing/models/subscription_group_signup_response.rb', line 274

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['uid'] = 'uid'
  @_hash['scheme'] = 'scheme'
  @_hash['customer_id'] = 'customer_id'
  @_hash['payment_profile_id'] = 'payment_profile_id'
  @_hash['subscription_ids'] = 'subscription_ids'
  @_hash['primary_subscription_id'] = 'primary_subscription_id'
  @_hash['next_assessment_at'] = 'next_assessment_at'
  @_hash['state'] = 'state'
  @_hash['cancel_at_end_of_period'] = 'cancel_at_end_of_period'
  @_hash['subscriptions'] = 'subscriptions'
  @_hash['payment_collection_method'] = 'payment_collection_method'
  @_hash
end

.nullablesObject

An array for nullable fields



308
309
310
# File 'lib/advanced_billing/models/subscription_group_signup_response.rb', line 308

def self.nullables
  []
end

.optionalsObject

An array for optional fields



291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
# File 'lib/advanced_billing/models/subscription_group_signup_response.rb', line 291

def self.optionals
  %w[
    uid
    scheme
    customer_id
    payment_profile_id
    subscription_ids
    primary_subscription_id
    next_assessment_at
    state
    cancel_at_end_of_period
    subscriptions
    payment_collection_method
  ]
end

Instance Method Details

#to_custom_next_assessment_atObject



392
393
394
# File 'lib/advanced_billing/models/subscription_group_signup_response.rb', line 392

def to_custom_next_assessment_at
  DateTimeHelper.to_rfc3339(next_assessment_at)
end