Skip to content

feat: Create payment actions service - #1658

Open
mzlangreder wants to merge 3 commits into
payment-actions-m3-featurefrom
create_payment_actions_service
Open

feat: Create payment actions service#1658
mzlangreder wants to merge 3 commits into
payment-actions-m3-featurefrom
create_payment_actions_service

Conversation

@mzlangreder

@mzlangreder mzlangreder commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary of changes

  • Create PaymentActionsService
  • Create unit tests

AI Usage

Which AI Agent Was Used?

  • Copilot
  • Claude
  • Other (Type Name Here)

How was AI used?
Review ADR to match up expected graphQL shapes and writing unit tests.

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

@mzlangreder
mzlangreder requested a review from a team as a code owner July 27, 2026 20:50
@mzlangreder mzlangreder changed the title Create payment actions service feat: Create payment actions service Jul 28, 2026
@mzlangreder
mzlangreder force-pushed the create_payment_actions_service branch 3 times, most recently from 4c61612 to 0e294a3 Compare July 29, 2026 16:02
Base automatically changed from add_payment_actions_base_interfaces_and_types to payment-actions-m3-feature July 29, 2026 18:45
* Payment Action Id is not needed as it's read from the authFingerprint
* Unit Test updated to reflect unvaulted card flow
* Added KDoc for PaymentActionsService
* Added unit tests to cover updated enum cases
@mzlangreder
mzlangreder force-pushed the create_payment_actions_service branch from 8029239 to 6a237ab Compare July 29, 2026 18:46

@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.

This looks great! Just a couple questions and nits

PaymentActionResult.Success(paymentAction)
}
}
} catch (jex: JSONException) {

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.

Interesting naming convention jex. Just out of curiosity, is that a personal preference or style standard?

): PaymentActionResult {
return try {
braintreeClient
.sendGraphQLPOST(buildSetPaymentActionPaymentMethodQuery(paymentMethod))

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.

nit: since the method name is so long this is starting to feel a bit difficult to parse in a single line, but I don't feel super strongly


private val paymentMethodVariables = JSONObject().apply {
put(
"paymentMethodDetails",

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.

Just double checking it should be paymentMethodDetails and not paymentMethod. I don't think I've seen what the payment method input is supposed to look like yet

every { paymentActionSelectionSet() } returns selectionSet
}

@OptIn(ExperimentalCoroutinesApi::class)

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.

Is this something we can put on the class so it doesn't need to be added to every test?

"setPaymentActionPaymentMethod": {
"paymentAction": {
"id": "pa123",
"status": "requires_payment_method"

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 this is more of a general feature question but I can't seem to answer it using the technical decision docs I've seen. What use case will the setPaymentActionPaymentMethod query be called and return a success but also have the status requires_payment_method. Isn't that status to signify that setPaymentActionPaymentMethod has to be called?

Again I'm probably under informed so please let me know if there's a doc I need to be referring to

.let { paymentActionJson ->
PaymentAction(
id = paymentActionJson.getString(ID_KEY),
status = paymentActionJson.getString(STATUS_KEY).toPaymentActionStatus()

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.

same thing came up on iOS: getString throws if id is missing, but not if it's an empty string — so that currently returns a Success with an unusable id. worth adding a check so empty fails the same way as missing, matching iOS.

braintreeClient
.sendGraphQLPOST(buildSetPaymentActionPaymentMethodQuery(paymentMethod))
.toPaymentActionsResult()
} catch (exception: IOException) {

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.

wondering if we should widen the exception type or if it's okay as-is 👀 in the case sendGraphQLPOST can throw anything besides IOException

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.

3 participants