Esempio n. 1
0
 /**
  * Unify plan objects from PayPal and Stripe
  *
  * @return array of plans
  */
 public static function getPlans($user)
 {
     // return array
     $allPlans = array();
     $stripePlans = array();
     $paypalPlans = array();
     // get plans from Stripe if connected
     if ($user->isStripeConnected()) {
         $stripePlans = StripeHelper::getPlans($user->stripe_key);
     }
     // get plans from Paypal if connected
     if ($user->isPayPalConnected()) {
         // getting api context
         $apiContext = PayPalHelper::getApiContext();
         $paypalPlans = PayPalHelper::getPlans($apiContext);
     }
     // merge the 2 arrays
     $allPlans = array_merge($stripePlans, $paypalPlans);
     return $allPlans;
 }