Пример #1
0
 def start(self, solitude):
     solitude.get_transaction.return_value = {
         "status": constants.STATUS_COMPLETED,
         "notes": self.notes,
         "type": constants.TYPE_PAYMENT,
         "uuid": self.transaction_uuid,
     }
     tasks.start_pay(self.transaction_uuid, self.notes)
Пример #2
0
 def start(self, solitude):
     solitude.get_transaction.return_value = {
             'status': constants.STATUS_COMPLETED,
             'notes': self.notes,
             'type': constants.TYPE_PAYMENT,
             'uuid': self.transaction_uuid
     }
     tasks.start_pay(self.transaction_uuid, self.notes)
Пример #3
0
 def start(self, marketplace, solitude):
     prices = mock.Mock()
     prices.get_object.return_value = self.prices
     marketplace.webpay.prices.return_value = prices
     solitude.get_transaction.return_value = {
         'status': constants.STATUS_CANCELLED,
         'notes': self.notes,
         'type': constants.TYPE_PAYMENT,
         'uuid': self.transaction_uuid
     }
     tasks.start_pay(self.transaction_uuid, self.notes, self.user_uuid)
Пример #4
0
 def start(self, marketplace, solitude):
     prices = mock.Mock()
     prices.get_object.return_value = self.prices
     marketplace.webpay.prices.return_value = prices
     solitude.get_transaction.return_value = {
         'status': constants.STATUS_COMPLETED,
         'notes': self.notes,
         'type': constants.TYPE_PAYMENT,
         'uuid': self.transaction_uuid
     }
     tasks.start_pay(self.transaction_uuid, self.notes)
Пример #5
0
 def start(self):
     prices = mock.Mock()
     prices.get_object.return_value = self.prices
     self.mkt.webpay.prices.return_value = prices
     self.solitude.get_transaction.return_value = {
         'status': constants.STATUS_CANCELLED,
         'notes': self.notes,
         'type': constants.TYPE_PAYMENT,
         'uuid': self.transaction_uuid
     }
     tasks.start_pay(self.transaction_uuid, self.notes, self.user_uuid,
                     [p.name for p in self.providers])
Пример #6
0
 def start(self):
     prices = mock.Mock()
     prices.get_object.return_value = self.prices
     self.mkt.webpay.prices.return_value = prices
     self.solitude.get_transaction.return_value = {
         'status': constants.STATUS_CANCELLED,
         'notes': self.notes,
         'type': constants.TYPE_PAYMENT,
         'uuid': self.transaction_uuid
     }
     tasks.start_pay(self.transaction_uuid, self.notes, self.user_uuid,
                     [p.name for p in self.providers])
Пример #7
0
    def test_bango_used_when_boku_supported_but_no_price(self):
        mcc, mnc = api.BokuProvider.network_data.keys()[0]
        self.providers = api.ProviderHelper.supported_providers(
            mcc=mcc, mnc=mnc)

        self.solitude.generic.seller.get_object_or_404.return_value = {
            'resource_pk': 1,
            'uuid': self.boku_seller_uuid,
            'resource_uri': '/generic/seller/1/'
        }

        self.solitude.generic.product.get_object_or_404.return_value = {
            'resource_uri': '/generic/product/1/',
            'public_id': 'public_id',
            'seller_uuids': {
                'bango': self.bango_seller_uuid,
                'boku': self.boku_seller_uuid,
            },
            'seller': '/generic/seller/1',
            'external_id': 'external_id',
        }

        def no_boku_price(pricePoint, provider):
            if provider == 'boku':
                return {'prices': []}
            return {'prices': [{'price': '0.99'}]}

        pricey = mock.Mock()
        pricey.get_object.side_effect = no_boku_price
        self.mkt.webpay.prices.return_value = pricey

        tasks.start_pay(self.transaction_uuid, self.notes, self.user_uuid,
                        [p.name for p in self.providers])

        self.solitude.bango.product.get_object_or_404.assert_called_with(
            seller_product__seller=1,
            seller_product__external_id='external_id'
        )
        self.solitude.bango.billing.post.assert_called_with({
            'application_size': None,
            'icon_url': mock.ANY,
            'pageTitle': 'Virtual Sword',
            'prices': [{'price': '0.99'}],
            'redirect_url_onerror': 'http://testserver/mozpay/bango/error',
            'redirect_url_onsuccess': 'http://testserver/mozpay/bango/success',
            'seller_product_bango': mock.ANY,
            'source': 'other',
            'transaction_uuid': 'webpay:some-id',
            'user_uuid': 'some-user-uuid'
        })
        ok_(self.mkt.webpay.prices.call_count, 2)