Class: PaypalServerSdk::SubscriptionBillingInformation
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- PaypalServerSdk::SubscriptionBillingInformation
- Defined in:
- lib/paypal_server_sdk/models/subscription_billing_information.rb
Overview
The billing details for the subscription. If the subscription was or is active, these fields are populated.
Instance Attribute Summary collapse
-
#cycle_executions ⇒ Array[CycleExecution]
The trial and regular billing executions.
-
#failed_payments_count ⇒ Integer
The number of consecutive payment failures.
-
#final_payment_time ⇒ String
The date and time, in [Internet date and time format](tools.ietf.org/html/rfc3339#section-5.6).
-
#last_failed_payment ⇒ FailedPaymentDetails
The details for the failed payment of the subscription.
-
#last_payment ⇒ LastPaymentDetails
The details for the last payment.
-
#next_billing_time ⇒ String
The date and time, in [Internet date and time format](tools.ietf.org/html/rfc3339#section-5.6).
-
#outstanding_balance ⇒ Money
The currency and amount for a financial transaction, such as a balance or payment due.
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(outstanding_balance:, failed_payments_count:, cycle_executions: SKIP, last_payment: SKIP, next_billing_time: SKIP, final_payment_time: SKIP, last_failed_payment: SKIP) ⇒ SubscriptionBillingInformation
constructor
A new instance of SubscriptionBillingInformation.
-
#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(outstanding_balance:, failed_payments_count:, cycle_executions: SKIP, last_payment: SKIP, next_billing_time: SKIP, final_payment_time: SKIP, last_failed_payment: SKIP) ⇒ SubscriptionBillingInformation
Returns a new instance of SubscriptionBillingInformation.
79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/paypal_server_sdk/models/subscription_billing_information.rb', line 79 def initialize(outstanding_balance:, failed_payments_count:, cycle_executions: SKIP, last_payment: SKIP, next_billing_time: SKIP, final_payment_time: SKIP, last_failed_payment: SKIP) @outstanding_balance = outstanding_balance @cycle_executions = cycle_executions unless cycle_executions == SKIP @last_payment = last_payment unless last_payment == SKIP @next_billing_time = next_billing_time unless next_billing_time == SKIP @final_payment_time = final_payment_time unless final_payment_time == SKIP @failed_payments_count = failed_payments_count @last_failed_payment = last_failed_payment unless last_failed_payment == SKIP end |
Instance Attribute Details
#cycle_executions ⇒ Array[CycleExecution]
The trial and regular billing executions.
20 21 22 |
# File 'lib/paypal_server_sdk/models/subscription_billing_information.rb', line 20 def cycle_executions @cycle_executions end |
#failed_payments_count ⇒ Integer
The number of consecutive payment failures. Resets to ‘0` after a successful payment. If this reaches the `payment_failure_threshold` value, the subscription updates to the `SUSPENDED` state.
44 45 46 |
# File 'lib/paypal_server_sdk/models/subscription_billing_information.rb', line 44 def failed_payments_count @failed_payments_count end |
#final_payment_time ⇒ String
The date and time, in [Internet date and time format](tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional. Note: The regular expression provides guidance but does not reject all invalid dates.
38 39 40 |
# File 'lib/paypal_server_sdk/models/subscription_billing_information.rb', line 38 def final_payment_time @final_payment_time end |
#last_failed_payment ⇒ FailedPaymentDetails
The details for the failed payment of the subscription.
48 49 50 |
# File 'lib/paypal_server_sdk/models/subscription_billing_information.rb', line 48 def last_failed_payment @last_failed_payment end |
#last_payment ⇒ LastPaymentDetails
The details for the last payment.
24 25 26 |
# File 'lib/paypal_server_sdk/models/subscription_billing_information.rb', line 24 def last_payment @last_payment end |
#next_billing_time ⇒ String
The date and time, in [Internet date and time format](tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional. Note: The regular expression provides guidance but does not reject all invalid dates.
31 32 33 |
# File 'lib/paypal_server_sdk/models/subscription_billing_information.rb', line 31 def next_billing_time @next_billing_time end |
#outstanding_balance ⇒ Money
The currency and amount for a financial transaction, such as a balance or payment due.
16 17 18 |
# File 'lib/paypal_server_sdk/models/subscription_billing_information.rb', line 16 def outstanding_balance @outstanding_balance end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/paypal_server_sdk/models/subscription_billing_information.rb', line 93 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. outstanding_balance = Money.from_hash(hash['outstanding_balance']) if hash['outstanding_balance'] failed_payments_count = hash.key?('failed_payments_count') ? hash['failed_payments_count'] : nil # Parameter is an array, so we need to iterate through it cycle_executions = nil unless hash['cycle_executions'].nil? cycle_executions = [] hash['cycle_executions'].each do |structure| cycle_executions << (CycleExecution.from_hash(structure) if structure) end end cycle_executions = SKIP unless hash.key?('cycle_executions') last_payment = LastPaymentDetails.from_hash(hash['last_payment']) if hash['last_payment'] next_billing_time = hash.key?('next_billing_time') ? hash['next_billing_time'] : SKIP final_payment_time = hash.key?('final_payment_time') ? hash['final_payment_time'] : SKIP last_failed_payment = FailedPaymentDetails.from_hash(hash['last_failed_payment']) if hash['last_failed_payment'] # Create object from extracted values. SubscriptionBillingInformation.new(outstanding_balance: outstanding_balance, failed_payments_count: failed_payments_count, cycle_executions: cycle_executions, last_payment: last_payment, next_billing_time: next_billing_time, final_payment_time: final_payment_time, last_failed_payment: last_failed_payment) end |
.names ⇒ Object
A mapping from model property names to API property names.
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/paypal_server_sdk/models/subscription_billing_information.rb', line 51 def self.names @_hash = {} if @_hash.nil? @_hash['outstanding_balance'] = 'outstanding_balance' @_hash['cycle_executions'] = 'cycle_executions' @_hash['last_payment'] = 'last_payment' @_hash['next_billing_time'] = 'next_billing_time' @_hash['final_payment_time'] = 'final_payment_time' @_hash['failed_payments_count'] = 'failed_payments_count' @_hash['last_failed_payment'] = 'last_failed_payment' @_hash end |
.nullables ⇒ Object
An array for nullable fields
75 76 77 |
# File 'lib/paypal_server_sdk/models/subscription_billing_information.rb', line 75 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
64 65 66 67 68 69 70 71 72 |
# File 'lib/paypal_server_sdk/models/subscription_billing_information.rb', line 64 def self.optionals %w[ cycle_executions last_payment next_billing_time final_payment_time last_failed_payment ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
139 140 141 142 143 144 145 146 |
# File 'lib/paypal_server_sdk/models/subscription_billing_information.rb', line 139 def inspect class_name = self.class.name.split('::').last "<#{class_name} outstanding_balance: #{@outstanding_balance.inspect}, cycle_executions:"\ " #{@cycle_executions.inspect}, last_payment: #{@last_payment.inspect}, next_billing_time:"\ " #{@next_billing_time.inspect}, final_payment_time: #{@final_payment_time.inspect},"\ " failed_payments_count: #{@failed_payments_count.inspect}, last_failed_payment:"\ " #{@last_failed_payment.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
130 131 132 133 134 135 136 |
# File 'lib/paypal_server_sdk/models/subscription_billing_information.rb', line 130 def to_s class_name = self.class.name.split('::').last "<#{class_name} outstanding_balance: #{@outstanding_balance}, cycle_executions:"\ " #{@cycle_executions}, last_payment: #{@last_payment}, next_billing_time:"\ " #{@next_billing_time}, final_payment_time: #{@final_payment_time}, failed_payments_count:"\ " #{@failed_payments_count}, last_failed_payment: #{@last_failed_payment}>" end |