Exemple #1
0
def add_comment_to_offer(offer_id, comment_content, user):
    offer = Offer.objects.get(pk=offer_id)
    offer.issue.touch()
    comment = OfferComment.newComment(offer, user, comment_content)
    comment.save()
    watches = watch_services.find_issue_and_offer_watches(comment.offer)
    notifyWatchers_newoffercomment(comment, watches)
    return offer
def change_existing_offer(offer_id, offerdict, user):
    offer = Offer.objects.get(pk=offer_id)
    offer.issue.touch()
    _throwIfNotOfferOwner(offer, user)
    old_offer = offer.clone()
    offer.changeOffer(offerdict)
    watches = watch_services.find_issue_and_offer_watches(offer)
    notifyWatchers_offerchanged(old_offer, offer, watches)
    return offer
def change_existing_offer(offer_id, offerdict, user):
    offer = Offer.objects.get(pk=offer_id)
    offer.issue.touch()
    _throwIfNotOfferOwner(offer, user)
    old_offer = offer.clone()
    offer.changeOffer(offerdict)
    watches = watch_services.find_issue_and_offer_watches(offer)
    notifyWatchers_offerchanged(old_offer, offer, watches)
    return offer
def revoke_existing_offer(offer_id, comment_content, user):
    offer = Offer.objects.get(pk=offer_id)
    offer.issue.touch()
    _throwIfNotOfferOwner(offer, user)
    _throwIfOfferNotOpen(offer, user, 'revoke offer')
    offer.revoke()
    comment = None
    if(comment_content):
        comment = OfferComment.newComment(offer, user, comment_content)
        comment.save()
    watches = watch_services.find_issue_and_offer_watches(offer)
    notifyWatchers_offerrevoked(offer, comment, watches)
    return offer
def revoke_existing_offer(offer_id, comment_content, user):
    offer = Offer.objects.get(pk=offer_id)
    offer.issue.touch()
    _throwIfNotOfferOwner(offer, user)
    _throwIfOfferNotOpen(offer, user, 'revoke offer')
    offer.revoke()
    comment = None
    if (comment_content):
        comment = OfferComment.newComment(offer, user, comment_content)
        comment.save()
    watches = watch_services.find_issue_and_offer_watches(offer)
    notifyWatchers_offerrevoked(offer, comment, watches)
    return offer
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')
Exemple #7
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)