def notify_transaction(self, transaction, silent=False):
        data = {
            'type': 'transaction',
            'amount': transaction.amount,
            'is_bonification': transaction.is_bonification,
            'is_euro_purchase': transaction.is_euro_purchase,
            'concept': transaction.concept
        }

        title = 'Ya tienes tu bonificación!' if transaction.is_bonification else 'Has recibido un movimiento'
        notify_user(self.user, title=title, message=data['concept'], data=data, silent=silent)
Esempio n. 2
0
    def cancel_payment(self):

        if self.status != STATUS_PENDING:
            print('Not pending!')
            return
            # TODO: create exception

        notify_user(user=self.sender, data={}, title="Pago cancelado", message="La entidad ha cancelado el pago")

        print("Payment cancelled")
        self.status = STATUS_CANCELLED
        self.processed = timezone.now()
        self.save()
Esempio n. 3
0
    def notify_receiver(self, silent=False):

        user_type, sender_instance = self.sender.get_related_entity()
        data = {
            'type': 'payment',
            'amount': self.currency_amount,
            'total_amount': self.total_amount,
            'id': str(self.pk),
            'user_type': user_type,
            'sender': str(sender_instance)
        }

        title = 'Has recibido un nuevo pago!'
        notify_user(self.receiver, title=title, data=data, silent=silent)
    def notify_receiver(self, silent=False):

        user_type, sender_instance = self.sender.get_related_entity()
        data = {
            'type': 'payment',
            'amount': self.currency_amount,
            'total_amount': self.total_amount,
            'id': str(self.pk),
            'user_type': user_type,
            'sender': str(sender_instance)
        }

        print 'Notifying payment receiver'
        title = 'Nuevo pago pendiente de confirmar'
        notify_user(self.receiver, title=title, data=data, silent=silent)