def decode_callback(self, data, signature): """ https://www.liqpay.com/en/doc/callback :param data: function result base64.b64encode(json_string) :param signature: function result base64.b64encode(hashlib.sha1(private_key + data + private_key)) """ return decode_response_data(self.private_key, data, signature)
def test_response_decoder(self): data = dict(field='value') encoded = encode_data(data) signature = generate_signature(self.private_key, encoded) decoded = decode_response_data(self.private_key, encoded, signature) self.assertEqual(data, decoded) self.assertRaises(SignatureMismatch, decode_response_data, self.private_key, encoded, 'privateKey2')