Class: PaypalServerSdk::SubscriptionTransactionDetails

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

Overview

The transaction details.

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(id:, amount_with_breakdown:, time:, status: SKIP, payer_name: SKIP, payer_email: SKIP) ⇒ SubscriptionTransactionDetails

Returns a new instance of SubscriptionTransactionDetails.



69
70
71
72
73
74
75
76
77
# File 'lib/paypal_server_sdk/models/subscription_transaction_details.rb', line 69

def initialize(id:, amount_with_breakdown:, time:, status: SKIP,
               payer_name: SKIP, payer_email: SKIP)
  @status = status unless status == SKIP
  @id = id
  @amount_with_breakdown = amount_with_breakdown
  @payer_name = payer_name unless payer_name == SKIP
  @payer_email = payer_email unless payer_email == SKIP
  @time = time
end

Instance Attribute Details

#amount_with_breakdownSubscriptionAmountWithBreakdown

The breakdown details for the amount. Includes the gross, tax, fee, and shipping amounts.



23
24
25
# File 'lib/paypal_server_sdk/models/subscription_transaction_details.rb', line 23

def amount_with_breakdown
  @amount_with_breakdown
end

#idString

The PayPal-generated transaction ID.

Returns:

  • (String)


18
19
20
# File 'lib/paypal_server_sdk/models/subscription_transaction_details.rb', line 18

def id
  @id
end

#payer_emailString

The internationalized email address. Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.

Returns:

  • (String)


34
35
36
# File 'lib/paypal_server_sdk/models/subscription_transaction_details.rb', line 34

def payer_email
  @payer_email
end

#payer_nameSubscriptionPayerName

The name of the party.



27
28
29
# File 'lib/paypal_server_sdk/models/subscription_transaction_details.rb', line 27

def payer_name
  @payer_name
end

#statusCaptureStatus

The status of the captured payment.

Returns:



14
15
16
# File 'lib/paypal_server_sdk/models/subscription_transaction_details.rb', line 14

def status
  @status
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)


41
42
43
# File 'lib/paypal_server_sdk/models/subscription_transaction_details.rb', line 41

def time
  @time
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/paypal_server_sdk/models/subscription_transaction_details.rb', line 80

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : nil
  if hash['amount_with_breakdown']
    amount_with_breakdown = SubscriptionAmountWithBreakdown.from_hash(hash['amount_with_breakdown'])
  end
  time = hash.key?('time') ? hash['time'] : nil
  status = hash.key?('status') ? hash['status'] : SKIP
  payer_name = SubscriptionPayerName.from_hash(hash['payer_name']) if hash['payer_name']
  payer_email = hash.key?('payer_email') ? hash['payer_email'] : SKIP

  # Create object from extracted values.
  SubscriptionTransactionDetails.new(id: id,
                                     amount_with_breakdown: amount_with_breakdown,
                                     time: time,
                                     status: status,
                                     payer_name: payer_name,
                                     payer_email: payer_email)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['status'] = 'status'
  @_hash['id'] = 'id'
  @_hash['amount_with_breakdown'] = 'amount_with_breakdown'
  @_hash['payer_name'] = 'payer_name'
  @_hash['payer_email'] = 'payer_email'
  @_hash['time'] = 'time'
  @_hash
end

.nullablesObject

An array for nullable fields



65
66
67
# File 'lib/paypal_server_sdk/models/subscription_transaction_details.rb', line 65

def self.nullables
  []
end

.optionalsObject

An array for optional fields



56
57
58
59
60
61
62
# File 'lib/paypal_server_sdk/models/subscription_transaction_details.rb', line 56

def self.optionals
  %w[
    status
    payer_name
    payer_email
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



111
112
113
114
115
116
# File 'lib/paypal_server_sdk/models/subscription_transaction_details.rb', line 111

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} status: #{@status.inspect}, id: #{@id.inspect}, amount_with_breakdown:"\
  " #{@amount_with_breakdown.inspect}, payer_name: #{@payer_name.inspect}, payer_email:"\
  " #{@payer_email.inspect}, time: #{@time.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



103
104
105
106
107
108
# File 'lib/paypal_server_sdk/models/subscription_transaction_details.rb', line 103

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} status: #{@status}, id: #{@id}, amount_with_breakdown:"\
  " #{@amount_with_breakdown}, payer_name: #{@payer_name}, payer_email: #{@payer_email}, time:"\
  " #{@time}>"
end