-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnative_pay_choose.oldjs
More file actions
127 lines (123 loc) · 4.15 KB
/
native_pay_choose.oldjs
File metadata and controls
127 lines (123 loc) · 4.15 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
import React, { useState } from 'react'
import { Modal, Image, View, TouchableOpacity, StyleSheet, Text } from 'react-native'
import { LocalizedText } from '../../components/Localization'
import tstripe from 'tipsi-stripe'
import Icon from 'react-native-vector-icons/MaterialCommunityIcons'
import icoMoonConfig from '../../../assets/fonts/selection.json'
import { createIconSetFromIcoMoon } from 'react-native-vector-icons'
const Vicon = createIconSetFromIcoMoon(icoMoonConfig)
export default function NpChoose(props) {
const { amount = false, isVisible = false, optionSetup = false, optionNative = true, optionWeb = false } = props
const { onProgress = () => {}, payNative = () => {}, payWeb = () => {}, onClose = () => {} } = props
const nativePayName = (Platform.OS === 'ios') ? 'Apple' : 'Google'
const nativePayMark =
Platform.OS === 'ios'
? require('../../assets/applePayMark.png')
: require('../../assets/googlePayMark.png')
return (
<View style={styles.modal}>
<TouchableOpacity
style={{
right: 5,
top: 5,
position: 'absolute',
justifyContent: 'center',
alignItems: 'center'
}}
onPress={onClose}
>
<Icon name='window-close' size={25} color='#7e7e7e' style={{}} />
</TouchableOpacity>
{amount &&
<LocalizedText options={{ amount: amount }} style={styles.payModalTitle}>{`Confirm $${amount} payment with`}</LocalizedText>}
{!amount &&
<LocalizedText style={styles.payModalTitle}>{`Confirm payment with`}</LocalizedText>}
{optionNative &&
<TouchableOpacity
style={{ width: '100%' }}
onPress={() => {
onProgress({ event: 'np_choice', meta: { choice: 'native' } })
onClose()
payNative()
}}
>
<View style={styles.payButton}>
<View style={styles.nativePayWrapper}>
<Image source={nativePayMark} style={styles.nativePayMark} />
<LocalizedText style={styles.nativePayText}>{nativePayName} Pay</LocalizedText>
</View>
<Vicon name='chevron-right' size={20} color='#707070' />
</View>
</TouchableOpacity>}
{optionSetup &&
<TouchableOpacity
style={{ width: '100%' }}
onPress={() => {
onProgress({ event: 'np_choice', meta: { choice: 'setup' } })
tstripe.openNativePaySetup()
}}
>
<View style={styles.payButton}>
<View style={styles.nativePayWrapper}>
<Image source={nativePayMark} style={styles.nativePayMark} />
<LocalizedText style={styles.nativePayText}>Setup {nativePayName} Pay</LocalizedText>
</View>
<Vicon name='chevron-right' size={20} color='#707070' />
</View>
</TouchableOpacity>}
{optionWeb &&
<TouchableOpacity
style={{ width: '100%' }}
onPress={() => {
onProgress({ event: 'np_choice', meta: { choice: 'web' } })
onClose()
payWeb()
}}
>
<View style={styles.payButton}>
<View style={styles.nativePayWrapper}>
<Image source={stripePayMark} style={styles.nativePayMark} />
<LocalizedText style={styles.nativePayText}>Credit Card</LocalizedText>
</View>
<Vicon name='chevron-right' size={20} color='#707070' />
</View>
</TouchableOpacity>}
</View>
)
}
const styles = StyleSheet.create({
modal: {
backgroundColor: 'white',
padding: 22,
justifyContent: 'center',
alignItems: 'center',
borderRadius: 4,
borderColor: 'rgba(0, 0, 0, 0.1)'
},
payModalTitle: {
paddingBottom: 10,
fontSize: 18
},
payButton: {
width: '100%',
display: 'flex',
alignItems: 'center',
flexDirection: 'row',
justifyContent: 'space-between',
padding: 0,
margin: 5,
marginTop: 10
},
nativePayWrapper: {
display: 'flex',
flexDirection: 'row',
alignItems: 'center'
},
nativePayMark: {
margin: 10
},
nativePayText: {
// fontFamily: 'AzoSans-Regular',
fontSize: 20
}
})