/**
  * @param Request $request
  */
 public function onStripeToken($request)
 {
     $token = $request->getPost('stripeToken');
     $db = $this->bootstrap->get('db');
     if ($request->getPost('stripeCreateAccount')) {
         $sql = 'SELECT firstname, lastname, customernumber FROM s_user_billingaddress WHERE userID = ?';
         $customer = $db->fetchRow($sql, array($this->session->sUserId));
         $customer = \Stripe\Customer::create(array("source" => $token, "email" => $this->session->sUserMail, "description" => implode(' ', $customer)));
         $customerId = $customer->id;
         unset($this->session->stripeToken);
     } else {
         $this->session->stripeToken = $token;
         $customerId = null;
     }
     $db->update('s_user_attributes', array('viison_stripe_customer_id' => $customerId), array('userID =' . (int) $this->session->sUserId));
 }
Exemple #2
0
 /**
  * Returns an array with all current values in _POST
  *
  * @return array
  */
 public function toArray()
 {
     return $this->request->getPost();
 }
Exemple #3
0
 /**
  * @param Request $request
  * @param Shop $shop
  * @return bool
  */
 protected function shouldRedirect(Request $request, Shop $shop)
 {
     return $request->isGet() && $request->getQuery('__shop') !== null && $request->getQuery('__shop') != $shop->getId() || $request->isPost() && $request->getPost('__shop') !== null && $request->getPost('__redirect') !== null;
 }