Skip to content

mail notification to origin and destination when transfer is done #247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from

Conversation

sseerrggii
Copy link
Contributor

@sseerrggii sseerrggii commented Mar 1, 2017

Queremos enviar un mail de notificación cuando se hace un pago de horas, tanto al receptor como al emisor:

  • Comprobar si el usuario tiene activas las notificaciones
  • Indicar a quien se ha pagado o de quien se ha recibido el pago, el concepto y el texto (comentario) del pago
  • Indicar el saldo actual del usuario
  • Link al perfil del usuario

Tarea Mail de notificación de pago explicada en http://community.coopdevs.org/t/timeoverflow-siguientes-pasos/139

#byebug
# mail notificación pago
PaymentNotifier.transfer_source(@account.accountable.display_name_with_uid,transfer.amount.to_f/3600).deliver_now
PaymentNotifier.transfer_destination(@source.accountable.display_name_with_uid,transfer.amount.to_f/3600).deliver_now
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probablemente deberiamos enviar los correos desde una callback del modelo Transfer, Mirate after_commit, puede ser incluso un observer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

me lo miro

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, please after_commit no 🙏

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eso acolparia mucho el modelo con la notificación y lo pagaríamos caro

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guay, me pondré a ello cuando te tenga al lado @enricostano 😉

hours, minutes = minutes.divmod(60)
raw format("%s%d:%02d", ("-" if sign < 0), hours, minutes)
else
mdash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Que es mdash? No lo veo definido en ningun sitio.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

esto... copy paste de /helpers/application_helper.rb función seconds_to_hm(seconds) 😬 me falto tampien copy paste de

def mdash
    raw "&mdash;"
end

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vas a necesitar raw tambien me temo.... y creo que es cosa de vistas...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ademas, no dupliques codigo. Muevelo y usa en todos sitios la clase esa.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me temo que estás haciendo de Ruby aquí. Si no me equivoco #strftime hace esto ya http://ruby-doc.org/stdlib-2.3.1/libdoc/date/rdoc/DateTime.html#method-i-strftime

@@ -0,0 +1,13 @@
class TimeFormatter < ActiveRecord::Base
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Este no es un model, no hace falta que herede de ActiveRecord::Base. Es una clase aislada, no tiene ninguna dependencia... creo... o te sirve para algo?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

hours, minutes = minutes.divmod(60)
raw format("%s%d:%02d", ("-" if sign < 0), hours, minutes)
else
mdash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ademas, no dupliques codigo. Muevelo y usa en todos sitios la clase esa.

#byebug
# mail notificación pago
PaymentNotifier.transfer_source(@account.accountable.display_name_with_uid,transfer.amount.to_f/3600).deliver_now
PaymentNotifier.transfer_destination(@source.accountable.display_name_with_uid,transfer.amount.to_f/3600).deliver_now
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, please after_commit no 🙏

hours, minutes = minutes.divmod(60)
raw format("%s%d:%02d", ("-" if sign < 0), hours, minutes)
else
mdash
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me temo que estás haciendo de Ruby aquí. Si no me equivoco #strftime hace esto ya http://ruby-doc.org/stdlib-2.3.1/libdoc/date/rdoc/DateTime.html#method-i-strftime

#byebug
# mail notificación pago
PaymentNotifier.transfer_source(@account.accountable.display_name_with_uid,transfer.amount.to_f/3600).deliver_now
PaymentNotifier.transfer_destination(@source.accountable.display_name_with_uid,transfer.amount.to_f/3600).deliver_now
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eso acolparia mucho el modelo con la notificación y lo pagaríamos caro

@sauloperez
Copy link
Collaborator

sauloperez commented Jan 11, 2018

Seguimos interesados en esto? Si ese es el caso me puedo encargar de acabarlo una vez mergeemos #264 para no abrir demasiados frentes. De todos modos, intentaria centrarnos en limpiar y refactorizar o que haga falta antes de meter nuevas features.

@sseerrggii
Copy link
Contributor Author

Cerramos esta PR, de momento no necesitamos esta funcioanlidad

@sseerrggii sseerrggii closed this Mar 11, 2019
@enricostano enricostano deleted the feature/mail-on-payment branch March 11, 2019 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants