Skip to content

Commit

Permalink
Example coolblue (#428)
Browse files Browse the repository at this point in the history
* Add Coolblue example (advanced lines example)
  • Loading branch information
bosd authored Mar 31, 2023
1 parent 97573eb commit 3770a1e
Show file tree
Hide file tree
Showing 5 changed files with 269 additions and 0 deletions.
117 changes: 117 additions & 0 deletions src/invoice2data/extract/templates/nl/nl.be.coolblue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# SPDX-License-Identifier: MIT
fields:
issuer:
parser: regex
regex:
- '(Coolblue\s(?:B.V.|Belgi.\sN.V.))'
amount:
parser: regex
regex:
- Totaal\s+[€]\s+([-]?\d{0,3}[.]?\d{1,3}[,]\d{2})\n
type: float
amount_untaxed:
parser: regex
regex:
- Exclusief BTW\s+[€]\s+([-]?\d{0,3}[.]?\d{1,3}[,]\d{2})
type: float
partner_coc:
parser: regex
regex:
- KvK\s\w+\s+(\d{8})
narration:
parser: regex
regex:
- (Ordernummer[:]\s+\d+)
note:
parser: regex
regex:
- (Klantnummer[:]\s+\d+)
- (Ordernummer[:]\s+\d+)
- (Orderdatum[:]\s+\d{1,2} \w+ \d{4})
- (Alles voor een glimlach[.])
group: join
partner_website:
parser: regex
regex:
- www[.](coolblue[.]\w{2})
partner_name:
parser: regex
regex:
- '(Coolblue\s(?:B.V.|Belgi.\sN.V.))'
country_code:
parser: regex
regex: BTW\s(\w{2})\d{9}
partner_zip:
parser: regex
regex: '(3012 CN|2600)'
partner_city:
parser: regex
regex: (Rotterdam|Berchem)
partner_street:
parser: regex
regex: '(Gildeweg\s+8|Borsbeeksebrug\s+28|Weena\s+\d+)'
vat:
parser: regex
regex:
- 'BTW\s+((?:BE|NL)\w+)'
bic:
parser: regex
regex:
- BIC\s+(\w{8,11})
iban:
parser: regex
regex:
- IBAN\s+(\w{10,30})
date:
parser: regex
regex:
- Factuurdatum[:]\s+(\d{1,2} \w+ \d{4})
type: date
invoice_number:
parser: regex
regex:
- actuurnummer[:]\s+(\d{8,12})
payment_method:
- (iDEAL)
- (Bancontact)
- (AMEX)
- (AMERICAN EXPRESS)
- (VISA)
- (MCARD)
- (CONTANT)
- (?i)(Paypal)
lines:
parser: lines
rules:
- start: 'Artikel\s+Aantal'
end: 'Exclusief BTW'
first_line:
- ^(?P<name>(\S+(?:\s\S+)*))\s+(?P<qty>[-]?\d+)\s+[€]?\s+(?P<price_unit>(\d{,3}[.]?\d{,3}[,]\d{2}))\s+(?P<line_tax_percent>\d+)[%]?\s+[€]?\s(?P<price_subtotal>([-]?\d{,3}[.]?\d+[,]\d{2}))
- ^\s+(?P<line_note>(Serienummer[:]\s\w+(?:\s\S+)*))
line:
- ^\s+(?P<name>(\w+(?:\s\S+)*))\s+(?:P<qty>[-]?\d+)\s*$
types:
qty: int
price_unit: float
line_tax_percent: int
price_subtotal: float
# second block to specific parse thuiskopij heffing
- start: 'Artikel\s+Aantal'
end: 'Exclusief BTW'
line:
- ^\s+(?P<name>(\S+(?:\s\S+)*))\s+(?P<qty>[-]?\d+)\s+[€]?\s+(?P<line_tax_percent>\d+)[%]?\s+[€]?\s(?P<price_subtotal>([-]?\d{0,3}[.]?\d+[,]\d{2}))
types:
qty: int
price_unit: float
line_tax_percent: int
price_subtotal: float
keywords:
- Coolblue
- (NL810433941B01|BE0867686774)
- factuur
-
options:
currency: EUR
languages:
- nl
decimal_separator: ','
69 changes: 69 additions & 0 deletions tests/compare/coolblue1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
[
{
"issuer": "Coolblue B.V.",
"amount": 717.97,
"amount_untaxed": 593.36,
"partner_coc": "24330087",
"narration": "Ordernummer: 12572103",
"note": "Klantnummer: 6669263 Ordernummer: 12572103 Orderdatum: 18 april 2014 Alles voor een glimlach.",
"partner_name": "Coolblue B.V.",
"country_code": "NL",
"partner_zip": "3012 CN",
"partner_city": "Rotterdam",
"partner_street": "Weena 664",
"vat": "NL810433941B01",
"bic": "INGBNL2A",
"iban": "NL50INGB0683251309",
"date": "2014-04-19",
"invoice_number": "993548900",
"payment_method": "iDEAL",
"lines": [
{
"name": "Apple iPad Air Wifi 16 GB Zilver",
"qty": 1,
"price_unit": 399.0,
"line_tax_percent": 21,
"price_subtotal": 399.0
},
{
"line_note": "Serienummer: SDMPP373MPP15"
},
{
"name": "Decoded Leather Slim Cover Apple iPad Air 2 Zwart",
"qty": 1,
"price_unit": 69.99,
"line_tax_percent": 21,
"price_subtotal": 69.99
},
{
"name": "Nintendo 3DS XL Wit + Blauw",
"qty": 1,
"price_unit": 189.0,
"line_tax_percent": 21,
"price_subtotal": 189.0
},
{
"name": "Nintendo AC-adapter",
"qty": 1,
"price_unit": 14.99,
"line_tax_percent": 21,
"price_subtotal": 14.99
},
{
"name": "Mario Kart 7 3DS",
"qty": 1,
"price_unit": 44.99,
"line_tax_percent": 21,
"price_subtotal": 44.99
},
{
"name": "Incl. Thuiskopieheffing: Thuiskopie €3.50",
"qty": 1,
"line_tax_percent": 21,
"price_subtotal": 4.24
}
],
"currency": "EUR",
"desc": "Invoice from Coolblue"
}
]
Binary file added tests/compare/coolblue1.pdf
Binary file not shown.
83 changes: 83 additions & 0 deletions tests/compare/coolblue2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
[
{
"issuer": "Coolblue B.V.",
"amount": 4904.94,
"amount_untaxed": 4053.67,
"partner_coc": "24330087",
"narration": "Ordernummer: 12508334",
"note": "Klantnummer: 6669263 Ordernummer: 12508334 Orderdatum: 29 maart 2014 Alles voor een glimlach.",
"partner_name": "Coolblue B.V.",
"country_code": "NL",
"partner_zip": "3012 CN",
"partner_city": "Rotterdam",
"partner_street": "Weena 664",
"vat": "NL810433941B01",
"bic": "INGBNL2A",
"iban": "NL50INGB0683251309",
"date": "2014-03-29",
"invoice_number": "992288600",
"payment_method": "iDEAL",
"lines": [
{
"name": "Decoded Leather Sleeve 15,4'' Vintage Bruin",
"qty": 2,
"price_unit": 99.99,
"line_tax_percent": 21,
"price_subtotal": 199.98
},
{
"name": "Apple MacBook Pro Retina 13,3'' + Apple Magic Mouse",
"qty": 1,
"price_unit": 2321.0,
"line_tax_percent": 21,
"price_subtotal": 2321.0
},
{
"name": "Microsoft Office Mac Home and Student 2011 NL PKC",
"qty": 1,
"price_unit": 124.99,
"line_tax_percent": 21,
"price_subtotal": 124.99
},
{
"name": "HP USB 3.0 Port Replicator 3005pr (H1L08ET)",
"qty": 1,
"price_unit": 159.99,
"line_tax_percent": 21,
"price_subtotal": 159.99
},
{
"name": "MSI GS60 2QE-226NL Ghost Pro",
"qty": 1,
"price_unit": 1999.0,
"line_tax_percent": 21,
"price_subtotal": 1999.0
},
{
"line_note": "Serienummer: GS60 2QE-226NLK141900003666"
},
{
"name": "Hex Outpost Origin Rugzak 15'' Grijs",
"qty": 1,
"price_unit": 79.99,
"line_tax_percent": 21,
"price_subtotal": 79.99
},
{
"name": "Case-Mate Barely There Case Sony Xperia Z3 Transparant",
"qty": 1,
"price_unit": 19.99,
"line_tax_percent": 21,
"price_subtotal": 19.99
},
{
"name": "Incl. Thuiskopieheffing: Thuiskopie €3.50",
"qty": 1,
"line_tax_percent": 21,
"price_subtotal": 4.24
}
],
"currency": "EUR",
"desc": "Invoice from Coolblue"
}
]
Binary file added tests/compare/coolblue2.pdf
Binary file not shown.

0 comments on commit 3770a1e

Please sign in to comment.