[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhortuneCartAcceptController 4 extends PhortuneCartController { 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(); 15 16 $cart = id(new PhortuneCartQuery()) 17 ->setViewer($viewer) 18 ->withIDs(array($this->id)) 19 ->needPurchases(true) 20 ->executeOne(); 21 if (!$cart) { 22 return new Aphront404Response(); 23 } 24 25 // You must control the merchant to accept orders. 26 PhabricatorPolicyFilter::requireCapability( 27 $viewer, 28 $cart->getMerchant(), 29 PhabricatorPolicyCapability::CAN_EDIT); 30 31 $cancel_uri = $cart->getDetailURI(); 32 33 if ($cart->getStatus() !== PhortuneCart::STATUS_REVIEW) { 34 return $this->newDialog() 35 ->setTitle(pht('Order Not in Review')) 36 ->appendParagraph( 37 pht( 38 'This order does not need manual review, so you can not '. 39 'accept it.')) 40 ->addCancelButton($cancel_uri); 41 } 42 43 if ($request->isFormPost()) { 44 $cart->didReviewCart(); 45 return id(new AphrontRedirectResponse())->setURI($cancel_uri); 46 } 47 48 return $this->newDialog() 49 ->setTitle(pht('Accept Order?')) 50 ->appendParagraph( 51 pht( 52 'This order has been flagged for manual review. You should review '. 53 'it carefully before accepting it.')) 54 ->addCancelButton($cancel_uri) 55 ->addSubmitButton(pht('Accept Order')); 56 } 57 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |