mirror of
https://github.com/hanzo-fi/payments.git
synced 2026-10-30 20:31:20 +00:00
* feat: Add payout capability to generic connector
- Add CAPABILITY_CREATE_PAYOUT to generic connector capabilities
- Extend OpenAPI schema with payout endpoints (POST /payouts, GET /payouts/{id})
- Implement payout client interface and methods (CreatePayout, GetPayoutStatus)
- Add plugin payout methods (CreatePayout, ReversePayout, PollPayoutStatus)
- Add comprehensive payout tests and validation
- Update existing tests to reflect payout functionality availability
- Support decimal amount parsing for API compatibility
This enables the generic connector to handle payout operations,
making it a more complete payment service provider connector.
* feat(payment): enhance payment initiation with scheduledAt handling
- Update payment initiation creation to set scheduledAt to the current time if not provided.
- Refactor CreatedAt and ScheduledAt assignments for consistency.
- Improve payout tests by integrating mock client for CreatePayout and GetPayoutStatus methods.
- Replace previous mock responses with actual API call implementations in the payout client.
These changes improve the handling of payment initiation timestamps and enhance the testing framework for payout operations.
* fix(tests): add missing newline at end of payouts_test.go file
- Ensure proper formatting by adding a newline at the end of the payouts_test.go file.
- This change improves code consistency and adheres to common coding standards.
* feat(payout): implement PollingPayoutID support in CreatePayout and PollPayoutStatus
- Enhance CreatePayout to return PollingPayoutID when the payment status is PENDING, allowing for scheduled polling of payout status.
- Update PollPayoutStatus to return nil Payment when the status is still PENDING, indicating that polling should continue.
- Add tests to verify the new behavior for both pending and succeeded payout statuses.
These changes improve the handling of payout operations and ensure better tracking of payment statuses during processing.
* feat(connector): add transfer and bank account capabilities to generic connector
- Introduce capabilities for creating transfers and bank accounts in the generic connector.
- Implement CreateTransfer and CreateBankAccount methods in the plugin, along with their respective status polling.
- Update OpenAPI schema to include endpoints for transfers and bank accounts, enhancing API documentation.
- Add mock client methods for CreateTransfer and CreateBankAccount to facilitate testing.
These enhancements expand the functionality of the generic connector, allowing for more comprehensive payment operations.
* fix(connector): correct transfer naming and add bank account creation functionality
- Rename "PluginCreateTransfert" to "PluginCreateTransfer" for consistency.
- Introduce createBankAccount and related validation methods in the generic connector.
- Implement client methods for creating bank accounts and handling responses.
These changes enhance the generic connector's capabilities for managing bank accounts and ensure proper naming conventions.
* refactor(tests): update error messages and test descriptions for plugin methods
- Change test descriptions to clarify failure reasons when methods are called before installation.
- Update error expectations to reflect the new error handling for unimplemented features.
- Enhance the reverse transfer test to provide a more specific error message for unsupported operations.
These changes improve the clarity and accuracy of the test cases for the generic plugin functionality.
* chore: regenerate mock with latest mockgen
* test(generic): add comprehensive tests for transfers, bank accounts, and payouts
- Add transfers_test.go with tests for createTransfer, pollTransferStatus, validation
- Add bank_account_creation_test.go with tests for createBankAccount, validation
- Expand payouts_test.go with FAILED status, client error, and helper function tests
- Coverage improved from 24% to 90%
* test(generic): add forward flow test for bank account creation
- Add TestCreateBankAccount_Plugin_NotInstalled for error case
- Add TestCreateBankAccount_Plugin_ForwardFlow for full forward flow simulation
- Tests the plugin's CreateBankAccount method that gets called by the activity
* test(generic): enhance unit tests for generic plugin payments
- Add new unit tests for payment type and status matching functions to improve coverage.
- Implement tests for filling payments with various scenarios, including related transaction IDs and invalid amounts.
- Introduce tests for fetching next payments and handling invalid states, ensuring robust error handling.
- Update the Codecov configuration to ignore additional generated client files.
These changes significantly enhance the test coverage and reliability of the generic plugin's payment functionalities.
* refactor(tests): update deferred function calls in tests and client methods
- Replace direct calls to Close() with deferred anonymous functions to handle errors gracefully in bank accounts, payouts, and transfers.
- Update test cases to ensure proper resource management and error handling during HTTP response processing.
These changes enhance the robustness of the code by ensuring that resources are closed properly without ignoring potential errors.
* Test and quality improvements
* refactor(tests): remove unused errorReader type from TestCreatePayout_ReadBodyError
- Eliminate the errorReader struct and its methods as they are no longer needed for the test case.
- This cleanup improves code readability and maintains focus on relevant test logic.
* feat(validation): enhance asset validation to support UMN format
- Introduced a new function `isValidAssetUMN` to validate assets in the UMN format, allowing for both currency codes and optional precision (e.g., "USD/2", "BTC/8"). Specifc Plugins can limit themselves to ISO4217 - there should not be a limit on a global level
- Updated existing tests to reflect the new validation rules, ensuring comprehensive coverage for various asset formats.
- Adjusted payment and payout handling to accept and process assets in the UMN format, improving compatibility with external systems.
* feat(payments): expand payment status handling and documentation
- Added support for additional payment statuses including CANCELLED, EXPIRED, REFUNDED, and DISPUTE-related statuses in the payment processing logic.
- Updated the TransactionStatus enum and its documentation to reflect the new statuses, ensuring comprehensive coverage of all Formance payment statuses.
- Enhanced unit tests to validate the new payment statuses, improving overall test coverage and reliability.
* fix(activity): correct spelling of "PluginCreateTransfer" to "PluginCreateTransfert"
- Updated the name of the transfer plugin in the activities definition set to fix a spelling error.
- Enhanced unit tests to cover network error scenarios for payout, transfer, and bank account creation, ensuring robust error handling and response validation.
- Added tests for reading response errors to improve overall test coverage and reliability.
* rollback unnecesary change
* feat(payments): enhance payment type handling and documentation
- Added support for new payment types: REFUND, CHARGEBACK, and OTHER in the payment processing logic.
- Updated the matchPaymentType function to correctly categorize these new types.
- Enhanced unit tests to cover the new payment types and their expected behaviors, improving overall test coverage and reliability.
- Updated OpenAPI documentation to reflect the new transaction types and their descriptions, ensuring clarity for API users.
* feat(payments): add PROCESSED status and update documentation
- Introduced a new payment status, PROCESSED, to enhance the payment status handling.
- Updated the TransactionStatus enum and OpenAPI documentation to include the new PROCESSED status, ensuring comprehensive coverage of payment states.
- Enhanced logging in the payment fetching process to provide more detailed information about the fetched payments.
* fix(validation): streamline asset validation logic and update tests
- Refactored the asset validation function to simplify the handling of UMN formats, ensuring it correctly validates both currency codes and optional precision.
- Removed outdated comments for clarity and improved code readability.
- Updated unit tests to reflect the refined validation logic, enhancing overall test coverage and reliability.
* feat(payments): add PROCESSING status to payment handling and documentation
- Introduced a new payment status, PROCESSING, to enhance the payment status handling.
- Updated relevant documentation to include the new PROCESSING status, ensuring comprehensive coverage of payment states.
- Modified the PaymentStatus and V3PaymentStatusEnum types to incorporate the new status, improving clarity in the codebase.
* Removed the fact that an payout to an account that looks like a UUID would request a bank account mapping.
* feat(generic): allow lower polling periods for generic connector
- Introduced a constant for the minimum polling period specific to the generic connector, enabling lower polling intervals for development and testing purposes.
- Updated the configuration unmarshalling logic to utilize this new minimum, ensuring that the actual minimum is enforced by the connector manager.
* refactor(payments): remove PROCESSING status from payment handling
- Eliminated the PROCESSING status from the payment status handling logic and documentation.
- Updated relevant tests and validation logic to reflect this change, ensuring consistency across the codebase.
- Adjusted OpenAPI documentation to remove references to the PROCESSING status, maintaining clarity for API users.
* chore(connector-capabilities): update connector capabilities JSON structure
- Reformatted the connector capabilities JSON file to ensure proper structure and readability.
- Ensured consistency in the representation of capabilities across different connectors.
- Added a newline at the end of the file to adhere to standard file formatting practices.
* refactor(generic): remove bank account creation and update transaction statuses
- Removed references to bank account creation from the API documentation and README files.
- Updated transaction status descriptions to reflect the removal of the PROCESSING status and added CANCELLED as a valid state.
- Enhanced clarity in the documentation for payout and transfer response models by specifying required fields.
* refactor(generic): standardize account ID field naming conventions
- Updated field names from `SourceAccountId` and `DestinationAccountId` to `SourceAccountID` and `DestinationAccountID` across multiple files for consistency.
- Ensured that all relevant tests and request/response models reflect these changes, enhancing clarity and uniformity in the codebase.
* refactor(generic): update error handling in reverse transfer and payout tests
- Changed test descriptions from "not supported" to "not implemented" for clarity.
- Updated error expectations to match the new error handling logic, ensuring consistency in test assertions for reverse transfer and payout functionalities.
* refactor(workflow): improve error handling for storage not found scenarios
This is needed because the structure of some Generic Connector beneficiry accounts 'looks like' having bank accounts but don't - so the assumption that any UUID benificiary has a bank account is wrong
- Introduced a new utility function, isStorageNotFoundError, to streamline error checking for storage "not found" errors.
- Updated the fillFormanceBankAccount function to utilize the new error handling logic, enhancing clarity and consistency in error management across workflows.
---------
Co-authored-by: Cursor Agent <[email protected]>