Skip to content

fix(accounts): allow customers to pay their portal documents (v16) - #64260

Merged
mergify[bot] merged 2 commits into
frappe:version-16-hotfixfrom
aerele:fix/v16-portal-customer-payments
Nov 10, 2026
Merged

mergify[bot] merged 2 commits into
frappe:version-16-hotfixfrom
aerele:fix/v16-portal-customer-payments

Conversation

@Pandiyan5273

@Pandiyan5273 Pandiyan5273 commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Issue

Steps to replicate

  • Install Payments, configure a gateway account, and link a website user with the Customer role to a customer.
  • Submit an unpaid Sales Order or Sales Invoice for that customer, without granting the website user Desk Payment Request creation permission.
  • Sign in as that user and submit a CSRF-protected POST to make_payment_request with the document name/type, order_type=Shopping Cart, and submit_doc=1.

Actual behavior

  • The customer's own submitted document is rejected with a Payment Request creation PermissionError; the standard ERPNext portal also hides its Pay button.

Expected behavior

  • Linked customers can pay their own submitted, payable Sales Orders and Sales Invoices without additional Desk permissions.
  • Other customers' documents, drafts, cancelled documents, purchases, and Guest requests remain denied; staff-created draft requests and staff permission checks remain protected.

Fix

  • Authorize the customer against the saved document's website ownership, derive payment details from that document, and scope internal payment creation/submission and retries to that authorized path.
  • Align portal Pay visibility with this authorization and reuse internal account/subscription resolution while preserving the public methods' permission checks.

Validation

  • The customer regression fails before the fix. All 42 Payment Request tests and 5 order-page tests pass, as does the regression with Webshop installed. Repository hooks pass.
  • With the companion Webshop patch, actual rendered-form/handler flows pass for an order of 1,000 and an invoice with 600 remaining, including CSRF validation, retry, staff-draft protection, payment/invoice creation, balanced GL, zero invoice payment-ledger balance, and normal cancellation.
  • Validated on ERPNext v16 a28009aca7 / Frappe fcb38c6fd4. External gateway controller, payment URL, and email were mocked; no browser, real-gateway, loyalty-redemption, or anonymous-callback tests ran.

Backport needed

Companion PRs

@mergify

mergify Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Queue requested — the merge queue status continues in this comment ↓.

@mergify

mergify Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

❌ Left the queue · Python Unit Tests (3) fails with this pull request

30 min in the queue, 19 min of it CI.

So far

The failure is in this pull request. It failed tested alone on top of version-16-hotfix.

Reason

The merge conditions cannot be satisfied due to failing checks

  • Python Unit Tests (3)

Failing checks:

To get back in the queue

  • Push a fix: the pull request is queued again once its queue conditions match.
  • If the failure is a flake, tick the box below to queue it again as it is.

Merge conditions not met when it left the queue

  • any of:
    • -files~=^(?!erpnext/locale/main\.pot$)
    • all of:
      • check-success=Python Unit Tests (1)
      • check-success=Python Unit Tests (3)
      • check-success=Patch Test
      • check-success=Python Unit Tests (2)
      • check-success=Python Unit Tests (4)

Requeue requested — the merge queue status continues in this comment ↓.

2 merge conditions met
  • #review-threads-unresolved = 0 · required by GitHub branch protection
  • github-review-approved · required by GitHub branch protection

Times in UTC · dashboard · how the merge queue works

@mergify mergify Bot added the queued label Nov 8, 2026
@mergify mergify Bot added dequeued and removed queued labels Nov 8, 2026
@Pandiyan5273
Pandiyan5273 force-pushed the fix/v16-portal-customer-payments branch from 1a9f6d6 to cd76284 Compare November 10, 2026 07:05
@mergify mergify Bot removed the dequeued label Nov 10, 2026
@Pandiyan5273

Copy link
Copy Markdown
Member Author

@Mergifyio queue

@mergify

mergify Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

✅ Merged into version-16-hotfix as 8bb8244 at 07:55 UTC

Merged together with #64627, #64573. 36 min in the queue, 27 min of it CI.

So far

3 merge conditions met
  • #review-threads-unresolved = 0 · required by GitHub branch protection
  • github-review-approved · required by GitHub branch protection
  • any of:
    • all of:
      • check-success=Patch Test
      • check-success=Python Unit Tests (1)
      • check-success=Python Unit Tests (2)
      • check-success=Python Unit Tests (3)
      • check-success=Python Unit Tests (4)
    • -files~=^(?!erpnext/locale/main\.pot$)

Times in UTC · dashboard · how the merge queue works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants