Skip to content

Commit

Permalink
Merge branch 'dev' for release 6.3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
nflorentin committed Nov 23, 2023
2 parents 23b9f97 + 10acf9d commit b75751c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 21 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog Fab-manager

## v6.3.4 2023 November 23

- fix a bug: wrong amount when pay a reservation with payment schedule
- fix regresion on PaymentScheduleItemWorker from v6.3.2

## v6.3.3 2023 November 14

- fix a bug: wrong currency unit for locale fr-CH
Expand Down
17 changes: 8 additions & 9 deletions app/workers/payment_schedule_item_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ class PaymentScheduleItemWorker
include Sidekiq::Worker

def perform(record_id = nil)
p "WORKER CURRENCY_LOCALE=#{CURRENCY_LOCALE}"
# if record_id
# psi = PaymentScheduleItem.find(record_id)
# check_item(psi)
# else
# PaymentScheduleItem.where.not(state: 'paid').where('due_date < ?', Time.current).each do |item|
# check_item(item)
# end
# end
if record_id
psi = PaymentScheduleItem.find(record_id)
check_item(psi)
else
PaymentScheduleItem.where.not(state: 'paid').where('due_date < ?', Time.current).each do |item|
check_item(item)
end
end
end

# @param psi [PaymentScheduleItem]
Expand Down
21 changes: 10 additions & 11 deletions lib/pay_zen/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,14 @@ def create_subscription(payment_schedule, order_id, *_args)
rrule: rrule(payment_schedule),
order_id: order_id
}
if first_item.details['adjustment']&.zero? && first_item.details['other_items']&.zero?
initial_amount = first_item.amount
initial_amount -= payment_schedule.wallet_amount if payment_schedule.wallet_amount
if initial_amount.zero?
params[:effect_date] = (first_item.due_date + 1.month).iso8601
params[:rrule] = rrule(payment_schedule, -1)
else
params[:initial_amount] = payzen_amount(initial_amount)
params[:initial_amount_number] = 1
end
initial_amount = first_item.amount
initial_amount -= payment_schedule.wallet_amount if payment_schedule.wallet_amount
if initial_amount.zero?
params[:effect_date] = (first_item.due_date + 1.month).iso8601
params[:rrule] = rrule(payment_schedule, -1)
else
params[:initial_amount] = payzen_amount(initial_amount)
params[:initial_amount_number] = 1
end
pz_subscription = client.create_subscription(**params)

Expand Down Expand Up @@ -141,7 +139,8 @@ def transaction_matches?(transaction, payment_schedule_item)
transaction_date = Time.zone.parse(transaction['creationDate']).to_date

amount = payment_schedule_item.amount
if payment_schedule_item.details['adjustment']&.zero? && payment_schedule_item.payment_schedule.wallet_amount
if payment_schedule_item == payment_schedule_item.payment_schedule.ordered_items.first &&
payment_schedule_item.payment_schedule.wallet_amount
amount -= payment_schedule_item.payment_schedule.wallet_amount
end

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fab-manager",
"version": "6.3.3",
"version": "6.3.4",
"description": "Fab-manager is the FabLab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks and your marker's projects.",
"keywords": [
"fablab",
Expand Down

0 comments on commit b75751c

Please sign in to comment.