Class: PaypalServerSdk::FailedPaymentDetails

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

Overview

The details for the failed payment of the subscription.

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(amount:, time:, reason_code: SKIP, next_payment_retry_time: SKIP) ⇒ FailedPaymentDetails

Returns a new instance of FailedPaymentDetails.



58
59
60
61
62
63
64
# File 'lib/paypal_server_sdk/models/failed_payment_details.rb', line 58

def initialize(amount:, time:, reason_code: SKIP,
               next_payment_retry_time: SKIP)
  @amount = amount
  @time = time
  @reason_code = reason_code unless reason_code == SKIP
  @next_payment_retry_time = next_payment_retry_time unless next_payment_retry_time == SKIP
end

Instance Attribute Details

#amountMoney

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

Returns:



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

def amount
  @amount
end

#next_payment_retry_timeString

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.

Returns:

  • (String)


33
34
35
# File 'lib/paypal_server_sdk/models/failed_payment_details.rb', line 33

def next_payment_retry_time
  @next_payment_retry_time
end

#reason_codeReasonCode

The reason code for the payment failure.

Returns:



26
27
28
# File 'lib/paypal_server_sdk/models/failed_payment_details.rb', line 26

def reason_code
  @reason_code
end

#timeString

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.

Returns:

  • (String)


22
23
24
# File 'lib/paypal_server_sdk/models/failed_payment_details.rb', line 22

def time
  @time
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/paypal_server_sdk/models/failed_payment_details.rb', line 67

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  amount = Money.from_hash(hash['amount']) if hash['amount']
  time = hash.key?('time') ? hash['time'] : nil
  reason_code = hash.key?('reason_code') ? hash['reason_code'] : SKIP
  next_payment_retry_time =
    hash.key?('next_payment_retry_time') ? hash['next_payment_retry_time'] : SKIP

  # Create object from extracted values.

  FailedPaymentDetails.new(amount: amount,
                           time: time,
                           reason_code: reason_code,
                           next_payment_retry_time: next_payment_retry_time)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['amount'] = 'amount'
  @_hash['time'] = 'time'
  @_hash['reason_code'] = 'reason_code'
  @_hash['next_payment_retry_time'] = 'next_payment_retry_time'
  @_hash
end

.nullablesObject

An array for nullable fields



54
55
56
# File 'lib/paypal_server_sdk/models/failed_payment_details.rb', line 54

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    reason_code
    next_payment_retry_time
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} amount: #{@amount.inspect}, time: #{@time.inspect}, reason_code:"\
  " #{@reason_code.inspect}, next_payment_retry_time: #{@next_payment_retry_time.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



85
86
87
88
89
# File 'lib/paypal_server_sdk/models/failed_payment_details.rb', line 85

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} amount: #{@amount}, time: #{@time}, reason_code: #{@reason_code},"\
  " next_payment_retry_time: #{@next_payment_retry_time}>"
end