Fixes bbPay interface with proper calls.
This commit is contained in:
parent
8eb10f493f
commit
75c02ed1b9
@ -1,3 +1,5 @@
|
|||||||
|
import { off } from "process";
|
||||||
|
|
||||||
export interface Participant {
|
export interface Participant {
|
||||||
offer: string;
|
offer: string;
|
||||||
chainID: number;
|
chainID: number;
|
||||||
@ -24,37 +26,42 @@ export interface Offer {
|
|||||||
|
|
||||||
export const createParticipant = async (participant: Participant) => {
|
export const createParticipant = async (participant: Participant) => {
|
||||||
console.log("Creating participant", participant);
|
console.log("Creating participant", participant);
|
||||||
const response = await fetch(
|
const response = await fetch(`${import.meta.env.VITE_APP_API_URL}/register`, {
|
||||||
`${import.meta.env.VITE_APP_API_URL}/participants`,
|
method: "POST",
|
||||||
{
|
headers: {
|
||||||
method: "PUT",
|
"Content-Type": "application/json",
|
||||||
headers: {
|
},
|
||||||
"Content-Type": "application/json",
|
body: JSON.stringify({
|
||||||
},
|
chainID: participant.chainID,
|
||||||
body: JSON.stringify(participant),
|
tipoDocumento: 1,
|
||||||
}
|
numeroDocumento: participant.identification,
|
||||||
);
|
numeroConta: participant.account,
|
||||||
|
numeroAgencia: participant.branch,
|
||||||
|
tipoConta: participant.accountType,
|
||||||
|
codigoIspb: participant.bankIspb,
|
||||||
|
}),
|
||||||
|
});
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
return { ...participant, id: data.id } as ParticipantWithID;
|
return { ...participant, id: data.id } as ParticipantWithID;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const createSolicitation = async (offer: Offer) => {
|
export const createSolicitation = async (offer: Offer) => {
|
||||||
const response = await fetch(
|
const response = await fetch(`${import.meta.env.VITE_APP_API_URL}/request`, {
|
||||||
`${import.meta.env.VITE_APP_API_URL}/solicitation`,
|
method: "POST",
|
||||||
{
|
headers: {
|
||||||
method: "POST",
|
"Content-Type": "application/json",
|
||||||
headers: {
|
},
|
||||||
"Content-Type": "application/json",
|
body: JSON.stringify({
|
||||||
},
|
amount: offer.amount,
|
||||||
body: JSON.stringify(offer),
|
pixTarget: offer.sellerId,
|
||||||
}
|
}),
|
||||||
);
|
});
|
||||||
return response.json();
|
return response.json();
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getSolicitation = async (id: string) => {
|
export const getSolicitation = async (id: string) => {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`${import.meta.env.VITE_APP_API_URL}/solicitation/${id}`
|
`${import.meta.env.VITE_APP_API_URL}/release/${id}`
|
||||||
);
|
);
|
||||||
|
|
||||||
const obj: any = response.json();
|
const obj: any = response.json();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user