Class: PaypalServerSdk::Refund

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

Overview

The refund information.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(status: SKIP, status_details: SKIP, id: SKIP, amount: SKIP, invoice_id: SKIP, custom_id: SKIP, acquirer_reference_number: SKIP, note_to_payer: SKIP, seller_payable_breakdown: SKIP, payer: SKIP, links: SKIP, create_time: SKIP, update_time: SKIP) ⇒ Refund

Returns a new instance of Refund.



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/paypal_server_sdk/models/refund.rb', line 124

def initialize(status: SKIP, status_details: SKIP, id: SKIP, amount: SKIP,
               invoice_id: SKIP, custom_id: SKIP,
               acquirer_reference_number: SKIP, note_to_payer: SKIP,
               seller_payable_breakdown: SKIP, payer: SKIP, links: SKIP,
               create_time: SKIP, update_time: SKIP)
  @status = status unless status == SKIP
  @status_details = status_details unless status_details == SKIP
  @id = id unless id == SKIP
  @amount = amount unless amount == SKIP
  @invoice_id = invoice_id unless invoice_id == SKIP
  @custom_id = custom_id unless custom_id == SKIP
  unless acquirer_reference_number == SKIP
    @acquirer_reference_number =
      acquirer_reference_number
  end
  @note_to_payer = note_to_payer unless note_to_payer == SKIP
  @seller_payable_breakdown = seller_payable_breakdown unless seller_payable_breakdown == SKIP
  @payer = payer unless payer == SKIP
  @links = links unless links == SKIP
  @create_time = create_time unless create_time == SKIP
  @update_time = update_time unless update_time == SKIP
end

Instance Attribute Details

#acquirer_reference_numberString

Reference ID issued for the card transaction. This ID can be used to track the transaction across processors, card brands and issuing banks.

Returns:

  • (String)


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

def acquirer_reference_number
  @acquirer_reference_number
end

#amountMoney

The currency and amount for a financial transaction, such as a balance or payment due.

Returns:



27
28
29
# File 'lib/paypal_server_sdk/models/refund.rb', line 27

def amount
  @amount
end

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


71
72
73
# File 'lib/paypal_server_sdk/models/refund.rb', line 71

def create_time
  @create_time
end

#custom_idString

The API caller-provided external ID. Used to reconcile API caller-initiated transactions with PayPal transactions. Appears in transaction and settlement reports.

Returns:

  • (String)


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

def custom_id
  @custom_id
end

#idString

The PayPal-generated ID for the refund.

Returns:

  • (String)


22
23
24
# File 'lib/paypal_server_sdk/models/refund.rb', line 22

def id
  @id
end

#invoice_idString

The API caller-provided external invoice number for this order. Appears in both the payer’s transaction history and the emails that the payer receives.

Returns:

  • (String)


33
34
35
# File 'lib/paypal_server_sdk/models/refund.rb', line 33

def invoice_id
  @invoice_id
end

An array of related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links).

Returns:



63
64
65
# File 'lib/paypal_server_sdk/models/refund.rb', line 63

def links
  @links
end

#note_to_payerString

The reason for the refund. Appears in both the payer’s transaction history and the emails that the payer receives.

Returns:

  • (String)


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

def note_to_payer
  @note_to_payer
end

#payerPayeeBase

The details for the merchant who receives the funds and fulfills the order. The merchant is also known as the payee.

Returns:



58
59
60
# File 'lib/paypal_server_sdk/models/refund.rb', line 58

def payer
  @payer
end

#seller_payable_breakdownSellerPayableBreakdown

The breakdown of the refund.



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

def seller_payable_breakdown
  @seller_payable_breakdown
end

#statusRefundStatus

The status of the refund.

Returns:



14
15
16
# File 'lib/paypal_server_sdk/models/refund.rb', line 14

def status
  @status
end

#status_detailsRefundStatusDetails

The details of the refund status.

Returns:



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

def status_details
  @status_details
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)


79
80
81
# File 'lib/paypal_server_sdk/models/refund.rb', line 79

def update_time
  @update_time
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/paypal_server_sdk/models/refund.rb', line 148

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  status = hash.key?('status') ? hash['status'] : SKIP
  status_details = RefundStatusDetails.from_hash(hash['status_details']) if
    hash['status_details']
  id = hash.key?('id') ? hash['id'] : SKIP
  amount = Money.from_hash(hash['amount']) if hash['amount']
  invoice_id = hash.key?('invoice_id') ? hash['invoice_id'] : SKIP
  custom_id = hash.key?('custom_id') ? hash['custom_id'] : SKIP
  acquirer_reference_number =
    hash.key?('acquirer_reference_number') ? hash['acquirer_reference_number'] : SKIP
  note_to_payer = hash.key?('note_to_payer') ? hash['note_to_payer'] : SKIP
  if hash['seller_payable_breakdown']
    seller_payable_breakdown = SellerPayableBreakdown.from_hash(hash['seller_payable_breakdown'])
  end
  payer = PayeeBase.from_hash(hash['payer']) if hash['payer']
  # 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_time = hash.key?('create_time') ? hash['create_time'] : SKIP
  update_time = hash.key?('update_time') ? hash['update_time'] : SKIP

  # Create object from extracted values.
  Refund.new(status: status,
             status_details: status_details,
             id: id,
             amount: amount,
             invoice_id: invoice_id,
             custom_id: custom_id,
             acquirer_reference_number: acquirer_reference_number,
             note_to_payer: note_to_payer,
             seller_payable_breakdown: seller_payable_breakdown,
             payer: payer,
             links: links,
             create_time: create_time,
             update_time: update_time)
end

.namesObject

A mapping from model property names to API property names.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/paypal_server_sdk/models/refund.rb', line 82

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['status'] = 'status'
  @_hash['status_details'] = 'status_details'
  @_hash['id'] = 'id'
  @_hash['amount'] = 'amount'
  @_hash['invoice_id'] = 'invoice_id'
  @_hash['custom_id'] = 'custom_id'
  @_hash['acquirer_reference_number'] = 'acquirer_reference_number'
  @_hash['note_to_payer'] = 'note_to_payer'
  @_hash['seller_payable_breakdown'] = 'seller_payable_breakdown'
  @_hash['payer'] = 'payer'
  @_hash['links'] = 'links'
  @_hash['create_time'] = 'create_time'
  @_hash['update_time'] = 'update_time'
  @_hash
end

.nullablesObject

An array for nullable fields



120
121
122
# File 'lib/paypal_server_sdk/models/refund.rb', line 120

def self.nullables
  []
end

.optionalsObject

An array for optional fields



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/paypal_server_sdk/models/refund.rb', line 101

def self.optionals
  %w[
    status
    status_details
    id
    amount
    invoice_id
    custom_id
    acquirer_reference_number
    note_to_payer
    seller_payable_breakdown
    payer
    links
    create_time
    update_time
  ]
end