Ejemplo n.º 1
0
 /**
  * Constructs a new Stripe instance
  * @param string $environment		'sandbox' or 'production'
  * @param mixed $merchant_attr		Account ID, ElggEntity or entity guid of the merchant on whose behalf the requests are to be made
  * @return StripeClient
  */
 function __construct($environment = null, $merchant_attr = null)
 {
     StripeClientFactory::stageEnvironment($environment);
     $merchant = new StripeMerchant($merchant_attr);
     $access_token = $merchant->getAccessToken();
     $this->setAccessToken($access_token);
 }
Ejemplo n.º 2
0
 /**
  * Get an access token for signing API requests
  */
 public function getAccessToken()
 {
     if (!elgg_instanceof($this->entity)) {
         return false;
     }
     switch ($this->entity->getType()) {
         case 'site':
             return StripeClientFactory::getSecretKey();
             break;
         default:
             return $this->entity->getPrivateSetting('stripe_access_token');
             break;
     }
 }
Ejemplo n.º 3
0
 /**
  * Stage an environment
  * @param string $environment
  */
 public static function stageEnvironment($environment = null)
 {
     self::$environment = self::filterEnvironment($environment);
     self::init();
 }
Ejemplo n.º 4
0
elgg.config.stripePublishableKey = '<?php 
echo StripeClientFactory::getPublishableKey();
?>
';