From 5e6d7c15c65636c6b1c5ecdc4661463b170a4bf3 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Thu, 17 Mar 2016 14:02:58 +0200 Subject: [PATCH 01/28] Changed .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 1edf419..9fda229 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ /app/cache/* /app/logs/* /app/config/config_dev_local.yml +/app/config/config_prod_local.yml +/app/config/config_test_local.yml /app/config/parameters.yml /app/Resources/payments /build/ From a418f733547f67ad3ff63df6e3baa3ff19e6b97f Mon Sep 17 00:00:00 2001 From: Dmitry Date: Thu, 17 Mar 2016 14:04:55 +0200 Subject: [PATCH 02/28] Added app.php & app_dev.php according to modern official userguide --- web/app.php | 6 ++++++ web/app_dev.php | 6 ++++++ web/index.php | 2 -- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 web/app.php create mode 100644 web/app_dev.php diff --git a/web/app.php b/web/app.php new file mode 100644 index 0000000..f1e796d --- /dev/null +++ b/web/app.php @@ -0,0 +1,6 @@ + Date: Thu, 17 Mar 2016 14:20:36 +0200 Subject: [PATCH 03/28] Updated AppKernel.php to use local configs too --- app/AppKernel.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/AppKernel.php b/app/AppKernel.php index a233281..381fad8 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -60,6 +60,10 @@ public function registerBundles() public function registerContainerConfiguration(LoaderInterface $loader) { - $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml'); + $config = __DIR__.'/config/config_'.$this->getEnvironment().'.yml'; + if (file_exists(__DIR__.'/config/config_'.$this->getEnvironment().'_local.yml')) { + $config = __DIR__.'/config/config_'.$this->getEnvironment().'_local.yml'; + } + $loader->load($config); } } From 704bf4b127ed29066e2cfb99c0f62015ae7aac9e Mon Sep 17 00:00:00 2001 From: Dmitry Date: Thu, 17 Mar 2016 14:27:26 +0200 Subject: [PATCH 04/28] Added variables initialization to index.php (to make env selection work only for index.php too) --- web/index.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/web/index.php b/web/index.php index 070c062..ee42226 100644 --- a/web/index.php +++ b/web/index.php @@ -1,5 +1,8 @@ Date: Mon, 28 Mar 2016 14:46:26 +0300 Subject: [PATCH 05/28] Added PayPal permissions SDK to dependencies --- composer.json | 3 +- composer.lock | 295 +++++++++++++++++++++++++++++++++----------------- 2 files changed, 199 insertions(+), 99 deletions(-) diff --git a/composer.json b/composer.json index 22acebd..c8fab18 100644 --- a/composer.json +++ b/composer.json @@ -41,7 +41,8 @@ "stripe/stripe-php": "^2.0", "sofort/sofortlib-php": "^3.0", "phpunit/phpunit": "^4.0", - "fabpot/php-cs-fixer": "^1.10" + "fabpot/php-cs-fixer": "^1.10", + "paypal/permissions-sdk-php": "^3.9" }, "scripts": { "post-install-cmd": [ diff --git a/composer.lock b/composer.lock index b294471..aac9975 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "4ebb778750cffab88465a0e72688da7f", - "content-hash": "6c563a4e4fedebe97bbfa3e3a108fe18", + "hash": "8f732cc820cbf251a82bfb08ff4ceb07", + "content-hash": "d084cfc4d091c8f99f9ab2043b4a6af5", "packages": [ { "name": "authorizenet/authorizenet", @@ -873,30 +873,36 @@ }, { "name": "doctrine/mongodb", - "version": "1.2.1", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/doctrine/mongodb.git", - "reference": "7a724d9f200b032afc69ee1ad373f6fe5bcbdd9a" + "reference": "b4eb8683d66d44de4e9e4e974149bdce327dc818" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/mongodb/zipball/7a724d9f200b032afc69ee1ad373f6fe5bcbdd9a", - "reference": "7a724d9f200b032afc69ee1ad373f6fe5bcbdd9a", + "url": "https://api.github.com/repos/doctrine/mongodb/zipball/b4eb8683d66d44de4e9e4e974149bdce327dc818", + "reference": "b4eb8683d66d44de4e9e4e974149bdce327dc818", "shasum": "" }, "require": { "doctrine/common": "^2.2", - "ext-mongo": "^1.2.12", - "php": ">=5.3.2" + "ext-mongo": "^1.5", + "php": "^5.5 || ^7.0" }, "require-dev": { - "jmikola/geojson": "^1.0" + "jmikola/geojson": "^1.0", + "phpunit/phpunit": "~4.8|~5.0" }, "suggest": { "jmikola/geojson": "Support GeoJSON geometry objects in 2dsphere queries" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, "autoload": { "psr-0": { "Doctrine\\MongoDB": "lib/" @@ -939,7 +945,7 @@ "mongodb", "persistence" ], - "time": "2015-11-24 13:28:35" + "time": "2016-03-19 18:45:48" }, { "name": "doctrine/mongodb-odm", @@ -1353,16 +1359,16 @@ }, { "name": "guzzlehttp/guzzle", - "version": "6.1.1", + "version": "6.2.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "c6851d6e48f63b69357cbfa55bca116448140e0c" + "reference": "d094e337976dff9d8e2424e8485872194e768662" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/c6851d6e48f63b69357cbfa55bca116448140e0c", - "reference": "c6851d6e48f63b69357cbfa55bca116448140e0c", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/d094e337976dff9d8e2424e8485872194e768662", + "reference": "d094e337976dff9d8e2424e8485872194e768662", "shasum": "" }, "require": { @@ -1378,7 +1384,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "6.1-dev" + "dev-master": "6.2-dev" } }, "autoload": { @@ -1411,20 +1417,20 @@ "rest", "web service" ], - "time": "2015-11-23 00:47:50" + "time": "2016-03-21 20:02:09" }, { "name": "guzzlehttp/promises", - "version": "1.0.3", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "b1e1c0d55f8083c71eda2c28c12a228d708294ea" + "reference": "bb9024c526b22f3fe6ae55a561fd70653d470aa8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/b1e1c0d55f8083c71eda2c28c12a228d708294ea", - "reference": "b1e1c0d55f8083c71eda2c28c12a228d708294ea", + "url": "https://api.github.com/repos/guzzle/promises/zipball/bb9024c526b22f3fe6ae55a561fd70653d470aa8", + "reference": "bb9024c526b22f3fe6ae55a561fd70653d470aa8", "shasum": "" }, "require": { @@ -1462,7 +1468,7 @@ "keywords": [ "promise" ], - "time": "2015-10-15 22:28:00" + "time": "2016-03-08 01:15:46" }, { "name": "guzzlehttp/psr7", @@ -2234,16 +2240,16 @@ }, { "name": "monolog/monolog", - "version": "1.18.0", + "version": "1.18.1", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "e19b764b5c855580e8ffa7e615f72c10fd2f99cc" + "reference": "a5f2734e8c16f3aa21b3da09715d10e15b4d2d45" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/e19b764b5c855580e8ffa7e615f72c10fd2f99cc", - "reference": "e19b764b5c855580e8ffa7e615f72c10fd2f99cc", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/a5f2734e8c16f3aa21b3da09715d10e15b4d2d45", + "reference": "a5f2734e8c16f3aa21b3da09715d10e15b4d2d45", "shasum": "" }, "require": { @@ -2308,20 +2314,20 @@ "logging", "psr-3" ], - "time": "2016-03-01 18:00:40" + "time": "2016-03-13 16:08:35" }, { "name": "omnipay/common", - "version": "v2.4.1", + "version": "v2.5.0", "source": { "type": "git", "url": "https://github.com/thephpleague/omnipay-common.git", - "reference": "5a618b4083a63b2e1405529d16c8d546a6788921" + "reference": "550138529e850143af7a87eab8cfe16e72a2f768" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/omnipay-common/zipball/5a618b4083a63b2e1405529d16c8d546a6788921", - "reference": "5a618b4083a63b2e1405529d16c8d546a6788921", + "url": "https://api.github.com/repos/thephpleague/omnipay-common/zipball/550138529e850143af7a87eab8cfe16e72a2f768", + "reference": "550138529e850143af7a87eab8cfe16e72a2f768", "shasum": "" }, "require": { @@ -2404,7 +2410,7 @@ "payment", "purchase" ], - "time": "2016-01-27 03:04:53" + "time": "2016-03-10 03:03:17" }, { "name": "omnipay/paypal", @@ -2466,16 +2472,16 @@ }, { "name": "omnipay/stripe", - "version": "v2.3.1", + "version": "v2.3.2", "source": { "type": "git", "url": "https://github.com/thephpleague/omnipay-stripe.git", - "reference": "6c4cef5b5168a58476eef6fa73b7875e15c94b6f" + "reference": "fe05ddd73d9ae38ca026dbc270ca98aaf3f99da4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/omnipay-stripe/zipball/6c4cef5b5168a58476eef6fa73b7875e15c94b6f", - "reference": "6c4cef5b5168a58476eef6fa73b7875e15c94b6f", + "url": "https://api.github.com/repos/thephpleague/omnipay-stripe/zipball/fe05ddd73d9ae38ca026dbc270ca98aaf3f99da4", + "reference": "fe05ddd73d9ae38ca026dbc270ca98aaf3f99da4", "shasum": "" }, "require": { @@ -2519,20 +2525,20 @@ "payment", "stripe" ], - "time": "2016-01-13 04:00:45" + "time": "2016-03-19 08:35:06" }, { "name": "paragonie/random_compat", - "version": "v1.2.1", + "version": "v1.4.1", "source": { "type": "git", "url": "https://github.com/paragonie/random_compat.git", - "reference": "f078eba3bcf140fd69b5fcc3ea5ac809abf729dc" + "reference": "c7e26a21ba357863de030f0b9e701c7d04593774" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/f078eba3bcf140fd69b5fcc3ea5ac809abf729dc", - "reference": "f078eba3bcf140fd69b5fcc3ea5ac809abf729dc", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/c7e26a21ba357863de030f0b9e701c7d04593774", + "reference": "c7e26a21ba357863de030f0b9e701c7d04593774", "shasum": "" }, "require": { @@ -2567,7 +2573,52 @@ "pseudorandom", "random" ], - "time": "2016-02-29 17:25:04" + "time": "2016-03-18 20:34:03" + }, + { + "name": "paypal/permissions-sdk-php", + "version": "v3.9.1", + "source": { + "type": "git", + "url": "https://github.com/paypal/permissions-sdk-php.git", + "reference": "9f5ac1d6024207ec9ddf3de4abc3b0de2b54ef8b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paypal/permissions-sdk-php/zipball/9f5ac1d6024207ec9ddf3de4abc3b0de2b54ef8b", + "reference": "9f5ac1d6024207ec9ddf3de4abc3b0de2b54ef8b", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "paypal/sdk-core-php": "3.*", + "php": ">=5.3.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "PayPal\\Service": "lib/", + "PayPal\\Types": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache2" + ], + "authors": [ + { + "name": "PayPal", + "homepage": "https://github.com/paypal/permissions-sdk-php/contributors" + } + ], + "description": "PayPal permission SDK for PHP", + "homepage": "https://developer.paypal.com", + "keywords": [ + "paypal", + "php", + "sdk" + ], + "time": "2015-12-09 18:01:09" }, { "name": "paypal/rest-api-sdk-php", @@ -2617,6 +2668,52 @@ ], "time": "2016-01-20 17:45:52" }, + { + "name": "paypal/sdk-core-php", + "version": "v3.2.4", + "source": { + "type": "git", + "url": "https://github.com/paypal/sdk-core-php.git", + "reference": "16b01e8e05f18538ff8dcce3292f0ada4eb4969b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paypal/sdk-core-php/zipball/16b01e8e05f18538ff8dcce3292f0ada4eb4969b", + "reference": "16b01e8e05f18538ff8dcce3292f0ada4eb4969b", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "3.7.*" + }, + "type": "library", + "autoload": { + "psr-0": { + "PayPal": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache2" + ], + "authors": [ + { + "name": "PayPal", + "homepage": "https://github.com/paypal/sdk-core-php/contributors" + } + ], + "description": "PayPal Core SDK for PHP", + "homepage": "https://github.com/paypal/sdk-core-php", + "keywords": [ + "paypal", + "php", + "sdk" + ], + "time": "2016-01-20 17:53:01" + }, { "name": "payum/iso4217", "version": "1.0.0", @@ -2802,16 +2899,16 @@ }, { "name": "payum/payum", - "version": "1.2.2", + "version": "1.2.8", "source": { "type": "git", "url": "https://github.com/Payum/Payum.git", - "reference": "5724785027c1ac6ce5c9f25931af0dfdd907397a" + "reference": "f6bb614d011b6db5688716988b16a34afea8b84f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Payum/Payum/zipball/5724785027c1ac6ce5c9f25931af0dfdd907397a", - "reference": "5724785027c1ac6ce5c9f25931af0dfdd907397a", + "url": "https://api.github.com/repos/Payum/Payum/zipball/f6bb614d011b6db5688716988b16a34afea8b84f", + "reference": "f6bb614d011b6db5688716988b16a34afea8b84f", "shasum": "" }, "require": { @@ -2845,7 +2942,7 @@ "klarna/checkout": "~1|~2.0", "omnipay/dummy": "~2.0", "paypal/rest-api-sdk-php": "0.5.*", - "payum/omnipay-bridge": "~1.0@dev", + "payum/omnipay-bridge": "^1", "phpunit/phpunit": "~4.0", "propel/propel1": "~1.7", "psr/log": "~1.0", @@ -2857,6 +2954,7 @@ "symfony/http-kernel": "~2.8|~3.0", "symfony/phpunit-bridge": "~2.8|~3.0", "symfony/routing": "~2.8|~3.0", + "symfony/templating": "~2.8|~3.0", "symfony/validator": "~2.8|~3.0", "zendframework/zend-db": "~2" }, @@ -2929,24 +3027,24 @@ "stripe checkout", "stripe.js" ], - "time": "2016-03-01 19:16:57" + "time": "2016-03-25 08:47:21" }, { "name": "payum/payum-bundle", - "version": "2.0.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/Payum/PayumBundle.git", - "reference": "ae387f5871547975861c5db381815faf0aa4d4b2" + "reference": "2c40b549b9b56573967d421c6b6f315ba51504a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Payum/PayumBundle/zipball/ae387f5871547975861c5db381815faf0aa4d4b2", - "reference": "ae387f5871547975861c5db381815faf0aa4d4b2", + "url": "https://api.github.com/repos/Payum/PayumBundle/zipball/2c40b549b9b56573967d421c6b6f315ba51504a5", + "reference": "2c40b549b9b56573967d421c6b6f315ba51504a5", "shasum": "" }, "require": { - "payum/core": "^1.2", + "payum/core": "^1.2.6", "php": "^5.5.0|^7.0", "symfony/form": "~2.8|~3.0", "symfony/framework-bundle": "~2.8|~3.0", @@ -2964,9 +3062,9 @@ "omnipay/paypal": "~2.0", "omnipay/stripe": "~2.0", "paypal/rest-api-sdk-php": "0.5.*", - "payum/jms-payment-bridge": "~1.0@dev", - "payum/omnipay-bridge": "~1.0@dev", - "payum/payum": "^1.2@dev", + "payum/jms-payment-bridge": "^1", + "payum/omnipay-bridge": "^1", + "payum/payum": "^1.2.6", "phpunit/phpunit": "~4.0", "sonata-project/admin-bundle": "~2.4@dev", "stripe/stripe-php": "~1.0", @@ -3029,7 +3127,7 @@ "stripe.js", "symfony" ], - "time": "2016-03-01 17:55:44" + "time": "2016-03-18 16:47:30" }, { "name": "phpcollection/phpcollection", @@ -3484,16 +3582,16 @@ }, { "name": "phpunit/phpunit", - "version": "4.8.23", + "version": "4.8.24", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "6e351261f9cd33daf205a131a1ba61c6d33bd483" + "reference": "a1066c562c52900a142a0e2bbf0582994671385e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/6e351261f9cd33daf205a131a1ba61c6d33bd483", - "reference": "6e351261f9cd33daf205a131a1ba61c6d33bd483", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a1066c562c52900a142a0e2bbf0582994671385e", + "reference": "a1066c562c52900a142a0e2bbf0582994671385e", "shasum": "" }, "require": { @@ -3552,7 +3650,7 @@ "testing", "xunit" ], - "time": "2016-02-11 14:56:33" + "time": "2016-03-14 06:16:08" }, { "name": "phpunit/phpunit-mock-objects", @@ -4813,16 +4911,16 @@ }, { "name": "symfony/assetic-bundle", - "version": "v2.7.1", + "version": "v2.8.0", "source": { "type": "git", "url": "https://github.com/symfony/assetic-bundle.git", - "reference": "d885ec8451d5a7b077bda81bb19ac9fbff9cdc76" + "reference": "aa5b4f8b712f38745928fa845ddb73300bb2af6d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/assetic-bundle/zipball/d885ec8451d5a7b077bda81bb19ac9fbff9cdc76", - "reference": "d885ec8451d5a7b077bda81bb19ac9fbff9cdc76", + "url": "https://api.github.com/repos/symfony/assetic-bundle/zipball/aa5b4f8b712f38745928fa845ddb73300bb2af6d", + "reference": "aa5b4f8b712f38745928fa845ddb73300bb2af6d", "shasum": "" }, "require": { @@ -4879,20 +4977,20 @@ "compression", "minification" ], - "time": "2015-11-17 09:45:47" + "time": "2015-12-28 13:12:39" }, { "name": "symfony/monolog-bundle", - "version": "v2.9.0", + "version": "v2.10.0", "source": { "type": "git", "url": "https://github.com/symfony/monolog-bundle.git", - "reference": "27c2e3eaec7a0ba3462f99ea92678cbfc7b146e4" + "reference": "82fd8f36e2cccbe94faf237403c48052d4d4b77e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/monolog-bundle/zipball/27c2e3eaec7a0ba3462f99ea92678cbfc7b146e4", - "reference": "27c2e3eaec7a0ba3462f99ea92678cbfc7b146e4", + "url": "https://api.github.com/repos/symfony/monolog-bundle/zipball/82fd8f36e2cccbe94faf237403c48052d4d4b77e", + "reference": "82fd8f36e2cccbe94faf237403c48052d4d4b77e", "shasum": "" }, "require": { @@ -4904,6 +5002,7 @@ "symfony/monolog-bridge": "~2.3|~3.0" }, "require-dev": { + "phpunit/phpunit": "^4.8", "symfony/console": "~2.3|~3.0", "symfony/yaml": "~2.3|~3.0" }, @@ -4938,20 +5037,20 @@ "log", "logging" ], - "time": "2016-03-01 17:53:42" + "time": "2016-03-13 15:55:56" }, { "name": "symfony/polyfill-apcu", - "version": "v1.1.0", + "version": "v1.1.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-apcu.git", - "reference": "d1911e6caeb4b6a4c8e2d5c46b978a66b3745e4c" + "reference": "0c901e4e65a2f7ece68f0fd249b56d6ad3adc214" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-apcu/zipball/d1911e6caeb4b6a4c8e2d5c46b978a66b3745e4c", - "reference": "d1911e6caeb4b6a4c8e2d5c46b978a66b3745e4c", + "url": "https://api.github.com/repos/symfony/polyfill-apcu/zipball/0c901e4e65a2f7ece68f0fd249b56d6ad3adc214", + "reference": "0c901e4e65a2f7ece68f0fd249b56d6ad3adc214", "shasum": "" }, "require": { @@ -4966,9 +5065,6 @@ "autoload": { "files": [ "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" ] }, "notification-url": "https://packagist.org/downloads/", @@ -4994,26 +5090,29 @@ "portable", "shim" ], - "time": "2016-01-20 09:13:37" + "time": "2016-03-03 16:49:40" }, { "name": "symfony/polyfill-intl-icu", - "version": "v1.1.0", + "version": "v1.1.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-icu.git", - "reference": "66b0bb4abda229bc073eff6bbc8f2685bdaac165" + "reference": "8328069d9f5322f0e7b3c3518485acfdc94c3942" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/66b0bb4abda229bc073eff6bbc8f2685bdaac165", - "reference": "66b0bb4abda229bc073eff6bbc8f2685bdaac165", + "url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/8328069d9f5322f0e7b3c3518485acfdc94c3942", + "reference": "8328069d9f5322f0e7b3c3518485acfdc94c3942", "shasum": "" }, "require": { "php": ">=5.3.3", "symfony/intl": "~2.3|~3.0" }, + "suggest": { + "ext-intl": "For best performance" + }, "type": "library", "extra": { "branch-alias": { @@ -5049,11 +5148,11 @@ "portable", "shim" ], - "time": "2016-01-20 09:13:37" + "time": "2016-02-26 16:18:12" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.1.0", + "version": "v1.1.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", @@ -5112,16 +5211,16 @@ }, { "name": "symfony/polyfill-php54", - "version": "v1.1.0", + "version": "v1.1.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php54.git", - "reference": "74663d5a2ff3c530c1bc0571500e0feec9094054" + "reference": "9ba741ca01c77282ecf5796c2c1d667f03454ffb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/74663d5a2ff3c530c1bc0571500e0feec9094054", - "reference": "74663d5a2ff3c530c1bc0571500e0feec9094054", + "url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/9ba741ca01c77282ecf5796c2c1d667f03454ffb", + "reference": "9ba741ca01c77282ecf5796c2c1d667f03454ffb", "shasum": "" }, "require": { @@ -5166,11 +5265,11 @@ "portable", "shim" ], - "time": "2016-01-20 09:13:37" + "time": "2016-01-25 19:13:00" }, { "name": "symfony/polyfill-php55", - "version": "v1.1.0", + "version": "v1.1.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php55.git", @@ -5226,7 +5325,7 @@ }, { "name": "symfony/polyfill-php56", - "version": "v1.1.0", + "version": "v1.1.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php56.git", @@ -5282,16 +5381,16 @@ }, { "name": "symfony/polyfill-php70", - "version": "v1.1.0", + "version": "v1.1.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "8428ceddbbaf102f2906769a8ef2438220c5cb95" + "reference": "386c1be9cad3ab531425211919e78c37971be4ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/8428ceddbbaf102f2906769a8ef2438220c5cb95", - "reference": "8428ceddbbaf102f2906769a8ef2438220c5cb95", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/386c1be9cad3ab531425211919e78c37971be4ce", + "reference": "386c1be9cad3ab531425211919e78c37971be4ce", "shasum": "" }, "require": { @@ -5337,11 +5436,11 @@ "portable", "shim" ], - "time": "2016-01-25 08:44:42" + "time": "2016-01-28 22:42:02" }, { "name": "symfony/polyfill-util", - "version": "v1.1.0", + "version": "v1.1.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-util.git", From de2ad860c8065ca9ae0cb9e3feb528aeabe90211 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Mon, 28 Mar 2016 17:30:31 +0300 Subject: [PATCH 06/28] Made Permissions API -> getRequestToken + getAccess as a single action --- .../PaypalPermissionsController.php | 79 +++++++++++++++++++ .../Resources/config/routing.yml | 10 ++- .../views/Details/accessToken.html.twig | 17 ++++ .../Resources/views/Details/view.html.twig | 10 +-- .../views/permissionsGetToken.html.twig | 11 +++ 5 files changed, 118 insertions(+), 9 deletions(-) create mode 100644 src/Acme/PaymentBundle/Controller/PaypalPermissionsController.php create mode 100644 src/Acme/PaymentBundle/Resources/views/Details/accessToken.html.twig create mode 100644 src/Acme/PaymentBundle/Resources/views/permissionsGetToken.html.twig diff --git a/src/Acme/PaymentBundle/Controller/PaypalPermissionsController.php b/src/Acme/PaymentBundle/Controller/PaypalPermissionsController.php new file mode 100644 index 0000000..1f3e7a4 --- /dev/null +++ b/src/Acme/PaymentBundle/Controller/PaypalPermissionsController.php @@ -0,0 +1,79 @@ + 'sandbox', // todo: make it optional + 'acct1.UserName' => $this->container->getParameter('paypal.express_checkout.username'), + 'acct1.Password' => $this->container->getParameter('paypal.express_checkout.password'), + 'acct1.Signature' => $this->container->getParameter('paypal.express_checkout.signature'), + 'acct1.AppId' => 'APP-80W284485P519543T', // sandbox App Id + ); + + $permissions = new PermissionsService($config); + + if ($request->isMethod('POST')) { + $callbackUrl = $request->getUri(); // todo: url to captureAction here + $request = new RequestPermissionsRequest('EXPRESS_CHECKOUT', $callbackUrl); + $request->requestEnvelope = new RequestEnvelope('en_US'); + + $response = $permissions->RequestPermissions($request); + /** @var RequestPermissionsResponse */ + + if(strtoupper($response->responseEnvelope->ack) != 'SUCCESS') { + throw new BadCredentialsException('No token received! Response object: ' . json_encode((array) $response)); + } + // no URI builder in SDK.. + $payPalURL = 'https://www.sandbox.paypal.com/webscr&cmd='.'_grant-permission&request_token='.$response->token; + return $this->redirect($payPalURL); + } + + if (!$request->query->has('verification_code')) { + return $this->render('AcmePaymentBundle::permissionsGetToken.html.twig', array()); + } + + // validation is also needed.. + $request = new GetAccessTokenRequest(); + $request->token = $httpRequest->query->get('request_token'); + $request->verifier = $httpRequest->query->get('verification_code'); + + $response = $permissions->GetAccessToken($request); + /** @var GetAccessTokenResponse */ + + return $this->render('AcmePaymentBundle:Details:accessToken.html.twig', array( + 'status' => $response->responseEnvelope->ack, + 'response' => json_encode($response, JSON_PRETTY_PRINT) + )); + + } + + /** + * @return Payum + */ + protected function getPayum() + { + return $this->get('payum'); + } + +} \ No newline at end of file diff --git a/src/Acme/PaymentBundle/Resources/config/routing.yml b/src/Acme/PaymentBundle/Resources/config/routing.yml index 7f9ad74..9d2a69b 100644 --- a/src/Acme/PaymentBundle/Resources/config/routing.yml +++ b/src/Acme/PaymentBundle/Resources/config/routing.yml @@ -61,4 +61,12 @@ acme_payment_payment_done: acme_payment_notifications_list: pattern: /payment/notifications/list - defaults: { _controller: AcmePaymentBundle:Notifications:list } \ No newline at end of file + defaults: { _controller: AcmePaymentBundle:Notifications:list } + +# PayPal permissions SDK experiment + +acme_payment_paypal_permissions_get_token: + pattern: /payment/paypal-permissions/get-token + defaults: { _controller: AcmePaymentBundle:PaypalPermissions:prepare } + +# /end PayPal permissions SDK experiment \ No newline at end of file diff --git a/src/Acme/PaymentBundle/Resources/views/Details/accessToken.html.twig b/src/Acme/PaymentBundle/Resources/views/Details/accessToken.html.twig new file mode 100644 index 0000000..ab5ffe5 --- /dev/null +++ b/src/Acme/PaymentBundle/Resources/views/Details/accessToken.html.twig @@ -0,0 +1,17 @@ +{% extends "AcmePaymentBundle::layout.html.twig" %} + +{% block title %} + AccessToken - Details View" +{% endblock %} + +{% block content %} +
+ Status: {{ status }} +
+ +
+
{{ response|raw }}
+
+{% endblock %} + +{% set code = code(_self) %} diff --git a/src/Acme/PaymentBundle/Resources/views/Details/view.html.twig b/src/Acme/PaymentBundle/Resources/views/Details/view.html.twig index e51ce6e..0e8c6aa 100644 --- a/src/Acme/PaymentBundle/Resources/views/Details/view.html.twig +++ b/src/Acme/PaymentBundle/Resources/views/Details/view.html.twig @@ -1,22 +1,16 @@ {% extends "AcmePaymentBundle::layout.html.twig" %} {% block title %} - {{ gatewayTitle }} - Details View" + PayPal AccessToken - Details View" {% endblock %} {% block content %}
Status: {{ status }} - {% if refundToken %} - Refund - {% endif %} - {% if captureToken %} - Capture - {% endif %}
-
{{ payment|raw }}
+
{{ response|raw }}
{% endblock %} diff --git a/src/Acme/PaymentBundle/Resources/views/permissionsGetToken.html.twig b/src/Acme/PaymentBundle/Resources/views/permissionsGetToken.html.twig new file mode 100644 index 0000000..5a8e14e --- /dev/null +++ b/src/Acme/PaymentBundle/Resources/views/permissionsGetToken.html.twig @@ -0,0 +1,11 @@ +{% extends "AcmePaymentBundle::layout.html.twig" %} + +{% block title "Prepare payment" %} + +{% block content %} +
+ +
+{% endblock %} + +{% set code = code(_self) %} \ No newline at end of file From 75dfaa7f5ccada42092706f19632f6a04554032a Mon Sep 17 00:00:00 2001 From: Dmitry Date: Mon, 28 Mar 2016 18:27:37 +0300 Subject: [PATCH 07/28] Added stubs; added "get-request-token" action controller --- ...palPermissionsGetAccessTokenController.php | 95 +++++++++++++++++++ ...alPermissionsGetRequestTokenController.php | 85 +++++++++++++++++ .../Resources/config/routing.yml | 9 ++ .../views/Details/accessToken.html.twig | 2 +- .../views/permissionsGetToken.html.twig | 9 +- 5 files changed, 197 insertions(+), 3 deletions(-) create mode 100644 src/Acme/PaymentBundle/Controller/PaypalPermissionsGetAccessTokenController.php create mode 100644 src/Acme/PaymentBundle/Controller/PaypalPermissionsGetRequestTokenController.php diff --git a/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetAccessTokenController.php b/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetAccessTokenController.php new file mode 100644 index 0000000..4dae8c5 --- /dev/null +++ b/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetAccessTokenController.php @@ -0,0 +1,95 @@ + 'sandbox', // todo: make it optional + 'acct1.UserName' => $this->container->getParameter('paypal.express_checkout.username'), + 'acct1.Password' => $this->container->getParameter('paypal.express_checkout.password'), + 'acct1.Signature' => $this->container->getParameter('paypal.express_checkout.signature'), + 'acct1.AppId' => 'APP-80W284485P519543T', // sandbox App Id + ); + + $permissions = new PermissionsService($config); + + if ($request->isMethod('POST')) { + $callbackUrl = $request->getUri(); // todo: url to captureAction here + $request = new RequestPermissionsRequest('EXPRESS_CHECKOUT', $callbackUrl); + $request->requestEnvelope = new RequestEnvelope('en_US'); + + $response = $permissions->RequestPermissions($request); + /** @var RequestPermissionsResponse */ + + if(strtoupper($response->responseEnvelope->ack) != 'SUCCESS') { + throw new BadCredentialsException('No token received! Response object: ' . json_encode((array) $response)); + } + // no URI builder in SDK.. + $payPalURL = 'https://www.sandbox.paypal.com/webscr&cmd='.'_grant-permission&request_token='.$response->token; + return $this->redirect($payPalURL); + } + + if (!$request->query->has('verification_code')) { + return $this->render('AcmePaymentBundle::permissionsGetToken.html.twig', array()); + } + + // validation is also needed.. + $request = new GetAccessTokenRequest(); + $request->token = $httpRequest->query->get('request_token'); + $request->verifier = $httpRequest->query->get('verification_code'); + + $response = $permissions->GetAccessToken($request); + /** @var GetAccessTokenResponse */ + + return $this->render('AcmePaymentBundle:Details:accessToken.html.twig', array( + 'status' => $response->responseEnvelope->ack, + 'response' => json_encode($response, JSON_PRETTY_PRINT) + )); + + } + + /** + * @return \Symfony\Component\Form\Form + */ + protected function createPurchaseForm() + { + return $this->createFormBuilder() + ->add('Return URL', null, array( + 'data' => 1.1, + 'constraints' => array(new Range(array('max' => 2))) + )) +// ->add('currency', null, array('data' => 'USD')) + + ->getForm() + ; + } + + /** + * @return Payum + */ + protected function getPayum() + { + return $this->get('payum'); + } + +} \ No newline at end of file diff --git a/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetRequestTokenController.php b/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetRequestTokenController.php new file mode 100644 index 0000000..47ca27e --- /dev/null +++ b/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetRequestTokenController.php @@ -0,0 +1,85 @@ + 'sandbox', // todo: make it optional + 'acct1.UserName' => $this->container->getParameter('paypal.express_checkout.username'), + 'acct1.Password' => $this->container->getParameter('paypal.express_checkout.password'), + 'acct1.Signature' => $this->container->getParameter('paypal.express_checkout.signature'), + 'acct1.AppId' => 'APP-80W284485P519543T', // sandbox App Id + ); + + $permissions = new PermissionsService($config); + + $form = $this->createDetailsForm(); + $form->handleRequest($request); + + if ($form->isValid()) { + $data = $form->getData(); + $callbackUrl =$data['return_url']; // todo: url to captureAction here + $request = new RequestPermissionsRequest('EXPRESS_CHECKOUT', $callbackUrl); + $request->requestEnvelope = new RequestEnvelope('en_US'); + + /** @var RequestPermissionsResponse */ + $response = $permissions->RequestPermissions($request); + + return $this->render('AcmePaymentBundle:Details:accessToken.html.twig', array( + 'pagetitle' => 'Request token', + 'status' => $response->responseEnvelope->ack, + 'response' => json_encode($response, JSON_PRETTY_PRINT), + )); + } + + return $this->render('AcmePaymentBundle::permissionsGetToken.html.twig', array( + 'pagetitle' => 'Get Request token', + 'form' => $form->createView() + )); + + } + + /** + * @return \Symfony\Component\Form\Form + */ + protected function createDetailsForm() + { + return $this->createFormBuilder() + ->add('return_url', null, array( + 'data' => $this->generateUrl('acme_payment_paypal_permissions_get_access_token', array(), UrlGeneratorInterface::ABSOLUTE_URL), + )) + + ->getForm() + ; + } + + /** + * @return Payum + */ + protected function getPayum() + { + return $this->get('payum'); + } + +} \ No newline at end of file diff --git a/src/Acme/PaymentBundle/Resources/config/routing.yml b/src/Acme/PaymentBundle/Resources/config/routing.yml index 9d2a69b..ce10a33 100644 --- a/src/Acme/PaymentBundle/Resources/config/routing.yml +++ b/src/Acme/PaymentBundle/Resources/config/routing.yml @@ -65,8 +65,17 @@ acme_payment_notifications_list: # PayPal permissions SDK experiment +# fixme: remove acme_payment_paypal_permissions_get_token: pattern: /payment/paypal-permissions/get-token defaults: { _controller: AcmePaymentBundle:PaypalPermissions:prepare } +acme_payment_paypal_permissions_get_request_token: + pattern: /payment/paypal-permissions/get-request-token + defaults: { _controller: AcmePaymentBundle:PaypalPermissionsGetRequestToken:prepare } + +acme_payment_paypal_permissions_get_access_token: + pattern: /payment/paypal-permissions/get-access-token + defaults: { _controller: AcmePaymentBundle:PaypalPermissionsGetAccessToken:prepare } + # /end PayPal permissions SDK experiment \ No newline at end of file diff --git a/src/Acme/PaymentBundle/Resources/views/Details/accessToken.html.twig b/src/Acme/PaymentBundle/Resources/views/Details/accessToken.html.twig index ab5ffe5..074301a 100644 --- a/src/Acme/PaymentBundle/Resources/views/Details/accessToken.html.twig +++ b/src/Acme/PaymentBundle/Resources/views/Details/accessToken.html.twig @@ -1,7 +1,7 @@ {% extends "AcmePaymentBundle::layout.html.twig" %} {% block title %} - AccessToken - Details View" + {{ pagetitle|default('Received token') }} - Details View" {% endblock %} {% block content %} diff --git a/src/Acme/PaymentBundle/Resources/views/permissionsGetToken.html.twig b/src/Acme/PaymentBundle/Resources/views/permissionsGetToken.html.twig index 5a8e14e..5ac8d22 100644 --- a/src/Acme/PaymentBundle/Resources/views/permissionsGetToken.html.twig +++ b/src/Acme/PaymentBundle/Resources/views/permissionsGetToken.html.twig @@ -1,10 +1,15 @@ {% extends "AcmePaymentBundle::layout.html.twig" %} -{% block title "Prepare payment" %} +{% block title %} + {{ pagetitle|default('Get token') }} +{% endblock %} {% block content %}
- + {% if form|default %} + {{ form_widget(form) }} + {% endif %} +
{% endblock %} From 6acc4c329d09bc7c9520d9e24b8a8f551d028229 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Mon, 28 Mar 2016 20:10:35 +0300 Subject: [PATCH 08/28] Added "get-access-token" action controller; small refactoring --- ...palPermissionsGetAccessTokenController.php | 40 ++++++++----------- ...alPermissionsGetRequestTokenController.php | 2 +- .../views/permissionsGetAccessToken.html.twig | 21 ++++++++++ ...g => permissionsGetRequestToken.html.twig} | 3 +- 4 files changed, 40 insertions(+), 26 deletions(-) create mode 100644 src/Acme/PaymentBundle/Resources/views/permissionsGetAccessToken.html.twig rename src/Acme/PaymentBundle/Resources/views/{permissionsGetToken.html.twig => permissionsGetRequestToken.html.twig} (71%) diff --git a/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetAccessTokenController.php b/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetAccessTokenController.php index 4dae8c5..6e6bdbf 100644 --- a/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetAccessTokenController.php +++ b/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetAccessTokenController.php @@ -14,6 +14,7 @@ use Payum\Core\Registry\RegistryInterface; use Payum\Core\Security\GenericTokenFactoryInterface; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Security\Core\Exception\BadCredentialsException; use Symfony\Component\Validator\Constraints\Range; @@ -33,24 +34,14 @@ public function prepareAction(Request $request) $permissions = new PermissionsService($config); - if ($request->isMethod('POST')) { - $callbackUrl = $request->getUri(); // todo: url to captureAction here - $request = new RequestPermissionsRequest('EXPRESS_CHECKOUT', $callbackUrl); - $request->requestEnvelope = new RequestEnvelope('en_US'); - - $response = $permissions->RequestPermissions($request); - /** @var RequestPermissionsResponse */ - - if(strtoupper($response->responseEnvelope->ack) != 'SUCCESS') { - throw new BadCredentialsException('No token received! Response object: ' . json_encode((array) $response)); - } - // no URI builder in SDK.. - $payPalURL = 'https://www.sandbox.paypal.com/webscr&cmd='.'_grant-permission&request_token='.$response->token; - return $this->redirect($payPalURL); - } - if (!$request->query->has('verification_code')) { - return $this->render('AcmePaymentBundle::permissionsGetToken.html.twig', array()); + $payPalAction = 'https://www.sandbox.paypal.com/webscr'; + + return $this->render('AcmePaymentBundle::permissionsGetAccessToken.html.twig', array( + 'pagetitle' => 'Get Access token', + 'form_action' => $payPalAction, + 'form_method' => 'GET', + )); } // validation is also needed.. @@ -65,21 +56,22 @@ public function prepareAction(Request $request) 'status' => $response->responseEnvelope->ack, 'response' => json_encode($response, JSON_PRETTY_PRINT) )); - } /** * @return \Symfony\Component\Form\Form */ - protected function createPurchaseForm() + protected function createDetailsForm() { return $this->createFormBuilder() - ->add('Return URL', null, array( - 'data' => 1.1, - 'constraints' => array(new Range(array('max' => 2))) + ->add('request_token', null, array( + 'data' => '', + 'property_path' => 'request_token' + )) + ->add('cmd', 'hidden', array( + 'data' => '_grant-permission', + 'property_path' => 'cmd', )) -// ->add('currency', null, array('data' => 'USD')) - ->getForm() ; } diff --git a/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetRequestTokenController.php b/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetRequestTokenController.php index 47ca27e..9200c82 100644 --- a/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetRequestTokenController.php +++ b/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetRequestTokenController.php @@ -53,7 +53,7 @@ public function prepareAction(Request $request) )); } - return $this->render('AcmePaymentBundle::permissionsGetToken.html.twig', array( + return $this->render('AcmePaymentBundle::permissionsGetRequestToken.html.twig', array( 'pagetitle' => 'Get Request token', 'form' => $form->createView() )); diff --git a/src/Acme/PaymentBundle/Resources/views/permissionsGetAccessToken.html.twig b/src/Acme/PaymentBundle/Resources/views/permissionsGetAccessToken.html.twig new file mode 100644 index 0000000..1fa3c9f --- /dev/null +++ b/src/Acme/PaymentBundle/Resources/views/permissionsGetAccessToken.html.twig @@ -0,0 +1,21 @@ +{% extends "AcmePaymentBundle::layout.html.twig" %} + +{% block title %} + {{ pagetitle|default('Get token') }} +{% endblock %} + +{% block content %} +
+
+ + +
+ + +
+{% endblock %} + +{% set code = code(_self) %} \ No newline at end of file diff --git a/src/Acme/PaymentBundle/Resources/views/permissionsGetToken.html.twig b/src/Acme/PaymentBundle/Resources/views/permissionsGetRequestToken.html.twig similarity index 71% rename from src/Acme/PaymentBundle/Resources/views/permissionsGetToken.html.twig rename to src/Acme/PaymentBundle/Resources/views/permissionsGetRequestToken.html.twig index 5ac8d22..ea886e3 100644 --- a/src/Acme/PaymentBundle/Resources/views/permissionsGetToken.html.twig +++ b/src/Acme/PaymentBundle/Resources/views/permissionsGetRequestToken.html.twig @@ -5,7 +5,8 @@ {% endblock %} {% block content %} -
+ {% if form|default %} {{ form_widget(form) }} {% endif %} From b3afaec6914fbd2a317c0b0b4f06f0aaabd8e603 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Tue, 29 Mar 2016 12:14:59 +0300 Subject: [PATCH 09/28] Cleaning & small refactoring --- .../PaypalPermissionsController.php | 79 ------------------- ...palPermissionsGetAccessTokenController.php | 2 +- ...alPermissionsGetRequestTokenController.php | 2 +- .../Resources/config/routing.yml | 5 -- ...{accessToken.html.twig => token.html.twig} | 0 5 files changed, 2 insertions(+), 86 deletions(-) delete mode 100644 src/Acme/PaymentBundle/Controller/PaypalPermissionsController.php rename src/Acme/PaymentBundle/Resources/views/Details/{accessToken.html.twig => token.html.twig} (100%) diff --git a/src/Acme/PaymentBundle/Controller/PaypalPermissionsController.php b/src/Acme/PaymentBundle/Controller/PaypalPermissionsController.php deleted file mode 100644 index 1f3e7a4..0000000 --- a/src/Acme/PaymentBundle/Controller/PaypalPermissionsController.php +++ /dev/null @@ -1,79 +0,0 @@ - 'sandbox', // todo: make it optional - 'acct1.UserName' => $this->container->getParameter('paypal.express_checkout.username'), - 'acct1.Password' => $this->container->getParameter('paypal.express_checkout.password'), - 'acct1.Signature' => $this->container->getParameter('paypal.express_checkout.signature'), - 'acct1.AppId' => 'APP-80W284485P519543T', // sandbox App Id - ); - - $permissions = new PermissionsService($config); - - if ($request->isMethod('POST')) { - $callbackUrl = $request->getUri(); // todo: url to captureAction here - $request = new RequestPermissionsRequest('EXPRESS_CHECKOUT', $callbackUrl); - $request->requestEnvelope = new RequestEnvelope('en_US'); - - $response = $permissions->RequestPermissions($request); - /** @var RequestPermissionsResponse */ - - if(strtoupper($response->responseEnvelope->ack) != 'SUCCESS') { - throw new BadCredentialsException('No token received! Response object: ' . json_encode((array) $response)); - } - // no URI builder in SDK.. - $payPalURL = 'https://www.sandbox.paypal.com/webscr&cmd='.'_grant-permission&request_token='.$response->token; - return $this->redirect($payPalURL); - } - - if (!$request->query->has('verification_code')) { - return $this->render('AcmePaymentBundle::permissionsGetToken.html.twig', array()); - } - - // validation is also needed.. - $request = new GetAccessTokenRequest(); - $request->token = $httpRequest->query->get('request_token'); - $request->verifier = $httpRequest->query->get('verification_code'); - - $response = $permissions->GetAccessToken($request); - /** @var GetAccessTokenResponse */ - - return $this->render('AcmePaymentBundle:Details:accessToken.html.twig', array( - 'status' => $response->responseEnvelope->ack, - 'response' => json_encode($response, JSON_PRETTY_PRINT) - )); - - } - - /** - * @return Payum - */ - protected function getPayum() - { - return $this->get('payum'); - } - -} \ No newline at end of file diff --git a/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetAccessTokenController.php b/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetAccessTokenController.php index 6e6bdbf..27d7453 100644 --- a/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetAccessTokenController.php +++ b/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetAccessTokenController.php @@ -52,7 +52,7 @@ public function prepareAction(Request $request) $response = $permissions->GetAccessToken($request); /** @var GetAccessTokenResponse */ - return $this->render('AcmePaymentBundle:Details:accessToken.html.twig', array( + return $this->render('AcmePaymentBundle:Details:token.html.twig', array( 'status' => $response->responseEnvelope->ack, 'response' => json_encode($response, JSON_PRETTY_PRINT) )); diff --git a/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetRequestTokenController.php b/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetRequestTokenController.php index 9200c82..a1986d5 100644 --- a/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetRequestTokenController.php +++ b/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetRequestTokenController.php @@ -46,7 +46,7 @@ public function prepareAction(Request $request) /** @var RequestPermissionsResponse */ $response = $permissions->RequestPermissions($request); - return $this->render('AcmePaymentBundle:Details:accessToken.html.twig', array( + return $this->render('AcmePaymentBundle:Details:token.html.twig', array( 'pagetitle' => 'Request token', 'status' => $response->responseEnvelope->ack, 'response' => json_encode($response, JSON_PRETTY_PRINT), diff --git a/src/Acme/PaymentBundle/Resources/config/routing.yml b/src/Acme/PaymentBundle/Resources/config/routing.yml index ce10a33..3d13bd0 100644 --- a/src/Acme/PaymentBundle/Resources/config/routing.yml +++ b/src/Acme/PaymentBundle/Resources/config/routing.yml @@ -65,11 +65,6 @@ acme_payment_notifications_list: # PayPal permissions SDK experiment -# fixme: remove -acme_payment_paypal_permissions_get_token: - pattern: /payment/paypal-permissions/get-token - defaults: { _controller: AcmePaymentBundle:PaypalPermissions:prepare } - acme_payment_paypal_permissions_get_request_token: pattern: /payment/paypal-permissions/get-request-token defaults: { _controller: AcmePaymentBundle:PaypalPermissionsGetRequestToken:prepare } diff --git a/src/Acme/PaymentBundle/Resources/views/Details/accessToken.html.twig b/src/Acme/PaymentBundle/Resources/views/Details/token.html.twig similarity index 100% rename from src/Acme/PaymentBundle/Resources/views/Details/accessToken.html.twig rename to src/Acme/PaymentBundle/Resources/views/Details/token.html.twig From 579d80587ac4676edd6d8b628a4ee5cbe221113c Mon Sep 17 00:00:00 2001 From: Dmitry Date: Tue, 29 Mar 2016 18:20:12 +0300 Subject: [PATCH 10/28] Added composer.lock to repository --- composer.lock | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/composer.lock b/composer.lock index aac9975..ade002e 100644 --- a/composer.lock +++ b/composer.lock @@ -5610,16 +5610,16 @@ }, { "name": "symfony/symfony", - "version": "v2.8.3", + "version": "v2.8.4", "source": { "type": "git", "url": "https://github.com/symfony/symfony.git", - "reference": "7a9a5fce7ce6e448e527f635463dda00761e12c2" + "reference": "9e14f9f4869c19188a376eab61d9a1c1f1fee347" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/symfony/zipball/7a9a5fce7ce6e448e527f635463dda00761e12c2", - "reference": "7a9a5fce7ce6e448e527f635463dda00761e12c2", + "url": "https://api.github.com/repos/symfony/symfony/zipball/9e14f9f4869c19188a376eab61d9a1c1f1fee347", + "reference": "9e14f9f4869c19188a376eab61d9a1c1f1fee347", "shasum": "" }, "require": { @@ -5706,11 +5706,7 @@ }, "autoload": { "psr-4": { - "Symfony\\Bridge\\Doctrine\\": "src/Symfony/Bridge/Doctrine/", - "Symfony\\Bridge\\Monolog\\": "src/Symfony/Bridge/Monolog/", - "Symfony\\Bridge\\ProxyManager\\": "src/Symfony/Bridge/ProxyManager/", - "Symfony\\Bridge\\Swiftmailer\\": "src/Symfony/Bridge/Swiftmailer/", - "Symfony\\Bridge\\Twig\\": "src/Symfony/Bridge/Twig/", + "Symfony\\Bridge\\": "src/Symfony/Bridge/", "Symfony\\Bundle\\": "src/Symfony/Bundle/", "Symfony\\Component\\": "src/Symfony/Component/" }, @@ -5740,7 +5736,7 @@ "keywords": [ "framework" ], - "time": "2016-02-28 21:06:29" + "time": "2016-03-27 12:57:53" }, { "name": "true/punycode", From 4dee726815616c2fdc103853ff71fa4b9113ccd1 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Tue, 29 Mar 2016 18:40:27 +0300 Subject: [PATCH 11/28] Restored Details:view.html.twig --- .../Resources/views/Details/view.html.twig | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Acme/PaymentBundle/Resources/views/Details/view.html.twig b/src/Acme/PaymentBundle/Resources/views/Details/view.html.twig index 0e8c6aa..e51ce6e 100644 --- a/src/Acme/PaymentBundle/Resources/views/Details/view.html.twig +++ b/src/Acme/PaymentBundle/Resources/views/Details/view.html.twig @@ -1,16 +1,22 @@ {% extends "AcmePaymentBundle::layout.html.twig" %} {% block title %} - PayPal AccessToken - Details View" + {{ gatewayTitle }} - Details View" {% endblock %} {% block content %}
Status: {{ status }} + {% if refundToken %} + Refund + {% endif %} + {% if captureToken %} + Capture + {% endif %}
-
{{ response|raw }}
+
{{ payment|raw }}
{% endblock %} From 7be8804caaedb0a3ad8c105ea16e7f13b3150e7a Mon Sep 17 00:00:00 2001 From: Dmitry Date: Wed, 30 Mar 2016 17:28:26 +0300 Subject: [PATCH 12/28] Config fix --- app/config/payum.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/config/payum.yml b/app/config/payum.yml index c770448..d4cc8c8 100644 --- a/app/config/payum.yml +++ b/app/config/payum.yml @@ -187,6 +187,7 @@ payum: config_key: %sofort.config_key% foo_bar_gateway: + factory: core payum.action.capture: @acme_payment.foo_bar.capture payum.action.status: @acme_payment.foo_bar.status From ff536d7d4dd472fad951f127c51dd235340864be Mon Sep 17 00:00:00 2001 From: Dmitry Date: Wed, 30 Mar 2016 17:33:57 +0300 Subject: [PATCH 13/28] Added new API and Factory for "ExpressCheckout via token" feature; added new section to parameters.yml.dist; updated configs --- app/config/parameters.yml.dist | 7 ++++ app/config/payum.yml | 5 +++ .../ExpressCheckout/Nvp/FactoryViaToken.php | 36 +++++++++++++++++++ .../ExpressCheckout/Nvp/ApiViaToken.php | 13 +++++++ .../Resources/config/services.yml | 12 ++++++- 5 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 src/Acme/PaymentBundle/Payum/Api/Paypal/ExpressCheckout/Nvp/FactoryViaToken.php create mode 100644 src/Acme/PaymentBundle/Payum/Paypal/ExpressCheckout/Nvp/ApiViaToken.php diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist index 712e4d0..b04170f 100644 --- a/app/config/parameters.yml.dist +++ b/app/config/parameters.yml.dist @@ -20,6 +20,13 @@ parameters: paypal.express_checkout.usd_testuser_login: EDIT ME paypal.express_checkout.usd_testuser_password: EDIT ME + # note: it's another account + paypal.express_checkout_via_token.username: EDIT ME + paypal.express_checkout_via_token.password: EDIT ME + paypal.express_checkout_via_token.signature: EDIT ME + paypal.express_checkout_via_token.token: EDIT ME + paypal.express_checkout_via_token.secret: EDIT ME + paypal.pro_checkout.username: EDIT ME paypal.pro_checkout.password: EDIT ME paypal.pro_checkout.partner: EDIT ME diff --git a/app/config/payum.yml b/app/config/payum.yml index d4cc8c8..8c5a6cf 100644 --- a/app/config/payum.yml +++ b/app/config/payum.yml @@ -71,6 +71,11 @@ payum: factory: paypal_express_checkout payum.api: @acme.payment.payum.paypal_express_checkout_api + # note: there is also custom api + paypal_express_checkout_via_token: + factory: paypal_express_checkout + payum.api: @acme.payment.payum.paypal_express_checkout_api + paypal_pro_checkout: factory: paypal_pro_checkout username: %paypal.pro_checkout.username% diff --git a/src/Acme/PaymentBundle/Payum/Api/Paypal/ExpressCheckout/Nvp/FactoryViaToken.php b/src/Acme/PaymentBundle/Payum/Api/Paypal/ExpressCheckout/Nvp/FactoryViaToken.php new file mode 100644 index 0000000..4c3af03 --- /dev/null +++ b/src/Acme/PaymentBundle/Payum/Api/Paypal/ExpressCheckout/Nvp/FactoryViaToken.php @@ -0,0 +1,36 @@ +container = $container; + } + + /** + * @return Api + */ + public function createPaypalExpressCheckoutApi() + { + return new Api(array( + 'username' => $this->container->getParameter('paypal.express_checkout_via_token.username'), + 'password' => $this->container->getParameter('paypal.express_checkout_via_token.password'), + 'signature' => $this->container->getParameter('paypal.express_checkout_via_token.signature'), + 'token' => $this->container->getParameter('paypal.express_checkout_via_token.token'), + 'tokenSecret' => $this->container->getParameter('paypal.express_checkout_via_token.tokenSecret'), + 'sandbox' => true + )); + } +} \ No newline at end of file diff --git a/src/Acme/PaymentBundle/Payum/Paypal/ExpressCheckout/Nvp/ApiViaToken.php b/src/Acme/PaymentBundle/Payum/Paypal/ExpressCheckout/Nvp/ApiViaToken.php new file mode 100644 index 0000000..25b15c2 --- /dev/null +++ b/src/Acme/PaymentBundle/Payum/Paypal/ExpressCheckout/Nvp/ApiViaToken.php @@ -0,0 +1,13 @@ + + * Date: 30.03.16 + * Time: 16:58 + */ +class ApiViaToken extends Payum\Paypal\ExpressCheckout\Nvp\Api +{ + // +} \ No newline at end of file diff --git a/src/Acme/PaymentBundle/Resources/config/services.yml b/src/Acme/PaymentBundle/Resources/config/services.yml index 4bca040..aeee6db 100644 --- a/src/Acme/PaymentBundle/Resources/config/services.yml +++ b/src/Acme/PaymentBundle/Resources/config/services.yml @@ -14,7 +14,17 @@ services: arguments: - @service_container + acme.payment.payum.api.factory_via_token: + class: Acme\PaymentBundle\Payum\Api\Paypal\ExpressCheckout\Nvp\Factory + arguments: + - @service_container + acme.payment.payum.paypal_express_checkout_api: class: Payum\Paypal\ExpressCheckout\Nvp\Api factory_service: acme.payment.payum.api.factory - factory_method: createPaypalExpressCheckoutApi \ No newline at end of file + factory_method: createPaypalExpressCheckoutApi + + acme.payment.payum.paypal_express_checkout_api_via_token: + class: Acme\PaymentBundle\Payum\Paypal\ExpressCheckout\Nvp\ApiViaToken + factory_service: acme.payment.payum.api.factory_via_token + factory_method: createPaypalExpressCheckoutApi From 4f5802cec20409aa889c69597e1e71f787b0e8c8 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Wed, 30 Mar 2016 18:05:44 +0300 Subject: [PATCH 14/28] Added demo action for merchant token feature --- .../Resources/views/Default/index.html.twig | 3 ++ .../Controller/PurchaseExamplesController.php | 43 +++++++++++++++++++ .../prepareViaToken.html.twig | 30 +++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 src/Acme/PaypalExpressCheckoutBundle/Resources/views/PurchaseExamples/prepareViaToken.html.twig diff --git a/src/Acme/PaymentBundle/Resources/views/Default/index.html.twig b/src/Acme/PaymentBundle/Resources/views/Default/index.html.twig index 79aee94..79b3178 100644 --- a/src/Acme/PaymentBundle/Resources/views/Default/index.html.twig +++ b/src/Acme/PaymentBundle/Resources/views/Default/index.html.twig @@ -31,6 +31,9 @@
  • Purchase using custom API.
  • +
  • + Purchase using merchant token to authorize. NEW! +
  • Purchase with Paypal configured in backend.
  • diff --git a/src/Acme/PaypalExpressCheckoutBundle/Controller/PurchaseExamplesController.php b/src/Acme/PaypalExpressCheckoutBundle/Controller/PurchaseExamplesController.php index 4f976ff..68ddce3 100644 --- a/src/Acme/PaypalExpressCheckoutBundle/Controller/PurchaseExamplesController.php +++ b/src/Acme/PaypalExpressCheckoutBundle/Controller/PurchaseExamplesController.php @@ -286,6 +286,49 @@ public function prepareWithCustomApiAction(Request $request) ); } + /** + * @Extra\Route( + * "/prepare_simple_purchase_via_token", + * name="acme_paypal_express_checkout_prepare_simple_purchase_via_token" + * ) + * + * @Extra\Template + */ + public function prepareViaTokenAction(Request $request) + { + $gatewayName = 'paypal_express_checkout_via_token'; + + $form = $this->createPurchaseForm(); + $form->handleRequest($request); + if ($form->isValid()) { + $data = $form->getData(); + + $storage = $this->getPayum()->getStorage(PaymentDetails::class); + + /** @var $payment PaymentDetails */ + $payment = $storage->create(); + $payment['PAYMENTREQUEST_0_CURRENCYCODE'] = $data['currency']; + $payment['PAYMENTREQUEST_0_AMT'] = $data['amount']; + $storage->update($payment); + + $captureToken = $this->getPayum()->getTokenFactory()->createCaptureToken( + $gatewayName, + $payment, + 'acme_payment_details_view' + ); + + $payment['INVNUM'] = $payment->getId(); + $storage->update($payment); + + return $this->redirect($captureToken->getTargetUrl()); + } + + return array( + 'form' => $form->createView(), + 'gatewayName' => $gatewayName + ); + } + /** * @Extra\Route( * "/prepare_purchase_with_ipn_enabled", diff --git a/src/Acme/PaypalExpressCheckoutBundle/Resources/views/PurchaseExamples/prepareViaToken.html.twig b/src/Acme/PaypalExpressCheckoutBundle/Resources/views/PurchaseExamples/prepareViaToken.html.twig new file mode 100644 index 0000000..70d5cb9 --- /dev/null +++ b/src/Acme/PaypalExpressCheckoutBundle/Resources/views/PurchaseExamples/prepareViaToken.html.twig @@ -0,0 +1,30 @@ +{% extends "AcmePaymentBundle::layout.html.twig" %} + +{% block title "Payment demo - Simple purchase with Paypal Express Checkout using Token for merchant - Prepare" %} + +{% block content %} + +

    + This is a simple example with minimal amount of code and config. +

    +

    + This payment will be processed with another Paypal merchant account, that You can find in parameters.yml file (paypal.express_checkout_via_token section), and it also needs a token/tokenSecret pair, that was received for this account. +

    +

    + More info in Official PayPal Permissions API guide + Use these credentials {{ paypal_usd_testuser_login }}/{{ paypal_usd_testuser_password }} to login on paypal side. + + Don't forget to check what's inside +

    + +
    + + + {{ form_widget(form) }} + + + +{% endblock %} + +{% set code = code(_self, gatewayName) %} From f6a3a571ec8ee34a7187aba07e4a47b5272bdb92 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Wed, 30 Mar 2016 18:25:33 +0300 Subject: [PATCH 15/28] Fixes --- app/config/parameters.yml.dist | 2 +- app/config/payum.yml | 2 +- .../Api/Paypal/ExpressCheckout/Nvp/FactoryViaToken.php | 9 +++++---- .../Payum/Paypal/ExpressCheckout/Nvp/ApiViaToken.php | 8 ++++++-- src/Acme/PaymentBundle/Resources/config/services.yml | 2 +- .../views/PurchaseExamples/prepareViaToken.html.twig | 2 ++ 6 files changed, 16 insertions(+), 9 deletions(-) diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist index b04170f..f905348 100644 --- a/app/config/parameters.yml.dist +++ b/app/config/parameters.yml.dist @@ -25,7 +25,7 @@ parameters: paypal.express_checkout_via_token.password: EDIT ME paypal.express_checkout_via_token.signature: EDIT ME paypal.express_checkout_via_token.token: EDIT ME - paypal.express_checkout_via_token.secret: EDIT ME + paypal.express_checkout_via_token.tokenSecret: EDIT ME paypal.pro_checkout.username: EDIT ME paypal.pro_checkout.password: EDIT ME diff --git a/app/config/payum.yml b/app/config/payum.yml index 8c5a6cf..c3c593f 100644 --- a/app/config/payum.yml +++ b/app/config/payum.yml @@ -74,7 +74,7 @@ payum: # note: there is also custom api paypal_express_checkout_via_token: factory: paypal_express_checkout - payum.api: @acme.payment.payum.paypal_express_checkout_api + payum.api: @acme.payment.payum.paypal_express_checkout_api_via_token paypal_pro_checkout: factory: paypal_pro_checkout diff --git a/src/Acme/PaymentBundle/Payum/Api/Paypal/ExpressCheckout/Nvp/FactoryViaToken.php b/src/Acme/PaymentBundle/Payum/Api/Paypal/ExpressCheckout/Nvp/FactoryViaToken.php index 4c3af03..78571a8 100644 --- a/src/Acme/PaymentBundle/Payum/Api/Paypal/ExpressCheckout/Nvp/FactoryViaToken.php +++ b/src/Acme/PaymentBundle/Payum/Api/Paypal/ExpressCheckout/Nvp/FactoryViaToken.php @@ -1,10 +1,11 @@ $this->container->getParameter('paypal.express_checkout_via_token.username'), 'password' => $this->container->getParameter('paypal.express_checkout_via_token.password'), 'signature' => $this->container->getParameter('paypal.express_checkout_via_token.signature'), diff --git a/src/Acme/PaymentBundle/Payum/Paypal/ExpressCheckout/Nvp/ApiViaToken.php b/src/Acme/PaymentBundle/Payum/Paypal/ExpressCheckout/Nvp/ApiViaToken.php index 25b15c2..67e4bd7 100644 --- a/src/Acme/PaymentBundle/Payum/Paypal/ExpressCheckout/Nvp/ApiViaToken.php +++ b/src/Acme/PaymentBundle/Payum/Paypal/ExpressCheckout/Nvp/ApiViaToken.php @@ -1,13 +1,17 @@ * Date: 30.03.16 * Time: 16:58 */ -class ApiViaToken extends Payum\Paypal\ExpressCheckout\Nvp\Api +class ApiViaToken extends Api { - // + } \ No newline at end of file diff --git a/src/Acme/PaymentBundle/Resources/config/services.yml b/src/Acme/PaymentBundle/Resources/config/services.yml index aeee6db..d4bcd1a 100644 --- a/src/Acme/PaymentBundle/Resources/config/services.yml +++ b/src/Acme/PaymentBundle/Resources/config/services.yml @@ -15,7 +15,7 @@ services: - @service_container acme.payment.payum.api.factory_via_token: - class: Acme\PaymentBundle\Payum\Api\Paypal\ExpressCheckout\Nvp\Factory + class: Acme\PaymentBundle\Payum\Api\Paypal\ExpressCheckout\Nvp\FactoryViaToken arguments: - @service_container diff --git a/src/Acme/PaypalExpressCheckoutBundle/Resources/views/PurchaseExamples/prepareViaToken.html.twig b/src/Acme/PaypalExpressCheckoutBundle/Resources/views/PurchaseExamples/prepareViaToken.html.twig index 70d5cb9..e43fd8c 100644 --- a/src/Acme/PaypalExpressCheckoutBundle/Resources/views/PurchaseExamples/prepareViaToken.html.twig +++ b/src/Acme/PaypalExpressCheckoutBundle/Resources/views/PurchaseExamples/prepareViaToken.html.twig @@ -13,6 +13,8 @@

    More info in Official PayPal Permissions API guide +

    +

    Use these credentials {{ paypal_usd_testuser_login }}/{{ paypal_usd_testuser_password }} to login on paypal side. Don't forget to check what's inside From 1d3c11583587524c20a64989b861a720a27fd1ec Mon Sep 17 00:00:00 2001 From: Dmitry Date: Wed, 30 Mar 2016 19:54:08 +0300 Subject: [PATCH 16/28] Customized new ApiViaToken class to use AuthToken for authorization, but it's not working properly yet --- .../ExpressCheckout/Nvp/ApiViaToken.php | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/src/Acme/PaymentBundle/Payum/Paypal/ExpressCheckout/Nvp/ApiViaToken.php b/src/Acme/PaymentBundle/Payum/Paypal/ExpressCheckout/Nvp/ApiViaToken.php index 67e4bd7..d110a1a 100644 --- a/src/Acme/PaymentBundle/Payum/Paypal/ExpressCheckout/Nvp/ApiViaToken.php +++ b/src/Acme/PaymentBundle/Payum/Paypal/ExpressCheckout/Nvp/ApiViaToken.php @@ -2,8 +2,11 @@ namespace Acme\PaymentBundle\Payum\Paypal\ExpressCheckout\Nvp; +use PayPal\Auth\Oauth\AuthSignature; +use Payum\Core\Exception\Http\HttpException; use Payum\Paypal\ExpressCheckout\Nvp; use Payum\Paypal\ExpressCheckout\Nvp\Api; +use GuzzleHttp\Psr7\Request; /** @@ -14,4 +17,75 @@ class ApiViaToken extends Api { + protected $options = array( + 'username' => null, + 'password' => null, + 'signature' => null, + 'return_url' => null, + 'cancel_url' => null, + 'sandbox' => null, + 'useraction' => null, + 'token' => null, + 'tokenSecret' => null, + 'cmd' => Api::CMD_EXPRESS_CHECKOUT, + ); + + /** + * @param array $fields + * + * @throws HttpException + * + * @return array + */ + protected function doRequest(array $fields) + { + $headers = array( + 'Content-Type' => 'application/x-www-form-urlencoded', + ); + + $method = 'POST'; + $this->addAuthorizeHeader($headers, $method); + + $request = new Request($method, $this->getApiEndpoint(), $headers, http_build_query($fields)); + + $response = $this->client->send($request); + + if (false == ($response->getStatusCode() >= 200 && $response->getStatusCode() < 300)) { + throw HttpException::factory($request, $response); + } + + $result = array(); + parse_str($response->getBody()->getContents(), $result); + foreach ($result as &$value) { + $value = urldecode($value); + } + + return $result; + } + + /** + * @param array $fields + */ + protected function addAuthorizeFields(array &$fields) + { + // we add nothing here; instead we use headers for this auth type + } + + protected function addAuthorizeHeader(array &$headers, $method = 'POST') + { + $authSignature = AuthSignature::generateFullAuthString( + $this->options['username'], + $this->options['password'], + $this->options['token'], + $this->options['tokenSecret'], + $method, + $this->getApiEndpoint() + ); + +// var_dump($this->options); +// die($authSignature); + + $headers['X-PAYPAL-AUTHORIZATION'] = $authSignature; + } + } \ No newline at end of file From d0ba6cf168f8e00656a9f5582906510660039927 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Thu, 31 Mar 2016 12:25:22 +0300 Subject: [PATCH 17/28] Added subject field to parameters.yml.dist; made the code work (not completely sure it works with the proper account, it needs testing) --- app/config/parameters.yml.dist | 2 ++ .../Payum/Paypal/ExpressCheckout/Nvp/ApiViaToken.php | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist index f905348..b2e344d 100644 --- a/app/config/parameters.yml.dist +++ b/app/config/parameters.yml.dist @@ -26,6 +26,8 @@ parameters: paypal.express_checkout_via_token.signature: EDIT ME paypal.express_checkout_via_token.token: EDIT ME paypal.express_checkout_via_token.tokenSecret: EDIT ME + ## e-mail of the merchant you work in behalf of + paypal.express_checkout_via_token.third_party_subject: EDIT ME paypal.pro_checkout.username: EDIT ME paypal.pro_checkout.password: EDIT ME diff --git a/src/Acme/PaymentBundle/Payum/Paypal/ExpressCheckout/Nvp/ApiViaToken.php b/src/Acme/PaymentBundle/Payum/Paypal/ExpressCheckout/Nvp/ApiViaToken.php index d110a1a..39c0c55 100644 --- a/src/Acme/PaymentBundle/Payum/Paypal/ExpressCheckout/Nvp/ApiViaToken.php +++ b/src/Acme/PaymentBundle/Payum/Paypal/ExpressCheckout/Nvp/ApiViaToken.php @@ -68,9 +68,15 @@ protected function doRequest(array $fields) */ protected function addAuthorizeFields(array &$fields) { - // we add nothing here; instead we use headers for this auth type +// parent::addAuthorizeFields($fields); + $fields['PWD'] = $this->options['password']; + $fields['USER'] = $this->options['username']; + $fields['SIGNATURE'] = $this->options['signature']; + + $fields['SUBJECT'] = $this->options['third_party_subject']; } + protected function addAuthorizeHeader(array &$headers, $method = 'POST') { $authSignature = AuthSignature::generateFullAuthString( @@ -82,9 +88,6 @@ protected function addAuthorizeHeader(array &$headers, $method = 'POST') $this->getApiEndpoint() ); -// var_dump($this->options); -// die($authSignature); - $headers['X-PAYPAL-AUTHORIZATION'] = $authSignature; } From ee0a968a04c3b815a91f374cddea304512c5795f Mon Sep 17 00:00:00 2001 From: Dmitry Date: Thu, 31 Mar 2016 18:10:13 +0300 Subject: [PATCH 18/28] Config fix --- app/config/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/config/config.yml b/app/config/config.yml index 93bf43a..312959a 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -23,6 +23,7 @@ framework: trusted_proxies: ~ session: { save_path: /tmp } fragments: ~ + translator: { fallbacks: [en] } # Twig Configuration twig: From fd3d9d3db06148f796eb226e1ac95ea03f21eef3 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Thu, 31 Mar 2016 18:12:40 +0300 Subject: [PATCH 19/28] Removed old factories, and used new ones from dev-version of Payum. Made all fixes in config and dist files --- app/config/parameters.yml.dist | 12 +-- app/config/payum.yml | 13 ++- .../ExpressCheckout/Nvp/FactoryViaToken.php | 37 -------- .../ExpressCheckout/Nvp/ApiViaToken.php | 94 ------------------- .../Resources/config/services.yml | 10 -- .../Resources/views/Default/index.html.twig | 2 +- .../Controller/PurchaseExamplesController.php | 8 +- ...l.twig => prepareViaPermissions.html.twig} | 0 8 files changed, 19 insertions(+), 157 deletions(-) delete mode 100644 src/Acme/PaymentBundle/Payum/Api/Paypal/ExpressCheckout/Nvp/FactoryViaToken.php delete mode 100644 src/Acme/PaymentBundle/Payum/Paypal/ExpressCheckout/Nvp/ApiViaToken.php rename src/Acme/PaypalExpressCheckoutBundle/Resources/views/PurchaseExamples/{prepareViaToken.html.twig => prepareViaPermissions.html.twig} (100%) diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist index b2e344d..8e95149 100644 --- a/app/config/parameters.yml.dist +++ b/app/config/parameters.yml.dist @@ -20,14 +20,12 @@ parameters: paypal.express_checkout.usd_testuser_login: EDIT ME paypal.express_checkout.usd_testuser_password: EDIT ME - # note: it's another account - paypal.express_checkout_via_token.username: EDIT ME - paypal.express_checkout_via_token.password: EDIT ME - paypal.express_checkout_via_token.signature: EDIT ME - paypal.express_checkout_via_token.token: EDIT ME - paypal.express_checkout_via_token.tokenSecret: EDIT ME + # required only for authorization by merchant token + # see: https://developer.paypal.com/docs/classic/permissions-service/integration-guide/PermissionsAbout/ + paypal.express_checkout.token: EDIT ME + paypal.express_checkout.tokenSecret: EDIT ME ## e-mail of the merchant you work in behalf of - paypal.express_checkout_via_token.third_party_subject: EDIT ME + paypal.express_checkout.third_party_subject: EDIT ME paypal.pro_checkout.username: EDIT ME paypal.pro_checkout.password: EDIT ME diff --git a/app/config/payum.yml b/app/config/payum.yml index c3c593f..881d745 100644 --- a/app/config/payum.yml +++ b/app/config/payum.yml @@ -71,10 +71,15 @@ payum: factory: paypal_express_checkout payum.api: @acme.payment.payum.paypal_express_checkout_api - # note: there is also custom api - paypal_express_checkout_via_token: - factory: paypal_express_checkout - payum.api: @acme.payment.payum.paypal_express_checkout_api_via_token + paypal_express_checkout_permission: + factory: paypal_express_checkout_permission + username: %paypal.express_checkout.username% + password: %paypal.express_checkout.password% + signature: %paypal.express_checkout.signature% + token: %paypal.express_checkout.token% + tokenSecret: %paypal.express_checkout.tokenSecret% + third_party_subject: %paypal.express_checkout.third_party_subject% + sandbox: true paypal_pro_checkout: factory: paypal_pro_checkout diff --git a/src/Acme/PaymentBundle/Payum/Api/Paypal/ExpressCheckout/Nvp/FactoryViaToken.php b/src/Acme/PaymentBundle/Payum/Api/Paypal/ExpressCheckout/Nvp/FactoryViaToken.php deleted file mode 100644 index 78571a8..0000000 --- a/src/Acme/PaymentBundle/Payum/Api/Paypal/ExpressCheckout/Nvp/FactoryViaToken.php +++ /dev/null @@ -1,37 +0,0 @@ -container = $container; - } - - /** - * @return ApiViaToken - */ - public function createPaypalExpressCheckoutApi() - { - return new ApiViaToken(array( - 'username' => $this->container->getParameter('paypal.express_checkout_via_token.username'), - 'password' => $this->container->getParameter('paypal.express_checkout_via_token.password'), - 'signature' => $this->container->getParameter('paypal.express_checkout_via_token.signature'), - 'token' => $this->container->getParameter('paypal.express_checkout_via_token.token'), - 'tokenSecret' => $this->container->getParameter('paypal.express_checkout_via_token.tokenSecret'), - 'sandbox' => true - )); - } -} \ No newline at end of file diff --git a/src/Acme/PaymentBundle/Payum/Paypal/ExpressCheckout/Nvp/ApiViaToken.php b/src/Acme/PaymentBundle/Payum/Paypal/ExpressCheckout/Nvp/ApiViaToken.php deleted file mode 100644 index 39c0c55..0000000 --- a/src/Acme/PaymentBundle/Payum/Paypal/ExpressCheckout/Nvp/ApiViaToken.php +++ /dev/null @@ -1,94 +0,0 @@ - - * Date: 30.03.16 - * Time: 16:58 - */ -class ApiViaToken extends Api -{ - - protected $options = array( - 'username' => null, - 'password' => null, - 'signature' => null, - 'return_url' => null, - 'cancel_url' => null, - 'sandbox' => null, - 'useraction' => null, - 'token' => null, - 'tokenSecret' => null, - 'cmd' => Api::CMD_EXPRESS_CHECKOUT, - ); - - /** - * @param array $fields - * - * @throws HttpException - * - * @return array - */ - protected function doRequest(array $fields) - { - $headers = array( - 'Content-Type' => 'application/x-www-form-urlencoded', - ); - - $method = 'POST'; - $this->addAuthorizeHeader($headers, $method); - - $request = new Request($method, $this->getApiEndpoint(), $headers, http_build_query($fields)); - - $response = $this->client->send($request); - - if (false == ($response->getStatusCode() >= 200 && $response->getStatusCode() < 300)) { - throw HttpException::factory($request, $response); - } - - $result = array(); - parse_str($response->getBody()->getContents(), $result); - foreach ($result as &$value) { - $value = urldecode($value); - } - - return $result; - } - - /** - * @param array $fields - */ - protected function addAuthorizeFields(array &$fields) - { -// parent::addAuthorizeFields($fields); - $fields['PWD'] = $this->options['password']; - $fields['USER'] = $this->options['username']; - $fields['SIGNATURE'] = $this->options['signature']; - - $fields['SUBJECT'] = $this->options['third_party_subject']; - } - - - protected function addAuthorizeHeader(array &$headers, $method = 'POST') - { - $authSignature = AuthSignature::generateFullAuthString( - $this->options['username'], - $this->options['password'], - $this->options['token'], - $this->options['tokenSecret'], - $method, - $this->getApiEndpoint() - ); - - $headers['X-PAYPAL-AUTHORIZATION'] = $authSignature; - } - -} \ No newline at end of file diff --git a/src/Acme/PaymentBundle/Resources/config/services.yml b/src/Acme/PaymentBundle/Resources/config/services.yml index d4bcd1a..915b613 100644 --- a/src/Acme/PaymentBundle/Resources/config/services.yml +++ b/src/Acme/PaymentBundle/Resources/config/services.yml @@ -18,13 +18,3 @@ services: class: Acme\PaymentBundle\Payum\Api\Paypal\ExpressCheckout\Nvp\FactoryViaToken arguments: - @service_container - - acme.payment.payum.paypal_express_checkout_api: - class: Payum\Paypal\ExpressCheckout\Nvp\Api - factory_service: acme.payment.payum.api.factory - factory_method: createPaypalExpressCheckoutApi - - acme.payment.payum.paypal_express_checkout_api_via_token: - class: Acme\PaymentBundle\Payum\Paypal\ExpressCheckout\Nvp\ApiViaToken - factory_service: acme.payment.payum.api.factory_via_token - factory_method: createPaypalExpressCheckoutApi diff --git a/src/Acme/PaymentBundle/Resources/views/Default/index.html.twig b/src/Acme/PaymentBundle/Resources/views/Default/index.html.twig index 79b3178..9349e79 100644 --- a/src/Acme/PaymentBundle/Resources/views/Default/index.html.twig +++ b/src/Acme/PaymentBundle/Resources/views/Default/index.html.twig @@ -32,7 +32,7 @@ Purchase using custom API.

  • - Purchase using merchant token to authorize. NEW! + Purchase using merchant token to authorize. NEW!
  • Purchase with Paypal configured in backend. diff --git a/src/Acme/PaypalExpressCheckoutBundle/Controller/PurchaseExamplesController.php b/src/Acme/PaypalExpressCheckoutBundle/Controller/PurchaseExamplesController.php index 68ddce3..65c7748 100644 --- a/src/Acme/PaypalExpressCheckoutBundle/Controller/PurchaseExamplesController.php +++ b/src/Acme/PaypalExpressCheckoutBundle/Controller/PurchaseExamplesController.php @@ -288,15 +288,15 @@ public function prepareWithCustomApiAction(Request $request) /** * @Extra\Route( - * "/prepare_simple_purchase_via_token", - * name="acme_paypal_express_checkout_prepare_simple_purchase_via_token" + * "/prepare_simple_purchase_via_permissions", + * name="acme_paypal_express_checkout_prepare_simple_purchase_via_permissions" * ) * * @Extra\Template */ - public function prepareViaTokenAction(Request $request) + public function prepareViaPermissionsAction(Request $request) { - $gatewayName = 'paypal_express_checkout_via_token'; + $gatewayName = 'paypal_express_checkout_permission'; $form = $this->createPurchaseForm(); $form->handleRequest($request); diff --git a/src/Acme/PaypalExpressCheckoutBundle/Resources/views/PurchaseExamples/prepareViaToken.html.twig b/src/Acme/PaypalExpressCheckoutBundle/Resources/views/PurchaseExamples/prepareViaPermissions.html.twig similarity index 100% rename from src/Acme/PaypalExpressCheckoutBundle/Resources/views/PurchaseExamples/prepareViaToken.html.twig rename to src/Acme/PaypalExpressCheckoutBundle/Resources/views/PurchaseExamples/prepareViaPermissions.html.twig From 83b8ac22470e8c1a007e3ea6cbe59552ac22e56e Mon Sep 17 00:00:00 2001 From: Dmitry Date: Thu, 31 Mar 2016 18:18:49 +0300 Subject: [PATCH 20/28] Fixed demo text --- .../views/PurchaseExamples/prepareViaPermissions.html.twig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Acme/PaypalExpressCheckoutBundle/Resources/views/PurchaseExamples/prepareViaPermissions.html.twig b/src/Acme/PaypalExpressCheckoutBundle/Resources/views/PurchaseExamples/prepareViaPermissions.html.twig index e43fd8c..cdf2c41 100644 --- a/src/Acme/PaypalExpressCheckoutBundle/Resources/views/PurchaseExamples/prepareViaPermissions.html.twig +++ b/src/Acme/PaypalExpressCheckoutBundle/Resources/views/PurchaseExamples/prepareViaPermissions.html.twig @@ -8,11 +8,11 @@ This is a simple example with minimal amount of code and config.

    - This payment will be processed with another Paypal merchant account, that You can find in parameters.yml file (paypal.express_checkout_via_token section), and it also needs a token/tokenSecret pair, that was received for this account. + This payment will be processed in behalf of another Paypal merchant account, that You can define in parameters.yml file (paypal.express_checkout.third_party_subject field). This factory needs also a token/tokenSecret pair, that was given to your merchant account by the account You should work on behalf to.

    - More info in Official PayPal Permissions API guide + More info about this feature You can find in Official PayPal Permissions API documentation

    Use these credentials {{ paypal_usd_testuser_login }}/{{ paypal_usd_testuser_password }} to login on paypal side. From ddb5cfcdce57efebec1d190f2fda705cb6fb6bd9 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Thu, 31 Mar 2016 18:22:07 +0300 Subject: [PATCH 21/28] Small fix --- .../Controller/PaypalPermissionsGetAccessTokenController.php | 4 +++- .../Controller/PaypalPermissionsGetRequestTokenController.php | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetAccessTokenController.php b/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetAccessTokenController.php index 27d7453..5305dea 100644 --- a/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetAccessTokenController.php +++ b/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetAccessTokenController.php @@ -21,6 +21,8 @@ class PaypalPermissionsGetAccessTokenController extends Controller { + const PAYPAL_SANDBOX_APP_ID = 'APP-80W284485P519543T'; + public function prepareAction(Request $request) { $httpRequest = $request; @@ -29,7 +31,7 @@ public function prepareAction(Request $request) 'acct1.UserName' => $this->container->getParameter('paypal.express_checkout.username'), 'acct1.Password' => $this->container->getParameter('paypal.express_checkout.password'), 'acct1.Signature' => $this->container->getParameter('paypal.express_checkout.signature'), - 'acct1.AppId' => 'APP-80W284485P519543T', // sandbox App Id + 'acct1.AppId' => self::PAYPAL_SANDBOX_APP_ID, ); $permissions = new PermissionsService($config); diff --git a/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetRequestTokenController.php b/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetRequestTokenController.php index a1986d5..1e35728 100644 --- a/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetRequestTokenController.php +++ b/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetRequestTokenController.php @@ -20,6 +20,7 @@ class PaypalPermissionsGetRequestTokenController extends Controller { + const PAYPAL_SANDBOX_APP_ID = 'APP-80W284485P519543T'; public function prepareAction(Request $request) { @@ -29,7 +30,7 @@ public function prepareAction(Request $request) 'acct1.UserName' => $this->container->getParameter('paypal.express_checkout.username'), 'acct1.Password' => $this->container->getParameter('paypal.express_checkout.password'), 'acct1.Signature' => $this->container->getParameter('paypal.express_checkout.signature'), - 'acct1.AppId' => 'APP-80W284485P519543T', // sandbox App Id + 'acct1.AppId' => self::PAYPAL_SANDBOX_APP_ID, ); $permissions = new PermissionsService($config); From 730ff2bb71d00ca8f1446e781d570fa517cf2769 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Fri, 1 Apr 2016 16:40:25 +0300 Subject: [PATCH 22/28] Revert "Changed .gitignore" This reverts commit 5e6d7c15c65636c6b1c5ecdc4661463b170a4bf3. --- .gitignore | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitignore b/.gitignore index 9fda229..1edf419 100644 --- a/.gitignore +++ b/.gitignore @@ -3,8 +3,6 @@ /app/cache/* /app/logs/* /app/config/config_dev_local.yml -/app/config/config_prod_local.yml -/app/config/config_test_local.yml /app/config/parameters.yml /app/Resources/payments /build/ From 89f954723d989c1442471d83ad1c11943c0cd305 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Fri, 1 Apr 2016 16:46:50 +0300 Subject: [PATCH 23/28] Revert "Added variables initialization to index.php (to make env selection work only for index.php too)" This reverts commit 704bf4b127ed29066e2cfb99c0f62015ae7aac9e. --- web/index.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/web/index.php b/web/index.php index ee42226..070c062 100644 --- a/web/index.php +++ b/web/index.php @@ -1,8 +1,5 @@ Date: Fri, 1 Apr 2016 16:47:08 +0300 Subject: [PATCH 24/28] Revert "Updated AppKernel.php to use local configs too" This reverts commit 50e7267a32300303a032d60cbc0c2912166e1101. --- app/AppKernel.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/AppKernel.php b/app/AppKernel.php index 381fad8..a233281 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -60,10 +60,6 @@ public function registerBundles() public function registerContainerConfiguration(LoaderInterface $loader) { - $config = __DIR__.'/config/config_'.$this->getEnvironment().'.yml'; - if (file_exists(__DIR__.'/config/config_'.$this->getEnvironment().'_local.yml')) { - $config = __DIR__.'/config/config_'.$this->getEnvironment().'_local.yml'; - } - $loader->load($config); + $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml'); } } From b1e154fed6f053fbda51fcbc03ee255f82d8eb9f Mon Sep 17 00:00:00 2001 From: Dmitry Date: Fri, 1 Apr 2016 16:47:22 +0300 Subject: [PATCH 25/28] Revert "Added app.php & app_dev.php according to modern official userguide" This reverts commit a418f733547f67ad3ff63df6e3baa3ff19e6b97f. --- web/app.php | 6 ------ web/app_dev.php | 6 ------ web/index.php | 2 ++ 3 files changed, 2 insertions(+), 12 deletions(-) delete mode 100644 web/app.php delete mode 100644 web/app_dev.php diff --git a/web/app.php b/web/app.php deleted file mode 100644 index f1e796d..0000000 --- a/web/app.php +++ /dev/null @@ -1,6 +0,0 @@ - Date: Fri, 1 Apr 2016 16:55:42 +0300 Subject: [PATCH 26/28] Moved PayPal sandbox app id into parameters.yml.dist --- app/config/parameters.yml.dist | 3 +++ .../Controller/PaypalPermissionsGetAccessTokenController.php | 4 +--- .../Controller/PaypalPermissionsGetRequestTokenController.php | 3 +-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist index 8e95149..ba90205 100644 --- a/app/config/parameters.yml.dist +++ b/app/config/parameters.yml.dist @@ -13,6 +13,9 @@ parameters: locale: en secret: ThisTokenIsNotSoSecretChangeIt + + # always the same + paypal.sandbox_app_id: APP-80W284485P519543T paypal.express_checkout.username: EDIT ME paypal.express_checkout.password: EDIT ME diff --git a/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetAccessTokenController.php b/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetAccessTokenController.php index 5305dea..d293ea2 100644 --- a/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetAccessTokenController.php +++ b/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetAccessTokenController.php @@ -21,8 +21,6 @@ class PaypalPermissionsGetAccessTokenController extends Controller { - const PAYPAL_SANDBOX_APP_ID = 'APP-80W284485P519543T'; - public function prepareAction(Request $request) { $httpRequest = $request; @@ -31,7 +29,7 @@ public function prepareAction(Request $request) 'acct1.UserName' => $this->container->getParameter('paypal.express_checkout.username'), 'acct1.Password' => $this->container->getParameter('paypal.express_checkout.password'), 'acct1.Signature' => $this->container->getParameter('paypal.express_checkout.signature'), - 'acct1.AppId' => self::PAYPAL_SANDBOX_APP_ID, + 'acct1.AppId' => $this->container->getParameter('paypal.sandbox_app_id'), ); $permissions = new PermissionsService($config); diff --git a/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetRequestTokenController.php b/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetRequestTokenController.php index 1e35728..63d494f 100644 --- a/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetRequestTokenController.php +++ b/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetRequestTokenController.php @@ -20,7 +20,6 @@ class PaypalPermissionsGetRequestTokenController extends Controller { - const PAYPAL_SANDBOX_APP_ID = 'APP-80W284485P519543T'; public function prepareAction(Request $request) { @@ -30,7 +29,7 @@ public function prepareAction(Request $request) 'acct1.UserName' => $this->container->getParameter('paypal.express_checkout.username'), 'acct1.Password' => $this->container->getParameter('paypal.express_checkout.password'), 'acct1.Signature' => $this->container->getParameter('paypal.express_checkout.signature'), - 'acct1.AppId' => self::PAYPAL_SANDBOX_APP_ID, + 'acct1.AppId' => $this->container->getParameter('paypal.sandbox_app_id'), ); $permissions = new PermissionsService($config); From 1a20bff24ca0b467fb7929ef9d61aba39a8f7129 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Fri, 1 Apr 2016 16:57:44 +0300 Subject: [PATCH 27/28] Config fix --- app/config/config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/app/config/config.yml b/app/config/config.yml index 312959a..93bf43a 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -23,7 +23,6 @@ framework: trusted_proxies: ~ session: { save_path: /tmp } fragments: ~ - translator: { fallbacks: [en] } # Twig Configuration twig: From 2e4a3f9fda699e21b369fae2486cf89939ede093 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Fri, 1 Apr 2016 18:23:18 +0300 Subject: [PATCH 28/28] tokenSecret -> token_secret --- app/config/parameters.yml.dist | 2 +- app/config/payum.yml | 2 +- .../views/PurchaseExamples/prepareViaPermissions.html.twig | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist index ba90205..01852fb 100644 --- a/app/config/parameters.yml.dist +++ b/app/config/parameters.yml.dist @@ -26,7 +26,7 @@ parameters: # required only for authorization by merchant token # see: https://developer.paypal.com/docs/classic/permissions-service/integration-guide/PermissionsAbout/ paypal.express_checkout.token: EDIT ME - paypal.express_checkout.tokenSecret: EDIT ME + paypal.express_checkout.token_secret: EDIT ME ## e-mail of the merchant you work in behalf of paypal.express_checkout.third_party_subject: EDIT ME diff --git a/app/config/payum.yml b/app/config/payum.yml index 881d745..dfdbbb0 100644 --- a/app/config/payum.yml +++ b/app/config/payum.yml @@ -77,7 +77,7 @@ payum: password: %paypal.express_checkout.password% signature: %paypal.express_checkout.signature% token: %paypal.express_checkout.token% - tokenSecret: %paypal.express_checkout.tokenSecret% + token_secret: %paypal.express_checkout.token_secret% third_party_subject: %paypal.express_checkout.third_party_subject% sandbox: true diff --git a/src/Acme/PaypalExpressCheckoutBundle/Resources/views/PurchaseExamples/prepareViaPermissions.html.twig b/src/Acme/PaypalExpressCheckoutBundle/Resources/views/PurchaseExamples/prepareViaPermissions.html.twig index cdf2c41..859fd8d 100644 --- a/src/Acme/PaypalExpressCheckoutBundle/Resources/views/PurchaseExamples/prepareViaPermissions.html.twig +++ b/src/Acme/PaypalExpressCheckoutBundle/Resources/views/PurchaseExamples/prepareViaPermissions.html.twig @@ -8,7 +8,7 @@ This is a simple example with minimal amount of code and config.

    - This payment will be processed in behalf of another Paypal merchant account, that You can define in parameters.yml file (paypal.express_checkout.third_party_subject field). This factory needs also a token/tokenSecret pair, that was given to your merchant account by the account You should work on behalf to. + This payment will be processed in behalf of another Paypal merchant account, that You can define in parameters.yml file (paypal.express_checkout.third_party_subject field). This factory needs also a token/token_secret pair, that was given to your merchant account by the account You should work on behalf to.

    More info about this feature You can find in