Differential D20735 Diff 49444 src/applications/phortune/controller/cart/PhortuneCartCheckoutController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phortune/controller/cart/PhortuneCartCheckoutController.php
<?php | <?php | ||||
final class PhortuneCartCheckoutController | final class PhortuneCartCheckoutController | ||||
extends PhortuneCartController { | extends PhortuneCartController { | ||||
public function handleRequest(AphrontRequest $request) { | protected function shouldRequireAccountAuthority() { | ||||
$viewer = $request->getViewer(); | return true; | ||||
$id = $request->getURIData('id'); | } | ||||
$cart = id(new PhortuneCartQuery()) | protected function shouldRequireMerchantAuthority() { | ||||
->setViewer($viewer) | return false; | ||||
->withIDs(array($id)) | |||||
->needPurchases(true) | |||||
->executeOne(); | |||||
if (!$cart) { | |||||
return new Aphront404Response(); | |||||
} | } | ||||
protected function handleCartRequest(AphrontRequest $request) { | |||||
$viewer = $request->getViewer(); | |||||
$cart = $this->getCart(); | |||||
$cancel_uri = $cart->getCancelURI(); | $cancel_uri = $cart->getCancelURI(); | ||||
$merchant = $cart->getMerchant(); | $merchant = $cart->getMerchant(); | ||||
switch ($cart->getStatus()) { | switch ($cart->getStatus()) { | ||||
case PhortuneCart::STATUS_BUILDING: | case PhortuneCart::STATUS_BUILDING: | ||||
return $this->newDialog() | return $this->newDialog() | ||||
->setTitle(pht('Incomplete Cart')) | ->setTitle(pht('Incomplete Cart')) | ||||
->appendParagraph( | ->appendParagraph( | ||||
▲ Show 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | protected function handleCartRequest(AphrontRequest $request) { | ||||
$account_id = $account->getID(); | $account_id = $account->getID(); | ||||
$params = array( | $params = array( | ||||
'merchantID' => $merchant->getID(), | 'merchantID' => $merchant->getID(), | ||||
'cartID' => $cart->getID(), | 'cartID' => $cart->getID(), | ||||
); | ); | ||||
$payment_method_uri = $this->getApplicationURI("{$account_id}/card/new/"); | $payment_method_uri = urisprintf( | ||||
'account/%d/methods/new/', | |||||
$account->getID()); | |||||
$payment_method_uri = $this->getApplicationURI($payment_method_uri); | |||||
$payment_method_uri = new PhutilURI($payment_method_uri, $params); | $payment_method_uri = new PhutilURI($payment_method_uri, $params); | ||||
$form = id(new AphrontFormView()) | $form = id(new AphrontFormView()) | ||||
->setUser($viewer) | ->setUser($viewer) | ||||
->appendChild($method_control); | ->appendChild($method_control); | ||||
$add_providers = $this->loadCreatePaymentMethodProvidersForMerchant( | $add_providers = $this->loadCreatePaymentMethodProvidersForMerchant( | ||||
$merchant); | $merchant); | ||||
▲ Show 20 Lines • Show All 83 Lines • Show Last 20 Lines |