Page MenuHomePhabricator

Improve expressiveness of Payment domain and reduce coupling
Open, Needs TriagePublic

Description

The payment classes suffer from the Anemic Domain Model problem - they are mostly value objects with no own behavior, with (de)serialization duplicated across donation and membership. Static analysis with PHPStan also highlights the problems (e.g. violations of the Liskov Substitution Principle.

Acceptance criteria:

  • Payment-related code from donation and membership domains is moved to the payment domain. Domain Events (use cases) include
    • Creating a payment
    • Receiving a payment notification from an external payment provider (Paypal and Micropayment), changing the payment state. These can be different use cases, as the business logic for both is quite different.
    • Canceling a payment. This is part of the "cancel donation" route and should only be possible for Direct Debit and Bank Transfer, other payments must be canceled via interaction with Fun OPs and that cancellation is not reflected in our database.
  • Payment Entities are stored in their own database tables. This includes having a PaymentRepository interface and an implementation and following the suggestions and constraints in T203679: Refactor fundraising database schema. The tasks for these changes can be broken down further. For backwards compatibility (with the FOC and the export scripts), the DonationRepository and MembershipRepository must still write the payment data into the donation/membership record tables. When reading records, the repositories should use the new PaymentRepository,
  • (Optional): Change donation export script and/or paypal export script to use the new tables.

Notes:

Event Timeline

Restricted Application added a project: WMDE-FUN-Team. · View Herald TranscriptApr 16 2018, 11:23 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
gabriel-wmde updated the task description. (Show Details)
gabriel-wmde renamed this task from Reduce technical debt of Payment domain model to Improve type safety and expressiveness of Payment domain model.Apr 17 2018, 11:00 AM
gabriel-wmde updated the task description. (Show Details)
This comment was removed by gabriel-wmde.
gabriel-wmde renamed this task from Improve type safety and expressiveness of Payment domain model to Improve expressiveness of Payment domain and reduce coupling .Apr 19 2018, 5:37 PM
gabriel-wmde added a project: Epic.
gabriel-wmde updated the task description. (Show Details)
gabriel-wmde updated the task description. (Show Details)Jan 14 2020, 9:34 AM
gabriel-wmde updated the task description. (Show Details)Jan 11 2021, 2:11 PM