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

Modify Selfwealth Limited PDF-Importer to add new bank identifier #2999

Merged
merged 1 commit into from Oct 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,33 @@
PDF author: ''
PDFBox Version: 1.8.16
-----------------------------------------
Selfwealth Limited ABN: 52 154 324 428 AFSL 421789 W: www.selfwealth.com.au E: support@selfwealth.com.au
This trade was executed and cleared by OpenMarkets Australia Ltd ABN 38 090 472 012,
AFSL 246 705, Market Particpant of ASX, CHI­X and NSX.
Buy Confirmation
MR JOHN DOE  Account Number: 1234567
JOHN DOE A/C Reference No: T20210701123456­1
1 LONG ROAD Trade Date: 1 Jul 2021
SYDNEY NSW Settlement Date: 5 Jul 2021
2000, AUS Market: ASX
WE HAVE BOUGHT ON YOUR ACCOUNT
Quantity Security Code Security Description Price +1 Consideration Currency
25 UMAX BETA S&P500 YIELDMAX 12.40 $312.50 AUD
Brokerage* $9.50 AUD
Adviser Fee* $3.12 AUD
Net Value $325.12 AUD
GST included in this invoice is $1.14
The confirmation is a tax invoice ­ please retain for tax purposes. If this confirmation does not correspond with your records please contact us immediately at
support@selfwealth.com.au
Settlement Instructions All consideration and any information or documents required by OpenMarkets must be provided to OpenMarkets by 9am AEST on the Settlement
Date. This transaction will be settled from your linked cash account or in accordance with your instructions on the Settlement Date.
Contract Comments
Ex Dividend
* Inclusive of GST
+1 Standard Financial Rounding Applied (if applicable)
This confirmation is provided to you by each of SelfWealth and OpenMarkets. The Brokerage and Adviser fees set out in this confirmation are charged by SelfWealth.
OpenMarkets has not charged you any fees for the above transaction(s). The above transaction(s) and this confirmation are issued subject to the directions, decisions
and requirements of the operator of the relevant Market, ASIC Market Integrity Rules, the operating rules of the relevant Market, and, where relevant, the Clearing
Rules of the relevant Clearing Facility and the Settlement Rules of the relevant Settlement Facility, the customs and usages of the relevant Market and the correction of
errors and omissions. If this confirmation relates to multiple transactions, those transactions may have been completed on ASX or CHI­X.”
Generated At: 5 Jul 2021 16:30:01 PM Page: 1 of 1
Expand Up @@ -35,7 +35,7 @@ public void testSecurityBuy01()

List<Exception> errors = new ArrayList<>();

List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "SelfWealthBuy01.txt"), errors);
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "Buy01.txt"), errors);

assertThat(errors, empty());
assertThat(results.size(), is(2));
Expand All @@ -57,7 +57,7 @@ public void testSecurityBuy01()

assertThat(entry.getPortfolioTransaction().getDateTime(), is(LocalDateTime.parse("2021-07-01T00:00")));
assertThat(entry.getPortfolioTransaction().getShares(), is(Values.Share.factorize(25)));
assertThat(entry.getSource(), is("SelfWealthBuy01.txt"));
assertThat(entry.getSource(), is("Buy01.txt"));
assertThat(entry.getNote(), is("T20210701123456­-1"));

assertThat(entry.getPortfolioTransaction().getMonetaryAmount(),
Expand All @@ -77,7 +77,7 @@ public void testSecurityBuy02()

List<Exception> errors = new ArrayList<>();

List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "SelfWealthBuy02.txt"), errors);
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "Buy02.txt"), errors);

assertThat(errors, empty());
assertThat(results.size(), is(2));
Expand All @@ -99,7 +99,49 @@ public void testSecurityBuy02()

assertThat(entry.getPortfolioTransaction().getDateTime(), is(LocalDateTime.parse("2021-07-01T00:00")));
assertThat(entry.getPortfolioTransaction().getShares(), is(Values.Share.factorize(25)));
assertThat(entry.getSource(), is("SelfWealthBuy02.txt"));
assertThat(entry.getSource(), is("Buy02.txt"));
assertThat(entry.getNote(), is("T20210701123456­1"));

assertThat(entry.getPortfolioTransaction().getMonetaryAmount(),
is(Money.of("AUD", Values.Amount.factorize(325.12))));
assertThat(entry.getPortfolioTransaction().getGrossValue(),
is(Money.of("AUD", Values.Amount.factorize(312.50))));
assertThat(entry.getPortfolioTransaction().getUnitSum(Unit.Type.TAX),
is(Money.of("AUD", Values.Amount.factorize(0.00))));
assertThat(entry.getPortfolioTransaction().getUnitSum(Unit.Type.FEE),
is(Money.of("AUD", Values.Amount.factorize(9.50 + 3.12))));
}

@Test
public void testSecurityBuy03()
{
SelfWealthPDFExtractor extractor = new SelfWealthPDFExtractor(new Client());

List<Exception> errors = new ArrayList<>();

List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "Buy03.txt"), errors);

assertThat(errors, empty());
assertThat(results.size(), is(2));
new AssertImportActions().check(results, "AUD");

// check security
Security security = results.stream().filter(SecurityItem.class::isInstance).findFirst()
.orElseThrow(IllegalArgumentException::new).getSecurity();
assertThat(security.getTickerSymbol(), is("UMAX"));
assertThat(security.getName(), is("BETA S&P500 YIELDMAX"));
assertThat(security.getCurrencyCode(), is("AUD"));

// check buy sell transaction
BuySellEntry entry = (BuySellEntry) results.stream().filter(BuySellEntryItem.class::isInstance).findFirst()
.orElseThrow(IllegalArgumentException::new).getSubject();

assertThat(entry.getPortfolioTransaction().getType(), is(PortfolioTransaction.Type.BUY));
assertThat(entry.getAccountTransaction().getType(), is(AccountTransaction.Type.BUY));

assertThat(entry.getPortfolioTransaction().getDateTime(), is(LocalDateTime.parse("2021-07-01T00:00")));
assertThat(entry.getPortfolioTransaction().getShares(), is(Values.Share.factorize(25)));
assertThat(entry.getSource(), is("Buy03.txt"));
assertThat(entry.getNote(), is("T20210701123456­1"));

assertThat(entry.getPortfolioTransaction().getMonetaryAmount(),
Expand All @@ -119,7 +161,7 @@ public void testSecuritySell01()

List<Exception> errors = new ArrayList<>();

List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "SelfWealthSell01.txt"), errors);
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "Sell01.txt"), errors);

assertThat(errors, empty());
assertThat(results.size(), is(2));
Expand All @@ -141,7 +183,7 @@ public void testSecuritySell01()

assertThat(entry.getPortfolioTransaction().getDateTime(), is(LocalDateTime.parse("2021-05-24T00:00")));
assertThat(entry.getPortfolioTransaction().getShares(), is(Values.Share.factorize(397)));
assertThat(entry.getSource(), is("SelfWealthSell01.txt"));
assertThat(entry.getSource(), is("Sell01.txt"));
assertThat(entry.getNote(), is("T20210701123456­1"));

assertThat(entry.getPortfolioTransaction().getMonetaryAmount(),
Expand All @@ -161,7 +203,7 @@ public void testSecuritySell02()

List<Exception> errors = new ArrayList<>();

List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "SelfWealthSell02.txt"), errors);
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "Sell02.txt"), errors);

assertThat(errors, empty());
assertThat(results.size(), is(2));
Expand All @@ -183,7 +225,7 @@ public void testSecuritySell02()

assertThat(entry.getPortfolioTransaction().getDateTime(), is(LocalDateTime.parse("2021-05-24T00:00")));
assertThat(entry.getPortfolioTransaction().getShares(), is(Values.Share.factorize(397)));
assertThat(entry.getSource(), is("SelfWealthSell02.txt"));
assertThat(entry.getSource(), is("Sell02.txt"));
assertThat(entry.getNote(), is("T20210701123456­1"));

assertThat(entry.getPortfolioTransaction().getMonetaryAmount(),
Expand Down
@@ -1,32 +1,32 @@
PDF author: ''
PDFBox Version: 1.8.16
-----------------------------------------
SelfWealth Limited ABN: 52 154 324 428 AFSL 421789 W: www.selfwealth.com.au E: support@selfwealth.com.au
This trade was executed and cleared by OpenMarkets Australia Ltd ABN 38 090 472 012,
AFSL 246 705, Market Particpant of ASX, CHI­X and NSX.
Sell Confirmation
MR JOHN DOE Account Number: 1234567
JOHN DOE A/C Reference No: T20210701123456­1
1 LONG ROAD Trade Date: 24 May 2021
SYDNEY NSW Settlement Date: 26 May 2021
2000, AUS Market: ASX
WE HAVE SOLD ON YOUR ACCOUNT
Quantity Security Code Security Description Price +1 Consideration Currency
397 WPL WOODSIDE PETROLEUM 21.88 $8,686.36 AUD
Brokerage* $9.50 AUD
Adviser Fee* $0.00 AUD
Net Value $8,676.86 AUD
GST included in this invoice is $0.86
The confirmation is a tax invoice ­ please retain for tax purposes. If this confirmation does not correspond with your records please contact us immediately at
support@selfwealth.com.au
Settlement Instructions All documents and security holder information (including a HIN or SRN) must be provided to OpenMarkets by 9am AEST on the Settlement Date.
This transaction will be settled in to your linked cash account or in accordance with your instructions on the Settlement Date.
Contract Comments
* Inclusive of GST
+1 Standard Financial Rounding Applied (if applicable)
This confirmation is provided to you by each of SelfWealth and OpenMarkets. The Brokerage and Adviser fees set out in this confirmation are charged by SelfWealth.
OpenMarkets has not charged you any fees for the above transaction(s). The above transaction(s) and this confirmation are issued subject to the directions, decisions
and requirements of the operator of the relevant Market, ASIC Market Integrity Rules, the operating rules of the relevant Market, and, where relevant, the Clearing
Rules of the relevant Clearing Facility and the Settlement Rules of the relevant Settlement Facility, the customs and usages of the relevant Market and the correction of
errors and omissions. If this confirmation relates to multiple transactions, those transactions may have been completed on ASX or CHI­X.”
Generated At: 26 May 2021 18:29:01 PM Page: 1 of 1
PDF author: ''
PDFBox Version: 1.8.16
-----------------------------------------
SelfWealth Limited ABN: 52 154 324 428 AFSL 421789 W: www.selfwealth.com.au E: support@selfwealth.com.au
This trade was executed and cleared by OpenMarkets Australia Ltd ABN 38 090 472 012,
AFSL 246 705, Market Particpant of ASX, CHI­X and NSX.
Sell Confirmation
MR JOHN DOE Account Number: 1234567
JOHN DOE A/C Reference No: T20210701123456­1
1 LONG ROAD Trade Date: 24 May 2021
SYDNEY NSW Settlement Date: 26 May 2021
2000, AUS Market: ASX
WE HAVE SOLD ON YOUR ACCOUNT
Quantity Security Code Security Description Price +1 Consideration Currency
397 WPL WOODSIDE PETROLEUM 21.88 $8,686.36 AUD
Brokerage* $9.50 AUD
Adviser Fee* $0.00 AUD
Net Value $8,676.86 AUD
GST included in this invoice is $0.86
The confirmation is a tax invoice ­ please retain for tax purposes. If this confirmation does not correspond with your records please contact us immediately at
support@selfwealth.com.au
Settlement Instructions All documents and security holder information (including a HIN or SRN) must be provided to OpenMarkets by 9am AEST on the Settlement Date.
This transaction will be settled in to your linked cash account or in accordance with your instructions on the Settlement Date.
Contract Comments
* Inclusive of GST
+1 Standard Financial Rounding Applied (if applicable)
This confirmation is provided to you by each of SelfWealth and OpenMarkets. The Brokerage and Adviser fees set out in this confirmation are charged by SelfWealth.
OpenMarkets has not charged you any fees for the above transaction(s). The above transaction(s) and this confirmation are issued subject to the directions, decisions
and requirements of the operator of the relevant Market, ASIC Market Integrity Rules, the operating rules of the relevant Market, and, where relevant, the Clearing
Rules of the relevant Clearing Facility and the Settlement Rules of the relevant Settlement Facility, the customs and usages of the relevant Market and the correction of
errors and omissions. If this confirmation relates to multiple transactions, those transactions may have been completed on ASX or CHI­X.”
Generated At: 26 May 2021 18:29:01 PM Page: 1 of 1
Expand Up @@ -20,14 +20,15 @@ public SelfWealthPDFExtractor(Client client)
super(client);

addBankIdentifier("SelfWealth"); //$NON-NLS-1$
addBankIdentifier("Selfwealth"); //$NON-NLS-1$

addBuySellTransaction();
}

@Override
public String getLabel()
{
return "SelfWealth"; //$NON-NLS-1$
return "SelfWealth Ltd"; //$NON-NLS-1$
}

private void addBuySellTransaction()
Expand Down