def checkout(request): if request.method == "POST": itemJson = request.POST.get('itemJson') name = request.POST.get('name') email = request.POST.get('email') address = request.POST.get('address1') + " " + request.POST.get( 'address2') city = request.POST.get('city') state = request.POST.get('state') zip_code = request.POST.get('zipcode', '') order = Order(itemJson=itemJson, name=name, email=email, address=address, city=city, state=state, zip_code=zip_code) order.save() orderupdate = OrderUpdate(order_id=order.order_id, order_desc="Your order has been received") orderupdate.save() thank = True return render(request, 'shop/checkout.html', { 'thank': thank, 'id': order.order_id }) return render(request, 'shop/checkout.html')
def verifyPayment(request): data = request.POST # getting the data send by the ajax to verify token = data['token'] # getting the token from the data send from page amount = data['amount'] # getting the amount from the data send from page """ sending the data to khalti for verification """ url = "https://khalti.com/api/v2/payment/verify/" payload = { "token": token, "amount": amount } headers = { "Authorization": config("TEST_SECRET_KEY") } response = requests.post(url, payload, headers=headers) """ recieving the data from khalti """ response_data = json.loads( response.text) # data given by khalt and converting to json format # fetching the status code of payment status_code = str(response.status_code) if status_code == 400: response = JsonResponse( {'status': 'false', 'message': response_data['detail']}, status=500) return response """ import pprint # alibrary use to print the json easily pp = pprint.PrettyPrinter(indent=4) pp.pprint(response_data) """ updates = OrderUpdate( order_id=id_order, update_desc='Your order has been placed') # order update initializing during checkout updates.save() return JsonResponse(response_data['user']['idx'], safe=False)
def checkout(request): if request.method == "POST": item_json = request.POST.get('itemsJson', '') name = request.POST.get('name', '') amount = request.POST.get('amount', '') email = request.POST.get('email', '') address = request.POST.get('address1', '') + \ " " + request.POST.get('address2', '') city = request.POST.get('city', '') state = request.POST.get('state', '') zip_code = request.POST.get('zip_code', '') phone = request.POST.get('phone', '') order = Order(item_json=item_json, name=name, amount=amount, email=email, address=address, city=city, state=state, zip_code=zip_code, phone=phone) order.save() update = OrderUpdate(order_id=order.order_id, update_desc="The order has been placed.") update.save() id = order.order_id message = 'Your order has been placed successfully. Thank you for ordering with us. Your order id is ' return render(request, 'shop/checkout.html', { 'id': id, 'name': name, 'msg': message }) else: return render(request, 'shop/checkout.html')
def saveUpdate(request, id): if not (request.user.is_nurseryManager): return redirect('/shop') if request.method == "POST": update = str(request.user.nursery_name) + " : " + str( request.POST.get("update")) now = datetime.datetime.now(pytz.timezone('Asia/Kolkata')) timex = now.strftime("%H:%M:%S") updated = OrderUpdate(order_id=id, update_desc=update, timestamp1=timex) updated.save() messages.success(request, "UPDATE PUSHED") return HttpResponseRedirect(request.META.get('HTTP_REFERER', '/'))
def checkout(request): if request.method == 'POST': item_json = request.POST.get('itemsJson', '') amount = request.POST.get('amount', '') name = request.POST.get('name', '') email = request.POST.get('email', '') address = request.POST.get('address', '') + request.POST.get( 'address2', '') city = request.POST.get('city', '') state = request.POST.get('state', '') zip_code = request.POST.get('zip_code', '') phone = request.POST.get('phone', '') od = request.POST.get('id', '') order = Order(item_json=item_json, amount=amount, name=name, email=email, address=address, city=city, state=state, zip_code=zip_code, phone=phone) order.save() thank = True update = OrderUpdate(order_id=order.order_id, update_desc="The Order has been placed.") update.save() id = order.order_id return render(request, 'shop/checkout.html', { "thank": thank, "id": id }) return render(request, 'shop/checkout.html')
def checkout(request): if request.method == "POST": name = request.POST.get("name") amount = request.POST.get("amount") phone = request.POST.get("phone") email = request.POST.get("email") address = request.POST.get("address") address2 = request.POST.get("address2") city = request.POST.get("city") state = request.POST.get("state") zip = request.POST.get("zip") itemjson = request.POST.get("itemjson") print(amount) order = Orders( items_json=itemjson, name=name, phone=phone, email=email, address=address, address2=address2, city=city, state=state, zipcode=zip, amount=amount, ) order.save() update = OrderUpdate(order_id=order.order_id, update_desc="The Order has been Placed") update.save() thank = True id = order.order_id # return render(request, "shop/checkout.html", {"thank": thank, "id": id}) param_dict = { "MID": "your mid", "ORDER_ID": str(order.order_id), "TXN_AMOUNT": str(amount), "CUST_ID": email, "INDUSTRY_TYPE_ID": "Retail", "WEBSITE": "WEBSTAGING", "CHANNEL_ID": "WEB", "CALLBACK_URL": "http://127.0.0.1:8000/shop/handlerequest/", } # param_dict['CHECKSUMHASH'] = Checksum.generate_checksum(param_dict,MERCHANT_KEY) return render(request, "shop/paytm.html", {"param_dict": param_dict}) return render(request, "shop/checkout.html")
def checkout(request): if request.method == "POST": items_json = request.POST.get('itemsJson', '') name = request.POST.get('name', '') amount = request.POST.get('amount', '') email = request.POST.get('email', '') address = request.POST.get('address1', '') + " " + request.POST.get( 'address2', '') city = request.POST.get('city', '') state = request.POST.get('state', '') zip_code = request.POST.get('zip_code', '') phone = request.POST.get('phone', '') order = Orders(items_json=items_json, name=name, email=email, address=address, city=city, state=state, zip_code=zip_code, phone=phone, amount=amount) order.save() update = OrderUpdate(order_id=order.order_id, update_desc="The order has been placed") update.save() thank = True id = order.order_id #return render(request,'shop/checkout.html',{'thank': thank, 'id': id}) param_dict = { 'MID': 'WorldP64425807474247', 'ORDER_ID': str(order.order_id), 'TXN_AMOUNT': str(amount), 'CUST_ID': email, 'INDUSTRY_TYPE_ID': 'Retail', 'WEBSITE': 'WEBSTAGING', 'CHANNEL_ID': 'WEB', 'CALLBACK_URL': 'http://127.0.0.1:8000/shop/handlerequest/', } param_dict['CHECKSUMHASH'] = Checksum.generate_checksum( param_dict, MERCHANT_KEY) return render(request, 'shop/paytm.html', {'param_dict': param_dict}) return render(request, 'shop/checkout.html')
def checkout(request): if request.method=="POST": items_json = request.POST.get('itemsJson', '') name = request.POST.get('name', '') email = request.POST.get('email', '') address = request.POST.get('address1', '') + " " + request.POST.get('address2', '') city = request.POST.get('city', '') state = request.POST.get('state', '') zip_code = request.POST.get('zip_code', '') phone = request.POST.get('phone', '') order = Orders(items_json=items_json, name=name, email=email, address=address, city=city, state=state, zip_code=zip_code, phone=phone) order.save() update = OrderUpdate(order_id=order.order_id, update_desc="The order has been placed") update.save() thank = True id = order.order_id return render(request, 'shop/checkout.html', {'thank':thank, 'id': id}) return render(request, 'shop/checkout.html')
def checkout(request): if request.method == "POST": name = request.POST.get("name", '') items = request.POST.get("itemsjson", '') amount = request.POST.get('amount', '') email = request.POST.get("email", '') phone = request.POST.get("phone", '') address = request.POST.get("add1", '') + " " + request.POST.get( "add2", '') city = request.POST.get("city", '') zip_code = request.POST.get("zip_code", '') state = request.POST.get("state", '') phone = request.POST.get("phone", '') order = Order(name=name, items_json=items, email=email, state=state, phone=phone, address=address, city=city, zip_code=zip_code, amount=amount) order.save() update = OrderUpdate(order_id=order.order_id, update_desc="The order has been placed") update.save() global id id = order.getid() print(id) param_dict = { 'MID': 'WorldP64425807474247', 'ORDER_ID': 'order.order_id', 'TXN_AMOUNT': '1', 'CUST_ID': 'email', 'INDUSTRY_TYPE_ID': 'Retail', 'WEBSITE': 'WEBSTAGING', 'CHANNEL_ID': 'WEB', 'CALLBACK_URL': 'http://127.0.0.1:8000/shop/handlepayment/', } return render(request, 'shop/paytm.html', {'param_dict': param_dict}) return render(request, 'shop/checkout.html')
def check(request): if request.method == "POST": item_json = request.POST.get('item_json') amount = request.POST.get('amount') name = request.POST.get('name', '') email = request.POST.get('email', '') address = request.POST.get('address1', '') + request.POST.get( 'address2', '') city = request.POST.get('city', '') state = request.POST.get('state', '') zip_code = request.POST.get('zip_code', '') number = request.POST.get('number', '') data = Order(item_json=item_json, name=name, email=email, address=address, city=city, state=state, zip_code=zip_code, number=number, amount=amount) data.save() or_id = data.order_id update = OrderUpdate(order_id=or_id, order_desc="The Order Has Been Placed...") update.save() thank = True param_dict = { 'MID': 'WZQuzq13014084176041', 'ORDER_ID': str(or_id), 'TXN_AMOUNT': str(amount), 'CUST_ID': email, 'INDUSTRY_TYPE_ID': 'Retail', 'WEBSITE': 'WEBSTAGING', 'CHANNEL_ID': 'WEB', 'CALLBACK_URL': 'http://127.0.0.1:8000/shop/handlerequest', } param_dict['CHECKSUMHASH'] = Checksum.generate_checksum( param_dict, 'e6aarV!WScrehy@8') return render(request, 'shop/paytm.html', {"param_dict": param_dict}) # return render(request,'shop/checkOut.html' , {"thank" : thank, "id" : or_id }) return render(request, 'shop/checkOut.html')
def cheackout(request): if request.method == 'POST': params = json.loads(request.body) print(type(params['ordered_item'])) dict2 = params['ordered_item'] address = f"{params['addressLine1']} - {params['addressLine2']}" totalPrice = 0 print(type(dict2)) for key in dict2: for another_key in dict2[key]: #print(another_key) if (another_key == "totalPrice"): totalPrice = totalPrice + dict2[key][another_key] print(totalPrice) order = Order(first_name=params['first_name'], last_name=params['last_name'], email=params['email'], phone=params['phone'], address=address, city=params['city'], state=params['state'], zip_code=params['zip_code'], total_price=totalPrice, date=params['date'], ordered_item=params['ordered_item']) order.save() print(order.order_id) order_id = order.order_id update = OrderUpdate(order_id=order_id, update_desc="Order Placed", status="Order Placed") update.save() sentMail(order_id, params['email'], params['first_name'], params['last_name'], address, dict2, totalPrice, params['date']) return JsonResponse({ 'err': 'false', 'message': 'Order Placeed', 'order_id': order_id })
def checkout(request): thank = 0 if request.method == "POST": item_json = request.POST.get('json','') print("muskan") print(item_json) print("muskan1") name = request.POST.get('name','') email = request.POST.get('email','') address = request.POST.get('address1','') +" "+ request.POST.get('address2','') city = request.POST.get('city','') state = request.POST.get('state','') zip_code = request.POST.get('zip','') phone = request.POST.get('phone','') user = User.objects.filter(username=name) print(user) order = Order(order_items=item_json,user=user[0],phone = phone,address=address,city=city,state=state,zip_code=zip_code) order.save() print(order.order_id) update = OrderUpdate(order_id = order.order_id,update_desc="the order has been placed") update.save() thank = 1 return render(request,"shop/checkout.html",{'thank':thank})
def checkOut(request): if request.method == 'POST': itemjason = request.POST.get('itemsjson', '') name = request.POST.get('Name', '') email = request.POST.get('Email', '') address = request.POST.get('Address1', '') + " " + request.POST.get( 'Address1', '') city = request.POST.get('City', '') state = request.POST.get('State', '') zip_code = request.POST.get('Zip_code', '') phone = request.POST.get('Phone', '') order = Orders(itemjason=itemjason, name=name, email=email, address=address, city=city, state=state, zip=zip_code, phone=phone) #order.save() # thank = True # update = OrderUpdate(update_id=order.order_id , update_desc="Your Order Has Been Placed") # orderid = order.order_id # update.save() order.save() update = OrderUpdate(order_id=order.order_id, update_desc="The order has been placed") update.save() thank = True id = order.order_id return render(request, 'shop/checkout.html', { 'thank': thank, 'id': id }) return render(request, './shop/checkOut.html')