3 final class PhortuneProviderActionController
4 extends PhortuneController
{
8 public function setAction($action) {
9 $this->action
= $action;
13 public function getAction() {
17 public function handleRequest(AphrontRequest
$request) {
18 $viewer = $request->getViewer();
19 $id = $request->getURIData('id');
20 $this->setAction($request->getURIData('action'));
22 $provider_config = id(new PhortunePaymentProviderConfigQuery())
26 if (!$provider_config) {
27 return new Aphront404Response();
30 $provider = $provider_config->buildProvider();
32 if (!$provider->canRespondToControllerAction($this->getAction())) {
33 return new Aphront404Response();
36 $response = $provider->processControllerRequest($this, $request);
38 if ($response instanceof AphrontResponse
) {
42 $title = pht('Phortune');
44 return $this->newPage()
46 ->appendChild($response);
51 public function loadCart($id) {
52 $request = $this->getRequest();
53 $viewer = $request->getUser();
55 return id(new PhortuneCartQuery())
59 ->requireCapabilities(
61 PhabricatorPolicyCapability
::CAN_VIEW
,
62 PhabricatorPolicyCapability
::CAN_EDIT
,
67 public function loadActiveCharge(PhortuneCart
$cart) {
68 $request = $this->getRequest();
69 $viewer = $request->getUser();
71 return id(new PhortuneChargeQuery())
73 ->withCartPHIDs(array($cart->getPHID()))
76 PhortuneCharge
::STATUS_CHARGING
,