예제 #1
0
 def save(self, *args, **kwargs):
     if not self.slug:
         self.slug = slugify(self.customer.customer.first_name +
                             self.customer.customer.last_name)
     telegram("New Arist signed up : " + self.customer.customer.first_name +
              " " + self.customer.customer.last_name)
     super(ArtistDetail, self).save(*args, **kwargs)
예제 #2
0
 def save(self, *args, **kwargs):
     if not self.slug:
         self.slug = slugify(self.designer.seller.first_name +
                             self.designer.seller.last_name)
     telegram("New Arist signed up : " + self.designer.seller.first_name +
              " " + self.designer.seller.last_name)
     super(Designer, self).save(*args, **kwargs)
예제 #3
0
def generate_monthly_notification():
    msg = """
        ***  LAST MONTH STATUS ***
            User SignUp - """ + str(get_user_count_last_month()) + """
            Artist SignUp - """ + str(get_artist_count_last_month()) + """
            Order Processed - """ + str(
        get_total_processed_order_last_month()) + """
    """
    telegram(msg)
예제 #4
0
def create_customer_profile(sender, **kwargs):
    if kwargs.get('created', False):
        customer_obj = Customer.objects.get_or_create(
            customer=kwargs.get('instance'))[0]
        coupon_obj = customer_obj.create_coupon_for_user()
        coupon_obj.create_campaign_for_user()
        customer_obj.share_link = get_shorten_url(
            "https://www.addictionbazaar.com/register?code=" +
            coupon_obj.code)['id']
        customer_obj.save()
        telegram("New user signed up")
예제 #5
0
def update_sheet(request):
    name = request.POST.get("name")
    mobile = request.POST.get("mobile")
    email = request.POST.get("email")
    message = request.POST.get("message")
    message = """ Get in touch
        name : """ + name + """
        mobile : """ + mobile + """
        email : """ + email + """
        message : """ + message + """
    """
    telegram(message)
예제 #6
0
def update_transaction(transaction_id,
                       payment_token,
                       request,
                       payment_mode,
                       status="COMPLETED"):
    txnid = uuid.UUID(transaction_id)
    tx_obj = Transaction.objects.get(payment_id=txnid)
    tx_obj.payment_token = payment_token
    tx_obj.payment_on = datetime.datetime.now()
    tx_obj.payment_status = status
    tx_obj.payment_mode = payment_mode
    tx_obj.payment_response = str(
        {k: v[0]
         for k, v in dict(request.POST.iterlists()).iteritems()})
    tx_obj.save()
    if status == "COMPLETED":
        handle_abmoney_after_transaction(tx_obj)
        notification_on_order(tx_obj)
        # Update order
        for orders in tx_obj.order.all():
            orders.order_status = "PAYMENT_DONE"
            orders.save()
            telegram("New Order Booked\nOrder id = " + str(orders.id) +
                     "\nPayment Mode = " + payment_mode + "\nTranction id = " +
                     str(tx_obj.id))

        # delete cart
        total_item = 0
        if request.user.is_authenticated():
            cart_obj = Cart.objects.filter(user=request.user,
                                           listed_type="CART")
            products = [obj.product for obj in cart_obj]
            total_item = len(products)
            cart_obj.delete()
        else:
            try:
                token = uuid.UUID(request.COOKIES.get("token"))
                cart_obj = Cart.objects.filter(token=token, listed_type="CART")
                products = [obj.product for obj in cart_obj]
                total_item = len(products)
                cart_obj.delete()
            except TypeError:
                cart = []
        if total_item > 0:
            AbMailUtils.send_email_of_order(request.user, products)
예제 #7
0
def process_cod(request, transaction_id):
    txid = uuid.UUID(transaction_id)
    tx_obj = Transaction.objects.get(payment_id=txid)
    if tx_obj.payment_mode == 'COD':
        return render(request, "order/cod_order_conf.html", {})
    order_obj = tx_obj.order.all()
    for order in order_obj:
        order.order_status = 'COD'
        order.save()
        telegram("New Order Booked\nOrder id = " + str(order.id) +
                 "\nPayment Mode = COD" + "\nTranction id = " + str(tx_obj.id))
    cod_charges = ProductOrderCalculation.calculate_cod_charges(order_obj)
    tx_obj.payment_mode = 'COD'
    tx_obj.payment_amount = tx_obj.payment_amount + cod_charges
    tx_obj.save()
    handle_abmoney_after_transaction(tx_obj)
    notification_on_order(tx_obj)
    # delete cart
    total_item = 0
    if request.user.is_authenticated():
        cart_obj = Cart.objects.filter(user=request.user, listed_type="CART")
        products = [obj.product for obj in cart_obj]
        total_item = len(products)
        cart_obj.delete()
    else:
        try:
            token = uuid.UUID(request.COOKIES.get("token"))
            cart_obj = Cart.objects.filter(token=token, listed_type="CART")
            products = [obj.product for obj in cart_obj]
            total_item = len(products)
            cart_obj.delete()
        except TypeError:
            cart = []
    if total_item > 0:
        AbMailUtils.send_email_of_order(request.user, products)

    return render(request, "order/cod_order_conf.html", {})