Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / phortune / controller / PhortuneController.php
blob37896cc941f30158d17c5f23ef4f5688662154ba
1 <?php
3 abstract class PhortuneController extends PhabricatorController {
5 private function loadEnabledProvidersForMerchant(PhortuneMerchant $merchant) {
6 $viewer = $this->getRequest()->getUser();
8 $provider_configs = id(new PhortunePaymentProviderConfigQuery())
9 ->setViewer($viewer)
10 ->withMerchantPHIDs(array($merchant->getPHID()))
11 ->execute();
12 $providers = mpull($provider_configs, 'buildProvider', 'getID');
14 foreach ($providers as $key => $provider) {
15 if (!$provider->isEnabled()) {
16 unset($providers[$key]);
20 return $providers;
23 protected function loadCreatePaymentMethodProvidersForMerchant(
24 PhortuneMerchant $merchant) {
26 $providers = $this->loadEnabledProvidersForMerchant($merchant);
27 foreach ($providers as $key => $provider) {
28 if (!$provider->canCreatePaymentMethods()) {
29 unset($providers[$key]);
30 continue;
34 return $providers;
37 protected function loadOneTimePaymentProvidersForMerchant(
38 PhortuneMerchant $merchant) {
40 $providers = $this->loadEnabledProvidersForMerchant($merchant);
41 foreach ($providers as $key => $provider) {
42 if (!$provider->canProcessOneTimePayments()) {
43 unset($providers[$key]);
44 continue;
48 return $providers;