Class: PaypalServerSdk::CaptureRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- PaypalServerSdk::CaptureRequest
- Defined in:
- lib/paypal_server_sdk/models/capture_request.rb
Overview
Captures either a portion or the full authorized amount of an authorized payment.
Instance Attribute Summary collapse
-
#amount ⇒ Money
The currency and amount for a financial transaction, such as a balance or payment due.
-
#final_capture ⇒ TrueClass | FalseClass
Indicates whether you can make additional captures against the authorized payment.
-
#invoice_id ⇒ String
The API caller-provided external invoice number for this order.
-
#note_to_payer ⇒ String
An informational note about this settlement.
-
#payment_instruction ⇒ CapturePaymentInstruction
Any additional payment instructions to be consider during payment processing.
-
#soft_descriptor ⇒ String
The payment descriptor on the payer’s account statement.
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(amount: SKIP, invoice_id: SKIP, final_capture: false, payment_instruction: SKIP, note_to_payer: SKIP, soft_descriptor: SKIP) ⇒ CaptureRequest
constructor
A new instance of CaptureRequest.
-
#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(amount: SKIP, invoice_id: SKIP, final_capture: false, payment_instruction: SKIP, note_to_payer: SKIP, soft_descriptor: SKIP) ⇒ CaptureRequest
75 76 77 78 79 80 81 82 83 84 |
# File 'lib/paypal_server_sdk/models/capture_request.rb', line 75 def initialize(amount: SKIP, invoice_id: SKIP, final_capture: false, payment_instruction: SKIP, note_to_payer: SKIP, soft_descriptor: SKIP) @amount = amount unless amount == SKIP @invoice_id = invoice_id unless invoice_id == SKIP @final_capture = final_capture unless final_capture == SKIP @payment_instruction = payment_instruction unless payment_instruction == SKIP @note_to_payer = note_to_payer unless note_to_payer == SKIP @soft_descriptor = soft_descriptor unless soft_descriptor == SKIP end |
Instance Attribute Details
#amount ⇒ Money
The currency and amount for a financial transaction, such as a balance or payment due.
16 17 18 |
# File 'lib/paypal_server_sdk/models/capture_request.rb', line 16 def amount @amount end |
#final_capture ⇒ TrueClass | 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.
29 30 31 |
# File 'lib/paypal_server_sdk/models/capture_request.rb', line 29 def final_capture @final_capture end |
#invoice_id ⇒ String
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.
22 23 24 |
# File 'lib/paypal_server_sdk/models/capture_request.rb', line 22 def invoice_id @invoice_id end |
#note_to_payer ⇒ String
An informational note about this settlement. Appears in both the payer’s transaction history and the emails that the payer receives.
40 41 42 |
# File 'lib/paypal_server_sdk/models/capture_request.rb', line 40 def note_to_payer @note_to_payer end |
#payment_instruction ⇒ CapturePaymentInstruction
Any additional payment instructions to be consider during payment processing. This processing instruction is applicable for Capturing an order or Authorizing an Order.
35 36 37 |
# File 'lib/paypal_server_sdk/models/capture_request.rb', line 35 def payment_instruction @payment_instruction end |
#soft_descriptor ⇒ String
The payment descriptor on the payer’s account statement.
44 45 46 |
# File 'lib/paypal_server_sdk/models/capture_request.rb', line 44 def soft_descriptor @soft_descriptor end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/paypal_server_sdk/models/capture_request.rb', line 87 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. amount = Money.from_hash(hash['amount']) if hash['amount'] invoice_id = hash.key?('invoice_id') ? hash['invoice_id'] : SKIP final_capture = hash['final_capture'] ||= false payment_instruction = CapturePaymentInstruction.from_hash(hash['payment_instruction']) if hash['payment_instruction'] note_to_payer = hash.key?('note_to_payer') ? hash['note_to_payer'] : SKIP soft_descriptor = hash.key?('soft_descriptor') ? hash['soft_descriptor'] : SKIP # Create object from extracted values. CaptureRequest.new(amount: amount, invoice_id: invoice_id, final_capture: final_capture, payment_instruction: payment_instruction, note_to_payer: note_to_payer, soft_descriptor: soft_descriptor) end |
.names ⇒ Object
A mapping from model property names to API property names.
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/paypal_server_sdk/models/capture_request.rb', line 47 def self.names @_hash = {} if @_hash.nil? @_hash['amount'] = 'amount' @_hash['invoice_id'] = 'invoice_id' @_hash['final_capture'] = 'final_capture' @_hash['payment_instruction'] = 'payment_instruction' @_hash['note_to_payer'] = 'note_to_payer' @_hash['soft_descriptor'] = 'soft_descriptor' @_hash end |
.nullables ⇒ Object
An array for nullable fields
71 72 73 |
# File 'lib/paypal_server_sdk/models/capture_request.rb', line 71 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
59 60 61 62 63 64 65 66 67 68 |
# File 'lib/paypal_server_sdk/models/capture_request.rb', line 59 def self.optionals %w[ amount invoice_id final_capture payment_instruction note_to_payer soft_descriptor ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
118 119 120 121 122 123 124 |
# File 'lib/paypal_server_sdk/models/capture_request.rb', line 118 def inspect class_name = self.class.name.split('::').last "<#{class_name} amount: #{@amount.inspect}, invoice_id: #{@invoice_id.inspect},"\ " final_capture: #{@final_capture.inspect}, payment_instruction:"\ " #{@payment_instruction.inspect}, note_to_payer: #{@note_to_payer.inspect},"\ " soft_descriptor: #{@soft_descriptor.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
110 111 112 113 114 115 |
# File 'lib/paypal_server_sdk/models/capture_request.rb', line 110 def to_s class_name = self.class.name.split('::').last "<#{class_name} amount: #{@amount}, invoice_id: #{@invoice_id}, final_capture:"\ " #{@final_capture}, payment_instruction: #{@payment_instruction}, note_to_payer:"\ " #{@note_to_payer}, soft_descriptor: #{@soft_descriptor}>" end |