Class: Pago::V2026_04::Models::SubscriptionCancel

Inherits:
Model
  • Object
show all
Defined in:
lib/pago/v2026_04/models.rb,
sig/pago/v2026_04/generated.rbs

Constant Summary collapse

JSON_KEYS =

Returns:

  • (Hash[Symbol, String])
{
  customer_cancellation_reason: "customer_cancellation_reason",
  customer_cancellation_comment: "customer_cancellation_comment",
  cancel_at_period_end: "cancel_at_period_end"
}.freeze
REQUIRED_KEYS =

Returns:

  • (Array[String])
["cancel_at_period_end"].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Model

#==, #[], #field_set?, #hash, #inspect, json_keys, required_json_keys, #to_json, #to_json_hash, wrap_raw

Constructor Details

#initialize(customer_cancellation_reason: ::Pago::UNSET, customer_cancellation_comment: ::Pago::UNSET, cancel_at_period_end:) ⇒ SubscriptionCancel

Returns a new instance of SubscriptionCancel.

Parameters:

  • customer_cancellation_reason: (String, nil) (defaults to: ::Pago::UNSET)
  • customer_cancellation_comment: (String, nil) (defaults to: ::Pago::UNSET)
  • cancel_at_period_end: (Boolean)


39792
39793
39794
39795
39796
39797
39798
39799
39800
39801
# File 'lib/pago/v2026_04/models.rb', line 39792

def initialize(
  customer_cancellation_reason: ::Pago::UNSET,
  customer_cancellation_comment: ::Pago::UNSET,
  cancel_at_period_end:
)
  super()
  assign(:customer_cancellation_reason, customer_cancellation_reason)
  assign(:customer_cancellation_comment, customer_cancellation_comment)
  assign(:cancel_at_period_end, cancel_at_period_end)
end

Instance Attribute Details

#cancel_at_period_endBoolean (readonly)

Cancel an active subscription once the current period ends.

Or uncancel a subscription currently set to be revoked at period end.

Returns:

  • (Boolean)


39790
39791
39792
# File 'lib/pago/v2026_04/models.rb', line 39790

def cancel_at_period_end
  @cancel_at_period_end
end

#customer_cancellation_commentString? (readonly)

Customer feedback and why they decided to cancel.

IMPORTANT: Do not use this to store internal notes! It's intended to be input from the customer and is therefore also available in their Pago purchases library.

Only set this in case your own service is requesting the reason from the customer. Or you copy a message directly from a customer conversation, i.e support.

Returns:

  • (String, nil)


39784
39785
39786
# File 'lib/pago/v2026_04/models.rb', line 39784

def customer_cancellation_comment
  @customer_cancellation_comment
end

#customer_cancellation_reasonString? (readonly)

Customer reason for cancellation.

Helpful to monitor reasons behind churn for future improvements.

Only set this in case your own service is requesting the reason from the customer. Or you know based on direct conversations, i.e support, with the customer.

  • too_expensive: Too expensive for the customer.
  • missing_features: Customer is missing certain features.
  • switched_service: Customer switched to another service.
  • unused: Customer is not using it enough.
  • customer_service: Customer is not satisfied with the customer service.
  • low_quality: Customer is unhappy with the quality.
  • too_complex: Customer considers the service too complicated.
  • other: Other reason(s).

Returns:

  • (String, nil)


39771
39772
39773
# File 'lib/pago/v2026_04/models.rb', line 39771

def customer_cancellation_reason
  @customer_cancellation_reason
end

Class Method Details

.from_json(data) ⇒ SubscriptionCancel?

Parameters:

  • data (Hash, String, nil)

Returns:



39805
39806
39807
39808
39809
39810
39811
39812
39813
39814
39815
39816
39817
39818
# File 'lib/pago/v2026_04/models.rb', line 39805

def self.from_json(data)
  data = ::JSON.parse(data) if data.is_a?(String)
  data = ::Pago::Serde.object(data)
  return nil if data.nil?

  wrap_raw(
    new(
      customer_cancellation_reason: (data.key?("customer_cancellation_reason") ? data["customer_cancellation_reason"] : ::Pago::UNSET),
      customer_cancellation_comment: (data.key?("customer_cancellation_comment") ? data["customer_cancellation_comment"] : ::Pago::UNSET),
      cancel_at_period_end: (data.key?("cancel_at_period_end") ? data["cancel_at_period_end"] : ::Pago::UNSET)
    ),
    data
  )
end