Page MenuHomePhabricator

Move any remaining controller logic out of the form classes
Closed, ResolvedPublic4 Story Points

Description

The form classes should not contain any controller logic. Move that into the adapter, or even better, into a new controller class. Figure out how to wrap responses like redirect-iframe.

Thinking out loud:

GatewayPage

  • Controller for UI.
  • Any reason not to pull in the resultswitcher logic?
  • handleRequest
    • Reads from POST and SESSION
    • Performs UI side-effects.

GatewayAdapter

  • Should have processing-specific controller logic, the sequence of API calls to make.
  • initiatePayment
    • Call validation here?
    • Returns PaymentResponse object.

PaymentResponse

Encapsulate and decouple adapter initiatePayment response, can be mapped directly to a UI action to present to the donor.

  • recoverableError -> Refresh form, optionally displaying validation errors.
  • gatewayInteractionRequired -> Redirect to gateway, with GET params.
  • gatewayIframeRequired -> IFrame would ideally be handled by template engine simply refreshing and iframeUrl toggles conditional display.
  • unrecoverableError -> redirect to failure page, for example after a credit card transaction was declined.
  • success -> redirect to Thank You page

Notes

K4-713 reminds us to not short-circuit the orphan slayer, which relies on an existing mechanism to capture success status, etc.

Implementation

Documentation

http://www.mediawiki.org/wiki/Extension:DonationInterface#GatewayForm

Event Timeline

awight created this task.Jan 8 2015, 10:21 PM
awight raised the priority of this task from to Needs Triage.
awight updated the task description. (Show Details)
awight moved this task to DI Refactor on the Fundraising-Backlog-Old board.
awight added a subscriber: awight.
atgo set Security to None.Jan 14 2015, 11:54 PM
atgo triaged this task as Normal priority.Jan 15 2015, 12:15 AM
atgo added a subscriber: atgo.

@awight estimate this please

atgo edited a custom field.Jan 16 2015, 7:56 PM
awight renamed this task from Move any remaining controller-type logic out of the form classes to Move any remaining controller logic out of the form classes.Jan 16 2015, 8:51 PM
awight updated the task description. (Show Details)
awight added subscribers: Ejegg, K4-713.
awight updated the task description. (Show Details)Jan 16 2015, 9:01 PM
awight updated the task description. (Show Details)Jan 17 2015, 1:34 AM
atgo assigned this task to awight.Jan 29 2015, 12:46 AM
awight updated the task description. (Show Details)Feb 4 2015, 10:31 PM
awight edited a custom field.Feb 5 2015, 8:05 AM
gerritbot added a subscriber: gerritbot.

Change 189133 had a related patch set uploaded (by Awight):
Consolidate GatewayPage logic in the base class

https://gerrit.wikimedia.org/r/189133

Patch-For-Review

Change 189136 had a related patch set uploaded (by Awight):
Use common code for Adyen form handling

https://gerrit.wikimedia.org/r/189136

Patch-For-Review

Change 189139 had a related patch set uploaded (by Awight):
WIP more controller logic consolidation

https://gerrit.wikimedia.org/r/189139

Patch-For-Review

Change 189153 had a related patch set uploaded (by Awight):
Move remaining controller logic into GatewayAdapter::doPayment()

https://gerrit.wikimedia.org/r/189153

Patch-For-Review

Oops... I still need to refactor the resultswitcher pages, but it's less urgent, cos these will not be using the universal form.

awight updated the task description. (Show Details)Feb 23 2015, 10:26 PM
awight added a project: Wikimedia-Fundraising.

Change 189133 merged by jenkins-bot:
Consolidate GatewayPage logic in the base class

https://gerrit.wikimedia.org/r/189133

Change 189139 abandoned by Awight:
WIP more controller logic consolidation

Reason:
I think this was accomplished in an updated changeset.

https://gerrit.wikimedia.org/r/189139

Change 189153 merged by jenkins-bot:
Move remaining controller logic into GatewayAdapter::doPayment()

https://gerrit.wikimedia.org/r/189153

Change 189136 merged by jenkins-bot:
Use common code for Adyen form handling

https://gerrit.wikimedia.org/r/189136

awight closed this task as Resolved.Mar 12 2015, 9:31 PM
mmodell removed a subscriber: awight.Jun 22 2017, 9:52 PM