mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-18 07:52:23 +01:00
(bug) wrong amount when pay a reservation with payment schedule
This commit is contained in:
parent
28f62228b0
commit
b2c3851ddc
@ -1,5 +1,7 @@
|
||||
# Changelog Fab-manager
|
||||
|
||||
- fix a bug: wrong amount when pay a reservation with payment schedule
|
||||
|
||||
## v6.3.3 2023 November 14
|
||||
|
||||
- fix a bug: wrong currency unit for locale fr-CH
|
||||
|
@ -24,16 +24,14 @@ class PayZen::Service < Payment::Service
|
||||
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)
|
||||
|
||||
@ -141,7 +139,8 @@ class PayZen::Service < Payment::Service
|
||||
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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user