mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-17 06:52:27 +01:00
Notify all admins on the creation of a refund invoice
This commit is contained in:
parent
510c802ab1
commit
6aa3c0caeb
@ -10,6 +10,7 @@
|
||||
- Configuration of phone number in members registration forms: can be required or optional, depending on `PHONE_REQUIRED` configuration
|
||||
- Improved user experience in defining slots in the calendar management
|
||||
- Improved notification email to the member when a rolling subscription is taken
|
||||
- Notify all admins on the creation of a refund invoice
|
||||
- Calendar management: improved legend display and visual behavior
|
||||
- Handle Ctrl^C in upgrade scripts
|
||||
- Updated moment-timezone
|
||||
|
@ -5,6 +5,8 @@
|
||||
class Avoir < Invoice
|
||||
belongs_to :invoice
|
||||
|
||||
after_create :notify_admins_refund_created
|
||||
|
||||
validates :payment_method, inclusion: { in: %w[stripe cheque transfer none cash wallet] }
|
||||
|
||||
attr_accessor :invoice_items_ids
|
||||
@ -16,4 +18,12 @@ class Avoir < Invoice
|
||||
def expire_subscription
|
||||
user.subscription.expire(DateTime.current)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def notify_admins_refund_created
|
||||
NotificationCenter.call type: 'notify_admin_refund_created',
|
||||
receiver: User.admins,
|
||||
attached_object: self
|
||||
end
|
||||
end
|
||||
|
@ -47,6 +47,7 @@ class NotificationType
|
||||
notify_admin_archive_complete
|
||||
notify_privacy_policy_changed
|
||||
notify_admin_import_complete
|
||||
notify_admin_refund_created
|
||||
]
|
||||
# deprecated:
|
||||
# - notify_member_subscribed_plan_is_changed
|
||||
|
@ -0,0 +1,5 @@
|
||||
json.title notification.notification_type
|
||||
json.description t('.refund_created',
|
||||
AMOUNT: number_to_currency(notification.attached_object.total / 100.00),
|
||||
USER: notification.attached_object.invoicing_profile&.full_name)
|
||||
json.url notification_url(notification, format: :json)
|
@ -0,0 +1,8 @@
|
||||
<%= render 'notifications_mailer/shared/hello', recipient: @recipient %>
|
||||
|
||||
<p><%= t('.body.refund_created',
|
||||
AMOUNT: number_to_currency(@attached_object.total / 100.00),
|
||||
INVOICE: @attached_object.invoice.reference,
|
||||
USER: @attached_object.invoicing_profile&.full_name) %>
|
||||
</p>
|
||||
<p><a href="<%= "#{root_url}api/invoices/#{@attached_object.id}/download" %>" target="_blank"><%= t('.body.download') %></a></p>
|
@ -351,6 +351,9 @@ en:
|
||||
notify_privacy_policy_changed:
|
||||
policy_updated: "Privacy policy updated."
|
||||
click_to_show: "Click here to consult"
|
||||
notify_admin_refund_created:
|
||||
refund_created: "A refund of %{AMOUNT} has been created for user %{USER}"
|
||||
|
||||
statistics:
|
||||
# statistics tools for admins
|
||||
subscriptions: "Subscriptions"
|
||||
|
@ -351,6 +351,9 @@ es:
|
||||
notify_privacy_policy_changed:
|
||||
policy_updated: "Privacy policy updated." # missing translation
|
||||
click_to_show: "Click here to consult" # missing translation
|
||||
notify_admin_refund_created:
|
||||
refund_created: "A refund of %{AMOUNT} has been created for user %{USER}" # missing translation
|
||||
|
||||
statistics:
|
||||
# statistics tools for admins
|
||||
subscriptions: "Suscripciones"
|
||||
|
@ -351,6 +351,8 @@ fr:
|
||||
notify_privacy_policy_changed:
|
||||
policy_updated: "Nouvelle mise à jour de la Politique de confidentialité."
|
||||
click_to_show: "Cliquez ici pour la consulter"
|
||||
notify_admin_refund_created:
|
||||
refund_created: "Un avoir de %{AMOUNT} a été généré pour l'utilisateur %{USER}"
|
||||
|
||||
statistics:
|
||||
# outil de statistiques pour les administrateurs
|
||||
|
@ -313,5 +313,11 @@ en:
|
||||
content_html: "<p>We wish to inform you that we have just updated our privacy policy.</p><p>We may change our privacy policy regularly. In accordance with the regulations, you will receive a notification for each update.</p><p>By accessing or using our services after the privacy policy update, we will consider that you agree its terms, updates included.</p>"
|
||||
link_to_policy: "Cliquez ici pour consultez la politique de confidentialité."
|
||||
|
||||
notify_admin_refund_created:
|
||||
subject: "A refund has been generated"
|
||||
body:
|
||||
refund_created: "A refund of %{AMOUNT} has been generated on invoice %{INVOICE} of user %{USER}"
|
||||
download: "Click here to download this refund invoice"
|
||||
|
||||
shared:
|
||||
hello: "Hello %{user_name}"
|
||||
|
@ -299,7 +299,7 @@ es:
|
||||
warning_last_closed_period_over_1_year: "Please remind to periodically close your accounting periods. Last closed period ended at %{LAST_END}."
|
||||
warning_no_closed_periods: "Please remind to periodically close your accounting periods. You have to close periods from %{FIRST_DATE}."
|
||||
|
||||
notify_admin_archive_complete: #translation_missing
|
||||
notify_admin_archive_complete: #translation_missing
|
||||
subject: "Archiving completed"
|
||||
body:
|
||||
archive_complete: "You have closed the accounting period from %{START} to %{END}. Archiving of data is now complete."
|
||||
@ -307,11 +307,17 @@ es:
|
||||
here: "here."
|
||||
save_on_secured: "Remember that you must save this archive on a secured external support, which may be requested by the tax authorities during a check."
|
||||
|
||||
notify_privacy_policy_changed: #translation_missing
|
||||
notify_privacy_policy_changed: #translation_missing
|
||||
subject: "Privacy policy updated"
|
||||
body:
|
||||
content_html: "<p>We wish to inform you that we have just updated our privacy policy.</p><p>We may change our privacy policy regularly. In accordance with the regulations, you will receive a notification for each update.</p><p>By accessing or using our services after the privacy policy update, we will consider that you agree its terms, updates included.</p>"
|
||||
link_to_policy: "Cliquez ici pour consultez la politique de confidentialité."
|
||||
|
||||
notify_admin_refund_created: #translation_missing
|
||||
subject: "A refund has been generated"
|
||||
body:
|
||||
refund_created: "A refund of %{AMOUNT} has been generated on invoice %{INVOICE} of user %{USER}"
|
||||
download: "Click here to download this refund invoice"
|
||||
|
||||
shared:
|
||||
hello: "¡Hola %{user_name}!"
|
||||
|
@ -313,5 +313,11 @@ fr:
|
||||
content_html: "<p>Nous souhaitons vous signaler que nous venons de mettre à jour notre politique de confidentialité.</p><p>Nous pouvons apporter régulièrement des modifications à notre politique de confidentialité. Conformément à la réglementation, une notification vous sera envoyée à chaque mise à jour.</p><p>En accédant ou en utilisant nos services après la mise à jour de la Politique de confidentialité, nous considérerons que vous acceptez les termes de celle-ci, mises à jour comprises.</p>"
|
||||
link_to_policy: "Cliquez ici pour consultez la politique de confidentialité."
|
||||
|
||||
notify_admin_refund_created:
|
||||
subject: "Un avoir a été généré"
|
||||
body:
|
||||
refund_created: "Un avoir de %{AMOUNT} a été généré sur la facture %{INVOICE} de l'utilisateur %{USER}"
|
||||
download: "Cliquez ici pour télécharger cet avoir"
|
||||
|
||||
shared:
|
||||
hello: "Bonjour %{user_name}"
|
||||
|
@ -299,7 +299,7 @@ pt:
|
||||
warning_last_closed_period_over_1_year: "Please remind to periodically close your accounting periods. Last closed period ended at %{LAST_END}."
|
||||
warning_no_closed_periods: "Please remind to periodically close your accounting periods. You have to close periods from %{FIRST_DATE}."
|
||||
|
||||
notify_admin_archive_complete: #translation_missing
|
||||
notify_admin_archive_complete: #translation_missing
|
||||
subject: "Archiving completed"
|
||||
body:
|
||||
archive_complete: "You have closed the accounting period from %{START} to %{END}. Archiving of data is now complete."
|
||||
@ -307,11 +307,17 @@ pt:
|
||||
here: "here."
|
||||
save_on_secured: "Remember that you must save this archive on a secured external support, which may be requested by the tax authorities during a check."
|
||||
|
||||
notify_privacy_policy_changed: #translation_missing
|
||||
notify_privacy_policy_changed: #translation_missing
|
||||
subject: "Privacy policy updated"
|
||||
body:
|
||||
content_html: "<p>We wish to inform you that we have just updated our privacy policy.</p><p>We may change our privacy policy regularly. In accordance with the regulations, you will receive a notification for each update.</p><p>By accessing or using our services after the privacy policy update, we will consider that you agree its terms, updates included.</p>"
|
||||
link_to_policy: "Cliquez ici pour consultez la politique de confidentialité."
|
||||
|
||||
notify_admin_refund_created: #translation_missing
|
||||
subject: "A refund has been generated"
|
||||
body:
|
||||
refund_created: "A refund of %{AMOUNT} has been generated on invoice %{INVOICE} of user %{USER}"
|
||||
download: "Click here to download this refund invoice"
|
||||
|
||||
shared:
|
||||
hello: "Olá %{user_name}"
|
||||
|
@ -349,8 +349,10 @@ pt:
|
||||
notify_admin_archive_complete: # missing translation
|
||||
archive_complete: "Data archiving from %{START} to %{END} is done. <a href='api/accounting_periods/%{ID}/archive' target='_blank'>click here to download</a>. Remember to save it on an external secured media." # missing translation
|
||||
notify_privacy_policy_changed:
|
||||
policy_updated: "Privacy policy updated." # missing translation
|
||||
click_to_show: "Click here to consult" # missing translation
|
||||
policy_updated: "Privacy policy updated." # missing translation
|
||||
click_to_show: "Click here to consult" # missing translation
|
||||
notify_admin_refund_created:
|
||||
refund_created: "A refund of %{AMOUNT} has been created for user %{USER}" # missing translation
|
||||
|
||||
statistics:
|
||||
# statistics tools for admins
|
||||
|
Loading…
x
Reference in New Issue
Block a user