fix(paykit): bump stripe 1.2.2 - #428
Conversation
* cleanup of types and unused envs
Changed Files
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
More reviews will be available in 43 minutes and 5 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughThis PR removes Stripe sandbox configuration and refactors the PayKit integration to use PayKit SDK schema types directly. Key changes include removing sandbox-mode environment variables across configuration files, simplifying the runtime client factory, updating type contracts to align with the SDK, and changing refund handling to use the SDK's refunds API. ChangesPayKit SDK Integration Refactoring
Possibly Related PRs
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~22 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR bumps
Confidence Score: 5/5Safe to merge — the SDK bump and env-var cleanup are consistent across all config layers, and the refund path is well-tested. All changes are mechanical: removing a now-unnecessary workaround (manual sandbox injection) and consolidating the refund path to the dedicated No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[refundPayment called] --> B{client.refunds?.create exists?}
B -- Yes --> C[Call client.refunds.create\npayment_id, amount, reason=null, metadata=null]
C --> D{refund.id present?}
D -- No --> E[Throw MedusaError\nINVALID_DATA\n'did not include an id']
D -- Yes --> F[Return merged data\n...input.data + id + refund + refund_id]
B -- No --> G[Throw MedusaError\nNOT_ALLOWED\n'does not support refunds']
style E fill:#f66,color:#fff
style G fill:#f66,color:#fff
style F fill:#6a6,color:#fff
Reviews (2): Last reviewed commit: "fix(paykit): code review fixes" | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
apps/medusa-be/src/modules/payment-paykit/runtime.ts (1)
111-124:⚠️ Potential issue | 🟠 Major | ⚡ Quick winfix(runtime): keep providers without
handleWebhookusableLine 111 makes webhook support mandatory during client construction. That conflicts with
PaykitPaymentClient.handleWebhook?and the fallback inPaykitPaymentProviderBase.getWebhookActionAndData(), so a provider that can still create/retrieve/cancel payments now fails every operation just because it cannot process webhooks.Suggested fix
- if (!isPaykitProviderRuntime(provider)) { - throw new Error( - `PayKit provider "${providerPackage}" does not implement handleWebhook` - ) - } - const paykit = new PayKitClass(provider) return { customers: paykit.customers, payments: paykit.payments, refunds: paykit.refunds, - handleWebhook: (payload) => - callPaykitProviderWebhook(provider, payload, webhookOptions), + ...(isPaykitProviderRuntime(provider) + ? { + handleWebhook: (payload) => + callPaykitProviderWebhook(provider, payload, webhookOptions), + } + : {}), }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/medusa-be/src/modules/payment-paykit/runtime.ts` around lines 111 - 124, The current runtime forces webhook support by throwing when isPaykitProviderRuntime(provider) is false, which blocks providers that implement payments but not handleWebhook; change construction to allow such providers by removing the throw and conditionally wiring handleWebhook: keep creating const paykit = new PayKitClass(provider) and returning customers/payments/refunds as before, but only include handleWebhook when the provider actually implements it (use isPaykitProviderRuntime or check paykit.handleWebhook) and otherwise set handleWebhook to undefined or omit the field; ensure callPaykitProviderWebhook is only used when handleWebhook exists and keep PaykitPaymentProviderBase.getWebhookActionAndData() fallback intact.apps/medusa-be/src/modules/payment-paykit/core/base.ts (1)
645-657:⚠️ Potential issue | 🟠 Major | ⚡ Quick winfix(base): validate refund IDs before returning success
PaykitRefundis now aPartial<Refund>, so Line 657 can legally beundefined. In that case this path still reports a successful refund and persists no stablerefund_id, which makes retries and reconciliation unsafe for a financial operation. Please mirror thepayment.idguard used ininitiatePayment()here.Suggested fix
if (client.refunds?.create) { const refund = await client.refunds.create({ payment_id: id, amount, reason: null, metadata: null, }) + + if (!refund.id) { + throw new MedusaError( + MedusaError.Types.INVALID_DATA, + "PayKit create refund response did not include an id" + ) + } return { data: { ...input.data, id,🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/medusa-be/src/modules/payment-paykit/core/base.ts` around lines 645 - 657, The code returns success even when refund.id can be undefined because PaykitRefund is Partial<Refund>; update the refund handling in the function that calls client.refunds.create (the block using variables refund, id, amount and returning input.data with refund_id) to validate refund.id before returning—mirror the guard used in initiatePayment(): if refund?.id is falsy, log/throw an error and do not return a successful response or persist data; only populate refund_id and return when refund.id is present to ensure safe retries/reconciliation.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/medusa-be/src/modules/payment-paykit/__tests__/base.unit.spec.ts`:
- Around line 420-442: Update the assertion in the test that calls
provider.refundPayment to also assert the Medusa error type: instead of only
checking the message "PayKit provider does not support refunds", assert the
rejected error has type MedusaError.Types.NOT_ALLOWED (e.g., use
expect(...).rejects.toMatchObject({ type: MedusaError.Types.NOT_ALLOWED,
message: /PayKit provider does not support refunds/ })). Keep the call to
provider.refundPayment and import or reference MedusaError so the test verifies
both the error type and the message.
---
Outside diff comments:
In `@apps/medusa-be/src/modules/payment-paykit/core/base.ts`:
- Around line 645-657: The code returns success even when refund.id can be
undefined because PaykitRefund is Partial<Refund>; update the refund handling in
the function that calls client.refunds.create (the block using variables refund,
id, amount and returning input.data with refund_id) to validate refund.id before
returning—mirror the guard used in initiatePayment(): if refund?.id is falsy,
log/throw an error and do not return a successful response or persist data; only
populate refund_id and return when refund.id is present to ensure safe
retries/reconciliation.
In `@apps/medusa-be/src/modules/payment-paykit/runtime.ts`:
- Around line 111-124: The current runtime forces webhook support by throwing
when isPaykitProviderRuntime(provider) is false, which blocks providers that
implement payments but not handleWebhook; change construction to allow such
providers by removing the throw and conditionally wiring handleWebhook: keep
creating const paykit = new PayKitClass(provider) and returning
customers/payments/refunds as before, but only include handleWebhook when the
provider actually implements it (use isPaykitProviderRuntime or check
paykit.handleWebhook) and otherwise set handleWebhook to undefined or omit the
field; ensure callPaykitProviderWebhook is only used when handleWebhook exists
and keep PaykitPaymentProviderBase.getWebhookActionAndData() fallback intact.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: bf0a43cf-34a5-45b9-9c06-669e5fb24af2
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (12)
.env.dockerapps/medusa-be/package.jsonapps/medusa-be/src/modules/payment-paykit/__tests__/base.unit.spec.tsapps/medusa-be/src/modules/payment-paykit/__tests__/medusa-config.unit.spec.tsapps/medusa-be/src/modules/payment-paykit/__tests__/runtime.unit.spec.tsapps/medusa-be/src/modules/payment-paykit/core/base.tsapps/medusa-be/src/modules/payment-paykit/medusa-config.tsapps/medusa-be/src/modules/payment-paykit/runtime.tsapps/medusa-be/src/modules/payment-paykit/types/index.tsapps/medusa-be/src/modules/payment-paykit/utils/mappers.tsapps/new-engine-ctl/src/orchestration/bootstrap/zane-project.tsdocker-compose.yaml
💤 Files with no reviewable changes (5)
- .env.docker
- apps/medusa-be/src/modules/payment-paykit/tests/medusa-config.unit.spec.ts
- apps/new-engine-ctl/src/orchestration/bootstrap/zane-project.ts
- docker-compose.yaml
- apps/medusa-be/src/modules/payment-paykit/medusa-config.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Greptile Review
- GitHub Check: main
- GitHub Check: Kilo Code Review
🧰 Additional context used
📓 Path-based instructions (10)
**/package.json
📄 CodeRabbit inference engine (CLAUDE.md)
Use pnpm CLI to add dependencies; never edit package.json directly
Files:
apps/medusa-be/package.json
apps/medusa-be/src/modules/**/*
📄 CodeRabbit inference engine (CLAUDE.md)
Place custom Medusa modules under apps/medusa-be/src/modules
Module directories use hyphens (
my-module/), but module keys in config use underscores (my_module)
Files:
apps/medusa-be/src/modules/payment-paykit/__tests__/runtime.unit.spec.tsapps/medusa-be/src/modules/payment-paykit/utils/mappers.tsapps/medusa-be/src/modules/payment-paykit/__tests__/base.unit.spec.tsapps/medusa-be/src/modules/payment-paykit/core/base.tsapps/medusa-be/src/modules/payment-paykit/types/index.tsapps/medusa-be/src/modules/payment-paykit/runtime.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Import UI components using the pattern
import { ComponentName } from '@libs/ui/atoms/component-name'or'@libs/ui/molecules/component-name'
Files:
apps/medusa-be/src/modules/payment-paykit/__tests__/runtime.unit.spec.tsapps/medusa-be/src/modules/payment-paykit/utils/mappers.tsapps/medusa-be/src/modules/payment-paykit/__tests__/base.unit.spec.tsapps/medusa-be/src/modules/payment-paykit/core/base.tsapps/medusa-be/src/modules/payment-paykit/types/index.tsapps/medusa-be/src/modules/payment-paykit/runtime.ts
**/*.{test,spec}.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use Vitest for running tests in backend and UI library projects
Files:
apps/medusa-be/src/modules/payment-paykit/__tests__/runtime.unit.spec.tsapps/medusa-be/src/modules/payment-paykit/__tests__/base.unit.spec.ts
apps/medusa-be/src/{api,modules,workflows,admin,subscribers,jobs}/**
📄 CodeRabbit inference engine (AGENTS.md)
In Medusa backend applications, organize custom code using the directory structure: api/, modules/, workflows/, admin/, subscribers/, jobs/
Files:
apps/medusa-be/src/modules/payment-paykit/__tests__/runtime.unit.spec.tsapps/medusa-be/src/modules/payment-paykit/utils/mappers.tsapps/medusa-be/src/modules/payment-paykit/__tests__/base.unit.spec.tsapps/medusa-be/src/modules/payment-paykit/core/base.tsapps/medusa-be/src/modules/payment-paykit/types/index.tsapps/medusa-be/src/modules/payment-paykit/runtime.ts
apps/medusa-be/**/*.{ts,tsx}
📄 CodeRabbit inference engine (apps/medusa-be/CLAUDE.md)
apps/medusa-be/**/*.{ts,tsx}: Runnpx tsc --noEmitfor typechecking before committing
Always use braces around conditional blocks, even for single statements; Biome will expand them
Declare one variable perconst/letstatement, not multiple on one line
Use nullish coalescing operator (??) instead of logical OR (||) for default values
Do not use non-null assertions (!); use type guards or validation instead
Annotate type asunknownwhen accessing dynamic object properties before applying type guards
Use comments only to explain 'why', never 'what'; self-document code with clear naming
Extract pure functions to separate files for testability without runtime dependencies
UseModules.*andContainerRegistrationKeys.*constants instead of hardcoding module/key strings
Do not use non-null assertions in TypeScript code; validate or use type guards instead
Validate data before type casting; never useas Typewithout prior validation
Files:
apps/medusa-be/src/modules/payment-paykit/__tests__/runtime.unit.spec.tsapps/medusa-be/src/modules/payment-paykit/utils/mappers.tsapps/medusa-be/src/modules/payment-paykit/__tests__/base.unit.spec.tsapps/medusa-be/src/modules/payment-paykit/core/base.tsapps/medusa-be/src/modules/payment-paykit/types/index.tsapps/medusa-be/src/modules/payment-paykit/runtime.ts
apps/medusa-be/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (apps/medusa-be/CLAUDE.md)
Run
bunx biome check --write .to lint and auto-format code
Files:
apps/medusa-be/src/modules/payment-paykit/__tests__/runtime.unit.spec.tsapps/medusa-be/src/modules/payment-paykit/utils/mappers.tsapps/medusa-be/src/modules/payment-paykit/__tests__/base.unit.spec.tsapps/medusa-be/src/modules/payment-paykit/core/base.tsapps/medusa-be/src/modules/payment-paykit/types/index.tsapps/medusa-be/src/modules/payment-paykit/runtime.ts
apps/medusa-be/src/**/*.ts
📄 CodeRabbit inference engine (apps/medusa-be/CLAUDE.md)
apps/medusa-be/src/**/*.ts: Useconstand explicit typing withdbService.sqlRaw<Type>()for SQL query results
Resolve logger usingcontainer.resolve<Logger>(ContainerRegistrationKeys.LOGGER)
Resolve Query usingcontainer.resolve<Query>(ContainerRegistrationKeys.QUERY)
UseModules.LOCKING(notModules.LOCK) to resolve locking services
UseModules.CACHING(notModules.CACHE) to resolve caching services
ThrowMedusaErrorwith appropriate type and message for error responses
UseMedusaError.Types.INVALID_DATAfor 400 validation errors
UseMedusaError.Types.NOT_FOUNDfor 404 errors
UseMedusaError.Types.UNAUTHORIZEDfor 401 authentication errors
UseMedusaError.Types.NOT_ALLOWEDfor 400 permission errors
UseMedusaError.Types.DUPLICATE_ERRORfor 422 duplicate entry errors
UseMedusaError.Types.CONFLICTfor 409 conflict errors
Use caching module'scomputeKey()to generate stable cache keys from filters and pagination
Use caching module'sget()with type assertion for cache retrieval
Use caching module'sset()with TTL and tags for cache storage and bulk invalidation
Use caching module'sclear()with tags to bulk-invalidate related cache entries
Always use Redis for caching in multi-container deployments instead of local variables
Batch operations usingCHUNK_SIZEconstant instead of unbounded loops
Files:
apps/medusa-be/src/modules/payment-paykit/__tests__/runtime.unit.spec.tsapps/medusa-be/src/modules/payment-paykit/utils/mappers.tsapps/medusa-be/src/modules/payment-paykit/__tests__/base.unit.spec.tsapps/medusa-be/src/modules/payment-paykit/core/base.tsapps/medusa-be/src/modules/payment-paykit/types/index.tsapps/medusa-be/src/modules/payment-paykit/runtime.ts
apps/medusa-be/src/modules/*/__tests__/*.spec.ts
📄 CodeRabbit inference engine (apps/medusa-be/CLAUDE.md)
apps/medusa-be/src/modules/*/__tests__/*.spec.ts: UsemoduleIntegrationTestRunner()for module tests with real DB instead of mocking MedusaService methods
Mock loaders in tests usingvi.mock()to prevent actual initialization during testing
Wrap missing dependency resolution in try/catch in integration tests; Awilix throws even with nullish coalescing
Files:
apps/medusa-be/src/modules/payment-paykit/__tests__/runtime.unit.spec.tsapps/medusa-be/src/modules/payment-paykit/__tests__/base.unit.spec.ts
apps/medusa-be/src/modules/**/*.ts
📄 CodeRabbit inference engine (apps/medusa-be/CLAUDE.md)
Modules use isolated containers; Query/Link unavailable during service initialization, defer to
onApplicationStart
Files:
apps/medusa-be/src/modules/payment-paykit/__tests__/runtime.unit.spec.tsapps/medusa-be/src/modules/payment-paykit/utils/mappers.tsapps/medusa-be/src/modules/payment-paykit/__tests__/base.unit.spec.tsapps/medusa-be/src/modules/payment-paykit/core/base.tsapps/medusa-be/src/modules/payment-paykit/types/index.tsapps/medusa-be/src/modules/payment-paykit/runtime.ts
🧠 Learnings (34)
📓 Common learnings
Learnt from: redeyecz
Repo: TechsioCZ/new-engine PR: 413
File: apps/medusa-be/package.json:77-80
Timestamp: 2026-05-20T15:59:00.434Z
Learning: The `paykit-sdk/*` packages (e.g., `paykit-sdk/comgate`, `paykit-sdk/core`, `paykit-sdk/gopay`, `paykit-sdk/stripe`) used in the TechsioCZ/new-engine monorepo (`apps/medusa-be/package.json`) are published to a **private npm registry**, not the public npm registry. Do not flag version numbers (e.g., `^1.2.0`) as invalid just because they are absent from the public npm registry. Version availability checks via web search or public npm API do not apply to these packages.
📚 Learning: 2026-04-29T15:44:04.609Z
Learnt from: KaiUweCZE
Repo: TechsioCZ/new-engine PR: 378
File: libs/storefront-data/package.json:285-286
Timestamp: 2026-04-29T15:44:04.609Z
Learning: In `libs/storefront-data/package.json`, `medusajs/js-sdk` and `medusajs/types` are intentionally pinned to an exact version in `devDependencies` (e.g., `"2.14.1"`). This is because the package generates TypeScript declaration files against the Medusa SDK/types, and a previous deploy failure was caused by different Medusa type versions being resolved in the build graph. The `peerDependencies` range remains broad (e.g., `>=2.12.0`) for consumers, while exact `devDependencies` pins ensure reproducible declaration generation. Do not flag these exact pins as inconsistencies.
Applied to files:
apps/medusa-be/package.jsonapps/medusa-be/src/modules/payment-paykit/core/base.ts
📚 Learning: 2026-05-20T15:58:53.048Z
Learnt from: redeyecz
Repo: TechsioCZ/new-engine PR: 413
File: apps/medusa-be/package.json:77-80
Timestamp: 2026-05-20T15:58:53.048Z
Learning: When reviewing monorepo `package.json` files, treat any dependencies/devDependencies using the `paykit-sdk/*` scope (e.g., `paykit-sdk/core`, `paykit-sdk/stripe`, `paykit-sdk/comgate`, `paykit-sdk/gopay`) as coming from the TechsioCZ/new-engine private npm registry. Do not flag dependency version constraints (e.g., `^1.2.0`) as invalid merely because those packages/versions are not found on the public npm registry. Public-web/private-web availability checks against the public npm API are not applicable for these packages; if validation is needed, rely on the private registry/CI install behavior instead.
Applied to files:
apps/medusa-be/package.json
📚 Learning: 2026-05-11T23:01:30.923Z
Learnt from: CR
Repo: TechsioCZ/new-engine PR: 0
File: apps/medusa-be/CLAUDE.md:0-0
Timestamp: 2026-05-11T23:01:30.923Z
Learning: Applies to apps/medusa-be/**/*.{ts,tsx} : Use `Modules.*` and `ContainerRegistrationKeys.*` constants instead of hardcoding module/key strings
Applied to files:
apps/medusa-be/package.jsonapps/medusa-be/src/modules/payment-paykit/core/base.tsapps/medusa-be/src/modules/payment-paykit/types/index.tsapps/medusa-be/src/modules/payment-paykit/runtime.ts
📚 Learning: 2026-04-13T12:34:56.405Z
Learnt from: CR
Repo: TechsioCZ/new-engine PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-13T12:34:56.405Z
Learning: Applies to apps/medusa-fe/**/*.{ts,tsx,js,jsx} : Use Modern.js from Bytedance as the primary frontend framework, with Next.js 15+ as an alternative only when necessary
Applied to files:
apps/medusa-be/package.json
📚 Learning: 2026-05-11T23:01:30.923Z
Learnt from: CR
Repo: TechsioCZ/new-engine PR: 0
File: apps/medusa-be/CLAUDE.md:0-0
Timestamp: 2026-05-11T23:01:30.923Z
Learning: Applies to apps/medusa-be/**/*.{ts,tsx} : Run `npx tsc --noEmit` for typechecking before committing
Applied to files:
apps/medusa-be/package.json
📚 Learning: 2026-05-06T13:06:32.478Z
Learnt from: CR
Repo: TechsioCZ/new-engine PR: 0
File: apps/payload/.cursor/rules/components.md:0-0
Timestamp: 2026-05-06T13:06:32.478Z
Learning: Applies to apps/payload/**/package.json : Pin all payloadcms/* packages to the exact same version to avoid dependency version mismatch errors with hooks like useConfig
Applied to files:
apps/medusa-be/package.json
📚 Learning: 2026-05-07T12:06:56.856Z
Learnt from: redeyecz
Repo: TechsioCZ/new-engine PR: 375
File: apps/medusa-be/src/admin/widgets/order-payment-reminder.tsx:3-11
Timestamp: 2026-05-07T12:06:56.856Z
Learning: In files under `apps/medusa-be/src/admin/` (Medusa admin widgets and routes, e.g., `apps/medusa-be/src/admin/widgets/order-payment-reminder.tsx`), UI components must be imported from `medusajs/ui` (the Medusa framework's own admin UI kit). The project-standard `libs/ui/atoms/*` and `libs/ui/molecules/*` import conventions do NOT apply to Medusa admin files. Never flag `medusajs/ui` imports in Medusa admin code as violating the `libs/ui` convention.
Applied to files:
apps/medusa-be/package.jsonapps/medusa-be/src/modules/payment-paykit/core/base.ts
📚 Learning: 2026-05-11T23:01:30.923Z
Learnt from: CR
Repo: TechsioCZ/new-engine PR: 0
File: apps/medusa-be/CLAUDE.md:0-0
Timestamp: 2026-05-11T23:01:30.923Z
Learning: Applies to apps/medusa-be/src/scripts/**/*.ts : Use script pattern `npx medusa exec ./src/scripts/startup.ts` in startup hooks
Applied to files:
apps/medusa-be/package.json
📚 Learning: 2026-05-14T15:16:57.253Z
Learnt from: redeyecz
Repo: TechsioCZ/new-engine PR: 407
File: pnpm-workspace.yaml:6-7
Timestamp: 2026-05-14T15:16:57.253Z
Learning: In `pnpm-workspace.yaml`, `paykit-sdk/comgate` and `paykit-sdk/gopay` are intentionally listed under `minimumReleaseAgeExclude` so that new releases can be adopted immediately. This is because the PayKit SDK is actively developed and bug fixes are sometimes delivered specifically for this project, requiring fast rollout without the default 24-hour safety delay.
Applied to files:
apps/medusa-be/package.json
📚 Learning: 2026-02-05T14:43:17.404Z
Learnt from: KaiUweCZE
Repo: NMIT-WR/new-engine PR: 324
File: apps/medusa-be/package.json:0-0
Timestamp: 2026-02-05T14:43:17.404Z
Learning: Validate and enforce React 19 compatibility across monorepo workspaces. Since Medusa UI supports React 19 via root package.json overrides and Medusa Cloud prerequisites show React 19 overrides for npm workspaces, ensure workspace root and all relevant package.json files align with React 19 (18+ requirement is satisfied). When reviewing, verify that overrides exist in the root package.json and that dependent packages in apps or packages directories declare React 19 (or compatible) in their peerDependencies or dependencies as appropriate for workspace usage.
Applied to files:
apps/medusa-be/package.json
📚 Learning: 2026-05-07T19:05:58.339Z
Learnt from: redeyecz
Repo: TechsioCZ/new-engine PR: 390
File: apps/medusa-be/package.json:78-81
Timestamp: 2026-05-07T19:05:58.339Z
Learning: When reviewing changes to `package.json`, do not automatically flag dependency additions/removals as "manually edited" or as "bypassing the pnpm lockfile" just because the `package.json` diff shows only that file changed. First verify whether `pnpm-lock.yaml` is missing the corresponding entries. Since `pnpm add` updates both `package.json` and `pnpm-lock.yaml` together, legitimate changes can appear in the `package.json` diff while still being properly tracked in the lockfile.
Applied to files:
apps/medusa-be/package.json
📚 Learning: 2026-05-11T23:01:30.923Z
Learnt from: CR
Repo: TechsioCZ/new-engine PR: 0
File: apps/medusa-be/CLAUDE.md:0-0
Timestamp: 2026-05-11T23:01:30.923Z
Learning: Applies to apps/medusa-be/tests/unit/**/*.unit.spec.ts : Focus unit tests on critical paths: validation, money calculations, and core business logic
Applied to files:
apps/medusa-be/src/modules/payment-paykit/__tests__/runtime.unit.spec.tsapps/medusa-be/src/modules/payment-paykit/__tests__/base.unit.spec.ts
📚 Learning: 2026-05-21T11:46:40.903Z
Learnt from: redeyecz
Repo: TechsioCZ/new-engine PR: 323
File: apps/medusa-be/integration-tests/http/promotions-custom-rules.spec.ts:0-0
Timestamp: 2026-05-21T11:46:40.903Z
Learning: In `apps/medusa-be/integration-tests/http/promotions-custom-rules.spec.ts`, the test intentionally uses a custom `requestJson`/`createClient`/`fetch`-based HTTP harness (running against a full Docker stack) instead of `medusaIntegrationTestRunner()`. This is a deliberate decision because `medusaIntegrationTestRunner()` had issues with publishable-key resolution in the monorepo due to package-hoisting caveats. Do not flag the absence of `medusaIntegrationTestRunner()` in this file; it is marked for future refactoring when the monorepo/hoisting issue is resolved.
Applied to files:
apps/medusa-be/src/modules/payment-paykit/__tests__/runtime.unit.spec.tsapps/medusa-be/src/modules/payment-paykit/__tests__/base.unit.spec.ts
📚 Learning: 2026-05-11T23:01:30.923Z
Learnt from: CR
Repo: TechsioCZ/new-engine PR: 0
File: apps/medusa-be/CLAUDE.md:0-0
Timestamp: 2026-05-11T23:01:30.923Z
Learning: Applies to apps/medusa-be/tests/unit/jobs/**/*.spec.ts : Place job tests in `tests/unit/jobs/` not in `src/jobs/__tests__/` to avoid Medusa loading them at runtime
Applied to files:
apps/medusa-be/src/modules/payment-paykit/__tests__/runtime.unit.spec.tsapps/medusa-be/src/modules/payment-paykit/__tests__/base.unit.spec.ts
📚 Learning: 2026-05-11T23:01:30.923Z
Learnt from: CR
Repo: TechsioCZ/new-engine PR: 0
File: apps/medusa-be/CLAUDE.md:0-0
Timestamp: 2026-05-11T23:01:30.923Z
Learning: Applies to apps/medusa-be/tests/unit/**/*.unit.spec.ts : Skip unit tests for: getters, static arrays, trivial transforms, constants, and pass-through methods
Applied to files:
apps/medusa-be/src/modules/payment-paykit/__tests__/runtime.unit.spec.tsapps/medusa-be/src/modules/payment-paykit/__tests__/base.unit.spec.ts
📚 Learning: 2026-05-11T23:01:30.923Z
Learnt from: CR
Repo: TechsioCZ/new-engine PR: 0
File: apps/medusa-be/CLAUDE.md:0-0
Timestamp: 2026-05-11T23:01:30.923Z
Learning: Applies to apps/medusa-be/tests/unit/**/*.unit.spec.ts : Do not test mocked methods; test real behavior instead
Applied to files:
apps/medusa-be/src/modules/payment-paykit/__tests__/runtime.unit.spec.tsapps/medusa-be/src/modules/payment-paykit/__tests__/base.unit.spec.ts
📚 Learning: 2026-05-11T23:01:30.923Z
Learnt from: CR
Repo: TechsioCZ/new-engine PR: 0
File: apps/medusa-be/CLAUDE.md:0-0
Timestamp: 2026-05-11T23:01:30.923Z
Learning: Applies to apps/medusa-be/tests/unit/**/*.unit.spec.ts : Do not test logging calls; they are implementation details
Applied to files:
apps/medusa-be/src/modules/payment-paykit/__tests__/runtime.unit.spec.tsapps/medusa-be/src/modules/payment-paykit/__tests__/base.unit.spec.ts
📚 Learning: 2026-05-11T23:01:30.923Z
Learnt from: CR
Repo: TechsioCZ/new-engine PR: 0
File: apps/medusa-be/CLAUDE.md:0-0
Timestamp: 2026-05-11T23:01:30.923Z
Learning: Applies to apps/medusa-be/tests/unit/**/*.unit.spec.ts : Clear mocks with `mockFn.mockReset()` instead of `vi.clearAllMocks()` for `mockResolvedValueOnce` chains
Applied to files:
apps/medusa-be/src/modules/payment-paykit/__tests__/runtime.unit.spec.tsapps/medusa-be/src/modules/payment-paykit/__tests__/base.unit.spec.ts
📚 Learning: 2026-05-11T23:01:30.923Z
Learnt from: CR
Repo: TechsioCZ/new-engine PR: 0
File: apps/medusa-be/CLAUDE.md:0-0
Timestamp: 2026-05-11T23:01:30.923Z
Learning: Applies to apps/medusa-be/integration-tests/http/**/*.spec.ts : Use `headers: { 'x-publishable-api-key': pak.token }` for store auth in integration tests
Applied to files:
apps/medusa-be/src/modules/payment-paykit/__tests__/runtime.unit.spec.ts
📚 Learning: 2026-05-11T23:01:30.923Z
Learnt from: CR
Repo: TechsioCZ/new-engine PR: 0
File: apps/medusa-be/CLAUDE.md:0-0
Timestamp: 2026-05-11T23:01:30.923Z
Learning: Applies to apps/medusa-be/tests/unit/**/*.unit.spec.ts : Use `vi.useFakeTimers()` for deterministic time-based testing; use `vi.setSystemTime()` for absolute time
Applied to files:
apps/medusa-be/src/modules/payment-paykit/__tests__/runtime.unit.spec.ts
📚 Learning: 2026-05-11T23:01:30.923Z
Learnt from: CR
Repo: TechsioCZ/new-engine PR: 0
File: apps/medusa-be/CLAUDE.md:0-0
Timestamp: 2026-05-11T23:01:30.923Z
Learning: Applies to apps/medusa-be/integration-tests/http/**/*.spec.ts : Write HTTP integration tests for: business logic routes, security-critical middleware, multi-step DB ops
Applied to files:
apps/medusa-be/src/modules/payment-paykit/__tests__/runtime.unit.spec.ts
📚 Learning: 2026-05-11T23:01:30.923Z
Learnt from: CR
Repo: TechsioCZ/new-engine PR: 0
File: apps/medusa-be/CLAUDE.md:0-0
Timestamp: 2026-05-11T23:01:30.923Z
Learning: Applies to apps/medusa-be/src/modules/*/__tests__/*.spec.ts : Wrap missing dependency resolution in try/catch in integration tests; Awilix throws even with nullish coalescing
Applied to files:
apps/medusa-be/src/modules/payment-paykit/__tests__/base.unit.spec.ts
📚 Learning: 2026-05-11T23:01:30.923Z
Learnt from: CR
Repo: TechsioCZ/new-engine PR: 0
File: apps/medusa-be/CLAUDE.md:0-0
Timestamp: 2026-05-11T23:01:30.923Z
Learning: Applies to apps/medusa-be/tests/unit/**/*.unit.spec.ts : Use factory functions like `createMockEntity(overrides)` for test data generation
Applied to files:
apps/medusa-be/src/modules/payment-paykit/__tests__/base.unit.spec.ts
📚 Learning: 2026-05-11T23:01:30.923Z
Learnt from: CR
Repo: TechsioCZ/new-engine PR: 0
File: apps/medusa-be/CLAUDE.md:0-0
Timestamp: 2026-05-11T23:01:30.923Z
Learning: Applies to apps/medusa-be/tests/unit/**/*.unit.spec.ts : Do not test `query.graph()` pass-through calls in unit tests
Applied to files:
apps/medusa-be/src/modules/payment-paykit/__tests__/base.unit.spec.ts
📚 Learning: 2026-05-11T23:01:30.923Z
Learnt from: CR
Repo: TechsioCZ/new-engine PR: 0
File: apps/medusa-be/CLAUDE.md:0-0
Timestamp: 2026-05-11T23:01:30.923Z
Learning: Applies to apps/medusa-be/src/modules/**/provider.ts : Use provider containers for extending existing modules (payment, fulfillment) with dependencies declared in `medusa-config.ts`
Applied to files:
apps/medusa-be/src/modules/payment-paykit/core/base.tsapps/medusa-be/src/modules/payment-paykit/types/index.tsapps/medusa-be/src/modules/payment-paykit/runtime.ts
📚 Learning: 2026-05-11T23:01:30.923Z
Learnt from: CR
Repo: TechsioCZ/new-engine PR: 0
File: apps/medusa-be/CLAUDE.md:0-0
Timestamp: 2026-05-11T23:01:30.923Z
Learning: Applies to apps/medusa-be/src/modules/**/models/*.ts : Use provider identifier format `{identifier}_{id}` in DB `provider_id` field (e.g., `my_shipping_default`)
Applied to files:
apps/medusa-be/src/modules/payment-paykit/core/base.ts
📚 Learning: 2026-05-11T23:01:30.923Z
Learnt from: CR
Repo: TechsioCZ/new-engine PR: 0
File: apps/medusa-be/CLAUDE.md:0-0
Timestamp: 2026-05-11T23:01:30.923Z
Learning: Applies to apps/medusa-be/src/api/**/*.ts : Use `validateAndTransformBody(Schema)` middleware for POST/PUT request validation
Applied to files:
apps/medusa-be/src/modules/payment-paykit/core/base.ts
📚 Learning: 2026-05-06T13:07:45.323Z
Learnt from: CR
Repo: TechsioCZ/new-engine PR: 0
File: apps/payload/.cursor/rules/plugin-development.md:0-0
Timestamp: 2026-05-06T13:07:45.323Z
Learning: Applies to apps/payload/**/*.{ts,tsx} : Import types from 'payload' using TypeScript `import type` syntax: `import type { Config, Plugin, CollectionConfig, Field } from 'payload'`
Applied to files:
apps/medusa-be/src/modules/payment-paykit/types/index.tsapps/medusa-be/src/modules/payment-paykit/runtime.ts
📚 Learning: 2026-05-06T13:06:32.478Z
Learnt from: CR
Repo: TechsioCZ/new-engine PR: 0
File: apps/payload/.cursor/rules/components.md:0-0
Timestamp: 2026-05-06T13:06:32.478Z
Learning: Applies to apps/payload/**/components/**/*.{ts,tsx} : Use TypeScript types from Payload (TextFieldServerComponent, TextFieldClientComponent, TextFieldCellComponent) to ensure type safety for custom components
Applied to files:
apps/medusa-be/src/modules/payment-paykit/types/index.ts
📚 Learning: 2026-05-20T15:59:00.434Z
Learnt from: redeyecz
Repo: TechsioCZ/new-engine PR: 413
File: apps/medusa-be/package.json:77-80
Timestamp: 2026-05-20T15:59:00.434Z
Learning: The `paykit-sdk/*` packages (e.g., `paykit-sdk/comgate`, `paykit-sdk/core`, `paykit-sdk/gopay`, `paykit-sdk/stripe`) used in the TechsioCZ/new-engine monorepo (`apps/medusa-be/package.json`) are published to a **private npm registry**, not the public npm registry. Do not flag version numbers (e.g., `^1.2.0`) as invalid just because they are absent from the public npm registry. Version availability checks via web search or public npm API do not apply to these packages.
Applied to files:
apps/medusa-be/src/modules/payment-paykit/types/index.ts
📚 Learning: 2026-05-07T19:18:05.075Z
Learnt from: redeyecz
Repo: TechsioCZ/new-engine PR: 390
File: apps/medusa-be/src/api/admin/packeta-labels/route.ts:121-121
Timestamp: 2026-05-07T19:18:05.075Z
Learning: In `apps/medusa-be`, the hard-coded fulfillment provider ID string (e.g. `"packeta_packeta"`) is intentionally kept inline for now, consistent with the PPL implementation pattern. Extracting these into shared constants (e.g. `PACKETA_FULFILLMENT_PROVIDER_ID`) is deferred to a future refactor pass when more providers are added. Do not flag this as an issue in code reviews.
Applied to files:
apps/medusa-be/src/modules/payment-paykit/runtime.ts
📚 Learning: 2026-05-11T23:01:30.923Z
Learnt from: CR
Repo: TechsioCZ/new-engine PR: 0
File: apps/medusa-be/CLAUDE.md:0-0
Timestamp: 2026-05-11T23:01:30.923Z
Learning: Applies to apps/medusa-be/**/*.{ts,tsx} : Extract pure functions to separate files for testability without runtime dependencies
Applied to files:
apps/medusa-be/src/modules/payment-paykit/runtime.ts
📚 Learning: 2026-05-06T13:08:26.636Z
Learnt from: CR
Repo: TechsioCZ/new-engine PR: 0
File: apps/payload/AGENTS.md:0-0
Timestamp: 2026-05-06T13:08:26.636Z
Learning: Applies to apps/payload/**/*.{ts,tsx} : Use TypeScript with proper types from Payload
Applied to files:
apps/medusa-be/src/modules/payment-paykit/runtime.ts
🔇 Additional comments (2)
apps/medusa-be/package.json (1)
82-82: LGTM!apps/medusa-be/src/modules/payment-paykit/__tests__/runtime.unit.spec.ts (1)
49-49: LGTM!Also applies to: 63-63
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (3 files)
Reviewed by nemotron-3-super-120b-a12b-20230311:free · 310,483 tokens |
|
🎉 This PR is included in version 0.4.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Updated paykit sdk, cleanup of unused envs & improve types
Summary by CodeRabbit
Release Notes
New Features
Improvements
Chores