feat(checkout): troca CPF por e-mail do pagador (PIX sem CPF confirmado no Orders API)
build-image / build-push (push) Successful in 6m39s

This commit is contained in:
jfeng committed 2026-10-22 00:15:31 -03:00
1 parent 8fab1e2ab6
commit 9748c8e9e0
3 files changed
+14 -17

No files matched your search

+6 -1
View File
@@ -51,9 +51,13 @@ app.get('/api/plans', (req, res) => {
app.post('/api/checkout', async (req, res) => {
try {
const { planId, mac, payerName, payerCpf, deviceId } = req.body || {};
const { planId, mac, payerName, payerEmail, payerCpf, deviceId } = req.body || {};
const plan = getDb().plans.find((p) => p.id === planId && p.active);
if (!plan) return res.status(400).json({ error: 'plano invalido' });
const email = String(payerEmail || '').trim();
if (!/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(email)) {
return res.status(400).json({ error: 'email invalido' });
}
if (payerCpf && !validCpf(payerCpf)) return res.status(400).json({ error: 'CPF invalido' });
// historico do comprador (primeira compra / ultima compra)
@@ -80,6 +84,7 @@ app.post('/api/checkout', async (req, res) => {
planId: plan.id,
planName: plan.name,
payerName,
payerEmail: email,
payerCpf,
firstPurchase,
registrationDate,
+2 -1
View File
@@ -63,6 +63,7 @@ export async function createPixPayment(opts) {
planId,
planName,
payerName,
payerEmail,
payerCpf,
firstPurchase,
registrationDate,
@@ -72,7 +73,7 @@ export async function createPixPayment(opts) {
const name = splitName(payerName);
const payer = {
email: '[email protected]',
email: payerEmail || '[email protected]',
first_name: name.first,
last_name: name.last,
entity_type: 'individual',