-
Notifications
You must be signed in to change notification settings - Fork 106
Feature/marking payment as paid #270
base: master
Are you sure you want to change the base?
Feature/marking payment as paid #270
Conversation
- 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
There was a problem hiding this 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: |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
🚀 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 aPATCH
request. I modified the postman collection and added some test data to thedata.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 thePaymentSDJpaServiceTest.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
✅ Checklist