diff --git a/CHANGELOG.md b/CHANGELOG.md index 68e466357..7e2bd4923 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog Fab-manager - Fix a bug: unable to show wallet payment mean for invoice +- Fix a bug: PayZen amount of subscription compute error for Coupon validity per user = forever - improvement: remove show_username_in_admin_list setting - improvement: show invoice payment method in accounting line - [TODO DEPLOY] `rails fablab:setup:build_accounting_lines` diff --git a/lib/pay_zen/service.rb b/lib/pay_zen/service.rb index 4f2dfbac6..e9597af0f 100644 --- a/lib/pay_zen/service.rb +++ b/lib/pay_zen/service.rb @@ -16,9 +16,11 @@ class PayZen::Service < Payment::Service order = PayZen::Order.new.get(order_id, operation_type: 'VERIFICATION') client = PayZen::Charge.new token_id = order['answer']['transactions'].first['paymentMethodToken'] + coupon = payment_schedule.coupon + amount = coupon && coupon.validity_per_user == 'forever' ? first_item.amount : first_item.details['recurring'].to_i params = { - amount: payzen_amount(first_item.details['recurring'].to_i), + amount: payzen_amount(amount), effect_date: first_item.due_date.iso8601, payment_method_token: token_id, rrule: rrule(payment_schedule, first_item.due_date),