Пример #1
0
    def global_create_json(self, **kwargs):
        _logger.info(
            'Beginning global payment form_feedback with post data %s',
            pprint.pformat(kwargs))
        cr, uid, context = request.cr, request.uid, request.context
        transaction_obj = request.env['payment.transaction']
        order = request.website.sale_get_order()
        tx = request.website.sale_get_transaction()
        print(order, tx)
        request.env['payment.acquirer'].configure_client()
        card = CreditCardData()
        card.number = kwargs['card-number']
        card.exp_month = kwargs['expiry-date-mm']
        card.exp_year = kwargs['expiry-date-yy']
        card.cvn = kwargs['cvn']
        card.card_holder_name = kwargs['cardholder-name']
        try:
            check_verification = card.verify() \
                .with_currency(tx.currency_id.name) \
                .execute()
            response = check_verification.response_code
            print('****', response)
            card.charge(tx.amount) \
                .with_currency(tx.currency_id.name) \
                .execute()
            if tx:
                # button cliked but no more info -> rewrite on tx or create a new one ?
                tx.write({
                    'acquirer_id':
                    request.env.ref('payment.payment_acquirer_global').id,
                    'amount':
                    order.amount_total,
                    'state':
                    'pending'
                })
            else:
                tx_id = transaction_obj.sudo().create(
                    {
                        'acquirer_id': kwargs['acquirer_id'],
                        'type': 'form',
                        'amount': order.amount_total,
                        'currency_id': order.pricelist_id.currency_id.id,
                        'partner_id': order.partner_id.id,
                        'partner_country_id': order.partner_id.country_id.id,
                        'reference': order.name,
                        'sale_order_id': order.id,
                        'state': 'done'
                    },
                    context=context)
                request.session['sale_transaction_id'] = tx_id

                # update quotation
            order.sudo().action_confirm()
            return request.render('e3k_payment_globalpay.confirm_g_payment', {
                'data': kwargs,
                'order': tx.sale_order_id
            })
        except GatewayException as e:
            if int(e.response_code) == 506:
                _logger.info('Bad Geteway****506****')
Пример #2
0
 def mastercard_series2_manual(card_present=False, reader_present=False):
     data = CreditCardData()
     data.number = '2223000010005798'
     data.exp_month = '12'
     data.exp_year = '2019'
     data.cvn = '999'
     data.card_present = card_present
     data.reader_present = reader_present
     return data
Пример #3
0
 def mastercard_manual(card_present=False, reader_present=False):
     data = CreditCardData()
     data.number = '5473500000000014'
     data.exp_month = '12'
     data.exp_year = '2025'
     data.cvn = '123'
     data.card_present = card_present
     data.reader_present = reader_present
     return data
Пример #4
0
 def visa_manual(card_present=False, reader_present=False):
     data = CreditCardData()
     data.number = '4012002000060016'
     data.exp_month = '12'
     data.exp_year = '2025'
     data.cvn = '123'
     data.card_present = card_present
     data.reader_present = reader_present
     return data
Пример #5
0
 def jcb_manual(card_present=False, reader_present=False):
     data = CreditCardData()
     data.number = '3566007770007321'
     data.exp_month = '12'
     data.exp_year = '2025'
     data.cvn = '123'
     data.card_present = card_present
     data.reader_present = reader_present
     return data
Пример #6
0
 def amex_manual(card_present=False, reader_present=False):
     data = CreditCardData()
     data.number = '372700699251018'
     data.exp_month = '12'
     data.exp_year = '2025'
     data.cvn = '1234'
     data.card_present = card_present
     data.reader_present = reader_present
     return data
Пример #7
0
 def discover_manual(card_present=False, reader_present=False):
     data = CreditCardData()
     data.number = '6011000990156527'
     data.exp_month = '12'
     data.exp_year = '2025'
     data.cvn = '123'
     data.card_present = card_present
     data.reader_present = reader_present
     return data
Пример #8
0
 def gsb_manual():
     data = CreditCardData()
     data.number = '6277220572999800'
     data.exp_month = '12'
     data.exp_year = '2049'
     return data