diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist index 712e4d0..01852fb 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 @@ -20,6 +23,13 @@ parameters: paypal.express_checkout.usd_testuser_login: EDIT ME paypal.express_checkout.usd_testuser_password: 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.token_secret: EDIT ME + ## e-mail of the merchant you work in behalf of + paypal.express_checkout.third_party_subject: 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 c770448..dfdbbb0 100644 --- a/app/config/payum.yml +++ b/app/config/payum.yml @@ -71,6 +71,16 @@ payum: factory: paypal_express_checkout payum.api: @acme.payment.payum.paypal_express_checkout_api + 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% + token_secret: %paypal.express_checkout.token_secret% + third_party_subject: %paypal.express_checkout.third_party_subject% + sandbox: true + paypal_pro_checkout: factory: paypal_pro_checkout username: %paypal.pro_checkout.username% @@ -187,6 +197,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 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..ade002e 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", @@ -5511,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": { @@ -5607,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/" }, @@ -5641,7 +5736,7 @@ "keywords": [ "framework" ], - "time": "2016-02-28 21:06:29" + "time": "2016-03-27 12:57:53" }, { "name": "true/punycode", diff --git a/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetAccessTokenController.php b/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetAccessTokenController.php new file mode 100644 index 0000000..d293ea2 --- /dev/null +++ b/src/Acme/PaymentBundle/Controller/PaypalPermissionsGetAccessTokenController.php @@ -0,0 +1,87 @@ + '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' => $this->container->getParameter('paypal.sandbox_app_id'), + ); + + $permissions = new PermissionsService($config); + + if (!$request->query->has('verification_code')) { + $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.. + $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:token.html.twig', array( + 'status' => $response->responseEnvelope->ack, + 'response' => json_encode($response, JSON_PRETTY_PRINT) + )); + } + + /** + * @return \Symfony\Component\Form\Form + */ + protected function createDetailsForm() + { + return $this->createFormBuilder() + ->add('request_token', null, array( + 'data' => '', + 'property_path' => 'request_token' + )) + ->add('cmd', 'hidden', array( + 'data' => '_grant-permission', + 'property_path' => 'cmd', + )) + ->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..63d494f --- /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' => $this->container->getParameter('paypal.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:token.html.twig', array( + 'pagetitle' => 'Request token', + 'status' => $response->responseEnvelope->ack, + 'response' => json_encode($response, JSON_PRETTY_PRINT), + )); + } + + return $this->render('AcmePaymentBundle::permissionsGetRequestToken.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 7f9ad74..3d13bd0 100644 --- a/src/Acme/PaymentBundle/Resources/config/routing.yml +++ b/src/Acme/PaymentBundle/Resources/config/routing.yml @@ -61,4 +61,16 @@ 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_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/config/services.yml b/src/Acme/PaymentBundle/Resources/config/services.yml index 4bca040..915b613 100644 --- a/src/Acme/PaymentBundle/Resources/config/services.yml +++ b/src/Acme/PaymentBundle/Resources/config/services.yml @@ -14,7 +14,7 @@ services: 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 + acme.payment.payum.api.factory_via_token: + class: Acme\PaymentBundle\Payum\Api\Paypal\ExpressCheckout\Nvp\FactoryViaToken + arguments: + - @service_container diff --git a/src/Acme/PaymentBundle/Resources/views/Default/index.html.twig b/src/Acme/PaymentBundle/Resources/views/Default/index.html.twig index 79aee94..9349e79 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 @@
{{ response|raw }}+
+ 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/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 Official PayPal Permissions API documentation +
++ Use these credentials {{ paypal_usd_testuser_login }}/{{ paypal_usd_testuser_password }} to login on paypal side. + + Don't forget to check what's inside +
+ +