Пример #1
0
    def test_configure(self):
        conf = dict(api_key=1,
                    api_login=2,
                    account_id=3,
                    merchant_id=4,
                    test=True,
                    payment_url='ham',
                    query_url='cheese')

        payu = PayU(**conf)

        assert payu.config['API_KEY'] == 1
        assert payu.config['API_LOGIN'] == 2
        assert payu.config['ACCOUNT_ID'] == 3
        assert payu.config['MERCHANT_ID'] == 4
        assert payu.config['TEST'] == True

        payu2 = PayU()
        payu2.configure(**conf)

        assert payu2.config['API_KEY'] == 1
        assert payu2.config['API_LOGIN'] == 2
        assert payu2.config['ACCOUNT_ID'] == 3
        assert payu2.config['MERCHANT_ID'] == 4
        assert payu2.config['TEST'] == True
Пример #2
0
class PayUTest(unittest.TestCase):

    def setUp(self):
        from payu import PayU
        self.payu = PayU()

    def test_create_token(self):
        response = self.payu.create_token(
            '10',
            'Juan Perez',
            'VISA',
            '4111111111111111',
            '2014/12'
        )
        self.assertTrue(response.get('code'))
        self.assertEqual(response.get('code'), 'SUCCESS')

    def test_get_tokens(self):
        response = self.payu.get_tokens(
            '10',
            'a6ab07a8-2bc6-4c39-9ad1-cc18d6d53bf8'
        )
        self.assertTrue(response.get('code'))
        self.assertEqual(response.get('code'), 'SUCCESS')

    def test_submit_transaction(self):
        response = self.payu.submit_transaction(
            'a6ab07a8-2bc6-4c39-9ad1-cc18d6d53bf8',
            'payment_test_00000001',
            'payment test',
            'http://localhost',
            100,
            '*****@*****.**'
        )
        self.assertTrue(response.get('code'))
        self.assertEqual(response.get('code'), 'SUCCESS')

        self.assertTrue(response.get('transactionResponse'))

        transactionResponse = response.get('transactionResponse')
        self.assertEqual(response.get('code'), 'SUCCESS')
        self.assertTrue(transactionResponse.get('transactionId'))

        self.assertTrue(re.search(
            '[\W\d-]+',
            transactionResponse.get('transactionId'))
        )

    def test_order_detail(self):
        response = self.payu.order_detail(5920900)

        self.assertTrue(response.get('code'))
        self.assertEqual(response.get('code'), 'SUCCESS')
Пример #3
0
 def _make_one(self):
     # test credentials
     # http://developers.payulatam.com/en/sdk/sandbox.html
     conf = dict(merchant_id = "500238",
                 api_login = "******",
                 api_key = "6u39nqhq8ftd0hlvnjfs66eh8c",
                 account_id = "500538",
                 verify_ssl =  False # payu sandbox cert is not trusted
     )
     return PayU(**conf)
Пример #4
0
class PayUTest(unittest.TestCase):
    def setUp(self):
        from payu import PayU
        self.payu = PayU()

    def test_create_token(self):
        response = self.payu.create_token('10', 'Juan Perez', 'VISA',
                                          '4111111111111111', '2014/12')
        self.assertTrue(response.get('code'))
        self.assertEqual(response.get('code'), 'SUCCESS')

    def test_get_tokens(self):
        response = self.payu.get_tokens(
            '10', 'a6ab07a8-2bc6-4c39-9ad1-cc18d6d53bf8')
        self.assertTrue(response.get('code'))
        self.assertEqual(response.get('code'), 'SUCCESS')

    def test_submit_transaction(self):
        response = self.payu.submit_transaction(
            'a6ab07a8-2bc6-4c39-9ad1-cc18d6d53bf8', 'payment_test_00000001',
            'payment test', 'http://localhost', 100, '*****@*****.**')
        self.assertTrue(response.get('code'))
        self.assertEqual(response.get('code'), 'SUCCESS')

        self.assertTrue(response.get('transactionResponse'))

        transactionResponse = response.get('transactionResponse')
        self.assertEqual(response.get('code'), 'SUCCESS')
        self.assertTrue(transactionResponse.get('transactionId'))

        self.assertTrue(
            re.search('[\W\d-]+', transactionResponse.get('transactionId')))

    def test_order_detail(self):
        response = self.payu.order_detail(5920900)

        self.assertTrue(response.get('code'))
        self.assertEqual(response.get('code'), 'SUCCESS')
Пример #5
0
from payu import PayU
import test_settings as ts

payu = PayU(ts.MERCHANT, ts.SECRET)

print payu.token(ts.TOKEN).new_sale('1.1', 'RUB', ts.REFNO, ext_ref_no='22')
# {u'message': u'Operation successful', u'code': u'0', u'tran_ref_no': u'6951255'}
Пример #6
0
 def setUp(self):
     from payu import PayU
     self.payu = PayU()
Пример #7
0
 def setUp(self):
     from payu import PayU
     self.payu = PayU()
Пример #8
0
from payu import PayU
import test_settings as ts
payu = PayU(ts.MERCHANT, ts.SECRET)

order = payu.order('RUB',
                   debug=True,
                   test_order=False,
                   back_ref='https://teamroom.me/backref/',
                   pay_method='CCVISAMC')
order.add_product('123', '1 rub subscription', 1, 1, 0)
#order.add_product('223', 'pubs', 200.5, 2, 10, info='Super pubs')
order.enable_token()
order.set_billing_info('Sergey', 'Kirillov', '*****@*****.**', '11111',
                       'ul. Asdasda', 'Kiev')
order.set_delivery_info('Sergey', 'Kirillov', '*****@*****.**', '11111',
                        'ul. Asdasda', 'Kiev')

z = unicode(order)
print z

with open('z.html', 'w') as f:
    f.write(z)
Пример #9
0
from payu import PayU
import test_settings as ts
payu = PayU(ts.MERCHANT, ts.SECRET)

order = payu.order('UAH', debug=True, test_order=False, back_ref='https://teamroom.me/backref/', pay_method='CCVISAMC')
order.add_product('123', '1 uah subscription', 1, 1, 0)
#order.add_product('223', 'pubs', 200.5, 2, 10, info='Super pubs')
order.enable_token()
order.set_billing_info('Sergey', 'Kirillov', '*****@*****.**', '11111', 'ul. Asdasda', 'Kiev')
order.set_delivery_info('Sergey', 'Kirillov', '*****@*****.**', '11111', 'ul. Asdasda', 'Kiev')

z = unicode(order)
print z

with open('z.html', 'w') as f:
    f.write(z)