Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: [postal-savings-rs] Card transactions #743

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
import { convertCardTransactions } from '../../../converters'

const input = `
<tr>
<td align="left">05.04.2024</td>
<td align="right">-3.282,63</td>
<td align="left">RSD</td>
<td align="left">09.04.2024</td>
<td align="left">Wolt doo </td>
<td align="right">4870........1234</td>
</tr>
<tr>
<td align="left">06.04.2024</td>
<td align="right">-370,00</td>
<td align="left">RSD</td>
<td align="left">09.04.2024</td>
<td align="left">LP NOVI CAJ VLADIMIR NOVI </td>
<td align="right">4870........1234</td>
</tr>
<tr>
<td align="left">07.04.2024</td>
<td align="right">500,00</td>
<td align="left">EUR</td>
<td align="left">10.04.2024</td>
<td align="left">REFUND U INOSTRANSTVU </td>
<td align="right">4870........1234</td>
</tr>
<tr>
<td align="left">08.04.2024</td>
<td align="right">-210,00</td>
<td align="left">RSD</td>
<td align="left">10.04.2024</td>
<td align="left">TISHLER TOBACCO AND COFFENOVI </td>
<td align="right">4870........1234</td>
</tr>
<tr>
<td align="left">12.04.2024</td>
<td align="right">20,00</td>
<td align="left">USD</td>
<td align="left"> </td>
<td align="left">CHATGPT SUBSCRIPTION +1415</td>
<td align="right">4870........1234</td>
</tr>
<tr>
<td align="left">13.04.2024</td>
<td align="right">10.000,00</td>
<td align="left">RSD</td>
<td align="left"> </td>
<td align="left">ATMBPS KAFE RANDEVU NOVI </td>
<td align="right">4870........1234</td>
</tr>
<tr>
<td align="left">13.04.2024</td>
<td align="right">250,00</td>
<td align="left">EUR</td>
<td align="left"> </td>
<td align="left">REFUND U INOSTRANSTVU </td>
<td align="right">4870........1234</td>
</tr>
`

describe('convertCardTransactions', () => {
it('converts card transactions', () => {
expect(convertCardTransactions(input)).toEqual([
{
date: new Date('2024-04-13T00:00:00.000'),
authorizationDate: null,
amount: {
sum: 250.00,
instrument: 'EUR'
},
merchant: 'REFUND U INOSTRANSTVU'
},
{
date: new Date('2024-04-13T00:00:00.000'),
authorizationDate: null,
amount: {
sum: -10_000.00,
instrument: 'RSD'
},
merchant: 'ATMBPS KAFE RANDEVU'
},
{
date: new Date('2024-04-12T00:00:00.000'),
authorizationDate: null,
amount: {
sum: -20.00,
instrument: 'USD'
},
merchant: 'CHATGPT SUBSCRIPTION'
},
{
date: new Date('2024-04-08T00:00:00.000'),
authorizationDate: new Date('2024-04-10T00:00:00.000'),
amount: {
sum: -210.00,
instrument: 'RSD'
},
merchant: 'TISHLER TOBACCO AND COFFE'
},
{
date: new Date('2024-04-07T00:00:00.000'),
authorizationDate: new Date('2024-04-10T00:00:00.000'),
amount: {
sum: 500.00,
instrument: 'EUR'
},
merchant: 'REFUND U INOSTRANSTVU'
},
{
date: new Date('2024-04-06T00:00:00.000'),
authorizationDate: new Date('2024-04-09T00:00:00.000'),
amount: {
sum: -370.00,
instrument: 'RSD'
},
merchant: 'LP NOVI CAJ VLADIMIR'
},
{
date: new Date('2024-04-05T00:00:00.000'),
authorizationDate: new Date('2024-04-09T00:00:00.000'),
amount: {
sum: -3282.63,
instrument: 'RSD'
},
merchant: 'Wolt doo'
}
])
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
import { convertExchangeRates } from '../../../converters'

const input = `
<tr>
<td align="center" colspan="9">E- BANKING EXCHANGE RATE LIST NO.: 66<br></br>APPLICABLE AS AT: 05.04.2024.</td>
</tr>
<tr>
<td align="center" width="5%" rowspan="2">Currency code</td>
<td align="center" width="5%" rowspan="2">Currency designation</td>
<td align="center" width="15%" rowspan="2">Country</td>
<td align="center" width="10%" rowspan="2">Unit</td>
<td align="center" colspan="3" width="30%">For foreign exchange</td>
<td align="center" colspan="2" width="20%">For foreign cash</td>
</tr><tr>
<td align="center" width="12%">Buying exchange rate</td>
<td align="center" width="12%">Middle exchange rate</td>
<td align="center" width="12%">Selling exchange rate</td>
<td align="center" width="12%">Buying exchange rate</td>
<td align="center" width="12%">Selling exchange rate</td>
</tr>

<tr valign="top">
<td align="center">978<br></br></td>
<td align="center">EUR<br></br></td>
<td align="left"><img src='../slike2/EUR.gif' height="11" width="16"/>&nbsp;E M U <br></br></td>
<td align="center"> 1<br></br></td>
<td align="center"> 116.7883<br></br></td>
<td align="center"> 117.1397<br></br></td>
<td align="center"> 117.4911<br></br></td>
<td align="center"> 116.7883<br></br></td>
<td align="center"> 117.6083<br></br></td>
</tr>

<tr valign="top">
<td align="center">036<br></br></td>
<td align="center">AUD<br></br></td>
<td align="left"><img src='../slike2/AUD.gif' height="11" width="16"/>&nbsp;AUSTRALIJA <br></br></td>
<td align="center"> 1<br></br></td>
<td align="center"> 70.0520<br></br></td>
<td align="center"> 71.1188<br></br></td>
<td align="center"> 72.1856<br></br></td>
<td align="center"> 70.0520<br></br></td>
<td align="center"> 72.1856<br></br></td>
</tr>

<tr valign="top">
<td align="center">124<br></br></td>
<td align="center">CAD<br></br></td>
<td align="left"><img src='../slike2/CAD.gif' height="11" width="16"/>&nbsp;KANADA <br></br></td>
<td align="center"> 1<br></br></td>
<td align="center"> 78.5289<br></br></td>
<td align="center"> 79.7248<br></br></td>
<td align="center"> 80.9207<br></br></td>
<td align="center"> 78.5289<br></br></td>
<td align="center"> 80.9207<br></br></td>
</tr>

<tr valign="top">
<td align="center">208<br></br></td>
<td align="center">DKK<br></br></td>
<td align="left"><img src='../slike2/DKK.gif' height="11" width="16"/>&nbsp;DANSKA <br></br></td>
<td align="center"> 1<br></br></td>
<td align="center"> 15.4678<br></br></td>
<td align="center"> 15.7034<br></br></td>
<td align="center"> 15.9390<br></br></td>
<td align="center"> 15.4678<br></br></td>
<td align="center"> 15.9390<br></br></td>
</tr>

<tr valign="top">
<td align="center">578<br></br></td>
<td align="center">NOK<br></br></td>
<td align="left"><img src='../slike2/NOK.gif' height="11" width="16"/>&nbsp;NORVESKA <br></br></td>
<td align="center"> 1<br></br></td>
<td align="center"> 9.9009<br></br></td>
<td align="center"> 10.0517<br></br></td>
<td align="center"> 10.2025<br></br></td>
<td align="center"> 9.9009<br></br></td>
<td align="center"> 10.2025<br></br></td>
</tr>

<tr valign="top">
<td align="center">643<br></br></td>
<td align="center">RUB<br></br></td>
<td align="left"><img src='../slike2/RUB.gif' height="11" width="16"/>&nbsp;RUSIJA <br></br></td>
<td align="center"> 1<br></br></td>
<td align="center"> 1.1140<br></br></td>
<td align="center"> 1.1726<br></br></td>
<td align="center"> 1.2312<br></br></td>
<td align="center"> 0.0000<br></br></td>
<td align="center"> 0.0000<br></br></td>
</tr>

<tr valign="top">
<td align="center">752<br></br></td>
<td align="center">SEK<br></br></td>
<td align="left"><img src='../slike2/SEK.gif' height="11" width="16"/>&nbsp;SVEDSKA <br></br></td>
<td align="center"> 1<br></br></td>
<td align="center"> 9.9941<br></br></td>
<td align="center"> 10.1463<br></br></td>
<td align="center"> 10.2985<br></br></td>
<td align="center"> 9.9941<br></br></td>
<td align="center"> 10.2985<br></br></td>
</tr>

<tr valign="top">
<td align="center">756<br></br></td>
<td align="center">CHF<br></br></td>
<td align="left"><img src='../slike2/CHF.gif' height="11" width="16"/>&nbsp;SVAJCARSKA <br></br></td>
<td align="center"> 1<br></br></td>
<td align="center"> 118.0506<br></br></td>
<td align="center"> 119.8483<br></br></td>
<td align="center"> 121.6460<br></br></td>
<td align="center"> 118.0506<br></br></td>
<td align="center"> 121.6460<br></br></td>
</tr>

<tr valign="top">
<td align="center">826<br></br></td>
<td align="center">GBP<br></br></td>
<td align="left"><img src='../slike2/GBP.gif' height="11" width="16"/>&nbsp;VEL. BRITANIJA <br></br></td>
<td align="center"> 1<br></br></td>
<td align="center"> 134.5570<br></br></td>
<td align="center"> 136.6061<br></br></td>
<td align="center"> 138.6552<br></br></td>
<td align="center"> 134.5570<br></br></td>
<td align="center"> 138.6552<br></br></td>
</tr>

<tr valign="top">
<td align="center">840<br></br></td>
<td align="center">USD<br></br></td>
<td align="left"><img src='../slike2/USD.gif' height="11" width="16"/>&nbsp;S A D <br></br></td>
<td align="center"> 1<br></br></td>
<td align="center"> 106.5299<br></br></td>
<td align="center"> 108.1522<br></br></td>
<td align="center"> 109.7745<br></br></td>
<td align="center"> 106.5299<br></br></td>
<td align="center"> 109.7745<br></br></td>
</tr>
`

describe('convertExchangeRates', () => {
it('converts exchange rates', () => {
expect(convertExchangeRates(input)).toEqual(new Map([
['EUR', 117.1397],
['AUD', 71.1188],
['CAD', 79.7248],
['DKK', 15.7034],
['NOK', 10.0517],
['RUB', 1.1726],
['SEK', 10.1463],
['CHF', 119.8483],
['GBP', 136.6061],
['USD', 108.1522]
]))
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ import { convertTransactions } from '../../../converters'

describe('payment', () => {
it('payment', () => {
expect(convertTransactions({
id: 123456789,
type: 5
}, '<tr>\n' +
expect(convertTransactions(
'1234567895',
'<tr>\n' +
'<td align="right" width="80" nowrap>05.12.2023</td>\n' +
'<td align="left" width="130" nowrap>ISPLATA VISA&nbsp;NICEFOODS</td>\n' +
'<td align="right" width="100" nowrap>EUR 978</td>\n' +
Expand Down
Loading