Conversation
Included 'rubocop' and 'rubocop-rails' in the Gemfile to enhance code quality checks and maintainability. Updated Gemfile.lock to reflect the new dependencies and their versions.
Updated the PaymentsController to improve the payment receipt logic by utilizing a service object for recording gateway receipts. Adjusted the orderNumber generation to use the user's email and ID. Enhanced request specs to cover scenarios for duplicate and forbidden statuses, ensuring robust handling of payment callbacks. This refactor improves code maintainability and clarity in payment processing.
Added a new table for payment gateway callbacks with relevant fields and foreign keys to enhance payment processing capabilities. Updated the ActiveRecord schema version to reflect these changes, ensuring improved data integrity and functionality in handling payment events.
…associations Introduced a new ActiveAdmin interface for managing PaymentGatewayCallback records, including filters and display options. Updated the Payment model to establish a relationship with PaymentGatewayCallback, allowing for better tracking of gateway callbacks. Enhanced ransackable associations and attributes for improved query capabilities. Updated the Payment admin view to display associated gateway callbacks, improving user experience in payment management.
…ecorder Updated the Payments::GatewayReceiptRecorder service to improve duplicate transaction handling by introducing a dedicated method for duplicate results. Added tests to cover scenarios where uniqueness validation fails and when concurrent callbacks raise a RecordNotUnique error. Refactored the PaymentsController to ensure consistent handling of duplicate statuses in payment receipts, enhancing overall robustness in payment processing.
…ayments table Modified the ActiveRecord schema to add a unique index on the transaction_id column in the payments table, enhancing data integrity by preventing duplicate transaction entries. Updated the schema version to reflect this change.
Fix pmnt recordings
Included the 'stackprof' gem in the Gemfile to enable performance profiling when the profiles_sample_rate is set in the Sentry configuration. This addition supports better performance monitoring and analysis capabilities in the application.
Included the 'stackprof' gem in the Gemfile.lock to support performance profiling capabilities in the application, enhancing monitoring and analysis features.
…ance Updated the ActiveAdmin dashboard to enhance the retrieval of recent applications and payments. Improved code readability by breaking down complex queries into more manageable parts, including the use of includes for eager loading. This refactor aims to optimize performance and maintainability of the dashboard's data presentation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a robust system for recording and auditing payment gateway callbacks, including a new
PaymentGatewayCallbackmodel and associated admin interface, as well as a refactor of the payment receipt logic to improve reliability and traceability. It also adds database-level enforcement of uniqueness for payment transaction IDs, and includes some dependency and code quality improvements.Payment Gateway Callback Tracking and Admin Interface:
PaymentGatewayCallbackmodel and database table to record all payment gateway callback attempts, including their status, payload, and associations toPaymentandUser. This provides a full audit trail of gateway interactions. [1] [2]PaymentGatewayCallback, allowing admins to view, filter, and inspect callback records, and linked these callbacks to the payment admin view for easy cross-reference. [1] [2]Payment Handling Refactor and Hardening:
PaymentsController#payment_receiptaction to delegate all gateway receipt processing to a new service object,Payments::GatewayReceiptRecorder, which handles user resolution, duplicate detection, error handling, and callback recording in a consistent and testable way. [1] [2] [3] [4] [5] [6] [7]Database Integrity Improvements:
payments.transaction_idto ensure transaction IDs are unique at the database level, preventing race conditions and duplicate payments. [1] [2]Admin Dashboard and Query Optimizations:
Development and Code Quality Enhancements:
stackproffor profiling (required by Sentry), and includedrubocopandrubocop-railsfor code linting in development and test environments. [1] [2]These changes collectively improve the reliability, traceability, and maintainability of our payment processing and administration features.