update depencies by grok#50
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughStripe Go imports and parameter construction were migrated to v82 across payment-intent, customer, error, controller, and integration-test code. Dependencies, currency conversion, config-based pre-commit hooks, the README badge, and editor build flags were also updated. ChangesStripe Go v82 migration
Repository development hooks
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
payment/intent/stripeconv_test.go (1)
14-50: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winNo test asserts the converted
Amount/Currency.None of
TestFromStripeToAppIntent*setAmount/Currencyon the inputstripe.PaymentIntentor assert onappintent.GetAmount()/GetCurrency(), yet this is precisely the field touched by thestring(intent.Currency)change. Consider adding assertions (and an invalid-currency case) to cover the new cast and the discarded-error path noted instripeconv.go.🤖 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 `@payment/intent/stripeconv_test.go` around lines 14 - 50, The TestFromStripeToAppIntent test does not cover PaymentIntent currency conversion or invalid-currency handling. Set Amount and Currency on the input stripe.PaymentIntent, assert appintent.GetAmount() and GetCurrency(), and add a separate invalid-currency case that verifies the conversion behavior when the currency cast discards an error.Source: Path instructions
🤖 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 `@go.mod`:
- Around line 7-10: Keep the github.com/stripe/stripe-go/v82 dependency pin
unchanged, and add a follow-up migration task for the legacy Stripe APIs,
including customer.New, paymentintent.New, and stripe.Key, to the modern
stripe.Client interface before a future major release removes them.
In `@payment/intent/stripeconv.go`:
- Line 13: แ Add a Go doc comment immediately above FromStripeToAppIntent,
beginning with the exact identifier name and briefly describing its conversion
of a Stripe PaymentIntent to an application Intent.
---
Outside diff comments:
In `@payment/intent/stripeconv_test.go`:
- Around line 14-50: The TestFromStripeToAppIntent test does not cover
PaymentIntent currency conversion or invalid-currency handling. Set Amount and
Currency on the input stripe.PaymentIntent, assert appintent.GetAmount() and
GetCurrency(), and add a separate invalid-currency case that verifies the
conversion behavior when the currency cast discards an error.
🪄 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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 7a20ce9f-443d-4fde-8ca7-09e594aaa514
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum,!go.sum
📒 Files selected for processing (21)
controller/rest/intent/cancel/restintentcancel_integration_test.gocontroller/rest/intent/capture/restintentcapture_integration_test.gocontroller/rest/intent/confirm/restintentconfirm_integration_test.gocontroller/rest/intent/create/restintentcreate_integration_test.gocontroller/rest/intent/get/restintentget_integration_test.gocustomer/customerstripe.gocustomer/customerstripe_integration_test.goerror/stripe.gogo.modpayment/intent/cancel/intentcancel.gopayment/intent/cancel/intentcancel_integration_test.gopayment/intent/capture/intentcapture.gopayment/intent/capture/intentcapture_integration_test.gopayment/intent/confirm/intentconfirm.gopayment/intent/confirm/intentconfirm_integration_test.gopayment/intent/create/intentcreate.gopayment/intent/create/intentcreate_integration_test.gopayment/intent/get/intentget.gopayment/intent/get/intentget_integration_test.gopayment/intent/stripeconv.gopayment/intent/stripeconv_test.go
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
payment/intent/create/intentcreate.go (1)
37-49: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winVerified correct against stripe-go v82.
The
AutomaticPaymentMethods/AllowRedirectsfields and constant, and the removal ofSavePaymentMethod/Sourcein stripe-go v72+, both check out: the v72 migration guide listsSavePaymentMethodandSourceas removed deprecated PaymentIntent parameters, andPaymentIntentAutomaticPaymentMethodsParams/PaymentIntentAutomaticPaymentMethodsAllowRedirectsNeverexist as documented in stripe-go. SettingAllowRedirects: nevercorrectly matches Stripe's guidance that this disables the return_url requirement, which aligns with the manual-confirmation-without-return_url flow used here.One nit: the existing integration test (
intentcreate_integration_test.go) doesn't assert on the returned intent'sautomatic_payment_methods/allow_redirectsvalues, so a regression here (e.g. someone reverting toalways) wouldn't be caught by tests.🤖 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 `@payment/intent/create/intentcreate.go` around lines 37 - 49, Add an integration-test assertion in the intent creation test covering the returned PaymentIntent’s AutomaticPaymentMethods configuration, verifying it is enabled and AllowRedirects is set to PaymentIntentAutomaticPaymentMethodsAllowRedirectsNever. Use the existing intent creation test and its returned intent object to ensure regressions to redirect-enabled behavior are detected.
🤖 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 @.github/hooks/gitconfig:
- Line 24: Update the golangci-lint command in the git hook so an unavailable
binary prints an actionable installation message and exits with a non-zero
status; only run `golangci-lint run ./...` when the executable is present,
removing the current `|| exit 0` bypass.
- Line 32: Update the pre-commit command in the git hook so Stripe-tagged
integration tests do not run by default when config.json exists. Gate the go
test invocation behind an explicit opt-in environment variable, such as
RUN_STRIPE_TESTS, while preserving the existing config and test arguments when
enabled.
- Line 16: Update the swagger hook command to avoid the unpinned `@latest`
dependency: retain the existing swag executable path, but replace the fallback
in the git hook with the repository-pinned github.com/swaggo/swag version
v1.16.6, or fail with an instruction to install swag separately. Ensure the
command remains reproducible.
In `@README.md`:
- Line 40: Update the README verification instructions to retain the hook
listing command and add git hook run pre-commit, ensuring contributors execute
and verify the configured pre-commit hook rather than only inspecting its
registration.
---
Outside diff comments:
In `@payment/intent/create/intentcreate.go`:
- Around line 37-49: Add an integration-test assertion in the intent creation
test covering the returned PaymentIntent’s AutomaticPaymentMethods
configuration, verifying it is enabled and AllowRedirects is set to
PaymentIntentAutomaticPaymentMethodsAllowRedirectsNever. Use the existing intent
creation test and its returned intent object to ensure regressions to
redirect-enabled behavior are detected.
🪄 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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 3aa20734-9b69-473d-977d-83d60ab09746
📒 Files selected for processing (4)
.github/hooks/gitconfig.github/hooks/pre-commitREADME.mdpayment/intent/create/intentcreate.go
💤 Files with no reviewable changes (1)
- .github/hooks/pre-commit
Stripe rejects combining automatic_payment_methods with confirmation_method. Use payment_method_types=["card"] instead so manual confirmation still works without redirect methods.
There was a problem hiding this comment.
Actionable comments posted: 10
🤖 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 `@controller/rest/intent/capture/restintentcapture_integration_test.go`:
- Around line 70-80: The createTestIntent helper leaves the Stripe PaymentIntent
cleanup dependent on the handler completing successfully. Update
createTestIntent to accept *testing.T (or return a cleanup function), and
register t.Cleanup immediately after successful intent creation so the intent is
canceled even when the test or handler fails.
- Around line 70-80: The PaymentIntent test parameters use invalid expressions
with new instead of types. In the request setup containing Amount, Currency,
PaymentMethod, SetupFutureUsage, ConfirmationMethod, Confirm, CaptureMethod, and
AutomaticPaymentMethods, replace each with valid typed pointers using an
existing pointer helper or typed local variables, including the omitted payment
method value referenced by the comment.
In `@controller/rest/intent/confirm/restintentconfirm_integration_test.go`:
- Around line 70-79: Register a t.Cleanup callback immediately after the Stripe
PaymentIntent is successfully created in the helper, before invoking the
controller or assertions. Have the callback safely cancel the PaymentIntent and
handle any cleanup error without masking the test result, ensuring cleanup
occurs even when the test fails.
- Around line 70-79: Fix invalid pointer construction in the PaymentIntent
parameter setup by replacing value expressions passed to new, including Amount,
Currency, PaymentMethod, SetupFutureUsage, ConfirmationMethod, and
CaptureMethod, with typed local variables or an existing pointer helper, then
pass their addresses or helper results to the corresponding fields.
In `@payment/intent/cancel/intentcancel_integration_test.go`:
- Around line 50-59: Register a t.Cleanup callback immediately after every
successful paymentintent.New in the affected integration tests, including the
cases around all referenced sections. Have each callback cancel its created
PaymentIntent using the existing cancellation logic, and remove or avoid relying
on only the explicit end-of-test cancellation so cleanup also runs after
assertion or API failures.
- Around line 50-59: Fix invalid pointer construction in all three
PaymentIntentParams blocks by replacing new(value/expression) calls with typed
local variables or a pointer helper that accepts values, including fields in the
intent-cancel integration tests and AutomaticPaymentMethods parameters. Ensure
Amount, Currency, ConfirmationMethod, Confirm, CaptureMethod, PaymentMethod, and
related string/bool fields receive correctly typed pointers.
In `@payment/intent/capture/intentcapture_integration_test.go`:
- Around line 50-59: Register Stripe PaymentIntent cancellation immediately
after each PaymentIntent is created in the affected integration tests, using
t.Cleanup so cleanup runs even when assertions fail. Locate the setup and
creation calls in the relevant test functions, and ensure the cleanup safely
cancels the created intent without relying on later successful test execution.
- Around line 50-59: Fix pointer construction in both test cases by replacing
invalid expressions passed to new in the PaymentIntent parameter setup with
addressable local variables or the repository’s pointer helper, covering am,
cur.GetISO4217(), all string and boolean literals, and the "card" value. Update
the affected PaymentIntentAutomaticPaymentMethodsParams and related fields
consistently.
In `@payment/intent/confirm/intentconfirm_integration_test.go`:
- Around line 50-57: The integration test currently cancels the PaymentIntent
only at the end, so failures can leave the remote resource behind. In the test
after `paymentintent.New` succeeds, register a `t.Cleanup` callback that calls
`paymentintent.Cancel` for the created intent, and remove or avoid relying on
the later inline cancellation; ensure cleanup handles and reports cancellation
errors appropriately.
- Around line 50-57: Fix pointer construction in the integration test’s
PaymentIntent parameters: replace invalid value expressions passed to new,
including Amount, Currency, ConfirmationMethod, PaymentMethod, and any card type
field, with addressable named locals and pointers such as &am; ensure the test
compiles under the stripe build tag.
🪄 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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 2a2651bc-a3c1-4de1-aa01-4a1e34733ab4
📒 Files selected for processing (11)
.zed/settings.jsoncontroller/rest/intent/cancel/restintentcancel_integration_test.gocontroller/rest/intent/capture/restintentcapture_integration_test.gocontroller/rest/intent/confirm/restintentconfirm_integration_test.gocontroller/rest/intent/get/restintentget_integration_test.gocustomer/customerstripe.gopayment/intent/cancel/intentcancel_integration_test.gopayment/intent/capture/intentcapture_integration_test.gopayment/intent/confirm/intentconfirm_integration_test.gopayment/intent/create/intentcreate.gopayment/intent/get/intentget_integration_test.go
The README still referenced the retired "Code scanning - action" workflow name, so the badge stayed stuck on failing. Point it at the active CodeQL Advanced workflow, which is passing.
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 (6)
payment/intent/get/intentget_integration_test.go (1)
59-73: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winRegister cleanup via
t.Cleanupinstead of relying on end-of-test cancellation.The intent created at line 59 is only cancelled at line 73; any early failure path added later would leak it. Register cancellation right after creation with
t.Cleanup.As per path instructions, "Flag tests that don't call t.Parallel() where safe, and missing t.Cleanup usage."
🤖 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 `@payment/intent/get/intentget_integration_test.go` around lines 59 - 73, Register a t.Cleanup callback immediately after successfully creating the payment intent in the test, using the intent ID to cancel it. Remove the explicit cancellation at the end of the test so cleanup runs on all exit paths; also add t.Parallel() if this test is safe to run concurrently.Source: Path instructions
controller/rest/intent/get/restintentget_integration_test.go (2)
66-91: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winRegister cleanup via
t.Cleanupfor the created test intent.
createTestIntentreturns an ID that is only cancelled at the very end ofTest(line 127); an early failing assertion leaves the PaymentIntent uncancelled in the test Stripe account.As per path instructions, "Flag tests that don't call t.Parallel() where safe, and missing t.Cleanup usage."
Also applies to: 94-128
🤖 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 `@controller/rest/intent/get/restintentget_integration_test.go` around lines 66 - 91, The created Stripe PaymentIntent is not cleaned up when the test exits early. Update Test and createTestIntent so the returned intent ID is registered with t.Cleanup immediately after creation, cancelling it through the appropriate Stripe API; remove reliance on end-of-test cancellation and ensure cleanup errors are handled or logged.Source: Path instructions
69-80: 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
new(...)here will not compile.newtakes a type, not a value; usestripe.Int64,stripe.String, andstripe.Boolinstead, includingstripe.String("card")forPaymentMethodTypes.🤖 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 `@controller/rest/intent/get/restintentget_integration_test.go` around lines 69 - 80, The PaymentIntentParams initialization uses invalid new(...) calls with values. Replace these with Stripe helper functions: stripe.Int64 for Amount, stripe.String for Currency, PaymentMethod, SetupFutureUsage, ConfirmationMethod, CaptureMethod, and the PaymentMethodTypes entry, and stripe.Bool for Confirm.controller/rest/intent/cancel/restintentcancel_integration_test.go (2)
66-91: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winRegister cleanup via
t.Cleanupfor the created test intent.The intent created in
createTestIntentis only cleaned up at the very end ofTest(line 128); an early failing assertion leaves it uncancelled.As per path instructions, "Flag tests that don't call t.Parallel() where safe, and missing t.Cleanup usage."
Also applies to: 94-129
🤖 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 `@controller/rest/intent/cancel/restintentcancel_integration_test.go` around lines 66 - 91, Register Stripe intent cleanup with t.Cleanup immediately after createTestIntent succeeds in the relevant test, rather than relying only on end-of-test cleanup; update the test flow around Test and its cancellation helper to ensure cleanup runs on assertion failures, while preserving the existing cleanup behavior and avoiding t.Parallel if the test is not safe for parallel execution.Source: Path instructions
69-80: 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
newis invalid here and stops this test from compiling.
newtakes a type, not a value or expression. Replace these with the Stripe helpers used elsewhere:🐛 Proposed fix
pip := &stripe.PaymentIntentParams{ - Amount: new(am), - Currency: new(cur.GetISO4217()), - PaymentMethod: new("pm_card_visa"), - SetupFutureUsage: new("off_session"), - ConfirmationMethod: new("automatic"), - Confirm: new(true), - CaptureMethod: new("manual"), + Amount: stripe.Int64(am), + Currency: stripe.String(cur.GetISO4217()), + PaymentMethod: stripe.String("pm_card_visa"), + SetupFutureUsage: stripe.String("off_session"), + ConfirmationMethod: stripe.String("automatic"), + Confirm: stripe.Bool(true), + CaptureMethod: stripe.String("manual"), // payment_method_types is compatible with confirmation_method; // automatic_payment_methods is not (Stripe rejects both together). - PaymentMethodTypes: []*string{new("card")}, + PaymentMethodTypes: []*string{stripe.String("card")}, }🤖 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 `@controller/rest/intent/cancel/restintentcancel_integration_test.go` around lines 69 - 80, Replace the invalid new(am), new(cur.GetISO4217()), and other new(value) usages in the PaymentIntentParams setup with the appropriate Stripe pointer helpers, such as stripe.Int, stripe.String, and stripe.Bool, matching the value types and existing conventions in the test.payment/intent/create/intentcreate.go (1)
30-47: 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick winReplace
new(...)with Stripe pointer helperspayment/intent/create/intentcreate.go:30-46
newtakes a type, not a value, so these field initialisers do not compile. Usestripe.Int64/stripe.Stringhere instead.🤖 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 `@payment/intent/create/intentcreate.go` around lines 30 - 47, Replace all value-based new(...) initializers in the PaymentIntentParams construction within intentcreate with Stripe pointer helpers: use stripe.Int64 for Amount and stripe.String for string fields, including Currency, PaymentMethod, SetupFutureUsage, ConfirmationMethod, CaptureMethod, and PaymentMethodTypes; also use stripe.String for Customer.
🤖 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 `@payment/intent/get/intentget_integration_test.go`:
- Around line 49-54: Replace the invalid new(am) and new(cur.GetISO4217())
expressions in the PaymentIntentParams initialization with the appropriate
Stripe pointer helper functions, preserving the existing amount and currency
values.
---
Outside diff comments:
In `@controller/rest/intent/cancel/restintentcancel_integration_test.go`:
- Around line 66-91: Register Stripe intent cleanup with t.Cleanup immediately
after createTestIntent succeeds in the relevant test, rather than relying only
on end-of-test cleanup; update the test flow around Test and its cancellation
helper to ensure cleanup runs on assertion failures, while preserving the
existing cleanup behavior and avoiding t.Parallel if the test is not safe for
parallel execution.
- Around line 69-80: Replace the invalid new(am), new(cur.GetISO4217()), and
other new(value) usages in the PaymentIntentParams setup with the appropriate
Stripe pointer helpers, such as stripe.Int, stripe.String, and stripe.Bool,
matching the value types and existing conventions in the test.
In `@controller/rest/intent/get/restintentget_integration_test.go`:
- Around line 66-91: The created Stripe PaymentIntent is not cleaned up when the
test exits early. Update Test and createTestIntent so the returned intent ID is
registered with t.Cleanup immediately after creation, cancelling it through the
appropriate Stripe API; remove reliance on end-of-test cancellation and ensure
cleanup errors are handled or logged.
- Around line 69-80: The PaymentIntentParams initialization uses invalid
new(...) calls with values. Replace these with Stripe helper functions:
stripe.Int64 for Amount, stripe.String for Currency, PaymentMethod,
SetupFutureUsage, ConfirmationMethod, CaptureMethod, and the PaymentMethodTypes
entry, and stripe.Bool for Confirm.
In `@payment/intent/create/intentcreate.go`:
- Around line 30-47: Replace all value-based new(...) initializers in the
PaymentIntentParams construction within intentcreate with Stripe pointer
helpers: use stripe.Int64 for Amount and stripe.String for string fields,
including Currency, PaymentMethod, SetupFutureUsage, ConfirmationMethod,
CaptureMethod, and PaymentMethodTypes; also use stripe.String for Customer.
In `@payment/intent/get/intentget_integration_test.go`:
- Around line 59-73: Register a t.Cleanup callback immediately after
successfully creating the payment intent in the test, using the intent ID to
cancel it. Remove the explicit cancellation at the end of the test so cleanup
runs on all exit paths; also add t.Parallel() if this test is safe to run
concurrently.
🪄 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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: ea99fa53-fef2-444c-bbe9-48f5acf5ef5b
📒 Files selected for processing (9)
controller/rest/intent/cancel/restintentcancel_integration_test.gocontroller/rest/intent/capture/restintentcapture_integration_test.gocontroller/rest/intent/confirm/restintentconfirm_integration_test.gocontroller/rest/intent/get/restintentget_integration_test.gopayment/intent/cancel/intentcancel_integration_test.gopayment/intent/capture/intentcapture_integration_test.gopayment/intent/confirm/intentconfirm_integration_test.gopayment/intent/create/intentcreate.gopayment/intent/get/intentget_integration_test.go
Summary by CodeRabbit