def test_rejected(self): self.transaction.status = constants.STATUS_COMPLETED self.transaction.save() reversal({'tracking_id': self.transaction_uuid, 'pay_key': 'foo'}, {'amount': {'amount': 10, 'currency': 'USD'}}) types = [s.type for s in Transaction.objects.all()] eq_([constants.TYPE_REVERSAL, constants.TYPE_PAYMENT], types)
def test_rejected_already_done(self): PaypalTransaction.objects.create( type=constants.TYPE_REVERSAL, status=constants.STATUS_PENDING, correlation_id='asd-123', pay_key='asd-123', seller=self.paypal, amount=Decimal('-10'), currency='USD', uuid=self.transaction_uuid + 'another', related=self.transaction) eq_(reversal({'tracking_id': self.transaction_uuid}, {}), False)
def test_rejected_already_done(self): Transaction.objects.create( type=constants.TYPE_REVERSAL, status=constants.STATUS_PENDING, uid_support='asd-123', uid_pay='asd-123', seller_product=self.product, amount=Decimal('-10'), currency='USD', provider=constants.SOURCE_PAYPAL, uuid=self.transaction_uuid + 'another', related=self.transaction) eq_(reversal({'tracking_id': self.transaction_uuid}, {}), False)
def test_rejected_already_done(self): Transaction.objects.create( type=constants.TYPE_REVERSAL, status=constants.STATUS_PENDING, uid_support='asd-123', uid_pay='asd-123', seller_product=self.product, amount=Decimal('-10'), currency='USD', provider=constants.PROVIDER_PAYPAL, uuid=self.transaction_uuid + 'another', related=self.transaction) eq_(reversal({'tracking_id': self.transaction_uuid}, {}), False)
def test_reject_missing(self): eq_(reversal({'tracking_id': self.transaction_uuid + 'nope'}, {}), False)