@actual-app/sync-server 25.8.0-nightly.20250719 → 25.8.0-nightly.20250721

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,65 +20,63 @@ export default {
20
20
  // Remove an unwanted line that pollutes the remittance information
21
21
  .filter(line => line.startsWith('Réf : ') === false);
22
22
  const infoArray = editedTrans.remittanceInformationUnstructuredArray;
23
- const firstLine = infoArray[0];
24
23
  let match;
25
- /*
26
- * Some transactions always have their identifier in the first line (e.g. card),
27
- * while others have it **randomly** in any of the lines (e.g. transfers).
28
- */
29
- // Check the first line for specific patterns
30
- if ((match = firstLine.match(regexCard))) {
24
+ // Transactions can have their identifier in any line, as the order of lines is not guaranteed.
25
+ // This is why we check all lines for specific patterns.
26
+ if ((match = infoArray.find(line => regexCard.test(line)))) {
31
27
  // Card transaction
32
- const payeeName = match.groups.payeeName;
33
- editedTrans.payeeName = title(payeeName);
34
- editedTrans.notes = `Carte ${match.groups.date}`;
28
+ const cardMatch = match.match(regexCard);
29
+ editedTrans.payeeName = title(cardMatch.groups.payeeName);
30
+ editedTrans.notes = `Carte ${cardMatch.groups.date}`;
35
31
  if (infoArray.length > 1) {
36
- editedTrans.notes += ' ' + infoArray.slice(1).join(' ');
32
+ editedTrans.notes += ' ' + infoArray.filter(l => l !== match).join(' ');
37
33
  }
38
34
  }
39
- else if ((match = firstLine.match(regexLoan))) {
35
+ else if ((match = infoArray.find(line => regexLoan.test(line)))) {
40
36
  // Loan
41
37
  editedTrans.payeeName = 'Prêt bancaire';
42
- editedTrans.notes = firstLine;
38
+ editedTrans.notes = match;
43
39
  }
44
- else if ((match = firstLine.match(regexAtmWithdrawal))) {
40
+ else if ((match = infoArray.find(line => regexAtmWithdrawal.test(line)))) {
45
41
  // ATM withdrawal
42
+ const atmMatch = match.match(regexAtmWithdrawal);
46
43
  editedTrans.payeeName = 'Retrait DAB';
47
- editedTrans.notes = `Retrait ${match.groups.date} ${match.groups.locationName}`;
44
+ editedTrans.notes = `Retrait ${atmMatch.groups.date} ${atmMatch.groups.locationName}`;
48
45
  if (infoArray.length > 1) {
49
- editedTrans.notes += ' ' + infoArray.slice(1).join(' ');
46
+ editedTrans.notes += ' ' + infoArray.filter(l => l !== match).join(' ');
50
47
  }
51
48
  }
52
- else if ((match = firstLine.match(regexCreditNote))) {
49
+ else if ((match = infoArray.find(line => regexCreditNote.test(line)))) {
53
50
  // Credit note (refund)
54
- editedTrans.payeeName = title(match.groups.payeeName);
55
- editedTrans.notes = `Avoir ${match.groups.date}`;
51
+ const creditMatch = match.match(regexCreditNote);
52
+ editedTrans.payeeName = title(creditMatch.groups.payeeName);
53
+ editedTrans.notes = `Avoir ${creditMatch.groups.date}`;
54
+ if (infoArray.length > 1) {
55
+ editedTrans.notes += ' ' + infoArray.filter(l => l !== match).join(' ');
56
+ }
57
+ }
58
+ else if ((match = infoArray.find(line => regexInstantTransfer.test(line)))) {
59
+ // Instant transfer
60
+ editedTrans.payeeName = title(match.replace(regexInstantTransfer, ''));
61
+ editedTrans.notes = infoArray.filter(l => l !== match).join(' ');
62
+ }
63
+ else if ((match = infoArray.find(line => regexSepa.test(line)))) {
64
+ // SEPA transfer
65
+ editedTrans.payeeName = title(match.replace(regexSepa, ''));
66
+ editedTrans.notes = infoArray.filter(l => l !== match).join(' ');
67
+ }
68
+ else if ((match = infoArray.find(line => regexTransfer.test(line)))) {
69
+ // Other transfer
70
+ // Must be evaluated after the other transfers as they're more specific
71
+ // (here VIR only)
72
+ const infoArrayWithoutLine = infoArray.filter(l => l !== match);
73
+ editedTrans.payeeName = title(infoArrayWithoutLine.join(' '));
74
+ editedTrans.notes = match.replace(regexTransfer, '');
56
75
  }
57
76
  else {
58
- // For the next patterns, we need to check all lines as the identifier can be anywhere
59
- if ((match = infoArray.find(line => regexInstantTransfer.test(line)))) {
60
- // Instant transfer
61
- editedTrans.payeeName = title(match.replace(regexInstantTransfer, ''));
62
- editedTrans.notes = infoArray.filter(l => l !== match).join(' ');
63
- }
64
- else if ((match = infoArray.find(line => regexSepa.test(line)))) {
65
- // SEPA transfer
66
- editedTrans.payeeName = title(match.replace(regexSepa, ''));
67
- editedTrans.notes = infoArray.filter(l => l !== match).join(' ');
68
- }
69
- else if ((match = infoArray.find(line => regexTransfer.test(line)))) {
70
- // Other transfer
71
- // Must be evaluated after the other transfers as they're more specific
72
- // (here VIR only)
73
- const infoArrayWithoutLine = infoArray.filter(l => l !== match);
74
- editedTrans.payeeName = title(infoArrayWithoutLine.join(' '));
75
- editedTrans.notes = match.replace(regexTransfer, '');
76
- }
77
- else {
78
- // Unknown transaction type
79
- editedTrans.payeeName = title(firstLine.replace(/ \d+$/, ''));
80
- editedTrans.notes = infoArray.slice(1).join(' ');
81
- }
77
+ // Unknown transaction type
78
+ editedTrans.payeeName = title(infoArray[0].replace(/ \d+$/, ''));
79
+ editedTrans.notes = infoArray.slice(1).join(' ');
82
80
  }
83
81
  return Fallback.normalizeTransaction(transaction, booked, editedTrans);
84
82
  },
@@ -18,6 +18,19 @@ describe('BoursoBank', () => {
18
18
  'Payee Name',
19
19
  'Carte 03/02/25 2,80 NZD / 1 euro = 1,818181818',
20
20
  ],
21
+ [
22
+ [
23
+ '2,80 NZD / 1 euro = 1,818181818',
24
+ 'CARTE 03/02/25 PAYEE NAME CB*1234',
25
+ ],
26
+ 'Payee Name',
27
+ 'Carte 03/02/25 2,80 NZD / 1 euro = 1,818181818',
28
+ ],
29
+ [
30
+ ['110,04 GBP / 1 euro = 0,860763454', 'CARTE 13/07/25 PAYEE NAME'],
31
+ 'Payee Name',
32
+ 'Carte 13/07/25 110,04 GBP / 1 euro = 0,860763454',
33
+ ],
21
34
  [
22
35
  ['RETRAIT DAB 01/03/25 My location CB*9876'],
23
36
  'Retrait DAB',
@@ -31,6 +44,14 @@ describe('BoursoBank', () => {
31
44
  'Retrait DAB',
32
45
  'Retrait 01/03/25 My location 2,80 NZD / 1 euro = 1,818181818',
33
46
  ],
47
+ [
48
+ [
49
+ '2,80 NZD / 1 euro = 1,818181818',
50
+ 'RETRAIT DAB 01/03/25 My location CB*9876',
51
+ ],
52
+ 'Retrait DAB',
53
+ 'Retrait 01/03/25 My location 2,80 NZD / 1 euro = 1,818181818',
54
+ ],
34
55
  [
35
56
  ['VIR Text put by the sender', 'PAYEE NAME'],
36
57
  'Payee Name',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@actual-app/sync-server",
3
- "version": "25.8.0-nightly.20250719",
3
+ "version": "25.8.0-nightly.20250721",
4
4
  "license": "MIT",
5
5
  "description": "actual syncing server",
6
6
  "bin": {
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@actual-app/crdt": "2.1.0",
31
- "@actual-app/web": "25.8.0-nightly.20250719",
31
+ "@actual-app/web": "25.8.0-nightly.20250721",
32
32
  "bcrypt": "^5.1.1",
33
33
  "better-sqlite3": "^11.10.0",
34
34
  "convict": "^6.2.4",