示例#1
0
    def __init__(self, *args, **kwargs):
        initial = kwargs.setdefault('initial', {})
        if settings.REQUIRE_HASH:
            initial['hash'] = getHashOnRequest(initial)
        if settings.HOLD_MODE:
            exp_date = datetime.datetime.now() + settings.EXPIRE_DATE_OFFSET
            initial['expireDate'] = exp_date

        super(IntellectMoneyForm, self).__init__(*args, **kwargs)
示例#2
0
    def __init__(self, *args, **kwargs):
        initial = kwargs.setdefault('initial', {})
        if settings.REQUIRE_HASH:
            initial['hash'] = getHashOnRequest(initial)
        if settings.HOLD_MODE:
            exp_date = datetime.datetime.now() + settings.EXPIRE_DATE_OFFSET
            initial['expireDate'] = exp_date

        super(IntellectMoneyForm, self).__init__(*args, **kwargs)
示例#3
0
    def testRequestForm(self):
        data = {
            'preference': 'bankCard', 'serviceName': u'Тестовый Платеж',
            'recipientAmount': '10000000.06', 'recipientCurrency': 'RUR',
            'userName': '******', 'email': '*****@*****.**',
            'orderId': 15, 'successUrl': '/dsdsd/', 'failUrl': '/dsdsda/',
            'eshopId': settings.SHOPID
        }
        if settings.REQUIRE_HASH:
            data['hash'] = getHashOnRequest(data)

        form = IntellectMoneyForm(data)
        self.assertTrue(form.is_valid())
示例#4
0
    def testResultBadRequestHash(self):
        data = self.data2.copy()
        data['orderId'] = '1'
        data['serviceName'] = u'покупка книги Хочу все знать'
        data['recipientAmount'] = '10,10'
        data['recipientCurrency'] = 'RUB'

        old_secretkey = settings.SECRETKEY
        settings.SECRETKEY = 'test'
        try:
            hash = getHashOnRequest(data)
        finally:
            settings.SECRETKEY = old_secretkey

        self.assertEqual(hash, '4590a539674c6b74d3032e004d1f8192')
示例#5
0
    def __init__(self, *args, **kwargs):
        initial = kwargs.setdefault('initial', {})

        if settings.DEBUG:
            # in debug mode only support 'inner' method
            initial['preference'] = self.PREFERENCE_CHOICES[0][0]

        if settings.HOLD_MODE:
            exp_date = datetime.datetime.now() + settings.EXPIRE_DATE_OFFSET
            initial['expireDate'] = exp_date

        if settings.REQUIRE_HASH:
            # update some initial values
            for fname in 'eshopId', 'recipientCurrency':
                initial[fname] = self.base_fields[fname].initial

            initial['hash'] = getHashOnRequest(initial)

        super(IntellectMoneyForm, self).__init__(*args, **kwargs)