Skip to content

Commit 643c1c4

Browse files
author
epriestley
committedJul 13, 2014
Update Stripe PHP API
Summary: Ref T2787. This brings us up to date. Test Plan: `git clone` Reviewers: btrahan, chad Reviewed By: chad Subscribers: epriestley Maniphest Tasks: T2787 Differential Revision: https://secure.phabricator.com/D9916
1 parent 3a59cff commit 643c1c4

37 files changed

+6473
-3735
lines changed
 

‎externals/stripe-php/.travis.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
language: php
2+
3+
php:
4+
- 5.2
5+
- 5.3
6+
- 5.4
7+
- 5.5
8+
- 5.6
9+
- hhvm
10+
11+
before_script:
12+
- sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.2' ]; then wget http://iweb.dl.sourceforge.net/project/simpletest/simpletest/simpletest_1.1/simpletest_1.1.0.tar.gz; tar xf simpletest_1.1.0.tar.gz -C test; else composer install --dev --prefer-source; fi"
13+
- sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.6' ]; then pear install pear/PHP_CodeSniffer; phpenv rehash; fi"
14+
15+
script:
16+
- sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.6' ]; then phpcs --standard=zend --encoding=UTF-8 --ignore=vendor -p ./; fi"
17+
- php test/Stripe.php

‎externals/stripe-php/CHANGELOG

+156
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
=== 1.16.0 2014-06-17
2+
3+
* Add metadata for refunds and disputes
4+
5+
=== 1.15.0 2014-05-28
6+
7+
* Support canceling transfers
8+
9+
=== 1.14.1 2014-05-21
10+
11+
* Support cards for recipients.
12+
13+
=== 1.13.1 2014-05-15
14+
15+
* Fix bug in account resource where `id` wasn't in the result
16+
17+
=== 1.13.0 2014-04-10
18+
19+
* Add support for certificate blacklisting
20+
* Update ca bundle
21+
* Drop support for HHVM (Temporarily)
22+
23+
=== 1.12.0 2014-04-01
24+
25+
* Add Stripe_RateLimitError for catching rate limit errors.
26+
* Update to Zend coding style (thanks, @jpiasetz)
27+
28+
=== 1.11.0 2014-01-29
29+
30+
* Add support for multiple subscriptions per customer
31+
32+
=== 1.10.1 2013-12-02
33+
34+
* Add new ApplicationFee
35+
36+
=== 1.9.1 2013-11-08
37+
38+
* Fix a bug where a null nestable object causes warnings to fire.
39+
40+
=== 1.9.0 2013-10-16
41+
42+
* Add support for metadata API.
43+
44+
=== 1.8.4 2013-09-18
45+
46+
* Add support for closing disputes.
47+
48+
=== 1.8.3 2013-08-13
49+
50+
* Add new Balance and BalanceTransaction
51+
52+
=== 1.8.2 2013-08-12
53+
54+
* Add support for unsetting attributes by updating to NULL.
55+
Setting properties to a blank string is now an error.
56+
57+
=== 1.8.1 2013-07-12
58+
59+
* Add support for multiple cards API (Stripe API version 2013-07-12: https://stripe.com/docs/upgrades#2013-07-05)
60+
61+
=== 1.8.0 2013-04-11
62+
63+
* Allow Transfers to be creatable
64+
* Add new Recipient resource
65+
66+
=== 1.7.15 2013-02-21
67+
68+
* Add 'id' to the list of permanent object attributes
69+
70+
=== 1.7.14 2013-02-20
71+
72+
* Don't re-encode strings that are already encoded in UTF-8. If you
73+
were previously using plan or coupon objects with UTF-8 IDs, they
74+
may have been treated as ISO-8859-1 (Latin-1) and encoded to UTF-8 a
75+
2nd time. You may now need to pass the IDs to utf8_encode before
76+
passing them to Stripe_Plan::retrieve or Stripe_Coupon::retrieve.
77+
* Ensure that all input is encoded in UTF-8 before submitting it to
78+
Stripe's servers. (github issue #27)
79+
80+
=== 1.7.13 2013-02-01
81+
82+
* Add support for passing options when retrieving Stripe objects
83+
e.g., Stripe_Charge::retrieve(array("id"=>"foo", "expand" => array("customer")))
84+
Stripe_Charge::retrieve("foo") will continue to work
85+
86+
=== 1.7.12 2013-01-15
87+
88+
* Add support for setting a Stripe API version override
89+
90+
=== 1.7.11 2012-12-30
91+
92+
* Version bump to cleanup constants and such (github issue #26)
93+
94+
=== 1.7.10 2012-11-08
95+
96+
* Add support for updating charge disputes.
97+
* Fix bug preventing retrieval of null attributes
98+
99+
=== 1.7.9 2012-11-08
100+
101+
* Fix usage under autoloaders such as the one generated by composer
102+
(github issue #22)
103+
104+
=== 1.7.8 2012-10-30
105+
* Add support for creating invoices.
106+
* Add support for new invoice lines return format
107+
* Add support for new list objects
108+
109+
=== 1.7.7 2012-09-14
110+
111+
* Get all of the various version numbers in the repo in sync (no other
112+
changes)
113+
114+
=== 1.7.6 2012-08-31
115+
116+
* Add update and pay methods to Invoice resource
117+
118+
=== 1.7.5 2012-08-23
119+
120+
* Change internal function names so that Stripe_SingletonApiRequest is
121+
E_STRICT-clean (github issue #16)
122+
123+
=== 1.7.4 2012-08-21
124+
125+
* Bugfix so that Stripe objects (e.g. Customer, Charge objects) used
126+
in API calls are transparently converted to their object IDs
127+
128+
=== 1.7.3 2012-08-15
129+
130+
* Add new Account resource
131+
132+
=== 1.7.2 2012-06-26
133+
134+
* Make clearer that you should be including lib/Stripe.php, not
135+
test/Stripe.php (github issue #14)
136+
137+
=== 1.7.1 2012-05-24
138+
139+
* Add missing argument to Stripe_InvalidRequestError constructor in
140+
Stripe_ApiResource::instanceUrl. Fixes a warning when
141+
Stripe_ApiResource::instanceUrl is called on a resource with no ID
142+
(github issue #12)
143+
144+
=== 1.7.0 2012-05-17
145+
146+
* Support Composer and Packagist (github issue #9)
147+
148+
* Add new deleteDiscount method to Stripe_Customer
149+
150+
* Add new Transfer resource
151+
152+
* Switch from using HTTP Basic auth to Bearer auth. (Note: Stripe will
153+
support Basic auth for the indefinite future, but recommends Bearer
154+
auth when possible going forward)
155+
156+
* Numerous test suite improvements

‎externals/stripe-php/LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License
22

3-
Copyright (c) 2010 Stripe
3+
Copyright (c) 2010-2014 Stripe
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

‎externals/stripe-php/README.rdoc

+50-3
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,67 @@
1-
= Installation
1+
= Stripe PHP bindings
2+
{<img src="https://travis-ci.org/stripe/stripe-php.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/stripe/stripe-php]
3+
{<img src="https://poser.pugx.org/stripe/stripe-php/v/stable.svg" alt="Latest Stable Version" />}[https://packagist.org/packages/stripe/stripe-php]
4+
{<img src="https://poser.pugx.org/stripe/stripe-php/downloads.svg" alt="Total Downloads" />}[https://packagist.org/packages/stripe/stripe-php]
5+
{<img src="https://poser.pugx.org/stripe/stripe-php/license.svg" alt="License" />}[https://packagist.org/packages/stripe/stripe-php]
6+
7+
You can sign up for a Stripe account at https://stripe.com.
8+
9+
== Requirements
10+
11+
PHP 5.2 and later.
12+
13+
== Composer
14+
15+
You can install the bindings via Composer[http://getcomposer.org/]. Add this to your +composer.json+:
16+
17+
{
18+
"require": {
19+
"stripe/stripe-php": "1.*"
20+
}
21+
}
22+
23+
Then install via:
24+
25+
composer.phar install
26+
27+
To use the bindings, either user Composer's autoload[https://getcomposer.org/doc/00-intro.md#autoloading]:
28+
29+
require_once('vendor/autoload.php');
30+
31+
Or manually:
32+
33+
require_once('/path/to/vendor/stripe/stripe-php/lib/Stripe.php');
34+
35+
== Manual Installation
236

337
Obtain the latest version of the Stripe PHP bindings with:
438

539
git clone https://github.com/stripe/stripe-php
640

7-
To get started, add the following to your PHP script:
41+
To use the bindings, add the following to your PHP script:
842

943
require_once("/path/to/stripe-php/lib/Stripe.php");
1044

45+
== Getting Started
46+
1147
Simple usage looks like:
1248

1349
Stripe::setApiKey('d8e8fca2dc0f896fd7cb4cb0031ba249');
1450
$myCard = array('number' => '4242424242424242', 'exp_month' => 5, 'exp_year' => 2015);
1551
$charge = Stripe_Charge::create(array('card' => $myCard, 'amount' => 2000, 'currency' => 'usd'));
1652
echo $charge;
1753

18-
= Documentation
54+
== Documentation
1955

2056
Please see https://stripe.com/api for up-to-date documentation.
57+
58+
== Tests
59+
60+
In order to run tests you have to install SimpleTest[http://packagist.org/packages/simpletest/simpletest] via Composer[http://getcomposer.org/] (recommended way):
61+
62+
composer.phar update --dev
63+
64+
Run test suite:
65+
66+
php ./test/Stripe.php
67+

‎externals/stripe-php/VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.6.3
1+
1.16.0

‎externals/stripe-php/composer.json

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "stripe/stripe-php",
3+
"description": "Stripe PHP Library",
4+
"keywords": [
5+
"stripe",
6+
"payment processing",
7+
"api"
8+
],
9+
"homepage": "https://stripe.com/",
10+
"license": "MIT",
11+
"authors": [
12+
{
13+
"name": "Stripe and contributors",
14+
"homepage": "https://github.com/stripe/stripe-php/contributors"
15+
}
16+
],
17+
"require": {
18+
"php": ">=5.2",
19+
"ext-curl": "*",
20+
"ext-json": "*",
21+
"ext-mbstring": "*"
22+
},
23+
"require-dev": {
24+
"simpletest/simpletest": "*"
25+
},
26+
"autoload": {
27+
"classmap": ["lib/Stripe/"]
28+
}
29+
}

‎externals/stripe-php/lib/Stripe.php

+18-27
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,12 @@
99
if (!function_exists('json_decode')) {
1010
throw new Exception('Stripe needs the JSON PHP extension.');
1111
}
12-
13-
14-
abstract class Stripe
15-
{
16-
public static $apiKey;
17-
public static $apiBase = 'https://api.stripe.com/v1';
18-
public static $verifySslCerts = true;
19-
const VERSION = '1.6.3';
20-
21-
public static function getApiKey()
22-
{
23-
return self::$apiKey;
24-
}
25-
26-
public static function setApiKey($apiKey)
27-
{
28-
self::$apiKey = $apiKey;
29-
}
30-
31-
public static function getVerifySslCerts() {
32-
return self::$verifySslCerts;
33-
}
34-
35-
public static function setVerifySslCerts($verify) {
36-
self::$verifySslCerts = $verify;
37-
}
12+
if (!function_exists('mb_detect_encoding')) {
13+
throw new Exception('Stripe needs the Multibyte String PHP extension.');
3814
}
3915

16+
// Stripe singleton
17+
require(dirname(__FILE__) . '/Stripe/Stripe.php');
4018

4119
// Utilities
4220
require(dirname(__FILE__) . '/Stripe/Util.php');
@@ -49,18 +27,31 @@ public static function setVerifySslCerts($verify) {
4927
require(dirname(__FILE__) . '/Stripe/AuthenticationError.php');
5028
require(dirname(__FILE__) . '/Stripe/CardError.php');
5129
require(dirname(__FILE__) . '/Stripe/InvalidRequestError.php');
30+
require(dirname(__FILE__) . '/Stripe/RateLimitError.php');
5231

5332
// Plumbing
5433
require(dirname(__FILE__) . '/Stripe/Object.php');
5534
require(dirname(__FILE__) . '/Stripe/ApiRequestor.php');
5635
require(dirname(__FILE__) . '/Stripe/ApiResource.php');
36+
require(dirname(__FILE__) . '/Stripe/SingletonApiResource.php');
37+
require(dirname(__FILE__) . '/Stripe/AttachedObject.php');
38+
require(dirname(__FILE__) . '/Stripe/List.php');
5739

5840
// Stripe API Resources
41+
require(dirname(__FILE__) . '/Stripe/Account.php');
42+
require(dirname(__FILE__) . '/Stripe/Card.php');
43+
require(dirname(__FILE__) . '/Stripe/Balance.php');
44+
require(dirname(__FILE__) . '/Stripe/BalanceTransaction.php');
5945
require(dirname(__FILE__) . '/Stripe/Charge.php');
6046
require(dirname(__FILE__) . '/Stripe/Customer.php');
6147
require(dirname(__FILE__) . '/Stripe/Invoice.php');
6248
require(dirname(__FILE__) . '/Stripe/InvoiceItem.php');
6349
require(dirname(__FILE__) . '/Stripe/Plan.php');
50+
require(dirname(__FILE__) . '/Stripe/Subscription.php');
6451
require(dirname(__FILE__) . '/Stripe/Token.php');
6552
require(dirname(__FILE__) . '/Stripe/Coupon.php');
66-
require(dirname(__FILE__) . '/Stripe/Event.php');
53+
require(dirname(__FILE__) . '/Stripe/Event.php');
54+
require(dirname(__FILE__) . '/Stripe/Transfer.php');
55+
require(dirname(__FILE__) . '/Stripe/Recipient.php');
56+
require(dirname(__FILE__) . '/Stripe/Refund.php');
57+
require(dirname(__FILE__) . '/Stripe/ApplicationFee.php');
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
class Stripe_Account extends Stripe_SingletonApiResource
4+
{
5+
/**
6+
* @param string|null $apiKey
7+
*
8+
* @return Stripe_Account
9+
*/
10+
public static function retrieve($apiKey=null)
11+
{
12+
$class = get_class();
13+
return self::_scopedSingletonRetrieve($class, $apiKey);
14+
}
15+
}

0 commit comments

Comments
 (0)
Failed to load comments.