Class: PaypalServerSdk::PaymentCollection
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- PaypalServerSdk::PaymentCollection
- Defined in:
- lib/paypal_server_sdk/models/payment_collection.rb
Overview
The collection of payments, or transactions, for a purchase unit in an order. For example, authorized payments, captured payments, and refunds.
Instance Attribute Summary collapse
-
#authorizations ⇒ Array[AuthorizationWithAdditionalData]
An array of authorized payments for a purchase unit.
-
#captures ⇒ Array[Capture]
An array of captured payments for a purchase unit.
-
#refunds ⇒ Array[Refund]
An array of refunds for a purchase unit.
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(authorizations: SKIP, captures: SKIP, refunds: SKIP) ⇒ PaymentCollection
constructor
A new instance of PaymentCollection.
Methods inherited from BaseModel
Constructor Details
#initialize(authorizations: SKIP, captures: SKIP, refunds: SKIP) ⇒ PaymentCollection
Returns a new instance of PaymentCollection.
51 52 53 54 55 |
# File 'lib/paypal_server_sdk/models/payment_collection.rb', line 51 def initialize(authorizations: SKIP, captures: SKIP, refunds: SKIP) @authorizations = unless == SKIP @captures = captures unless captures == SKIP @refunds = refunds unless refunds == SKIP end |
Instance Attribute Details
#authorizations ⇒ Array[AuthorizationWithAdditionalData]
An array of authorized payments for a purchase unit. A purchase unit can have zero or more authorized payments.
16 17 18 |
# File 'lib/paypal_server_sdk/models/payment_collection.rb', line 16 def @authorizations end |
#captures ⇒ Array[Capture]
An array of captured payments for a purchase unit. A purchase unit can have zero or more captured payments.
21 22 23 |
# File 'lib/paypal_server_sdk/models/payment_collection.rb', line 21 def captures @captures end |
#refunds ⇒ Array[Refund]
An array of refunds for a purchase unit. A purchase unit can have zero or more refunds.
26 27 28 |
# File 'lib/paypal_server_sdk/models/payment_collection.rb', line 26 def refunds @refunds end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/paypal_server_sdk/models/payment_collection.rb', line 58 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. # Parameter is an array, so we need to iterate through it = nil unless hash['authorizations'].nil? = [] hash['authorizations'].each do |structure| << (AuthorizationWithAdditionalData.from_hash(structure) if structure) end end = SKIP unless hash.key?('authorizations') # Parameter is an array, so we need to iterate through it captures = nil unless hash['captures'].nil? captures = [] hash['captures'].each do |structure| captures << (Capture.from_hash(structure) if structure) end end captures = SKIP unless hash.key?('captures') # Parameter is an array, so we need to iterate through it refunds = nil unless hash['refunds'].nil? refunds = [] hash['refunds'].each do |structure| refunds << (Refund.from_hash(structure) if structure) end end refunds = SKIP unless hash.key?('refunds') # Create object from extracted values. PaymentCollection.new(authorizations: , captures: captures, refunds: refunds) end |
.names ⇒ Object
A mapping from model property names to API property names.
29 30 31 32 33 34 35 |
# File 'lib/paypal_server_sdk/models/payment_collection.rb', line 29 def self.names @_hash = {} if @_hash.nil? @_hash['authorizations'] = 'authorizations' @_hash['captures'] = 'captures' @_hash['refunds'] = 'refunds' @_hash end |
.nullables ⇒ Object
An array for nullable fields
47 48 49 |
# File 'lib/paypal_server_sdk/models/payment_collection.rb', line 47 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
38 39 40 41 42 43 44 |
# File 'lib/paypal_server_sdk/models/payment_collection.rb', line 38 def self.optionals %w[ authorizations captures refunds ] end |