Skip to content

A local-first personal finance app

🐛 Pluggy.ai credit card transactions were inverted (#4628)

lelemm0cdaac694484
diff --git a/packages/sync-server/src/app-pluggyai/app-pluggyai.js b/packages/sync-server/src/app-pluggyai/app-pluggyai.js
index 10715cc990..3edd8e47eb 100644
--- a/packages/sync-server/src/app-pluggyai/app-pluggyai.js
+++ b/packages/sync-server/src/app-pluggyai/app-pluggyai.js
@@ -110,12 +110,19 @@ app.post(
newTrans.payeeName = getPayeeName(trans);
newTrans.notes = trans.descriptionRaw || trans.description;
+ if (account.type === 'CREDIT') {
+ if (trans.amountInAccountCurrency) {
+ trans.amountInAccountCurrency *= -1;
+ }
+
+ trans.amount *= -1;
+ }
+
let amountInCurrency = trans.amountInAccountCurrency ?? trans.amount;
amountInCurrency = Math.round(amountInCurrency * 100) / 100;
newTrans.transactionAmount = {
- amount:
- account.type === 'BANK' ? amountInCurrency : -amountInCurrency,
+ amount: amountInCurrency,
currency: trans.currencyCode,
};
diff --git a/upcoming-release-notes/4628.md b/upcoming-release-notes/4628.md
new file mode 100644
index 0000000000..765eeab5c8
--- /dev/null
+++ b/upcoming-release-notes/4628.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [lelemm]
+---
+
+Fixed Pluggy.ai credit card transactions inverted