Class: PaypalServerSdk::PaymentPreferences
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- PaypalServerSdk::PaymentPreferences
- Defined in:
- lib/paypal_server_sdk/models/payment_preferences.rb
Overview
The payment preferences for a subscription.
Instance Attribute Summary collapse
-
#auto_bill_outstanding ⇒ TrueClass | FalseClass
Indicates whether to automatically bill the outstanding amount in the next billing cycle.
-
#payment_failure_threshold ⇒ Integer
The maximum number of payment failures before a subscription is suspended.
-
#setup_fee ⇒ Money
The currency and amount for a financial transaction, such as a balance or payment due.
-
#setup_fee_failure_action ⇒ SetupFeeFailureAction
The action to take on the subscription if the initial payment for the setup fails.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(auto_bill_outstanding: true, setup_fee: SKIP, setup_fee_failure_action: SetupFeeFailureAction::CANCEL, payment_failure_threshold: 0) ⇒ PaymentPreferences
constructor
A new instance of PaymentPreferences.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
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: true, setup_fee: SKIP, setup_fee_failure_action: SetupFeeFailureAction::CANCEL, payment_failure_threshold: 0) ⇒ PaymentPreferences
Returns a new instance of PaymentPreferences.
59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/paypal_server_sdk/models/payment_preferences.rb', line 59 def initialize(auto_bill_outstanding: true, setup_fee: SKIP, setup_fee_failure_action: SetupFeeFailureAction::CANCEL, payment_failure_threshold: 0) @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_outstanding ⇒ TrueClass | FalseClass
Indicates whether to automatically bill the outstanding amount in the next billing cycle.
15 16 17 |
# File 'lib/paypal_server_sdk/models/payment_preferences.rb', line 15 def auto_bill_outstanding @auto_bill_outstanding end |
#payment_failure_threshold ⇒ Integer
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.
32 33 34 |
# File 'lib/paypal_server_sdk/models/payment_preferences.rb', line 32 def payment_failure_threshold @payment_failure_threshold end |
#setup_fee ⇒ Money
The currency and amount for a financial transaction, such as a balance or payment due.
20 21 22 |
# File 'lib/paypal_server_sdk/models/payment_preferences.rb', line 20 def setup_fee @setup_fee end |
#setup_fee_failure_action ⇒ SetupFeeFailureAction
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.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 |
# File 'lib/paypal_server_sdk/models/payment_preferences.rb', line 72 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. auto_bill_outstanding = hash['auto_bill_outstanding'] ||= true setup_fee = Money.from_hash(hash['setup_fee']) if hash['setup_fee'] setup_fee_failure_action = hash['setup_fee_failure_action'] ||= SetupFeeFailureAction::CANCEL payment_failure_threshold = hash['payment_failure_threshold'] ||= 0 # Create object from extracted values. PaymentPreferences.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 |
.names ⇒ Object
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.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 |
.nullables ⇒ Object
An array for nullable fields
55 56 57 |
# File 'lib/paypal_server_sdk/models/payment_preferences.rb', line 55 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
45 46 47 48 49 50 51 52 |
# File 'lib/paypal_server_sdk/models/payment_preferences.rb', line 45 def self.optionals %w[ auto_bill_outstanding setup_fee setup_fee_failure_action payment_failure_threshold ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
98 99 100 101 102 103 |
# File 'lib/paypal_server_sdk/models/payment_preferences.rb', line 98 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_s ⇒ Object
Provides a human-readable string representation of the object.
90 91 92 93 94 95 |
# File 'lib/paypal_server_sdk/models/payment_preferences.rb', line 90 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 |