Differential D20735 Diff 49444 src/applications/phortune/controller/account/PhortuneAccountChargesController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phortune/controller/account/PhortuneAccountChargesController.php
<?php | <?php | ||||
final class PhortuneAccountChargesController | final class PhortuneAccountChargesController | ||||
extends PhortuneAccountProfileController { | extends PhortuneAccountProfileController { | ||||
protected function shouldRequireAccountEditCapability() { | protected function shouldRequireAccountEditCapability() { | ||||
return false; | return false; | ||||
} | } | ||||
protected function handleAccountRequest(AphrontRequest $request) { | protected function handleAccountRequest(AphrontRequest $request) { | ||||
$account = $this->getAccount(); | $account = $this->getAccount(); | ||||
$title = $account->getName(); | $title = $account->getName(); | ||||
$crumbs = $this->buildApplicationCrumbs() | $crumbs = $this->buildApplicationCrumbs() | ||||
->addTextCrumb(pht('Order History')) | ->addTextCrumb(pht('Orders')) | ||||
->setBorder(true); | ->setBorder(true); | ||||
$header = $this->buildHeaderView(); | $header = $this->buildHeaderView(); | ||||
$authority = $this->newAccountAuthorityView(); | $authority = $this->newAccountAuthorityView(); | ||||
$charge_history = $this->buildChargeHistorySection($account); | $charge_history = $this->buildChargeHistorySection($account); | ||||
$view = id(new PHUITwoColumnView()) | $view = id(new PHUITwoColumnView()) | ||||
->setHeader($header) | ->setHeader($header) | ||||
Show All 17 Lines | private function buildChargeHistorySection(PhortuneAccount $account) { | ||||
$charges = id(new PhortuneChargeQuery()) | $charges = id(new PhortuneChargeQuery()) | ||||
->setViewer($viewer) | ->setViewer($viewer) | ||||
->withAccountPHIDs(array($account->getPHID())) | ->withAccountPHIDs(array($account->getPHID())) | ||||
->needCarts(true) | ->needCarts(true) | ||||
->setLimit(100) | ->setLimit(100) | ||||
->execute(); | ->execute(); | ||||
$phids = array(); | |||||
foreach ($charges as $charge) { | |||||
$phids[] = $charge->getProviderPHID(); | |||||
$phids[] = $charge->getCartPHID(); | |||||
$phids[] = $charge->getMerchantPHID(); | |||||
$phids[] = $charge->getPaymentMethodPHID(); | |||||
} | |||||
$handles = $this->loadViewerHandles($phids); | |||||
$charges_uri = $account->getChargeListURI(); | $charges_uri = $account->getChargeListURI(); | ||||
$table = id(new PhortuneChargeTableView()) | $table = id(new PhortuneChargeTableView()) | ||||
->setUser($viewer) | ->setUser($viewer) | ||||
->setCharges($charges) | ->setCharges($charges); | ||||
->setHandles($handles); | |||||
$header = id(new PHUIHeaderView()) | $header = id(new PHUIHeaderView()) | ||||
->setHeader(pht('Recent Charges')) | ->setHeader(pht('Recent Charges')) | ||||
->addActionLink( | ->addActionLink( | ||||
id(new PHUIButtonView()) | id(new PHUIButtonView()) | ||||
->setTag('a') | ->setTag('a') | ||||
->setIcon('fa-list') | ->setIcon('fa-list') | ||||
->setHref($charges_uri) | ->setHref($charges_uri) | ||||
Show All 9 Lines |