pierre / killbill-deposit-ui

Kill Bill UI for the deposit plugin
https://killbill.io
MIT License
0 stars 0 forks source link

Sweep: pre-populate a 0 amount for all invoice payment lines #1

Open pierre opened 1 year ago

pierre commented 1 year ago

For all line items on the form https://github.com/killbill/killbill-deposit-ui/blob/main/app/views/deposit/collection/_invoices_table.html.erb:

Write a Rails view test using mock invoices and mock payments to verify the above.

sweep-ai[bot] commented 1 year ago

Here's the PR! https://github.com/pierre/killbill-deposit-ui/pull/3.

⚡ Sweep Free Trial: I used GPT-4 to create this ticket. You have 5 GPT-4 tickets left. For more GPT-4 tickets, visit our payment portal.To get Sweep to recreate this ticket, leave a comment prefixed with "sweep:" or edit the issue.


Step 1: 🔍 Code Search

I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.

Some code snippets I looked at (click to expand). If some file is missing from here, you can mention the path in the ticket description. https://github.com/pierre/killbill-deposit-ui/blob/185ba6abb88f3a239a25bea0c0004d423371fbc4/lib/deposit/client.rb#L1-L47 https://github.com/pierre/killbill-deposit-ui/blob/185ba6abb88f3a239a25bea0c0004d423371fbc4/app/views/deposit/collection/_payment_form.html.erb#L1-L53 https://github.com/pierre/killbill-deposit-ui/blob/185ba6abb88f3a239a25bea0c0004d423371fbc4/app/views/deposit/collection/_invoices_table.html.erb#L1-L68 https://github.com/pierre/killbill-deposit-ui/blob/185ba6abb88f3a239a25bea0c0004d423371fbc4/app/controllers/deposit/collection_controller.rb#L1-L149 https://github.com/pierre/killbill-deposit-ui/blob/185ba6abb88f3a239a25bea0c0004d423371fbc4/README.md#L1-L50

I also found the following external resources that might be helpful:

Summaries of links found in the content:

https://github.com/killbill/killbill-deposit-ui/blob/main/app/views/deposit/collection/_invoices_table.html.erb:

The given page does not contain any content or code snippets.


Step 2: 🧐 Snippet Analysis

From looking through the relevant snippets, I decided to make the following modifications:

File Path Proposed Changes
app/views/deposit/collection/_invoices_table.html.erb In the DataTables initialization code, set the default value of the payment amount input field to 0. Add a condition to check if the invoice balance is 0, and if so, disable the corresponding payment amount input field.
test/integration/navigation_test.rb Add a new test case to verify the changes in the view. Use mock invoices and mock payments to check if the payment amount field is auto-populated with 0 and is disabled when the invoice balance is 0.

Step 3: 📝 Planning

I have created a plan for writing the pull request. I am now working my plan and coding the required changes to address this issue. Here is the planned pull request:

Pre-populate a 0 amount for all invoice payment lines sweep/pre-populate-0-amount

Description

This PR addresses the issue #1 by modifying the _invoices_table.html.erb view. The changes include setting the default value of the payment amount input field to 0 and disabling it if the invoice balance is 0. Additionally, a new Rails view test is added to verify these changes using mock invoices and mock payments.

Summary of Changes

  • Modified app/views/deposit/collection/_invoices_table.html.erb to set the default value of the payment amount input field to 0 and disable it if the invoice balance is 0.
  • Added a new test case in test/integration/navigation_test.rb to verify the changes in the view. The test uses mock invoices and mock payments to check if the payment amount field is auto-populated with 0 and is disabled when the invoice balance is 0.

Step 4: ⌨️ Coding

I have finished coding the issue. I am now reviewing it for completeness.


Step 5: 🔁 Code Review

Success! 🚀


To recreate the pull request, leave a comment prefixed with "sweep:" or edit the issue. Join Our Discord