function __Construct($dictionary)
 {
     parent::__Construct(get_class(), "desktop.html", $dictionary);
     //get input params
     $paymentConfigCode = Params::Get('state');
     $authCode = Params::Get('code');
     //load provider (verify code)
     $provider = Provider::FromPaymentConfigCode($paymentConfigCode);
     if (is_null($provider)) {
         //TODO: deal with this
     } else {
         //check stripe id isn't already set
         if (!is_null($provider->getStripeAccountId())) {
             //TODO: deal with this
         } else {
             $stripeAccount = StripeConnector::ConstructAccount($authCode);
             if (is_null($stripeAccount)) {
                 //TODO: deal with this
             } else {
                 //add to provider - clear code
                 $provider->setStripeAccountId($stripeAccount->getId());
                 $provider->setPaymentConfigCode(null);
                 $provider->save();
                 //notify success
                 $this->connected = true;
             }
         }
     }
 }
示例#2
0
     } else {
         $response = new HomePage($dictionary);
     }
 } else {
     //special cases
     if ($element0 == 'contact') {
         $response = new HomePage($dictionary, true);
     } elseif ($element0 == 'sitemap') {
         $response = new SitemapResponse();
     } elseif ($element0 == 'verify') {
         $provider = Provider::FromVerificationCode($element1);
         if (!is_null($provider)) {
             $response = new ProviderSetupPage($dictionary, $provider);
         }
     } elseif ($element0 == 'stripe-setup') {
         $provider = Provider::FromPaymentConfigCode($element1);
         if (!is_null($provider)) {
             $response = new StripeSetupPage($dictionary, $provider);
         }
     } elseif ($element0 == 'stripe-return') {
         $response = new StripeReturnPage($dictionary);
     } elseif ($client == 'mobile' && $element0 == 'static') {
         $response = new MobileHoldingPage($dictionary);
     } else {
         //cmsPage
         $cmsPage = null;
         if ($element0 != '' && $element1 == '') {
             $cmsPage = CmsPage::FromUri(Application::SITE_CODE, $element0);
         } elseif ($element0 != '' && $element1 != '') {
             $cmsPage = CmsPage::FromUri(Application::SITE_CODE, $element1, $element0);
         }