# coding=utf-8 import unittest import interface_factory import api_details interface = interface_factory.get_interface_obj() # TODO: implement the paypal account log-in as web-based? somehow implement with a bare-bones python web client so it's programmable? class TestExpressCheckout(unittest.TestCase): def setUp(self): self.returnurl = 'http://www.paypal.com' self.cancelurl = 'http://www.ebay.com' def test_sale(self): pass def test_authorize_and_delayed_capture(self): """ Tests a four-step checkout process involving the following flow:: One or more calls to `SetExpressCheckout`. --- User goes to PayPal, logs in, and confirms shipping, taxes, and total amount. --- A call to `GetExpressCheckoutDetails`. A call to `DoExpressCheckoutPayment`. A call to `DoAuthorization`. A call to `DoCapture`. """ setexp = interface.set_express_checkout(amt='10.00', returnurl=self.returnurl, \
# coding=utf-8 import unittest from paypal import PayPalAPIResponseError import interface_factory #import api_details interface = interface_factory.get_interface_obj() class TestDirectPayment(unittest.TestCase): def setUp(self): self.credit_card = { 'amt': '10.00', 'creditcardtype': 'Visa', 'acct': api_details.VISA_ACCOUNT_NO, 'expdate': api_details.VISA_EXPIRATION, 'cvv2': '123', 'firstname': 'John', 'lastname': 'Doe', 'street': '1313 Mockingbird Lane', 'city': 'Beverly Hills', 'state': 'CA', 'zip': '90110', 'countrycode': 'US', 'currencycode': 'USD', } def test_sale(self): sale = interface.do_direct_payment('Sale', **self.credit_card) self.assertTrue(sale.success)