Skip to content

feat: add a compose friendly constructor to SEPADirectDebit - #1704

Merged
noguier merged 3 commits into
mainfrom
compose-constructor-SEPA
Sep 23, 2026
Merged

noguier merged 3 commits into
mainfrom
compose-constructor-SEPA

Conversation

@noguier

@noguier noguier commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary of changes

  • Create compose-friendly constructor to SEPADirectDebitLauncher
  • wire the new constructor in the demo app to ensure it works as expected
  • add a changelog

AI Usage

Which AI Agent Was Used?

  • Copilot
  • Claude
  • Other (Type Name Here)

How was AI used?
test creation

Estimated AI Code Contribution

  • less than 30%
  • 30 - 60%
  • 60 - 100%

Checklist

  • Added a changelog entry
  • Tested and confirmed payment flows affected by this change are functioning as expected

Authors

List GitHub usernames for everyone who contributed to this pull request.
@noguier

@noguier
noguier requested review from a team and a lite review from Copilot September 11, 2026 20:03
@noguier
noguier requested a review from a team as a code owner September 11, 2026 20:03
@github-actions

github-actions Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities found.

Scanned Files

None

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The only finding is a non-blocking test assertion nit.

Pull request overview

Adds a Compose-friendly ActivityResultRegistry constructor to SEPADirectDebitLauncher, with a unit test and changelog entry.

Changes:

  • Added registry-based launcher construction.
  • Added constructor test coverage.
  • Documented the change in CHANGELOG.md.
File summaries
File Summary
SEPADirectDebit/src/test/java/com/braintreepayments/api/sepadirectdebit/SEPADirectDebitLauncherUnitTest.kt Tests registry-based construction; includes a minor assertion nit.
SEPADirectDebit/src/main/java/com/braintreepayments/api/sepadirectdebit/SEPADirectDebitLauncher.kt Adds the Compose-compatible constructor.
CHANGELOG.md Documents the new constructor.
Review details

Suppressed comments (1)

SEPADirectDebit/src/test/java/com/braintreepayments/api/sepadirectdebit/SEPADirectDebitLauncherUnitTest.kt:43

  • This assertion only proves that Kotlin returned a non-null object, so it would still pass if this overload ignored registry and constructed the default BrowserSwitchClient. Please verify the registry-backed browser-switch client is actually used (or remove the test if compile-only coverage is intended), so the new Compose wiring is protected from regressions.
        val launcher = SEPADirectDebitLauncher(registry)

        assertNotNull(launcher)
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

* Used to launch the SEPA mandate in a web browser and deliver results. Use it in Compose flows
* or anywhere else an [ActivityResultCaller] is not available.
* @param registry ActivityResultRegistry parameter. It will be passed to BrowserSwitchClient.
*/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a nice, helpful comment!


assertNotNull(launcher)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a question coming from my lack of compose knowledge, but is this type of test good enough to confirm the compose constructor is working as intended?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

great question, i think I was mostly trying to test here if the constructor can be constructed with ActivityResultCaller without crashing. Most of the hard work is passed to BrowserSwitchClient so it is hard to test anything besides launcher creation. I can possibly mock the creation of BrowserSwitchClient with the newly created launcher, do you think it will be better?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think that question is probably best answered by you and other Android platform specific folks since I don't know the common best practices for compose UI tests and how much is necessary

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

When I read the text of the test, "creates a valid launcher", I think here I would at least expect some more assertions on the launcher itself to verify it is "valid". If all we wanted was a test that the launcher gets created when being passed the expected params, that kind of feels like a low value test to me unless there is something specific you're looking for having been set up from calling the constructor.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah that makes sense and sort of what I was curious about: Are there additional things that could be asserted to see if any attributes can be verified, or is this comprehensive enough

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hi all, i removed this test, and instead wired a new constructor in the demo app, I dont think we can add a useful unit test for this change since all the constructor is doing is passing the registry to browserSwitchClient, that then does all the job. I feel like wiring the new constructor is comprehensive enough to ensure the flow works as expected. Let me know what you think :)

Copilot AI review requested due to automatic review settings September 17, 2026 22:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The test should verify that the supplied registry is actually used.

Get a fresh assessment by requesting another Copilot review.

Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Lite

@saralvasquez saralvasquez left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These changes seem simple enough, but could I get a bit of context on why we are adding this? The ticket for this referenced the acceptance criteria but didn't give much explanation otherwise

I think I also second the comments on testing. I wonder if there would be a way to do extra testing on this by possibly adding to the demo app or something

@noguier

noguier commented Sep 18, 2026

Copy link
Copy Markdown
Contributor Author

hey @saralvasquez , thank you for your question! this ticket came as a follow up for this ask: #1662. Here we are asked to do the compose for GooglePay, but upon investigation I found that SEPADirectDebit and some other launchers can also use compose friendly constructor :)

I think adding that compose for the demo might be a good middle ground in testing the constructor out, I will add that!

Copilot AI review requested due to automatic review settings September 21, 2026 20:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

One or more issues must be addressed before approval.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity · 1 Low severity

Open (2)
Resolved since last review (1)

Comment on lines +29 to +30
constructor(registry: ActivityResultRegistry) : this(
browserSwitchClient = BrowserSwitchClient(registry)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

These constructors match the same pattern that Venmo and PayPal Launchers have today.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should still validate (and they may be broken on those other Launchers if this ends up being true)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added unit tests to test the behavior outlined by copilot. The code didnt not crash, so I believe we can continue with the merge.

Copilot AI review requested due to automatic review settings September 21, 2026 21:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

One or more issues must be addressed before approval.

Review effort: Lite
Findings: 1 High severity · 1 Low severity

Open (2)

@noguier
noguier force-pushed the compose-constructor-SEPA branch from c54b1c8 to 42ef463 Compare September 22, 2026 18:47
Copilot AI review requested due to automatic review settings September 22, 2026 18:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

No unresolved review issues were identified.

Review effort: Lite
Findings: 1 High severity

Open (1)
Resolved since last review (1)

@saralvasquez saralvasquez left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for adding the change to the demo app! I think this is a good approach since testing these changes is challenging

@agedd agedd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks good! 🚀

@noguier
noguier merged commit e9e856c into main Sep 23, 2026
26 of 28 checks passed
@noguier
noguier deleted the compose-constructor-SEPA branch September 23, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants