Module: UU::Fairpay2::FinancialTransaction::BankTransaction

Extended by:
BankTransaction
Included in:
BankTransaction
Defined in:
lib/uu/fairpay2/bank_transaction.rb

Overview

Module Bank Transaction. This service allows managing bank transactions, withdrawals and deposits at Client Account Business Case(CABC).

Constant Summary

PATH =

Service path

'uu/fairpay2/financialtransaction/BankTransaction'

Instance Method Summary (collapse)

Instance Method Details

- (UU::OS::UESURI) create(credit_business_case_uri, bank_transaction = nil)

Creates new Bank Transaction. The command creates a new Bank Transaction on specified Business Case with passed DTO parameters.

Financial transaction types:
bank transaction, deposit, withdrawal. Transaction type is specified by meta_artifact_uri attribute.

Required attributes:

name, meta_artifact_uri, competent_role_uri, location_uri, amount, debit_business_case_uri, currency, credit_account_currency, debit_account_currency, exchange_rate_for_opp_side, amount_for_opp_side

Examples:

# Prepare Client Account Business Case URI, where we want to create Bank Transaction.
credit_business_case_uri = UU::OS::UESURI.new('ues:TERRITORY:CLIENT_ACCOUNT_BUSINESS_CASE');

# Create Bank Transaction
UU::Fairpay2::FinancialTransaction::BankTransaction.create(credit_business_case_uri,
    :name => "NAME OF BANK TRANSACTION",
    :competent_role_uri => "ues:TERRITORY:ROLE",
    :meta_artifact_uri => "ues:TERRITORY:META_ARTIFACT_OF_BANK_TRANSACTION",
    :location_uri => "ues:TERRITORY:FOLDER_OR_ORG_UNIT",
    :amount => "1000",
    :constant_symbol => "111",
    :debit_business_case_uri => "ues:TERRITORY:WITHDRAWAL_CLIENT_ACCOUNT_BUSINESS_CASE",
    :specific_symbol => "222",
    :message_payer => "message",
    :message_recipient => "message",
    :credit_account_number => "12345/123",
    :debit_account_number => "54321/123",
    :currency => "CZK",
    :credit_account_currency => "CZK",
    :debit_account_currency => "CZK",
    :exchange_rate_for_opp_side => "1",
    :amount_for_opp_side => "1000");

# Prepare Client Account Business Case URI, where we want to create Bank Transaction.
# Attribute :credit_account_number must be authorized account.
credit_business_case_uri = UU::OS::UESURI.new('ues:TERRITORY:BUSINESS_CASE_FOR_WITHDRAWALS');
# Create Withdrawal
UU::Fairpay2::FinancialTransaction::BankTransaction.create(credit_business_case_uri,
    :name => "NAME OF WITHDRAWAL",
    :competent_role_uri => "ues:TERRITORY:ROLE",
    :meta_artifact_uri => "ues:TERRITORY:META_ARTIFACT_OF_WITHDRAWAL",
    :location_uri => "ues:TERRITORY:FOLDER_OR_ORG_UNIT",
    :amount => "1000",
    :constant_symbol => "111",
    :debit_business_case_uri => "ues:TERRITORY:DEPOSIT_CLIENT_ACCOUNT_BUSINESS_CASE",
    :specific_symbol => "222",
    :message_payer => "message",
    :message_recipient => "message",
    :credit_account_number => "12345/123",
    :debit_account_number => "54321/123",
    :currency => "CZK",
    :credit_account_currency => "CZK",
    :debit_account_currency => "CZK",
    :exchange_rate_for_opp_side => "1",
    :amount_for_opp_side => "1000");

# Prepare Client Account Business Case URI, where we want to create Bank Transaction.
# Attribute :debit_account_number must be authorized account.
credit_business_case_uri = UU::OS::UESURI.new('ues:TERRITORY:DEPOSIT_CLIENT_ACCOUNT_BUSINESS_CASE');
# Create Deposit
UU::Fairpay2::FinancialTransaction::BankTransaction.create(credit_business_case_uri,
    :name => "NAME OF DEPOSIT",
    :competent_role_uri => "ues:TERRITORY:ROLE",
    :meta_artifact_uri => "ues:TERRITORY:META_ARTIFACT_OF_DEPOSIT",
    :location_uri => "ues:TERRITORY:FOLDER_OR_ORG_UNIT",
    :amount => "1000",
    :constant_symbol => "111",
    :currency => "CZK",
    :debit_business_case_uri => "ues:TERRITORY:BUSINESS_CASE_FOR_DEPOSITS",
    :variable_symbol => "222",
    :specific_symbol => "222",
    :message_payer => "message",
    :message_recipient => "message",
    :credit_account_number => "12345/123",
    :debit_account_number => "54321/123",
    :currency => "CZK",
    :credit_account_currency => "CZK",
    :debit_account_currency => "CZK",
    :exchange_rate_for_opp_side => "1",
    :amount_for_opp_side => "1000");

Parameters:

Options Hash (bank_transaction):

  • :name (String)

    Name of the bank transaction. Cannot be null nor empty string nor longer than 250 characters and can contain only allowed characters.

  • :code (String)

    Code of the bank transaction. The code must be unique in target territory. It cannot be empty string nor longer than 250 characters and can contain only allowed characters.

  • :description (String)

    Description of the Bank Transaction. Must not be empty string, must not contain whitespace characters only and must not be longer than 4000 characters.

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

    URI of the role competent for the Bank Transaction. Required attribute, cannot be null and must be valid UESURI.

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

    URI of the meta artifact. Required attribute, cannot be null and must be valid UESURI.

  • :security_level (String, UU::OS::Artifact::SecurityLevel)

    Security level.

  • :amount (Fixnum)

    Amount of the Bank Transaction. Required attribute, cannot be null or invalid Fixnum.

  • :constant_symbol (String)

    Constant symbol. Must not be empty string, must not contain whitespace characters only and must not be longer than 4000 characters.

  • :currency (String)

    Currency code. Required attribute, cannot be null, empty, whitespace only or longer than 250 characters.

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

    UESURI of the debit business case or Client Account Business Case. Required attribute, cannot be null and must be valid UESURI.

  • :specific_symbol (String)

    Specific symbol. Must not be empty string, must not contain whitespace characters only and must not be longer than 4000 characters.

  • :variable_symbol (String)

    Variable symbol. Must not be empty string, must not contain whitespace characters only and must not be longer than 4000 characters.

  • :message_recipient (String)

    Message for recipient. Must not be empty string, must not contain whitespace characters only and must not be longer than 4000 characters.

  • :message_payer (String)

    Message for payer. Must not be empty string, must not contain whitespace characters only and must not be longer than 4000 characters.

  • :finman_transaction_uri (String)

    UESURI of Finman g03 transaction or uri of financial transaction in uuFinMang05. Attribute is not required. Should be used only in integration FINMAN->FAIRPAY

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

    UESURI of org. unit or folder where we want to create Finman transaction. Required attribute, cannot be null and must be valid UESURI.

  • :credit_account_number (String)

    Credit Client Account Number Must not be empty string, must not contain whitespace characters only and must not be longer than 4000 characters.

  • :debit_account_number (String)

    Debit Client Account Number. Must not be empty string, must not contain whitespace characters only and must not be longer than 4000 characters.

  • :credit_account_uri (String)

    Credit Account Uri. UESURI of the credit account. Must be valid UESURI of account.

  • :debit_account_uri (String)

    Debit Account Uri. UESURI of the debit account. Must be valid UESURI of account.

  • :credit_account_currency (String)

    Credit Account Currency Required attribute, cannot be null, empty, whitespace only or longer than 250 characters.

  • :debit_account_currency (String)

    Debit Account Currency Required attribute, cannot be null, empty, whitespace only or longer than 250 characters.

  • :exchange_rate_for_opp_side (Fixnum)

    Exchange rate for opposite side. Required attribute, cannot be null or invalid Fixnum. Maximum digits before decimal part is 7.

  • :amount_for_opp_side (Fixnum)

    Amount for opposite side Required attribute, cannot be null or invalid Fixnum.

  • :dry_run (TrueClass, FalseClass)

    Specifies whether this is only a test run to verify that the object can be created. The default value is false.

Returns:

  • (UU::OS::UESURI)

    UESURI of the new Bank Transaction. In case of setting dry_run parameter to true, UU::OS::UESURI::NIL_URI is returned instead.



133
134
135
136
137
138
139
140
141
# File 'lib/uu/fairpay2/bank_transaction.rb', line 133

def create(credit_business_case_uri, bank_transaction = nil)
  svc = UU::OS::REST::RemoteClient.new(BankTransaction)
  bank_transaction_create = UU::Fairpay2::FinancialTransaction::BankTransactionCreate.new(bank_transaction).to_json

  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.post('create', credit_business_case_uri, bank_transaction_create)
    return UU::OS::UESURI.new(res)
  end
end

- (Object) get_attributes(bank_transaction_uri)

Obtains Bank Transaction attributes from REST service and returns them

Examples:

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

# Get Financial Transation attributes
UU::Fairpay2::FinancialTransaction::BankTransaction.get_attributes(bank_transaction_uri);

Parameters:

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

    UESURI of the Bank Transaction.



200
201
202
203
204
205
206
# File 'lib/uu/fairpay2/bank_transaction.rb', line 200

def get_attributes(bank_transaction_uri)
  svc = UU::OS::REST::RemoteClient.new(BankTransaction)
  UU::OS::QoS::QoSHandler.auto_retry do
    attrs = svc.get('getAttributes', bank_transaction_uri)
    return UU::Fairpay2::FinancialTransaction::BankTransactionAttributes.new(attrs)
  end
end

- (UU::OS::REST::ResultList<UU::Fairpay2::FinancialTransaction::BankTransactionGetTransactionList, UU::Fairpay2::FinancialTransaction::BankTransactionAttributes>) get_transaction_list(client_business_case_uri, criteria = nil)

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

Examples:

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

# Get transaction list on  specific Client Account Business Case
UU::Fairpay2::FinancialTransaction::BankTransaction.get_transaction_list(client_business_case_uri,
 :query => "creationTime > '2015-01-01' AND metaArtifactUri = 'ues:TERRITORY:META_ARTIFACT_OF_FINANCIAL_TRANSACTION'");

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:



225
226
227
228
229
230
231
232
233
234
235
# File 'lib/uu/fairpay2/bank_transaction.rb', line 225

def get_transaction_list(client_business_case_uri, criteria = nil)
  svc = UU::OS::REST::RemoteClient.new(BankTransaction)
  dto = UU::Fairpay2::FinancialTransaction::BankTransactionGetTransactionList.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', client_business_case_uri)
    return UU::OS::REST::ResultList.new(UU::Fairpay2::FinancialTransaction::BankTransactionGetTransactionList, UU::Fairpay2::FinancialTransaction::BankTransactionAttributes, res)
  end
end

- (UU::OS::UESURI) set_attributes(bank_transaction_uri, bank_transaction = nil)

Set selected attributes to existing Bank Transaction with passed DTO parameters.

Examples:

# Prepare Bank Transaction URI, where we want to modify attributes.
bank_transaction_uri = UU::OS::UESURI.new('ues:TERRITORY:BANK_TRANSACTION');

# Sets Bank Transaction
UU::Fairpay2::FinancialTransaction::BankTransaction.set_attributes(bank_transaction_uri,
    :message_payer => "new message");

Parameters:

Options Hash (bank_transaction):

  • :name (String)

    Name of the bank transaction. Cannot be longer than 250 characters and can contain only allowed characters.

  • :code (String)

    Code of the bank transaction. The code must be unique in target territory. It cannot be empty string nor longer than 250 characters and can contain only allowed characters.

  • :description (String)

    Description of the Bank Transaction. Cannot be longer than 4000 characters.

  • :amount (Fixnum)

    Amount of the Bank Transaction. Cannot be empty, whitespace only or invalid Fixnum.

  • :currency (String)

    Currency code. Cannot be longer than 4000 characters.

  • :constant_symbol (String)

    Constant symbol.Cannot be longer than 4000 characters.

  • :specific_symbol (String)

    Specific symbol. Cannot be longer than 4000 characters.

  • :variable_symbol (String)

    Variable symbol. Cannot be longer than 4000 characters.

  • :message_recipient (String)

    Message for recipient. Cannot be longer than 4000 characters.

  • :message_payer (String)

    Message for payer. Cannot be longer than 4000 characters.

  • :finman_transaction_uri (String)

    UESURI of Finman g03 transaction or uri of financial transaction in uuFinMang05. Attribute is not required. Should be used only in integration FINMAN->FAIRPAY

  • :credit_account_number (String)

    Credit Client Account Number Cannot be longer than 4000 characters.

  • :debit_account_number (String)

    Debit Client Account Number. Cannot be longer than 4000 characters.

  • :credit_account_uri (String)

    Credit Account Uri. UESURI of the credit account. Must be valid UESURI of account.

  • :debit_account_uri (String)

    Debit Account Uri. UESURI of the debit account. Must be valid UESURI of account.

  • :credit_account_currency (String)

    Credit Account Currency Cannot be longer than 250 characters.

  • :debit_account_currency (String)

    Debit Account Currency Cannot be longer than 250 characters.

  • :exchange_rate_for_opp_side (Fixnum)

    Exchange rate for opposite side. Cannot be empty, whitespace only or invalid Fixnum.

  • :amount_for_opp_side (Fixnum)

    Amount for opposite side. Cannot be empty, whitespace only or invalid Fixnum.

Returns:

  • (UU::OS::UESURI)

    UESURI of the modified Bank Transaction



178
179
180
181
182
183
184
185
# File 'lib/uu/fairpay2/bank_transaction.rb', line 178

def set_attributes(bank_transaction_uri, bank_transaction = nil)
  svc = UU::OS::REST::RemoteClient.new(BankTransaction)
  bank_transaction_set = UU::Fairpay2::FinancialTransaction::BankTransactionSetAttributes.new(bank_transaction).to_json
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.post('setAttributes', bank_transaction_uri, bank_transaction_set)
    return UU::OS::UESURI.new(res)
  end
end