NAV
cURL PHP Java Perl C#

Login Instructions

General Information

Enterprise link is safe information access to transactions via the XML gateway for integration with ERP, bookkeeping or accounting systems.

To activate the Enterprise Link, select the account in the iRietumu settings and click “Activate”.

Enter a one-time password from the Digipass and click on “Confirm”.

Copy the access identifier to use it in your application as an electronic pass further on (the “ticket” parameter).

Service Invocation

Enquiry Format

Sample code:

curl -d "function=<Function name>&rid=<Rietumu ID>&ticket=<Ticket>&refno=<Reference number>&language=<Language code>" https://<domain>/elink/process.xml -u "<Username>:<Password>"
<?php
/**
 * Process Enterprise Link request
 * 
 * make sure that curl.cainfo in php.ini is targeted to last CA certificates
 * last extracted CA can be downloaded here: http://curl.haxx.se/ca/cacert.pem
 * 
 * @param   {Array}     $arguments      ASSOC array with arguments for request
 * @param   {String}    $username   
 * @param   {String}    $password   
 * @return  {String}                    XML content
 */
function process_enterprise_link( $arguments, $username, $password ) {
    $ch = curl_init();
    curl_setopt_array( $ch, array(
        CURLOPT_POST => 1,
        CURLOPT_HEADER => 0,
        CURLOPT_FRESH_CONNECT => 1,
        CURLOPT_RETURNTRANSFER => 1,
        CURLOPT_FORBID_REUSE => 1,
        CURLOPT_TIMEOUT => 120,
        CURLOPT_URL => "https://<domain>/elink/process.xml",
        CURLOPT_POSTFIELDS => http_build_query($arguments),
        CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
        CURLOPT_USERPWD => $username . ":" . $password
    ) );
    $result = curl_exec( $ch );
    curl_close( $ch ); 
    return $result; 
}
?>
/**
 * Enterprise Link class for Java 7
 * 
 * MAVEN dependencies:
 * org.apache.httpcomponents : httpclient : 4.4
 */
public class EnterpriseLink {

    private static final String ELINK_HOST = "https://<domain>";
    private static final String PROCESS_PATH = "/elink/process.xml";
    private HttpHost host;
    private String username;
    private String password;
    private HttpClient httpClient;
    private HttpClientContext httpClientContext;

    public EnterpriseLink(String username, String password) {
        this.host = HttpHost.create(ELINK_HOST);
        this.username = username;
        this.password = password;
        this.httpClient = HttpClientBuilder.create().build();
        this.httpClientContext = createHttpClientContext();
    }

    private HttpClientContext createHttpClientContext() {
        HttpClientContext httpClientContext = HttpClientContext.create();

        AuthCache authCache = new BasicAuthCache();
        authCache.put(host, new BasicScheme());
        httpClientContext.setAuthCache(authCache);

        CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
        credentialsProvider.setCredentials(new AuthScope(host,
                AuthScope.ANY_REALM, AuthScope.ANY_SCHEME),
                new UsernamePasswordCredentials(username, password));
        httpClientContext.setCredentialsProvider(credentialsProvider);

        return httpClientContext;
    }

    public String process(List<NameValuePair> params) throws ParseException,
            IOException {
        HttpPost httpPost = new HttpPost(PROCESS_PATH);
        httpPost.setEntity(new UrlEncodedFormEntity(params));

        HttpResponse response = httpClient.execute(host, httpPost,
                httpClientContext);

        return EntityUtils.toString(response.getEntity(), Consts.UTF_8);
    }
}
#!/usr/bin/perl

use LWP::UserAgent;
use HTTP::Request::Common;

# Process Enterprise Link request
#
# @param   {Array}     $arguments      array with arguments for request
# @param   {String}    $username   
# @param   {String}    $password   
# @return  {String}                    XML content
sub process_enterprise_link {
    my ( $arguments, $username, $password ) = @_;
    my $ua = LWP::UserAgent->new;
    my $req = POST 'https://<domain>/elink/process.xml', $arguments;
    $req->authorization_basic( $username, $password );
    my $response = $ua->request( $req );
    return $response->content();
}
/**
 * Enterprise Link class for .NET 4.5
 *
 * Required references:
 * System.Net.Http
 */
public class EnterpriseLink
{
    private static readonly String ELINK_URL = "https://<domain>/elink/process.xml";
    private HttpClient client;

    public EnterpriseLink(String username, String password)
    {
        this.client = new HttpClient();
        var authString = Convert.ToBase64String(Encoding.ASCII.GetBytes(username + ":" + password));
        var authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", authString);
        client.DefaultRequestHeaders.Authorization = authorization;
    }

    public async Task<String> Process(Dictionary<string, string> values)
    {
        var response = await client.PostAsync(ELINK_URL, new FormUrlEncodedContent(values));
        var responseString = await response.Content.ReadAsStringAsync();
        return responseString;
    }
}

Address: https:///elink/process.xml
Authorisation: HTTP Basic

Method: Post

Response Format

Response structure:

<response>
    <code>0</code>
    <error/>
    <!-- a set of tags depending on the function -->
</response>

Format: XML

Response Code Description
0 Everything is OK
1 System failure
2 There are no transactions during the provided period in the provided currency
4 Error in parameters
6 Invalid electronic pass (ticket parameter)

Transaction timeout = 2 minutes

Function “List of Transactions”

This function is used to receive all transactions on the account.

Enquiry Parameters

Sample code:

curl -d "function=Transactions&rid=123456&ticket=JGFIGDMG5965SF44557548958345975934&ccy=EUR&dateFrom=2012-01-26&dateTill=2012-02-28&language=RU&trnID=~bb~Y#~bbEUR~12387.76#~cbd~03122012#~ctd~03122012#~fbd~31122000#~hd~05032005#~ls~2513030097#~of~seq_no#~t1~2512150262#~t2~2524554564#~td~01112012#" https://<domain>/elink/process.xml -u "123456:qwerty"
<?php
$response = process_enterprise_link( array(
    "function" => "Transactions",
    "rid" => "123456",
    "ticket" => "JGFIGDMG5965SF44557548958345975934",
    "ccy" => "EUR",
    "dateFrom" => "2012-01-26",
    "dateTill" => "2012-02-28",
    "language" => "RU",
    "trnID" => "~bb~Y#~bbEUR~12387.76#~cbd~03122012#~ctd~03122012#~fbd~31122000#~hd~05032005#~ls~2513030097#~of~seq_no#~t1~2512150262#~t2~2524554564#~td~01112012#"
), "123456", "qwerty" );
?>
EnterpriseLink enterpriseLink = new EnterpriseLink("123456", "qwerty");

List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("function", "Transactions"));
params.add(new BasicNameValuePair("rid", "123456"));
params.add(new BasicNameValuePair("ticket", "JGFIGDMG5965SF44557548958345975934"));
params.add(new BasicNameValuePair("ccy", "EUR"));
params.add(new BasicNameValuePair("dateFrom", "2012-01-26"));
params.add(new BasicNameValuePair("dateTill", "2012-02-28"));
params.add(new BasicNameValuePair("language", "RU"));
params.add(new BasicNameValuePair("trnID", "~bb~Y#~bbEUR~12387.76#~cbd~03122012#~ctd~03122012#~fbd~31122000#~hd~05032005#~ls~2513030097#~of~seq_no#~t1~2512150262#~t2~2524554564#~td~01112012#"));

String result = enterpriseLink.process(params);
$response = process_enterprise_link( [
    function => "Transactions",
    rid => "123456",
    ticket => "JGFIGDMG5965SF44557548958345975934",
    ccy => "EUR",
    dateFrom => "2012-01-26",
    dateTill => "2012-02-28",
    language => "RU",
    trnID => "~bb~Y#~bbEUR~12387.76#~cbd~03122012#~ctd~03122012#~fbd~31122000#~hd~05032005#~ls~2513030097#~of~seq_no#~t1~2512150262#~t2~2524554564#~td~01112012#"
], '123456', 'qwerty' );
var enterpriseLink = new EnterpriseLink("123456", "qwerty");

var result = await enterpriseLink.Process(new Dictionary<string, string>
    {
       { "function", "Transactions" },
       { "rid", "123456" },
       { "ticket", "JGFIGDMG5965SF44557548958345975934" },
       { "ccy", "EUR" },
       { "dateFrom", "2012-01-26" },
       { "dateTill", "2012-02-28" },
       { "language", "RU" },
       { "trnID", "~bb~Y#~bbEUR~12387.76#~cbd~03122012#~ctd~03122012#~fbd~31122000#~hd~05032005#~ls~2513030097#~of~seq_no#~t1~2512150262#~t2~2524554564#~td~01112012#" }
    }
);
Parameter Description
function* Transactions
rid* Rietumu ID
ticket* Electronic pass provided when the account is connected to Enterprise Link Pro service at iRietumu, for example ticket=JGFIGDMG5965SF44557548958345975934
ccy Currency code according to the ISO-4217 standard, for example ccy=EUR
dateFrom* Date of the start of the statement period in ISO yyyy-MM-dd format, for example dateFrom=2012-01-26
dateTill* Date of the end of the statement period in ISO yyyy-MM-dd format, for example dateTill=2012-01-28
language* Language of the statement (notes, etc.), for example language=RU. Possible options: RU, EN, LV
trnID* ID of the transaction the next page starts from (for a page-by-page statement). The parameter is not provided for the first page.

* compulsory parameters

Description of XML Fields

Response Example:

<?xml version="1.0" encoding="UTF-8"?>
<response>
    <code>0</code>
    <error/>
    <transactions>
        <transaction>
            <uniqueID>EQ-28022013-HEAD-@@SC-7</uniqueID>
            <trnID>~bb~Y#~bbEUR~12387.76#~cbd~03122012#~ctd~03122012#~fbd~31122000#~hd~05032005#~ls~2513030097#~of~seq_no#~t1~2512150262#~t2~2524554564#~td~01112012#</trnID>
            <date>2012-11-01</date>
            <refno>AAA2004</refno>
            <docno/>
            <benname/>
            <benacc/>
            <benid/>
            <benbank/>
            <benbankswift/>
            <details/>
            <narrative>Interest repay - fund.</narrative>
            <amount>-9.82</amount>
            <currency>EUR</currency>
            <saldo>12387.76</saldo>
            <trtype>YP</trtype>
            <trntype>EQ_440</trntype>
            <trndesc>Interest repay - fund.</trndesc>
            <tcf>Y</tcf>
        </transaction>
        <transaction>
            <uniqueID>EQ-28022013-HEAD-@@SC-8</uniqueID>
            <trnID>~bb~Y#~bbEUR~12183.39#~cbd~03122012#~ctd~03122012#~fbd~31122000#~hd~05032005#~ls~2513030097#~of~seq_no#~t1~2512436843#~t2~2525131368#~td~12112012#</trnID>
            <date>2012-11-12</date>
            <refno>I5IC11129901953</refno>
            <docno/>
            <benname/>
            <benacc/>
            <benid/>
            <benbank/>
            <benbankswift/>
            <details>6.97 LVL -- 10.00 EUR (0.697500000)</details>
            <narrative>6.97 LVL -- 10.00 EUR (0.697500000)</narrative>
            <amount>10.0</amount>
            <currency>EUR</currency>
            <saldo>12183.39</saldo>
            <trtype>CONV</trtype>
            <trntype>EQ_543</trntype>
            <trndesc>Currency Exchange</trndesc>
            <tcf>Y</tcf>
        </transaction>
        <transaction>
            <uniqueID>EQ-28022013-HEAD-@@SC-9</uniqueID>
            <trnID>~bb~Y#~bbLVL~2638.06#~cbd~03122012#~ctd~03122012#~fbd~31122000#~hd~05032005#~ls~2513030256#~of~seq_no#~t1~2512299603#~t2~2524860183#~td~07112012#</trnID>
            <date>2012-11-07</date>
            <refno>IVIC11079900909</refno>
            <docno>11-1</docno>
            <benname>ben name</benname>
            <benacc>LV70RIKO000000000000</benacc>
            <benid>111111-22222</benid>
            <benbank>AS DNB BANKA</benbank>
            <benbankswift>RIKOLV2X</benbankswift>
            <details>konta papild.</details>
            <narrative>59: /ID/ 111111-22222, ben name, Rez LV, Nr.LV70RIKO000000000000; 57: AS DNB BANKA, RIKOLV2X; 70: konta papild.;</narrative>
            <amount>-100.0</amount>
            <currency>LVL</currency>
            <saldo>2638.06</saldo>
            <trtype>OO</trtype>
            <trntype>EQ_471</trntype>
            <trndesc>External payment</trndesc>
            <tcf>Y</tcf>
        </transaction>
    </transactions>
    <more>false</more>
</response>
XML Field Description
<trnID> Unique identifier of the transaction
<date> Transaction date
<refno> Reference number of the transaction
<docno> Document number set by the client
<benname> Beneficiary name
<benacc> Beneficiary account number
<benid> Beneficiary identifier
<benbank> Beneficiary bank
<benbankswift> SWIFT code of the beneficiary bank
<details> Transaction details
<amount> Transaction amount. Sign “-“ means that it is a debit transaction
<currency> Transaction currency
<saldo> Balance after the transaction
<trtype> Transaction type
<trndesc> Description of the transaction type
<more> Sign of the availability of transactions. The “true” parameter means that not all transactions have been obtained and continuation must be enquired about (with an indication of the identifier of the last obtained transaction <trnID>)

Function “Outgoing Payment Details”

This function is used for receiving information on the specific outgoing transaction.

Enquiry Parameters

Sample code:

curl -d "function=OutgoingPaymentDetails&rid=123456&ticket=JGFIGDMG5965SF44557548958345975934&refno=IVID05249900342&language=RU" https://<domain>/elink/process.xml -u "123456:qwerty"
<?php
$response = process_enterprise_link( array(
    "function" => "OutgoingPaymentDetails",
    "rid" => "123456",
    "ticket" => "JGFIGDMG5965SF44557548958345975934",
    "refno" => "IVID05249900342",
    "language" => "RU"
), "123456", "qwerty" );
?>
EnterpriseLink enterpriseLink = new EnterpriseLink("123456", "qwerty");

List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("function", "OutgoingPaymentDetails"));
params.add(new BasicNameValuePair("rid", "123456"));
params.add(new BasicNameValuePair("ticket", "JGFIGDMG5965SF44557548958345975934"));
params.add(new BasicNameValuePair("refno", "IVID05249900342"));
params.add(new BasicNameValuePair("language", "RU"));

String result = enterpriseLink.process(params);
$response = process_enterprise_link( [
    function => "OutgoingPaymentDetails",
    rid => "123456",
    ticket => "JGFIGDMG5965SF44557548958345975934",
    refno => "IVID05249900342",
    language => "RU"
], '123456', 'qwerty' );
var enterpriseLink = new EnterpriseLink("123456", "qwerty");

var result = await enterpriseLink.Process(new Dictionary<string, string>
    {
       { "function", "OutgoingPaymentDetails" },
       { "rid", "123456" },
       { "ticket", "JGFIGDMG5965SF44557548958345975934" },
       { "refno", "IVID05249900342" },
       { "language", "RU" }
    }
);
Parameter Description
function* OutgoingPaymentDetails
rid* Rietumu ID
ticket* Electronic pass provided during account login for the service at iRietumu, for example ticket=JGFIGDMG5965SF44557548958345975934
refno* Reference number of the transaction
language Language of the statement (notes, etc.), for example language=RU. Possible options: RU, EN, LV

* compulsory parameters

Description of XML Fields

Response Example:

<?xml version="1.0" encoding="UTF-8"?>
<response>
    <code>0</code>
    <error/>
    <details>
        <ref_no>IVID05249900342</ref_no>
        <state_id>2</state_id>
        <doc_number/>
        <reg_date>2013-05-24T00:00:00</reg_date>
        <reg_datetime>2013-05-24T16:04:58</reg_datetime>
        <urgency>Standart</urgency>
        <urgency_code>1</urgency_code>
        <rem_acc>LV10RTMB0000000000000</rem_acc>
        <rem_name>ABC Ltd.</rem_name>
        <rem_addr>RĪGA LATVIA</rem_addr>
        <rem_regno>123456789-0</rem_regno>
        <rem_country>LV</rem_country>
        <rem_res>RES</rem_res>
        <pmnt_amount>1000.0</pmnt_amount>
        <pmnt_ccy>AUD</pmnt_ccy>
        <pmnt_value/>
        <cor_name/>
        <cor_addr/>
        <cor_addr1/>
        <cor_bic/>
        <cor_eltype/>
        <cor_el/>
        <cor_country/>
        <bbank_acc/>
        <bbank_name>UBS AG</bbank_name>
        <bbank_addr>ZURICH</bbank_addr>
        <bbank_addr1>45, BAHNHOFSTRASSE</bbank_addr1>
        <bbank_bic>UBSWCHZH80A</bbank_bic>
        <bbank_country>CH</bbank_country>
        <bbank_eltype/>
        <bbank_el/>
        <ben_name>ABC HOLDINGS LIMITED</ben_name>
        <ben_addr>UNIT 88,19THFLOOR BASE</ben_addr>
        <ben_addr1>200 DEF ROAD,Germany</ben_addr1>
        <ben_acciban>CH5000111235FJ1234567</ben_acciban>
        <ben_country>SZ</ben_country>
        <ben_regno>123</ben_regno>
        <ben_res>NONRES</ben_res>
        <charge_type>BEN</charge_type>
        <pmnt_details>test ALL FIELDS</pmnt_details>
        <add_info>Поле Information to the Bank.</add_info>
        <rietumuid>000000</rietumuid>
        <charge_amnt>0.0</charge_amnt>
        <charge_ccy/>
        <amk_code>213</amk_code>
        <tran_type_desc>Payment to another bank</tran_type_desc>
        <lng>EN</lng>
        <oper_type>Debit</oper_type>
        <state_id_desc>Rejected</state_id_desc>
        <cor_bank_acc/>
        <oper_type_v>D</oper_type_v>
        <pmnt_amount_text>one thousand, 00</pmnt_amount_text>
    </details>
</response>
XML Field Description
<ref_no> Reference number of the transaction
<state_id> Transaction state *
<doc_number> Document number set by the client
<reg_date> Transaction registration date
<reg_datetime> Date and time of the registration
<urgency> Urgency of the transaction **
<urgency_code> Urgency code **
<rem_acc> Account of the sender
<rem_name> Name of the sender
<rem_addr> Address of the sender
<rem_regno> Registration name of the sender
<rem_country> Country of the sender
<rem_res> Whether the sender is a resident of Latvia. Possible options: RES, NONRES
<pmnt_amount> Transaction amount
<pmnt_ccy> Transaction currency
<pmnt_value> Value date
<cor_name> Name of the correspondent bank
<cor_addr> Address of the correspondent bank
<cor_addr1>
<cor_bic> SWIFT of the correspondent bank
<cor_eltype> National code type
<cor_el> National code
<cor_country> Country of the correspondent bank
<bbank_acc> Account of the beneficiary bank
<bbank_name> Name of the beneficiary bank
<bbank_addr> Address of the beneficiary bank
<bbank_addr1>
<bbank_bic> SWIFT of the beneficiary bank
<bbank_country> Country of the beneficiary bank
<bbank_eltype> National code type
<bbank_el> National code
<ben_name> Beneficiary name
<ben_acciban> Beneficiary account in IBAN format
<ben_addr> Address of the beneficiary
<ben_addr1>
<ben_country> Country of the beneficiary
<ben_regno> Registration number of the beneficiary
<ben_res> Whether the beneficiary is a resident of Latvia. Possible options: RES, NONRES
<charge_type> Charge type ***
<pmnt_details> Payment details
<add_info> Additional information
<rietumuid> Rietumu ID
<charge_amnt> Charge amount. The value is not returned.
<charge_ccy> Charge currency. The value is not returned.
<amk_code> AMK code of the transaction. Is used when a resident of Latvia remits more than EUR 5 000 to a non-resident.
<tran_type_desc> Transaction type description
<lng> Language used in the enquiry
<oper_type> Operation type. Possible options (the language depends on ): Debit, Credit
<state_id_desc> Code of the transaction state *
<cor_bank_acc> Account number of the beneficiary bank in the correspondent bank
<oper_type_v> Operation type code. Possible options: D, C
<pmnt_amount_text> Payment amount in words

* - possible options of the transaction state

State Description Code
In the bank 0, 3, 4
For signature 20
Deferred 1
Cancelled 2, 7
Sent 5, 6

** - possible options of urgency

Description of Urgency Code
Standard 1
Express 2
Economy 3

*** - possible options of charge types

Charge Type Description
OUR Paid by the sender
BEN Paid by the beneficiary
SHA Paid separately