Class: PaypalServerSdk::OrderAuthorizeResponse

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

Overview

OrderAuthorizeResponse Model.

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(create_time: SKIP, update_time: SKIP, id: SKIP, payment_source: SKIP, intent: SKIP, payer: SKIP, purchase_units: SKIP, status: SKIP, links: SKIP) ⇒ OrderAuthorizeResponse

Returns a new instance of OrderAuthorizeResponse.



97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/paypal_server_sdk/models/order_authorize_response.rb', line 97

def initialize(create_time: SKIP, update_time: SKIP, id: SKIP,
               payment_source: SKIP, intent: SKIP, payer: SKIP,
               purchase_units: SKIP, status: SKIP, links: SKIP)
  @create_time = create_time unless create_time == SKIP
  @update_time = update_time unless update_time == SKIP
  @id = id unless id == SKIP
  @payment_source = payment_source unless payment_source == SKIP
  @intent = intent unless intent == SKIP
  @payer = payer unless payer == SKIP
  @purchase_units = purchase_units unless purchase_units == SKIP
  @status = status unless status == SKIP
  @links = links unless links == SKIP
end

Instance Attribute Details

#create_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)


17
18
19
# File 'lib/paypal_server_sdk/models/order_authorize_response.rb', line 17

def create_time
  @create_time
end

#idString

The ID of the order.

Returns:

  • (String)


28
29
30
# File 'lib/paypal_server_sdk/models/order_authorize_response.rb', line 28

def id
  @id
end

#intentCheckoutPaymentIntent

The intent to either capture payment immediately or authorize a payment for an order after order creation.



37
38
39
# File 'lib/paypal_server_sdk/models/order_authorize_response.rb', line 37

def intent
  @intent
end

An array of request-related [HATEOAS links](/api/rest/responses/#hateoas-links) that are either relevant to the issue by providing additional information or offering potential resolutions.

Returns:



60
61
62
# File 'lib/paypal_server_sdk/models/order_authorize_response.rb', line 60

def links
  @links
end

#payerPayer

The intent to either capture payment immediately or authorize a payment for an order after order creation.

Returns:



42
43
44
# File 'lib/paypal_server_sdk/models/order_authorize_response.rb', line 42

def payer
  @payer
end

#payment_sourceOrderAuthorizeResponsePaymentSource

The payment source used to fund the payment.



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

def payment_source
  @payment_source
end

#purchase_unitsArray[PurchaseUnit]

An array of purchase units. Each purchase unit establishes a contract between a customer and merchant. Each purchase unit represents either a full or partial order that the customer intends to purchase from the merchant.

Returns:



49
50
51
# File 'lib/paypal_server_sdk/models/order_authorize_response.rb', line 49

def purchase_units
  @purchase_units
end

#statusOrderStatus

The order status.

Returns:



53
54
55
# File 'lib/paypal_server_sdk/models/order_authorize_response.rb', line 53

def status
  @status
end

#update_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)


24
25
26
# File 'lib/paypal_server_sdk/models/order_authorize_response.rb', line 24

def update_time
  @update_time
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/paypal_server_sdk/models/order_authorize_response.rb', line 112

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  create_time = hash.key?('create_time') ? hash['create_time'] : SKIP
  update_time = hash.key?('update_time') ? hash['update_time'] : SKIP
  id = hash.key?('id') ? hash['id'] : SKIP
  payment_source = OrderAuthorizeResponsePaymentSource.from_hash(hash['payment_source']) if
    hash['payment_source']
  intent = hash.key?('intent') ? hash['intent'] : SKIP
  payer = Payer.from_hash(hash['payer']) if hash['payer']
  # Parameter is an array, so we need to iterate through it
  purchase_units = nil
  unless hash['purchase_units'].nil?
    purchase_units = []
    hash['purchase_units'].each do |structure|
      purchase_units << (PurchaseUnit.from_hash(structure) if structure)
    end
  end

  purchase_units = SKIP unless hash.key?('purchase_units')
  status = hash.key?('status') ? hash['status'] : SKIP
  # Parameter is an array, so we need to iterate through it
  links = nil
  unless hash['links'].nil?
    links = []
    hash['links'].each do |structure|
      links << (LinkDescription.from_hash(structure) if structure)
    end
  end

  links = SKIP unless hash.key?('links')

  # Create object from extracted values.
  OrderAuthorizeResponse.new(create_time: create_time,
                             update_time: update_time,
                             id: id,
                             payment_source: payment_source,
                             intent: intent,
                             payer: payer,
                             purchase_units: purchase_units,
                             status: status,
                             links: links)
end

.namesObject

A mapping from model property names to API property names.



63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/paypal_server_sdk/models/order_authorize_response.rb', line 63

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['create_time'] = 'create_time'
  @_hash['update_time'] = 'update_time'
  @_hash['id'] = 'id'
  @_hash['payment_source'] = 'payment_source'
  @_hash['intent'] = 'intent'
  @_hash['payer'] = 'payer'
  @_hash['purchase_units'] = 'purchase_units'
  @_hash['status'] = 'status'
  @_hash['links'] = 'links'
  @_hash
end

.nullablesObject

An array for nullable fields



93
94
95
# File 'lib/paypal_server_sdk/models/order_authorize_response.rb', line 93

def self.nullables
  []
end

.optionalsObject

An array for optional fields



78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/paypal_server_sdk/models/order_authorize_response.rb', line 78

def self.optionals
  %w[
    create_time
    update_time
    id
    payment_source
    intent
    payer
    purchase_units
    status
    links
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



166
167
168
169
170
171
172
# File 'lib/paypal_server_sdk/models/order_authorize_response.rb', line 166

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} create_time: #{@create_time.inspect}, update_time: #{@update_time.inspect},"\
  " id: #{@id.inspect}, payment_source: #{@payment_source.inspect}, intent:"\
  " #{@intent.inspect}, payer: #{@payer.inspect}, purchase_units: #{@purchase_units.inspect},"\
  " status: #{@status.inspect}, links: #{@links.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



158
159
160
161
162
163
# File 'lib/paypal_server_sdk/models/order_authorize_response.rb', line 158

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} create_time: #{@create_time}, update_time: #{@update_time}, id: #{@id},"\
  " payment_source: #{@payment_source}, intent: #{@intent}, payer: #{@payer}, purchase_units:"\
  " #{@purchase_units}, status: #{@status}, links: #{@links}>"
end