def test_verify_and_log_wepay_checkout(self): self.assertTrue( Donation.verify_and_log_wepay_checkout(12345, 'Tester', False, True)) # Donation should be in the DB now self.assertEqual(Donation.query.all()[0].transaction_id, str(12345))
def ipn(): """Endpoint that receives Instant Payment Notifications (IPNs) from WePay. More info is available at https://www.wepay.com/developer/reference/ipn. """ # Checking the type of object (should be `checkout`) if 'checkout_id' in request.form: checkout_id = request.form['checkout_id'] else: # No need to return any errors in this case # TODO: Add logging there. return 'Invalid object_id.', 200 # Getting additional info that was passed with callback_uri during payment creation editor = request.args['editor'] anonymous = request.args['anonymous'] can_contact = request.args['can_contact'] result = Donation.verify_and_log_wepay_checkout(checkout_id, editor, anonymous, can_contact) if result is True: return "Recorded." return '', 200
def test_verify_and_log_wepay_checkout(self): self.assertTrue(Donation.verify_and_log_wepay_checkout(12345, 'Tester', False, True)) # Donation should be in the DB now self.assertEqual(Donation.query.all()[0].transaction_id, str(12345))