Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
InvestCustomer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Giang Tran
InvestCustomer
Commits
daf5a609
Commit
daf5a609
authored
Mar 16, 2021
by
Giang Tran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push code
parent
0dd06b5b
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
97 additions
and
20 deletions
+97
-20
Deposit.js
src/Screens/Action/Deposit/Deposit.js
+62
-2
DepositView.js
src/Screens/Action/Deposit/DepositView.js
+19
-5
Item.js
src/Screens/Action/Deposit/Item.js
+6
-1
Payment.js
src/Screens/Payment/Payment.js
+0
-2
setup.js
src/Screens/Payment/setup.js
+4
-4
Button.js
src/components/Button.js
+2
-4
TextField.js
src/components/Input/TextField.js
+4
-2
Webview.js
src/components/Webview.js
+0
-0
No files found.
src/Screens/Action/Deposit/Deposit.js
View file @
daf5a609
import
React
from
'react'
;
import
React
,
{
useEffect
}
from
'react'
;
import
{
Alert
,
NativeEventEmitter
}
from
'react-native'
;
import
DepositView
from
'./DepositView'
;
import
DepositView
from
'./DepositView'
;
import
create_payment_link
from
'../../Payment/setup'
;
import
VnpayMerchant
,
{
VnpayMerchantModule
}
from
'react-native-vnpay-merchant'
;
const
eventEmitter
=
new
NativeEventEmitter
(
VnpayMerchantModule
);
const
Deposit
=
(
props
)
=>
{
const
Deposit
=
(
props
)
=>
{
return
<
DepositView
/>
;
const
{
method
}
=
props
.
route
.
params
;
useEffect
(()
=>
{
// mở sdk
eventEmitter
.
addListener
(
'PaymentBack'
,
(
e
)
=>
{
console
.
log
(
'Sdk back!'
);
// Đã available trên cả ios, android
if
(
e
)
{
switch
(
e
.
resultCode
)
{
case
0
:
console
.
log
(
'Sdk closed'
);
break
;
case
-
1
:
console
.
log
(
'Người dùng nhấn back từ sdk để quay lại'
);
break
;
case
10
:
//ios
console
.
log
(
'Người dùng nhấn chọn thanh toán qua app thanh toán (Mobile Banking, Ví...)'
,
);
break
;
case
99
:
console
.
log
(
'Người dùng nhấn back từ trang thanh toán thành công khi thanh toán qua thẻ khi gọi đến http://sdk.merchantbackapp'
,
);
}
}
});
return
()
=>
{
// khi tắt sdk
eventEmitter
.
removeAllListeners
(
'PaymentBack'
);
};
},
[]);
const
depositClick
=
(
money
,
note
)
=>
{
if
(
money
&&
note
)
{
if
(
method
.
agent
==
'VNPAY'
)
{
VnpayMerchant
.
show
({
iconBackName
:
'ic_back'
,
paymentUrl
:
create_payment_link
(
method
.
return_url
,
method
.
checkout_url
,
money
,
note
,
),
scheme
:
'sampleapp'
,
tmn_code
:
'FAHASA03'
,
});
}
}
else
{
Alert
(
'Bạn vui lòng điền đầy đủ thông tin!'
);
}
};
return
<
DepositView
depositClick
=
{
depositClick
}
/>
;
};
};
export
default
Deposit
;
export
default
Deposit
;
src/Screens/Action/Deposit/DepositView.js
View file @
daf5a609
import
React
from
'react'
;
import
React
,
{
useState
}
from
'react'
;
import
{
View
,
Text
,
StyleSheet
}
from
'react-native'
;
import
{
View
,
Text
,
StyleSheet
}
from
'react-native'
;
import
HeaderBack
from
'../../../components/Header/HeaderBack'
;
import
HeaderBack
from
'../../../components/Header/HeaderBack'
;
import
TextField
from
'../../../components/Input/TextField'
;
import
TextField
from
'../../../components/Input/TextField'
;
...
@@ -7,16 +7,30 @@ import Button from '../../../components/Button';
...
@@ -7,16 +7,30 @@ import Button from '../../../components/Button';
import
{
HEIGHTXD
}
from
'../../../Config/Functions'
;
import
{
HEIGHTXD
}
from
'../../../Config/Functions'
;
const
DepositView
=
(
props
)
=>
{
const
DepositView
=
(
props
)
=>
{
const
[
money
,
setMoney
]
=
useState
(
0
);
const
[
note
,
setNote
]
=
useState
(
''
);
return
(
return
(
<
View
style
=
{{
flex
:
1
}}
>
<
View
style
=
{{
flex
:
1
}}
>
<
HeaderBack
title
=
{
'Nạp tiền'
}
/
>
<
HeaderBack
title
=
{
'Nạp tiền'
}
/
>
<
View
style
=
{{
flex
:
1
,
paddingHorizontal
:
10
,
paddingTop
:
10
}}
>
<
View
style
=
{{
flex
:
1
,
paddingHorizontal
:
10
,
paddingTop
:
10
}}
>
<
TextField
title
=
{
'Số tiền'
}
/
>
<
TextField
<
TextField
title
=
{
'Phương thức nạp'
}
/
>
value
=
{
money
}
<
TextMulti
numberLines
=
{
3
}
title
=
{
'Ghi chú'
}
/
>
isNumber
=
{
true
}
onChangeText
=
{(
val
)
=>
setMoney
(
val
)}
title
=
{
'Số tiền'
}
/
>
<
TextMulti
onChangeText
=
{(
val
)
=>
setNote
(
val
)}
numberLines
=
{
3
}
title
=
{
'Ghi chú'
}
/
>
<
/View
>
<
/View
>
<
View
style
=
{
styles
.
containerBtn
}
>
<
View
style
=
{
styles
.
containerBtn
}
>
<
Button
title
=
{
'Nạp tiền'
}
/
>
<
Button
title
=
{
'Nạp tiền'
}
onClick
=
{()
=>
props
.
depositClick
(
money
,
note
)}
/
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
);
);
...
...
src/Screens/Action/Deposit/Item.js
View file @
daf5a609
...
@@ -9,12 +9,17 @@ import {
...
@@ -9,12 +9,17 @@ import {
import
R
from
'../../../assets/R'
;
import
R
from
'../../../assets/R'
;
import
Block
from
'../../../components/Block'
;
import
Block
from
'../../../components/Block'
;
import
Icon
from
'react-native-vector-icons/MaterialCommunityIcons'
;
import
Icon
from
'react-native-vector-icons/MaterialCommunityIcons'
;
import
{
DEPOSIT
}
from
'../../../routers/ScreenNames'
;
import
{
useNavigation
}
from
'@react-navigation/native'
;
const
Item
=
(
props
)
=>
{
const
Item
=
(
props
)
=>
{
const
{
item
}
=
props
;
const
{
item
}
=
props
;
const
navigate
=
useNavigation
();
return
(
return
(
<
TouchableOpacity
<
TouchableOpacity
onPress
=
{()
=>
console
.
log
(
'hello'
)}
onPress
=
{()
=>
navigate
.
navigate
(
DEPOSIT
,
{
method
:
item
}
)}
style
=
{
styles
.
containerItem
}
>
style
=
{
styles
.
containerItem
}
>
<
Image
source
=
{{
uri
:
item
.
logo_url
}}
style
=
{
styles
.
imgIcon
}
/
>
<
Image
source
=
{{
uri
:
item
.
logo_url
}}
style
=
{
styles
.
imgIcon
}
/
>
<
Text
>
{
item
.
agent
}
<
/Text
>
<
Text
>
{
item
.
agent
}
<
/Text
>
...
...
src/Screens/Payment/Payment.js
View file @
daf5a609
...
@@ -18,8 +18,6 @@ const eventEmitter = new NativeEventEmitter(VnpayMerchantModule);
...
@@ -18,8 +18,6 @@ const eventEmitter = new NativeEventEmitter(VnpayMerchantModule);
const
Payment
=
(
props
)
=>
{
const
Payment
=
(
props
)
=>
{
const
[
text
,
setText
]
=
useState
(
'OpenSDK'
);
const
[
text
,
setText
]
=
useState
(
'OpenSDK'
);
console
.
log
(
'Link create payment'
);
useEffect
(()
=>
{
useEffect
(()
=>
{
// mở sdk
// mở sdk
eventEmitter
.
addListener
(
'PaymentBack'
,
(
e
)
=>
{
eventEmitter
.
addListener
(
'PaymentBack'
,
(
e
)
=>
{
...
...
src/Screens/Payment/setup.js
View file @
daf5a609
...
@@ -17,7 +17,7 @@ function sortObject(o) {
...
@@ -17,7 +17,7 @@ function sortObject(o) {
return
sorted
;
return
sorted
;
}
}
function
create_payment_link
()
{
function
create_payment_link
(
return_url
,
checkout_url
,
money
,
note
)
{
/*var ipAddr = req.headers['x-forwarded-for'] ||
/*var ipAddr = req.headers['x-forwarded-for'] ||
req.connection.remoteAddress ||
req.connection.remoteAddress ||
req.socket.remoteAddress ||
req.socket.remoteAddress ||
...
@@ -34,14 +34,14 @@ function create_payment_link() {
...
@@ -34,14 +34,14 @@ function create_payment_link() {
var
tmnCode
=
'ICTLIFE1'
;
var
tmnCode
=
'ICTLIFE1'
;
var
secretKey
=
'ISDFGWJZVJFABUMZYKDFOSYWHHYNAPFS'
;
var
secretKey
=
'ISDFGWJZVJFABUMZYKDFOSYWHHYNAPFS'
;
var
vnpUrl
=
'http://sandbox.vnpayment.vn/paymentv2/vpcpay.html'
;
var
vnpUrl
=
'http://sandbox.vnpayment.vn/paymentv2/vpcpay.html'
;
var
returnUrl
=
'http://my.dcvinvest.com/app-vnpay-return-url.html'
;
var
returnUrl
=
return_url
;
var
date
=
new
Date
();
var
date
=
new
Date
();
var
createDate
=
dateFormat
(
date
,
'yyyymmddHHmmss'
);
var
createDate
=
dateFormat
(
date
,
'yyyymmddHHmmss'
);
var
orderId
=
dateFormat
(
date
,
'HHmmss'
);
var
orderId
=
dateFormat
(
date
,
'HHmmss'
);
//var amount = req.body.amount;
//var amount = req.body.amount;
var
amount
=
25000
;
var
amount
=
money
;
//var bankCode = req.body.bankCode;
//var bankCode = req.body.bankCode;
var
bankCode
=
''
;
var
bankCode
=
''
;
...
@@ -49,7 +49,7 @@ function create_payment_link() {
...
@@ -49,7 +49,7 @@ function create_payment_link() {
var orderType = req.body.orderType;
var orderType = req.body.orderType;
var locale = req.body.language;*/
var locale = req.body.language;*/
var
orderInfo
=
'Thanh toan vnpay'
;
var
orderInfo
=
note
;
var
orderType
=
'150000'
;
var
orderType
=
'150000'
;
var
locale
=
''
;
var
locale
=
''
;
...
...
src/components/Button.js
View file @
daf5a609
...
@@ -11,11 +11,9 @@ import {colors, sizes} from '../assets/theme';
...
@@ -11,11 +11,9 @@ import {colors, sizes} from '../assets/theme';
import
{
getFontXD
,
HEIGHTXD
,
WIDTHXD
}
from
'../Config/Functions'
;
import
{
getFontXD
,
HEIGHTXD
,
WIDTHXD
}
from
'../Config/Functions'
;
const
Button
=
(
props
)
=>
{
const
Button
=
(
props
)
=>
{
const
{
title
}
=
props
;
const
{
title
,
onClick
}
=
props
;
return
(
return
(
<
TouchableOpacity
<
TouchableOpacity
style
=
{
styles
.
container
}
onPress
=
{()
=>
onClick
()}
>
style
=
{
styles
.
container
}
onPress
=
{()
=>
console
.
log
(
'hello'
)}
>
<
ImageBackground
<
ImageBackground
imageStyle
=
{{
imageStyle
=
{{
borderRadius
:
20
,
borderRadius
:
20
,
...
...
src/components/Input/TextField.js
View file @
daf5a609
...
@@ -4,7 +4,7 @@ import {HEIGHTXD, WIDTHXD, getFontXD} from '../../Config/Functions';
...
@@ -4,7 +4,7 @@ import {HEIGHTXD, WIDTHXD, getFontXD} from '../../Config/Functions';
import
R
from
'../../assets/R'
;
import
R
from
'../../assets/R'
;
const
TextField
=
(
props
)
=>
{
const
TextField
=
(
props
)
=>
{
const
{
title
,
onChangeText
,
maxLength
}
=
props
;
const
{
title
,
onChangeText
,
maxLength
,
isNumber
,
value
}
=
props
;
return
(
return
(
<
View
style
=
{{
marginVertical
:
5
}}
>
<
View
style
=
{{
marginVertical
:
5
}}
>
...
@@ -17,8 +17,10 @@ const TextField = (props) => {
...
@@ -17,8 +17,10 @@ const TextField = (props) => {
{
title
?
title
:
''
}
{
title
?
title
:
''
}
<
/Text
>
<
/Text
>
<
TextInput
<
TextInput
maxLength
=
{
maxLength
}
maxLength
=
{
maxLength
?
maxLength
:
256
}
placeholderTextColor
=
{
R
.
colors
.
placeHolder
}
placeholderTextColor
=
{
R
.
colors
.
placeHolder
}
value
=
{
value
}
keyboardType
=
{
isNumber
?
'number-pad'
:
'default'
}
onChangeText
=
{(
val
)
=>
onChangeText
(
val
)}
onChangeText
=
{(
val
)
=>
onChangeText
(
val
)}
style
=
{{
style
=
{{
height
:
HEIGHTXD
(
109
),
height
:
HEIGHTXD
(
109
),
...
...
src/components/Webview.js
0 → 100644
View file @
daf5a609
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment