Beispiel #1
0
def pago_email_administrador(pedido):
    try:
        htmly = get_template('email/pago_administrador.html')
    except Exception as e:
        htmly = get_template('pedidos/correos/pago_administrador.html')

    info = get_info()
    c_d = {}
    c_d['STATIC_URL'] = (info.site + STATIC_URL)
    c_d['MEDIA_URL'] = (info.site + MEDIA_URL)
    c_d['info'] = info
    c_d['pedido'] = pedido

    # cuentas = CuentaBancaria.objects.all()
    detalle = DetallePedido.objects.filter(pedido=pedido)
    # c_d['cuentas'] = cuentas
    c_d['detalle'] = detalle

    d = Context(c_d)

    html_content = htmly.render(d)
    asunto = u'%s N°%s' % ('Pago Realizado ', pedido.codigo)
    mail = '{0}<{1}>'.format(settings.PROJECT_NAME, settings.DEFAULT_FROM_EMAIL)
    msg = EmailMessage(asunto, html_content, mail,
                       info.get_email_ventas(), EMAIL_DEVELOPER,)
    msg.content_subtype = "html"
    msg.send()
Beispiel #2
0
def footer(context):
    info = get_info()
    request = context['request']
    STATIC_URL = settings.STATIC_URL
    cats = CursosCategorias.objects.active().order_by('posicion')

    return locals()
Beispiel #3
0
    def enviaEmail(self):
        htmly = get_template('email/bienvenida.html')
        site = Site.objects.get(id=settings.SITE_ID)
        cd = self.cleaned_data

        info = get_info()
        infosite = info.site
        # url = reverse('custom_auth:set_password', kwargs={'uuid_hash':self.u.uuid_hash})


        cd['urlweb'] = '%s' % (infosite)
        cd['SITE'] = site.domain
        cd['STATIC_URL'] = infosite + STATIC_URL
        try:
            self.u = Usuario.objects.get(email=cd['username'])
            cd['usuario'] = self.u
            emailsend = self.u.email
        except:
            emailsend = ''
        d = Context(cd)

        html_content = htmly.render(d)
        asunto = u'Want'
        mail = '{0}<{1}>'.format(settings.PROJECT_NAME,
            settings.DEFAULT_FROM_EMAIL)
        msg = EmailMessage(asunto, html_content, mail, [emailsend])
        msg.content_subtype = "html"
        msg.send()
Beispiel #4
0
def enviaEmail(pedido, base_url):
    if pedido.status == '3':
        return None
    pay_info, created = PaypalInfo.objects.get_or_create(pk=1)
    if pay_info.notificar_a:
        info = get_info()
        c_d = dict()
        c_d['STATIC_URL'] = (info.site + STATIC_URL)
        c_d['info'] = info
        c_d['pedido'] = pedido
        c_d['pay'] = pay_info

        c_d['url_complete'] = "{}/{}{}".format(
            base_url, 'post-payment/datos-facturacion/', pedido.token)
        d = Context(c_d)

        htmly = get_template('email/carrito_detalle.html')
        html_content = htmly.render(d)
        asunto = u"EPCM: Compra de cursos vía {0} (Orden de compra: {1})".format(
            pedido.metodopago, pedido.codigo)
        mail = u'{0}<{1}>'.format(settings.PROJECT_NAME,
                                  settings.DEFAULT_FROM_EMAIL)
        if pedido.usuario_email:
            msg = EmailMessage(asunto,
                               html_content,
                               mail, [pedido.usuario_email],
                               bcc=[pay_info.notificar_a])
        else:
            msg = EmailMessage(asunto, html_content, mail,
                               [pay_info.notificar_a])
        msg.content_subtype = "html"
        msg.send()
Beispiel #5
0
def header(context):
    info = get_info()
    STATIC_URL = settings.STATIC_URL
    request = context['request']
    sesioncarrito = request.session.get('sesioncarrito', '')
    if sesioncarrito == '':
        num_cart = 0
    else:
        num_cart = len(sesioncarrito)
    langs = ['es', 'en', 'pt']
    cats = CursosCategorias.objects.active().order_by('posicion')
    return locals()
Beispiel #6
0
    def enviaEmail(self):
        htmly = get_template('custom_auth/password/email-password-update.html')
        site = Site.objects.get(id=settings.SITE_ID)
        info = get_info()
        infosite = info.site
        cd = self.cleaned_data
        # url = reverse('custom_auth:set_password', kwargs={'uuid_hash':self.u.uuid_hash})
        #
        # cd['enlace'] = '%s%s' % (infosite, url)

        cd['SITE'] = infosite
        cd['STATIC_URL'] = infosite + STATIC_URL
        cd['usuario'] = self.u
        d = Context(cd)

        html_content = htmly.render(d)
        asunto = u'Actualización de Contraseña'
        mail = '{0}<{1}>'.format(settings.PROJECT_NAME,
            settings.DEFAULT_FROM_EMAIL)
        msg = EmailMessage(asunto, html_content, mail, [self.u.email])
        msg.content_subtype = "html"
        msg.send()
Beispiel #7
0
def realizar_pago_pagoefectivo_logged(request):

    if request.is_secure():
        http_protocol = "https://"
    else:
        http_protocol = "http://"
    base_url = '{0}{1}'.format(http_protocol, request.get_host())
    log.info("VIEW: Realizar Pago PagoEfectivo Logged")
    pedido_codigo = request.session.get('num_pedido')
    info = get_info()

    p = Pedido.objects.get(codigo=pedido_codigo)
    threading.Thread(target=enviarCarrito, args=(p, base_url)).start()
    # Limpiamos la session
    del request.session['num_pedido']

    # Datos para PagoefectivoData

    id_moneda = "1"
    total = p.monto_total
    metodos_pago = "1,2"
    cod_transaccion = p.codigo
    email = p.usuario_email
    usuarionombres = p.usuario_nombres
    usuarioapellidos = p.usuario_apellidos
    usuariodni = p.usuario_nrodocumento
    usuario = u"{0} {1}".format(
        p.usuario_nombres, p.usuario_apellidos)
    concepto_pago = "Compra en Tienda Virtual"
    telefono = p.usuario_telefono
    fecha_expira = time.strftime("%x")

    data = {
        'id_moneda': id_moneda,
        'total': total,
        'metodos_pago': metodos_pago,
        'cod_transaccion': cod_transaccion,
        'email': email,
        'usuarionombres': usuarionombres,
        'usuarioapellidos': usuarioapellidos,
        'usuariodni': usuariodni,
        'usuario': usuario,
        'concepto_pago': concepto_pago,
        'fecha_expira': fecha_expira
    }

    pagoefectivo_form = PagoEfectivoForm(data=data)
    # Validamos que el formulario enviado a PagoEfectivo sea válido
    realizar_pago_pagoefectivo = True

    if pagoefectivo_form.is_valid():
        log.info("PagoEfectivo Form is valid")
        pagoefectivo_form.save()

    else:
        log.warning("PagoEfectivo Form is invalid: ")
        print(pagoefectivo_form.errors)
        log.error(str(pagoefectivo_form.errors))
        log.error(str(pagoefectivo_form.non_field_errors()))
        data['enviado'] = False
        p = PagoEfectivoData(**data)
        p.save()
        return redirect(reverse('home'))

    pagoefectivo_url = settings.PAGOEFECTIVO_URL

    return render('web/pago-efectivo-form.html',
                  locals(), context_instance=ctx(request))
Beispiel #8
0
def footer():
    info = get_info()

    return locals()
Beispiel #9
0
def header():
    info = get_info()

    return locals()