Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Feature/marking payment as paid #270

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

boisvertmathieu
Copy link

🚀 Description

Added the "marking payment as paid" feature that was listed in the assets/FEATURES.md file. We can mark a payment as paid by calling the/payments/{PAYMENT_ID}/paid endpoint with a PATCH request. I modified the postman collection and added some test data to the data.sql file to be able to test the new feature.

📄 Motivation and Context

This change was listed as being a future feature that was going to be implemented.

🧪 How Has This Been Tested?

I added tests in the PaymentControllerTest.java class and in the PaymentSDJpaServiceTest.java class to cover the code I added. I checked the jacoco report, and my modifications are (normally) 100% covered. I did not add any integration tests in the integration-tests module.

I also added a request in the postman collection to test the change, while connecting to the h2 database on the /h2-console endpoint. After I executed the said request, I saw that the payment that I was trying to mark as paid got updated successfully.

📷 Screenshots (if appropriate)

📦 Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

✅ Checklist

  • My code follows the code style of this project(Do your best to follow code styles. If none apply just skip this).
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

- Updated the swagger contract to make marking payment as paid possible
- Added a bit of test data to the data.sql file
- Fixed the java version number in the Dockerfile since it was causing errors building the project
- Developed the paid payment feature
Copy link
Author

@boisvertmathieu boisvertmathieu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some changes are just code formatting, but I used the code styles you specified in the project's readme so everything should be indented correctly.

@@ -1384,6 +1407,9 @@ components:
type: number
dueDate:
type: string
paid:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing that could be done better here would be to add an allOf reference to a Payment schema for both the MemberPayment and AdminPayment schema here. Since there was already a Payment entity class in the code, I wasn't really sure what to name the new schema, so I decided to just add the new field in both object.

@@ -26,12 +26,14 @@
@Getter
@Setter
public class PaymentDto {
private Long id;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding this id here helps updating the payment entity in the PaymentSDJpaService

@@ -21,6 +21,4 @@

public interface PaymentRepository extends JpaRepository<Payment, Long> {
Optional<Payment> findByPaymentId(String paymentId);

void deleteByPaymentId(String paymentId);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method wasn't used.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant