Class: FdxV660Api::PaymentDetail
- Defined in:
- lib/fdx_v660_api/models/payment_detail.rb
Overview
Detail for split payments
Instance Attribute Summary collapse
-
#check_number ⇒ String
If payment method CHECK, the last four of the check/cheque number, i.e.
-
#direct_deposit ⇒ DirectDeposit2
If payment by DIRECT_DEPOSIT, the details of the deposit account.
-
#method ⇒ PaymentMethod2
Name of the payment method, either CHECK or DIRECT_DEPOSIT (or CASH).
-
#payment ⇒ MonetaryAmount7
Amount of the check/cheque or direct deposit amount.
-
#percent_split ⇒ Float
Percentage split for this check/cheque or direct deposit.
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(method: SKIP, payment: SKIP, percent_split: SKIP, check_number: SKIP, direct_deposit: SKIP, additional_properties: nil) ⇒ PaymentDetail
constructor
A new instance of PaymentDetail.
-
#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(method: SKIP, payment: SKIP, percent_split: SKIP, check_number: SKIP, direct_deposit: SKIP, additional_properties: nil) ⇒ PaymentDetail
Returns a new instance of PaymentDetail.
62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/fdx_v660_api/models/payment_detail.rb', line 62 def initialize(method: SKIP, payment: SKIP, percent_split: SKIP, check_number: SKIP, direct_deposit: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @method = method unless method == SKIP @payment = payment unless payment == SKIP @percent_split = percent_split unless percent_split == SKIP @check_number = check_number unless check_number == SKIP @direct_deposit = direct_deposit unless direct_deposit == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#check_number ⇒ String
If payment method CHECK, the last four of the check/cheque number, i.e. xxxxx-x0000
29 30 31 |
# File 'lib/fdx_v660_api/models/payment_detail.rb', line 29 def check_number @check_number end |
#direct_deposit ⇒ DirectDeposit2
If payment by DIRECT_DEPOSIT, the details of the deposit account
33 34 35 |
# File 'lib/fdx_v660_api/models/payment_detail.rb', line 33 def direct_deposit @direct_deposit end |
#method ⇒ PaymentMethod2
Name of the payment method, either CHECK or DIRECT_DEPOSIT (or CASH). To ensure interoperability CHECK also applies for payment to Canadian chequing accounts
16 17 18 |
# File 'lib/fdx_v660_api/models/payment_detail.rb', line 16 def method @method end |
#payment ⇒ MonetaryAmount7
Amount of the check/cheque or direct deposit amount
20 21 22 |
# File 'lib/fdx_v660_api/models/payment_detail.rb', line 20 def payment @payment end |
#percent_split ⇒ Float
Percentage split for this check/cheque or direct deposit
24 25 26 |
# File 'lib/fdx_v660_api/models/payment_detail.rb', line 24 def percent_split @percent_split end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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/fdx_v660_api/models/payment_detail.rb', line 77 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. method = hash.key?('method') ? hash['method'] : SKIP payment = MonetaryAmount7.from_hash(hash['payment']) if hash['payment'] percent_split = hash.key?('percentSplit') ? hash['percentSplit'] : SKIP check_number = hash.key?('checkNumber') ? hash['checkNumber'] : SKIP direct_deposit = DirectDeposit2.from_hash(hash['directDeposit']) if hash['directDeposit'] # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. PaymentDetail.new(method: method, payment: payment, percent_split: percent_split, check_number: check_number, direct_deposit: direct_deposit, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
36 37 38 39 40 41 42 43 44 |
# File 'lib/fdx_v660_api/models/payment_detail.rb', line 36 def self.names @_hash = {} if @_hash.nil? @_hash['method'] = 'method' @_hash['payment'] = 'payment' @_hash['percent_split'] = 'percentSplit' @_hash['check_number'] = 'checkNumber' @_hash['direct_deposit'] = 'directDeposit' @_hash end |
.nullables ⇒ Object
An array for nullable fields
58 59 60 |
# File 'lib/fdx_v660_api/models/payment_detail.rb', line 58 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
47 48 49 50 51 52 53 54 55 |
# File 'lib/fdx_v660_api/models/payment_detail.rb', line 47 def self.optionals %w[ method payment percent_split check_number direct_deposit ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
112 113 114 115 116 117 |
# File 'lib/fdx_v660_api/models/payment_detail.rb', line 112 def inspect class_name = self.class.name.split('::').last "<#{class_name} method: #{@method.inspect}, payment: #{@payment.inspect}, percent_split:"\ " #{@percent_split.inspect}, check_number: #{@check_number.inspect}, direct_deposit:"\ " #{@direct_deposit.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
104 105 106 107 108 109 |
# File 'lib/fdx_v660_api/models/payment_detail.rb', line 104 def to_s class_name = self.class.name.split('::').last "<#{class_name} method: #{@method}, payment: #{@payment}, percent_split: #{@percent_split},"\ " check_number: #{@check_number}, direct_deposit: #{@direct_deposit}, additional_properties:"\ " #{@additional_properties}>" end |