当前位置: 首页>>代码示例>>Python>>正文


Python transferuj.PaymentProcessor类代码示例

本文整理汇总了Python中getpaid.backends.transferuj.PaymentProcessor的典型用法代码示例。如果您正苦于以下问题:Python PaymentProcessor类的具体用法?Python PaymentProcessor怎么用?Python PaymentProcessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PaymentProcessor类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_online_wrong_id

 def test_online_wrong_id(self):
     self.assertEqual('ID ERR',
                      PaymentProcessor.online('195.149.229.109', '1111', '1', '', '1',
                                                                          '123.45', None, None, None, None, None,
                                                                          '15bb75707d4374bc6e578c0cbf5a7fc7'))
     self.assertNotEqual('ID ERR',
                         PaymentProcessor.online('195.149.229.109', '1234', '1', '', '1',
                                                                             '123.45', None, None, None, None, None,
                                                                             'f5f8276fbaa98a6e05b1056ab7c3a589'))
开发者ID:dcondeurra,项目名称:django-getpaid,代码行数:9,代码来源:test_transferuj.py

示例2: test_online_wrong_sig

 def test_online_wrong_sig(self):
     self.assertEqual('SIG ERR',
                      PaymentProcessor.online('195.149.229.109', '1234', '1', '', '1',
                                                                          '123.45', None, None, None, None, None,
                                                                          'xxx'))
     self.assertNotEqual('SIG ERR',
                         PaymentProcessor.online('195.149.229.109', '1234', '1', '', '1',
                                                                             '123.45', None, None, None, None, None,
                                                                             '21b028c2dbdcb9ca272d1cc67ed0574e'))
开发者ID:dcondeurra,项目名称:django-getpaid,代码行数:9,代码来源:test_transferuj.py

示例3: test_online_crc_error

 def test_online_crc_error(self):
     self.assertEqual('CRC ERR',
                      PaymentProcessor.online('195.149.229.109', '1234', '1', '',
                                                                          '99999', '123.45', None, None, None, None,
                                                                          None, 'f5f8276fbaa98a6e05b1056ab7c3a589'))
     self.assertEqual('CRC ERR',
                      PaymentProcessor.online('195.149.229.109', '1234', '1', '',
                                                                          'GRRGRRG', '123.45', None, None, None,
                                                                          None, None,
                                                                          '6a9e045010c27dfed24774b0afa37d0b'))
开发者ID:dcondeurra,项目名称:django-getpaid,代码行数:10,代码来源:test_transferuj.py

示例4: handle

    def handle(self, *args, **options):

        key = PaymentProcessor.get_backend_setting("key", None)
        if key is None:
            self.stdout.write('Please be sure to provide "key" setting for this backend (random max. 16 characters)')
        else:
            self.stdout.write("Please setup in Transferuj.pl user defined key (for security signing): %s\n" % key)
开发者ID:giam-forte,项目名称:ExpertBilling,代码行数:7,代码来源:transferuj_configuration.py

示例5: test_online_payment_failure

 def test_online_payment_failure(self):
     Payment = apps.get_model('getpaid', 'Payment')
     order = Order(name='Test EUR order', total='123.45', currency='PLN')
     order.save()
     payment = Payment(order=order, amount=order.total, currency=order.currency, backend='getpaid.backends.payu')
     payment.save(force_insert=True)
     self.assertEqual('TRUE', PaymentProcessor.online('195.149.229.109', '1234', '1', '',
                                                                                  payment.pk, '123.45', '23.45', '',
                                                                                  False, 0, '',
                                                                                  '21b028c2dbdcb9ca272d1cc67ed0574e'))
     payment = Payment.objects.get(pk=payment.pk)
     self.assertEqual(payment.status, 'failed')
开发者ID:dcondeurra,项目名称:django-getpaid,代码行数:12,代码来源:test_transferuj.py

示例6: test_default_config_url_transaction_params

    def test_default_config_url_transaction_params(self):
        data = self.get_geteway_data()

        crc = data['crc']
        kwota = data['kwota']
        id_ = data['id']
        key = PaymentProcessor.get_backend_setting('key')
        md5sum = six.text_type(id_) + kwota + six.text_type(crc) + key
        md5sum = md5sum.encode('utf-8')

        self.assertEquals(crc, self.payment.pk)
        self.assertEquals(kwota, six.text_type(self.payment.amount))
        self.assertEquals(id_, 1234)
        self.assertEquals(data['md5sum'], md5(md5sum).hexdigest())
开发者ID:dcondeurra,项目名称:django-getpaid,代码行数:14,代码来源:test_transferuj.py

示例7: post

    def post(self, request, *args, **kwargs):
        try:
            id = request.POST['id']
            tr_id = request.POST['tr_id']
            tr_date = request.POST['tr_date']
            tr_crc = request.POST['tr_crc']
            tr_amount = request.POST['tr_amount']
            tr_paid = request.POST['tr_paid']
            tr_desc = request.POST['tr_desc']
            tr_status = request.POST['tr_status']
            tr_error = request.POST['tr_error']
            tr_email = request.POST['tr_email']
            md5sum = request.POST['md5sum']
        except KeyError:
            logger.warning('Got malformed POST request: %s' % str(request.POST))
            return HttpResponse('MALFORMED')

        status = PaymentProcessor.online(request.META['REMOTE_ADDR'], id, tr_id, tr_date, tr_crc, tr_amount, tr_paid, tr_desc, tr_status, tr_error, tr_email, md5sum)
        return HttpResponse(status)
开发者ID:fesp21,项目名称:django-getpaid,代码行数:19,代码来源:views.py

示例8: test_online_not_allowed_ip

    def test_online_not_allowed_ip(self):
        self.assertEqual('IP ERR',
                         PaymentProcessor.online('0.0.0.0', None, None, None, None, None,
                                                                             None, None, None, None, None, None))

        #Tests allowing IP given in settings
        with self.settings(GETPAID_BACKENDS_SETTINGS={
            'getpaid.backends.transferuj': {'allowed_ip': ('1.1.1.1', '1.2.3.4'), 'key': ''},
        }):
            self.assertEqual('IP ERR',
                             PaymentProcessor.online('0.0.0.0', None, None, None, None,
                                                                                 None, None, None, None, None, None,
                                                                                 None))
            self.assertNotEqual('IP ERR',
                                PaymentProcessor.online('1.1.1.1', None, None, None, None,
                                                                                    None, None, None, None, None, None,
                                                                                    None))
            self.assertNotEqual('IP ERR',
                                PaymentProcessor.online('1.2.3.4', None, None, None, None,
                                                                                    None, None, None, None, None, None,
                                                                                    None))

        #Tests allowing all IP
        with self.settings(GETPAID_BACKENDS_SETTINGS={
            'getpaid.backends.transferuj': {'allowed_ip': [], 'key': ''},
        }):
            self.assertNotEqual('IP ERR',
                                PaymentProcessor.online('0.0.0.0', None, None, None, None,
                                                                                    None, None, None, None, None, None,
                                                                                    None))
            self.assertNotEqual('IP ERR',
                                PaymentProcessor.online('1.1.1.1', None, None, None, None,
                                                                                    None, None, None, None, None, None,
                                                                                    None))
            self.assertNotEqual('IP ERR',
                                PaymentProcessor.online('1.2.3.4', None, None, None, None,
                                                                                    None, None, None, None, None, None,
                                                                                    None))
开发者ID:dcondeurra,项目名称:django-getpaid,代码行数:38,代码来源:test_transferuj.py

示例9: setUp

 def setUp(self):
     self.payment = PaymentFactory()
     self.pp = PaymentProcessor(self.payment)
开发者ID:dcondeurra,项目名称:django-getpaid,代码行数:3,代码来源:test_transferuj.py

示例10: PaymentProcessorGetGatewayUrl

class PaymentProcessorGetGatewayUrl(TestCase):

    def setUp(self):
        self.payment = PaymentFactory()
        self.pp = PaymentProcessor(self.payment)

    def update_settings(self, data):
        settings = get_backend_settings('getpaid.backends.transferuj')
        settings.update(data)

        return {'getpaid.backends.transferuj': settings}

    def get_geteway_data(self):
        settings = self.update_settings({'method': 'post'})
        with self.settings(GETPAID_BACKENDS_SETTINGS=settings):
            url, method, data = self.pp.get_gateway_url(Mock())

        return data

    def test_return_types(self):
        settings = self.update_settings({'method': 'get'})

        with self.settings(GETPAID_BACKENDS_SETTINGS=settings):
            url, method, data = self.pp.get_gateway_url(Mock())

        self.assertEquals(method, 'GET')
        self.assertEquals(data, {})
        self.assertIsInstance(url, str)

    def test_default_config_url_transaction_params(self):
        data = self.get_geteway_data()

        crc = data['crc']
        kwota = data['kwota']
        id_ = data['id']
        key = PaymentProcessor.get_backend_setting('key')
        md5sum = six.text_type(id_) + kwota + six.text_type(crc) + key
        md5sum = md5sum.encode('utf-8')

        self.assertEquals(crc, self.payment.pk)
        self.assertEquals(kwota, six.text_type(self.payment.amount))
        self.assertEquals(id_, 1234)
        self.assertEquals(data['md5sum'], md5(md5sum).hexdigest())

    def test_default_config_url_data_params(self):
        data = self.get_geteway_data()

        self.assertEquals(data['email'], '[email protected]')
        self.assertIn('opis', data)
        self.assertNotIn('jezyk', data)

    def get_urls(self):
        return {
            'wyn_url': reverse('getpaid:transferuj:online'),
            'pow_url_blad': reverse('getpaid:transferuj:failure',
                                    kwargs={'pk': self.payment.pk}),
            'pow_url': reverse('getpaid:transferuj:success',
                               kwargs={'pk': self.payment.pk}),
        }

    def test_default_config_url_urls(self):
        data = self.get_geteway_data()

        for key, u in self.get_urls().items():
            str_ = data[key]
            self.assertTrue(str_.endswith(u),
                            "{} not end with {}".format(str_, u))

    @patch.object(transferuj, 'get_domain')
    def test_domains_http(self, patch_domain):
        patch_domain.return_value = 'test'

        data = self.get_geteway_data()

        for key in self.get_urls():
            self.assertTrue(data[key].startswith('http://test/'))

    @patch.object(transferuj, 'get_domain')
    def test_domains_https(self, patch_domain):
        patch_domain.return_value = 'test'
        settings = self.update_settings({
            'force_ssl_online': True,
            'force_ssl_return': True,
        })

        with self.settings(GETPAID_BACKENDS_SETTINGS=settings):
            data = self.get_geteway_data()

        for key in self.get_urls():
            str_ = data[key]
            self.assertTrue(str_.startswith('https://test/'),
                            "{} not start with https://test/".format(str_))

    def test_post(self):
        settings = self.update_settings({'method': 'post'})

        with self.settings(GETPAID_BACKENDS_SETTINGS=settings):
            url, method, data = self.pp.get_gateway_url(Mock())

        self.assertEquals(method, 'POST')
#.........这里部分代码省略.........
开发者ID:dcondeurra,项目名称:django-getpaid,代码行数:101,代码来源:test_transferuj.py


注:本文中的getpaid.backends.transferuj.PaymentProcessor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。