public function testRetrieve()
 {
     authorizeFromEnv();
     $d = Stripe_Account::retrieve();
     $this->assertEqual($d->email, "*****@*****.**");
     $this->assertEqual($d->charge_enabled, false);
     $this->assertEqual($d->details_submitted, false);
 }
Example #2
0
 public function testRetrieve()
 {
     self::authorizeFromEnv();
     $d = Stripe_Account::retrieve();
     $this->assertEqual($d->id, "cuD9Rwx8pgmRZRpVe02lsuR9cwp2Bzf7");
     $this->assertEqual($d->email, "*****@*****.**");
     // @codingStandardsIgnoreStart
     $this->assertEqual($d->charges_enabled, false);
     $this->assertEqual($d->details_submitted, false);
     // @codingStandardsIgnoreEnd
 }
Example #3
0
 public function ajax_validate_secret_key()
 {
     $key_name = rgpost('keyName');
     // if no cache or if new value provided, do a fresh validation
     $this->include_stripe_api();
     Stripe::setApiKey(rgpost('key'));
     $is_valid = true;
     try {
         Stripe_Account::retrieve();
     } catch (Stripe_AuthenticationError $e) {
         $is_valid = false;
     }
     $response = $is_valid ? 'valid' : 'invalid';
     die($response);
 }
 /**
  * Currencies supported by Stripe account
  *
  * @since 1.7.9.1
  *
  * @uses  get_transient()
  * @uses  GFP_Stripe::include_api()
  * @uses  GFP_Stripe::get_api_key()
  * @uses  Stripe::setApiKey()
  * @uses  Stripe_Account::retrieve()
  * @uses  set_transient()
  *
  * @param $currencies
  *
  * @return array
  */
 public function gform_currencies($currencies)
 {
     $current_currency = get_transient('gfp_stripe_currency');
     if (false === $current_currency) {
         self::$_this->include_api();
         $api_key = self::$_this->get_api_key('secret');
         if (!empty($api_key)) {
             Stripe::setApiKey($api_key);
             $account = Stripe_Account::retrieve();
             $default_currency = strtoupper($account['default_currency']);
             $currencies_supported = array_map('strtoupper', $account['currencies_supported']);
             set_transient('gfp_stripe_currency', array('default' => $default_currency, 'supported' => $currencies_supported), 24 * HOUR_IN_SECONDS);
         }
     }
     if (!empty($current_currency) || !empty($default_currency) && !empty($currencies_supported)) {
         $currencies = array_intersect_key($currencies, $current_currency ? array_flip($current_currency['supported']) : array_flip($currencies_supported));
     }
     return $currencies;
 }
Example #5
0
 /**
  * Retrieve a Stripe account
  * @return boolean
  */
 public function getAccount()
 {
     try {
         return Stripe_Account::retrieve($this->access_token);
     } catch (Exception $ex) {
         $this->log($ex);
         return false;
     }
 }
 public function runConfigurationTest()
 {
     $this->loadStripeAPILibraries();
     $secret_key = $this->getSecretKey();
     $account = Stripe_Account::retrieve($secret_key);
 }
Example #7
0
 /**
  * Retrieve acount 
  * 
  * @return \Stripe_Account
  */
 public function retrieveAcount()
 {
     $this->includeStripeLibrary();
     try {
         $account = \Stripe_Account::retrieve();
     } catch (\Exception $e) {
         $account = null;
     }
     return $account;
 }