def test_recurring_payment_ipn(self): """ The wat the code is written in PayPalIPN.send_signals the recurring_payment will never be sent because the paypal ipn contains a txn_id, if this test failes you might break some compatibility """ update = { "recurring_payment_id": "BN5JZ2V7MLEV4", "txn_type": "recurring_payment", } params = IPN_POST_PARAMS.copy() params.update(update) self.got_signal = False self.signal_obj = None def handle_signal(sender, **kwargs): self.got_signal = True self.signal_obj = sender with warnings.catch_warnings(record=True): recurring_payment.connect(handle_signal) response = self.paypal_post(params) self.assertEqual(response.status_code, 200) ipns = PayPalIPN.objects.all() self.assertEqual(len(ipns), 1) self.assertFalse(self.got_signal)
def test_recurring_payment_ipn(self): """ The wat the code is written in PayPalIPN.send_signals the recurring_payment will never be sent because the paypal ipn contains a txn_id, if this test failes you might break some compatibility """ update = { "recurring_payment_id": "BN5JZ2V7MLEV4", "txn_type": "recurring_payment", } params = IPN_POST_PARAMS.copy() params.update(update) self.got_signal = False self.signal_obj = None def handle_signal(sender, **kwargs): self.got_signal = True self.signal_obj = sender recurring_payment.connect(handle_signal) response = self.paypal_post(params) self.assertEqual(response.status_code, 200) ipns = PayPalIPN.objects.all() self.assertEqual(len(ipns), 1) self.assertFalse(self.got_signal)
def test_recurring_payment_ipn(self): """ The wat the code is written in PayPalIPN.send_signals the recurring_payment will never be sent because the paypal ipn contains a txn_id, if this test failes you might break some compatibility """ update = { 'recurring_payment_id': 'BN5JZ2V7MLEV4', 'txn_type': 'recurring_payment', } params = IPN_POST_PARAMS.copy() params.update(update) self.got_signal = False self.signal_obj = None def handle_signal(sender, **kwargs): self.got_signal = True self.signal_obj = sender recurring_payment.connect(handle_signal) response = self.client.post(reverse('paypal-ipn'), data=params) self.assertEqual(response.status_code, 200) ipns = PayPalIPN.objects.all() self.assertEqual(len(ipns), 1) self.assertFalse(self.got_signal)
def __init__(self, shop): self.shop = shop # Hook the payment was successful listener on the appropriate signal sent # by django-paypal (success_signal) assert settings.PAYPAL_RECEIVER_EMAIL, "You need to define a PAYPAL_RECEIVER_EMAIL in settings with the money recipient's email addresss" assert settings.PAYPAL_CURRENCY_CODE, "You need to define a PAYPAL_CURRENCY_CODE in settings with the currency code" success_signal.connect(self.payment_was_successful, weak=False) flagged_signal.connect(self.payment_was_flagged, weak=False) subscription_cancel_signal.connect(self.subscription_cancelled, weak=False) subscription_eot_signal.connect(self.subscription_expired, weak=False) subscription_modify_signal.connect(self.subscription_modified, weak=False) subscription_signup_signal.connect(self.subscription_signup_success, weak=False) recurring_create_signal.connect(self.recurring_created, weak=False) recurring_payment_signal.connect(self.recurring_payment, weak=False) recurring_cancel_signal.connect(self.recurring_cancelled, weak=False)
def test_recurring_payment_ipn(self): update = { "recurring_payment_id": "BN5JZ2V7MLEV4", "txn_type": "recurring_payment", } params = IPN_POST_PARAMS.copy() params.update(update) self.got_signal = False self.signal_obj = None def handle_signal(sender, **kwargs): self.got_signal = True self.signal_obj = sender recurring_payment.connect(handle_signal) response = self.paypal_post(params) self.assertEqual(response.status_code, 200) ipns = PayPalIPN.objects.all() self.assertEqual(len(ipns), 1) self.assertTrue(self.got_signal)