Пример #1
0
 def setUp(self):
     self.uuid = 'sample:uid'
     self.sellers = utils.make_sellers(self.uuid)
     self.seller = self.sellers.seller
     self.product = self.sellers.product
     self.trans = Transaction.objects.create(
         amount=5, seller_product=self.product,
         provider=constants.PROVIDER_BANGO, uuid=self.uuid,
         status=constants.STATUS_COMPLETED)
     self.url = reverse('bango:refund-list')
     self.seller_bango = self.sellers.bango
Пример #2
0
 def setUp(self):
     """
     Generates 3 statuses with different lifetimes of 5, 20 and 35 days
     to test both default and custom `lifetime` parameter.
     """
     sellers = utils.make_sellers()
     for i in (5, 20, 35):
         status = Status.objects.create(
             seller_product_bango=sellers.product_bango, )
         # Work around due to the `auto_now_add` option
         status.created = date.today() - timedelta(days=i)
         status.save()
Пример #3
0
 def setUp(self):
     self.trans_uuid = 'some-transaction-uid'
     sellers = utils.make_sellers(uuid='seller-uuid')
     self.seller = sellers.seller
     self.product = sellers.product
     self.trans = Transaction.objects.create(
         amount=1, provider=constants.SOURCE_BANGO,
         seller_product=self.product,
         uuid=self.trans_uuid,
         uid_pay='external-trans-uid'
     )
     self.url = self.get_list_url('notification')
Пример #4
0
 def setUp(self):
     self.uuid = 'sample:uid'
     self.sellers = utils.make_sellers(self.uuid)
     self.seller = self.sellers.seller
     self.product = self.sellers.product
     self.trans = Transaction.objects.create(
         amount=5,
         seller_product=self.product,
         provider=constants.PROVIDER_BANGO,
         uuid=self.uuid,
         status=constants.STATUS_COMPLETED)
     self.url = reverse('bango:refund-list')
     self.seller_bango = self.sellers.bango
Пример #5
0
 def setUp(self):
     self.api_name = 'bango'
     self.refund_uuid = 'sample:refund'
     self.sellers = utils.make_sellers('sample:uuid')
     self.seller = self.sellers.seller
     self.product = self.sellers.product
     self.refund = Transaction.objects.create(
         amount=5, seller_product=self.product,
         type=constants.TYPE_REFUND,
         provider=constants.PROVIDER_BANGO,
         uuid=self.refund_uuid, uid_pay='asd',
         status=constants.STATUS_COMPLETED)
     self.url = '/bango/refund/status/'
Пример #6
0
 def setUp(self):
     """
     Generates 3 statuses with different lifetimes of 5, 20 and 35 days
     to test both default and custom `lifetime` parameter.
     """
     sellers = utils.make_sellers()
     for i in (5, 20, 35):
         status = Status.objects.create(
             seller_product_bango=sellers.product_bango,
         )
         # Work around due to the `auto_now_add` option
         status.created = date.today() - timedelta(days=i)
         status.save()
Пример #7
0
 def create(self, without_product_bango=False):
     """
     The `without_product_bango` boolean is useful to test
     `SellerProductBango` objects creation and duplicates.
     """
     self.sellers = utils.make_sellers(uuid=self.uuid)
     self.seller = self.sellers.seller
     self.seller_bango = self.sellers.bango
     self.seller_product = self.sellers.product
     if without_product_bango:
         self.sellers.product_bango.delete()
     self.seller_bango_uri = self.get_detail_url("package", self.seller_bango.pk)
     self.seller_product_uri = self.get_detail_url("product", self.seller_product.pk, api_name="generic")
     self.package_uri = self.get_detail_url("package", self.seller_bango.pk)
Пример #8
0
    def setUp(self):
        self.refund_uuid = 'sample:refund'
        self.sellers = utils.make_sellers('sample:uuid')
        self.seller = self.sellers.seller
        self.product = self.sellers.product
        self.refund = Transaction.objects.create(
            amount=5,
            seller_product=self.product,
            type=constants.TYPE_REFUND,
            provider=constants.PROVIDER_BANGO,
            uuid=self.refund_uuid,
            uid_pay='asd',
            status=constants.STATUS_COMPLETED)

        self.url = reverse('bango:refund-list')
Пример #9
0
 def create(self, without_product_bango=False):
     """
     The `without_product_bango` boolean is useful to test
     `SellerProductBango` objects creation and duplicates.
     """
     self.buyer = Buyer.objects.create(uuid=samples.good_billing_request["user_uuid"])
     self.sellers = utils.make_sellers(uuid=self.uuid)
     self.seller = self.sellers.seller
     self.seller_bango = self.sellers.bango
     self.seller_product = self.sellers.product
     if without_product_bango:
         self.sellers.product_bango.delete()
     self.seller_bango_uri = self.seller_bango.get_uri()
     self.seller_product_uri = self.seller_product.get_uri()
     # Not sure why this is the same as seller bango uri.
     self.package_uri = self.seller_bango.get_uri()
Пример #10
0
 def create(self, without_product_bango=False):
     """
     The `without_product_bango` boolean is useful to test
     `SellerProductBango` objects creation and duplicates.
     """
     self.sellers = utils.make_sellers(uuid=self.uuid)
     self.seller = self.sellers.seller
     self.seller_bango = self.sellers.bango
     self.seller_product = self.sellers.product
     if without_product_bango:
         self.sellers.product_bango.delete()
     self.seller_bango_uri = self.get_detail_url('package',
                                                 self.seller_bango.pk)
     self.seller_product_uri = self.get_detail_url('product',
                                                   self.seller_product.pk,
                                                   api_name='generic')
     self.package_uri = self.get_detail_url('package', self.seller_bango.pk)
Пример #11
0
 def create(self, without_product_bango=False):
     """
     The `without_product_bango` boolean is useful to test
     `SellerProductBango` objects creation and duplicates.
     """
     self.buyer = Buyer.objects.create(
         uuid=samples.good_billing_request['user_uuid'])
     self.sellers = utils.make_sellers(uuid=self.uuid)
     self.seller = self.sellers.seller
     self.seller_bango = self.sellers.bango
     self.seller_product = self.sellers.product
     if without_product_bango:
         self.sellers.product_bango.delete()
     self.seller_bango_uri = self.seller_bango.get_uri()
     self.seller_product_uri = self.seller_product.get_uri()
     # Not sure why this is the same as seller bango uri.
     self.package_uri = self.seller_bango.get_uri()
Пример #12
0
    def setUp(self):
        self.api_name = "bango"
        self.refund_uuid = "sample:refund"
        self.sellers = utils.make_sellers("sample:uuid")
        self.seller = self.sellers.seller
        self.product = self.sellers.product
        self.refund = Transaction.objects.create(
            amount=5,
            seller_product=self.product,
            type=constants.TYPE_REFUND,
            provider=constants.PROVIDER_BANGO,
            uuid=self.refund_uuid,
            uid_pay="asd",
            status=constants.STATUS_COMPLETED,
        )

        self.url = reverse("bango:refund-list")
Пример #13
0
 def create(self, without_product_bango=False):
     """
     The `without_product_bango` boolean is useful to test
     `SellerProductBango` objects creation and duplicates.
     """
     self.buyer = Buyer.objects.create(
         uuid=samples.good_billing_request['user_uuid'])
     self.sellers = utils.make_sellers(uuid=self.uuid)
     self.seller = self.sellers.seller
     self.seller_bango = self.sellers.bango
     self.seller_product = self.sellers.product
     if without_product_bango:
         self.sellers.product_bango.delete()
     self.seller_bango_uri = self.get_detail_url('package',
                                                 self.seller_bango.pk)
     self.seller_product_uri = self.get_detail_url('product',
                                                   self.seller_product.pk,
                                                   api_name='generic')
     self.package_uri = self.get_detail_url('package', self.seller_bango.pk)
Пример #14
0
 def setUp(self):
     self.trans_uuid = 'some-transaction-uid'
     sellers = utils.make_sellers(uuid='seller-uuid')
     self.seller = sellers.seller
     self.product = sellers.product
     self.token = '<bango-guid>'
     self.response_code = OK
     self.response_msg = 'Success'
     self.bango_trans_id = '56789'
     self.trans = Transaction.objects.create(
         amount=1, provider=constants.PROVIDER_BANGO,
         seller_product=self.product,
         uuid=self.trans_uuid,
         uid_pay='external-trans-uid'
     )
     self.url = reverse('bango:notification')
     self.sig = sign(self.trans_uuid)
     p = patch('lib.bango.forms.get_client')
     self.addCleanup(p.stop)
     self.get_client = p.start()
Пример #15
0
 def setUp(self):
     self.trans_uuid = 'some-transaction-uid'
     sellers = utils.make_sellers(uuid='seller-uuid')
     self.seller = sellers.seller
     self.product = sellers.product
     self.token = '<bango-guid>'
     self.response_code = OK
     self.response_msg = 'Success'
     self.bango_trans_id = '56789'
     self.trans = Transaction.objects.create(
         amount=1,
         provider=constants.PROVIDER_BANGO,
         seller_product=self.product,
         uuid=self.trans_uuid,
         uid_pay='external-trans-uid')
     self.url = self.get_list_url('notification')
     self.sig = sign(self.trans_uuid)
     p = patch('lib.bango.forms.get_client')
     self.addCleanup(p.stop)
     self.get_client = p.start()
Пример #16
0
 def setUp(self):
     self.trans_uuid = "some-transaction-uid"
     sellers = utils.make_sellers(uuid="seller-uuid")
     self.seller = sellers.seller
     self.product = sellers.product
     self.token = "<bango-guid>"
     self.response_code = OK
     self.response_msg = "Success"
     self.bango_trans_id = "56789"
     self.trans = Transaction.objects.create(
         amount=1,
         provider=constants.PROVIDER_BANGO,
         seller_product=self.product,
         uuid=self.trans_uuid,
         uid_pay="external-trans-uid",
     )
     self.url = self.get_list_url("notification")
     self.sig = sign(self.trans_uuid)
     p = patch("lib.bango.forms.get_client")
     self.addCleanup(p.stop)
     self.get_client = p.start()