Add Integração Pixel X App#68
Open
moskoweb wants to merge 16 commits into
Open
Conversation
- Estrutura GSD inicializada (.planning/) - ROADMAP, STATE, REQUIREMENTS da integração Pixel X - CONTEXT.md com decisões validadas (10 eventos, token no body) - 5 PLAN.md em 2 waves: models/migrations → payload/job → subscriber/controller/frontend - Logo Pixel X salvo em public/images/integrations/ Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Migration pixel_x_integrations: tenant_id nullable+indexed, token text nullable, events json, is_active boolean - Migration pixel_x_integration_product: pivot sem timestamps, FKs cascade em ambas as tabelas, unique constraint - Migration pixel_x_integration_logs: apenas created_at (sem updated_at), indice composto (pixel_x_integration_id, created_at)
- Constante EVENT_STATUS_MAP com todos os 10 slugs Getfy → status Pixel X - Método build() retorna payload no formato proprietário Pixel X - Token incluído no body JSON (nunca no header Authorization) - recurrence.number preenchido apenas para eventos de assinatura - mapPaymentMethod() normaliza pix/pix_auto, card/credit_card, boleto - samplePayload() para testes manuais via WebhookPayloadBuilder::sampleTestPayload
- PixelXIntegration: casts encrypted em token, array em events, boolean em is_active - PixelXIntegration: scopeForTenant com suporte a null (whereNull), scopeActive, listensTo, shouldFireForProduct - PixelXIntegration: logs() hasMany ordenado por created_at desc, products() sem withTimestamps - PixelXIntegrationLog: timestamps=false, UPDATED_AT=null, relacionamento pixelXIntegration()
- index(), store(), update(), destroy(), test(), logs(), showLog() - authorizeIntegration() com abort(404) por tenant_id - test() usa Http::timeout(15) sem withToken() — token via PixelXPayloadBuilder::samplePayload() - store()/update() validam events.* com Rule::in nos 10 slugs Pixel X - update() só sobrescreve token quando request tem token não-vazio
…ompleto - tries=3, backoff=30, timeout=15s conforme especificação - Token enviado APENAS no body JSON via PixelXPayloadBuilder (não no header) - array_diff_key remove token do request_payload antes de gravar em PixelXIntegrationLog (T-01-02-02) - PixelXIntegrationLog::create em todos os branches: token inválido, sucesso, falha HTTP, exceção - release($this->backoff) em falha HTTP e exceção para retry automático
- Subscreve todos os eventos de config/webhook_events.php via subscribe() - Filtra pelos 10 slugs suportados pela Pixel X (ignora pedido_cancelado, assinatura_em_atraso, envio_acesso) - Busca PixelXIntegration::active() com whereIn tenant_ids e filtro listensTo/shouldFireForProduct - Despacha DispatchPixelXJob com (integrationId, eventSlug, webhookPayload) - Usa dispatchAfterResponse para eventos críticos (OrderCompleted, OrderPending) - Reutiliza WebhookPayloadBuilder para construir payload base
- Adiciona use App\Listeners\PixelXEventSubscriber no bloco de imports - Adiciona Event::subscribe(PixelXEventSubscriber::class) após CademiEventSubscriber
- 7 rotas /integracoes/pixel-x adicionadas dentro do middleware team.permission:integracoes.view - IntegrationsController.index() inclui pixel_x_integrations nos props Inertia - use App\Models\PixelXIntegration adicionado ao IntegrationsController
- Sidebar com 3 views: hub (lista), form (criar/editar) e logs (tabela)
- 10 eventos mapeados com slugs e labels conforme especificação
- Formulário com campos: Nome, URL, Token, eventos, produtos, toggle ativo
- Token nunca é pré-populado no formulário de edição (segurança T-01-05-01)
- Botão Testar via axios.post('/integracoes/pixel-x/{id}/test')
- Logs com detalhe em modal (request_payload + response_body)
- Endpoints: POST/PUT/DELETE/GET /integracoes/pixel-x
- Import PixelXSidebar e adição do componente no template - Entrada pixel_x na APPS_BASE com logo pixel-x.jpg - defineProps: pixel_x_integrations adicionado - Computed APPS: status 'active' para pixel_x baseado em integrações configuradas - Refs e funções: pixelXSidebarOpen, openPixelXSidebar, closePixelXSidebar, onPixelXSaved - Case pixel_x no onAppClick para abrir sidebar - router.reload com only: ['pixel_x_integrations', 'products'] após salvar
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.
No description provided.