Class: PaypalServerSdk::Order
- Defined in:
- lib/paypal_server_sdk/models/order.rb
Overview
The order details.
Instance Attribute Summary collapse
-
#create_time ⇒ String
The date and time, in [Internet date and time format](tools.ietf.org/html/rfc3339#section-5.6).
-
#id ⇒ String
The ID of the order.
-
#intent ⇒ CheckoutPaymentIntent
The intent to either capture payment immediately or authorize a payment for an order after order creation.
-
#links ⇒ Array[LinkDescription]
An array of request-related HATEOAS links.
-
#payer ⇒ Payer
DEPRECATED.
-
#payment_source ⇒ PaymentSourceResponse
The payment source used to fund the payment.
-
#purchase_units ⇒ Array[PurchaseUnit]
An array of purchase units.
-
#status ⇒ OrderStatus
The order status.
-
#update_time ⇒ String
The date and time, in [Internet date and time format](tools.ietf.org/html/rfc3339#section-5.6).
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(create_time: SKIP, update_time: SKIP, id: SKIP, payment_source: SKIP, intent: SKIP, payer: SKIP, purchase_units: SKIP, status: SKIP, links: SKIP) ⇒ Order
constructor
A new instance of Order.
-
#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(create_time: SKIP, update_time: SKIP, id: SKIP, payment_source: SKIP, intent: SKIP, payer: SKIP, purchase_units: SKIP, status: SKIP, links: SKIP) ⇒ Order
Returns a new instance of Order.
107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/paypal_server_sdk/models/order.rb', line 107 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_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.
17 18 19 |
# File 'lib/paypal_server_sdk/models/order.rb', line 17 def create_time @create_time end |
#id ⇒ String
The ID of the order.
28 29 30 |
# File 'lib/paypal_server_sdk/models/order.rb', line 28 def id @id end |
#intent ⇒ CheckoutPaymentIntent
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.rb', line 37 def intent @intent end |
#links ⇒ Array[LinkDescription]
An array of request-related HATEOAS links. To complete payer approval, use the ‘approve` link to redirect the payer. The API caller has 6 hours (default setting, this which can be changed by your account manager to 24/48/72 hours to accommodate your use case) from the time the order is created, to redirect your payer. Once redirected, the API caller has 6 hours for the payer to approve the order and either authorize or capture the order. If you are not using the PayPal JavaScript SDK to initiate PayPal Checkout (in context) ensure that you include `application_context.return_url` is specified or you will get “We’re sorry, Things don’t appear to be working at the moment” after the payer approves the payment.
70 71 72 |
# File 'lib/paypal_server_sdk/models/order.rb', line 70 def links @links end |
#payer ⇒ Payer
DEPRECATED. The customer is also known as the payer. The Payer object was intended to only be used with the ‘payment_source.paypal` object. In order to make this design more clear, the details in the `payer` object are now available under `payment_source.paypal`. Please use `payment_source.paypal`.
45 46 47 |
# File 'lib/paypal_server_sdk/models/order.rb', line 45 def payer @payer end |
#payment_source ⇒ PaymentSourceResponse
The payment source used to fund the payment.
32 33 34 |
# File 'lib/paypal_server_sdk/models/order.rb', line 32 def payment_source @payment_source end |
#purchase_units ⇒ Array[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.
52 53 54 |
# File 'lib/paypal_server_sdk/models/order.rb', line 52 def purchase_units @purchase_units end |
#status ⇒ OrderStatus
The order status.
56 57 58 |
# File 'lib/paypal_server_sdk/models/order.rb', line 56 def status @status end |
#update_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.
24 25 26 |
# File 'lib/paypal_server_sdk/models/order.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.
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 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/paypal_server_sdk/models/order.rb', line 122 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 = PaymentSourceResponse.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. Order.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 |
.names ⇒ Object
A mapping from model property names to API property names.
73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/paypal_server_sdk/models/order.rb', line 73 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 |
.nullables ⇒ Object
An array for nullable fields
103 104 105 |
# File 'lib/paypal_server_sdk/models/order.rb', line 103 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/paypal_server_sdk/models/order.rb', line 88 def self.optionals %w[ create_time update_time id payment_source intent payer purchase_units status links ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
176 177 178 179 180 181 182 |
# File 'lib/paypal_server_sdk/models/order.rb', line 176 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_s ⇒ Object
Provides a human-readable string representation of the object.
168 169 170 171 172 173 |
# File 'lib/paypal_server_sdk/models/order.rb', line 168 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 |