Closed lehuygiang28 closed 2 months ago
The latest updates on your projects. Learn more about Vercel for Git βοΈ
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
vnpay | β Ready (Inspect) | Visit Preview | π¬ Add feedback | Jul 20, 2024 8:43pm |
This pull request refactors the VNPay module for improved readability and maintainability. Key changes include modularizing the payment URL creation and secure hash calculation into separate utility functions, enhancing date handling functions, and updating tests accordingly. Additionally, the jest configuration was updated to set the timezone to UTC and enforce a minimum coverage threshold. The console logger was also enhanced to support different console methods.
Files | Changes |
---|---|
src/vnpay.ts src/utils/payment.util.ts |
Refactored payment URL creation and secure hash calculation into separate utility functions for better modularity and readability. |
src/utils/common.ts test/build-payment-url.test.ts |
Enhanced date handling functions and updated tests to use the new date utility functions. |
The recent changes enhance the configuration and functionality of the project, introducing improvements in feedback tone guidance, file ignoring during linting and publishing processes, and significant updates to payment handling utilities. Notable additions include a clear professional tone in feedback, new utility functions for payment processing, and comprehensive testing for these functionalities, all aimed at improving code quality and maintainability.
File(s) | Change Summary |
---|---|
.coderabbit.yaml |
Added tone_instructions for clearer, more professional feedback. |
.eslintignore , .npmignore |
Added coverage/ directory to ignore lists, optimizing linting and package size. |
.gitignore |
Changed .env from ignored to tracked; added coverage/ to ignore list. |
jest.config.ts |
Set timezone to UTC and added coverageThreshold for minimum test coverage of 80%. |
package.json |
Introduced "test:cov" script to run tests with coverage reporting enabled. |
src/utils/common.ts |
Enhanced getDateInGMT7 and parseDate functions for better timezone support. |
src/utils/index.ts |
Added export for payment.util functions, improving modularity. |
src/utils/logger.ts |
Updated consoleLogger to accept a log method parameter, enhancing flexibility in logging output. |
src/utils/payment.util.ts |
Introduced utilities for payment URL construction and secure hash calculations for transaction integrity. |
src/vnpay.ts |
Refactored payment processing logic to utilize new utility functions and improved date handling. |
test/... (various) |
Added comprehensive tests for date handling, logging utilities, and payment functions, ensuring correctness and reliability across functionalities. |
sequenceDiagram
participant User
participant PaymentProcessor
participant PaymentUtil
participant Logger
User->>PaymentProcessor: Initiate Payment
PaymentProcessor->>PaymentUtil: Build Payment URL
PaymentUtil-->>PaymentProcessor: Return Payment URL
PaymentProcessor->>Logger: Log Payment Initiation
Logger-->>PaymentProcessor: Acknowledge Log
PaymentProcessor->>User: Confirm Payment Processing
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
@coderabbitai review
Summary by Sourcery
This pull request refactors the VNPay class for better readability and maintainability, introduces new utility functions for date handling and secure hash calculation, and updates the logging functionality. It also includes updates to tests and configuration files.
getDateInGMT7
and updatingparseDate
to support different time zones.consoleLogger
to specify the console method to use.payment.util.ts
.getDateInGMT7
function for consistent date handling..coderabbit.yaml
configuration to include tone instructions for feedback.Summary by CodeRabbit
New Features
Bug Fixes
Tests