Class: FdxV660Api::Remittance2

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

Overview

Remittance details for the transaction

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(payment_id: SKIP, type: SKIP, value_date: SKIP, payment_status: SKIP, exchange_rate: SKIP, source_currency: SKIP, debtor: SKIP, creditor: SKIP, fi_attributes: SKIP, additional_properties: nil) ⇒ Remittance2

Returns a new instance of Remittance2.



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/fdx_v660_api/models/remittance2.rb', line 92

def initialize(payment_id: SKIP, type: SKIP, value_date: SKIP,
               payment_status: SKIP, exchange_rate: SKIP,
               source_currency: SKIP, debtor: SKIP, creditor: SKIP,
               fi_attributes: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @payment_id = payment_id unless payment_id == SKIP
  @type = type unless type == SKIP
  @value_date = value_date unless value_date == SKIP
  @payment_status = payment_status unless payment_status == SKIP
  @exchange_rate = exchange_rate unless exchange_rate == SKIP
  @source_currency = source_currency unless source_currency == SKIP
  @debtor = debtor unless debtor == SKIP
  @creditor = creditor unless creditor == SKIP
  @fi_attributes = fi_attributes unless fi_attributes == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#creditorRemittanceParty1

Identification of the creditor party to the transaction for the funds received, can include accountNumber which is sensitive data and should be encrypted

Returns:



49
50
51
# File 'lib/fdx_v660_api/models/remittance2.rb', line 49

def creditor
  @creditor
end

#debtorRemittanceParty3

Identification of the debtor party to the transaction for the funds source, can include accountNumber which is sensitive data and should be encrypted

Returns:



43
44
45
# File 'lib/fdx_v660_api/models/remittance2.rb', line 43

def debtor
  @debtor
end

#exchange_rateFloat

Exchange rate used to convert the instructed amount, if the source currency is different from the received currency

Returns:

  • (Float)


33
34
35
# File 'lib/fdx_v660_api/models/remittance2.rb', line 33

def exchange_rate
  @exchange_rate
end

#fi_attributesArray[FiAttributeEntity]

Array of additional remittance attributes. This can include SWIFT tags such as '20', '70', '71A', '72' and etc, or similar custom fields from other rails

Returns:



55
56
57
# File 'lib/fdx_v660_api/models/remittance2.rb', line 55

def fi_attributes
  @fi_attributes
end

#payment_idString

An ID for the payment from the external payment rail. For SWIFT wires this will be Unique End-to-End Transaction Reference (UETR)

Returns:

  • (String)


15
16
17
# File 'lib/fdx_v660_api/models/remittance2.rb', line 15

def payment_id
  @payment_id
end

#payment_statusRemittanceStatus2

Status of the transaction from the payment rail, including one of IN_PROGRESS, FAILED, CANCELLED, REJECTED or COMPLETED

Returns:



28
29
30
# File 'lib/fdx_v660_api/models/remittance2.rb', line 28

def payment_status
  @payment_status
end

#source_currencyIso4217CurrencyCode2

The ISO 4217 code of the currency of the source account



37
38
39
# File 'lib/fdx_v660_api/models/remittance2.rb', line 37

def source_currency
  @source_currency
end

#typePaymentNetworkType1

The payment rail of the transaction, such as SWIFT_WIRE

Returns:



19
20
21
# File 'lib/fdx_v660_api/models/remittance2.rb', line 19

def type
  @type
end

#value_dateDate

Date that the payment is executed

Returns:

  • (Date)


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

def value_date
  @value_date
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/fdx_v660_api/models/remittance2.rb', line 112

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  payment_id = hash.key?('paymentId') ? hash['paymentId'] : SKIP
  type = hash.key?('type') ? hash['type'] : SKIP
  value_date = hash.key?('valueDate') ? hash['valueDate'] : SKIP
  payment_status = hash.key?('paymentStatus') ? hash['paymentStatus'] : SKIP
  exchange_rate = hash.key?('exchangeRate') ? hash['exchangeRate'] : SKIP
  source_currency =
    hash.key?('sourceCurrency') ? hash['sourceCurrency'] : SKIP
  debtor = RemittanceParty3.from_hash(hash['debtor']) if hash['debtor']
  creditor = RemittanceParty1.from_hash(hash['creditor']) if hash['creditor']
  # Parameter is an array, so we need to iterate through it
  fi_attributes = nil
  unless hash['fiAttributes'].nil?
    fi_attributes = []
    hash['fiAttributes'].each do |structure|
      fi_attributes << (FiAttributeEntity.from_hash(structure) if structure)
    end
  end

  fi_attributes = SKIP unless hash.key?('fiAttributes')

  # 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.
  Remittance2.new(payment_id: payment_id,
                  type: type,
                  value_date: value_date,
                  payment_status: payment_status,
                  exchange_rate: exchange_rate,
                  source_currency: source_currency,
                  debtor: debtor,
                  creditor: creditor,
                  fi_attributes: fi_attributes,
                  additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/fdx_v660_api/models/remittance2.rb', line 58

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['payment_id'] = 'paymentId'
  @_hash['type'] = 'type'
  @_hash['value_date'] = 'valueDate'
  @_hash['payment_status'] = 'paymentStatus'
  @_hash['exchange_rate'] = 'exchangeRate'
  @_hash['source_currency'] = 'sourceCurrency'
  @_hash['debtor'] = 'debtor'
  @_hash['creditor'] = 'creditor'
  @_hash['fi_attributes'] = 'fiAttributes'
  @_hash
end

.nullablesObject

An array for nullable fields



88
89
90
# File 'lib/fdx_v660_api/models/remittance2.rb', line 88

def self.nullables
  []
end

.optionalsObject

An array for optional fields



73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/fdx_v660_api/models/remittance2.rb', line 73

def self.optionals
  %w[
    payment_id
    type
    value_date
    payment_status
    exchange_rate
    source_currency
    debtor
    creditor
    fi_attributes
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (Remittance2 | Hash)

    value against the validation is performed.



158
159
160
161
162
163
164
# File 'lib/fdx_v660_api/models/remittance2.rb', line 158

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



176
177
178
179
180
181
182
183
# File 'lib/fdx_v660_api/models/remittance2.rb', line 176

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} payment_id: #{@payment_id.inspect}, type: #{@type.inspect}, value_date:"\
  " #{@value_date.inspect}, payment_status: #{@payment_status.inspect}, exchange_rate:"\
  " #{@exchange_rate.inspect}, source_currency: #{@source_currency.inspect}, debtor:"\
  " #{@debtor.inspect}, creditor: #{@creditor.inspect}, fi_attributes:"\
  " #{@fi_attributes.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



167
168
169
170
171
172
173
# File 'lib/fdx_v660_api/models/remittance2.rb', line 167

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} payment_id: #{@payment_id}, type: #{@type}, value_date: #{@value_date},"\
  " payment_status: #{@payment_status}, exchange_rate: #{@exchange_rate}, source_currency:"\
  " #{@source_currency}, debtor: #{@debtor}, creditor: #{@creditor}, fi_attributes:"\
  " #{@fi_attributes}, additional_properties: #{@additional_properties}>"
end