@@ -18,7 +18,7 @@ const PaymentScreen = (props) => {
18
18
try {
19
19
const stripeResponse = await axios . post ( 'http://localhost:8000/payment' , {
20
20
21
- product : cartInfo ,
21
+ product : order ,
22
22
authToken : jsonResponse ,
23
23
} ) ;
24
24
@@ -37,14 +37,77 @@ const PaymentScreen = (props) => {
37
37
setPaymentStatus ( ' Payment failed due to some issue' ) ;
38
38
}
39
39
} ;
40
+ const paymentUI = ( ) => {
41
+ if ( ! makePayment ) {
42
+ return (
43
+ < View
44
+ style = { {
45
+ display : 'flex' ,
46
+ flexDirection : 'column' ,
47
+ justifyContent : 'center' ,
48
+ alignItems : 'center' ,
49
+ height : 300 ,
50
+ marginTop : 50 ,
51
+ } } >
52
+ < Text style = { { fontSize : 25 , margin : 10 } } > Make Payment </ Text >
53
+ < Text style = { { fontSize : 16 , margin : 10 } } >
54
+ { ' ' }
55
+ Product Description: { order . description } { ' ' }
56
+ </ Text >
57
+ < Text style = { { fontSize : 16 , margin : 10 } } >
58
+ { ' ' }
59
+ Payable Amount: { order . budget } { ' ' }
60
+ </ Text >
61
+
62
+ < TouchableOpacity
63
+ style = { {
64
+ height : 60 ,
65
+ width : 300 ,
66
+ backgroundColor : '#FF5733' ,
67
+ borderRadius : 30 ,
68
+ justifyContent : 'center' ,
69
+ alignItems : 'center' ,
70
+ } }
71
+ onPress = { ( ) => {
72
+ setMakePayment ( true ) ;
73
+ } } >
74
+ < Text style = { { color : '#FFF' , fontSize : 20 } } > Proceed To Pay</ Text >
75
+ </ TouchableOpacity >
76
+ </ View >
77
+ ) ;
78
+
79
+ // show to make payment
80
+ } else {
81
+ if ( response !== undefined ) {
82
+ return (
83
+ < View
84
+ style = { {
85
+ display : 'flex' ,
86
+ flexDirection : 'column' ,
87
+ justifyContent : 'center' ,
88
+ alignItems : 'center' ,
89
+ height : 300 ,
90
+ marginTop : 50 ,
91
+ } } >
92
+ < Text style = { { fontSize : 25 , margin : 10 } } > { paymentStatus } </ Text >
93
+ < Text style = { { fontSize : 16 , margin : 10 } } > { response } </ Text >
94
+ </ View >
95
+ ) ;
96
+ } else {
97
+ return (
98
+ < PaymentView
99
+ order = { props . route . params . order }
100
+ onCheckStatus = { onCheckStatus }
101
+ />
102
+ ) ;
103
+ }
104
+ }
105
+ } ;
40
106
41
107
return (
42
108
< View style = { styles . container } >
43
109
< Text style = { styles . heading } > Payment</ Text >
44
- < PaymentView
45
- order = { props . route . params . order }
46
- onCheckStatus = { onCheckStatus }
47
- />
110
+ { paymentUI ( ) }
48
111
</ View >
49
112
) ;
50
113
} ;
0 commit comments