Ejemplo n.º 1
0
 def test_inapp_refund(self, log):
     for type in [amo.CONTRIB_REFUND, amo.CONTRIB_CHARGEBACK]:
         contribution = self.make_inapp_contribution(type=type)
         res = self.verify_receipt_data(
             get_sample_inapp_receipt(contribution))
         eq_(res['status'], 'refunded')
     eq_(log.call_count, 2)
Ejemplo n.º 2
0
 def test_product_barf_store_data_for_inapp(self):
     contribution = self.make_inapp_contribution()
     for storedata in (urlencode({'id': 'NaN'}),
                       urlencode({'id': '123', 'contrib': 'NaN'}),
                       'NaN'):
         data = get_sample_inapp_receipt(contribution)
         data['product'] = {'url': 'http://f.com', 'storedata': storedata}
         res = self.verify_receipt_data(data)
         eq_(res['status'], 'invalid')
         eq_(res['reason'], 'WRONG_STOREDATA')
Ejemplo n.º 3
0
    def test_invalid_inapp_id_returns_invalid(self):
        contribution = self.make_inapp_contribution()
        receipt = get_sample_inapp_receipt(contribution)
        receipt['product']['storedata'] = urlencode({
            'contrib': contribution.id,
            'inapp_id': 'not_an_id',
        })

        res = self.verify_receipt_data(receipt)
        eq_(res['status'], 'invalid')
        eq_(res['reason'], 'WRONG_STOREDATA')
Ejemplo n.º 4
0
    def test_inapp_product_matches_contribution(self):
        contribution = self.make_inapp_contribution()
        receipt = get_sample_inapp_receipt(contribution)
        receipt['product']['storedata'] = urlencode({
            'contrib': contribution.id,
            # Set the inapp_id to the wrong id
            'inapp_id': contribution.inapp_product_id + 1,
        })

        res = self.verify_receipt_data(receipt)
        eq_(res['status'], 'invalid')
        eq_(res['reason'], 'NO_PURCHASE')
Ejemplo n.º 5
0
 def test_inapp_no_charge(self):
     contribution = self.make_inapp_contribution(type=amo.CONTRIB_NO_CHARGE)
     res = self.verify_receipt_data(get_sample_inapp_receipt(contribution))
     eq_(res['status'], 'ok', res)
Ejemplo n.º 6
0
 def test_inapp_purchased(self):
     contribution = self.make_inapp_contribution()
     res = self.verify_receipt_data(get_sample_inapp_receipt(contribution))
     eq_(res['status'], 'ok', res)