コード例 #1
0
def find_user_by_email(user_email: str) -> _User:
    """
    Find user by her email
    :param user_email:
    :return: User
    """
    return _core_facade.find_user_by_email(user_email)
コード例 #2
0
def subscribe_anonymous_user_to_waiting_list(email: str, name: str, phone: str, source: str) -> None:
    """
    Subscribe anonymous user to waiting list
    :param email:
    :param name:
    :param phone:
    :param source:
    :return:
    """
    try:
        user = _core_facade.find_user_by_email(email)
    except _User.DoesNotExist:
        _email_marketing_facade.create_or_update_with_no_role.delay(name, email, 'lista-de-espera', phone=phone)
    else:
        subscribe_to_waiting_list(user, phone, source)
コード例 #3
0
def verify_purchase(name, email, phone, payment_item_slug):
    """
    Verify each buy interaction to see if it succeeded and depending on each situation take an action
    :param name: name filled at the form
    :param phone: phone filled at the form
    :param email: email filled at the form
    :param payment_item_slug: slug of the item of purchase
    """
    try:
        user = facade.find_user_by_email(email=email)
    except facade.UserDoesNotExist:
        return send_abandoned_cart(name, email, phone, payment_item_slug)
    else:
        payment = PagarmePayment.objects.filter(
            user__id=user.id,
            items__slug__exact=payment_item_slug).order_by('-id').first()
        if payment is None or payment.status() != django_pagarme_facade.PAID:
            return send_abandoned_cart(name, email, phone, payment_item_slug)