Plugin Directory

Changeset 1517034


Ignore:
Timestamp:
10/17/2016 11:39:39 PM (9 years ago)
Author:
naomicbush
Message:

Update Stripe PHP library

Location:
gravity-forms-stripe/trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • gravity-forms-stripe/trunk/gravity-forms-stripe.php

    r1504158 r1517034  
    55 * Plugin URI: https://gravityplus.pro/gravity-forms-stripe
    66 * Description: Use Stripe to process credit card payments on your site, easily and securely, with Gravity Forms
    7  * Version: 1.9.2.8
     7 * Version: 1.9.2.9
    88 * Author: gravity+
    99 * Author URI: https://gravityplus.pro
     
    2828 *
    2929 * @package   GFP_Stripe
    30  * @version   1.9.2.8
     30 * @version   1.9.2.9
    3131 * @author    gravity+ <support@gravityplus.pro>
    3232 * @license   GPL-2.0+
     
    3434 * @copyright 2012-2016 gravity+
    3535 *
    36  * last updated: September 4, 2016
     36 * last updated: October 17, 2016
    3737 */
    3838
  • gravity-forms-stripe/trunk/includes/api/stripe-php/init.php

    r1504158 r1517034  
    3636require(dirname(__FILE__) . '/lib/Account.php');
    3737require(dirname(__FILE__) . '/lib/AlipayAccount.php');
     38require(dirname(__FILE__) . '/lib/ApplePayDomain.php');
    3839require(dirname(__FILE__) . '/lib/ApplicationFee.php');
    3940require(dirname(__FILE__) . '/lib/ApplicationFeeRefund.php');
     
    6364require(dirname(__FILE__) . '/lib/Source.php');
    6465require(dirname(__FILE__) . '/lib/Subscription.php');
     66require(dirname(__FILE__) . '/lib/SubscriptionItem.php');
    6567require(dirname(__FILE__) . '/lib/ThreeDSecure.php');
    6668require(dirname(__FILE__) . '/lib/Token.php');
  • gravity-forms-stripe/trunk/includes/api/stripe-php/lib/ApiRequestor.php

    r1504158 r1517034  
    118118    }
    119119
     120    private static function _formatAppInfo($appInfo)
     121    {
     122        if ($appInfo !== null) {
     123            $string = $appInfo['name'];
     124            if ($appInfo['version'] !== null) {
     125                $string .= '/' . $appInfo['version'];
     126            }
     127            if ($appInfo['url'] !== null) {
     128                $string .= ' (' . $appInfo['url'] . ')';
     129            }
     130            return $string;
     131        } else {
     132            return null;
     133        }
     134    }
     135
     136    private static function _defaultHeaders($apiKey)
     137    {
     138        $appInfo = Stripe::getAppInfo();
     139
     140        $uaString = 'Stripe/v1 PhpBindings/' . Stripe::VERSION;
     141
     142        $langVersion = phpversion();
     143        $uname = php_uname();
     144        $curlVersion = curl_version();
     145        $appInfo = Stripe::getAppInfo();
     146        $ua = array(
     147            'bindings_version' => Stripe::VERSION,
     148            'lang' => 'php',
     149            'lang_version' => $langVersion,
     150            'publisher' => 'stripe',
     151            'uname' => $uname,
     152            'httplib' => 'curl ' . $curlVersion['version'],
     153            'ssllib' => $curlVersion['ssl_version'],
     154        );
     155        if ($appInfo !== null) {
     156            $uaString .= ' ' . self::_formatAppInfo($appInfo);
     157            $ua['application'] = $appInfo;
     158        }
     159
     160        $defaultHeaders = array(
     161            'X-Stripe-Client-User-Agent' => json_encode($ua),
     162            'User-Agent' => $uaString,
     163            'Authorization' => 'Bearer ' . $apiKey,
     164        );
     165        return $defaultHeaders;
     166    }
     167
    120168    private function _requestRaw($method, $url, $params, $headers)
    121169    {
     
    135183        $absUrl = $this->_apiBase.$url;
    136184        $params = self::_encodeObjects($params);
    137         $langVersion = phpversion();
    138         $uname = php_uname();
    139         $ua = array(
    140             'bindings_version' => Stripe::VERSION,
    141             'lang' => 'php',
    142             'lang_version' => $langVersion,
    143             'publisher' => 'stripe',
    144             'uname' => $uname,
    145         );
    146         $defaultHeaders = array(
    147             'X-Stripe-Client-User-Agent' => json_encode($ua),
    148             'User-Agent' => 'Stripe/v1 PhpBindings/' . Stripe::VERSION,
    149             'Authorization' => 'Bearer ' . $myApiKey,
    150         );
     185        $defaultHeaders = $this->_defaultHeaders($myApiKey);
    151186        if (Stripe::$apiVersion) {
    152187            $defaultHeaders['Stripe-Version'] = Stripe::$apiVersion;
  • gravity-forms-stripe/trunk/includes/api/stripe-php/lib/ApiResource.php

    r1504158 r1517034  
    142142        list($response, $opts) = static::_staticRequest('get', $url, $params, $options);
    143143        $obj = Util\Util::convertToStripeObject($response->json, $opts);
    144         if (!is_a($obj, 'Stripe\\Collection')) { //TODO does this need to be namespaced?
     144        if (!is_a($obj, 'PPP\\Stripe\\Collection')) {
    145145            $class = get_class($obj);
    146146            $message = "Expected type \"PPP\\Stripe\\Collection\", got \"$class\" instead";
  • gravity-forms-stripe/trunk/includes/api/stripe-php/lib/Balance.php

    r1504158 r1517034  
    66 * Class Balance
    77 *
    8  * @param string $object
    9  * @param mixed $available
    10  * @param bool $livedmode
    11  * @param mixed $pending
     8 * @property string $object
     9 * @property mixed $available
     10 * @property bool $livedmode
     11 * @property mixed $pending
    1212 *
    1313 * @package Stripe
  • gravity-forms-stripe/trunk/includes/api/stripe-php/lib/Collection.php

    r1504158 r1517034  
    66 * Class Collection
    77 *
    8  * @param string $object
    9  * @param string $url
    10  * @param bool $has_more
    11  * @param mixed $data
     8 * @property string $object
     9 * @property string $url
     10 * @property bool $has_more
     11 * @property mixed $data
    1212 *
    1313 * @package Stripe
  • gravity-forms-stripe/trunk/includes/api/stripe-php/lib/HttpClient/CurlClient.php

    r1504158 r1517034  
    66use PPP\Stripe\Error;
    77use PPP\Stripe\Util;
     8
     9// cURL constants are not defined in PHP < 5.5
     10
     11// @codingStandardsIgnoreStart
     12// PSR2 requires all constants be upper case. Sadly, the CURL_SSLVERSION
     13// constants do not abide by those rules.
     14
     15// Note the values 1 and 6 come from their position in the enum that
     16// defines them in cURL's source code.
     17if (!defined('CURL_SSLVERSION_TLSv1')) {
     18    define('CURL_SSLVERSION_TLSv1', 1);
     19}
     20if (!defined('CURL_SSLVERSION_TLSv1_2')) {
     21    define('CURL_SSLVERSION_TLSv1_2', 6);
     22}
     23// @codingStandardsIgnoreEnd
    824
    925class CurlClient implements ClientInterface
     
    151167            $opts[CURLOPT_SSL_VERIFYPEER] = false;
    152168        }
    153 
    154         // @codingStandardsIgnoreStart
    155         // PSR2 requires all constants be upper case. Sadly, the CURL_SSLVERSION
    156         // constants to not abide by those rules.
    157         //
    158         // Explicitly set a TLS version for cURL to use now that we're starting
    159         // to block 1.0 and 1.1 requests.
    160         //
    161         // If users are on OpenSSL >= 1.0.1, we know that they support TLS 1.2,
    162         // so set that explicitly because on some older Linux distros, clients may
    163         // default to TLS 1.0 even when they have TLS 1.2 available.
    164         //
    165         // For users on much older versions of OpenSSL, set a valid range of
    166         // TLS 1.0 to 1.2 (CURL_SSLVERSION_TLSv1). Note that this may result in
    167         // their requests being blocked unless they're specially flagged into
    168         // being able to use an old TLS version.
    169         //
    170         // Note: The int on the right is pulled from the source of OpenSSL 1.0.1a.
    171         if (OPENSSL_VERSION_NUMBER >= 0x1000100f) {
    172             if (!defined('CURL_SSLVERSION_TLSv1_2')) {
    173                 // Note the value 6 comes from its position in the enum that
    174                 // defines it in cURL's source code.
    175                 define('CURL_SSLVERSION_TLSv1_2', 6); // constant not defined in PHP < 5.5
    176             }
    177             $opts[CURLOPT_SSLVERSION] = CURL_SSLVERSION_TLSv1_2;
    178         } else {
    179             if (!defined('CURL_SSLVERSION_TLSv1')) {
    180                 define('CURL_SSLVERSION_TLSv1', 1); // constant not defined in PHP < 5.5
    181             }
    182             $opts[CURLOPT_SSLVERSION] = CURL_SSLVERSION_TLSv1;
    183         }
    184         // @codingStandardsIgnoreEnd
    185169
    186170        curl_setopt_array($curl, $opts);
  • gravity-forms-stripe/trunk/includes/api/stripe-php/lib/Stripe.php

    r1504158 r1517034  
    2828    public static $verifySslCerts = true;
    2929
    30     const VERSION = '3.21.0';
     30    // @var array The application's information (name, version, URL)
     31    public static $appInfo = null;
     32
     33    const VERSION = '4.0.1';
    3134
    3235    /**
     
    98101        self::$accountId = $accountId;
    99102    }
     103
     104    /**
     105     * @return array | null The application's information
     106     */
     107    public static function getAppInfo()
     108    {
     109        return self::$appInfo;
     110    }
     111
     112    /**
     113     * @param string $appName The application's name
     114     * @param string $appVersion The application's version
     115     * @param string $appUrl The application's URL
     116     */
     117    public static function setAppInfo($appName, $appVersion = null, $appUrl = null)
     118    {
     119        if (self::$appInfo === null) {
     120            self::$appInfo = array();
     121        }
     122        self::$appInfo['name'] = $appName;
     123        self::$appInfo['version'] = $appVersion;
     124        self::$appInfo['url'] = $appUrl;
     125    }
    100126}
  • gravity-forms-stripe/trunk/includes/api/stripe-php/lib/Util/Util.php

    r1504158 r1517034  
    6767            'account' => 'PPP\\Stripe\\Account',
    6868            'alipay_account' => 'PPP\\Stripe\\AlipayAccount',
     69            'apple_pay_domain' => 'PPP\\Stripe\\ApplePayDomain',
    6970            'bank_account' => 'PPP\\Stripe\\BankAccount',
    7071            'balance_transaction' => 'PPP\\Stripe\\BalanceTransaction',
     
    8283            'token' => 'PPP\\Stripe\\Token',
    8384            'transfer' => 'PPP\\Stripe\\Transfer',
     85            'transfer_reversal' => 'PPP\\Stripe\\TransferReversal',
    8486            'order' => 'PPP\\Stripe\\Order',
    8587            'order_return' => 'PPP\\Stripe\\OrderReturn',
     
    9193            'source' => 'PPP\\Stripe\\Source',
    9294            'subscription' => 'PPP\\Stripe\\Subscription',
     95            'subscription_item' => 'PPP\\Stripe\\SubscriptionItem',
    9396            'three_d_secure' => 'PPP\\Stripe\\ThreeDSecure',
    9497            'fee_refund' => 'PPP\\Stripe\\ApplicationFeeRefund',
  • gravity-forms-stripe/trunk/includes/class-gfp-stripe.php

    r1371732 r1517034  
    22/**
    33 * @package   GFP_Stripe
    4  * @copyright 2013-2014 gravity+
     4 * @copyright 2013-2016 gravity+
    55 * @license   GPL-2.0+
    66 * @since     0.1.0
     
    4545     * @var string
    4646     */
    47     private static $version = '1.9.2.7';
     47    private static $version = '1.9.2.9';
    4848
    4949    /**
  • gravity-forms-stripe/trunk/readme.txt

    r1504158 r1517034  
    44Tags: stripe, form, forms, gravity, gravity form, gravity forms, gravityforms, payment, payments, subscribe, subscriptions, recurring billing, paypal, authorize.net, credit cards, online payment, ecommerce, membership
    55Requires at least: 3.9
    6 Tested up to: 4.5
    7 Stable tag: 1.9.2.8
     6Tested up to: 4.6
     7Stable tag: 1.9.2.9
    88
    99Build your own completely custom credit card payment forms with Stripe & Gravity Forms!
     
    168168
    169169== Changelog ==
     170
     171= 1.9.2.9 (Oct 2016) =
     172
     173* **Processing**
     174
     175    * Add latest Stripe API changes
     176
     177* **Developers**
     178
     179    * Update to latest Stripe PHP library
    170180
    171181= 1.9.2.8 (Sep 2016) =
     
    663673
    664674== Upgrade Notice ==
     675= 1.9.2.9 =
     676DO NOT UPDATE if you are using More Stripe and don't have version 1.9 or greater (email support for latest version). Update Stripe PHP library.
     677
    665678= 1.9.2.8 =
    666679DO NOT UPDATE if you are using More Stripe and don't have version 1.9 or greater (email support for latest version). Update Stripe PHP library.
Note: See TracChangeset for help on using the changeset viewer.