Class: PaypalServerSdk::PaymentPreferencesOverride

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/paypal_server_sdk/models/payment_preferences_override.rb

Overview

The payment preferences to override at subscription level.

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(auto_bill_outstanding: SKIP, setup_fee: SKIP, setup_fee_failure_action: SKIP, payment_failure_threshold: SKIP) ⇒ PaymentPreferencesOverride

Returns a new instance of PaymentPreferencesOverride.



59
60
61
62
63
64
65
66
67
68
69
# File 'lib/paypal_server_sdk/models/payment_preferences_override.rb', line 59

def initialize(auto_bill_outstanding: SKIP, setup_fee: SKIP,
               setup_fee_failure_action: SKIP,
               payment_failure_threshold: SKIP)
  @auto_bill_outstanding = auto_bill_outstanding unless auto_bill_outstanding == SKIP
  @setup_fee = setup_fee unless setup_fee == SKIP
  @setup_fee_failure_action = setup_fee_failure_action unless setup_fee_failure_action == SKIP
  unless payment_failure_threshold == SKIP
    @payment_failure_threshold =
      payment_failure_threshold
  end
end

Instance Attribute Details

#auto_bill_outstandingTrueClass | FalseClass

Indicates whether to automatically bill the outstanding amount in the next billing cycle.

Returns:

  • (TrueClass | FalseClass)


15
16
17
# File 'lib/paypal_server_sdk/models/payment_preferences_override.rb', line 15

def auto_bill_outstanding
  @auto_bill_outstanding
end

#payment_failure_thresholdInteger

The maximum number of payment failures before a subscription is suspended. For example, if ‘payment_failure_threshold` is `2`, the subscription automatically updates to the `SUSPEND` state if two consecutive payments fail.

Returns:

  • (Integer)


32
33
34
# File 'lib/paypal_server_sdk/models/payment_preferences_override.rb', line 32

def payment_failure_threshold
  @payment_failure_threshold
end

#setup_feeMoney

The currency and amount for a financial transaction, such as a balance or payment due.

Returns:



20
21
22
# File 'lib/paypal_server_sdk/models/payment_preferences_override.rb', line 20

def setup_fee
  @setup_fee
end

#setup_fee_failure_actionSetupFeeFailureAction

The action to take on the subscription if the initial payment for the setup fails.



25
26
27
# File 'lib/paypal_server_sdk/models/payment_preferences_override.rb', line 25

def setup_fee_failure_action
  @setup_fee_failure_action
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/paypal_server_sdk/models/payment_preferences_override.rb', line 72

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  auto_bill_outstanding =
    hash.key?('auto_bill_outstanding') ? hash['auto_bill_outstanding'] : SKIP
  setup_fee = Money.from_hash(hash['setup_fee']) if hash['setup_fee']
  setup_fee_failure_action =
    hash.key?('setup_fee_failure_action') ? hash['setup_fee_failure_action'] : SKIP
  payment_failure_threshold =
    hash.key?('payment_failure_threshold') ? hash['payment_failure_threshold'] : SKIP

  # Create object from extracted values.
  PaymentPreferencesOverride.new(auto_bill_outstanding: auto_bill_outstanding,
                                 setup_fee: setup_fee,
                                 setup_fee_failure_action: setup_fee_failure_action,
                                 payment_failure_threshold: payment_failure_threshold)
end

.namesObject

A mapping from model property names to API property names.



35
36
37
38
39
40
41
42
# File 'lib/paypal_server_sdk/models/payment_preferences_override.rb', line 35

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['auto_bill_outstanding'] = 'auto_bill_outstanding'
  @_hash['setup_fee'] = 'setup_fee'
  @_hash['setup_fee_failure_action'] = 'setup_fee_failure_action'
  @_hash['payment_failure_threshold'] = 'payment_failure_threshold'
  @_hash
end

.nullablesObject

An array for nullable fields



55
56
57
# File 'lib/paypal_server_sdk/models/payment_preferences_override.rb', line 55

def self.nullables
  []
end

.optionalsObject

An array for optional fields



45
46
47
48
49
50
51
52
# File 'lib/paypal_server_sdk/models/payment_preferences_override.rb', line 45

def self.optionals
  %w[
    auto_bill_outstanding
    setup_fee
    setup_fee_failure_action
    payment_failure_threshold
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



100
101
102
103
104
105
# File 'lib/paypal_server_sdk/models/payment_preferences_override.rb', line 100

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} auto_bill_outstanding: #{@auto_bill_outstanding.inspect}, setup_fee:"\
  " #{@setup_fee.inspect}, setup_fee_failure_action: #{@setup_fee_failure_action.inspect},"\
  " payment_failure_threshold: #{@payment_failure_threshold.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



92
93
94
95
96
97
# File 'lib/paypal_server_sdk/models/payment_preferences_override.rb', line 92

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} auto_bill_outstanding: #{@auto_bill_outstanding}, setup_fee: #{@setup_fee},"\
  " setup_fee_failure_action: #{@setup_fee_failure_action}, payment_failure_threshold:"\
  " #{@payment_failure_threshold}>"
end