@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Update Phortune for handleRequest

Summary: Updates Phortune controllers for handleRequest

Test Plan: New Invoice, new merchant, new subscriptions, manual bill, pay bill, anything I could find to test.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T8628

Differential Revision: https://secure.phabricator.com/D13768

+104 -215
+5 -11
src/applications/phortune/controller/PhortuneAccountEditController.php
··· 2 2 3 3 final class PhortuneAccountEditController extends PhortuneController { 4 4 5 - private $id; 6 - 7 - public function willProcessRequest(array $data) { 8 - $this->id = idx($data, 'id'); 9 - } 10 - 11 - public function processRequest() { 12 - $request = $this->getRequest(); 13 - $viewer = $request->getUser(); 5 + public function handleRequest(AphrontRequest $request) { 6 + $viewer = $request->getViewer(); 7 + $id = $request->getURIData('id'); 14 8 15 - if ($this->id) { 9 + if ($id) { 16 10 $account = id(new PhortuneAccountQuery()) 17 11 ->setViewer($viewer) 18 - ->withIDs(array($this->id)) 12 + ->withIDs(array($id)) 19 13 ->requireCapabilities( 20 14 array( 21 15 PhabricatorPolicyCapability::CAN_VIEW,
+2 -3
src/applications/phortune/controller/PhortuneAccountListController.php
··· 2 2 3 3 final class PhortuneAccountListController extends PhortuneController { 4 4 5 - public function processRequest() { 6 - $request = $this->getRequest(); 7 - $viewer = $request->getUser(); 5 + public function handleRequest(AphrontRequest $request) { 6 + $viewer = $request->getViewer(); 8 7 9 8 $accounts = id(new PhortuneAccountQuery()) 10 9 ->setViewer($viewer)
+4 -10
src/applications/phortune/controller/PhortuneCartAcceptController.php
··· 3 3 final class PhortuneCartAcceptController 4 4 extends PhortuneCartController { 5 5 6 - private $id; 7 - 8 - public function willProcessRequest(array $data) { 9 - $this->id = $data['id']; 10 - } 11 - 12 - public function processRequest() { 13 - $request = $this->getRequest(); 14 - $viewer = $request->getUser(); 6 + public function handleRequest(AphrontRequest $request) { 7 + $viewer = $request->getViewer(); 8 + $id = $request->getURIData('id'); 15 9 16 10 // You must control the merchant to accept orders. 17 11 $authority = $this->loadMerchantAuthority(); ··· 21 15 22 16 $cart = id(new PhortuneCartQuery()) 23 17 ->setViewer($viewer) 24 - ->withIDs(array($this->id)) 18 + ->withIDs(array($id)) 25 19 ->withMerchantPHIDs(array($authority->getPHID())) 26 20 ->needPurchases(true) 27 21 ->executeOne();
+6 -13
src/applications/phortune/controller/PhortuneCartCancelController.php
··· 3 3 final class PhortuneCartCancelController 4 4 extends PhortuneCartController { 5 5 6 - private $id; 7 - private $action; 8 - 9 - public function willProcessRequest(array $data) { 10 - $this->id = $data['id']; 11 - $this->action = $data['action']; 12 - } 13 - 14 - public function processRequest() { 15 - $request = $this->getRequest(); 16 - $viewer = $request->getUser(); 6 + public function handleRequest(AphrontRequest $request) { 7 + $viewer = $request->getViewer(); 8 + $id = $request->getURIData('id'); 9 + $action = $request->getURIData('action'); 17 10 18 11 $authority = $this->loadMerchantAuthority(); 19 12 20 13 $cart_query = id(new PhortuneCartQuery()) 21 14 ->setViewer($viewer) 22 - ->withIDs(array($this->id)) 15 + ->withIDs(array($id)) 23 16 ->needPurchases(true); 24 17 25 18 if ($authority) { ··· 31 24 return new Aphront404Response(); 32 25 } 33 26 34 - switch ($this->action) { 27 + switch ($action) { 35 28 case 'cancel': 36 29 // You must be able to edit the account to cancel an order. 37 30 PhabricatorPolicyFilter::requireCapability(
+4 -10
src/applications/phortune/controller/PhortuneCartCheckoutController.php
··· 3 3 final class PhortuneCartCheckoutController 4 4 extends PhortuneCartController { 5 5 6 - private $id; 7 - 8 - public function willProcessRequest(array $data) { 9 - $this->id = $data['id']; 10 - } 11 - 12 - public function processRequest() { 13 - $request = $this->getRequest(); 14 - $viewer = $request->getUser(); 6 + public function handleRequest(AphrontRequest $request) { 7 + $viewer = $request->getViewer(); 8 + $id = $request->getURIData('id'); 15 9 16 10 $cart = id(new PhortuneCartQuery()) 17 11 ->setViewer($viewer) 18 - ->withIDs(array($this->id)) 12 + ->withIDs(array($id)) 19 13 ->needPurchases(true) 20 14 ->executeOne(); 21 15 if (!$cart) {
+4 -10
src/applications/phortune/controller/PhortuneCartUpdateController.php
··· 3 3 final class PhortuneCartUpdateController 4 4 extends PhortuneCartController { 5 5 6 - private $id; 7 - 8 - public function willProcessRequest(array $data) { 9 - $this->id = $data['id']; 10 - } 11 - 12 - public function processRequest() { 13 - $request = $this->getRequest(); 14 - $viewer = $request->getUser(); 6 + public function handleRequest(AphrontRequest $request) { 7 + $viewer = $request->getViewer(); 8 + $id = $request->getURIData('id'); 15 9 16 10 $authority = $this->loadMerchantAuthority(); 17 11 18 12 $cart_query = id(new PhortuneCartQuery()) 19 13 ->setViewer($viewer) 20 - ->withIDs(array($this->id)) 14 + ->withIDs(array($id)) 21 15 ->needPurchases(true); 22 16 23 17 if ($authority) {
+4 -10
src/applications/phortune/controller/PhortuneCartViewController.php
··· 3 3 final class PhortuneCartViewController 4 4 extends PhortuneCartController { 5 5 6 - private $id; 7 - 8 - public function willProcessRequest(array $data) { 9 - $this->id = $data['id']; 10 - } 11 - 12 - public function processRequest() { 13 - $request = $this->getRequest(); 14 - $viewer = $request->getUser(); 6 + public function handleRequest(AphrontRequest $request) { 7 + $viewer = $request->getViewer(); 8 + $id = $request->getURIData('id'); 15 9 16 10 $authority = $this->loadMerchantAuthority(); 17 11 18 12 $query = id(new PhortuneCartQuery()) 19 13 ->setViewer($viewer) 20 - ->withIDs(array($this->id)) 14 + ->withIDs(array($id)) 21 15 ->needPurchases(true); 22 16 23 17 if ($authority) {
+8 -15
src/applications/phortune/controller/PhortuneChargeListController.php
··· 3 3 final class PhortuneChargeListController 4 4 extends PhortuneController { 5 5 6 - private $accountID; 7 - private $queryKey; 8 - 9 6 private $account; 10 7 11 - public function willProcessRequest(array $data) { 12 - $this->accountID = idx($data, 'accountID'); 13 - $this->queryKey = idx($data, 'queryKey'); 14 - } 15 - 16 - public function processRequest() { 17 - $request = $this->getRequest(); 18 - $viewer = $request->getUser(); 8 + public function handleRequest(AphrontRequest $request) { 9 + $viewer = $request->getViewer(); 10 + $querykey = $request->getURIData('queryKey'); 11 + $account_id = $request->getURIData('accountID'); 19 12 20 13 $engine = new PhortuneChargeSearchEngine(); 21 14 22 - if ($this->accountID) { 15 + if ($account_id) { 23 16 $account = id(new PhortuneAccountQuery()) 24 17 ->setViewer($viewer) 25 - ->withIDs(array($this->accountID)) 18 + ->withIDs(array($account_id)) 26 19 ->requireCapabilities( 27 20 array( 28 21 PhabricatorPolicyCapability::CAN_VIEW, ··· 39 32 } 40 33 41 34 $controller = id(new PhabricatorApplicationSearchController()) 42 - ->setQueryKey($this->queryKey) 35 + ->setQueryKey($querykey) 43 36 ->setSearchEngine($engine) 44 37 ->setNavigation($this->buildSideNavView()); 45 38 ··· 47 40 } 48 41 49 42 public function buildSideNavView() { 50 - $viewer = $this->getRequest()->getUser(); 43 + $viewer = $this->getViewer(); 51 44 52 45 $nav = new AphrontSideNavFilterView(); 53 46 $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
+5 -6
src/applications/phortune/controller/PhortuneLandingController.php
··· 2 2 3 3 final class PhortuneLandingController extends PhortuneController { 4 4 5 - public function processRequest() { 6 - $request = $this->getRequest(); 7 - $user = $request->getUser(); 5 + public function handleRequest(AphrontRequest $request) { 6 + $viewer = $request->getViewer(); 8 7 9 8 $accounts = id(new PhortuneAccountQuery()) 10 - ->setViewer($user) 11 - ->withMemberPHIDs(array($user->getPHID())) 9 + ->setViewer($viewer) 10 + ->withMemberPHIDs(array($viewer->getPHID())) 12 11 ->execute(); 13 12 14 13 if (!$accounts) { 15 14 $account = PhortuneAccount::createNewAccount( 16 - $user, 15 + $viewer, 17 16 PhabricatorContentSource::newFromRequest($request)); 18 17 $accounts = array($account); 19 18 }
+5 -11
src/applications/phortune/controller/PhortuneMerchantEditController.php
··· 3 3 final class PhortuneMerchantEditController 4 4 extends PhortuneMerchantController { 5 5 6 - private $id; 7 - 8 - public function willProcessRequest(array $data) { 9 - $this->id = idx($data, 'id'); 10 - } 11 - 12 - public function processRequest() { 13 - $request = $this->getRequest(); 14 - $viewer = $request->getUser(); 6 + public function handleRequest(AphrontRequest $request) { 7 + $viewer = $request->getViewer(); 8 + $id = $request->getURIData('id'); 15 9 16 - if ($this->id) { 10 + if ($id) { 17 11 $merchant = id(new PhortuneMerchantQuery()) 18 12 ->setViewer($viewer) 19 - ->withIDs(array($this->id)) 13 + ->withIDs(array($id)) 20 14 ->requireCapabilities( 21 15 array( 22 16 PhabricatorPolicyCapability::CAN_VIEW,
+5 -8
src/applications/phortune/controller/PhortuneMerchantListController.php
··· 3 3 final class PhortuneMerchantListController 4 4 extends PhortuneMerchantController { 5 5 6 - private $queryKey; 7 - 8 6 public function shouldAllowPublic() { 9 7 return true; 10 8 } 11 9 12 - public function willProcessRequest(array $data) { 13 - $this->queryKey = idx($data, 'queryKey'); 14 - } 10 + public function handleRequest(AphrontRequest $request) { 11 + $viewer = $request->getViewer(); 12 + $querykey = $request->getURIData('queryKey'); 15 13 16 - public function processRequest() { 17 14 $controller = id(new PhabricatorApplicationSearchController()) 18 - ->setQueryKey($this->queryKey) 15 + ->setQueryKey($querykey) 19 16 ->setSearchEngine(new PhortuneMerchantSearchEngine()) 20 17 ->setNavigation($this->buildSideNavView()); 21 18 ··· 23 20 } 24 21 25 22 public function buildSideNavView() { 26 - $viewer = $this->getRequest()->getUser(); 23 + $viewer = $this->getViewer(); 27 24 28 25 $nav = new AphrontSideNavFilterView(); 29 26 $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
+4 -10
src/applications/phortune/controller/PhortuneMerchantViewController.php
··· 3 3 final class PhortuneMerchantViewController 4 4 extends PhortuneMerchantController { 5 5 6 - private $id; 7 - 8 - public function willProcessRequest(array $data) { 9 - $this->id = $data['id']; 10 - } 11 - 12 - public function processRequest() { 13 - $request = $this->getRequest(); 14 - $viewer = $request->getUser(); 6 + public function handleRequest(AphrontRequest $request) { 7 + $viewer = $request->getViewer(); 8 + $id = $request->getURIData('id'); 15 9 16 10 $merchant = id(new PhortuneMerchantQuery()) 17 11 ->setViewer($viewer) 18 - ->withIDs(array($this->id)) 12 + ->withIDs(array($id)) 19 13 ->executeOne(); 20 14 if (!$merchant) { 21 15 return new Aphront404Response();
+4 -10
src/applications/phortune/controller/PhortunePaymentMethodCreateController.php
··· 3 3 final class PhortunePaymentMethodCreateController 4 4 extends PhortuneController { 5 5 6 - private $accountID; 7 - 8 - public function willProcessRequest(array $data) { 9 - $this->accountID = $data['accountID']; 10 - } 11 - 12 - public function processRequest() { 13 - $request = $this->getRequest(); 14 - $viewer = $request->getUser(); 6 + public function handleRequest(AphrontRequest $request) { 7 + $viewer = $request->getViewer(); 8 + $account_id = $request->getURIData('accountID'); 15 9 16 10 $account = id(new PhortuneAccountQuery()) 17 11 ->setViewer($viewer) 18 - ->withIDs(array($this->accountID)) 12 + ->withIDs(array($account_id)) 19 13 ->executeOne(); 20 14 if (!$account) { 21 15 return new Aphront404Response();
+4 -10
src/applications/phortune/controller/PhortunePaymentMethodDisableController.php
··· 3 3 final class PhortunePaymentMethodDisableController 4 4 extends PhortuneController { 5 5 6 - private $methodID; 7 - 8 - public function willProcessRequest(array $data) { 9 - $this->methodID = $data['id']; 10 - } 11 - 12 - public function processRequest() { 13 - $request = $this->getRequest(); 14 - $viewer = $request->getUser(); 6 + public function handleRequest(AphrontRequest $request) { 7 + $viewer = $request->getViewer(); 8 + $method_id = $request->getURIData('methodID'); 15 9 16 10 $method = id(new PhortunePaymentMethodQuery()) 17 11 ->setViewer($viewer) 18 - ->withIDs(array($this->methodID)) 12 + ->withIDs(array($method_id)) 19 13 ->requireCapabilities( 20 14 array( 21 15 PhabricatorPolicyCapability::CAN_VIEW,
+4 -10
src/applications/phortune/controller/PhortunePaymentMethodEditController.php
··· 3 3 final class PhortunePaymentMethodEditController 4 4 extends PhortuneController { 5 5 6 - private $methodID; 7 - 8 - public function willProcessRequest(array $data) { 9 - $this->methodID = $data['id']; 10 - } 11 - 12 - public function processRequest() { 13 - $request = $this->getRequest(); 14 - $viewer = $request->getUser(); 6 + public function handleRequest(AphrontRequest $request) { 7 + $viewer = $request->getViewer(); 8 + $method_id = $request->getURIData('id'); 15 9 16 10 $method = id(new PhortunePaymentMethodQuery()) 17 11 ->setViewer($viewer) 18 - ->withIDs(array($this->methodID)) 12 + ->withIDs(array($method_id)) 19 13 ->requireCapabilities( 20 14 array( 21 15 PhabricatorPolicyCapability::CAN_VIEW,
+4 -5
src/applications/phortune/controller/PhortuneProductListController.php
··· 2 2 3 3 final class PhortuneProductListController extends PhabricatorController { 4 4 5 - public function processRequest() { 6 - $request = $this->getRequest(); 7 - $user = $request->getUser(); 5 + public function handleRequest(AphrontRequest $request) { 6 + $viewer = $request->getViewer(); 8 7 9 8 $pager = new AphrontCursorPagerView(); 10 9 $pager->readFromRequest($request); 11 10 12 11 $query = id(new PhortuneProductQuery()) 13 - ->setViewer($user); 12 + ->setViewer($viewer); 14 13 15 14 $products = $query->executeWithCursorPager($pager); 16 15 ··· 27 26 ->setIcon('fa-plus-square')); 28 27 29 28 $product_list = id(new PHUIObjectItemListView()) 30 - ->setUser($user) 29 + ->setUser($viewer) 31 30 ->setNoDataString(pht('No products.')); 32 31 33 32 foreach ($products as $product) {
+7 -13
src/applications/phortune/controller/PhortuneProductViewController.php
··· 2 2 3 3 final class PhortuneProductViewController extends PhortuneController { 4 4 5 - private $productID; 6 - 7 - public function willProcessRequest(array $data) { 8 - $this->productID = $data['id']; 9 - } 10 - 11 - public function processRequest() { 12 - $request = $this->getRequest(); 13 - $user = $request->getUser(); 5 + public function handleRequest(AphrontRequest $request) { 6 + $viewer = $request->getViewer(); 7 + $id = $request->getURIData('id'); 14 8 15 9 $product = id(new PhortuneProductQuery()) 16 - ->setViewer($user) 17 - ->withIDs(array($this->productID)) 10 + ->setViewer($viewer) 11 + ->withIDs(array($id)) 18 12 ->executeOne(); 19 13 if (!$product) { 20 14 return new Aphront404Response(); ··· 28 22 $edit_uri = $this->getApplicationURI('product/edit/'.$product->getID().'/'); 29 23 30 24 $actions = id(new PhabricatorActionListView()) 31 - ->setUser($user) 25 + ->setUser($viewer) 32 26 ->setObjectURI($request->getRequestURI()); 33 27 34 28 $crumbs = $this->buildApplicationCrumbs(); ··· 40 34 $request->getRequestURI()); 41 35 42 36 $properties = id(new PHUIPropertyListView()) 43 - ->setUser($user) 37 + ->setUser($viewer) 44 38 ->setActionList($actions) 45 39 ->addProperty( 46 40 pht('Price'),
+5 -10
src/applications/phortune/controller/PhortuneProviderActionController.php
··· 3 3 final class PhortuneProviderActionController 4 4 extends PhortuneController { 5 5 6 - private $id; 7 6 private $action; 8 - 9 - public function willProcessRequest(array $data) { 10 - $this->id = $data['id']; 11 - $this->setAction($data['action']); 12 - } 13 7 14 8 public function setAction($action) { 15 9 $this->action = $action; ··· 20 14 return $this->action; 21 15 } 22 16 23 - public function processRequest() { 24 - $request = $this->getRequest(); 25 - $viewer = $request->getUser(); 17 + public function handleRequest(AphrontRequest $request) { 18 + $viewer = $request->getViewer(); 19 + $id = $request->getURIData('id'); 20 + $this->setAction($request->getURIData('action')); 26 21 27 22 $provider_config = id(new PhortunePaymentProviderConfigQuery()) 28 23 ->setViewer($viewer) 29 - ->withIDs(array($this->id)) 24 + ->withIDs(array($id)) 30 25 ->executeOne(); 31 26 if (!$provider_config) { 32 27 return new Aphront404Response();
+4 -10
src/applications/phortune/controller/PhortuneProviderDisableController.php
··· 3 3 final class PhortuneProviderDisableController 4 4 extends PhortuneMerchantController { 5 5 6 - private $id; 7 - 8 - public function willProcessRequest(array $data) { 9 - $this->id = $data['id']; 10 - } 11 - 12 - public function processRequest() { 13 - $request = $this->getRequest(); 14 - $viewer = $request->getUser(); 6 + public function handleRequest(AphrontRequest $request) { 7 + $viewer = $request->getViewer(); 8 + $id = $request->getURIData('id'); 15 9 16 10 $provider_config = id(new PhortunePaymentProviderConfigQuery()) 17 11 ->setViewer($viewer) 18 - ->withIDs(array($this->id)) 12 + ->withIDs(array($id)) 19 13 ->requireCapabilities( 20 14 array( 21 15 PhabricatorPolicyCapability::CAN_VIEW,
+5 -11
src/applications/phortune/controller/PhortuneProviderEditController.php
··· 3 3 final class PhortuneProviderEditController 4 4 extends PhortuneMerchantController { 5 5 6 - private $id; 7 - 8 - public function willProcessRequest(array $data) { 9 - $this->id = idx($data, 'id'); 10 - } 11 - 12 - public function processRequest() { 13 - $request = $this->getRequest(); 14 - $viewer = $request->getUser(); 6 + public function handleRequest(AphrontRequest $request) { 7 + $viewer = $request->getViewer(); 8 + $id = $request->getURIData('id'); 15 9 16 - if ($this->id) { 10 + if ($id) { 17 11 $provider_config = id(new PhortunePaymentProviderConfigQuery()) 18 12 ->setViewer($viewer) 19 - ->withIDs(array($this->id)) 13 + ->withIDs(array($id)) 20 14 ->requireCapabilities( 21 15 array( 22 16 PhabricatorPolicyCapability::CAN_VIEW,
+11 -19
src/applications/phortune/controller/PhortuneSubscriptionListController.php
··· 3 3 final class PhortuneSubscriptionListController 4 4 extends PhortuneController { 5 5 6 - private $accountID; 7 - private $merchantID; 8 - private $queryKey; 9 - 10 6 private $merchant; 11 7 private $account; 12 8 13 - public function willProcessRequest(array $data) { 14 - $this->merchantID = idx($data, 'merchantID'); 15 - $this->accountID = idx($data, 'accountID'); 16 - $this->queryKey = idx($data, 'queryKey'); 17 - } 18 - 19 - public function processRequest() { 20 - $request = $this->getRequest(); 21 - $viewer = $request->getUser(); 9 + public function handleRequest(AphrontRequest $request) { 10 + $viewer = $request->getViewer(); 11 + $querykey = $request->getURIData('queryKey'); 12 + $merchant_id = $request->getURIData('merchantID'); 13 + $account_id = $request->getURIData('accountID'); 22 14 23 15 $engine = new PhortuneSubscriptionSearchEngine(); 24 16 25 - if ($this->merchantID) { 17 + if ($merchant_id) { 26 18 $merchant = id(new PhortuneMerchantQuery()) 27 19 ->setViewer($viewer) 28 - ->withIDs(array($this->merchantID)) 20 + ->withIDs(array($merchant_id)) 29 21 ->requireCapabilities( 30 22 array( 31 23 PhabricatorPolicyCapability::CAN_VIEW, ··· 38 30 $this->merchant = $merchant; 39 31 $viewer->grantAuthority($merchant); 40 32 $engine->setMerchant($merchant); 41 - } else if ($this->accountID) { 33 + } else if ($account_id) { 42 34 $account = id(new PhortuneAccountQuery()) 43 35 ->setViewer($viewer) 44 - ->withIDs(array($this->accountID)) 36 + ->withIDs(array($account_id)) 45 37 ->requireCapabilities( 46 38 array( 47 39 PhabricatorPolicyCapability::CAN_VIEW, ··· 58 50 } 59 51 60 52 $controller = id(new PhabricatorApplicationSearchController()) 61 - ->setQueryKey($this->queryKey) 53 + ->setQueryKey($querykey) 62 54 ->setSearchEngine($engine) 63 55 ->setNavigation($this->buildSideNavView()); 64 56 ··· 66 58 } 67 59 68 60 public function buildSideNavView() { 69 - $viewer = $this->getRequest()->getUser(); 61 + $viewer = $this->getViewer(); 70 62 71 63 $nav = new AphrontSideNavFilterView(); 72 64 $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));