Repository navigation
Conversation
New opt-in `checkout.personsOnly` gate in store config: checkout answers 403 CKT807 with a pt-BR/en-US user message when the customer or any transaction buyer has `registry_type: 'j'` or a 14-digit document (CNPJ). Runs before the customer is saved, so a refused company doesn't create or update a customer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Fechando: o bloqueio de CNPJ da Mundo Quadri vai ser resolvido só na frente de loja (input de documento aceitando apenas CPF), sem gate no servidor. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problema
Algumas lojas vendem só para pessoa física e precisam recusar pedidos com CNPJ. Hoje o checkout aceita qualquer comprador, e esconder a opção "Pessoa jurídica" na vitrine não basta, porque o checkout pode ser chamado direto ou com um CNPJ marcado como pessoa física.
Solução
Novo gate opt-in
checkout.personsOnlyna config da loja (functions/config.json), ao lado decustomersOnly,requireStaffSignatureeminSubtotal:{ "checkout": { "personsOnly": true } }getCompanyGateErroremfunctions-checkout/customer-gates.tsrecusa quando ocustomerou qualquertransaction.buyertemregistry_type: 'j'ou documento com 14 dígitos (CNPJ). O caso do CNPJ enviado comregistry_type: 'p'também é recusado.CKT807, comuser_messageem pt-BR e en-US. O checkout do Storefront já exibe essa mensagem: "Esta loja vende somente para pessoa física (CPF), compras com CNPJ não são permitidas".readOrSaveCustomer: um comprador recusado não cria nem atualiza cliente. Otransaction.buyertemregistry_typeedoc_numberobrigatórios no schema, então a checagem não depende dos campos mesclados do cliente salvo.personsOnlynada muda.Verificação
packages/modules/tests/3-customer-gates.test.ts: novo caso cobrindo gate desligado, só pessoas físicas, PJ porregistry_type, CNPJ marcado comope CNPJ formatado.3-customer-gatese4-checkout-customer-guard: 13/13.turbo run build --filter=./packages/modules...(tsc) e ESLint limpos.Primeira loja a usar: Mundo Quadri (https://github.com/mundoquadri/mundoquadri/tree/main-bloqueio-cnpj).
🤖 Generated with Claude Code