-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpayment_info.py
73 lines (54 loc) · 1.74 KB
/
payment_info.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# from Cart_d import *
import random
from enum import Enum,auto
import math
import string
list1 = []
list2= []
class Payment:
def add_grand_total(self):
sum=0
f = open("Cart_details.txt", 'r')
cart_read_4_pay = f.read()
#print(cart_read_4_pay)
# i=5
# for line[i] in cart_read_4_pay:
# sum =sum + int(line[i])
# i+=5
l=cart_read_4_pay.split()
f.close()
for i in range(5,len(l),6):
sum=sum+int(l[i])
print("Your grand total is :" ,sum)
def generateOTP(self):
digits = "0123456789"
OTP = ""
for i in range(6):
OTP += digits[math.floor(random.random() * 10)]
return OTP
def payment_processing(self):
print("1.Card payment\n2.UPI Payment\n3.Exit")
self.method = int(input("Enter payment method:"))
check = True
while check:
# print("1.Card payment\n2.UPI Payment\n3.Exit")
# self.method = input("Enter payment method:")
if self.method == 1:
self.card = input("Enter card number:")
list1.append(self.card)
self.ph = input("Enter phone number:")
list1.append(self.ph)
OTP = self.generateOTP()
print("Your OTP is", OTP)
self.otp = int(input("Enter OTP:"))
list1.append(self.otp)
break
elif self.method == 2:
self.upi = input("Enter UPI number:")
list2.append(self.upi)
print("Payment done successfully")
break
else:
check = False
# pay=Payment()
# pay.add_grand_total()