Page MenuHomePhabricator

DonationInterface DonationData class: Total refactor (use new data item class)
Open, MediumPublic

Description

There is some evidence currently in the code, relating to a dream I had once, in the way we're currently trying (and failing) to handle order_id. This should be rolled in to the main strategy:

  • Each piece of data that DonationData keeps, should be an instance of a new data item class
  • The new class should keep track of all places that the data item can currently be pulled from ($_GET, $_POST, $_SESSION, passed to other class via constructor denoting some kind of batch mode, whatever else we do to squeeze any kind of data into the system), and what values existed in what valid source
  • DonationData should keep general default rules (the ones we have now, will do nicely) about what sources should win over other data sources, for each individual data item
  • DonationData should try to call back to specific gateway adapter classes for rule overrides on specific data items, or entire rulesets depending on context (batch mode vs user interaction vs return from gateway will have to be supported)
  • Not entirely sure if this is a true statement, but it's possible that an instantiated DonationData object should no longer be a member of the gateway at all, if we have a good mechanism for callbacks.

Event Timeline

K4-713 created this task.Jan 8 2015, 11:19 PM
K4-713 raised the priority of this task from to Medium.
K4-713 updated the task description. (Show Details)
K4-713 added a subscriber: K4-713.
Ejegg added a comment.Aug 19 2015, 4:13 PM

Would something like an InputSpec class be a good alternative to the rule override callbacks? For each field, it lists a name, type, validation rules, and a ranked list of search locations. The adapter would construct it based on payment method and stage of the donation process (so DonationData doesn't need to know context). Besides informing DonationData construction, the adapter could provide the spec to the form class, which would build inputs for everything that has POST as one of its search locations.