frappe / webshop

Open Source eCommerce Platform
GNU General Public License v3.0
92 stars 98 forks source link

Payment Requests with Zero Value on Repeated Payment Attempts #158

Open SmoothPlay opened 2 months ago

SmoothPlay commented 2 months ago

Description: When a customer initiates a payment through the Frappe Payments app integrated with GoCardless, everything functions correctly on the first attempt. The customer is redirected to the GoCardless payment page, and the correct amount is shown for payment.

However, if the customer navigates away from the GoCardless payment page and then clicks the Pay button again, a new Payment Request is created with a value of 0.00. This results in two different payment requests: one with the correct value and another with a value of 0.00. The Sales Order is left in the "To Pay" state.

Steps to Reproduce:

Create a Sales Order in the Frappe Payments app. Click the Pay button to initiate payment through GoCardless. On the GoCardless payment page, navigate away or close the page. Return to the Frappe Payments app and click the Pay button again.

Expected Behavior:

If the customer clicks the Pay button again, the existing Payment Request should be used, or a new Payment Request should be created with the correct value from the Sales Order.

Actual Behavior:

A new Payment Request is created with a value of 0.00, resulting in two Payment Requests: one with the correct value and another with 0.00.

Environment:

Payments app version: Latest (dev) Webshop: Latest (dev) Erpnext: v16.0.0-dev Frappe: v16.0.0-dev Browser: Brave Browser

Possible Fixes:

Ensure that the value from the Sales Order is correctly fetched and applied to any new Payment Request. Check if an existing Payment Request can be reused instead of creating a new one. Additional Context:

This issue disrupts the payment process and could lead to customer confusion and failed payments.

SmoothPlay commented 2 months ago

As a side note, I wonder... shouldn't the Sales Order be always "To Pay" from the beginning until the costumer pays?

The current behavior is that when the sales order is generated it starts as " To Deliver and Bill ". Which should only happen after the client pays I guess.