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:19pm |
This pull request refactors the VNPay module for better readability and modularity. Key changes include moving URL creation and secure hash calculation to separate utility functions, enhancing existing utility functions with additional parameters, and adding new tests. The jest configuration was also updated to enforce a minimum of 80% line coverage.
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 src/utils/logger.ts |
Enhanced utility functions with additional parameters and improved functionality. |
The recent changes significantly enhance project configuration and utility functions, with a strong emphasis on code quality, maintainability, and testing. Key updates include the addition of coverage/
and .env
entries to ignore lists for linting, version control, and npm packaging. New utility functions for payment processing have been introduced, along with comprehensive unit tests for various modules, ensuring robust functionality and effective error handling throughout the application.
Files | Change Summary |
---|---|
.eslintignore , .gitignore , .npmignore , .prettierignore |
Added coverage/ and .env entries to ignore lists, optimizing linting and version control processes. |
jest.config.ts |
Introduced coverageThreshold to enforce a minimum coverage requirement of 80%. |
package.json |
Added script command "test:cov": "jest --coverage" for easier coverage testing. |
src/utils/common.ts |
Modified getDateInGMT7 to accept an optional date parameter; updated parseDate to include timezone support. |
src/utils/payment.util.ts , src/vnpay.ts |
Introduced new utility functions for payment URL construction and secure hash management; refactored payment handling to utilize these functions. |
test/utils/common.test.ts , test/utils/logger.test.ts , test/utils/payment-util.test.ts , test/verify-return-url.test.ts |
Established unit tests for utility functions and the verifyReturnUrl method in VNPay , ensuring correct functionality and error handling. |
.coderabbit.yaml |
Added tone_instructions field to guide feedback generation, enhancing customization capabilities. |
sequenceDiagram
participant User
participant VNPay
participant PaymentUtil
participant Logger
User->>VNPay: Initiates payment
VNPay->>PaymentUtil: Generates payment URL
PaymentUtil-->>VNPay: Returns payment URL
VNPay->>Logger: Logs payment initiation
Logger-->>VNPay: Confirms log
VNPay->>User: Returns payment link
sequenceDiagram
participant User
participant VNPay
participant PaymentUtil
participant Logger
User->>VNPay: Verifies return URL
VNPay->>PaymentUtil: Validates secure hash
PaymentUtil-->>VNPay: Returns validation result
VNPay->>Logger: Logs verification result
Logger-->>VNPay: Confirms log
VNPay->>User: Returns verification status
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, enhances date handling and logging utilities, and adds new tests to cover the changes.
Summary by CodeRabbit
New Features
Chores