Ejemplo n.º 1
0
    def test_status_update_rejected(self):
        o = OrderFactory.create(state='pending')
        t = TransactionFactory.create(status='pending', order=o)

        data = dict(Status=dict(Code=dict(Code=BUCKAROO_690_REJECTED)))

        update_transaction(transaction=t, data=data)

        assert t.status == t.STATUS_REJECTED
Ejemplo n.º 2
0
    def test_status_update_cancelled(self):
        o = OrderFactory.create(state='pending')
        t = TransactionFactory.create(status='pending', order=o)

        data = dict(Status=dict(Code=dict(
            Code=BUCKAROO_890_CANCELLED_BY_USER)))

        update_transaction(transaction=t, data=data)

        assert t.status == t.STATUS_CANCELLED
Ejemplo n.º 3
0
    def test_status_update_success(self):
        o = OrderFactory.create(state='pending')
        t = TransactionFactory.create(status='pending', order=o)

        data = dict(Status=dict(Code=dict(Code=BUCKAROO_190_SUCCESS)))

        update_transaction(transaction=t, data=data)

        assert t.status == t.STATUS_SUCCESS
        assert t.last_push is not None
Ejemplo n.º 4
0
    def test_update_no_code(self):
        o = OrderFactory.create(state='pending')
        t = TransactionFactory.create(order=o)
        data = {1: 1}

        assert t.last_push is None

        update_transaction(transaction=t, data=data)

        assert t.status == t.STATUS_NEW
        assert t.last_push is not None
Ejemplo n.º 5
0
    def test_order_status_not_pending(self):

        order = OrderFactory.create(total=100, owner=self.user, state='new')
        self.ideal_data['order'] = order.id

        response = self.client.post(reverse('buckaroo_transaction_list'),
                                    self.ideal_data,
                                    format='json')

        assert response.status_code == status.HTTP_400_BAD_REQUEST
        assert response.data[0] == 'Incorrect order status: new'
Ejemplo n.º 6
0
    def test_user_not_owner(self):
        user = UserFactory.create()
        order = OrderFactory.create(total=100, owner=user)
        self.ideal_data['order'] = order.id

        response = self.client.post(reverse('buckaroo_transaction_list'),
                                    self.ideal_data,
                                    format='json')

        assert response.status_code == status.HTTP_403_FORBIDDEN
        assert response.data['detail'] == 'User is not owner of the order'
Ejemplo n.º 7
0
    def setUp(self):
        self.user = UserFactory.create()
        self.client.force_login(self.user)
        self.order = OrderFactory.create(total=100,
                                         owner=self.user,
                                         state='pending')

        self.ideal_data = dict(bank_code='ABNANL2A',
                               card=False,
                               order=1,
                               payment_method='ideal',
                               redirect_url=None,
                               status=None,
                               uuid=None)