Exemple #1
0
    def process(self):

        attempt = PaymentAttempt(**self.params)

        result = {
            'success': False,
        }

        try:
            attempt.get_authorized()
        except GetAuthorizedException, e:
            result['msg'] = u'Não foi possível processar: %s' % e
    def capture_cielo_payment(self, order_number, total_incl_tax):
        form = self.get_cielo_form()

        if not form.is_valid():
            """ Something wrong with the submitted values
            Maybe some value was changed before submiting
            """
            raise

        attempt = PaymentAttempt(**self.get_cielo_payment_data(
            order_number, total_incl_tax, form.cleaned_data))

        try:
            attempt.get_authorized()
            attempt.capture()
        except (GetAuthorizedException, CaptureException), e:
            raise exceptions.UnableToTakePayment(unicode(e))
Exemple #3
0
    def test_payment_attempt_authorized(self):
        params = {
            'affiliation_id': '1006993069',
            'api_key': '25fbb99741c739dd84d7b06ec78c9bac718838630f30b112d033ce2e621b34f3',
            'card_type': PaymentAttempt.VISA,
            'total': Decimal('1.00'),  # when amount ends with .00 attempt is automatically authorized
            'order_id': '7DSD163AH1',  # strings are allowed here
            'card_number': '4012001037141112',
            'cvc2': 423,
            'exp_month': 1,
            'exp_year': 2010,
            'card_holders_name': 'JOAO DA SILVA',
            'installments': 1,
            'transaction': PaymentAttempt.CASH,
            'sandbox': True,
        }

        attempt = PaymentAttempt(**params)
        self.assertTrue(attempt.get_authorized())
Exemple #4
0
    def test_payment_attempt_authorized(self):
        params = {
            'affiliation_id': '1006993069',
            'api_key':
            '25fbb99741c739dd84d7b06ec78c9bac718838630f30b112d033ce2e621b34f3',
            'card_type': PaymentAttempt.VISA,
            'total': Decimal(
                '1.00'
            ),  # when amount ends with .00 attempt is automatically authorized
            'order_id': '7DSD163AH1',  # strings are allowed here
            'card_number': '4012001037141112',
            'cvc2': 423,
            'exp_month': 1,
            'exp_year': 2010,
            'card_holders_name': 'JOAO DA SILVA',
            'installments': 1,
            'transaction': PaymentAttempt.CASH,
            'sandbox': True,
        }

        attempt = PaymentAttempt(**params)
        self.assertTrue(attempt.get_authorized())