def process_ipn_return(paykey, status, tracking_id):
    if(status == 'COMPLETED'):
        payment = get_or_none(Payment, paykey=paykey, confirm_key=tracking_id)
        if(not payment):
            raise BaseException('payment not found ' + paykey)
        payment.confirm_ipn()
        payment.offer.paid()
        payment.offer.issue.touch()
        watches = watch_services.find_issue_and_offer_watches(payment.offer)
        notify_payment_parties_and_watchers_paymentconfirmed(payment, watches)
        notify_admin_payment_confirmed(payment)
    else:
        logger.warn('received a ' + status + ' IPN confirmation')
Ejemplo n.º 2
0
def process_ipn_return(paykey, status, tracking_id):
    if (status == 'COMPLETED'):
        payment = get_or_none(Payment, paykey=paykey, confirm_key=tracking_id)
        if not payment:
            raise BaseException('payment not found ' + paykey)
        if payment.status == Payment.CONFIRMED_IPN:
            return  #double notification, nothing to do
        payment.confirm_ipn()
        payment.offer.paid()
        payment.offer.issue.touch()
        watches = watch_services.find_issue_and_offer_watches(payment.offer)
        notify_payment_parties_and_watchers_paymentconfirmed(payment, watches)
        notify_admin_payment_confirmed(payment)
    else:
        logger.warn('received a ' + status + ' IPN confirmation')
def _notify_payment_finished_if_applicable(payment_id):
    payment = Payment.objects.get(pk=payment_id)
    parts = PaymentPart.objects.filter(payment__id=payment.id)
    is_finished = True
    for part in parts:
        if part.money_sent.status != MoneySent.CONFIRMED_TRN:
            is_finished = False
            break
    if is_finished:
        payment.offer.paid()
        watches = watch_services.find_issue_and_offer_watches(payment.offer)
        mail_services.notify_payment_parties_and_watchers_paymentconfirmed(payment, watches)
        msg = 'payment_id=%s, value=%s, issue=%s' % (
            payment.id,
            payment.total_bitcoin_received,
            payment.offer.issue.title)
        mail_services.notify_admin('Bitcoin payment made - %s'%payment.total_bitcoin_received, msg)
def process_ipn_return(paykey, status, tracking_id):
    if status == 'COMPLETED':
        payment = get_or_none(Payment, paykey=paykey, confirm_key=tracking_id)
        if not payment:
            raise BaseException('payment not found ' + paykey)
        if payment.status == Payment.CONFIRMED_IPN:
            return  # double notification, nothing to do
        payment.confirm_ipn()
        payment.offer.paid()
        payment.offer.issue.touch()
        watches = watch_services.find_issue_and_offer_watches(payment.offer)
        notify_payment_parties_and_watchers_paymentconfirmed(payment, watches)
        notify_admin_payment_confirmed(payment)
    else:
        subject = 'received a payment confirmation with status = %s' % status
        msg = 'paykey = %s\nconfirm_key=%s' % (paykey, tracking_id)
        mail_services.notify_admin(subject, msg)
        logger.warn(subject)
        logger.warn(msg)
def process_ipn_return(paykey, status, tracking_id):
    if status == 'COMPLETED':
        payment = get_or_none(Payment, paykey=paykey, confirm_key=tracking_id)
        if not payment:
            raise BaseException('payment not found ' + paykey)
        if payment.status == Payment.CONFIRMED_IPN:
            return  # double notification, nothing to do
        payment.confirm_ipn()
        payment.offer.paid()
        payment.offer.issue.touch()
        watches = watch_services.find_issue_and_offer_watches(payment.offer)
        notify_payment_parties_and_watchers_paymentconfirmed(payment, watches)
        notify_admin_payment_confirmed(payment)
    else:
        subject = 'received a payment confirmation with status = %s' % status
        msg = 'paykey = %s\nconfirm_key=%s' % (paykey, tracking_id)
        mail_services.notify_admin(subject, msg)
        logger.warn(subject)
        logger.warn(msg)