Skip to content

Commit

Permalink
Merge pull request #461 from ChessCom/bump-stripe
Browse files Browse the repository at this point in the history
Updates stripe api to 3.6
  • Loading branch information
makasim committed Jan 22, 2016
2 parents 36b3644 + 8737a00 commit bd2fbd5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
9 changes: 6 additions & 3 deletions Action/Api/CreateChargeAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
use Payum\Core\Exception\UnsupportedApiException;
use Payum\Stripe\Keys;
use Payum\Stripe\Request\Api\CreateCharge;
use Stripe\Charge;
use Stripe\Error;
use Stripe\Stripe;

class CreateChargeAction implements ActionInterface, ApiAwareInterface
{
Expand Down Expand Up @@ -48,12 +51,12 @@ public function execute($request)
}

try {
\Stripe::setApiKey($this->keys->getSecretKey());
Stripe::setApiKey($this->keys->getSecretKey());

$charge = \Stripe_Charge::create($model->toUnsafeArray());
$charge = Charge::create($model->toUnsafeArray());

$model->replace($charge->__toArray(true));
} catch (\Stripe_CardError $e) {
} catch (Error\Card $e) {
$model->replace($e->getJsonBody());
}
}
Expand Down
10 changes: 7 additions & 3 deletions Action/Api/CreateCustomerAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
use Payum\Stripe\Keys;
use Payum\Stripe\Request\Api\CreateCharge;
use Payum\Stripe\Request\Api\ObtainToken;
use Stripe\Customer;
use Stripe\Error;
use Stripe\Stripe;


class CreateCustomerAction extends GatewayAwareAction implements ApiAwareInterface
{
Expand Down Expand Up @@ -46,12 +50,12 @@ public function execute($request)
}

try {
\Stripe::setApiKey($this->keys->getSecretKey());
Stripe::setApiKey($this->keys->getSecretKey());

$charge = \Stripe_Customer::create($model->toUnsafeArray());
$charge = Customer::create($model->toUnsafeArray());

$model->replace($charge->__toArray(true));
} catch (\Stripe_CardError $e) {
} catch (Error\Card $e) {
$model->replace($e->getJsonBody());
}
}
Expand Down
4 changes: 2 additions & 2 deletions StripeCheckoutGatewayFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class StripeCheckoutGatewayFactory extends GatewayFactory
*/
protected function populateConfig(ArrayObject $config)
{
if (!class_exists('Stripe')) {
throw new \LogicException('You must install "stripe/stripe-php" library.');
if (!class_exists('\Stripe\Stripe')) {
throw new \LogicException('You must install "stripe/stripe-php:~2.0|~3.0" library.');
}

$config->defaults(array(
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
],
"require": {
"payum/core": "~1.0",
"stripe/stripe-php": "~1.0"
"stripe/stripe-php": "~2.0|~3.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
Expand Down

0 comments on commit bd2fbd5

Please sign in to comment.