-
Notifications
You must be signed in to change notification settings - Fork 1
feat: create MQ jobs to resynch payment profiles from external MS #453
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
base: main
Are you sure you want to change the base?
Conversation
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 adds support for synchronizing payment profile data from an external payments service via RabbitMQ message queue. The implementation adds an ExternalId field to track external payment profiles and implements message consumers to handle create, update, and delete events.
- Added database migration to add
ExternalIdcolumn toPaymentGatewayProfiletable - Implemented RabbitMQ consumer infrastructure for payments sync with handlers for create, update, and delete operations
- Added PaymentsApi client to fetch payment profile data from external service
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| readme.md | Added documentation for the new payments_sync_consumer queue worker |
| database/migrations/model/Version20251106013928.php | Database migration adding ExternalId column to PaymentGatewayProfile table |
| config/queue.php | Configuration for payments_sync_consumer RabbitMQ connection |
| app/Services/Apis/PaymentsApi.php | New API client for fetching payment profiles from external service |
| app/Services/Apis/IPaymentsApi.php | Interface for PaymentsApi |
| app/Repositories/Summit/DoctrinePaymentGatewayProfileRepository.php | Added getByExternalId method to query profiles by external ID |
| app/Models/Foundation/Summit/Repositories/IPaymentGatewayProfileRepository.php | Added getByExternalId interface method |
| app/Models/Foundation/Summit/Registration/Payment/PaymentGatewayProfile.php | Added external_id property with getter/setter methods |
| app/Models/Foundation/Summit/Factories/PaymentGatewayProfileFactory.php | Added support for populating external_id field |
| app/Jobs/Payments/UpdatePaymentProfileMQJob.php | Job handler for payment profile update events |
| app/Jobs/Payments/PaymentsMQJob.php | RabbitMQ job dispatcher routing events to appropriate handlers |
| app/Jobs/Payments/EventTypes.php | Constants defining payment profile event types |
| app/Jobs/Payments/DeletePaymentProfileMQJob.php | Job handler for payment profile delete events |
| app/Jobs/Payments/CreatePaymentProfileMQJob.php | Job handler for payment profile create events |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| $builder = new Builder($schema); | ||
| if($schema->hasTable("PaymentGatewayProfile") && !$builder->hasColumn("PaymentGatewayProfile", "ExternalId")) { | ||
| $builder->table("PaymentGatewayProfile", function (Table $table) { | ||
| $table->string("ExternalId", )->setNotnull(false)->setDefault('NULL'); |
Copilot
AI
Nov 6, 2025
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.
The string() method is missing the length parameter. Based on similar migrations in the codebase, this should specify a length value (e.g., 255). Additionally, setDefault('NULL') should be setDefault(null) for a proper NULL default value in the database.
| $table->string("ExternalId", )->setNotnull(false)->setDefault('NULL'); | |
| $table->string("ExternalId", 255)->setNotnull(false)->setDefault(null); |
| /** | ||
| * @var string | ||
| */ | ||
| private $scopes; |
Copilot
AI
Nov 6, 2025
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.
The $scopes property is declared but never used in the class. Consider removing it to reduce code clutter.
| private $scopes; |
| private $scopes; | ||
|
|
||
| /** | ||
| * ExternalUserApi constructor. |
Copilot
AI
Nov 6, 2025
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.
The constructor comment says 'ExternalUserApi constructor' but this is the PaymentsApi class. Update the comment to 'PaymentsApi constructor'.
| * ExternalUserApi constructor. | |
| * PaymentsApi constructor. |
| $test_publishable_key = $params['test_publishable_key'] ?? null; | ||
| $test_secret_key = $params['test_secret_key'] ?? null; | ||
|
|
||
| $external_id = $params['external_id'] ?? null; |
Copilot
AI
Nov 6, 2025
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.
The variable $external_id is extracted but never used. This assignment can be removed since the value is accessed directly via $params['external_id'] in line 60-61.
| $external_id = $params['external_id'] ?? null; |
|
|
||
| /** | ||
| * Class EventTypes | ||
| * @package App\Jobs\SponsorServices |
Copilot
AI
Nov 6, 2025
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.
The @package tag incorrectly references 'App\Jobs\SponsorServices' but this class is in the 'App\Jobs\Payments' namespace. Update to '@Package App\Jobs\Payments'.
| * @package App\Jobs\SponsorServices | |
| * @package App\Jobs\Payments |
| $id = intval($data['id']); | ||
| $summit_id = intval($data['summit_id']); | ||
| $response = $this->payments_api->getPaymentProfile($summit_id, $id); | ||
| Log::debug("UpdatePaymentProfileMQJob::handle", ['response' => $response]); |
Copilot
AI
Nov 6, 2025
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.
The log statement references 'UpdatePaymentProfileMQJob::handle' but this is in CreatePaymentProfileMQJob. Change to 'CreatePaymentProfileMQJob::handle' for accurate logging.
| Log::debug("UpdatePaymentProfileMQJob::handle", ['response' => $response]); | |
| Log::debug("CreatePaymentProfileMQJob::handle", ['response' => $response]); |
| $summit_id = intval($data['summit_id']); | ||
|
|
||
| $summit = $this->summit_repository->getById($summit_id); | ||
| $local_payment_profile =$this->payment_gateway_profile_repository->getByExternalId($id); |
Copilot
AI
Nov 6, 2025
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.
Missing space after = assignment operator. Should be $local_payment_profile = $this->payment_gateway_profile_repository->getByExternalId($id); for consistent formatting.
| $local_payment_profile =$this->payment_gateway_profile_repository->getByExternalId($id); | |
| $local_payment_profile = $this->payment_gateway_profile_repository->getByExternalId($id); |
cc93a30 to
a1083d3
Compare
ref: https://app.clickup.com/t/86b66n5d9