Skip to content

Commit 34bf93a

Browse files
committed
wip: new schema version
1 parent dda58c1 commit 34bf93a

7 files changed

Lines changed: 113 additions & 33 deletions

File tree

API_Bankovnictvi.pdf

4.33 KB
Binary file not shown.

src/main/java/cz/geek/fio/FioClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
*/
2929
public class FioClient {
3030

31-
private static final String ROOT = "/ib_api/rest/";
31+
private static final String ROOT = "/v1/rest/";
3232
private static final String STATEMENT_BY_ID = ROOT + "by-id/{token}/{year}/{id}/transactions.{format}";
3333
private static final String STATEMENT_PERIODS = ROOT + "periods/{token}/{start}/{end}/transactions.{format}";
3434
private static final String STATEMENT_LAST = ROOT + "last/{token}/transactions.{format}";
@@ -56,7 +56,7 @@ public FioClient(final String token) {
5656
* @param settings HTTP settings
5757
*/
5858
public FioClient(@NonNull FioClientSettings settings) {
59-
this("https", "www.fio.cz", null, settings);
59+
this("https", "fioapi.fio.cz", null, settings);
6060
}
6161

6262
FioClient(final String protocol, final String host, final Integer port, final FioClientSettings settings) {

src/main/resources/IBSchema.xsd

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,18 @@
276276
</xs:simpleContent>
277277
</xs:complexType>
278278
</xs:element>
279+
280+
<!-- REFERENCE PLATCE -->
281+
<xs:element name="column_27" minOccurs="0" maxOccurs="1">
282+
<xs:complexType>
283+
<xs:simpleContent>
284+
<xs:extension base="xs:string">
285+
<xs:attribute name="name" type="xs:token" use="required"></xs:attribute>
286+
<xs:attribute name="id" type="xs:nonNegativeInteger" use="required"></xs:attribute>
287+
</xs:extension>
288+
</xs:simpleContent>
289+
</xs:complexType>
290+
</xs:element>
279291

280292
</xs:sequence>
281293
</xs:complexType>
@@ -287,4 +299,65 @@
287299
</xs:complexType>
288300
</xs:element>
289301

290-
</xs:schema>
302+
<xs:element name="MerchantStatement">
303+
<xs:complexType>
304+
<xs:sequence>
305+
<xs:element name="Info" minOccurs="1" maxOccurs="1">
306+
<xs:complexType>
307+
<xs:sequence>
308+
<xs:element name="accountId" type="xs:string" minOccurs="1" maxOccurs="1"/>
309+
<xs:element name="bankId" type="xs:string" minOccurs="1" maxOccurs="1"/>
310+
<xs:element name="currency" type="xs:string" minOccurs="1" maxOccurs="1"/>
311+
312+
<xs:element name="iban" type="xs:string" minOccurs="1" maxOccurs="1"/>
313+
<xs:element name="bic" type="xs:string" minOccurs="1" maxOccurs="1"/>
314+
315+
<xs:element name="dateStart" type="xs:date" minOccurs="0" maxOccurs="1"/>
316+
<xs:element name="dateEnd" type="xs:date" minOccurs="0" maxOccurs="1"/>
317+
</xs:sequence>
318+
</xs:complexType>
319+
</xs:element>
320+
<xs:element name="TransactionList" minOccurs="0" maxOccurs="1">
321+
<xs:complexType>
322+
<xs:sequence>
323+
<xs:element name="Transaction" minOccurs="0" maxOccurs="unbounded">
324+
<xs:complexType>
325+
<xs:sequence>
326+
<xs:element name="operationId" type="xs:long" minOccurs="1" maxOccurs="1"/>
327+
<xs:element name="orderId" type="xs:long" minOccurs="1" maxOccurs="1"/>
328+
<xs:element name="date" type="xs:date" minOccurs="1" maxOccurs="1"/>
329+
<xs:element name="amount" type="xs:decimal" minOccurs="1" maxOccurs="1"/>
330+
<xs:element name="note" type="xs:string" minOccurs="0" maxOccurs="1"/>
331+
<xs:element name="branchName" type="xs:string" minOccurs="0" maxOccurs="1"/>
332+
<xs:element name="transactionId" type="xs:long" minOccurs="0" maxOccurs="1"/>
333+
<xs:element name="deviceId" type="xs:string" minOccurs="0" maxOccurs="1"/>
334+
<xs:element name="transactionDateTime" type="xs:dateTime" minOccurs="0"
335+
maxOccurs="1"/>
336+
<xs:element name="autorizationNumber" type="xs:string" minOccurs="0"
337+
maxOccurs="1"/>
338+
<xs:element name="cardNumber" type="xs:string" minOccurs="0" maxOccurs="1"/>
339+
<xs:element name="transactionAmount" type="xs:decimal" minOccurs="0"
340+
maxOccurs="1"/>
341+
<xs:element name="transactionCurrency" type="xs:string" minOccurs="0"
342+
maxOccurs="1"/>
343+
<xs:element name="type" type="xs:string" minOccurs="0" maxOccurs="1"/>
344+
<xs:element name="cardIssuer" type="xs:string" minOccurs="0" maxOccurs="1"/>
345+
<xs:element name="totalFees" type="xs:decimal" minOccurs="0" maxOccurs="1"/>
346+
<xs:element name="fioFee" type="xs:decimal" minOccurs="0" maxOccurs="1"/>
347+
<xs:element name="interchangeFee" type="xs:decimal" minOccurs="0"
348+
maxOccurs="1"/>
349+
<xs:element name="cardAssociationFee" type="xs:decimal" minOccurs="0"
350+
maxOccurs="1"/>
351+
<xs:element name="settlement" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
352+
<xs:element name="settlementDate" type="xs:date" minOccurs="0" maxOccurs="1"/>
353+
<xs:element name="vs" type="xs:string" minOccurs="0" maxOccurs="1"/>
354+
</xs:sequence>
355+
</xs:complexType>
356+
</xs:element>
357+
</xs:sequence>
358+
</xs:complexType>
359+
</xs:element>
360+
</xs:sequence>
361+
</xs:complexType>
362+
</xs:element>
363+
</xs:schema>
Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<xs:pattern value="(\d{1,6}-)?\d{1,10}" />
3030
</xs:restriction>
3131
</xs:simpleType>
32-
32+
3333
<xs:simpleType name="account_fio_type">
3434
<xs:restriction base="xs:nonNegativeInteger">
3535
<xs:pattern value="(\d{1,10})" />
@@ -101,13 +101,13 @@
101101
<xs:maxLength value="140" />
102102
</xs:restriction>
103103
</xs:simpleType>
104-
104+
105105
<xs:simpleType name="bic_type">
106106
<xs:restriction base="xs:token">
107107
<xs:pattern value="[A-Z]{6}[A-Z0-9]{2}([A-Z0-9]{3})?" />
108108
</xs:restriction>
109109
</xs:simpleType>
110-
110+
111111

112112
<xs:simpleType name="std_string_type">
113113
<xs:restriction base="xs:string">
@@ -120,12 +120,12 @@
120120
<xs:maxLength value="50" />
121121
</xs:restriction>
122122
</xs:simpleType>
123-
123+
124124
<xs:simpleType name="remittance_info_type">
125125
<xs:restriction base="xs:token">
126126
<xs:maxLength value="35" />
127127
</xs:restriction>
128-
</xs:simpleType>
128+
</xs:simpleType>
129129

130130
<xs:simpleType name="details_charges_type">
131131
<xs:restriction base="xs:nonNegativeInteger">
@@ -138,7 +138,6 @@
138138
<xs:simpleType name="payment_type_domestic_type">
139139
<xs:restriction base="xs:nonNegativeInteger">
140140
<xs:enumeration value="431001" /><!-- Standardní -->
141-
<xs:enumeration value="431004" /><!-- Zrychlená -->
142141
<xs:enumeration value="431005" /><!-- Prioritní -->
143142
<xs:enumeration value="431022" /><!-- Prikaz k inkasu -->
144143
</xs:restriction>
@@ -152,7 +151,7 @@
152151
</xs:simpleType>
153152

154153
<xs:simpleType name="payment_reason_type">
155-
<xs:restriction base="xs:string">
154+
<xs:restriction base="xs:integer">
156155
<xs:enumeration value="110"/><!-- 110 - Vývoz zboží -->
157156
<xs:enumeration value="112"/><!-- 112 - Finanční pronájem (leasing) - vývoz -->
158157
<xs:enumeration value="120"/><!-- 120 - Dovoz zboží -->
@@ -268,7 +267,7 @@
268267
<xs:enumeration value="755"/><!-- 755 - Vklady a výběry z vkladů střednědobých a dlouhodobých -->
269268
<xs:enumeration value="760"/><!-- 760 - Konverze, arbitráže a další operace -->
270269
<xs:enumeration value="762"/><!-- 762 - Řízení likvidity peněžních prostředků (cash-pooling, zero balancing) -->
271-
<xs:enumeration value="770"/><!-- 770 - Členské podíly v mezinárodních organizacích -->
270+
<xs:enumeration value="770"/><!-- 770 - Členské podíly v mezinárodních organizacích -->
272271
<xs:enumeration value="790"/><!-- 790 - Zajištění závazků cizozemce -->
273272
<xs:enumeration value="818"/><!-- 818 - Tuzemské portfoliové investice -->
274273
<xs:enumeration value="820"/><!-- 820 - Tuzemské dluhové cenné papíry krátkodobé -->
@@ -282,11 +281,11 @@
282281
<xs:enumeration value="890"/><!-- 890 - Zajištění závazku tuzemce -->
283282
<xs:enumeration value="950"/><!-- 950 - Převody mezi tuzemci -->
284283
<xs:enumeration value="952"/><!-- 952 - Převody mezi cizozemci -->
285-
</xs:restriction>
284+
</xs:restriction>
286285
</xs:simpleType>
287286

288287
<xs:simpleType name="country_type">
289-
<xs:restriction base="xs:string">
288+
<xs:restriction base="xs:string">
290289
<xs:enumeration value="AX"/><!-- Alandské ostrovy -->
291290
<xs:enumeration value="AL"/><!-- Albánie -->
292291
<xs:enumeration value="DZ"/><!-- Alžírsko -->
@@ -539,7 +538,7 @@
539538
<xs:enumeration value="ZM"/><!-- Zambie -->
540539
<xs:enumeration value="EH"/><!-- Západní Sahara -->
541540
<xs:enumeration value="ZW"/><!-- Zimbabwe -->
542-
</xs:restriction>
541+
</xs:restriction>
543542
</xs:simpleType>
544543

545-
</xs:schema>
544+
</xs:schema>

src/main/resources/importIB.xsd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
33

4-
<xs:include schemaLocation="type.xsd"/>
4+
<xs:include schemaLocation="fio_xml_type.xsd"/>
55

66
<xs:element name="Import">
77
<xs:complexType>
@@ -48,7 +48,7 @@
4848
<xs:element name="ks" type="ks_type" minOccurs="0" maxOccurs="1" />
4949
<xs:element name="vs" type="vs_type" minOccurs="0" maxOccurs="1" />
5050
<xs:element name="ss" type="ss_type" minOccurs="0" maxOccurs="1" />
51-
<xs:element name="bic" type="bic_type" minOccurs="1" maxOccurs="1" />
51+
<xs:element name="bic" type="string_50_type" minOccurs="0" maxOccurs="1" />
5252
<xs:element name="date" type="xs:date" minOccurs="1" maxOccurs="1" />
5353
<xs:element name="comment" type="user_identification_type" minOccurs="0" maxOccurs="1" />
5454
<xs:element name="benefName" type="string_50_type" minOccurs="1" maxOccurs="1" />

src/main/resources/responseImportIB.xsd

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
33

4-
<xs:include schemaLocation="type.xsd" />
4+
<xs:simpleType name="status">
5+
<xs:restriction base="xs:string">
6+
<xs:enumeration value="ok" />
7+
<xs:enumeration value="error" />
8+
<xs:enumeration value="warning" />
9+
<xs:enumeration value="fatal" />
10+
</xs:restriction>
11+
</xs:simpleType>
12+
13+
<xs:simpleType name="amount_type">
14+
<xs:restriction base="xs:decimal">
15+
<xs:fractionDigits value="2" />
16+
</xs:restriction>
17+
</xs:simpleType>
518

619
<xs:element name="responseImport">
720
<xs:complexType>
@@ -10,9 +23,9 @@
1023
<xs:complexType>
1124
<xs:sequence>
1225
<xs:element name="errorCode" type="xs:unsignedShort" minOccurs="1" maxOccurs="1" />
13-
<xs:element name="idInstruction" type="xs:nonNegativeInteger" minOccurs="0" maxOccurs="1" />
26+
<xs:element name="idInstruction" type="xs:nonNegativeInteger" minOccurs="0" maxOccurs="unbounded" />
1427
<xs:element name="status" type="status" minOccurs="1" maxOccurs="1" />
15-
<xs:element name="message" type="xs:string" minOccurs="0" maxOccurs="1" />
28+
<xs:element name="message" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
1629

1730
<xs:element name="sums" minOccurs="0" maxOccurs="1">
1831
<xs:complexType>
@@ -65,9 +78,4 @@
6578
</xs:sequence>
6679
</xs:complexType>
6780
</xs:element>
68-
69-
70-
71-
72-
7381
</xs:schema>

src/test/java/cz/geek/fio/FioClientIT.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public void commonSetUp() {
2727
public void shouldExportTransactionsById() throws Exception {
2828
onRequest()
2929
.havingMethodEqualTo("GET")
30-
.havingPathEqualTo("/ib_api/rest/by-id/token/2016/1/transactions.xml")
30+
.havingPathEqualTo("/v1/rest/by-id/token/2016/1/transactions.xml")
3131
.respond()
3232
.withBody(ResourceUtils.readFromResource("/transactions-id.xml"))
3333
.withContentType("text/xml")
@@ -40,7 +40,7 @@ public void shouldExportTransactionsById() throws Exception {
4040
public void shouldGetTransactionsById() throws Exception {
4141
onRequest()
4242
.havingMethodEqualTo("GET")
43-
.havingPathEqualTo("/ib_api/rest/by-id/token/2016/1/transactions.xml")
43+
.havingPathEqualTo("/v1/rest/by-id/token/2016/1/transactions.xml")
4444
.respond()
4545
.withBody(ResourceUtils.readFromResource("/transactions-id.xml"))
4646
.withContentType("text/xml")
@@ -53,7 +53,7 @@ public void shouldGetTransactionsById() throws Exception {
5353
public void shouldExportTransactionsByDate() throws Exception {
5454
onRequest()
5555
.havingMethodEqualTo("GET")
56-
.havingPathEqualTo("/ib_api/rest/periods/token/2016-01-01/2016-01-02/transactions.xml")
56+
.havingPathEqualTo("/v1/rest/periods/token/2016-01-01/2016-01-02/transactions.xml")
5757
.respond()
5858
.withBody(ResourceUtils.readFromResource("/transactions-from-to.xml"))
5959
.withContentType("text/xml")
@@ -66,7 +66,7 @@ public void shouldExportTransactionsByDate() throws Exception {
6666
public void shouldGetTransactionsByDate() throws Exception {
6767
onRequest()
6868
.havingMethodEqualTo("GET")
69-
.havingPathEqualTo("/ib_api/rest/periods/token/2016-01-01/2016-01-02/transactions.xml")
69+
.havingPathEqualTo("/v1/rest/periods/token/2016-01-01/2016-01-02/transactions.xml")
7070
.respond()
7171
.withBody(ResourceUtils.readFromResource("/transactions-from-to.xml"))
7272
.withContentType("text/xml")
@@ -79,7 +79,7 @@ public void shouldGetTransactionsByDate() throws Exception {
7979
public void shouldExportLastTransactions() throws Exception {
8080
onRequest()
8181
.havingMethodEqualTo("GET")
82-
.havingPathEqualTo("/ib_api/rest/last/token/transactions.xml")
82+
.havingPathEqualTo("/v1/rest/last/token/transactions.xml")
8383
.respond()
8484
.withBody(ResourceUtils.readFromResource("/transactions-last.xml"))
8585
.withContentType("text/xml")
@@ -92,7 +92,7 @@ public void shouldExportLastTransactions() throws Exception {
9292
public void shouldGetLastTransactions() throws Exception {
9393
onRequest()
9494
.havingMethodEqualTo("GET")
95-
.havingPathEqualTo("/ib_api/rest/last/token/transactions.xml")
95+
.havingPathEqualTo("/v1/rest/last/token/transactions.xml")
9696
.respond()
9797
.withBody(ResourceUtils.readFromResource("/transactions-last.xml"))
9898
.withContentType("text/xml")
@@ -105,7 +105,7 @@ public void shouldGetLastTransactions() throws Exception {
105105
public void shouldSetLastId() throws Exception {
106106
onRequest()
107107
.havingMethodEqualTo("GET")
108-
.havingPathEqualTo("/ib_api/rest/set-last-id/token/1/")
108+
.havingPathEqualTo("/v1/rest/set-last-id/token/1/")
109109
.respond()
110110
.withStatus(200);
111111

@@ -116,7 +116,7 @@ public void shouldSetLastId() throws Exception {
116116
public void shouldSetLastDate() throws Exception {
117117
onRequest()
118118
.havingMethodEqualTo("GET")
119-
.havingPathEqualTo("/ib_api/rest/set-last-date/token/2016-01-02/")
119+
.havingPathEqualTo("/v1/rest/set-last-date/token/2016-01-02/")
120120
.respond()
121121
.withStatus(200);
122122

0 commit comments

Comments
 (0)