public function customIndex($parameters) { $preferences = Preference::getValues(12); $parameters['marketPayPalDescriptionItemList'] = isset($preferences->where('id_018', 'marketPayPalDescriptionItemList')->first()->value_018) ? $preferences->where('id_018', 'marketPayPalDescriptionItemList')->first()->value_018 : null; $parameters['marketPayPalSuccessRoute'] = isset($preferences->where('id_018', 'marketPayPalSuccessRoute')->first()->value_018) ? $preferences->where('id_018', 'marketPayPalSuccessRoute')->first()->value_018 : null; $parameters['marketPayPalErrorRoute'] = isset($preferences->where('id_018', 'marketPayPalErrorRoute')->first()->value_018) ? $preferences->where('id_018', 'marketPayPalErrorRoute')->first()->value_018 : null; $parameters['marketPayPalShippingDescription'] = isset($preferences->where('id_018', 'marketPayPalShippingDescription')->first()->value_018) ? $preferences->where('id_018', 'marketPayPalShippingDescription')->first()->value_018 : null; return $parameters; }
/** * PayPalController constructor. * @param Request $request */ public function __construct(Request $request) { parent::__construct($request); $this->preferences = Preference::getValues(12); // Set mode if (config('market.payPalMode') == 'live') { $clientID = config('market.payPalLiveClientId'); $secret = config('market.payPalLiveSecret'); } else { $clientID = config('market.payPalSandboxClientId'); $secret = config('market.payPalSandboxSecret'); } // init PayPal API Context $this->apiContext = new ApiContext(new OAuthTokenCredential($clientID, $secret)); // SDK configuration $this->apiContext->setConfig(['mode' => config('market.payPalMode'), 'http.ConnectionTimeOut' => 30, 'log.LogEnabled' => true, 'log.FileName' => storage_path() . '/logs/paypal.log', 'log.LogLevel' => 'FINE']); }