Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
beasy-mobile
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
4
Issues
4
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
G
beasy-mobile
Commits
23a83c2b
Commit
23a83c2b
authored
May 14, 2024
by
G
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
now with real amount and paymentUrl
parent
c1fcf8d3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
8 deletions
+30
-8
PaymentAmountInputScreen.tsx
src/screens/PaymentAmountInputScreen.tsx
+30
-8
No files found.
src/screens/PaymentAmountInputScreen.tsx
View file @
23a83c2b
...
@@ -9,7 +9,8 @@ import BackgroundDefault from "@components/backgrounds/BackgroundDefault";
...
@@ -9,7 +9,8 @@ import BackgroundDefault from "@components/backgrounds/BackgroundDefault";
import
Box
from
"@components/bases/Box"
;
import
Box
from
"@components/bases/Box"
;
import
Text
from
"@components/bases/Text"
;
import
Text
from
"@components/bases/Text"
;
import
{
useMutation
}
from
"@tanstack/react-query"
;
import
{
useMutation
}
from
"@tanstack/react-query"
;
import
{
useState
}
from
"react"
;
import
*
as
WebBrowser
from
"expo-web-browser"
;
import
{
useCallback
,
useState
}
from
"react"
;
import
{
useSafeAreaInsets
}
from
"react-native-safe-area-context"
;
import
{
useSafeAreaInsets
}
from
"react-native-safe-area-context"
;
const
PaymentAmountInputScreen
:
PaymentStackScreenComponentProps
<
"paymentAmountInputScreen"
>
=
({
const
PaymentAmountInputScreen
:
PaymentStackScreenComponentProps
<
"paymentAmountInputScreen"
>
=
({
...
@@ -41,26 +42,47 @@ const PaymentAmountInputScreen: PaymentStackScreenComponentProps<"paymentAmountI
...
@@ -41,26 +42,47 @@ const PaymentAmountInputScreen: PaymentStackScreenComponentProps<"paymentAmountI
};
};
const
omPaymentMutation
=
useMutation
({
const
omPaymentMutation
=
useMutation
({
mutationFn
:
()
=>
getTransactionsData
(
dummyObject
),
mutationFn
:
(
amount
:
number
)
=>
onSuccess
:
(
data
)
=>
{
getTransactionsData
({
console
.
log
(
"om starter response"
,
data
);
// biome-ignore lint/style/useNamingConvention: <explanation>
type_paiement
:
1
,
marchand
:
"1"
,
service
:
"1"
,
montant
:
amount
,
numero
:
"0707070707"
,
commentaire
:
"Un commentaire"
,
}),
onSuccess
:
async
(
data
)
=>
{
const
result
=
await
WebBrowser
.
openBrowserAsync
(
data
.
payment_url
);
// setResult(result);
console
.
log
(
"result"
,
result
);
},
},
onError
:
(
err
)
=>
{
onError
:
(
err
)
=>
{
console
.
log
(
"om start error "
,
err
);
console
.
log
(
"om start error "
,
err
);
},
},
});
});
const
handlePaymentButton
=
()
=>
{
const
_handlePressButtonAsync
=
async
()
=>
{
console
.
log
(
"openning browser ! "
);
const
result
=
await
WebBrowser
.
openBrowserAsync
(
"https://mpayment.orange-money.com/sx/mpayment/abstract/v13r49t9xznfvjxxngu31gz1ecpeenhpaethdyl4psuhzwlws64vvyixqywa8zcf"
,
);
// setResult(result);
console
.
log
(
"result"
,
result
);
};
const
handlePaymentButton
=
useCallback
(()
=>
{
switch
(
paymentType
)
{
switch
(
paymentType
)
{
case
"OM"
:
case
"OM"
:
console
.
log
(
"OM so we stays on screen"
);
console
.
log
(
"OM so we stays on screen !!"
);
omPaymentMutation
.
mutate
();
console
.
log
(
"Calling api with amount :: "
,
amountToPay
);
omPaymentMutation
.
mutate
(
amountToPay
);
break
;
break
;
default
:
default
:
navigation
.
navigate
(
"numberAndOtpForPaymentScreen"
);
navigation
.
navigate
(
"numberAndOtpForPaymentScreen"
);
break
;
break
;
}
}
};
}
,
[
amountToPay
,
omPaymentMutation
,
paymentType
,
navigation
])
;
return
(
return
(
<
BackgroundDefault
>
<
BackgroundDefault
>
...
...
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