Class: PaypalServerSdk::CaptureRequest

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

Overview

CaptureRequest Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(invoice_id: SKIP, note_to_payer: SKIP, amount: SKIP, final_capture: false, payment_instruction: SKIP, soft_descriptor: SKIP) ⇒ CaptureRequest

Returns a new instance of CaptureRequest.



74
75
76
77
78
79
80
81
82
83
# File 'lib/paypal_server_sdk/models/capture_request.rb', line 74

def initialize(invoice_id: SKIP, note_to_payer: SKIP, amount: SKIP,
               final_capture: false, payment_instruction: SKIP,
               soft_descriptor: SKIP)
  @invoice_id = invoice_id unless invoice_id == SKIP
  @note_to_payer = note_to_payer unless note_to_payer == SKIP
  @amount = amount unless amount == SKIP
  @final_capture = final_capture unless final_capture == SKIP
  @payment_instruction = payment_instruction unless payment_instruction == SKIP
  @soft_descriptor = soft_descriptor unless soft_descriptor == SKIP
end

Instance Attribute Details

#amountMoney

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

Returns:



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

def amount
  @amount
end

#final_captureTrueClass | FalseClass

Indicates whether you can make additional captures against the authorized payment. Set to ‘true` if you do not intend to capture additional payments against the authorization. Set to `false` if you intend to capture additional payments against the authorization.

Returns:

  • (TrueClass | FalseClass)


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

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


16
17
18
# File 'lib/paypal_server_sdk/models/capture_request.rb', line 16

def invoice_id
  @invoice_id
end

#note_to_payerString

An informational note about this settlement. Appears in both the payer’s transaction history and the emails that the payer receives.

Returns:

  • (String)


21
22
23
# File 'lib/paypal_server_sdk/models/capture_request.rb', line 21

def note_to_payer
  @note_to_payer
end

#payment_instructionCapturePaymentInstruction

Any additional payment instructions to be consider during payment processing. This processing instruction is applicable for Capturing an order or Authorizing an Order.



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

def payment_instruction
  @payment_instruction
end

#soft_descriptorString

The payment descriptor on the payer’s account statement.

Returns:

  • (String)


43
44
45
# File 'lib/paypal_server_sdk/models/capture_request.rb', line 43

def soft_descriptor
  @soft_descriptor
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/paypal_server_sdk/models/capture_request.rb', line 86

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  invoice_id = hash.key?('invoice_id') ? hash['invoice_id'] : SKIP
  note_to_payer = hash.key?('note_to_payer') ? hash['note_to_payer'] : SKIP
  amount = Money.from_hash(hash['amount']) if hash['amount']
  final_capture = hash['final_capture'] ||= false
  payment_instruction = CapturePaymentInstruction.from_hash(hash['payment_instruction']) if
    hash['payment_instruction']
  soft_descriptor =
    hash.key?('soft_descriptor') ? hash['soft_descriptor'] : SKIP

  # Create object from extracted values.
  CaptureRequest.new(invoice_id: invoice_id,
                     note_to_payer: note_to_payer,
                     amount: amount,
                     final_capture: final_capture,
                     payment_instruction: payment_instruction,
                     soft_descriptor: soft_descriptor)
end

.namesObject

A mapping from model property names to API property names.



46
47
48
49
50
51
52
53
54
55
# File 'lib/paypal_server_sdk/models/capture_request.rb', line 46

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['invoice_id'] = 'invoice_id'
  @_hash['note_to_payer'] = 'note_to_payer'
  @_hash['amount'] = 'amount'
  @_hash['final_capture'] = 'final_capture'
  @_hash['payment_instruction'] = 'payment_instruction'
  @_hash['soft_descriptor'] = 'soft_descriptor'
  @_hash
end

.nullablesObject

An array for nullable fields



70
71
72
# File 'lib/paypal_server_sdk/models/capture_request.rb', line 70

def self.nullables
  []
end

.optionalsObject

An array for optional fields



58
59
60
61
62
63
64
65
66
67
# File 'lib/paypal_server_sdk/models/capture_request.rb', line 58

def self.optionals
  %w[
    invoice_id
    note_to_payer
    amount
    final_capture
    payment_instruction
    soft_descriptor
  ]
end