Differential D20733 Diff 49440 src/applications/phortune/controller/merchant/PhortuneMerchantProviderDisableController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phortune/controller/merchant/PhortuneMerchantProviderDisableController.php
- This file was moved from src/applications/phortune/controller/provider/PhortuneProviderDisableController.php.
<?php | <?php | ||||
final class PhortuneProviderDisableController | final class PhortuneMerchantProviderDisableController | ||||
extends PhortuneMerchantController { | extends PhortuneMerchantController { | ||||
public function handleRequest(AphrontRequest $request) { | protected function shouldRequireMerchantEditCapability() { | ||||
return true; | |||||
} | |||||
protected function handleMerchantRequest(AphrontRequest $request) { | |||||
$viewer = $request->getViewer(); | $viewer = $request->getViewer(); | ||||
$id = $request->getURIData('id'); | $merchant = $this->getMerchant(); | ||||
$id = $request->getURIData('providerID'); | |||||
$provider_config = id(new PhortunePaymentProviderConfigQuery()) | $provider_config = id(new PhortunePaymentProviderConfigQuery()) | ||||
->setViewer($viewer) | ->setViewer($viewer) | ||||
->withIDs(array($id)) | ->withIDs(array($id)) | ||||
->requireCapabilities( | ->requireCapabilities( | ||||
array( | array( | ||||
PhabricatorPolicyCapability::CAN_VIEW, | PhabricatorPolicyCapability::CAN_VIEW, | ||||
PhabricatorPolicyCapability::CAN_EDIT, | PhabricatorPolicyCapability::CAN_EDIT, | ||||
)) | )) | ||||
->executeOne(); | ->executeOne(); | ||||
if (!$provider_config) { | if (!$provider_config) { | ||||
return new Aphront404Response(); | return new Aphront404Response(); | ||||
} | } | ||||
$merchant = $provider_config->getMerchant(); | |||||
$merchant_id = $merchant->getID(); | $merchant_id = $merchant->getID(); | ||||
$cancel_uri = $this->getApplicationURI("merchant/{$merchant_id}/"); | $cancel_uri = $provider_config->getURI(); | ||||
$provider = $provider_config->buildProvider(); | $provider = $provider_config->buildProvider(); | ||||
if ($request->isFormPost()) { | if ($request->isFormPost()) { | ||||
$new_status = !$provider_config->getIsEnabled(); | $new_status = !$provider_config->getIsEnabled(); | ||||
$xactions = array(); | $xactions = array(); | ||||
$xactions[] = id(new PhortunePaymentProviderConfigTransaction()) | $xactions[] = id(new PhortunePaymentProviderConfigTransaction()) | ||||
Show All 37 Lines |