Beispiel #1
0
    def __unicode__(self):
        return u'%s' % (self.client.title + ' ' + self.date.strftime('%Y %b %d %H:%M'))

    def __str__(self):
        return "{title} {date}".format(title=self.client.title, date=self.date.strftime('%Y %b %d %H:%M'))

    class Meta:
        verbose_name = "Корзина"
        verbose_name_plural = "Корзина"
        ordering = ['-date']


def payment_received(sender, **kwargs):
    """
    Handle payment after payment is recieved.
    :param sender:
    :param kwargs:
    """
    order = Orders.objects.get(pk=kwargs['InvId'])
    order.payment_status = True
    order.save()
    client = Clients.objects.get(pk=order.client.pk)
    client.unpaid_orders -= 1
    client.unpaid_sum -= order.order_sum
    client.orders_sum += order.order_sum
    client.save()

# Wait signal of successful payments
result_received.connect(payment_received)
Beispiel #2
0
#coding: utf-8
from django.db import models

class SuccessNotification(models.Model):
    InvId = models.IntegerField(u'Номер заказа', db_index=True)
    OutSum = models.CharField(u'Сумма', max_length=15)

    created_at = models.DateTimeField(u'Дата и время получения уведомления', auto_now_add=True)

    class Meta:
        verbose_name = u'Уведомление об успешном платеже'
        verbose_name_plural = u'Уведомления об успешных платежах (ROBOKASSA)'

    def __unicode__(self):
        return u'#%d: %s (%s)' % (self.InvId, self.OutSum, self.created_at)

# registering signals
from robokassa.receivers import place_order
from robokassa.signals import result_received
result_received.connect(place_order, dispatch_uid = "6601677768")


Beispiel #3
0
from pprint import pprint

from robokassa.signals import result_received


def payment_received(sender, **kwargs):
    pprint(kwargs)


result_received.connect(payment_received)
Beispiel #4
0
#coding: utf-8
from django.db import models


class SuccessNotification(models.Model):
    InvId = models.IntegerField(u'Номер заказа', db_index=True)
    OutSum = models.CharField(u'Сумма', max_length=15)

    created_at = models.DateTimeField(u'Дата и время получения уведомления',
                                      auto_now_add=True)

    class Meta:
        verbose_name = u'Уведомление об успешном платеже'
        verbose_name_plural = u'Уведомления об успешных платежах (ROBOKASSA)'

    def __unicode__(self):
        return u'#%d: %s (%s)' % (self.InvId, self.OutSum, self.created_at)


# registering signals
from robokassa.receivers import place_order
from robokassa.signals import result_received

result_received.connect(place_order, dispatch_uid="6601677768")