Skip to content

Commit 3a8dfbf

Browse files
committed
Improve AJ Bell Securities Limited PDF-Importer
small corrections regEx
1 parent c0811cf commit 3a8dfbf

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

name.abuchen.portfolio/src/name/abuchen/portfolio/datatransfer/pdf/AJBellSecuritiesLimitedPDFExtractor.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ public String getLabel()
4343

4444
private void addBuySellTransaction()
4545
{
46-
DocumentType type = new DocumentType("CONTRACT NOTE");
46+
var type = new DocumentType("CONTRACT NOTE");
4747
this.addDocumentTyp(type);
4848

49-
Transaction<BuySellEntry> pdfTransaction = new Transaction<>();
49+
var pdfTransaction = new Transaction<BuySellEntry>();
5050

51-
Block firstRelevantLine = new Block("^Account No\\. .*$");
51+
var firstRelevantLine = new Block("^Account No\\. .*$");
5252
type.addBlock(firstRelevantLine);
5353
firstRelevantLine.set(pdfTransaction);
5454

@@ -75,7 +75,7 @@ private void addBuySellTransaction()
7575
.find("We have (bought|sold) for you as agent") //
7676
.match("^(?<name>.*)$") //
7777
.match("^(?<name1>.*)$") //
78-
.match("^.*([\\s]{1,})[\\.,\\d]+ [\\.,\\d]+([\\s]{1,})[\\.,\\d]+ (?<currency>[\\w]{3})$") //
78+
.match("^.*([\\s]{1,})[\\.,\\d]+ [\\.,\\d]+([\\s]{1,})[\\.,\\d]+ (?<currency>[A-Z]{3})$") //
7979
.assign((t, v) -> {
8080
if (!v.get("name1").startsWith("Venue"))
8181
v.put("name", v.get("name") + " " + v.get("name1"));
@@ -88,7 +88,7 @@ private void addBuySellTransaction()
8888
// XLON 470 67.3483 31,653.70 GBP
8989
// @formatter:on
9090
.section("shares") //
91-
.match("^.*([\\s]{1,})(?<shares>[\\.,\\d]+) [\\.,\\d]+([\\s]{1,})[\\.,\\d]+ [\\w]{3}$") //
91+
.match("^.*[\\s]{1,}(?<shares>[\\.,\\d]+) [\\.,\\d]+[\\s]{1,}[\\.,\\d]+ [A-Z]{3}$") //
9292
.assign((t, v) -> t.setShares(asShares(v.get("shares"))))
9393

9494
// @formatter:off
@@ -103,7 +103,7 @@ private void addBuySellTransaction()
103103
// Total credit 15,783.20 GBP
104104
// @formatter:on
105105
.section("currency", "amount") //
106-
.match("^Total (debit|credit)([\\s]{1,})(?<amount>[\\.,\\d]+) (?<currency>[\\w]{3})$") //
106+
.match("^Total (debit|credit)[\\s]{1,}(?<amount>[\\.,\\d]+) (?<currency>[A-Z]{3})$") //
107107
.assign((t, v) -> {
108108
t.setCurrencyCode(asCurrencyCode(v.get("currency")));
109109
t.setAmount(asAmount(v.get("amount")));
@@ -113,7 +113,7 @@ private void addBuySellTransaction()
113113
// 05/12/19 13.15 11/12/19 Bought BF41Q72 C5L6DQ
114114
// @formatter:on
115115
.section("note").optional() //
116-
.match("^[\\d]{2}\\/[\\d]{2}\\/[\\d]{2} [\\d]{2}\\.[\\d]{2} [\\d]{2}\\/[\\d]{2}\\/[\\d]{2} (Bought|Sold)([\\s]{1,})[A-Z0-9]{7} (?<note>.*)$") //
116+
.match("^[\\d]{2}\\/[\\d]{2}\\/[\\d]{2} [\\d]{2}\\.[\\d]{2} [\\d]{2}\\/[\\d]{2}\\/[\\d]{2} (Bought|Sold)[\\s]{1,}[A-Z0-9]{7} (?<note>.*)$") //
117117
.assign((t, v) -> t.setNote("Ref. No. " + trim(v.get("note"))))
118118

119119
.wrap(BuySellEntryItem::new);
@@ -129,7 +129,7 @@ private <T extends Transaction<?>> void addFeesSectionsTransaction(T transaction
129129
// Dealing charge 1.50 GBP
130130
// @formatter:on
131131
.section("fee", "currency").optional() //
132-
.match("^Dealing charge([\\s]{1,})(?<fee>[\\.,\\d]+) (?<currency>[\\w]{3})$") //
132+
.match("^Dealing charge[\\s]{1,}(?<fee>[\\.,\\d]+) (?<currency>[A-Z]{3})$") //
133133
.assign((t, v) -> processFeeEntries(t, v, type));
134134
}
135135

0 commit comments

Comments
 (0)