Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Rearchitecture #52

Open
3 of 7 tasks
blaggacao opened this issue Nov 4, 2023 · 0 comments · May be fixed by #53
Open
3 of 7 tasks

WIP: Rearchitecture #52

blaggacao opened this issue Nov 4, 2023 · 0 comments · May be fixed by #53

Comments

@blaggacao
Copy link
Collaborator

blaggacao commented Nov 4, 2023

Motivation

Having implemented PayZen, I have seen the stark inconsistencies and lack of structure in the codebase first hand.

It is clear that the code base has organically grown over time with little guidance.

In order to incentivize developers all over the world to implement and contribute more payment gateways, and thus, make ERPNext more useful to more businesses, some guidance and a shared mental model across payment gateways is in order.

Overview

This excalidraw link tries to identify the high level interaction between business logic (as implemented on the RefDoc [not necessarily Payment Request]) and the payment logic (as implemented on the Payment Gateway Controller).

It further tries to draw a distinction between two-step payments, i.e. mandates of some sort, and one step singular payments, i.e. charges. This fundamental distinction clarifies which state needs to be managed where and separates concerns into flow-related initiating and processing methods.

https://excalidraw.com/#json=VzKNVyFcXqBFqkTi0he20,8pftc53H3Gu9efjxYaM0WA

Further Work

  • Create a payment controller (think like ERPNext's TransactionController) which implements this framing integration flow
  • Document flow variants in sequence diagrams
  • Write some integrator documentation
  • (Re-)Implement PayZen using this new controller
    • Implement unified ./checkout?ref=<tx ref>
    • Implement live checkout page updates rather than redirects for success/failure messages
  • "Monkey-patch-comply" current gateways to that controller (without compromising the controller)

Further in the future

  • Introduce functional changes to the existing controllers and where necessary breaking changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant