-
Notifications
You must be signed in to change notification settings - Fork 0
CIVIMM-417: Add generic payment processing services for return flow support #2
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
Conversation
|
@codex review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces generic payment processing infrastructure to support payment processor return flows (success/cancel URLs). The implementation centralizes common payment logic previously duplicated across payment processor extensions, providing two core services for contribution completion and customer ID management.
Key Changes:
- Added
ContributionCompletionServicefor idempotent contribution completion with automatic receipt detection and fee recording - Added
PaymentProcessorCustomerServicewith database-backed customer ID storage to prevent duplicate customer creation - Created
PaymentProcessorCustomerentity with full APIv4 support and unique constraints - Implemented service container registration following Hook/Container/ServiceContainer pattern
- Added
PaymentUrlBuilder.buildIpnUrl()utility method for building IPN callback URLs
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
xml/schema/CRM/Paymentprocessingcore/PaymentProcessorCustomer.xml |
Defines database schema for PaymentProcessorCustomer entity with unique constraints and foreign keys |
xml/schema/CRM/Paymentprocessingcore/PaymentProcessorCustomer.entityType.php |
Registers PaymentProcessorCustomer entity type for CiviCRM |
Civi/Api4/PaymentProcessorCustomer.php |
Provides APIv4 interface for PaymentProcessorCustomer entity |
CRM/Paymentprocessingcore/DAO/PaymentProcessorCustomer.php |
Auto-generated DAO class for database operations |
CRM/Paymentprocessingcore/BAO/PaymentProcessorCustomer.php |
Business logic layer with helper methods for finding customers |
Civi/Paymentprocessingcore/Service/PaymentProcessorCustomerService.php |
Service for managing customer IDs with get/create/store/delete operations |
Civi/Paymentprocessingcore/Service/ContributionCompletionService.php |
Service for completing pending contributions with idempotency and receipt handling |
Civi/Paymentprocessingcore/Exception/PaymentProcessorCustomerException.php |
Custom exception with context data for customer operations |
Civi/Paymentprocessingcore/Exception/ContributionCompletionException.php |
Custom exception with context data for contribution completion |
Civi/Paymentprocessingcore/Hook/Container/ServiceContainer.php |
Registers services for dependency injection |
Civi/Paymentprocessingcore/Utils/PaymentUrlBuilder.php |
Added buildIpnUrl() method for IPN callback URLs |
paymentprocessingcore.php |
Implements hook_civicrm_container for service registration |
sql/auto_install.sql |
Creates PaymentProcessorCustomer table on installation |
sql/auto_uninstall.sql |
Drops PaymentProcessorCustomer table on uninstallation |
README.md |
Documentation for new services and usage examples |
CRM/Paymentprocessingcore/Upgrader.php |
Removed commented example code |
tests/phpunit/Civi/Api4/PaymentProcessorCustomerTest.php |
Comprehensive API tests for PaymentProcessorCustomer entity |
tests/phpunit/Civi/Paymentprocessingcore/Service/PaymentProcessorCustomerServiceTest.php |
Unit tests for PaymentProcessorCustomerService |
tests/phpunit/Civi/Paymentprocessingcore/Service/ContributionCompletionServiceTest.php |
Unit tests for ContributionCompletionService |
tests/phpunit/Civi/Paymentprocessingcore/Utils/PaymentUrlBuilderTest.php |
Tests for PaymentUrlBuilder utility class |
phpstan-baseline.neon |
PHPStan baseline updates for new code |
docs/CONTRIBUTION-COMPLETION-SERVICE-IMPLEMENTATION-PLAN.md |
Detailed implementation plan documentation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
tests/phpunit/Civi/Paymentprocessingcore/Service/PaymentProcessorCustomerServiceTest.php
Outdated
Show resolved
Hide resolved
a29d070 to
1a92fe6
Compare
| ### For Payment Processor Developers | ||
|
|
||
| The extension provides two main entities via API4: | ||
| The extension provides three main entities via API4: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think just remove the number from here so you dont have to update it everytime
Overview
This PR adds generic payment processing infrastructure to support payment processor return flows (success/cancel URLs). It introduces two core services that centralize common payment logic previously duplicated across
payment processor extensions (Stripe, GoCardless, etc.).
Before
After
Technical Details
1. ContributionCompletionService (Civi/Paymentprocessingcore/Service/ContributionCompletionService.php)
2. PaymentProcessorCustomerService (Civi/Paymentprocessingcore/Service/PaymentProcessorCustomerService.php)
3. PaymentProcessorCustomer Entity
4. Service Registration
Code Examples:
// Complete a contribution
// Get or create customer ID