Integrate with the rest of the flow

This commit is contained in:
enzoggqs 2022-12-08 20:35:27 -03:00
parent a99c872b5c
commit 87de79201c

View File

@ -4,7 +4,6 @@ import { ref } from "vue";
import { debounce } from "@/utils/debounce"; import { debounce } from "@/utils/debounce";
import CustomButton from "./CustomButton.vue"; import CustomButton from "./CustomButton.vue";
import api from "../services/index"; import api from "../services/index";
import { AxiosError } from 'axios';
const props = defineProps({ const props = defineProps({
pixTarget: String, pixTarget: String,
@ -12,6 +11,7 @@ const props = defineProps({
}); });
console.log(props.tokenValue); console.log(props.tokenValue);
console.log(props.pixTarget);
const qrCode = ref<string>(""); const qrCode = ref<string>("");
const qrCodePayload = ref<string>(""); const qrCodePayload = ref<string>("");
@ -20,7 +20,6 @@ const pixQrCode = pix({
value: props.tokenValue, value: props.tokenValue,
}); });
const pixIsValid = ref<number>(0); const pixIsValid = ref<number>(0);
const stateButton = ref(false);
pixQrCode.base64QrCode().then((code: string) => { pixQrCode.base64QrCode().then((code: string) => {
qrCode.value = code; qrCode.value = code;
@ -35,7 +34,7 @@ const handleInputEvent = (event: any) => {
}; };
const validatePix = async (value: any) => { const validatePix = async (value: any) => {
console.log(value) console.log(value);
if(value == ''){ if(value == ''){
pixIsValid.value = 0; pixIsValid.value = 0;
return; return;
@ -43,37 +42,34 @@ const validatePix = async (value: any) => {
var sellerPixKey = props.pixTarget; var sellerPixKey = props.pixTarget;
var transactionValue = props.tokenValue; var transactionValue = props.tokenValue;
// var body_req = { if(sellerPixKey && transactionValue){
// e2e_id: value, var body_req = {
// pix_key: sellerPixKey, e2e_id: value,
// pix_value: transactionValue, pix_key: sellerPixKey,
// }; pix_value: transactionValue,
var body_req = { };
e2e_id: value, var resp = await api.post("http://localhost:8000/validate_pix", body_req)
pix_key: "12345678", .catch((reason: Error) => {
pix_value: 100, console.log('entrou no erro', reason);
}; pixIsValid.value = 2;
var resp = await api.post("http://localhost:8000/validate_pix", body_req) return;
.catch((reason: Error) => { });
console.log('entrou no erro', reason); console.log("🚀 ~ file: QrCodeForm.vue:47 ~ validatePix ~ resp", resp);
pixIsValid.value = 2; console.log(resp.status);
return;
});
console.log("🚀 ~ file: QrCodeForm.vue:47 ~ validatePix ~ resp", resp);
console.log(resp.status);
pixIsValid.value = 1; pixIsValid.value = 1;
} else {
pixIsValid.value = 0;
}
}; };
</script> </script>
<template> <template>
<div class="page"> <div class="page">
<div class="text-container"> <div class="text-container">
<!-- <h2 class="text-center font-bold text-emerald-50 text-2xl"></h2> -->
<span class="text font-extrabold text-2xl max-w-[30rem]"> <span class="text font-extrabold text-2xl max-w-[30rem]">
Utilize o QR Code ou copie o código para realizar o Pix Utilize o QR Code ou copie o código para realizar o Pix
</span> </span>
<!-- <h4 class="text-center"> -->
<span class="text font-medium text-md max-w-[28rem]"> <span class="text font-medium text-md max-w-[28rem]">
Após realizar o Pix no banco de sua preferência, insira o código de Após realizar o Pix no banco de sua preferência, insira o código de
autenticação para enviar a transação para a rede. autenticação para enviar a transação para a rede.