- Implemented Flutterwave service in payment providers factory.
- Added specs for Flutterwave service in payment provider customers.
- Enhanced create customer factory spec to include Flutterwave provider.
- Updated handle event service spec to handle Flutterwave events.
- Created charge completed service spec for Flutterwave webhooks.
- Developed Flutterwave service specs for payment processing.
- Added payment requests service spec for Flutterwave integration.
- Updated payment providers factory spec to include Flutterwave.
User description
This pull request introduces significant updates to the Flutterwave integration, including refactoring webhook handling, improving error logging, and enhancing payment processing logic. Additionally, it modifies configurations, updates factories, and adds comprehensive test coverage for Flutterwave-related functionality.
Flutterwave Integration Enhancements:
Refactored Webhook Handling:
signaturewithsecretin webhook handling logic to improve clarity and consistency. (app/controllers/webhooks_controller.rb- [1]app/services/payment_providers/flutterwave/handle_incoming_webhook_service.rb- [2]app/services/payment_providers/flutterwave/handle_incoming_webhook_service.rb- app/services/payment_providers/flutterwave/handle_incoming_webhook_service.rbL7-R42)Improved Payment Processing Logic:
payable_typeand implementedfind_payablemethod to locate associated invoices or payment requests. (app/services/payment_providers/flutterwave/webhooks/charge_completed_service.rb- app/services/payment_providers/flutterwave/webhooks/charge_completed_service.rbR78-R86)app/services/payment_providers/flutterwave/webhooks/charge_completed_service.rb- app/services/payment_providers/flutterwave/webhooks/charge_completed_service.rbR130)Error Logging and Resilience:
app/services/payment_providers/flutterwave/handle_event_service.rb- app/services/payment_providers/flutterwave/handle_event_service.rbR23-R27)Configuration and Factory Updates:
Database Configuration Changes:
config/database.yml- config/database.ymlL7-R25)Factory Enhancements:
flutterwave_customerfactory to streamline testing of Flutterwave-specific functionality. (spec/factories/payment_provider_customers.rb- spec/factories/payment_provider_customers.rbR37-R43)Test Coverage Additions:
Unit Tests for Flutterwave Event Handling:
HandleEventJobto ensure proper service invocation and queue configuration. (spec/jobs/payment_providers/flutterwave/handle_event_job_spec.rb- spec/jobs/payment_providers/flutterwave/handle_event_job_spec.rbR1-R42)Integration Tests for Webhook Controller:
spec/requests/webhooks_controller_spec.rb- spec/requests/webhooks_controller_spec.rbR330-R441)PR Type
Enhancement, Tests
Description
• Add comprehensive Flutterwave payment provider integration
• Refactor webhook handling to use 'secret' instead of 'signature'
• Enhance payment processing with payable type validation
• Add extensive test coverage for all Flutterwave services
Changes walkthrough 📝
3 files
Update webhook parameter from signature to secretRename signature to secret and improve error messagesAdd payable type validation and find_payable method2 files
Refactor throttling error handling logicRemove unused private method and clean formatting2 files
Fix amount calculation using Money gemFix amount calculation and error code handling1 files
Add error handling for event processing13 files
Add flutterwave_customer factory definitionAdd comprehensive job testing with queue configurationAdd Flutterwave webhook endpoint testingAdd complete invoice payment service testingAdd Flutterwave provider to factory testsAdd customer service testing for FlutterwaveAdd Flutterwave provider to customer factory testsAdd event handling service testing with error scenariosUpdate webhook service tests for secret parameterAdd comprehensive webhook charge completion testingAdd provider service testing with CRUD operationsAdd payment request service testingAdd Flutterwave to payment request factory tests1 files
Remove httparty dependency1 files
Update database configuration for development