예제 #1
0
 def create(self, data, request=None):
     stuff = {'user': {'type': 'directed-identifier'}}
     stuff.update(data)
     key = jwt.rsa_load(settings.WEBAPPS_RECEIPT_KEY)
     receipt = jwt.encode(stuff, key, u'RS512')
     v = verify.Verify(receipt, request)
     v.decoded = v.decode()
     return v
예제 #2
0
    def verify_signed_receipt(self, signed_receipt, check_purchase=True):
        # Ensure that the verify code is using the test database cursor.
        verifier = verify.Verify(signed_receipt,
                                 RequestFactory().get('/verifyme/').META)
        verifier.cursor = connection.cursor()

        if check_purchase:
            return verifier.check_full()
        else:
            return verifier.check_without_purchase()
예제 #3
0
 def get_decode(self, addon_id, receipt):
     # Ensure that the verify code is using the test database cursor.
     v = verify.Verify(addon_id, receipt)
     v.cursor = connection.cursor()
     return json.loads(v())
예제 #4
0
 def get_headers(self, decode_receipt):
     decode_receipt.return_value = ''
     return verify.Verify(3615, '').get_headers(1)
예제 #5
0
 def get_decode(self, addon_id, receipt, check_purchase=True):
     # Ensure that the verify code is using the test database cursor.
     v = verify.Verify(addon_id, receipt, {})
     v.cursor = connection.cursor()
     return json.loads(v(check_purchase=check_purchase))
예제 #6
0
 def get_decode(self, receipt, check_purchase=True):
     # Ensure that the verify code is using the test database cursor.
     v = verify.Verify(receipt, RequestFactory().get('/verifyme/').META)
     v.cursor = connection.cursor()
     name = 'check_full' if check_purchase else 'check_without_purchase'
     return json.loads(getattr(v, name)())
예제 #7
0
 def get_headers(self, decode_receipt):
     decode_receipt.return_value = ''
     return verify.get_headers(verify.Verify('', mock.Mock()))