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
db5ab177
Commit
db5ab177
authored
Jun 07, 2024
by
G
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
had to suddenly add basic token auth because koffi couldn't be bothered to warn me.
parent
1efc9808
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
4 deletions
+28
-4
getPaymentTypes.ts
src/utils/requests/getPaymentTypes.ts
+9
-4
orangePayment.ts
src/utils/requests/orangePayment.ts
+12
-0
transactions.ts
src/utils/requests/transactions.ts
+7
-0
No files found.
src/utils/requests/getPaymentTypes.ts
View file @
db5ab177
import
{
LOG
}
from
"@logger"
;
import
base64
from
"react-native-base64"
;
import
axiosRequest
from
"../axios-request"
;
import
{
IpaginatedResponse
,
IpaymentType
}
from
"./Types"
;
import
type
{
IpaginatedResponse
,
IpaymentType
}
from
"./Types"
;
const
basictoken
=
base64
.
encode
(
"admin:admin"
);
const
log
=
LOG
.
extend
(
"getPaymentTypes"
);
const
getPaymentTypes
=
async
()
=>
{
...
...
@@ -8,11 +11,13 @@ const getPaymentTypes = async () => {
const
response
=
await
axiosRequest
<
IpaginatedResponse
<
IpaymentType
[]
>>
({
url
:
"/operateur/"
,
method
:
"GET"
,
headers
:
{
// biome-ignore lint/style/useNamingConvention: <explanation>
Authorization
:
`Basic
${
basictoken
}
`
,
},
});
log
.
http
(
JSON
.
stringify
(
response
,
null
,
2
));
return
response
return
response
;
};
export
default
getPaymentTypes
;
src/utils/requests/orangePayment.ts
View file @
db5ab177
import
{
LOG
}
from
"@logger"
;
import
base64
from
"react-native-base64"
;
import
axiosRequest
from
"../axios-request"
;
export
interface
IorangePaymentStarter
{
...
...
@@ -24,6 +25,8 @@ export interface IorangeResponse {
order_id
:
string
;
}
const
basictoken
=
base64
.
encode
(
"admin:admin"
);
type
OrangeStatus
=
"INITIATED"
|
"SUCCESS"
|
"FAILED"
;
export
interface
IorangePaymentStatus
{
status
:
OrangeStatus
;
...
...
@@ -40,10 +43,15 @@ const log = LOG.extend("orangePayment");
export
const
getTransactionsData
=
async
(
payload
:
IorangePaymentStarter
)
=>
{
log
.
http
(
"getTransactionsData"
,
payload
);
// const basictoken = base64.encode("admin:admin");
const
response
=
await
axiosRequest
<
IorangeResponse
>
({
url
:
"/transactions/"
,
method
:
"POST"
,
headers
:
{
// biome-ignore lint/style/useNamingConvention: <explanation>
Authorization
:
`Basic
${
basictoken
}
`
,
},
data
:
payload
,
});
...
...
@@ -59,6 +67,10 @@ export const getTransactionStatus = async (orderId: string) => {
const
response
=
await
axiosRequest
<
IorangePaymentStatus
>
({
url
:
`/api/TransactionCheckStatus/
${
orderId
}
/`
,
method
:
"GET"
,
headers
:
{
// biome-ignore lint/style/useNamingConvention: <explanation>
Authorization
:
`Basic
${
basictoken
}
`
,
},
});
log
.
http
(
"getTransactionStatus |"
,
JSON
.
stringify
(
response
,
null
,
2
));
...
...
src/utils/requests/transactions.ts
View file @
db5ab177
import
{
LOG
}
from
"@logger"
;
import
base64
from
"react-native-base64"
;
import
axiosRequest
from
"../axios-request"
;
import
type
{
PaymentCode
}
from
"./Types"
;
...
...
@@ -26,10 +27,16 @@ export interface Transaction {
}
export
const
getTransactionsHistory
=
async
():
Promise
<
Transaction
[]
>
=>
{
const
basictoken
=
base64
.
encode
(
"admin:admin"
);
log
.
http
(
"getTransactionsHistory"
);
try
{
const
response
=
await
axiosRequest
<
Transaction
[]
>
({
url
:
"/transactions/"
,
headers
:
{
// biome-ignore lint/style/useNamingConvention: <explanation>
Authorization
:
`Basic
${
basictoken
}
`
,
},
});
log
.
http
(
"getTransactionsHistory |"
,
JSON
.
stringify
(
response
,
null
,
2
));
...
...
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