Differential D20719 Diff 49401 src/applications/phortune/controller/paymentmethod/PhortunePaymentMethodDisableController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phortune/controller/paymentmethod/PhortunePaymentMethodDisableController.php
- This file was moved from src/applications/phortune/controller/payment/PhortunePaymentMethodDisableController.php.
Show All 20 Lines | public function handleRequest(AphrontRequest $request) { | ||||
} | } | ||||
if ($method->getStatus() == PhortunePaymentMethod::STATUS_DISABLED) { | if ($method->getStatus() == PhortunePaymentMethod::STATUS_DISABLED) { | ||||
return new Aphront400Response(); | return new Aphront400Response(); | ||||
} | } | ||||
$account = $method->getAccount(); | $account = $method->getAccount(); | ||||
$account_id = $account->getID(); | $account_id = $account->getID(); | ||||
$account_uri = $this->getApplicationURI("/account/billing/{$account_id}/"); | $account_uri = $account->getPaymentMethodsURI(); | ||||
if ($request->isFormPost()) { | if ($request->isFormPost()) { | ||||
$xactions = array(); | |||||
// TODO: ApplicationTransactions!!!! | $xactions[] = $method->getApplicationTransactionTemplate() | ||||
$method | ->setTransactionType( | ||||
->setStatus(PhortunePaymentMethod::STATUS_DISABLED) | PhortunePaymentMethodStatusTransaction::TRANSACTIONTYPE) | ||||
->save(); | ->setNewValue(PhortunePaymentMethod::STATUS_DISABLED); | ||||
$editor = id(new PhortunePaymentMethodEditor()) | |||||
->setActor($viewer) | |||||
->setContentSourceFromRequest($request) | |||||
->setContinueOnNoEffect(true) | |||||
->setContinueOnMissingFields(true); | |||||
$editor->applyTransactions($method, $xactions); | |||||
return id(new AphrontRedirectResponse())->setURI($account_uri); | return id(new AphrontRedirectResponse())->setURI($account_uri); | ||||
} | } | ||||
return $this->newDialog() | return $this->newDialog() | ||||
->setTitle(pht('Remove Payment Method')) | ->setTitle(pht('Remove Payment Method')) | ||||
->appendParagraph( | ->appendParagraph( | ||||
pht( | pht( | ||||
Show All 14 Lines |