Module: UU::Finman::FinancialTransaction

Extended by:
FinancialTransaction
Included in:
FinancialTransaction
Defined in:
lib/uu/finman/payment.rb,
lib/uu/finman/transfer.rb,
lib/uu/finman/credit_note.rb,
lib/uu/finman/fast_payment.rb,
lib/uu/finman/payment_copy.rb,
lib/uu/finman/expost_payment.rb,
lib/uu/finman/financial_transaction.rb,
lib/uu/finman/financialtransaction/control_side.rb,
lib/uu/finman/financialtransaction/payment_create.rb,
lib/uu/finman/financialtransaction/transfer_create.rb,
lib/uu/finman/financialtransaction/reinvoicing_type.rb,
lib/uu/finman/financialtransaction/credit_note_type.rb,
lib/uu/finman/financialtransaction/credit_note_create.rb,
lib/uu/finman/financialtransaction/payment_attributes.rb,
lib/uu/finman/financialtransaction/transfer_attributes.rb,
lib/uu/finman/financialtransaction/fast_payment_create.rb,
lib/uu/finman/financialtransaction/expost_payment_create.rb,
lib/uu/finman/financialtransaction/credit_note_attributes.rb,
lib/uu/finman/financialtransaction/payment_set_attributes.rb,
lib/uu/finman/financialtransaction/fast_payment_attributes.rb,
lib/uu/finman/financialtransaction/transfer_set_attributes.rb,
lib/uu/finman/financialtransaction/payment_copy_attributes.rb,
lib/uu/finman/financialtransaction/financial_transaction_dto.rb,
lib/uu/finman/financialtransaction/expost_payment_attributes.rb,
lib/uu/finman/financialtransaction/financial_transaction_type.rb,
lib/uu/finman/financialtransaction/credit_note_set_attributes.rb,
lib/uu/finman/financialtransaction/financial_transaction_state.rb,
lib/uu/finman/financialtransaction/payment_copy_set_attributes.rb,
lib/uu/finman/financialtransaction/financial_transaction_class.rb,
lib/uu/finman/financialtransaction/fast_payment_set_attributes.rb,
lib/uu/finman/financialtransaction/expost_payment_set_attributes.rb,
lib/uu/finman/financialtransaction/financial_transaction_set_state.rb,
lib/uu/finman/financialtransaction/financial_transaction_reinvoice.rb,
lib/uu/finman/financialtransaction/financial_transaction_attributes.rb,
lib/uu/finman/financialtransaction/financial_transaction_reinvoice_parameters.rb,
lib/uu/finman/financialtransaction/financial_transaction_get_transaction_list.rb,
lib/uu/finman/financialtransaction/financial_transaction_to_be_paid_attributes.rb,
lib/uu/finman/financialtransaction/financial_transaction_pay_transactions_to_be_paid.rb,
lib/uu/finman/financialtransaction/financial_transaction_check_transactions_to_be_paid.rb,
lib/uu/finman/financialtransaction/financial_transaction_get_transaction_to_be_paid_list.rb

Overview

Module of finman Fast Payment

Defined Under Namespace

Modules: CreditNote, ExpostPayment, FastPayment, Payment, PaymentCopy, Transfer Classes: ControlSide, CreditNoteAttributes, CreditNoteCreate, CreditNoteSetAttributes, CreditNoteType, ExpostPaymentAttributes, ExpostPaymentCreate, ExpostPaymentSetAttributes, FastPaymentAttributes, FastPaymentCreate, FastPaymentSetAttributes, FinancialTransactionAttributes, FinancialTransactionCheckTransactionsToBePaid, FinancialTransactionClass, FinancialTransactionDTO, FinancialTransactionGetTransactionList, FinancialTransactionGetTransactionToBePaidList, FinancialTransactionPayTransactionsToBePaid, FinancialTransactionReinvoice, FinancialTransactionReinvoiceParameters, FinancialTransactionSetState, FinancialTransactionState, FinancialTransactionToBePaidAttributes, FinancialTransactionType, PaymentAttributes, PaymentCopyAttributes, PaymentCopySetAttributes, PaymentCreate, PaymentSetAttributes, ReinvoicingType, TransferAttributes, TransferCreate, TransferSetAttributes

Constant Summary

PATH =

Service path

'uu/finman/financialtransaction/FinancialTransaction'

Instance Method Summary (collapse)

Instance Method Details

- (UU::OS::UESURI) check_transactions_to_be_paid(acc_uri, params)

Processes financial transactions to be paid. Sets the Check activity to requested state with optional annotation. The checking process is asynchronous. It is possible to wait for the end of the process. More information in [UU::OS::Env::Process] and in [UU::OS::REST::Future]. The results file will be stored in attachment. Attachment UESURI will be returned as the process result.

Input file format: CSV with 3 columns: TRANSACTION_URI, STATE, ANNOTATION separated by semicolon. The column TRANSACTION_URI contains UESURIs of all financial transactions to be checked. The column STATE contains requested state of the activity, which can be YES_ACTIVE or NO_ACTIVE (any other value results in error INCORRECT_ACTIVITY_STATE). The column ANNOTATION contains requested annotation. It can be empty, in this case no annotation will be set.

Output file format:CSV file separated by semicolon with header. See UNI-BT:UU.FINMAN/SWA/CMD_API/MODULE_FINTX/ENTITY_FINTX for more details.

Examples:

# Prepare account URI, where we want to get Financial Transaction list.
 = UU::OS::UESURI.new('ues:TERRITORY:ACCOUNT_URI');

# Start the paying
File.open('payments.csv', 'r') do |f|
  # Call the command
  process =  UU::Finman::FinancialTransaction.check_transactions_to_be_paid(, :financial_transactions => f)

  # Initialize the future
  future = UU::OS::REST::Future.new(process)

  # Get the UESURI of the attachment from process result. 
  result = future.get(nil, 60)
end

Parameters:

Returns:

  • (UU::OS::UESURI)

    UESURI of the asynchronous process which can be used to wait for the results file.



220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# File 'lib/uu/finman/financial_transaction.rb', line 220

def check_transactions_to_be_paid(acc_uri, params)
  svc = UU::OS::REST::RemoteClient.new(FinancialTransaction)
  #svc = UU::OS::REST::RemoteClient.new(UU::OS::Sheet)
  dto = UU::Finman::FinancialTransaction::FinancialTransactionCheckTransactionsToBePaid.new(params)
  payload = dto.to_hash
  payload.delete(:financial_transactions)
  tmpfile = Tempfile.new("CheckTransactionsToBePaid")
  tmpfile.binmode
  begin
    if (!dto.financial_transactions.kind_of?(UU::OS::REST::BinaryValue))
      dto.financial_transactions = UU::OS::REST::BinaryValue.new(dto.financial_transactions)
    end
    if (dto.financial_transactions.data.respond_to?(:read))
      if (dto.financial_transactions.data.respond_to?(:path))
        payload[:financialTransactions] = dto.financial_transactions.to_hash(false)
      else
        dto.financial_transactions.data.rewind
        tmpfile.write(dto.financial_transactions.data.read)
        payload[:financialTransactions] = tmpfile
      end
    else
      tmpfile.write(dto.financial_transactions.data)
      payload[:financialTransactions] = tmpfile
    end
    tmpfile.flush
    tmpfile.rewind

    UU::OS::QoS::QoSHandler.auto_retry do
      res = svc.post('checkTransactionsToBePaid', acc_uri, payload)
      return UU::OS::UESURI.new(res)            
    end
  ensure
  tmpfile.close
  tmpfile.unlink
  end

end

- (Object) close(fintr_uri)

Closes the specified financial transaction artifact. The financial transaction artifact cannot be closed when the user executing this command is not cast in Group Role cast in Accounting Authorities.

Examples:

# Close financial transaction with specified URI.
UU::Finman::FinancialTransaction.close('ues:TERRITORY:P1234567890')

Parameters:

  • fintr_uri (String, UU::OS::UESURI)

    UESURI of the financial transaction which is about to be closed.



78
79
80
81
82
83
# File 'lib/uu/finman/financial_transaction.rb', line 78

def close(fintr_uri)
  svc = UU::OS::REST::RemoteClient.new(FinancialTransaction)
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.post('close', fintr_uri)
  end
end

- (Object) delete(fintr_uri)

Deletes the specified financial transaction artifact from the system. The financial transaction artifact cannot be deleted when the user executing this command is not cast in the Service Executives group.

Examples:

# Delete financial transaction with specified URI.
UU::Finman::FinancialTransaction.delete('ues:TERRITORY:P1234567890')

Parameters:

  • fintr_uri (String, UU::OS::UESURI)

    UESURI of the financial transaction which is about to be deleted.



63
64
65
66
67
68
# File 'lib/uu/finman/financial_transaction.rb', line 63

def delete(fintr_uri)
  svc = UU::OS::REST::RemoteClient.new(FinancialTransaction)
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.post('delete', fintr_uri)
  end
end

- (Object) force_update_assignments(fintr_uri)

Forces update of financial transaction assignments on satellite module. Can be executed for any financial transaction, either original or copy. Triggers recomputing of assignments to BC and Date dimensions. Update is done even for closed transactions. Does not propagate to opposite territory for ITA transactions. Main purpose is to recompute assignments of closed transactions to BC dimensions when organizational structure changes (because assignments of closed payments are normally not updated).

Examples:

# Force update of financial transaction assignments with specific URI.
UU::Finman::FinancialTransaction.force_update_assignments('ues:TERRITORY:P1234567890')

Parameters:

  • fintr_uri (String, UU::OS::UESURI)

    UESURI of the financial transaction which should reassigned on SSM.



285
286
287
288
289
290
291
# File 'lib/uu/finman/financial_transaction.rb', line 285

def force_update_assignments(fintr_uri)
  svc = UU::OS::REST::RemoteClient.new(FinancialTransaction)
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.post('forceUpdateAssignments', fintr_uri)
    return UU::OS::UESURI.new(res)    
  end
end

- (Object) force_update_attributes(fintr_uri)

Forces update of financial transaction attributes on satellite module. Can be executed only for original financial transaction. Propagates attributes to PSM and SSM and also to copy if main entity is ITA transaction.

Examples:

# Force update of financial transaction with specific URI.
UU::Finman::FinancialTransaction.force_update_attributes('ues:TERRITORY:P1234567890')

Parameters:

  • fintr_uri (String, UU::OS::UESURI)

    UESURI of the financial transaction which should be updated on SM.



267
268
269
270
271
272
273
# File 'lib/uu/finman/financial_transaction.rb', line 267

def force_update_attributes(fintr_uri)
  svc = UU::OS::REST::RemoteClient.new(FinancialTransaction)
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.post('forceUpdateAttributes', fintr_uri)
    return UU::OS::UESURI.new(res)    
  end
end

- (UU::OS::REST::ResultList<UU::Finman::FinancialTransaction::FinancialTransactionGetTransactionList, UU::Finman::FinancialTransaction::FinancialTransactionAttributes>) get_transaction_list(bc_uri, criteria = nil)

Retrieves a result list of financial transactions for specified business case by UESURI. The resulting attachment list is filtered according to the criteria provided by the criteria attribute.

Allowed values for attribute businessCaseSide in query are CREDIT for filtering by credit business case side and DEBIT for filtering by debit business case side. Use it for filtering transaction only by CREDIT / DEBIT side of Business Case(same as main entity). If parameter not used, returns transaction with CREDIT or DEBIT side.
For allowed values for attribute stateType in query, look at UU::OS::Artifact::ArtifactStateType

Examples:

# Prepare Business Case URI, where we want to get Financial Transaction list.
business_case_uri = UU::OS::UESURI.new('ues:TERRITORY:BUSINESS_CASE');

# Get transaction list on  specific Business Case
UU::Finman::FinancialTransaction.get_transaction_list(business_case_uri,
   :query => "creationTime > '2015-01-01' AND metaArtifactUri = 'ues:TERRITORY:META_ARTIFACT_OF_FINANCIAL_TRANSACTION' AND stateType = ACTIVE");

Parameters:

Options Hash (criteria):

  • :query (String)

    The UES query string. It has to conform the ues query syntax (see documentation for more info). Filtering and order of the result list can be specified there.

Returns:



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/uu/finman/financial_transaction.rb', line 43

def get_transaction_list(bc_uri, criteria = nil)
  svc = UU::OS::REST::RemoteClient.new(FinancialTransaction)
  dto = UU::Finman::FinancialTransaction::FinancialTransactionGetTransactionList.new(criteria)
  svc.add_parameter('pageIndex', dto.page_index)
  svc.add_parameter('pageSize', dto.page_size)
  svc.add_parameter('query', dto.query)
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.get('getTransactionList', bc_uri)
    return UU::OS::REST::ResultList.new(UU::Finman::FinancialTransaction::FinancialTransactionGetTransactionList, UU::Finman::FinancialTransaction::FinancialTransactionAttributes, res)
  end
end

- (UU::OS::REST::ResultList<UU::Finman::FinancialTransaction::FinancialTransactionGetTransactionToBePaidList, UU::Finman::FinancialTransaction::FinancialTransactionToBePaidAttributes>) get_transaction_to_be_paid_list(acc_uri, criteria = nil)

Returns list of Financial Transactions related to the account by debit side that are matching the query criteria, specified by account UESURI and must have Pay Payment acivity. The resulting attachment list is filtered according to the criteria provided by the criteria attribute.

Allowed values for attribute transactionType in query are CASH for show only NONCASH payments, NONCASH for show only NONCASH payments and ALL for both types. If parameter not used, returns transaction with type CASH or NONCASH .

Examples:

# Prepare account URI, where we want to get Financial Transaction list.
 = UU::OS::UESURI.new('ues:TERRITORY:ACCOUNT_URI');

# Get transaction list on specific Account
UU::Finman::FinancialTransaction.get_transaction_to_be_paid_list(,
   :query => "dueDate < '2016-01-01' AND dueDate > '2014-01-01'");

# Get transaction list on specific Account
UU::Finman::FinancialTransaction.get_transaction_to_be_paid_list(,
   :query => "dueDate < '2016-01-01' AND dueDate > '2014-01-01' AND transactionType = 'CASH'");

Parameters:

Options Hash (criteria):

  • :query (String)

    The UES query string. It has to conform the ues query syntax (see documentation for more info). Filtering and order of the result list can be specified there.

Returns:



108
109
110
111
112
113
114
115
116
117
118
# File 'lib/uu/finman/financial_transaction.rb', line 108

def get_transaction_to_be_paid_list(acc_uri, criteria = nil)
  svc = UU::OS::REST::RemoteClient.new(FinancialTransaction)
  dto = UU::Finman::FinancialTransaction::FinancialTransactionGetTransactionToBePaidList.new(criteria)
  svc.add_parameter('pageIndex', dto.page_index)
  svc.add_parameter('pageSize', dto.page_size)
  svc.add_parameter('query', dto.query)
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.get('getTransactionToBePaidList', acc_uri)
    return UU::OS::REST::ResultList.new(UU::Finman::FinancialTransaction::FinancialTransactionGetTransactionToBePaidList, UU::Finman::FinancialTransaction::FinancialTransactionToBePaidAttributes, res)
  end
end

- (UU::OS::UESURI) pay_transactions_to_be_paid(acc_uri, params)

Processes financial transactions to be paid. Sets the Pay activity to final state and sets the financial transaction to Money On The Way State. The paying process is asynchronous. It is possible to wait for the end of the process. More information in [UU::OS::Env::Process] and in [UU::OS::REST::Future]. The results file will be stored in attachment. Attachment UESURI will be returned as the process result.

Input file format: CSV with one column and no header. The column contains UESURIs of all financial transactions to be paid.

Output file format:CSV file separated by semicolon with header. See UNI-BT:UU.FINMAN/SWA/CMD_API/MODULE_FINTX/ENTITY_FINTX for more details.

Examples:

# Prepare account URI, where we want to get Financial Transaction list.
 = UU::OS::UESURI.new('ues:TERRITORY:ACCOUNT_URI');

# Start the paying
File.open('payments.csv', 'r') do |f|
  # Call the command
  process =  UU::Finman::FinancialTransaction.pay_transactions_to_be_paid(, :financial_transactions => f)

  # Initialize the future
  future = UU::OS::REST::Future.new(process)

  # Get the UESURI of the attachment from process result. 
  result = future.get(nil, 60)
end

Parameters:

Returns:

  • (UU::OS::UESURI)

    UESURI of the asynchronous process which can be used to wait for the results file.



149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/uu/finman/financial_transaction.rb', line 149

def pay_transactions_to_be_paid(acc_uri, params)
  svc = UU::OS::REST::RemoteClient.new(FinancialTransaction)
  #svc = UU::OS::REST::RemoteClient.new(UU::OS::Sheet)
  dto = UU::Finman::FinancialTransaction::FinancialTransactionPayTransactionsToBePaid.new(params)
  payload = dto.to_hash
  payload.delete(:financial_transactions)
  tmpfile = Tempfile.new("PayTransactionsToBePaid")
  tmpfile.binmode
  begin
    if (!dto.financial_transactions.kind_of?(UU::OS::REST::BinaryValue))
      dto.financial_transactions = UU::OS::REST::BinaryValue.new(dto.financial_transactions)
    end
    if (dto.financial_transactions.data.respond_to?(:read))
      if (dto.financial_transactions.data.respond_to?(:path))
        payload[:financialTransactions] = dto.financial_transactions.to_hash(false)
      else
        dto.financial_transactions.data.rewind
        tmpfile.write(dto.financial_transactions.data.read)
        payload[:financialTransactions] = tmpfile
      end
    else
      tmpfile.write(dto.financial_transactions.data)
      payload[:financialTransactions] = tmpfile
    end
    tmpfile.flush
    tmpfile.rewind

    UU::OS::QoS::QoSHandler.auto_retry do
      res = svc.post('payTransactionsToBePaid', acc_uri, payload)
      return UU::OS::UESURI.new(res)            
    end
  ensure
  tmpfile.close
  tmpfile.unlink
  end

end

- (Object) reinvoice(fintr_uri, financialTransactionReinvoiceParameters)

Reinvoice financial transaction.

Examples:

result = UU::Finman::FinancialTransaction.reinvoice('ues:UNI-BT:P1368519936123',
                                                    :reinvoicing_type => 'INCOMES_INCOMES',
                                                    :reinvoice_to_category => 'ues:UNI-BT:APPS.UU.FINMAN/CONFIGURATION:UU.FINMAN/C02',
                                                    :amount_with_vat => 100.0,
                                                    :vat_date => ::Time.local(2019, 5, 3),
                                                    :pay_date => '2019-05-03')
puts "\nResult:\n#{result}"

Parameters:

  • fintr_uri (String, UU::OS::UESURI)

    UESURI of the financial transaction to be reinvoiced.

  • financialTransactionReinvoiceParameters (String, FinancialTransactionReinvoiceParameters)

    Parameters of the reinvoicing.



324
325
326
327
328
329
330
331
332
# File 'lib/uu/finman/financial_transaction.rb', line 324

def reinvoice(fintr_uri, financialTransactionReinvoiceParameters)
  svc = UU::OS::REST::RemoteClient.new(FinancialTransaction)
  transaction = UU::Finman::FinancialTransaction::FinancialTransactionReinvoiceParameters.new(financialTransactionReinvoiceParameters).to_json
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.post('reinvoice', fintr_uri, transaction)
    pars = UU::Finman::FinancialTransaction::FinancialTransactionReinvoice.new(res)
    return res
  end
end

- (Object) set_state(fintr_uri, financialTransactionSetState)

Advance the specified financial transaction to a specific state The financial transaction state cannot be set when the user executing this command is not cast in the Authorised Executives group.

Examples:

# Set advanced state of financial transaction with specified URI.
UU::Finman::FinancialTransaction.setState('ues:TERRITORY:P1234567890',
     :financial_transaction_state => "INVOICE_RECEIVED");

Parameters:

  • fintr_uri (String, UU::OS::UESURI)

    UESURI of the financial transaction which want to advanced to the state

  • financialTransactionSetState (String, financialTransactionSetState)

    of the financial transaction state which want to be advanced



303
304
305
306
307
308
309
# File 'lib/uu/finman/financial_transaction.rb', line 303

def set_state(fintr_uri, financialTransactionSetState)
  svc = UU::OS::REST::RemoteClient.new(FinancialTransaction)
  transaction = UU::Finman::FinancialTransaction::FinancialTransactionSetState.new(financialTransactionSetState).to_json
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.post('setState', fintr_uri, transaction)
  end
end