示例#1
0
def status_change(request):
    """ Update URL should have ?merchant_transaction_id=<id> set. """
    transaction_id = request.GET.get('merchant_transaction_id')

    if not transaction_id:
        logger.warning('No transaction id in status change message')
        return HttpResponseNotFound('')

    logger.debug('Received status change message for transaction_id %s',
                 transaction_id)

    try:
        payment_cluster = \
            PaymentCluster.get_by_transaction_id(transaction_id)
    except (PaymentCluster.DoesNotExist, ValueError):
        logger.warning(
            'Status change for payment cluster with merchant \
                        transaction_id %s not matched', transaction_id)
        return HttpResponseNotFound('')

    payment_cluster.update_status()

    logger.debug('Status for payment with transaction_id %s updated',
                 transaction_id)

    # Allways return a 200
    return HttpResponse('')
示例#2
0
def status_change(request):
    """ Update URL should have ?merchant_transaction_id=<id> set. """
    transaction_id = request.GET.get('merchant_transaction_id')

    if not transaction_id:
        logger.warning('No transaction id in status change message')
        return HttpResponseNotFound('')

    logger.debug('Received status change message for transaction_id %s',
                 transaction_id)

    try:
        payment_cluster = \
            PaymentCluster.get_by_transaction_id(transaction_id)
    except (PaymentCluster.DoesNotExist, ValueError):
        logger.warning('Status change for payment cluster with merchant \
                        transaction_id %s not matched', transaction_id)
        return HttpResponseNotFound('')

    payment_cluster.update_status()

    logger.debug('Status for payment with transaction_id %s updated',
                 transaction_id)

    # Allways return a 200
    return HttpResponse('')
示例#3
0
    def test_transaction_id(self):
        """ Test transaction_id -> pk resolution. """

        pc = PaymentCluster(pk=self.get_transaction_id())
        pc.save()

        transaction_id = pc.transaction_id
        pc2 = PaymentCluster.get_by_transaction_id(transaction_id)

        self.assertEqual(pc.pk, pc2.pk)
示例#4
0
    def test_transaction_id(self):
        """ Test transaction_id -> pk resolution. """

        pc = PaymentCluster(pk=self.get_transaction_id())
        pc.save()

        transaction_id = pc.transaction_id
        pc2 = PaymentCluster.get_by_transaction_id(transaction_id)

        self.assertEqual(pc.pk, pc2.pk)