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

#to_hash, #to_json

Constructor Details

#initialize(create_time: SKIP, update_time: SKIP, id: SKIP, payment_source: SKIP, intent: SKIP, processing_instruction: SKIP, payer: SKIP, purchase_units: SKIP, status: SKIP, links: SKIP) ⇒ OrderAuthorizeResponse

Returns a new instance of OrderAuthorizeResponse.



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/paypal_server_sdk/models/order_authorize_response.rb', line 106

def initialize(create_time: SKIP, update_time: SKIP, id: SKIP,
               payment_source: SKIP, intent: SKIP,
               processing_instruction: 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
  @processing_instruction = processing_instruction unless processing_instruction == 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.<blockquote><strong>Note:</strong> The regular expression provides guidance but does not reject all invalid dates.</blockquote>

Returns:

  • (String)


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

def create_time
  @create_time
end

#idString

The ID of the order.

Returns:

  • (String)


30
31
32
# File 'lib/paypal_server_sdk/models/order_authorize_response.rb', line 30

def id
  @id
end

#intentCheckoutPaymentIntent

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



39
40
41
# File 'lib/paypal_server_sdk/models/order_authorize_response.rb', line 39

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:



67
68
69
# File 'lib/paypal_server_sdk/models/order_authorize_response.rb', line 67

def links
  @links
end

#payerPayer

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

Returns:



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

def payer
  @payer
end

#payment_sourceOrderAuthorizeResponsePaymentSource

The payment source used to fund the payment.



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

def payment_source
  @payment_source
end

#processing_instructionObject

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

Returns:

  • (Object)


44
45
46
# File 'lib/paypal_server_sdk/models/order_authorize_response.rb', line 44

def processing_instruction
  @processing_instruction
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:



56
57
58
# File 'lib/paypal_server_sdk/models/order_authorize_response.rb', line 56

def purchase_units
  @purchase_units
end

#statusOrderStatus

The order status.

Returns:



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

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.<blockquote><strong>Note:</strong> The regular expression provides guidance but does not reject all invalid dates.</blockquote>

Returns:

  • (String)


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

def update_time
  @update_time
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/paypal_server_sdk/models/order_authorize_response.rb', line 123

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
  processing_instruction =
    hash.key?('processing_instruction') ? hash['processing_instruction'] : 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,
                             processing_instruction: processing_instruction,
                             payer: payer,
                             purchase_units: purchase_units,
                             status: status,
                             links: links)
end

.namesObject

A mapping from model property names to API property names.



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

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['processing_instruction'] = 'processing_instruction'
  @_hash['payer'] = 'payer'
  @_hash['purchase_units'] = 'purchase_units'
  @_hash['status'] = 'status'
  @_hash['links'] = 'links'
  @_hash
end

.nullablesObject

An array for nullable fields



102
103
104
# File 'lib/paypal_server_sdk/models/order_authorize_response.rb', line 102

def self.nullables
  []
end

.optionalsObject

An array for optional fields



86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/paypal_server_sdk/models/order_authorize_response.rb', line 86

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