Ejemplo n.º 1
0
    except:
        pass
    user.profile.activate_premium()
subscription_signup.connect(paypal_signup)

def paypal_payment_history_sync(sender, **kwargs):
    ipn_obj = sender
    try:
        user = User.objects.get(username__iexact=ipn_obj.custom)
    except User.DoesNotExist:
        user = User.objects.get(email__iexact=ipn_obj.payer_email)
    try:
        user.profile.setup_premium_history()
    except:
        return {"code": -1, "message": "User doesn't exist."}
payment_was_successful.connect(paypal_payment_history_sync)

def stripe_signup(sender, full_json, **kwargs):
    stripe_id = full_json['data']['object']['customer']
    try:
        profile = Profile.objects.get(stripe_id=stripe_id)
        profile.activate_premium()
    except Profile.DoesNotExist:
        return {"code": -1, "message": "User doesn't exist."}
zebra_webhook_customer_subscription_created.connect(stripe_signup)

def stripe_payment_history_sync(sender, full_json, **kwargs):
    stripe_id = full_json['data']['object']['customer']
    try:
        profile = Profile.objects.get(stripe_id=stripe_id)
        profile.setup_premium_history()
Ejemplo n.º 2
0
subscription_signup.connect(paypal_signup)


def paypal_payment_history_sync(sender, **kwargs):
    ipn_obj = sender
    try:
        user = User.objects.get(username__iexact=ipn_obj.custom)
    except User.DoesNotExist:
        user = User.objects.get(email__iexact=ipn_obj.payer_email)
    try:
        user.profile.setup_premium_history()
    except:
        return {"code": -1, "message": "User doesn't exist."}


payment_was_successful.connect(paypal_payment_history_sync)


def stripe_signup(sender, full_json, **kwargs):
    stripe_id = full_json['data']['object']['customer']
    try:
        profile = Profile.objects.get(stripe_id=stripe_id)
        profile.activate_premium()
    except Profile.DoesNotExist:
        return {"code": -1, "message": "User doesn't exist."}


zebra_webhook_customer_subscription_created.connect(stripe_signup)


def stripe_payment_history_sync(sender, full_json, **kwargs):