Beispiel #1
0
    def test_payment_ipn(self):
        views.verify_ipn = Mock(return_value="VERIFIED")
        views.utils.http_utils = Mock(return_value="f74b9f96-f89a-4cfe-813f-5f86df1cb37f")
        self.data = {u'protection_eligibility': [u'Ineligible'], u'last_name': [u'Buyer'], 
        u'txn_id': [u'29B086831A497564T'], u'receiver_email': [u'*****@*****.**'], 
        u'payment_status': [u'Completed'], u'payment_gross': [u'100.00'], u'residence_country': [u'US'], 
        u'payer_status': [u'verified'], u'txn_type': [u'subscr_payment'], 
        u'payment_date': [u'00:21:27 Jul 20, 2013 PDT'], u'first_name': [u'Sample'], 
        u'item_name': [u'Nation Wide Basic Plan'], u'charset': [u'windows-1252'], 
        u'custom': [u'*****@*****.**'], u'notify_version': [u'3.7'], 
        u'transaction_subject': [u'Nation Wide Basic Plan'], u'test_ipn': [u'1'], 
        u'receiver_id': [u'UJW568NKYXBR8'], u'business': [u'*****@*****.**'], 
        u'payer_id': [u'P9CUA4KE7JPWU'], 
        u'verify_sign': [u'Ai-FzWGYDKmBlnQl-iAuG4atWtVOAYUT5uh0b-cGS1JWp30A6iztyGCO'], 
        u'subscr_id': [u'I-4C7W7BVETGSD'], u'payment_fee': [u'3.20'], 
        u'mc_fee': [u'3.20'], u'mc_currency': [u'USD'], 
        u'payer_email': [u'*****@*****.**'], u'payment_type': [u'instant'], 
        u'mc_gross': [u'100.00'], u'ipn_track_id': [u'c12713fac59fd']}

        self.data.update({'payer_email' : '*****@*****.**'})
        request = self.factory.post(reverse('paypal_ipn'), data=self.data)
        request.session = dict(ipaddress='192.168.1.1') 
        response = views.paypal_ipn(request)
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.content, 'ok') 
        ipn = PayPalIPN.objects.filter(username=self.data.get('custom'), txn_type='subscr_payment')[0]
        self.assertEqual(ipn.subscr_id, self.data.get('subscr_id'))
        self.assertEqual(ipn.txn_id, self.data.get('txn_id'))   
Beispiel #2
0
    def test_sigup_ipn(self):
        views.utils.http_utils = Mock(return_value="VERIFIED")

        request = self.factory.post(reverse('paypal_ipn'), data=self.data)
        request.session = dict(ipaddress='192.168.1.1') 
        response = views.paypal_ipn(request)
        print response.content
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.content, 'ok')
        ipn = PayPalIPN.objects.filter(username=self.data.get('custom'), txn_type='subscr_signup')[0]
        self.assertEqual(ipn.subscr_id, self.data.get('subscr_id'))
Beispiel #3
0
    def test_sigup_ipn(self):
        views.utils.http_utils = Mock(return_value="VERIFIED")

        request = self.factory.post(reverse('paypal_ipn'), data=self.data)
        request.session = dict(ipaddress='192.168.1.1')
        response = views.paypal_ipn(request)
        print response.content
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.content, 'ok')
        ipn = PayPalIPN.objects.filter(username=self.data.get('custom'),
                                       txn_type='subscr_signup')[0]
        self.assertEqual(ipn.subscr_id, self.data.get('subscr_id'))
Beispiel #4
0
    def test_payment_ipn(self):
        views.verify_ipn = Mock(return_value="VERIFIED")
        views.utils.http_utils = Mock(
            return_value="f74b9f96-f89a-4cfe-813f-5f86df1cb37f")
        self.data = {
            u'protection_eligibility': [u'Ineligible'],
            u'last_name': [u'Buyer'],
            u'txn_id': [u'29B086831A497564T'],
            u'receiver_email': [u'*****@*****.**'],
            u'payment_status': [u'Completed'],
            u'payment_gross': [u'100.00'],
            u'residence_country': [u'US'],
            u'payer_status': [u'verified'],
            u'txn_type': [u'subscr_payment'],
            u'payment_date': [u'00:21:27 Jul 20, 2013 PDT'],
            u'first_name': [u'Sample'],
            u'item_name': [u'Nation Wide Basic Plan'],
            u'charset': [u'windows-1252'],
            u'custom': [u'*****@*****.**'],
            u'notify_version': [u'3.7'],
            u'transaction_subject': [u'Nation Wide Basic Plan'],
            u'test_ipn': [u'1'],
            u'receiver_id': [u'UJW568NKYXBR8'],
            u'business': [u'*****@*****.**'],
            u'payer_id': [u'P9CUA4KE7JPWU'],
            u'verify_sign':
            [u'Ai-FzWGYDKmBlnQl-iAuG4atWtVOAYUT5uh0b-cGS1JWp30A6iztyGCO'],
            u'subscr_id': [u'I-4C7W7BVETGSD'],
            u'payment_fee': [u'3.20'],
            u'mc_fee': [u'3.20'],
            u'mc_currency': [u'USD'],
            u'payer_email': [u'*****@*****.**'],
            u'payment_type': [u'instant'],
            u'mc_gross': [u'100.00'],
            u'ipn_track_id': [u'c12713fac59fd']
        }

        self.data.update({'payer_email': '*****@*****.**'})
        request = self.factory.post(reverse('paypal_ipn'), data=self.data)
        request.session = dict(ipaddress='192.168.1.1')
        response = views.paypal_ipn(request)
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.content, 'ok')
        ipn = PayPalIPN.objects.filter(username=self.data.get('custom'),
                                       txn_type='subscr_payment')[0]
        self.assertEqual(ipn.subscr_id, self.data.get('subscr_id'))
        self.assertEqual(ipn.txn_id, self.data.get('txn_id'))