diff --git a/modules/swile/browser.py b/modules/swile/browser.py index 596d337701da4ce28fbee25a9d5ffe0c7b4614e7..75b394714214693437ad506619740f5e2d9b78d9 100644 --- a/modules/swile/browser.py +++ b/modules/swile/browser.py @@ -140,9 +140,11 @@ def _parse_transaction(self, payment): return # Check if transaction is only on cb card + # if 'details' is empty we put default on '' because it's probably a + # 'MEAL_VOUCHER_RENEWAL' or a 'MEAL_VOUCHER_EXPIRATION' if ( Dict('type')(payment) != 'MEAL_VOUCHER_CREDIT' - and len(Dict('details')(payment)) == 1 + and len(Dict('details', default='')(payment)) == 1 and Dict('details/0/type')(payment) == 'CREDIT_CARD' ): return @@ -158,6 +160,9 @@ def _parse_transaction(self, payment): if Dict('type')(payment) == 'MEAL_VOUCHER_CREDIT': transaction.amount = CleanDecimal.US(Dict('amount/value'))(payment) transaction.type = Transaction.TYPE_DEPOSIT + elif Dict('type')(payment) in ('MEAL_VOUCHER_RENEWAL', 'MEAL_VOUCHER_EXPIRATION'): + transaction.amount = CleanDecimal.US(Dict('amount/value'))(payment) + transaction.type = Transaction.TYPE_BANK else: transaction.amount = CleanDecimal.US(Dict('details/0/amount'))(payment) transaction.type = Transaction.TYPE_CARD