Differential D20735 Diff 49444 src/applications/phortune/controller/cart/PhortuneCartAcceptController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phortune/controller/cart/PhortuneCartAcceptController.php
<?php | <?php | ||||
final class PhortuneCartAcceptController | final class PhortuneCartAcceptController | ||||
extends PhortuneCartController { | extends PhortuneCartController { | ||||
public function handleRequest(AphrontRequest $request) { | protected function shouldRequireAccountAuthority() { | ||||
$viewer = $request->getViewer(); | return false; | ||||
$id = $request->getURIData('id'); | |||||
// You must control the merchant to accept orders. | |||||
$authority = $this->loadMerchantAuthority(); | |||||
if (!$authority) { | |||||
return new Aphront404Response(); | |||||
} | } | ||||
$cart = id(new PhortuneCartQuery()) | protected function shouldRequireMerchantAuthority() { | ||||
->setViewer($viewer) | return true; | ||||
->withIDs(array($id)) | |||||
->withMerchantPHIDs(array($authority->getPHID())) | |||||
->needPurchases(true) | |||||
->executeOne(); | |||||
if (!$cart) { | |||||
return new Aphront404Response(); | |||||
} | } | ||||
$cancel_uri = $cart->getDetailURI($authority); | protected function handleCartRequest(AphrontRequest $request) { | ||||
$viewer = $request->getViewer(); | |||||
$cart = $this->getCart(); | |||||
$cancel_uri = $cart->getDetailURI(); | |||||
if ($cart->getStatus() !== PhortuneCart::STATUS_REVIEW) { | if ($cart->getStatus() !== PhortuneCart::STATUS_REVIEW) { | ||||
return $this->newDialog() | return $this->newDialog() | ||||
->setTitle(pht('Order Not in Review')) | ->setTitle(pht('Order Not in Review')) | ||||
->appendParagraph( | ->appendParagraph( | ||||
pht( | pht( | ||||
'This order does not need manual review, so you can not '. | 'This order does not need manual review, so you can not '. | ||||
'accept it.')) | 'accept it.')) | ||||
Show All 18 Lines |