Пример #1
0
def pagarme_anonymous_notification(request):
    if request.method != 'POST':
        return HttpResponseNotAllowed([request.method])
    try:
        transaction = payment_facade.extract_transaction(
            request.POST, request.body.decode('utf8'), request.headers['X-Hub-Signature'])
    except PagarmeNotPaidTransaction:
        pass  # No problem, we need to handle only paid transactions
    else:
        user = user_facade.find_user_by_email(transaction['customer']['email'])
        _promote_client_and_remove_tag_boleto(user, request)
    return HttpResponse('')
Пример #2
0
def subscribe_anonymous_member_who_paid_boleto(
        notification_data: dict,
        raw_post: str,
        signature: str,
        source: str = 'unknow') -> _User:
    try:
        transaction = _payment_facade.extract_transaction(
            notification_data, raw_post, signature)
    except PagarmeNotPaidTransaction:
        pass  # No problem, we need to handle only paid transactions
    else:
        user = _user_facade.find_user_by_email(
            transaction['customer']['email'])
        _user_facade.promote_member(user, source)
        return user