Skip to content

Conversation

@michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Dec 9, 2025

Resolves #13226

Summary by CodeRabbit

  • New Features

    • Create Customer: add customers to Braintree with name, company, email, phone, fax, and website
    • New Customer Created: event source that emits when a new Braintree customer appears
    • New Transaction Created: event source that emits when a new Braintree transaction appears
    • Shared polling support: common polling logic to power reliable event sources
  • Chores

    • Component package version bumped and enhanced GraphQL connectivity for Braintree integrations

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link

vercel bot commented Dec 9, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
pipedream-docs Ignored Ignored Dec 11, 2025 3:27pm
pipedream-docs-redirect-do-not-edit Ignored Ignored Dec 11, 2025 3:27pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 9, 2025

Walkthrough

Adds a Braintree integration: app-level GraphQL helper, GraphQL query/mutation modules, a create-customer action, a reusable polling source framework, two polling sources (new customer, new transaction), and package/version metadata updates.

Changes

Cohort / File(s) Summary
Braintree App
components/braintree/braintree.app.mjs
Removed authKeys(); added async makeGraphQLRequest({ $ = this, ...opts }) that POSTs to Braintree GraphQL using env-based subdomain, sets Braintree-Version and Content-Type headers, uses basic auth from this.$auth, throws ConfigurationError on GraphQL errors, and returns the response. Imports axios and ConfigurationError.
Create Customer Action
components/braintree/actions/create-customer/create-customer.mjs
New action braintree-create-customer exporting props for customer fields and run() which calls this.braintree.makeGraphQLRequest with mutations.createCustomer and variables: { input: { customer: { ... } } }; exports a summary containing the created customer ID and returns the response.
GraphQL Definitions
components/braintree/common/mutations.mjs, components/braintree/common/queries.mjs
New modules exporting GraphQL strings: mutations.mjs exports createCustomer mutation; queries.mjs exports searchCustomers and searchTransactions query strings with selected fields.
Polling Framework
components/braintree/sources/common/base-polling.mjs
New reusable polling source with props (braintree, db, timer), helpers (_yesterday, _getLastCreatedAt, _setLastCreatedAt), emitEvent, generateMeta, abstract getResults/getSummary (throw ConfigurationError if unimplemented), and a run() loop that fetches results, emits events, and persists the latest createdAt.
Polling Sources
components/braintree/sources/new-customer-created/new-customer-created.mjs, components/braintree/sources/new-transaction-created/new-transaction-created.mjs
New sources extending the base polling module. Each implements getResults(lastCreatedAt) that calls this.braintree.makeGraphQLRequest with respective queries and filters on createdAt, maps edgesnodes, and getSummary(result) returning a concise summary string.
Package Metadata
components/braintree/package.json
Bumped version from 0.0.30.1.0; added dependencies with @pipedream/platform: ^3.1.1.
Trivial Formatting
components/upsales/upsales.app.mjs, components/xero_payroll/xero_payroll.app.mjs
End-of-file newline added; no behavioral changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Source as Polling Source
  participant App as braintree.app (makeGraphQLRequest)
  participant API as Braintree GraphQL
  participant DB as Persisted DB
  participant Events as Event Emitter

  Source->>DB: _getLastCreatedAt()
  DB-->>Source: lastCreatedAt
  Source->>App: makeGraphQLRequest(query=search..., variables={createdAt >= lastCreatedAt})
  App->>API: POST GraphQL request (basic auth, headers)
  API-->>App: GraphQL response (edges -> nodes)
  App-->>Source: response
  loop for each result
    Source->>Events: emitEvent(result, meta)
    Events-->>Source: ack
    Source->>DB: _setLastCreatedAt(result.createdAt) (update maxCreatedAt)
    DB-->>Source: ack
  end
Loading
sequenceDiagram
  autonumber
  participant Action as create-customer Action
  participant App as braintree.app (makeGraphQLRequest)
  participant API as Braintree GraphQL

  Action->>App: makeGraphQLRequest(mutation=createCustomer, variables={input: { customer: {...} }})
  App->>API: POST GraphQL mutation (basic auth, headers)
  API-->>App: mutation response (created customer)
  App-->>Action: response
  Action-->>Caller: return response + summary("Customer successfully created with ID ...")
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~35–50 minutes

  • Areas to focus on:
    • components/braintree/sources/common/base-polling.mjs: run loop correctness, handling empty or out-of-order results, timestamp zone/format and persistence semantics.
    • components/braintree/braintree.app.mjs: URL/subdomain construction, basic auth header encoding, header names/values, and GraphQL error detection/throwing.
    • components/braintree/common/queries.mjs and components/braintree/common/mutations.mjs: ensure queries/mutations match Braintree GraphQL schema and required input/field names.
    • components/braintree/sources/* and components/braintree/actions/create-customer/create-customer.mjs: null-safety when reading response.data...edges, input shape alignment with mutation, and summary extraction path (response.data.createCustomer.customer.id).

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 2 inconclusive)
Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR includes minor formatting changes to unrelated components (upsales.app.mjs, xero_payroll.app.mjs) that are out of scope for Braintree component development. Remove unrelated formatting changes to upsales and xero_payroll components; keep only Braintree-specific changes (braintree.app.mjs, create-customer action, polling sources, mutations, queries).
Description check ❓ Inconclusive The description is minimal, containing only 'Resolves #13226', but it correctly links to the issue without following the repository's template structure. Fill out the WHY section of the PR description template to explain the motivation and context for adding these Braintree components.
Linked Issues check ❓ Inconclusive The PR implements polling sources (new-customer-created, new-transaction-created) and action (create-customer) that align with issue #13226 requirements, though implementation differs from exact specifications. Verify that props for new-customer/new-transaction sources match issue requirements; create-customer includes optional props but missing 'paymentMethod' and 'address' specified in issue #13226.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically identifies the main change: introducing new Braintree components (polling sources and actions).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch issue-13226

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 31ba835 and e5cf122.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • components/upsales/upsales.app.mjs (1 hunks)
  • components/xero_payroll/xero_payroll.app.mjs (1 hunks)
⏰ 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). (4)
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Publish TypeScript components
  • GitHub Check: pnpm publish
  • GitHub Check: Lint Code Base
🔇 Additional comments (2)
components/upsales/upsales.app.mjs (1)

11-11: LGTM - Trailing newline addition.

No functional change; just ensures the file ends with a newline per POSIX convention.

components/xero_payroll/xero_payroll.app.mjs (1)

11-11: LGTM - Trailing newline addition.

No functional change; just ensures the file ends with a newline per POSIX convention.


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: 11

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a284285 and bbb45a6.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (8)
  • components/braintree/actions/create-customer/create-customer.mjs (1 hunks)
  • components/braintree/braintree.app.mjs (1 hunks)
  • components/braintree/common/mutations.mjs (1 hunks)
  • components/braintree/common/queries.mjs (1 hunks)
  • components/braintree/package.json (2 hunks)
  • components/braintree/sources/common/base-polling.mjs (1 hunks)
  • components/braintree/sources/new-customer-created/new-customer-created.mjs (1 hunks)
  • components/braintree/sources/new-transaction-created/new-transaction-created.mjs (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-09-15T22:01:11.472Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 18362
File: components/leonardo_ai/actions/generate-image/generate-image.mjs:103-105
Timestamp: 2025-09-15T22:01:11.472Z
Learning: In Pipedream components, pipedream/platform's axios implementation automatically excludes undefined values from HTTP requests, so there's no need to manually check for truthiness before including properties in request payloads.

Applied to files:

  • components/braintree/braintree.app.mjs
📚 Learning: 2024-10-30T15:24:39.294Z
Learnt from: jcortes
Repo: PipedreamHQ/pipedream PR: 14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In `components/gainsight_px/actions/create-account/create-account.mjs`, the action name should be "Create Account" instead of "Create Memory".

Applied to files:

  • components/braintree/actions/create-customer/create-customer.mjs
📚 Learning: 2024-12-12T19:23:09.039Z
Learnt from: jcortes
Repo: PipedreamHQ/pipedream PR: 14935
File: components/sailpoint/package.json:15-18
Timestamp: 2024-12-12T19:23:09.039Z
Learning: When developing Pipedream components, do not add built-in Node.js modules like `fs` to `package.json` dependencies, as they are native modules provided by the Node.js runtime.

Applied to files:

  • components/braintree/package.json
🧬 Code graph analysis (1)
components/braintree/sources/new-customer-created/new-customer-created.mjs (2)
components/braintree/sources/common/base-polling.mjs (1)
  • lastCreatedAt (49-49)
components/braintree/sources/new-transaction-created/new-transaction-created.mjs (1)
  • braintree (16-27)
⏰ 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). (4)
  • GitHub Check: pnpm publish
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Lint Code Base
🔇 Additional comments (3)
components/braintree/package.json (1)

3-17: LGTM!

Version bump to 0.1.0 is appropriate for this feature addition, and the @pipedream/platform dependency is correctly added to support the new axios-based GraphQL request method.

components/braintree/common/mutations.mjs (1)

1-21: LGTM!

The GraphQL mutation is well-structured and returns a comprehensive set of customer fields. The export pattern is consistent with the queries module.

components/braintree/sources/common/base-polling.mjs (1)

18-23: LGTM: Clean date utility method.

The _yesterday() method correctly creates an ISO timestamp for 24 hours ago, providing a sensible default for initial polling.

jcortes
jcortes previously approved these changes Dec 9, 2025
Copy link
Collaborator

@jcortes jcortes left a comment

Choose a reason for hiding this comment

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

Hi @michelle0927 lgtm! Ready for QA!

@vunguyenhung
Copy link
Collaborator

For Integration QA:

@vunguyenhung
Copy link
Collaborator

Hello everyone, I have tested this PR and there're some test cases failed or needed improvement.

Please check test reports below for more information:

@michelle0927
Copy link
Collaborator Author

@vunguyenhung I added error handling to display the GraphQL errors when they're returned. When I tested with the account in 1PW, I got an authentication error. I noticed that the private_key specified in 1PW was incorrect, so I updated it with the correct private_key. Can you reconnect your account with the updated creds and test again?

@vunguyenhung
Copy link
Collaborator

Hi @michelle0927, thank you for your information.

Definitely something miss on my end, will check and test again

@vunguyenhung
Copy link
Collaborator

Hi everyone, all test cases are passed! Ready for release!

Test reports

@michelle0927
Copy link
Collaborator Author

/approve

@michelle0927
Copy link
Collaborator Author

/approve

@michelle0927 michelle0927 merged commit 080d445 into master Dec 12, 2025
9 checks passed
@michelle0927 michelle0927 deleted the issue-13226 branch December 12, 2025 15:06
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.

[Components] braintree

4 participants