diff --git a/src/Handlers/AfterPayOld.php b/src/Handlers/AfterPayOld.php
index 5eea20a1..dc674522 100644
--- a/src/Handlers/AfterPayOld.php
+++ b/src/Handlers/AfterPayOld.php
@@ -243,19 +243,54 @@ private function getBirthDate(RequestDataBag $dataBag)
*/
private function getItemVatCategory(array $item): int
{
- if (!isset($item['taxId']) ||
- !is_string($item['taxId'])
- ) {
- return 4;
+ $vatRate = null;
+ if (isset($item['vatRate'])) {
+ $vatRate = (float)$item['vatRate'];
}
- $taxId = $item['taxId'];
- $taxAssociation = $this->settingsService->getSetting('afterpayOldtax');
+ if (isset($item['taxId']) && is_string($item['taxId'])) {
+ $taxId = $item['taxId'];
+ $taxAssociation = $this->settingsService->getSetting('afterpayOldtax');
- if (is_array($taxAssociation) && isset($taxAssociation[$taxId])) {
- return (int)$taxAssociation[$taxId];
+ if (is_array($taxAssociation) && isset($taxAssociation[$taxId])) {
+ $mappedCategory = (int)$taxAssociation[$taxId];
+
+ if ($mappedCategory > 0) {
+ return $mappedCategory;
+ }
+ }
+ }
+
+ if ($vatRate !== null) {
+ return $this->mapVatRateToVatCategory($vatRate);
}
return 4;
}
+
+ /**
+ * Map a VAT percentage to Riverty/AfterPay VAT category
+ *
+ * 1 = High rate
+ * 2 = Low rate
+ * 3 = Zero rate
+ * 4 = Null rate (unknown)
+ * 5 = Middle rate
+ */
+ private function mapVatRateToVatCategory(float $vatRate): int
+ {
+ if ($vatRate <= 0.0001) {
+ return 3;
+ }
+
+ if ($vatRate < 12.0) {
+ return 2;
+ }
+
+ if ($vatRate >= 20.0) {
+ return 1;
+ }
+
+ return 5;
+ }
}
diff --git a/src/Resources/public/images/zakelijk-op-rekening-abn-amro.svg b/src/Resources/public/images/zakelijk-op-rekening-abn-amro.svg
new file mode 100644
index 00000000..caeaad6a
--- /dev/null
+++ b/src/Resources/public/images/zakelijk-op-rekening-abn-amro.svg
@@ -0,0 +1,12 @@
+
diff --git a/src/Resources/views/storefront/buckaroo/payments/zakelijk-op-rekening-abn-amro.svg b/src/Resources/views/storefront/buckaroo/payments/zakelijk-op-rekening-abn-amro.svg
new file mode 100644
index 00000000..caeaad6a
--- /dev/null
+++ b/src/Resources/views/storefront/buckaroo/payments/zakelijk-op-rekening-abn-amro.svg
@@ -0,0 +1,12 @@
+