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
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()
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())
def get_headers(self, decode_receipt): decode_receipt.return_value = '' return verify.Verify(3615, '').get_headers(1)
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))
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)())
def get_headers(self, decode_receipt): decode_receipt.return_value = '' return verify.get_headers(verify.Verify('', mock.Mock()))