Skip to content

Fix pro issue 6081 (Square fatal error when refunding with payments s…#3041

Merged
Crabcyborg merged 4 commits intomasterfrom
pro_issue_6081
Mar 24, 2026
Merged

Fix pro issue 6081 (Square fatal error when refunding with payments s…#3041
Crabcyborg merged 4 commits intomasterfrom
pro_issue_6081

Conversation

@Crabcyborg
Copy link
Contributor

@Crabcyborg Crabcyborg commented Mar 24, 2026

…ubmodule active)

Fixes https://github.com/Strategy11/formidable-pro/issues/6081

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Enhanced reliability and stability of payment refund and subscription cancellation operations.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 24, 2026

Warning

Rate limit exceeded

@Crabcyborg has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 0 minutes and 33 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9c28c4bd-627d-4931-bbd5-f1f0ee998e31

📥 Commits

Reviewing files that changed from the base of the PR and between 2d0498a and f613e46.

📒 Files selected for processing (1)
  • square/helpers/FrmSquareLiteConnectHelper.php
📝 Walkthrough

Walkthrough

A new PHP helper class FrmSquareLiteApiHelper is introduced to provide backward compatibility wrapper methods for payment and subscription operations. The class includes an ABSPATH security gate and delegates refund and cancellation requests to the existing FrmSquareLiteConnectHelper.

Changes

Cohort / File(s) Summary
New Backward Compatibility Wrapper
square/helpers/FrmSquareLiteApiHelper.php
Added new helper class with ABSPATH access gate and two public static methods (refund_payment, cancel_subscription) that delegate to FrmSquareLiteConnectHelper for backward compatibility with the Payments Submodule.

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A wrapper born to bridge the way,
Where payments dance and subscriptions sway,
Backward compatible, tried and true,
Old friends and new, I connect them through! 💳✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the main objective of fixing a Square fatal error when refunding with the payments submodule active, which matches the core change of introducing the FrmSquareLiteApiHelper class.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch pro_issue_6081

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@square/helpers/FrmSquareLiteApiHelper.php`:
- Around line 12-22: The docblock for refund_payment incorrectly declares
"@return bool" while FrmSquareLiteConnectHelper::refund_payment() actually
returns false|object; update the refund_payment method's docblock in
FrmSquareLiteApiHelper::refund_payment to reflect the correct return type
(false|object) so static analysis and callers see the accurate signature; keep
the rest of the docblock intact and ensure the returned value documentation
matches the behavior of FrmSquareLiteConnectHelper::refund_payment.
- Around line 6-10: Update the file-level doc comment above class
FrmSquareLiteApiHelper to correctly reference the Square payments context
instead of "Authorize.Net": change the sentence that currently reads "the
Authorize.Net add on will trigger fatal errors" to mention the Square payments
add-on (or generically "payments add-on/submodule") so the comment accurately
reflects that FrmSquareLiteApiHelper exists for backward compatibility with the
Payments Submodule and prevents Square-related fatal errors.
- Around line 24-34: The docblock on FrmSquareLiteApiHelper::cancel_subscription
incorrectly declares `@return` bool while the method forwards to
FrmSquareLiteConnectHelper::cancel_subscription which returns false|object;
update the docblock for cancel_subscription to declare the correct return type
(false|object) to match FrmSquareLiteConnectHelper::cancel_subscription and keep
any inline method behavior unchanged so callers see the accurate signature.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b0c4f98f-1ae5-4449-a16a-dfdfbba63bcd

📥 Commits

Reviewing files that changed from the base of the PR and between be364dd and 2d0498a.

📒 Files selected for processing (1)
  • square/helpers/FrmSquareLiteApiHelper.php

@deepsource-io
Copy link

deepsource-io bot commented Mar 24, 2026

DeepSource Code Review

We reviewed changes in be364dd...f613e46 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
PHP Mar 24, 2026 12:53p.m. Review ↗
JavaScript Mar 24, 2026 12:53p.m. Review ↗

@Crabcyborg Crabcyborg merged commit 91bc9f2 into master Mar 24, 2026
22 checks passed
@Crabcyborg Crabcyborg deleted the pro_issue_6081 branch March 24, 2026 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant