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_watches(payment.offer.issue)
        notify_payment_parties_and_watchers_paymentconfirmed(payment, watches)
        notify_admin_payment_confirmed(payment)
        ActionLog.log_pay(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)
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_project_watches(
            payment.offer.issue)
        notify_payment_parties_and_watchers_paymentconfirmed(payment, watches)
        notify_admin_payment_confirmed(payment)
        ActionLog.log_pay(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)