diff --git a/.travis.yml b/.travis.yml old mode 100644 new mode 100755 diff --git a/Action/Api/CreateChargeAction.php b/Action/Api/CreateChargeAction.php old mode 100644 new mode 100755 diff --git a/Action/Api/CreateCustomerAction.php b/Action/Api/CreateCustomerAction.php old mode 100644 new mode 100755 diff --git a/Action/Api/CreatePlanAction.php b/Action/Api/CreatePlanAction.php old mode 100644 new mode 100755 diff --git a/Action/Api/CreateProductAction.php b/Action/Api/CreateProductAction.php new file mode 100755 index 0000000..fa9ff83 --- /dev/null +++ b/Action/Api/CreateProductAction.php @@ -0,0 +1,82 @@ +api + * + * @var Keys + */ + protected $keys; + + public function __construct() + { + $this->apiClass = Keys::class; + } + + /** + * {@inheritDoc} + */ + public function setApi($api) + { + $this->_setApi($api); + + // BC. will be removed in 2.x + $this->keys = $this->api; + } + + /** + * {@inheritDoc} + */ + public function execute($request) + { + /** @var $request CreatePlan */ + RequestNotSupportedException::assertSupports($this, $request); + + $model = ArrayObject::ensureArrayObject($request->getModel()); + + try { + Stripe::setApiKey($this->keys->getSecretKey()); + + $product = Product::create($model->toUnsafeArrayWithoutLocal()); + + $model->replace($plan->__toArray(true)); + } catch (Error\Base $e) { + $model->replace($e->getJsonBody()); + } + } + + /** + * {@inheritDoc} + */ + public function supports($request) + { + return + $request instanceof CreateProduct && + $request->getModel() instanceof \ArrayAccess + ; + } +} diff --git a/Action/Api/CreateSubscriptionAction.php b/Action/Api/CreateSubscriptionAction.php old mode 100644 new mode 100755 diff --git a/Action/Api/CreateTokenAction.php b/Action/Api/CreateTokenAction.php old mode 100644 new mode 100755 diff --git a/Action/Api/CreateTokenForCreditCardAction.php b/Action/Api/CreateTokenForCreditCardAction.php old mode 100644 new mode 100755 diff --git a/Action/Api/ObtainTokenAction.php b/Action/Api/ObtainTokenAction.php old mode 100644 new mode 100755 diff --git a/Action/Api/ObtainTokenForCreditCardAction.php b/Action/Api/ObtainTokenForCreditCardAction.php old mode 100644 new mode 100755 diff --git a/Action/CaptureAction.php b/Action/CaptureAction.php old mode 100644 new mode 100755 diff --git a/Action/ConvertPaymentAction.php b/Action/ConvertPaymentAction.php old mode 100644 new mode 100755 diff --git a/Action/GetCreditCardTokenAction.php b/Action/GetCreditCardTokenAction.php old mode 100644 new mode 100755 diff --git a/Action/StatusAction.php b/Action/StatusAction.php old mode 100644 new mode 100755 diff --git a/CHANGELOG.md b/CHANGELOG.md old mode 100644 new mode 100755 diff --git a/Constants.php b/Constants.php old mode 100644 new mode 100755 diff --git a/Extension/CreateCustomerExtension.php b/Extension/CreateCustomerExtension.php old mode 100644 new mode 100755 diff --git a/Keys.php b/Keys.php old mode 100644 new mode 100755 diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/Request/Api/CreateCharge.php b/Request/Api/CreateCharge.php old mode 100644 new mode 100755 diff --git a/Request/Api/CreateCustomer.php b/Request/Api/CreateCustomer.php old mode 100644 new mode 100755 diff --git a/Request/Api/CreatePlan.php b/Request/Api/CreatePlan.php old mode 100644 new mode 100755 diff --git a/Request/Api/CreateProduct.php b/Request/Api/CreateProduct.php new file mode 100755 index 0000000..f26126b --- /dev/null +++ b/Request/Api/CreateProduct.php @@ -0,0 +1,8 @@ + new CreateSubscriptionAction(), 'payum.extension.create_customer' => new CreateCustomerExtension(), + + 'payum.action.create_product' => new CreateProductAction(), ]); if (false == $config['payum.api']) { diff --git a/StripeDirectGatewayFactory.php b/StripeDirectGatewayFactory.php old mode 100644 new mode 100755 diff --git a/StripeJsGatewayFactory.php b/StripeJsGatewayFactory.php old mode 100644 new mode 100755 diff --git a/Tests/Action/Api/CreateChargeActionTest.php b/Tests/Action/Api/CreateChargeActionTest.php old mode 100644 new mode 100755 diff --git a/Tests/Action/Api/CreateCustomerActionTest.php b/Tests/Action/Api/CreateCustomerActionTest.php old mode 100644 new mode 100755 diff --git a/Tests/Action/Api/CreatePlanActionTest.php b/Tests/Action/Api/CreatePlanActionTest.php old mode 100644 new mode 100755 diff --git a/Tests/Action/Api/ObtainTokenActionTest.php b/Tests/Action/Api/ObtainTokenActionTest.php old mode 100644 new mode 100755 diff --git a/Tests/Action/CaptureActionTest.php b/Tests/Action/CaptureActionTest.php old mode 100644 new mode 100755 diff --git a/Tests/Action/ConvertPaymentActionTest.php b/Tests/Action/ConvertPaymentActionTest.php old mode 100644 new mode 100755 diff --git a/Tests/Action/GetCreditCardTokenActionTest.php b/Tests/Action/GetCreditCardTokenActionTest.php old mode 100644 new mode 100755 diff --git a/Tests/Action/StatusActionTest.php b/Tests/Action/StatusActionTest.php old mode 100644 new mode 100755 diff --git a/Tests/Extension/CreateCustomerExtensionTest.php b/Tests/Extension/CreateCustomerExtensionTest.php old mode 100644 new mode 100755 diff --git a/Tests/Functional/Resources/Views/ObtainTokenTemplateTest.php b/Tests/Functional/Resources/Views/ObtainTokenTemplateTest.php old mode 100644 new mode 100755 diff --git a/Tests/KeysTest.php b/Tests/KeysTest.php old mode 100644 new mode 100755 diff --git a/Tests/Request/Api/CreateChargeTest.php b/Tests/Request/Api/CreateChargeTest.php old mode 100644 new mode 100755 diff --git a/Tests/Request/Api/CreateCustomerTest.php b/Tests/Request/Api/CreateCustomerTest.php old mode 100644 new mode 100755 diff --git a/Tests/Request/Api/CreatePlanTest.php b/Tests/Request/Api/CreatePlanTest.php old mode 100644 new mode 100755 diff --git a/Tests/Request/Api/ObtainTokenTest.php b/Tests/Request/Api/ObtainTokenTest.php old mode 100644 new mode 100755 diff --git a/Tests/StripeCheckoutGatewayFactoryTest.php b/Tests/StripeCheckoutGatewayFactoryTest.php old mode 100644 new mode 100755 diff --git a/Tests/StripeJsGatewayFactoryTest.php b/Tests/StripeJsGatewayFactoryTest.php old mode 100644 new mode 100755 diff --git a/Tests/bootstrap.php b/Tests/bootstrap.php old mode 100644 new mode 100755 diff --git a/UPGRADE.md b/UPGRADE.md old mode 100644 new mode 100755 diff --git a/composer.json b/composer.json old mode 100644 new mode 100755 diff --git a/phpunit.xml.dist b/phpunit.xml.dist old mode 100644 new mode 100755