Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(background): split up OpenPaymentsService #775

Merged
merged 22 commits into from
Jan 9, 2025

Conversation

DarianM
Copy link
Member

@DarianM DarianM commented Dec 16, 2024

Closes #713

Changes proposed in this pull request

  • related grant and AcessToken functionality moved to OutgoingPaymentGrantService
    • provides a service for managing outgoing payment grants, including creating, canceling, and rotating grants, as well as switching between different grant types.
  • move connectWallet, addFunds, updateBudget, disconnectWallet and related to new WalletService
  • move createOutgoingPayment, pollOutgoingPayment and probeDebitAmount to PaymentSession
  • move close popup event from openPayments to wallet service

@DarianM DarianM linked an issue Dec 16, 2024 that may be closed by this pull request
@github-actions github-actions bot added area: background Improvements or additions to extension background script area: shared Changes to shared libraries and utilities labels Dec 16, 2024
Copy link
Contributor

github-actions bot commented Dec 16, 2024

Extension builds preview

Name Link
Latest commit a06ff48
Latest job logs Run #12689732622
BadgeDownload
BadgeDownload

@github-actions github-actions bot added the area: tests Improvements or additions to tests label Dec 16, 2024
@DarianM DarianM marked this pull request as ready for review December 16, 2024 07:54
@sidvishnoi sidvishnoi changed the title chore: Simplify OpenPaymentsService refactor(background): simplify OpenPaymentsService, extract OutgoingPaymentGrantService Dec 16, 2024
@sidvishnoi sidvishnoi changed the title refactor(background): simplify OpenPaymentsService, extract OutgoingPaymentGrantService refactor(bg/OpenPaymentsService): move functionality to OutgoingPaymentGrantService Dec 16, 2024
@sidvishnoi sidvishnoi changed the title refactor(bg/OpenPaymentsService): move functionality to OutgoingPaymentGrantService refactor(bg/OpenPayments): move functionality to OutgoingPaymentGrantService Dec 16, 2024
@sidvishnoi sidvishnoi changed the title refactor(bg/OpenPayments): move functionality to OutgoingPaymentGrantService refactor(bg/OpenPayments): extract OutgoingPaymentGrantService Dec 16, 2024
@DarianM DarianM marked this pull request as draft December 16, 2024 08:33
@github-actions github-actions bot added area: popup Improvements or additions to extension popup area: pages Changes to any of extension's pages and removed area: tests Improvements or additions to tests area: shared Changes to shared libraries and utilities labels Dec 16, 2024
Copy link
Member

@sidvishnoi sidvishnoi left a comment

Choose a reason for hiding this comment

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

Some nits in first round of review.
Overall:

  • Should move connectWallet and more outgoing-payment grant related things into new service.
  • Make background communicate directly with new service, instead of going through OpenPaymentsService

src/background/container.ts Outdated Show resolved Hide resolved
src/pages/popup/index.tsx Outdated Show resolved Hide resolved
src/background/services/outgoingPaymentGrant.ts Outdated Show resolved Hide resolved
src/background/services/outgoingPaymentGrant.ts Outdated Show resolved Hide resolved
src/background/services/outgoingPaymentGrant.ts Outdated Show resolved Hide resolved
@sidvishnoi sidvishnoi removed the request for review from raducristianpopa December 16, 2024 12:01
@github-actions github-actions bot removed area: popup Improvements or additions to extension popup area: pages Changes to any of extension's pages labels Dec 20, 2024
Copy link
Member

@sidvishnoi sidvishnoi left a comment

Choose a reason for hiding this comment

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

test-e2e

@DarianM DarianM requested a review from sidvishnoi January 8, 2025 15:09
Copy link
Member Author

@DarianM DarianM left a comment

Choose a reason for hiding this comment

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

test-e2e

@sidvishnoi sidvishnoi changed the title refactor(bg/OpenPayments): extract OutgoingPaymentGrantService refactor(background): split up OpenPaymentsService Jan 9, 2025
As that'll allow us using `keyid` throughout code, but we prefer `keyId`
Copy link
Member

@sidvishnoi sidvishnoi left a comment

Choose a reason for hiding this comment

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

Nearly there! Some small recommendations.

src/background/services/outgoingPaymentGrant.ts Outdated Show resolved Hide resolved
src/background/services/outgoingPaymentGrant.ts Outdated Show resolved Hide resolved
src/background/services/wallet.ts Outdated Show resolved Hide resolved
src/background/services/outgoingPaymentGrant.ts Outdated Show resolved Hide resolved
Copy link
Member

@sidvishnoi sidvishnoi left a comment

Choose a reason for hiding this comment

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

test-e2e

jest.setup.ts Outdated Show resolved Hide resolved
Copy link
Member

@sidvishnoi sidvishnoi left a comment

Choose a reason for hiding this comment

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

🎉🚀 Worth all the effort 💯

@sidvishnoi sidvishnoi merged commit ce6d58f into main Jan 9, 2025
9 checks passed
@sidvishnoi sidvishnoi deleted the 713-refactor-simplify-openpaymentsservice branch January 9, 2025 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: background Improvements or additions to extension background script
Projects
None yet
Development

Successfully merging this pull request may close these issues.

refactor: simplify OpenPaymentsService
2 participants