mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-26 20:54:21 +01:00
[bug] do not send notifications each hour for payment schedules deadlines
This commit is contained in:
parent
544b00e8a7
commit
f9e775ac35
@ -3,6 +3,7 @@
|
|||||||
- Improved the setup script
|
- Improved the setup script
|
||||||
- Fix a bug: unable to install a new instance with an external reverse proxy
|
- Fix a bug: unable to install a new instance with an external reverse proxy
|
||||||
- Fix a bug: do not display "powered by disqus" if Disqus is disabled
|
- Fix a bug: do not display "powered by disqus" if Disqus is disabled
|
||||||
|
- Fix a bug: do not send notifications each hour for payment schedules deadlines
|
||||||
|
|
||||||
## v4.7.2 2021 March 1st
|
## v4.7.2 2021 March 1st
|
||||||
- Updated yq to v4
|
- Updated yq to v4
|
||||||
|
@ -29,12 +29,15 @@ class PaymentScheduleItemWorker
|
|||||||
psi.update_attributes(state: 'paid', payment_method: 'stripe', stp_invoice_id: stp_invoice.id)
|
psi.update_attributes(state: 'paid', payment_method: 'stripe', stp_invoice_id: stp_invoice.id)
|
||||||
elsif stp_subscription.status == 'past_due' || stp_invoice.status == 'open'
|
elsif stp_subscription.status == 'past_due' || stp_invoice.status == 'open'
|
||||||
##### Stripe / Payment error
|
##### Stripe / Payment error
|
||||||
NotificationCenter.call type: 'notify_admin_payment_schedule_failed',
|
if psi.state == 'new'
|
||||||
receiver: User.admins_and_managers,
|
# notify only for new deadlines, to prevent spamming
|
||||||
attached_object: psi
|
NotificationCenter.call type: 'notify_admin_payment_schedule_failed',
|
||||||
NotificationCenter.call type: 'notify_member_payment_schedule_failed',
|
receiver: User.admins_and_managers,
|
||||||
receiver: psi.payment_schedule.user,
|
attached_object: psi
|
||||||
attached_object: psi
|
NotificationCenter.call type: 'notify_member_payment_schedule_failed',
|
||||||
|
receiver: psi.payment_schedule.user,
|
||||||
|
attached_object: psi
|
||||||
|
end
|
||||||
stp_payment_intent = Stripe::PaymentIntent.retrieve(stp_invoice.payment_intent, api_key: stripe_key)
|
stp_payment_intent = Stripe::PaymentIntent.retrieve(stp_invoice.payment_intent, api_key: stripe_key)
|
||||||
psi.update_attributes(state: stp_payment_intent.status,
|
psi.update_attributes(state: stp_payment_intent.status,
|
||||||
stp_invoice_id: stp_invoice.id,
|
stp_invoice_id: stp_invoice.id,
|
||||||
@ -42,8 +45,8 @@ class PaymentScheduleItemWorker
|
|||||||
else
|
else
|
||||||
psi.update_attributes(state: 'error')
|
psi.update_attributes(state: 'error')
|
||||||
end
|
end
|
||||||
else
|
elsif psi.state == 'new'
|
||||||
### Check
|
### Check (only new deadlines, to prevent spamming)
|
||||||
NotificationCenter.call type: 'notify_admin_payment_schedule_check_deadline',
|
NotificationCenter.call type: 'notify_admin_payment_schedule_check_deadline',
|
||||||
receiver: User.admins_and_managers,
|
receiver: User.admins_and_managers,
|
||||||
attached_object: psi
|
attached_object: psi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user