コード例 #1
0
 /**
  * anyDisconnectStripe
  * --------------------------------------------------
  * @return Deletes the logged in user's stripe connection.
  * --------------------------------------------------
  */
 public function anyDisconnectStripe()
 {
     /* Try to disconnect */
     try {
         $connector = new StripeConnector(Auth::user());
         $connector->disconnect();
     } catch (StripeNotConnected $e) {
     }
     /* Redirect */
     return Redirect::route('settings.settings');
 }
コード例 #2
0
 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;
             }
         }
     }
 }
コード例 #3
0
 /**
  * getFinancialConnections
  * --------------------------------------------------
  * @return Renders the financial connections step
  * --------------------------------------------------
  */
 public function getFinancialConnections()
 {
     /* Connect stripe after OAuth if not connected */
     if (!Auth::user()->isStripeConnected()) {
         /* Access code if available */
         if (Input::get('code', FALSE)) {
             /* Create instance */
             $stripeconnector = new StripeConnector(Auth::user());
             /* Get tokens */
             try {
                 $stripeconnector->getTokens(Input::get('code'));
                 /* Error handling */
             } catch (StripeConnectFailed $e) {
                 $messages = array();
                 array_push($messages, $e->getMessage());
             }
             /* Connect to stripe */
             $stripeconnector->connect();
         }
     }
     /* Render the page */
     return View::make('signup-wizard.financial-connections');
 }