Class: UnivapayClientSdk::MerchantWebhookSubscriptionConfiguration

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/univapay_client_sdk/models/merchant_webhook_subscription_configuration.rb

Overview

Subscription feature configuration.

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(enabled: SKIP, failed_charges_to_cancel: SKIP, suspend_on_cancel: SKIP, allow_merchant_amount_patch: SKIP, allow_merchant_due_date_patch: SKIP, additional_properties: nil) ⇒ MerchantWebhookSubscriptionConfiguration

Returns a new instance of MerchantWebhookSubscriptionConfiguration.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/univapay_client_sdk/models/merchant_webhook_subscription_configuration.rb', line 66

def initialize(enabled: SKIP, failed_charges_to_cancel: SKIP,
               suspend_on_cancel: SKIP, allow_merchant_amount_patch: SKIP,
               allow_merchant_due_date_patch: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @enabled = enabled unless enabled == SKIP
  @failed_charges_to_cancel = failed_charges_to_cancel unless failed_charges_to_cancel == SKIP
  @suspend_on_cancel = suspend_on_cancel unless suspend_on_cancel == SKIP
  unless allow_merchant_amount_patch == SKIP
    @allow_merchant_amount_patch =
      allow_merchant_amount_patch
  end
  unless allow_merchant_due_date_patch == SKIP
    @allow_merchant_due_date_patch =
      allow_merchant_due_date_patch
  end
  @additional_properties = additional_properties
end

Instance Attribute Details

#allow_merchant_amount_patchTrueClass | FalseClass

Allows merchants to update scheduled subscription amounts.

Returns:

  • (TrueClass | FalseClass)


26
27
28
# File 'lib/univapay_client_sdk/models/merchant_webhook_subscription_configuration.rb', line 26

def allow_merchant_amount_patch
  @allow_merchant_amount_patch
end

#allow_merchant_due_date_patchTrueClass | FalseClass

Allows merchants to update scheduled subscription due dates.

Returns:

  • (TrueClass | FalseClass)


30
31
32
# File 'lib/univapay_client_sdk/models/merchant_webhook_subscription_configuration.rb', line 30

def allow_merchant_due_date_patch
  @allow_merchant_due_date_patch
end

#enabledTrueClass | FalseClass

Enables subscription payments.

Returns:

  • (TrueClass | FalseClass)


14
15
16
# File 'lib/univapay_client_sdk/models/merchant_webhook_subscription_configuration.rb', line 14

def enabled
  @enabled
end

#failed_charges_to_cancelInteger

Number of failed charges allowed before cancellation.

Returns:

  • (Integer)


18
19
20
# File 'lib/univapay_client_sdk/models/merchant_webhook_subscription_configuration.rb', line 18

def failed_charges_to_cancel
  @failed_charges_to_cancel
end

#suspend_on_cancelTrueClass | FalseClass

Suspends the subscription when its latest charge is canceled.

Returns:

  • (TrueClass | FalseClass)


22
23
24
# File 'lib/univapay_client_sdk/models/merchant_webhook_subscription_configuration.rb', line 22

def suspend_on_cancel
  @suspend_on_cancel
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/univapay_client_sdk/models/merchant_webhook_subscription_configuration.rb', line 88

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  enabled = hash.key?('enabled') ? hash['enabled'] : SKIP
  failed_charges_to_cancel =
    hash.key?('failed_charges_to_cancel') ? hash['failed_charges_to_cancel'] : SKIP
  suspend_on_cancel =
    hash.key?('suspend_on_cancel') ? hash['suspend_on_cancel'] : SKIP
  allow_merchant_amount_patch =
    hash.key?('allow_merchant_amount_patch') ? hash['allow_merchant_amount_patch'] : SKIP
  allow_merchant_due_date_patch =
    hash.key?('allow_merchant_due_date_patch') ? hash['allow_merchant_due_date_patch'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  MerchantWebhookSubscriptionConfiguration.new(enabled: enabled,
                                               failed_charges_to_cancel: failed_charges_to_cancel,
                                               suspend_on_cancel: suspend_on_cancel,
                                               allow_merchant_amount_patch: allow_merchant_amount_patch,
                                               allow_merchant_due_date_patch: allow_merchant_due_date_patch,
                                               additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
38
39
40
41
42
# File 'lib/univapay_client_sdk/models/merchant_webhook_subscription_configuration.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['enabled'] = 'enabled'
  @_hash['failed_charges_to_cancel'] = 'failed_charges_to_cancel'
  @_hash['suspend_on_cancel'] = 'suspend_on_cancel'
  @_hash['allow_merchant_amount_patch'] = 'allow_merchant_amount_patch'
  @_hash['allow_merchant_due_date_patch'] =
    'allow_merchant_due_date_patch'
  @_hash
end

.nullablesObject

An array for nullable fields



56
57
58
59
60
61
62
63
64
# File 'lib/univapay_client_sdk/models/merchant_webhook_subscription_configuration.rb', line 56

def self.nullables
  %w[
    enabled
    failed_charges_to_cancel
    suspend_on_cancel
    allow_merchant_amount_patch
    allow_merchant_due_date_patch
  ]
end

.optionalsObject

An array for optional fields



45
46
47
48
49
50
51
52
53
# File 'lib/univapay_client_sdk/models/merchant_webhook_subscription_configuration.rb', line 45

def self.optionals
  %w[
    enabled
    failed_charges_to_cancel
    suspend_on_cancel
    allow_merchant_amount_patch
    allow_merchant_due_date_patch
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



129
130
131
132
133
134
135
136
# File 'lib/univapay_client_sdk/models/merchant_webhook_subscription_configuration.rb', line 129

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} enabled: #{@enabled.inspect}, failed_charges_to_cancel:"\
  " #{@failed_charges_to_cancel.inspect}, suspend_on_cancel: #{@suspend_on_cancel.inspect},"\
  " allow_merchant_amount_patch: #{@allow_merchant_amount_patch.inspect},"\
  " allow_merchant_due_date_patch: #{@allow_merchant_due_date_patch.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



119
120
121
122
123
124
125
126
# File 'lib/univapay_client_sdk/models/merchant_webhook_subscription_configuration.rb', line 119

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} enabled: #{@enabled}, failed_charges_to_cancel:"\
  " #{@failed_charges_to_cancel}, suspend_on_cancel: #{@suspend_on_cancel},"\
  " allow_merchant_amount_patch: #{@allow_merchant_amount_patch},"\
  " allow_merchant_due_date_patch: #{@allow_merchant_due_date_patch}, additional_properties:"\
  " #{@additional_properties}>"
end