Class: FdxV660Api::PaymentForUpdateEntity

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/fdx_v660_api/models/payment_for_update_entity.rb

Overview

Payment entity used for creation and update of a payment

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(from_account_id:, to_payee_id:, amount:, due_date:, description: SKIP, merchant_account_id: SKIP, additional_properties: nil) ⇒ PaymentForUpdateEntity

Returns a new instance of PaymentForUpdateEntity.



62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/fdx_v660_api/models/payment_for_update_entity.rb', line 62

def initialize(from_account_id:, to_payee_id:, amount:, due_date:,
               description: SKIP, merchant_account_id: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @from_account_id = 
  @to_payee_id = to_payee_id
  @description = description unless description == SKIP
  @amount = amount
  @merchant_account_id =  unless  == SKIP
  @due_date = due_date
  @additional_properties = additional_properties
end

Instance Attribute Details

#amountFloat

Amount for the payment. Must be positive

Returns:

  • (Float)


27
28
29
# File 'lib/fdx_v660_api/models/payment_for_update_entity.rb', line 27

def amount
  @amount
end

#descriptionString

The purpose of the payment as provided by consumer or payment-requesting app

Returns:

  • (String)


23
24
25
# File 'lib/fdx_v660_api/models/payment_for_update_entity.rb', line 23

def description
  @description
end

#due_dateDate

Date that the funds are scheduled to be delivered

Returns:

  • (Date)


35
36
37
# File 'lib/fdx_v660_api/models/payment_for_update_entity.rb', line 35

def due_date
  @due_date
end

#from_account_idString

ID of the account used to source funds for payment

Returns:

  • (String)


14
15
16
# File 'lib/fdx_v660_api/models/payment_for_update_entity.rb', line 14

def 
  @from_account_id
end

#merchant_account_idString

User's account identifier with the merchant

Returns:

  • (String)


31
32
33
# File 'lib/fdx_v660_api/models/payment_for_update_entity.rb', line 31

def 
  @merchant_account_id
end

#to_payee_idString

ID of the payee to receive funds for the payment

Returns:

  • (String)


18
19
20
# File 'lib/fdx_v660_api/models/payment_for_update_entity.rb', line 18

def to_payee_id
  @to_payee_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/fdx_v660_api/models/payment_for_update_entity.rb', line 78

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('fromAccountId') ? hash['fromAccountId'] : nil
  to_payee_id = hash.key?('toPayeeId') ? hash['toPayeeId'] : nil
  amount = hash.key?('amount') ? hash['amount'] : nil
  due_date = hash.key?('dueDate') ? hash['dueDate'] : nil
  description = hash.key?('description') ? hash['description'] : SKIP
   =
    hash.key?('merchantAccountId') ? hash['merchantAccountId'] : SKIP

  # 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.
  PaymentForUpdateEntity.new(from_account_id: ,
                             to_payee_id: to_payee_id,
                             amount: amount,
                             due_date: due_date,
                             description: description,
                             merchant_account_id: ,
                             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



38
39
40
41
42
43
44
45
46
47
# File 'lib/fdx_v660_api/models/payment_for_update_entity.rb', line 38

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['from_account_id'] = 'fromAccountId'
  @_hash['to_payee_id'] = 'toPayeeId'
  @_hash['description'] = 'description'
  @_hash['amount'] = 'amount'
  @_hash['merchant_account_id'] = 'merchantAccountId'
  @_hash['due_date'] = 'dueDate'
  @_hash
end

.nullablesObject

An array for nullable fields



58
59
60
# File 'lib/fdx_v660_api/models/payment_for_update_entity.rb', line 58

def self.nullables
  []
end

.optionalsObject

An array for optional fields



50
51
52
53
54
55
# File 'lib/fdx_v660_api/models/payment_for_update_entity.rb', line 50

def self.optionals
  %w[
    description
    merchant_account_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



117
118
119
120
121
122
123
# File 'lib/fdx_v660_api/models/payment_for_update_entity.rb', line 117

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} from_account_id: #{@from_account_id.inspect}, to_payee_id:"\
  " #{@to_payee_id.inspect}, description: #{@description.inspect}, amount: #{@amount.inspect},"\
  " merchant_account_id: #{@merchant_account_id.inspect}, due_date: #{@due_date.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



108
109
110
111
112
113
114
# File 'lib/fdx_v660_api/models/payment_for_update_entity.rb', line 108

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} from_account_id: #{@from_account_id}, to_payee_id: #{@to_payee_id},"\
  " description: #{@description}, amount: #{@amount}, merchant_account_id:"\
  " #{@merchant_account_id}, due_date: #{@due_date}, additional_properties:"\
  " #{@additional_properties}>"
end