/** * Unify customer objects from PayPal and Stripe * * @return array of all customers */ public static function getCustomers($user) { // return array $allCustomers = array(); $stripeCustomers = array(); $paypalCustomers = array(); // get customers from Stripe if connected if ($user->isStripeConnected()) { $stripeCustomers = StripeHelper::getCustomers($user); } // get customers from Paypal if connected if ($user->isPayPalConnected()) { // getting api context $apiContext = PayPalHelper::getApiContext(); $paypalCustomers = PayPalHelper::getCustomers($apiContext); // TODO // tailor it to look like Stripe data } // merge the 2 arrays $allCustomers = array_merge($stripeCustomers, $paypalCustomers); return $allCustomers; }