Esempio n. 1
0
class TestExpressCheckoutAPI(unittest.TestCase):
    def setUp(self):
        self.api_username = getattr(local_settings, 'PAYPAL_API_USERNAME', None)
        self.api_password = getattr(local_settings, 'PAYPAL_API_PASSWORD', None)
        self.api_signature = getattr(local_settings, 'PAYPAL_API_SIGNATURE', None)
        self.api = ExpressCheckoutAPI(self.api_username, self.api_password, self.api_signature,\
            'http://site.com', 'http://site.com', 'http://site.com', debug=True)

    def test_set_express_checkout(self):
        vars = {
            'MAXAMT': 50,
            'NOSHIPPING': 1,
            'ALLOWNOTE': 0,
            'SOLUTIONTYPE': 'Mark',
            'PAYMENTREQUEST_0_AMT': 0,
            'PAYMENTREQUEST_0_PAYMENTACTION': 'Authorization',
            'L_PAYMENTREQUEST_0_ITEMCATEGORY0': 'Digital',
            'L_BILLINGTYPE0': 'RecurringPayments',
            'L_BILLINGAGREEMENTDESCRIPTION0': 'AppHosted service',
        }
        resp, cont = self.api.do_request('SetExpressCheckout', vars)
        self.assertTrue(cont.has_key('ACK'))
        self.assertEqual(cont['ACK'].lower(), 'success')
        self.assertTrue(cont.has_key('TOKEN'))
Esempio n. 2
0
 def setUp(self):
     self.api_username = getattr(local_settings, 'PAYPAL_API_USERNAME', None)
     self.api_password = getattr(local_settings, 'PAYPAL_API_PASSWORD', None)
     self.api_signature = getattr(local_settings, 'PAYPAL_API_SIGNATURE', None)
     self.api = ExpressCheckoutAPI(self.api_username, self.api_password, self.api_signature,\
         'http://site.com', 'http://site.com', 'http://site.com', debug=True)