Class: PaypalServerSdk::OrderRequest
- Defined in:
- lib/paypal_server_sdk/models/order_request.rb
Overview
The order request details.
Instance Attribute Summary collapse
-
#application_context ⇒ OrderApplicationContext
Customizes the payer experience during the approval process for the payment with PayPal.<blockquote><strong>Note:</strong> Partners and Marketplaces might configure
brand_name
andshipping_preference
during partner account setup, which overrides the request values.</blockquote>. -
#intent ⇒ CheckoutPaymentIntent
The intent to either capture payment immediately or authorize a payment for an order after order creation.
-
#payer ⇒ Payer
The intent to either capture payment immediately or authorize a payment for an order after order creation.
-
#payment_source ⇒ PaymentSource
The payment source definition.
-
#purchase_units ⇒ Array[PurchaseUnitRequest]
An array of purchase units.
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(intent:, purchase_units:, payer: SKIP, payment_source: SKIP, application_context: SKIP) ⇒ OrderRequest
constructor
A new instance of OrderRequest.
Methods inherited from BaseModel
Constructor Details
#initialize(intent:, purchase_units:, payer: SKIP, payment_source: SKIP, application_context: SKIP) ⇒ OrderRequest
Returns a new instance of OrderRequest.
65 66 67 68 69 70 71 72 |
# File 'lib/paypal_server_sdk/models/order_request.rb', line 65 def initialize(intent:, purchase_units:, payer: SKIP, payment_source: SKIP, application_context: SKIP) @intent = intent @payer = payer unless payer == SKIP @purchase_units = purchase_units @payment_source = payment_source unless payment_source == SKIP @application_context = application_context unless application_context == SKIP end |
Instance Attribute Details
#application_context ⇒ OrderApplicationContext
Customizes the payer experience during the approval process for the payment with PayPal.<blockquote><strong>Note:</strong> Partners and Marketplaces might configure brand_name
and shipping_preference
during partner account setup, which overrides the request values.</blockquote>
38 39 40 |
# File 'lib/paypal_server_sdk/models/order_request.rb', line 38 def application_context @application_context end |
#intent ⇒ CheckoutPaymentIntent
The intent to either capture payment immediately or authorize a payment for an order after order creation.
15 16 17 |
# File 'lib/paypal_server_sdk/models/order_request.rb', line 15 def intent @intent end |
#payer ⇒ Payer
The intent to either capture payment immediately or authorize a payment for an order after order creation.
20 21 22 |
# File 'lib/paypal_server_sdk/models/order_request.rb', line 20 def payer @payer end |
#payment_source ⇒ PaymentSource
The payment source definition.
30 31 32 |
# File 'lib/paypal_server_sdk/models/order_request.rb', line 30 def payment_source @payment_source end |
#purchase_units ⇒ Array[PurchaseUnitRequest]
An array of purchase units. Each purchase unit establishes a contract between a payer and the payee. Each purchase unit represents either a full or partial order that the payer intends to purchase from the payee.
26 27 28 |
# File 'lib/paypal_server_sdk/models/order_request.rb', line 26 def purchase_units @purchase_units end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/paypal_server_sdk/models/order_request.rb', line 75 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. intent = hash.key?('intent') ? hash['intent'] : nil # 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 << (PurchaseUnitRequest.from_hash(structure) if structure) end end purchase_units = nil unless hash.key?('purchase_units') payer = Payer.from_hash(hash['payer']) if hash['payer'] payment_source = PaymentSource.from_hash(hash['payment_source']) if hash['payment_source'] application_context = OrderApplicationContext.from_hash(hash['application_context']) if hash['application_context'] # Create object from extracted values. OrderRequest.new(intent: intent, purchase_units: purchase_units, payer: payer, payment_source: payment_source, application_context: application_context) end |
.names ⇒ Object
A mapping from model property names to API property names.
41 42 43 44 45 46 47 48 49 |
# File 'lib/paypal_server_sdk/models/order_request.rb', line 41 def self.names @_hash = {} if @_hash.nil? @_hash['intent'] = 'intent' @_hash['payer'] = 'payer' @_hash['purchase_units'] = 'purchase_units' @_hash['payment_source'] = 'payment_source' @_hash['application_context'] = 'application_context' @_hash end |
.nullables ⇒ Object
An array for nullable fields
61 62 63 |
# File 'lib/paypal_server_sdk/models/order_request.rb', line 61 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
52 53 54 55 56 57 58 |
# File 'lib/paypal_server_sdk/models/order_request.rb', line 52 def self.optionals %w[ payer payment_source application_context ] end |