add dummy payment app to monorepo#2335
Conversation
|
|
The latest updates on your projects. Learn more about Vercel for GitHub. 9 Skipped Deployments
|
| }, | ||
|
|
||
| ignoreOutgoingUrls: [ | ||
| (url) => url.includes("ingest.sentry.io"), |
| onClick={() => { | ||
| setNotFoundError(false); | ||
| if (transactionId) { | ||
| router.push(`/app/transactions/${transactionId}`); |
Differences Found✅ No packages or licenses were added. SummaryExpand
|
There was a problem hiding this comment.
Pull request overview
Adds a new “dummy-payment” Next.js app under apps/ intended to act as a dummy payment gateway for exercising Saleor Transactions API flows in this monorepo.
Changes:
- Introduces a full Next.js Pages Router app with Saleor App SDK integration (manifest/register endpoints + sync webhooks).
- Adds tRPC + urql GraphQL client plumbing plus UI pages for checkout/transactions tooling.
- Adds observability/logging scaffolding (OpenTelemetry + Sentry) and local tooling (codegen, vitest, docker devfile).
Reviewed changes
Copilot reviewed 115 out of 128 changed files in this pull request and generated 23 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/dummy-payment/vitest.config.ts | Adds Vitest config for the new app |
| apps/dummy-payment/tsconfig.json | Adds TypeScript config for the new app |
| apps/dummy-payment/src/trpc-client.ts | Adds tRPC Next client configuration |
| apps/dummy-payment/src/styles/globals.css | Adds global CSS for the app |
| apps/dummy-payment/src/setup-tests.ts | Adds Vitest setup placeholder |
| apps/dummy-payment/src/server/server.ts | Adds base tRPC server helpers |
| apps/dummy-payment/src/server/routers/transaction-reporter.router.ts | Adds tRPC router for reporting transaction events |
| apps/dummy-payment/src/server/routers/app-router.ts | Composes tRPC app router |
| apps/dummy-payment/src/server/procedure/procedure-with-graphql-client.ts | Adds tRPC middleware to attach a GraphQL client |
| apps/dummy-payment/src/server/middleware/attach-app-token.ts | Adds middleware to fetch APL token for Saleor |
| apps/dummy-payment/src/saleor-app.ts | Configures SaleorApp + selectable APL backends |
| apps/dummy-payment/src/providers/GraphQLProvider.tsx | Adds urql Provider based on AppBridge state |
| apps/dummy-payment/src/pages/index.tsx | Adds public landing page + install helper |
| apps/dummy-payment/src/pages/app/transactions/index.tsx | Adds transaction lookup page (PSP/id) |
| apps/dummy-payment/src/pages/app/transactions/[id].tsx | Adds transaction details + event reporting UI |
| apps/dummy-payment/src/pages/app/index.tsx | Adds app “home” page |
| apps/dummy-payment/src/pages/app/configuration.tsx | Adds placeholder configuration page |
| apps/dummy-payment/src/pages/app/checkout.tsx | Adds UI for creating checkout + initializing transaction |
| apps/dummy-payment/src/pages/api/webhooks/transaction-refund-requested.ts | Adds TRANSACTION_REFUND_REQUESTED sync webhook |
| apps/dummy-payment/src/pages/api/webhooks/transaction-process-session.ts | Adds TRANSACTION_PROCESS_SESSION sync webhook |
| apps/dummy-payment/src/pages/api/webhooks/transaction-initialize-session.ts | Adds TRANSACTION_INITIALIZE_SESSION sync webhook |
| apps/dummy-payment/src/pages/api/webhooks/transaction-charge-requested.ts | Adds TRANSACTION_CHARGE_REQUESTED sync webhook |
| apps/dummy-payment/src/pages/api/webhooks/transaction-cancel-requested.ts | Adds TRANSACTION_CANCELATION_REQUESTED sync webhook |
| apps/dummy-payment/src/pages/api/webhooks/payment-gateway-initialize-session.ts | Adds PAYMENT_GATEWAY_INITIALIZE_SESSION sync webhook |
| apps/dummy-payment/src/pages/api/trpc/[trpc].ts | Adds tRPC Next API handler and context |
| apps/dummy-payment/src/pages/api/register.ts | Adds Saleor app registration endpoint |
| apps/dummy-payment/src/pages/api/manifest.ts | Adds Saleor manifest endpoint wiring webhooks |
| apps/dummy-payment/src/pages/_app.tsx | Adds Next.js app shell with AppBridge + providers |
| apps/dummy-payment/src/order-example.tsx | Adds example component querying orders |
| apps/dummy-payment/src/modules/validation/sync-transaction.ts | Adds Zod schema for controlling webhook behavior |
| apps/dummy-payment/src/modules/validation/refund-webhook.ts | Adds Zod schema/response types for refund webhook |
| apps/dummy-payment/src/modules/validation/common.ts | Adds shared Zod enums/schemas |
| apps/dummy-payment/src/modules/validation/charge-webhook.ts | Adds Zod schema/response types for charge webhook |
| apps/dummy-payment/src/modules/validation/cancel-webhook.ts | Adds Zod schema/response types for cancel webhook |
| apps/dummy-payment/src/modules/url/app-url-generator.ts | Adds helper to build dashboard URLs back to the app |
| apps/dummy-payment/src/modules/transaction/transaction-refund-checker.ts | Adds helper for refund amount checking |
| apps/dummy-payment/src/modules/transaction/transaction-psp-finder.ts | Adds helper to find PSP reference from events |
| apps/dummy-payment/src/modules/configuration/app-config.ts | Adds (placeholder) app configuration schema |
| apps/dummy-payment/src/logger-context.ts | Adds server-side logger context singleton |
| apps/dummy-payment/src/lib/zod-error.ts | Adds helper to flatten Zod errors to a message string |
| apps/dummy-payment/src/lib/transaction-actions.ts | Adds mapping from event type to available actions |
| apps/dummy-payment/src/lib/theme-synchronizer.tsx | Syncs Macaw theme to Dashboard theme |
| apps/dummy-payment/src/lib/otel/shared-config.ts | Adds shared OTEL config |
| apps/dummy-payment/src/lib/otel/otel-wrapper.ts | Adds wrapper to create spans and flush OTEL |
| apps/dummy-payment/src/lib/otel/otel-traces-setup.ts | Adds OTEL trace exporter/processor setup |
| apps/dummy-payment/src/lib/otel/otel-tracer.ts | Adds tracer getter |
| apps/dummy-payment/src/lib/otel/otel-logs-setup.ts | Adds OTEL logs exporter/processor setup |
| apps/dummy-payment/src/lib/otel/otel-graphql-utils.ts | Adds span attribute helpers for GraphQL |
| apps/dummy-payment/src/lib/otel/otel-exchange.ts | Adds urql exchange emitting OTEL spans |
| apps/dummy-payment/src/lib/otel/lib/race.ts | Adds timeout helper used for flushes |
| apps/dummy-payment/src/lib/otel/lib/observability-attributes.ts | Adds OTEL attribute names/constants |
| apps/dummy-payment/src/lib/otel/instrumentation.ts | Adds NodeSDK OTEL instrumentation setup |
| apps/dummy-payment/src/lib/otel/get-attributes-from-request.ts | Adds request->span attribute extraction |
| apps/dummy-payment/src/lib/no-ssr-wrapper.tsx | Adds SPA-only wrapper for iframe usage |
| apps/dummy-payment/src/lib/logger/logger.ts | Adds tslog base logger + formatter |
| apps/dummy-payment/src/lib/logger/logger-vercel-transport.ts | Adds Vercel runtime log drain transport |
| apps/dummy-payment/src/lib/logger/logger-sentry-transport.ts | Adds Sentry breadcrumb transport |
| apps/dummy-payment/src/lib/logger/logger-context.ts | Adds AsyncLocalStorage-based logger context |
| apps/dummy-payment/src/lib/logger/logger-console-transport.ts | Adds local console transport |
| apps/dummy-payment/src/lib/logger/create-logger.ts | Wires transports + exports logger factory |
| apps/dummy-payment/src/lib/is-in-iframe.ts | Adds iframe detection helper |
| apps/dummy-payment/src/lib/invariant.ts | Adds invariant helper + error type |
| apps/dummy-payment/src/lib/create-graphql-client.ts | Adds urql client factory with auth exchange |
| apps/dummy-payment/src/errors.ts | Adds base error types for the app |
| apps/dummy-payment/src/db/dynamo-main-table.ts | Adds DynamoDB table wrapper for APL |
| apps/dummy-payment/src/db/dynamo-client.ts | Adds DynamoDB client creation helper |
| apps/dummy-payment/src/components/StatusChip.tsx | Adds status chip component for event types |
| apps/dummy-payment/src/components/NavigationTile.tsx | Adds navigation tile component |
| apps/dummy-payment/src/components/Navigation.tsx | Adds app navigation bar and routes |
| apps/dummy-payment/src/components/AppContent.tsx | Adds wrapper for app content layout |
| apps/dummy-payment/sentry.server.config.ts | Adds Sentry server config |
| apps/dummy-payment/sentry.edge.config.ts | Adds Sentry edge config |
| apps/dummy-payment/sentry.client.config.ts | Adds Sentry client config |
| apps/dummy-payment/scripts/generate-app-webhooks-types.ts | Adds script to generate TS types from Saleor JSON schemas |
| apps/dummy-payment/public/logo.png | Adds app logo asset |
| apps/dummy-payment/package.json | Adds app package definition and dependencies |
| apps/dummy-payment/next.config.js | Adds Next.js config (Sentry + analyzer + OTEL warning ignore) |
| apps/dummy-payment/next-env.d.ts | Adds Next.js TS env types |
| apps/dummy-payment/graphql/subscriptions/TransactionRefundRequested.graphql | Adds subscription document for codegen |
| apps/dummy-payment/graphql/subscriptions/TransactionProcessSession.graphql | Adds subscription document for codegen |
| apps/dummy-payment/graphql/subscriptions/TransactionInitializeSession.graphql | Adds subscription document for codegen |
| apps/dummy-payment/graphql/subscriptions/TransactionChargeRequested.graphql | Adds subscription document for codegen |
| apps/dummy-payment/graphql/subscriptions/TransactionCancelRequested.graphql | Adds subscription document for codegen |
| apps/dummy-payment/graphql/subscriptions/PaymentGatewayInitializeSession.graphql | Adds subscription document for codegen |
| apps/dummy-payment/graphql/subscriptions/.gitkeep | Keeps subscriptions dir tracked |
| apps/dummy-payment/graphql/queries/TransactionDetailsViaPsp.graphql | Adds query for transaction lookup by PSP |
| apps/dummy-payment/graphql/queries/TransactionDetailsViaId.graphql | Adds query for transaction lookup by id |
| apps/dummy-payment/graphql/queries/ProductList.graphql | Adds query for products list |
| apps/dummy-payment/graphql/queries/FetchAppDetails.graphql | Adds query for app metadata |
| apps/dummy-payment/graphql/queries/ChannelsList.graphql | Adds query for channels |
| apps/dummy-payment/graphql/queries/.gitkeep | Keeps queries dir tracked |
| apps/dummy-payment/graphql/mutations/UpdateDelivery.graphql | Adds mutation to set delivery method |
| apps/dummy-payment/graphql/mutations/TransactionEventReport.graphql | Adds mutation to report transaction events |
| apps/dummy-payment/graphql/mutations/InitializeTransaction.graphql | Adds mutation to initialize a transaction |
| apps/dummy-payment/graphql/mutations/CreateCheckout.graphql | Adds mutation to create checkout |
| apps/dummy-payment/graphql/mutations/CompleteCheckout.graphql | Adds mutation to complete checkout |
| apps/dummy-payment/graphql/mutations/.gitkeep | Keeps mutations dir tracked |
| apps/dummy-payment/graphql/fragments/TransactionRefundRequestedEvent.graphql | Adds webhook fragment |
| apps/dummy-payment/graphql/fragments/TransactionProcessSessionEvent.graphql | Adds webhook fragment |
| apps/dummy-payment/graphql/fragments/TransactionInitializeSessionEvent.graphql | Adds webhook fragment |
| apps/dummy-payment/graphql/fragments/TransactionChargeRequestedEvent.graphql | Adds webhook fragment |
| apps/dummy-payment/graphql/fragments/TransactionCancelRequestedEvent.graphql | Adds webhook fragment |
| apps/dummy-payment/graphql/fragments/Transaction.graphql | Adds transaction fragment |
| apps/dummy-payment/graphql/fragments/SyncWebhookTransaction.graphql | Adds sync webhook transaction fragment |
| apps/dummy-payment/graphql/fragments/PaymentGatewayRecipient.graphql | Adds recipient fragment |
| apps/dummy-payment/graphql/fragments/PaymentGatewayInitializeSessionEvent.graphql | Adds webhook fragment |
| apps/dummy-payment/graphql/fragments/Money.graphql | Adds money fragment |
| apps/dummy-payment/graphql/fragments/BasicWebhookMetadata.graphql | Adds basic webhook metadata fragment |
| apps/dummy-payment/graphql/fragments/.gitkeep | Keeps fragments dir tracked |
| apps/dummy-payment/generated/app-webhooks-types/transaction-refund-requested.ts | Adds generated webhook response types |
| apps/dummy-payment/generated/app-webhooks-types/transaction-process-session.ts | Adds generated webhook response types |
| apps/dummy-payment/generated/app-webhooks-types/transaction-initialize-session.ts | Adds generated webhook response types |
| apps/dummy-payment/generated/app-webhooks-types/payment-gateway-initialize-session.ts | Adds generated webhook response types |
| apps/dummy-payment/generated/app-webhooks-types/.gitkeep | Keeps generated types dir tracked |
| apps/dummy-payment/LICENSE | Adds license file for the app |
| apps/dummy-payment/Dockerfile.dev | Adds dev Dockerfile |
| apps/dummy-payment/CLAUDE.md | Adds agent guidance doc |
| apps/dummy-payment/AGENTS.md | Adds agent guidance doc |
| apps/dummy-payment/.prettierrc | Adds app-local prettier config |
| apps/dummy-payment/.prettierignore | Adds app-local prettier ignore |
| apps/dummy-payment/.npmrc | Adds app-local npmrc |
| apps/dummy-payment/.graphqlrc.yml | Adds GraphQL codegen config |
| apps/dummy-payment/.gitignore | Adds app-local gitignore |
| apps/dummy-payment/.gitallowed | Adds gitallowed list |
| apps/dummy-payment/.eslintrc | Adds app-local eslint config |
| apps/dummy-payment/.env.example | Adds env example file |
| useEffect(() => { | ||
| if (data) { | ||
| const transaction = data?.orders?.edges[0]?.node?.transactions.find((transaction) => { | ||
| return transaction?.pspReference === pspReference; | ||
| }); |
| import { MiddlewareFunction, TRPCError } from "@trpc/server"; | ||
| import { middleware, procedure } from "../server"; | ||
| import { attachAppToken } from "../middleware/attach-app-token"; |
| const [otherError, setOtherError] = React.useState<string | null>(null); | ||
|
|
||
| const transactionId = router.query.id as string; | ||
|
|
||
| const [eventType, setEventType] = React.useState<EventReporterOptions>({ |
| return next({ | ||
| ctx: { | ||
| apiClient: client, | ||
| }, | ||
| }); |
| export const appConfigSchema = z.object({ | ||
| refundConfig: z.enum(["SYNC_SUCESS", "ASYNC_SUCCESS", "ASYNC_FAILURE", "SYNC_FAILURE"]), | ||
| chargeConfig: z.enum(["SYNC_SUCESS", "ASYNC_SUCCESS", "ASYNC_FAILURE", "SYNC_FAILURE"]), | ||
| cancelConfig: z.enum(["SYNC_SUCESS", "ASYNC_SUCCESS", "ASYNC_FAILURE", "SYNC_FAILURE"]), | ||
| // TODO: Add implementation for ASYNC events via event queue |
| <Box display="flex" alignItems="center" gap={2}> | ||
| <Text>Selet event type:</Text> | ||
| <Combobox |
| try { | ||
| // return await loggerContext.wrap(() => wrappingTarget.apply(thisArg, [req, res])); | ||
|
|
||
| wrappingTarget.apply(thisArg, [req, res]); | ||
| } catch (error) { |
| @@ -0,0 +1,14 @@ | |||
| FROM node:20.12-alpine | |||
| return next({ | ||
| ctx: { | ||
| authData, | ||
| // TODO: Remove appToken | ||
| appToken: authData.token, |
| }, | ||
| ssr: true, | ||
| }); |
No description provided.