Skip to content

Instantly share code, notes, and snippets.

# -*- coding: utf-8 -*-
import base64
import six
import datetime
from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
from General.utils import desencripta_rsa
# -*- coding: utf-8 -*-
import base64
import six
from decimal import Decimal
from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
from Simoba.bancos.models import Moneda
from SistemaV2.institucion.models import Campus
# -*- coding: utf-8 -*-
from decimal import Decimal
def url_mercadopago_transaction(usuario, matricula, nombre, apellido, email, campus, nivel, programa, monto, moneda,
nombre_producto, descripcion, referencia, periodo, telefono_lada, telefono, calle, calle_numero, cp, extra_info=""):
try:
from Simoba.mercadopago.views.mercadopago import get_preference_url_and_instance
from Simoba.mercadopago.models import CuentaMercado, Transaction as TransactionMP
mercadopago_cuenta = CuentaMercado.objects.get(id=1)
# -*- coding: utf-8 -*-
from django.db import models
import base64
from Simoba.bancos.models import Moneda
from django.contrib.auth.models import User
class CuentaMercado(models.Model):
_client_id = models.TextField()
# -*- coding: utf-8 -*-
import json
import mercadopago as mep
import logging
from General.utils.color import Color
from General.utils import environment_produccion
[
{
"model": "paypal.CatTipoSuscripcionPayPal",
"pk": 1,
"fields": {
"nombre": "Subscription",
"clave": "subscr_signup"
}
},
{
import re
from operator import itemgetter
class TransaccionPayPalException(Exception):
def __init__(self, respuesta_paypal_dict={}, **kwargs):
self.respuesta_paypal_dict = respuesta_paypal_dict
self.shortmessages_re = kwargs.get('shortmessages_re', r'^L_SHORTMESSAGE(\d{1,2})$')
self.longmessages_re = kwargs.get('longmessages_re', r'^L_LONGMESSAGE(\d{1,2})$')
super(TransaccionPayPalException, self).__init__()
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
### INTEGRACION Django
try:
import imp
imp.find_module('settings') # Assumed to be in the same directory.
except ImportError:
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n" % __file__)
def realizar_transaccion_paypal(cuenta_paypal, operacion, *args, **kwargs):
from General.utils import desencripta_rsa
ops_log = kwargs.pop('ops_log', {})
log_transaccion_paypal(operacion, tipo_mensaje=MSJ_REQUEST, **ops_log) # bitacora de transaccion
transaccion_paypal = Transaccion(cuenta_paypal.apiusername, desencripta_rsa(cuenta_paypal.apipassword), desencripta_rsa(cuenta_paypal.apisignature), cuenta_paypal.cat_apipaypal.url, cuenta_paypal.cat_apipaypal.version)
respuesta_paypal = getattr(transaccion_paypal, operacion)(*args,
**dict(cuenta_paypal.cat_apipaypal.opcionesapipaypaloperaciones_set.filter(catoperacionesapipaypal__metodo=operacion, habilitado=True).values_list('request_field', 'value'), **kwargs)
)
respuesta_paypal_dict = respuesta_paypal_a_dict(respuesta_paypal)
# -*- coding: utf-8 -*-
import json
import requests
import hashlib
REPORTS = 'reports'
PAYMENTS = 'payments'
class PayU(object):