author
int64
658
755k
date
stringlengths
19
19
timezone
int64
-46,800
43.2k
hash
stringlengths
40
40
message
stringlengths
5
490
mods
list
language
stringclasses
20 values
license
stringclasses
3 values
repo
stringlengths
5
68
original_message
stringlengths
12
491
331,280
04.01.2017 17:46:47
0
662e971e83e86a9896bb6a889c05bc0383262180
support for angular-cli generators
[ { "change_type": "ADD", "old_path": null, "new_path": "angular-cli.json", "diff": "+{\n+ \"project\": {\n+ \"version\": \"1.0.0-beta.24\",\n+ \"name\": \"angular2-webpack-advance-starter\"\n+ },\n+ \"apps\": [\n+ {\n+ \"root\": \"src\",\n+ \"outDir\": \"dist\",\n+ \"assets\": [\n+ \"assets\",\n+ \"favicon.ico\"\n+ ],\n+ \"index\": \"index.html\",\n+ \"main\": \"main.ts\",\n+ \"test\": \"test.ts\",\n+ \"tsconfig\": \"tsconfig.json\",\n+ \"prefix\": \"app\",\n+ \"mobile\": false,\n+ \"styles\": [\n+ \"styles.css\"\n+ ],\n+ \"scripts\": [],\n+ \"environments\": {\n+ \"source\": \"environments/environment.ts\",\n+ \"dev\": \"environments/environment.ts\",\n+ \"prod\": \"environments/environment.prod.ts\"\n+ }\n+ }\n+ ],\n+ \"addons\": [],\n+ \"packages\": [],\n+ \"e2e\": {\n+ \"protractor\": {\n+ \"config\": \"./protractor.conf.js\"\n+ }\n+ },\n+ \"test\": {\n+ \"karma\": {\n+ \"config\": \"./karma.conf.js\"\n+ }\n+ },\n+ \"defaults\": {\n+ \"styleExt\": \"scss\",\n+ \"prefixInterfaces\": false,\n+ \"inline\": {\n+ \"style\": false,\n+ \"template\": false\n+ },\n+ \"spec\": {\n+ \"class\": false,\n+ \"component\": true,\n+ \"directive\": true,\n+ \"module\": false,\n+ \"pipe\": true,\n+ \"service\": true\n+ }\n+ }\n+}\n" }, { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"@types/source-map\": \"^0.5.0\",\n\"@types/uglify-js\": \"^2.0.27\",\n\"@types/webpack\": \"^2.0.0\",\n+ \"angular-cli\": \"1.0.0-beta.24\",\n\"angular-router-loader\": \"^0.4.0\",\n\"angular2-template-loader\": \"^0.6.0\",\n\"assets-webpack-plugin\": \"^3.4.0\",\n" } ]
TypeScript
MIT License
jonnybgod/angular2-webpack-advance-starter
support for angular-cli generators
331,280
05.01.2017 00:36:23
0
8e75f035e9fb5aa0c1409099565fb56d0c361446
fix ng-router-loader for aot nested lazy loaded modules
[ { "change_type": "MODIFY", "old_path": "config/webpack.common.js", "new_path": "config/webpack.common.js", "diff": "@@ -104,7 +104,14 @@ module.exports = function (options) {\n'@angularclass/hmr-loader?pretty=' + !isProd + '&prod=' + isProd,\n'awesome-typescript-loader?{configFileName: \"tsconfig.webpack.json\"}',\n'angular2-template-loader',\n- 'angular-router-loader?loader=system&genDir=compiled/src/app&aot=' + AOT\n+ {\n+ loader: 'ng-router-loader',\n+ options: {\n+ loader: 'async-system',\n+ genDir: 'compiled',\n+ aot: AOT\n+ }\n+ }\n],\nexclude: [/\\.(spec|e2e)\\.ts$/]\n},\n" }, { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"@types/uglify-js\": \"^2.0.27\",\n\"@types/webpack\": \"^2.0.0\",\n\"angular-cli\": \"1.0.0-beta.24\",\n- \"angular-router-loader\": \"^0.4.0\",\n\"angular2-template-loader\": \"^0.6.0\",\n\"assets-webpack-plugin\": \"^3.4.0\",\n\"awesome-typescript-loader\": \"~3.0.0-beta.17\",\n\"karma-remap-coverage\": \"^0.1.4\",\n\"karma-sourcemap-loader\": \"^0.3.7\",\n\"karma-webpack\": \"1.8.1\",\n+ \"ng-router-loader\": \"^1.0.0\",\n\"ngc-webpack\": \"^1.0.2\",\n\"ngrx-store-freeze\": \"0.1.6\",\n\"node-sass\": \"^4.1.1\",\n" } ]
TypeScript
MIT License
jonnybgod/angular2-webpack-advance-starter
fix ng-router-loader for aot nested lazy loaded modules
331,280
05.01.2017 05:10:07
0
07b1a88bababcf0bd1fffb368995e8b1a0793ef7
fix ng-router-loader
[ { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"karma-remap-coverage\": \"^0.1.4\",\n\"karma-sourcemap-loader\": \"^0.3.7\",\n\"karma-webpack\": \"1.8.1\",\n- \"ng-router-loader\": \"^1.0.0\",\n+ \"ng-router-loader\": \"^1.0.1\",\n\"ngc-webpack\": \"^1.0.2\",\n\"ngrx-store-freeze\": \"0.1.6\",\n\"node-sass\": \"^4.1.1\",\n" } ]
TypeScript
MIT License
jonnybgod/angular2-webpack-advance-starter
fix ng-router-loader
331,280
05.01.2017 19:32:23
0
ec4200ae0ad03a00a1c770034384031508bacee5
fix ng-router-loader version
[ { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"karma-remap-coverage\": \"^0.1.4\",\n\"karma-sourcemap-loader\": \"^0.3.7\",\n\"karma-webpack\": \"1.8.1\",\n- \"ng-router-loader\": \"^1.0.1\",\n+ \"ng-router-loader\": \"^1.0.2\",\n\"ngc-webpack\": \"^1.0.2\",\n\"ngrx-store-freeze\": \"0.1.6\",\n\"node-sass\": \"^4.1.1\",\n" } ]
TypeScript
MIT License
jonnybgod/angular2-webpack-advance-starter
fix ng-router-loader version
331,280
19.01.2017 15:47:01
0
25d73da71507c332e02269d2b6842a65953bd58b
fix(github-deploy): hash mode and 404.html fallback
[ { "change_type": "MODIFY", "old_path": "TODO.md", "new_path": "TODO.md", "diff": "@@ -20,15 +20,13 @@ TODO\n## Bugs\n-- [ ] github-deploy not working properly\n-\n-### Before commit manual checks\n+## Before commit manual checks\n- [x] npm run ci\n- [x] npm start\n- [x] npm run docs\n-- [ ] npm run github-deploy:aot\n+- [x] npm run github-deploy:aot\n./nativescript\n- [ ] npm run start:ios\n" }, { "change_type": "MODIFY", "old_path": "config/advance/helpers.js", "new_path": "config/advance/helpers.js", "diff": "* @author: @AngularClass\n*/\nvar path = require('path');\n-const HtmlWebpackPlugin = require('html-webpack-plugin');\n+const EVENT = process.env.npm_lifecycle_event || '';\n// Helper functions\nvar ROOT = path.resolve(__dirname, '../..');\n@@ -11,6 +11,10 @@ function hasProcessFlag(flag) {\nreturn process.argv.join('').indexOf(flag) > -1;\n}\n+function hasNpmFlag(flag) {\n+ return EVENT.includes(flag);\n+}\n+\nfunction isWebpackDevServer() {\nreturn process.argv[1] && !! (/webpack-dev-server$/.exec(process.argv[1]));\n}\n@@ -27,17 +31,28 @@ function checkNodeImport(context, request, cb) {\ncb();\n}\n-function removeHtmlWebpackPlugin(plugins) {\n+function removePlugins(plugins, test) {\nfor (var i = 0; i < plugins.length; i++) {\n- if (plugins[i] instanceof HtmlWebpackPlugin) {\n+ if (test.filter(function(t) { return plugins[i] instanceof t;}).length > 0) {\nplugins.splice(i, 1);\nreturn;\n}\n}\n}\n+function removeRules(rules, test) {\n+ for (var i = 0; i < rules.length; i++) {\n+ if (test.filter(function(t) { return t.toString() === rules[i].test.toString();}).length > 0) {\n+ rules.splice(i, 1);\n+ return;\n+ }\n+ }\n+}\n+\nexports.hasProcessFlag = hasProcessFlag;\n+exports.hasNpmFlag = hasNpmFlag;\nexports.isWebpackDevServer = isWebpackDevServer;\nexports.root = root;\nexports.checkNodeImport = checkNodeImport;\n-exports.removeHtmlWebpackPlugin = removeHtmlWebpackPlugin;\n+exports.removePlugins = removePlugins;\n+exports.removeRules = removeRules;\n" }, { "change_type": "MODIFY", "old_path": "config/advance/webpack.desktop.build.renderer.js", "new_path": "config/advance/webpack.desktop.build.renderer.js", "diff": "@@ -13,14 +13,16 @@ const customConfig = require('../custom/webpack.web.prod.js');\n/**\n* Webpack Constants\n*/\n-const HtmlWebpackPlugin = require('html-webpack-plugin');\nconst ENV = process.env.ENV = process.env.NODE_ENV = 'production';\n+const AOT = helpers.hasNpmFlag('aot');\n/**\n* Webpack Plugins\n*/\nconst NormalModuleReplacementPlugin = require('webpack/lib/NormalModuleReplacementPlugin');\nconst DefinePlugin = require('webpack/lib/DefinePlugin');\n+const HtmlWebpackPlugin = require('html-webpack-plugin');\n+const ngcWebpack = require('ngc-webpack');\nconst METADATA = Object.assign({\n@@ -29,8 +31,11 @@ const METADATA = Object.assign({\n}, customConfig.metadata);\nlet webpackConfig = webpackMerge.smart(simpleWebProdConfig({env: ENV}), commonAdvanceConfig({env: ENV}));\n-// remove the instance of HtmlWebpackPlugin.\n-helpers.removeHtmlWebpackPlugin(webpackConfig.plugins);\n+\n+// remove the plugins to be overwriten.\n+helpers.removePlugins(webpackConfig.plugins, [HtmlWebpackPlugin, ngcWebpack.NgcWebpackPlugin]);\n+// remove the rules to be overwriten.\n+helpers.removeRules(webpackConfig.module.rules, [/\\.ts$/]);\n/**\n* Webpack configuration\n@@ -39,12 +44,47 @@ helpers.removeHtmlWebpackPlugin(webpackConfig.plugins);\n*/\nmodule.exports = function(options) {\nreturn webpackMerge.smart(webpackConfig, {\n+ module: {\n+ rules: [\n+ /*\n+ * Typescript loader support for .ts and Angular 2 async routes via .async.ts\n+ * Replace templateUrl and stylesUrl with require()\n+ *\n+ * See: https://github.com/s-panferov/awesome-typescript-loader\n+ * See: https://github.com/TheLarkInn/angular2-template-loader\n+ */\n+ {\n+ test: /\\.ts$/,\n+ use: [\n+ '@angularclass/hmr-loader?pretty=' + !isProd + '&prod=' + isProd,\n+ 'awesome-typescript-loader?{configFileName: \"tsconfig.desktop.json\"}',\n+ 'angular2-template-loader',\n+ {\n+ loader: 'ng-router-loader',\n+ options: {\n+ loader: 'async-require',\n+ genDir: 'compiled',\n+ aot: AOT\n+ }\n+ }\n+ ],\n+ exclude: [/\\.(spec|e2e)\\.ts$/]\n+ },\n+ ]\n+ },\n+\nplugins: [\nnew NormalModuleReplacementPlugin(\n/routerModule/,\nhelpers.root('src/app/app.routerModule.desktop.ts')\n),\n+ new ngcWebpack.NgcWebpackPlugin({\n+ disabled: !AOT,\n+ tsConfig: helpers.root('tsconfig.desktop.json'),\n+ resourceOverride: helpers.root('config/resource-override.js')\n+ }),\n+\nnew DefinePlugin({\n'BASE_URL': METADATA.baseUrl,\n'TARGET_DESKTOP': true,\n" }, { "change_type": "MODIFY", "old_path": "config/advance/webpack.github-deploy.js", "new_path": "config/advance/webpack.github-deploy.js", "diff": "@@ -6,12 +6,13 @@ const path = require('path');\nconst helpers = require('./helpers');\nconst ghDeploy = require('../github-deploy');\nconst webpackMerge = require('webpack-merge'); // used to merge webpack configs\n-const ghpages = require('gh-pages');\n/**\n* Webpack Plugins\n*/\n+const NormalModuleReplacementPlugin = require('webpack/lib/NormalModuleReplacementPlugin');\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\n+const ngcWebpack = require('ngc-webpack');\n/**\n* Webpack Constants\n@@ -19,6 +20,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');\nconst GIT_REMOTE_NAME = 'origin';\nconst COMMIT_MESSAGE = 'Updates';\nconst GH_REPO_NAME = ghDeploy.getRepoName(GIT_REMOTE_NAME);\n+const AOT = helpers.hasNpmFlag('aot');\nmodule.exports = function (options) {\nconst webpackConfigFactory = ghDeploy.getWebpackConfigModule(options); // the settings that are common to prod and dev\n@@ -28,8 +30,16 @@ module.exports = function (options) {\nisDevServer: helpers.isWebpackDevServer()\n}, require('../custom/webpack.common.js').metadata);\n- // remove the instance of HtmlWebpackPlugin.\n- helpers.removeHtmlWebpackPlugin(webpackConfig.plugins);\n+ // remove the plugins to be overwriten.\n+ helpers.removePlugins(webpackConfig.plugins, [HtmlWebpackPlugin, ngcWebpack.NgcWebpackPlugin]);\n+ // remove the rules to be overwriten.\n+ helpers.removeRules(webpackConfig.module.rules, [/\\.ts$/, /\\.html$/]);\n+\n+ for (var i = 0; i < webpackConfig.module.rules.length; i++) {\n+ if (webpackConfig.module.rules[i].test.toString() === /\\.html$/.toString()) {\n+ webpackConfig.module.rules[i].exclude.push(helpers.root('src/assets/404.html'));\n+ }\n+ }\nreturn webpackMerge(webpackConfig, {\noutput: {\n@@ -49,7 +59,41 @@ module.exports = function (options) {\npublicPath: '/' + GH_REPO_NAME + '/' + ghDeploy.safeUrl(webpackConfig.output.publicPath)\n},\n+ module: {\n+ rules: [\n+ /*\n+ * Typescript loader support for .ts and Angular 2 async routes via .async.ts\n+ * Replace templateUrl and stylesUrl with require()\n+ *\n+ * See: https://github.com/s-panferov/awesome-typescript-loader\n+ * See: https://github.com/TheLarkInn/angular2-template-loader\n+ */\n+ {\n+ test: /\\.ts$/,\n+ use: [\n+ '@angularclass/hmr-loader?pretty=' + !isProd + '&prod=' + isProd,\n+ 'awesome-typescript-loader?{configFileName: \"tsconfig.desktop.json\"}',\n+ 'angular2-template-loader',\n+ {\n+ loader: 'ng-router-loader',\n+ options: {\n+ loader: 'async-require',\n+ genDir: 'compiled',\n+ aot: AOT\n+ }\n+ }\n+ ],\n+ exclude: [/\\.(spec|e2e)\\.ts$/]\n+ }\n+ ]\n+ },\n+\nplugins: [\n+ new NormalModuleReplacementPlugin(\n+ /routerModule/,\n+ helpers.root('src/app/app.routerModule.desktop.ts')\n+ ),\n+\nnew HtmlWebpackPlugin({\ntemplate: 'src/index.html',\ntitle: METADATA.title,\n@@ -58,6 +102,22 @@ module.exports = function (options) {\ninject: 'head'\n}),\n+ new HtmlWebpackPlugin({\n+ template: 'src/assets/404.html',\n+ filename: '404.html',\n+ title: METADATA.title,\n+ metadata: {\n+ GH_REPO_NAME: GH_REPO_NAME || ''\n+ },\n+ inject: false\n+ }),\n+\n+ new ngcWebpack.NgcWebpackPlugin({\n+ disabled: !AOT,\n+ tsConfig: helpers.root('tsconfig.desktop.json'),\n+ resourceOverride: helpers.root('config/resource-override.js')\n+ }),\n+\nfunction() {\nthis.plugin('done', function(stats) {\nif (stats.compilation.errors.length > 0) return;\n@@ -81,7 +141,7 @@ module.exports = function (options) {\n// this is the fix for now.\nfs.writeFileSync(path.join(webpackConfig.output.path, '.nojekyll'), '');\n- ghpages.publish(webpackConfig.output.path, options, function(err) {\n+ require('gh-pages').publish(webpackConfig.output.path, options, function(err) {\nif (err) {\nconsole.log('GitHub deployment done. STATUS: ERROR.');\nthrow err;\n" }, { "change_type": "MODIFY", "old_path": "config/advance/webpack.web.dev.js", "new_path": "config/advance/webpack.web.dev.js", "diff": "const helpers = require('./helpers');\nconst webpackMerge = require('webpack-merge'); // used to merge webpack configs\n+const HtmlWebpackPlugin = require('html-webpack-plugin');\nconst commonAdvanceConfig = require('./webpack.common.web.js');\nconst simpleWebDevConfig = require('../webpack.dev.js');\n@@ -16,7 +17,7 @@ const ENV = process.env.ENV = process.env.NODE_ENV = 'development';\nlet webpackConfig = simpleWebDevConfig({env: ENV});\n// remove the instance of HtmlWebpackPlugin.\n-helpers.removeHtmlWebpackPlugin(webpackConfig.plugins);\n+helpers.removePlugins(webpackConfig.plugins, [HtmlWebpackPlugin]);\n/**\n* Webpack configuration\n" }, { "change_type": "MODIFY", "old_path": "config/advance/webpack.web.prod.js", "new_path": "config/advance/webpack.web.prod.js", "diff": "const helpers = require('./helpers');\nconst webpackMerge = require('webpack-merge'); // used to merge webpack configs\n+const HtmlWebpackPlugin = require('html-webpack-plugin');\nconst commonAdvanceConfig = require('./webpack.common.web.js');\nconst simpleWebProdConfig = require('../webpack.prod.js');\n@@ -16,7 +17,7 @@ const ENV = process.env.ENV = process.env.NODE_ENV = 'production';\nlet webpackConfig = simpleWebProdConfig({env: ENV});\n// remove the instance of HtmlWebpackPlugin.\n-helpers.removeHtmlWebpackPlugin(webpackConfig.plugins);\n+helpers.removePlugins(webpackConfig.plugins, [HtmlWebpackPlugin]);\n/**\n* Webpack configuration\n" }, { "change_type": "MODIFY", "old_path": "config/advance/webpack.web.test.js", "new_path": "config/advance/webpack.web.test.js", "diff": "@@ -6,6 +6,7 @@ const helpers = require('./helpers');\nconst webpackMerge = require('webpack-merge'); // used to merge webpack configs\nconst HtmlElementsPlugin = require('../html-elements-plugin');\n+const HtmlWebpackPlugin = require('html-webpack-plugin');\nconst ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin');\nconst commonAdvanceConfig = require('./webpack.common.web.js');\n@@ -19,7 +20,7 @@ const ENV = process.env.ENV = process.env.NODE_ENV = 'test';\nlet webpackConfig = simpleWebTestConfig({env: ENV});\n// remove the instance of HtmlWebpackPlugin.\n-helpers.removeHtmlWebpackPlugin(webpackConfig.plugins);\n+helpers.removePlugins(webpackConfig.plugins, [HtmlWebpackPlugin]);\n/**\n* Webpack configuration\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/assets/404.html", "diff": "+<!DOCTYPE html>\n+<html>\n+ <head>\n+ <meta charset=\"utf-8\">\n+ <title><%= htmlWebpackPlugin.options.title %></title>\n+ <script type=\"text/javascript\">\n+ var pathPrefix = '<%= htmlWebpackPlugin.options.metadata.GH_REPO_NAME %>';\n+\n+ window.location.replace(window.location.href.replace(\n+ window.location.host + '/' + pathPrefix,\n+ window.location.host + '/' + pathPrefix + (pathPrefix ? '/#' : '#/')\n+ ));\n+ </script>\n+ </head>\n+ <body>\n+ </body>\n+</html>\n\\ No newline at end of file\n" } ]
TypeScript
MIT License
jonnybgod/angular2-webpack-advance-starter
fix(github-deploy): hash mode and 404.html fallback
331,280
19.01.2017 15:47:44
0
2fbda682fdfa03d1a63b3f1c9d84ad7dd45032bf
shore(ci): temporary remove desktop build
[ { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"build:prod:desktop\": \"npm run build:prod:desktop:renderer && npm run build:prod:desktop:main\",\n\"build:prod:desktop:main\": \"webpack --config config/advance/webpack.desktop.build.main.js --progress --profile --bail\",\n\"build:prod:desktop:renderer\": \"webpack --config config/advance/webpack.desktop.build.renderer.js --progress --profile --bail\",\n- \"ci:aot\": \"npm run test && npm run build:aot && npm run e2e && npm run build:aot:desktop\",\n- \"ci:jit\": \"npm run test && npm run build:prod && npm run e2e && npm run build:desktop\",\n+ \"ci:aot\": \"npm run test && npm run build:aot && npm run e2e\",\n+ \"ci:jit\": \"npm run test && npm run build:prod && npm run e2e\",\n\"ci:nobuild\": \"npm test && npm run e2e\",\n- \"ci:testall\": \"npm run test && npm run build:prod && npm run e2e && npm run build:aot && npm run e2e && npm run build:desktop && npm run build:aot:desktop\",\n+ \"ci:testall\": \"npm run test && npm run build:prod && npm run e2e && npm run build:aot && npm run e2e\",\n\"ci\": \"npm run ci:testall\",\n\"clean\": \"npm cache clean && npm run rimraf -- node_modules doc coverage dist desktop _temp compiled\",\n\"clean:aot\": \"npm run rimraf -- compiled\",\n" } ]
TypeScript
MIT License
jonnybgod/angular2-webpack-advance-starter
shore(ci): temporary remove desktop build
331,280
28.01.2017 19:14:51
0
616377abdd64d41c43c26cf83e34eb74c93e6762
fix gitdeploy and desktop render
[ { "change_type": "MODIFY", "old_path": "config/advance/helpers.js", "new_path": "config/advance/helpers.js", "diff": "@@ -32,21 +32,21 @@ function checkNodeImport(context, request, cb) {\n}\nfunction removePlugins(plugins, test) {\n- for (var i = 0; i < plugins.length; i++) {\n+ for (var i = plugins.length - 1; i >= 0; i--) {\nif (test.filter(function(t) { return plugins[i] instanceof t;}).length > 0) {\nplugins.splice(i, 1);\n- return;\n}\n}\n+ return;\n}\nfunction removeRules(rules, test) {\n- for (var i = 0; i < rules.length; i++) {\n+ for (var i = rules.length - 1; i >= 0; i--) {\nif (test.filter(function(t) { return t.toString() === rules[i].test.toString();}).length > 0) {\nrules.splice(i, 1);\n- return;\n}\n}\n+ return;\n}\nexports.hasProcessFlag = hasProcessFlag;\n" }, { "change_type": "MODIFY", "old_path": "config/advance/webpack.desktop.build.renderer.js", "new_path": "config/advance/webpack.desktop.build.renderer.js", "diff": "@@ -33,7 +33,11 @@ const METADATA = Object.assign({\nlet webpackConfig = webpackMerge.smart(simpleWebProdConfig({env: ENV}), commonAdvanceConfig({env: ENV}));\n// remove the plugins to be overwriten.\n-helpers.removePlugins(webpackConfig.plugins, [HtmlWebpackPlugin, ngcWebpack.NgcWebpackPlugin]);\n+helpers.removePlugins(webpackConfig.plugins, [\n+ DefinePlugin,\n+ HtmlWebpackPlugin,\n+ ngcWebpack.NgcWebpackPlugin\n+]);\n// remove the rules to be overwriten.\nhelpers.removeRules(webpackConfig.module.rules, [/\\.ts$/]);\n@@ -43,6 +47,8 @@ helpers.removeRules(webpackConfig.module.rules, [/\\.ts$/]);\n* See: http://webpack.github.io/docs/configuration.html#cli\n*/\nmodule.exports = function(options) {\n+ isProd = ENV === 'production';\n+\nreturn webpackMerge.smart(webpackConfig, {\nmodule: {\nrules: [\n@@ -57,16 +63,16 @@ module.exports = function(options) {\ntest: /\\.ts$/,\nuse: [\n'@angularclass/hmr-loader?pretty=' + !isProd + '&prod=' + isProd,\n- 'awesome-typescript-loader?{configFileName: \"tsconfig.desktop.json\"}',\n- 'angular2-template-loader',\n{\nloader: 'ng-router-loader',\noptions: {\n- loader: 'async-require',\n+ loader: 'async-import',\ngenDir: 'compiled',\naot: AOT\n}\n- }\n+ },\n+ 'awesome-typescript-loader?{configFileName: \"tsconfig.desktop.json\"}',\n+ 'angular2-template-loader'\n],\nexclude: [/\\.(spec|e2e)\\.ts$/]\n},\n" }, { "change_type": "MODIFY", "old_path": "config/advance/webpack.github-deploy.js", "new_path": "config/advance/webpack.github-deploy.js", "diff": "@@ -20,9 +20,12 @@ const ngcWebpack = require('ngc-webpack');\nconst GIT_REMOTE_NAME = 'origin';\nconst COMMIT_MESSAGE = 'Updates';\nconst GH_REPO_NAME = ghDeploy.getRepoName(GIT_REMOTE_NAME);\n+const ENV = process.env.ENV = process.env.NODE_ENV = 'production';\nconst AOT = helpers.hasNpmFlag('aot');\nmodule.exports = function (options) {\n+ isProd = ENV === 'production';\n+\nconst webpackConfigFactory = ghDeploy.getWebpackConfigModule(options); // the settings that are common to prod and dev\nconst webpackConfig = webpackConfigFactory(options);\nconst METADATA = Object.assign({\n@@ -31,7 +34,10 @@ module.exports = function (options) {\n}, require('../custom/webpack.common.js').metadata);\n// remove the plugins to be overwriten.\n- helpers.removePlugins(webpackConfig.plugins, [HtmlWebpackPlugin, ngcWebpack.NgcWebpackPlugin]);\n+ helpers.removePlugins(webpackConfig.plugins, [\n+ HtmlWebpackPlugin,\n+ ngcWebpack.NgcWebpackPlugin\n+ ]);\n// remove the rules to be overwriten.\nhelpers.removeRules(webpackConfig.module.rules, [/\\.ts$/, /\\.html$/]);\n@@ -72,16 +78,16 @@ module.exports = function (options) {\ntest: /\\.ts$/,\nuse: [\n'@angularclass/hmr-loader?pretty=' + !isProd + '&prod=' + isProd,\n- 'awesome-typescript-loader?{configFileName: \"tsconfig.desktop.json\"}',\n- 'angular2-template-loader',\n{\nloader: 'ng-router-loader',\noptions: {\n- loader: 'async-require',\n+ loader: 'async-import',\ngenDir: 'compiled',\naot: AOT\n}\n- }\n+ },\n+ 'awesome-typescript-loader?{configFileName: \"tsconfig.desktop.json\"}',\n+ 'angular2-template-loader'\n],\nexclude: [/\\.(spec|e2e)\\.ts$/]\n}\n" } ]
TypeScript
MIT License
jonnybgod/angular2-webpack-advance-starter
fix gitdeploy and desktop render
331,280
29.01.2017 02:37:31
0
6123e5c76edaa552815a02a9d5c56b87621a41a0
update deps and fix travis
[ { "change_type": "MODIFY", "old_path": ".travis.yml", "new_path": ".travis.yml", "diff": "@@ -8,8 +8,8 @@ addons:\n- google-chrome-stable\nlanguage: node_js\nnode_js:\n- - \"5\"\n- \"6\"\n+ - \"7\"\n- \"node\"\n# Matrix failure enabled for https://github.com/TheLarkInn/LazyParseWebpackPlugin/issues/6\nmatrix:\n" }, { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"codelyzer\": \"~2.0.0-beta.4\",\n\"copy-webpack-plugin\": \"^4.0.0\",\n\"css-loader\": \"^0.26.0\",\n- \"electron\": \"^1.4.13\",\n- \"electron-builder\": \"^10.16.0\",\n+ \"electron\": \"^1.5.0\",\n+ \"electron-builder\": \"^11.7.0\",\n\"electron-debug\": \"^1.0.1\",\n\"exports-loader\": \"^0.6.3\",\n\"expose-loader\": \"^0.7.1\",\n- \"extract-text-webpack-plugin\": \"~2.0.0-beta.4\",\n- \"file-loader\": \"^0.9.0\",\n+ \"extract-text-webpack-plugin\": \"~2.0.0-rc.2\",\n+ \"file-loader\": \"^0.10.0\",\n\"find-root\": \"^1.0.0\",\n\"gh-pages\": \"^0.12.0\",\n\"html-webpack-plugin\": \"^2.21.0\",\n\"karma-mocha-reporter\": \"^2.0.0\",\n\"karma-remap-coverage\": \"^0.1.4\",\n\"karma-sourcemap-loader\": \"^0.3.7\",\n- \"karma-webpack\": \"2.0.1\",\n+ \"karma-webpack\": \"2.0.2\",\n\"ng-router-loader\": \"^2.1.0\",\n\"ngc-webpack\": \"^1.1.0\",\n\"ngrx-store-freeze\": \"0.1.6\",\n\"npm-run-all\": \"^4.0.0\",\n\"optimize-js-plugin\": \"0.0.4\",\n\"parse5\": \"^3.0.1\",\n- \"protractor\": \"^4.0.14\",\n+ \"protractor\": \"^5.0.0\",\n\"raw-loader\": \"0.5.1\",\n\"rimraf\": \"~2.5.4\",\n\"sass-loader\": \"^4.1.1\",\n\"webpack-dev-middleware\": \"^1.9.0\",\n\"webpack-dev-server\": \"2.2.0\",\n\"webpack-dll-bundles-plugin\": \"^1.0.0-beta.5\",\n- \"webpack-merge\": \"~2.4.0\",\n+ \"webpack-merge\": \"~2.6.0\",\n\"webpack-target-electron-renderer\": \"^0.4.0\"\n},\n\"build\": {\n" }, { "change_type": "MODIFY", "old_path": "src/app/components/about/about.component.spec.ts", "new_path": "src/app/components/about/about.component.spec.ts", "diff": "@@ -24,7 +24,7 @@ t.describe('@Component: AboutComponent', () => {\nfixture.detectChanges();\nlet aboutDOMEl = fixture.debugElement.children[0].nativeElement;\n- t.e(getDOM().querySelectorAll(aboutDOMEl, 'h2')[0].textContent).toEqual('Features');\n+ t.e(getDOM().querySelectorAll(aboutDOMEl, 'div h2')[0].textContent).toEqual('Features');\n});\n}));\n});\n" } ]
TypeScript
MIT License
jonnybgod/angular2-webpack-advance-starter
update deps and fix travis
331,280
29.01.2017 05:49:50
0
e8173b692b9b747fbdcd8c982ee4f2ccc9f45309
chore(docs): update known bugs
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -321,11 +321,6 @@ The following are some things that will make AoT compile fail.\nPlease see the [CONTRIBUTING](https://github.com/JonnyBGod/angular2-webpack-advance-starter/blob/master/.github/CONTRIBUTING.md) and [CODE_OF_CONDUCT](https://github.com/JonnyBGod/angular2-webpack-advance-starter/blob/master/.github/CODE_OF_CONDUCT.md) files for guidelines.\n-## Known Bugs\n-\n-- [ ] ELECTRON: css absolute paths\n-- [ ] npm run docs (upstream) (https://github.com/TypeStrong/typedoc/issues/234)\n-\n___\n# License\n" } ]
TypeScript
MIT License
jonnybgod/angular2-webpack-advance-starter
chore(docs): update known bugs
331,280
29.03.2017 02:31:41
-3,600
416341eb0481840c61df9cf8818c85cf5b368f55
update upstream, dependencies and app
[ { "change_type": "MODIFY", "old_path": "config/advance/webpack.web.test.js", "new_path": "config/advance/webpack.web.test.js", "diff": "@@ -29,15 +29,6 @@ helpers.removePlugins(webpackConfig.plugins, [HtmlWebpackPlugin]);\n*/\nmodule.exports = function(options) {\nreturn webpackMerge.smart(webpackConfig, commonAdvanceConfig({env: ENV}), {\n- module: {\n- rules: [\n- {\n- test: /\\.scss$/,\n- use: ['to-string-loader', 'css-loader', 'sass-loader'],\n- exclude: [helpers.root('src', 'styles')]\n- },\n- ]\n- },\nplugins: [\n/*\n" }, { "change_type": "MODIFY", "old_path": "electron/main.desktop.ts", "new_path": "electron/main.desktop.ts", "diff": "@@ -13,7 +13,7 @@ let template: any;\nlet menu: any;\n// app\n-import { DesktopConfig } from 'frameworks/electron/index';\n+import { DesktopConfig } from 'shared/electron/index';\n/*crashReporter.start({\nproductName: 'Angular2WebpackAdvanceStarter',\n" }, { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "},\n\"linux\": {\n\"target\": [\n- \"AppImage\",\n- \"snap\"\n+ \"AppImage\"\n]\n},\n- \"asar\": true\n- },\n+ \"asar\": true,\n\"directories\": {\n\"buildResources\": \"src/assets\",\n\"output\": \"desktop\",\n\"app\": \"dist\"\n+ }\n},\n\"repository\": {\n\"type\": \"git\",\n" }, { "change_type": "MODIFY", "old_path": "src/app/components/about/about.component.spec.ts", "new_path": "src/app/components/about/about.component.spec.ts", "diff": "-import { TestBed, async } from '@angular/core/testing';\n+// angular\nimport { Component } from '@angular/core';\n-import { getDOM } from '@angular/platform-browser/src/dom/dom_adapter';\n+import { TestBed, async } from '@angular/core/testing';\n-import { t } from 'shared/test';\n+// app\n+import { t } from 'shared/test/index';\nimport { AboutComponent } from './about.component';\n// test module configuration for each test\n@@ -12,6 +13,7 @@ const testModuleConfig = () => {\n});\n};\n+export function main() {\nt.describe('@Component: AboutComponent', () => {\nt.be(testModuleConfig);\n@@ -24,10 +26,11 @@ t.describe('@Component: AboutComponent', () => {\nfixture.detectChanges();\nlet aboutDOMEl = fixture.debugElement.children[0].nativeElement;\n- t.e(getDOM().querySelectorAll(aboutDOMEl, 'h2')[0].textContent).toEqual('Features');\n+ t.e(aboutDOMEl.querySelectorAll('h2')[0].textContent).toEqual('Features');\n});\n}));\n});\n+}\n@Component({\nselector: 'test-cmp',\n" }, { "change_type": "MODIFY", "old_path": "src/app/shared/core/services/log.service.spec.ts", "new_path": "src/app/shared/core/services/log.service.spec.ts", "diff": "@@ -8,15 +8,18 @@ import { BaseRequestOptions, Http, Response, ResponseOptions } from '@angular/ht\nimport { MockBackend, MockConnection } from '@angular/http/testing';\n// libs\n-import { ConfigModule, ConfigLoader, ConfigService } from 'ng2-config';\n+import { ConfigModule, ConfigLoader, ConfigService, ConfigHttpLoader } from '@nglibs/config';\n// app\nimport { t } from '../../test/index';\n-import { configFactory } from '../../core/core.module';\n// module\nimport { ConsoleService, LogService } from '../index';\n+export function configFactory(http: Http): ConfigLoader {\n+ return new ConfigHttpLoader(http, '/config.json'); // FILE PATH || API ENDPOINT\n+}\n+\nconst providers: any[] = [\n{ provide: ConsoleService, useValue: console },\nLogService,\n@@ -50,7 +53,11 @@ t.describe('core: LogService', () => {\nTestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting())\n.configureTestingModule({\nimports: [\n- ConfigModule.forRoot({ provide: ConfigLoader, useFactory: (configFactory) })\n+ ConfigModule.forRoot({\n+ provide: ConfigLoader,\n+ useFactory: (configFactory),\n+ deps: [Http]\n+ }),\n],\nproviders\n});\n" }, { "change_type": "MODIFY", "old_path": "src/app/shared/core/testing/providers/core.ts", "new_path": "src/app/shared/core/testing/providers/core.ts", "diff": "// libs\n-import { ConfigService } from 'ng2-config';\n+import { ConfigService } from '@nglibs/config';\n// app\nimport { ANALYTICS_PROVIDERS } from '../../../analytics/index';\n" }, { "change_type": "MODIFY", "old_path": "src/app/shared/i18n/components/lang-switcher.component.spec.ts", "new_path": "src/app/shared/i18n/components/lang-switcher.component.spec.ts", "diff": "@@ -8,7 +8,7 @@ import { MockBackend, MockConnection } from '@angular/http/testing';\n// libs\nimport { StoreModule } from '@ngrx/store';\nimport { EffectsModule } from '@ngrx/effects';\n-import { ConfigService } from 'ng2-config';\n+import { ConfigService } from '@nglibs/config';\nimport { Angulartics2Module, Angulartics2GoogleAnalytics } from 'angulartics2';\n// app\n" }, { "change_type": "MODIFY", "old_path": "src/app/shared/i18n/testing/index.ts", "new_path": "src/app/shared/i18n/testing/index.ts", "diff": "// libs\n-import { TranslateService, TranslateLoader } from 'ng2-translate';\n+import { TranslateService, TranslateLoader } from '@ngx-translate/core';\n// module\nimport { MultilingualService } from '../index';\n" }, { "change_type": "MODIFY", "old_path": "src/app/shared/sample/services/name-list.service.spec.ts", "new_path": "src/app/shared/sample/services/name-list.service.spec.ts", "diff": "@@ -52,7 +52,7 @@ const mockBackendResponse = (connection: MockConnection, response: string) => {\nt.describe('app: NameListService', () => {\nlet injector: Injector;\n- let backend: MockBackend;\n+ let backend: any;\nlet nameList: NameListService;\nlet store: Store<any>;\nlet runner: EffectsRunner; // ngrx/effects tester\n" }, { "change_type": "MODIFY", "old_path": "tsconfig.desktop.json", "new_path": "tsconfig.desktop.json", "diff": "\"sourceMap\": true,\n\"noEmit\": true,\n\"noEmitHelpers\": true,\n+ \"importHelpers\": true,\n\"strictNullChecks\": false,\n\"baseUrl\": \"./src\",\n\"paths\": {\n\"es2015\",\n\"dom\"\n],\n+ \"typeRoots\": [\n+ \"node_modules/@types\"\n+ ],\n\"types\": [\n\"hammerjs\",\n\"jasmine\",\n},\n\"compileOnSave\": false,\n\"buildOnSave\": false,\n- \"atom\": { \"rewriteTsconfig\": false }\n+ \"atom\": {\n+ \"rewriteTsconfig\": false\n+ }\n}\n" } ]
TypeScript
MIT License
jonnybgod/angular2-webpack-advance-starter
update upstream, dependencies and app
21,238
06.01.2017 09:21:09
28,800
b50ba6f47008fdddb38a566758f016b3ea6ffbed
Update composer.json Updating package name.
[ { "change_type": "MODIFY", "old_path": "composer.json", "new_path": "composer.json", "diff": "{\n- \"name\": \"amazon/module-login-and-pay\",\n+ \"name\": \"amzn/amazon-payments-magento-2-plugin\",\n\"description\": \"Official Magento2 Plugin to integrate with Amazon Payments\",\n\"type\": \"magento2-module\",\n\"version\": \"1.0.9\",\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Update composer.json Updating package name.
21,260
30.11.2016 17:20:50
21,600
32bb021bd88cb418b8beb0e9a7bc87f5991f7473
Add missing code to amazon payment template
[ { "change_type": "MODIFY", "old_path": "src/Payment/view/frontend/web/template/payment/amazon-payment-widget.html", "new_path": "src/Payment/view/frontend/web/template/payment/amazon-payment-widget.html", "diff": "<label data-bind=\"attr: {'for': getCode()}\" class=\"label\"><span data-bind=\"text: getTitle()\"></span></label>\n</div>\n<div class=\"payment-method-content\">\n-\n+ <!-- ko foreach: getRegion('messages') -->\n+ <!-- ko template: getTemplate() --><!-- /ko -->\n+ <!--/ko-->\n<div class=\"amazon-widget-container\">\n<div id=\"walletWidgetDiv\" class=\"amazon-widget amazon-widget--payment\" data-bind=\"afterRender: initPaymentWidget\"></div>\n</div>\n- <div class=\"checkout-agreements-block\"></div>\n+ <div class=\"checkout-agreements-block\">\n+ <!-- ko foreach: $parent.getRegion('before-place-order') -->\n+ <!-- ko template: getTemplate() --><!-- /ko -->\n+ <!--/ko-->\n+ </div>\n<div class=\"actions-toolbar\">\n<div class=\"primary\">\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Add missing code to amazon payment template
21,260
30.11.2016 19:04:02
21,600
eefcee8b6eff8d7c9d4e7718a1bac8800e92e0e9
Add mixin to Amazon to add agreement data to submission
[ { "change_type": "MODIFY", "old_path": "src/Payment/view/frontend/requirejs-config.js", "new_path": "src/Payment/view/frontend/requirejs-config.js", "diff": "@@ -25,5 +25,12 @@ var config = {\n//this is a fix for Magento 2.1 (ajax / validation fails on add to cart)\ncatalogAddToCart: 'Amazon_Payment/js/catalog-add-to-cart'\n}\n+ },\n+ config: {\n+ mixins: {\n+ 'Amazon_Payment/js/action/place-order': {\n+ 'Amazon_Payment/js/model/place-order-mixin': true\n+ }\n+ }\n}\n};\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Add mixin to Amazon to add agreement data to submission
21,260
02.12.2016 17:28:54
21,600
e63fd3e462c11c30dc9eff86d495290d4fa02d0b
Rework cart button to render alongside other payment types
[ { "change_type": "ADD", "old_path": null, "new_path": "src/Payment/Observer/AddAmazonButton.php", "diff": "+<?php\n+/**\n+ * Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\").\n+ * You may not use this file except in compliance with the License.\n+ * A copy of the License is located at\n+ *\n+ * http://aws.amazon.com/apache2.0\n+ *\n+ * or in the \"license\" file accompanying this file. This file is distributed\n+ * on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n+ * express or implied. See the License for the specific language governing\n+ * permissions and limitations under the License.\n+ */\n+namespace Amazon\\Payment\\Observer;\n+\n+use Magento\\Framework\\Event\\ObserverInterface;\n+use Magento\\Framework\\Event\\Observer;\n+use Amazon\\Core\\Helper\\Data;\n+\n+class AddAmazonButton implements ObserverInterface\n+{\n+ /**\n+ * @var Data\n+ */\n+ protected $coreHelper;\n+\n+ /**\n+ * @param Data $coreHelper\n+ */\n+ public function __construct(\n+ Data $coreHelper\n+ ) {\n+ $this->coreHelper = $coreHelper;\n+ }\n+\n+ public function execute(Observer $observer)\n+ {\n+ /** @var \\Magento\\Catalog\\Block\\ShortcutButtons $shortcutButtons */\n+ $shortcutButtons = $observer->getEvent()->getContainer();\n+\n+ if ($this->coreHelper->isPwaEnabled() && $this->coreHelper->isCurrentCurrencySupportedByAmazon()) {\n+\n+// $params = [\n+// 'shortcutValidator' => $this->shortcutFactory->create($observer->getEvent()->getCheckoutSession()),\n+// ];\n+ $params['checkoutSession'] = $observer->getEvent()->getCheckoutSession();\n+\n+ /** @var \\Magento\\Framework\\View\\Element\\Template $shortcut */\n+ $shortcut = $shortcutButtons->getLayout()->createBlock(\n+ 'Amazon\\Payment\\Block\\Minicart\\Button',\n+ '',\n+ $params\n+ );\n+\n+ $shortcut->setIsInCatalogProduct(\n+ $observer->getEvent()->getIsCatalogProduct()\n+ )->setShowOrPosition(\n+ $observer->getEvent()->getOrPosition()\n+ );\n+ $shortcutButtons->addShortcut($shortcut);\n+ }\n+ }\n+}\n" }, { "change_type": "MODIFY", "old_path": "src/Payment/etc/frontend/di.xml", "new_path": "src/Payment/etc/frontend/di.xml", "diff": "<argument name=\"methodCode\" xsi:type=\"const\">Amazon\\Payment\\Model\\Method\\Amazon::PAYMENT_METHOD_CODE</argument>\n</arguments>\n</virtualType>\n+ <type name=\"Amazon\\Payment\\Block\\Minicart\\Button\">\n+ <arguments>\n+ <argument name=\"data\" xsi:type=\"array\">\n+ <item name=\"template\" xsi:type=\"string\">Amazon_Payment::minicart-button.phtml</item>\n+ <item name=\"alias\" xsi:type=\"string\">amazon.button.mini-cart</item>\n+ <item name=\"button_id\" xsi:type=\"string\">PayWithAmazon</item>\n+ </argument>\n+ <argument name=\"payment\" xsi:type=\"object\">Amazon\\Payment\\Model\\Method\\Amazon</argument>\n+ </arguments>\n+ </type>\n</config>\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Payment/etc/frontend/events.xml", "diff": "+<?xml version=\"1.0\"?>\n+<config xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework:Event/etc/events.xsd\">\n+ <event name=\"shortcut_buttons_container\">\n+ <observer name=\"amazon_buttons\" instance=\"Amazon\\Payment\\Observer\\AddAmazonButton\"/>\n+ </event>\n+</config>\n" }, { "change_type": "DELETE", "old_path": "src/Payment/view/frontend/layout/default.xml", "new_path": null, "diff": "-<?xml version=\"1.0\"?>\n-<!--\n-/**\n- * Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n- *\n- * Licensed under the Apache License, Version 2.0 (the \"License\").\n- * You may not use this file except in compliance with the License.\n- * A copy of the License is located at\n- *\n- * http://aws.amazon.com/apache2.0\n- *\n- * or in the \"license\" file accompanying this file. This file is distributed\n- * on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n- * express or implied. See the License for the specific language governing\n- * permissions and limitations under the License.\n- */\n--->\n-<page xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework:View/Layout/etc/page_configuration.xsd\">\n- <body>\n- <referenceBlock name=\"minicart\">\n- <arguments>\n- <argument name=\"jsLayout\" xsi:type=\"array\">\n- <item name=\"components\" xsi:type=\"array\">\n- <item name=\"minicart_content\" xsi:type=\"array\">\n- <item name=\"children\" xsi:type=\"array\">\n- <item name=\"amazon_minicart_pay\" xsi:type=\"array\">\n- <item name=\"component\" xsi:type=\"string\">Amazon_Payment/js/view/minicart-button</item>\n- <item name=\"config\" xsi:type=\"array\">\n- <item name=\"displayArea\" xsi:type=\"string\">extraInfo</item>\n- <item name=\"tooltip\" xsi:type=\"string\" translate=\"true\">Are you an Amazon customer? Pay now with address and payment details stored in your Amazon account.</item>\n- </item>\n- <item name=\"children\" xsi:type=\"array\">\n- <item name=\"before-amazon-button\" xsi:type=\"array\">\n- <item name=\"component\" xsi:type=\"string\">uiComponent</item>\n- <item name=\"displayArea\" xsi:type=\"string\">before-amazon-button</item>\n- <item name=\"children\" xsi:type=\"array\">\n- <!-- before amazon button -->\n- </item>\n- </item>\n- <item name=\"after-amazon-button\" xsi:type=\"array\">\n- <item name=\"component\" xsi:type=\"string\">uiComponent</item>\n- <item name=\"displayArea\" xsi:type=\"string\">after-amazon-button</item>\n- <item name=\"children\" xsi:type=\"array\">\n- <!-- after amazon button -->\n- </item>\n- </item>\n- </item>\n- </item>\n- </item>\n- </item>\n- </item>\n- </argument>\n- </arguments>\n- </referenceBlock>\n- </body>\n-</page>\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Payment/view/frontend/templates/minicart-button.phtml", "diff": "+<?php\n+/**\n+ * Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\").\n+ * You may not use this file except in compliance with the License.\n+ * A copy of the License is located at\n+ *\n+ * http://aws.amazon.com/apache2.0\n+ *\n+ * or in the \"license\" file accompanying this file. This file is distributed\n+ * on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n+ * express or implied. See the License for the specific language governing\n+ * permissions and limitations under the License.\n+ */\n+\n+/**\n+ * @var \\Amazon\\Payment\\Block\\Minicart\\Button $block\n+ */\n+$config = [\n+ 'Amazon_Payment/js/amazon-button' => [\n+ 'buttonType' => 'PwA'\n+ ]\n+];\n+\n+$tooltipConfig = [\n+ 'dropdown' => [\n+ 'activeClass' => '_active'\n+ ]\n+];\n+?>\n+\n+<div id=\"minicart-amazon-pay-button\" class=\"amazon-minicart-container\">\n+ <div class=\"amazon-button-container\">\n+ <div class=\"amazon-button-container__cell\">\n+ <div id=\"PayWithAmazon\" class=\"login-with-amazon\" data-mage-init='<?php /* @noEscape */ echo json_encode($config); ?>'></div>\n+ </div>\n+\n+ <div class=\"amazon-button-container__cell\">\n+ <div class=\"field-tooltip toggle\">\n+ <span class=\"field-tooltip-action action-help\" data-mage-init='<?php /* @noEscape */ echo json_encode($tooltipConfig); ?>' data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\"></span>\n+ <div class=\"field-tooltip-content\" data-target=\"dropdown\" aria-hidden=\"true\">Are you an Amazon customer? Pay now with address and payment details stored in your Amazon account.</div>\n+ </div>\n+ </div>\n+ </div>\n+</div>\n" }, { "change_type": "DELETE", "old_path": "src/Payment/view/frontend/web/js/view/minicart-button.js", "new_path": null, "diff": "-/*global define*/\n-\n-define(\n- [\n- 'jquery',\n- \"uiComponent\",\n- 'ko',\n- 'Amazon_Payment/js/model/storage',\n- 'amazonPaymentConfig',\n- 'Magento_Customer/js/customer-data'\n- ],\n- function (\n- $,\n- Component,\n- ko,\n- amazonStorage,\n- amazonPaymentConfig,\n- customerData\n- ) {\n- 'use strict';\n-\n- return Component.extend({\n- defaults: {\n- template: 'Amazon_Payment/minicart/minicart-button'\n- },\n- isAmazonEnabled: ko.observable(amazonPaymentConfig.getValue('isPwaEnabled')),\n- isAmazonAccountLoggedIn: amazonStorage.isAmazonAccountLoggedIn,\n- isPwaVisible: amazonStorage.isPwaVisible,\n- initialize: function () {\n- var self = this;\n- this._super();\n-\n- var minicart = $(\"[data-block='minicart']\");\n-\n- // set observable flag on every minicart update\n- minicart.on('contentUpdated', function () {\n- var quoteHasExcludedItems = customerData.get('cart')().amazon_quote_has_excluded_item;\n- amazonStorage.isQuoteDirty(quoteHasExcludedItems);\n- });\n- }\n- });\n- }\n-);\n" }, { "change_type": "DELETE", "old_path": "src/Payment/view/frontend/web/template/minicart/minicart-button.html", "new_path": null, "diff": "-<!--\n-/**\n- * Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n- *\n- * Licensed under the Apache License, Version 2.0 (the \"License\").\n- * You may not use this file except in compliance with the License.\n- * A copy of the License is located at\n- *\n- * http://aws.amazon.com/apache2.0\n- *\n- * or in the \"license\" file accompanying this file. This file is distributed\n- * on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n- * express or implied. See the License for the specific language governing\n- * permissions and limitations under the License.\n- */\n--->\n-\n-<!-- ko if: isPwaVisible -->\n- <div id=\"minicart-amazon-pay-button\" class=\"amazon-minicart-container\">\n- <!-- ko template: 'Amazon_Payment/checkout-button' --><!-- /ko -->\n- </div>\n-<!--/ko-->\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Rework cart button to render alongside other payment types
21,260
02.12.2016 19:01:20
21,600
202cbdaa236de57d7b9e9c5155494c18bc5924b8
Correct display on cart and add display validator
[ { "change_type": "ADD", "old_path": null, "new_path": "src/Payment/Helper/Shortcut/CheckoutValidator.php", "diff": "+<?php\n+/**\n+ * Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\").\n+ * You may not use this file except in compliance with the License.\n+ * A copy of the License is located at\n+ *\n+ * http://aws.amazon.com/apache2.0\n+ *\n+ * or in the \"license\" file accompanying this file. This file is distributed\n+ * on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n+ * express or implied. See the License for the specific language governing\n+ * permissions and limitations under the License.\n+ */\n+\n+namespace Amazon\\Payment\\Helper\\Shortcut;\n+\n+class CheckoutValidator implements ValidatorInterface\n+{\n+ /**\n+ * @var \\Magento\\Checkout\\Model\\Session\n+ */\n+ private $_checkoutSession;\n+\n+ /**\n+ * @var \\Magento\\Payment\\Helper\\Data\n+ */\n+ private $_paymentData;\n+\n+ /**\n+ * @var Validator\n+ */\n+ private $_shortcutValidator;\n+\n+ /**\n+ * @param \\Magento\\Checkout\\Model\\Session $checkoutSession\n+ * @param Validator $shortcutValidator\n+ * @param \\Magento\\Payment\\Helper\\Data $paymentData\n+ */\n+ public function __construct(\n+ \\Magento\\Checkout\\Model\\Session $checkoutSession,\n+ Validator $shortcutValidator,\n+ \\Magento\\Payment\\Helper\\Data $paymentData\n+ ) {\n+ $this->_checkoutSession = $checkoutSession;\n+ $this->_paymentData = $paymentData;\n+ $this->_shortcutValidator = $shortcutValidator;\n+ }\n+\n+ /**\n+ * Validates shortcut\n+ *\n+ * @param string $code\n+ * @param bool $isInCatalog\n+ * @return bool\n+ */\n+ public function validate($code, $isInCatalog)\n+ {\n+ return false;\n+ return $this->_shortcutValidator->isContextAvailable($code, $isInCatalog)\n+ && $this->_shortcutValidator->isPriceOrSetAvailable($isInCatalog)\n+ && $this->isMethodQuoteAvailable($code, $isInCatalog)\n+ && $this->isQuoteSummaryValid($isInCatalog);\n+ }\n+\n+ /**\n+ * Checks payment method and quote availability\n+ *\n+ * @param string $paymentCode\n+ * @param bool $isInCatalog\n+ * @return bool\n+ */\n+ public function isMethodQuoteAvailable($paymentCode, $isInCatalog)\n+ {\n+ $quote = $isInCatalog ? null : $this->_checkoutSession->getQuote();\n+ // check payment method availability\n+ /** @var \\Magento\\Payment\\Model\\Method\\AbstractMethod $methodInstance */\n+ $methodInstance = $this->_paymentData->getMethodInstance($paymentCode);\n+ if (!$methodInstance->isAvailable($quote)) {\n+ return false;\n+ }\n+ return true;\n+ }\n+\n+ /**\n+ * Validates minimum quote amount and zero grand total\n+ *\n+ * @param bool $isInCatalog\n+ * @return bool\n+ */\n+ public function isQuoteSummaryValid($isInCatalog)\n+ {\n+ $quote = $isInCatalog ? null : $this->_checkoutSession->getQuote();\n+ // validate minimum quote amount and validate quote for zero grandtotal\n+ if (null !== $quote && (!$quote->validateMinimumAmount() || !$quote->getGrandTotal())) {\n+ return false;\n+ }\n+ return true;\n+ }\n+}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Payment/Helper/Shortcut/Factory.php", "diff": "+<?php\n+/**\n+ * Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\").\n+ * You may not use this file except in compliance with the License.\n+ * A copy of the License is located at\n+ *\n+ * http://aws.amazon.com/apache2.0\n+ *\n+ * or in the \"license\" file accompanying this file. This file is distributed\n+ * on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n+ * express or implied. See the License for the specific language governing\n+ * permissions and limitations under the License.\n+ */\n+\n+namespace Amazon\\Payment\\Helper\\Shortcut;\n+\n+class Factory\n+{\n+ /**\n+ * Default validator\n+ */\n+ const DEFAULT_VALIDATOR = 'Amazon\\Payment\\Helper\\Shortcut\\Validator';\n+\n+ /**\n+ * Checkout validator\n+ */\n+ const CHECKOUT_VALIDATOR = 'Amazon\\Payment\\Helper\\Shortcut\\CheckoutValidator';\n+\n+ /**\n+ * @var \\Magento\\Framework\\ObjectManagerInterface\n+ */\n+ protected $_objectManager;\n+\n+ /**\n+ * @param \\Magento\\Framework\\ObjectManagerInterface $objectManager\n+ */\n+ public function __construct(\\Magento\\Framework\\ObjectManagerInterface $objectManager)\n+ {\n+ $this->_objectManager = $objectManager;\n+ }\n+\n+ /**\n+ * @param mixed $parameter\n+ * @return \\Amazon\\Payment\\Helper\\Shortcut\\ValidatorInterface\n+ */\n+ public function create($parameter = null)\n+ {\n+ $instanceName = self::DEFAULT_VALIDATOR;\n+ if (is_object($parameter) && $parameter instanceof \\Magento\\Checkout\\Model\\Session) {\n+ $instanceName = self::CHECKOUT_VALIDATOR;\n+ }\n+ return $this->_objectManager->create($instanceName);\n+ }\n+}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Payment/Helper/Shortcut/Validator.php", "diff": "+<?php\n+/**\n+ * Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\").\n+ * You may not use this file except in compliance with the License.\n+ * A copy of the License is located at\n+ *\n+ * http://aws.amazon.com/apache2.0\n+ *\n+ * or in the \"license\" file accompanying this file. This file is distributed\n+ * on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n+ * express or implied. See the License for the specific language governing\n+ * permissions and limitations under the License.\n+ */\n+\n+namespace Amazon\\Payment\\Helper\\Shortcut;\n+\n+/**\n+ * @SuppressWarnings(PHPMD.UnusedPrivateField)\n+ */\n+class Validator implements ValidatorInterface\n+{\n+ /**\n+ * @var \\Amazon\\Payment\\Model\\Config\n+ */\n+ private $_amazonConfigFactory;\n+\n+ /**\n+ * @var \\Magento\\Framework\\Registry\n+ */\n+ private $_registry;\n+\n+ /**\n+ * @var \\Magento\\Catalog\\Model\\ProductTypes\\ConfigInterface\n+ */\n+ private $_productTypeConfig;\n+\n+ /**\n+ * @var \\Magento\\Payment\\Helper\\Data\n+ */\n+ private $_paymentData;\n+\n+ /**\n+ * @param \\Amazon\\Payment\\Model\\ConfigFactory $amazonConfig\n+ * @param \\Magento\\Framework\\Registry $registry\n+ * @param \\Magento\\Catalog\\Model\\ProductTypes\\ConfigInterface $productTypeConfig\n+ * @param \\Magento\\Payment\\Helper\\Data $paymentData\n+ */\n+ public function __construct(\n+ \\Amazon\\Payment\\Model\\Config $amazonConfig,\n+ \\Magento\\Framework\\Registry $registry,\n+ \\Magento\\Catalog\\Model\\ProductTypes\\ConfigInterface $productTypeConfig,\n+ \\Magento\\Payment\\Helper\\Data $paymentData\n+ ) {\n+ $this->_amazonConfig = $amazonConfig;\n+ $this->_registry = $registry;\n+ $this->_productTypeConfig = $productTypeConfig;\n+ $this->_paymentData = $paymentData;\n+ }\n+\n+ /**\n+ * Validates shortcut\n+ *\n+ * @param string $code\n+ * @param bool $isInCatalog\n+ * @return bool\n+ */\n+ public function validate($code, $isInCatalog)\n+ {\n+ return $this->isContextAvailable($code, $isInCatalog)\n+ && $this->isPriceOrSetAvailable($isInCatalog)\n+ && $this->isMethodAvailable($code);\n+ }\n+\n+ /**\n+ * Checks visibility of context (cart or product page)\n+ *\n+ * @param string $paymentCode Payment method code\n+ * @param bool $isInCatalog\n+ * @return bool\n+ */\n+ public function isContextAvailable($paymentCode, $isInCatalog)\n+ {\n+ /** @var \\Magento\\Paypal\\Model\\Config $config */\n+ $config = $this->_amazonConfigFactory->create();\n+ $config->setMethod($paymentCode);\n+\n+ // check visibility on product page\n+ if ($isInCatalog && $config->getValue('pwa_pp_button_is_visible')) {\n+ return true;\n+ }\n+ return false;\n+ }\n+\n+ /**\n+ * Check is product available depending on final price or type set(configurable)\n+ *\n+ * @param bool $isInCatalog\n+ * @return bool\n+ */\n+ public function isPriceOrSetAvailable($isInCatalog)\n+ {\n+ if ($isInCatalog) {\n+ // Show PayPal shortcut on a product view page only if product has nonzero price\n+ /** @var $currentProduct \\Magento\\Catalog\\Model\\Product */\n+ $currentProduct = $this->_registry->registry('current_product');\n+ if ($currentProduct !== null) {\n+ $productPrice = (double)$currentProduct->getFinalPrice();\n+ $typeInstance = $currentProduct->getTypeInstance();\n+ if (empty($productPrice)\n+ && !$this->_productTypeConfig->isProductSet($currentProduct->getTypeId())\n+ && !$typeInstance->canConfigure($currentProduct)\n+ ) {\n+ return false;\n+ }\n+ }\n+ }\n+ return true;\n+ }\n+\n+ /**\n+ * Checks payment method and quote availability\n+ *\n+ * @param string $paymentCode\n+ * @return bool\n+ */\n+ public function isMethodAvailable($paymentCode)\n+ {\n+ // check payment method availability\n+ /** @var \\Magento\\Payment\\Model\\Method\\AbstractMethod $methodInstance */\n+ $methodInstance = $this->_paymentData->getMethodInstance($paymentCode);\n+ if (!$methodInstance->isAvailable()) {\n+ return false;\n+ }\n+ return true;\n+ }\n+}\n" }, { "change_type": "RENAME", "old_path": "src/Payment/view/frontend/layout/checkout_cart_index.xml", "new_path": "src/Payment/Helper/Shortcut/ValidatorInterface.php", "diff": "-<?xml version=\"1.0\"?>\n-<!--\n+<?php\n/**\n* Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n*\n* express or implied. See the License for the specific language governing\n* permissions and limitations under the License.\n*/\n--->\n-<page xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" layout=\"1column\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework:View/Layout/etc/page_configuration.xsd\">\n- <body>\n- <referenceContainer name=\"checkout.cart.methods\">\n- <block class=\"Amazon\\Payment\\Block\\PaymentLink\" name=\"checkout.cart.methods.amazon\" after=\"checkout.cart.methods.onepage.bottom\" template=\"Amazon_Payment::payment-link.phtml\" />\n- </referenceContainer>\n- </body>\n-</page>\n\\ No newline at end of file\n+\n+namespace Amazon\\Payment\\Helper\\Shortcut;\n+\n+interface ValidatorInterface\n+{\n+ /**\n+ * Validates shortcut\n+ *\n+ * @param string $code\n+ * @param bool $isInCatalog\n+ * @return bool\n+ */\n+ public function validate($code, $isInCatalog);\n+}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Payment/Model/Config.php", "diff": "+<?php\n+/**\n+ * Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\").\n+ * You may not use this file except in compliance with the License.\n+ * A copy of the License is located at\n+ *\n+ * http://aws.amazon.com/apache2.0\n+ *\n+ * or in the \"license\" file accompanying this file. This file is distributed\n+ * on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n+ * express or implied. See the License for the specific language governing\n+ * permissions and limitations under the License.\n+ */\n+\n+namespace Amazon\\Payment\\Model;\n+\n+use Magento\\Framework\\App\\Config\\ScopeConfigInterface;\n+\n+class Config extends \\Magento\\Payment\\Gateway\\Config\\Config {}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "src/Payment/Observer/AddAmazonButton.php", "new_path": "src/Payment/Observer/AddAmazonButton.php", "diff": "@@ -18,6 +18,7 @@ namespace Amazon\\Payment\\Observer;\nuse Magento\\Framework\\Event\\ObserverInterface;\nuse Magento\\Framework\\Event\\Observer;\nuse Amazon\\Core\\Helper\\Data;\n+use Amazon\\Payment\\Helper\\Shortcut\\Factory as ShortcutFactory;\nclass AddAmazonButton implements ObserverInterface\n{\n@@ -26,13 +27,21 @@ class AddAmazonButton implements ObserverInterface\n*/\nprotected $coreHelper;\n+ /**\n+ * @var ShortcutFactory\n+ */\n+ protected $shortcutFactory;\n+\n/**\n* @param Data $coreHelper\n+ * @param ShortcutFactory $shortcutFactory\n*/\npublic function __construct(\n- Data $coreHelper\n+ Data $coreHelper,\n+ ShortcutFactory $shortcutFactory\n) {\n$this->coreHelper = $coreHelper;\n+ $this->shortcutFactory = $shortcutFactory;\n}\npublic function execute(Observer $observer)\n@@ -42,9 +51,9 @@ class AddAmazonButton implements ObserverInterface\nif ($this->coreHelper->isPwaEnabled() && $this->coreHelper->isCurrentCurrencySupportedByAmazon()) {\n-// $params = [\n-// 'shortcutValidator' => $this->shortcutFactory->create($observer->getEvent()->getCheckoutSession()),\n-// ];\n+ $params = [\n+ 'shortcutValidator' => $this->shortcutFactory->create($observer->getEvent()->getCheckoutSession()),\n+ ];\n$params['checkoutSession'] = $observer->getEvent()->getCheckoutSession();\n/** @var \\Magento\\Framework\\View\\Element\\Template $shortcut */\n" }, { "change_type": "MODIFY", "old_path": "src/Payment/etc/di.xml", "new_path": "src/Payment/etc/di.xml", "diff": "<plugin name=\"amazon_payment_webapi_error_processor\" type=\"Amazon\\Payment\\Plugin\\WebapiErrorProcessor\" sortOrder=\"1\" />\n</type>\n<type name=\"Magento\\Framework\\Mail\\MessageInterface\" shared=\"false\" />\n+ <type name=\"Amazon\\Payment\\Model\\Config\">\n+ <arguments>\n+ <argument name=\"methodCode\" xsi:type=\"const\">Amazon\\Payment\\Model\\Method\\Amazon::PAYMENT_METHOD_CODE</argument>\n+ </arguments>\n+ </type>\n+ <type name=\"Amazon\\Payment\\Helper\\Shortcut\\Validator\">\n+ <arguments>\n+ <argument name=\"amazonConfig\" xsi:type=\"object\">Amazon\\Payment\\Model\\Config</argument>\n+ </arguments>\n+ </type>\n</config>\n" }, { "change_type": "MODIFY", "old_path": "src/Payment/etc/frontend/di.xml", "new_path": "src/Payment/etc/frontend/di.xml", "diff": "<?xml version=\"1.0\"?>\n<config xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework:ObjectManager/etc/config.xsd\">\n- <virtualType name=\"Amazon\\Payment\\Model\\Config\" type=\"Magento\\Payment\\Gateway\\Config\\Config\">\n- <arguments>\n- <argument name=\"methodCode\" xsi:type=\"const\">Amazon\\Payment\\Model\\Method\\Amazon::PAYMENT_METHOD_CODE</argument>\n- </arguments>\n- </virtualType>\n<type name=\"Amazon\\Payment\\Block\\Minicart\\Button\">\n<arguments>\n<argument name=\"data\" xsi:type=\"array\">\n- <item name=\"template\" xsi:type=\"string\">Amazon_Payment::minicart-button.phtml</item>\n+ <item name=\"template\" xsi:type=\"string\">Amazon_Payment::payment-link.phtml</item>\n<item name=\"alias\" xsi:type=\"string\">amazon.button.mini-cart</item>\n- <item name=\"button_id\" xsi:type=\"string\">PayWithAmazon</item>\n</argument>\n<argument name=\"payment\" xsi:type=\"object\">Amazon\\Payment\\Model\\Method\\Amazon</argument>\n</arguments>\n" }, { "change_type": "DELETE", "old_path": "src/Payment/view/frontend/templates/minicart-button.phtml", "new_path": null, "diff": "-<?php\n-/**\n- * Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n- *\n- * Licensed under the Apache License, Version 2.0 (the \"License\").\n- * You may not use this file except in compliance with the License.\n- * A copy of the License is located at\n- *\n- * http://aws.amazon.com/apache2.0\n- *\n- * or in the \"license\" file accompanying this file. This file is distributed\n- * on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n- * express or implied. See the License for the specific language governing\n- * permissions and limitations under the License.\n- */\n-\n-/**\n- * @var \\Amazon\\Payment\\Block\\Minicart\\Button $block\n- */\n-$config = [\n- 'Amazon_Payment/js/amazon-button' => [\n- 'buttonType' => 'PwA'\n- ]\n-];\n-\n-$tooltipConfig = [\n- 'dropdown' => [\n- 'activeClass' => '_active'\n- ]\n-];\n-?>\n-\n-<div id=\"minicart-amazon-pay-button\" class=\"amazon-minicart-container\">\n- <div class=\"amazon-button-container\">\n- <div class=\"amazon-button-container__cell\">\n- <div id=\"PayWithAmazon\" class=\"login-with-amazon\" data-mage-init='<?php /* @noEscape */ echo json_encode($config); ?>'></div>\n- </div>\n-\n- <div class=\"amazon-button-container__cell\">\n- <div class=\"field-tooltip toggle\">\n- <span class=\"field-tooltip-action action-help\" data-mage-init='<?php /* @noEscape */ echo json_encode($tooltipConfig); ?>' data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\"></span>\n- <div class=\"field-tooltip-content\" data-target=\"dropdown\" aria-hidden=\"true\">Are you an Amazon customer? Pay now with address and payment details stored in your Amazon account.</div>\n- </div>\n- </div>\n- </div>\n-</div>\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Correct display on cart and add display validator
21,260
02.12.2016 19:15:59
21,600
c58de30ee83df5a4c94b58a59abbc18d58a2e814
Proper category exclusion and product view validation
[ { "change_type": "MODIFY", "old_path": "src/Payment/Helper/Shortcut/Validator.php", "new_path": "src/Payment/Helper/Shortcut/Validator.php", "diff": "@@ -42,21 +42,29 @@ class Validator implements ValidatorInterface\nprivate $_paymentData;\n/**\n- * @param \\Amazon\\Payment\\Model\\ConfigFactory $amazonConfig\n+ * @var \\Amazon\\Core\\Helper\\CategoryExclusion\n+ */\n+ private $_categoryExclusionHelper;\n+\n+ /**\n+ * @param \\Amazon\\Payment\\Model\\Config $amazonConfig\n* @param \\Magento\\Framework\\Registry $registry\n* @param \\Magento\\Catalog\\Model\\ProductTypes\\ConfigInterface $productTypeConfig\n* @param \\Magento\\Payment\\Helper\\Data $paymentData\n+ * @param \\Amazon\\Core\\Helper\\CategoryExclusion $categoryExclusionHelper\n*/\npublic function __construct(\n\\Amazon\\Payment\\Model\\Config $amazonConfig,\n\\Magento\\Framework\\Registry $registry,\n\\Magento\\Catalog\\Model\\ProductTypes\\ConfigInterface $productTypeConfig,\n- \\Magento\\Payment\\Helper\\Data $paymentData\n+ \\Magento\\Payment\\Helper\\Data $paymentData,\n+ \\Amazon\\Core\\Helper\\CategoryExclusion $categoryExclusionHelper\n) {\n$this->_amazonConfig = $amazonConfig;\n$this->_registry = $registry;\n$this->_productTypeConfig = $productTypeConfig;\n$this->_paymentData = $paymentData;\n+ $this->_categoryExclusionHelper = $categoryExclusionHelper;\n}\n/**\n@@ -88,6 +96,14 @@ class Validator implements ValidatorInterface\n// check visibility on product page\nif ($isInCatalog && $config->getValue('pwa_pp_button_is_visible')) {\n+ $currentProduct = $this->_registry->registry('current_product');\n+ if ($currentProduct !== null) {\n+ if ($this->_categoryExclusionHelper->productHasExcludedCategory($currentProduct))\n+ return false;\n+ } else {\n+ if ($this->_categoryExclusionHelper->isQuoteDirty())\n+ return false;\n+ }\nreturn true;\n}\nreturn false;\n" }, { "change_type": "MODIFY", "old_path": "src/Payment/Model/Config.php", "new_path": "src/Payment/Model/Config.php", "diff": "@@ -18,4 +18,17 @@ namespace Amazon\\Payment\\Model;\nuse Magento\\Framework\\App\\Config\\ScopeConfigInterface;\n-class Config extends \\Magento\\Payment\\Gateway\\Config\\Config {}\n\\ No newline at end of file\n+class Config extends \\Magento\\Payment\\Gateway\\Config\\Config {\n+ /**\n+ * Map any supported payment method into a config path by specified field name\n+ *\n+ * @param string $fieldName\n+ * @return string|null\n+ * @SuppressWarnings(PHPMD.CyclomaticComplexity)\n+ * @SuppressWarnings(PHPMD.NPathComplexity)\n+ */\n+ protected function _getSpecificConfigPath($fieldName)\n+ {\n+ return 'payment/amazon_payment/general/options';\n+ }\n+}\n\\ No newline at end of file\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Proper category exclusion and product view validation
21,260
05.12.2016 13:12:21
21,600
c665654839b6f91875c5cdd03610296d1c7d9d36
Fix display issues with minicart
[ { "change_type": "MODIFY", "old_path": "src/Payment/etc/frontend/di.xml", "new_path": "src/Payment/etc/frontend/di.xml", "diff": "<type name=\"Amazon\\Payment\\Block\\Minicart\\Button\">\n<arguments>\n<argument name=\"data\" xsi:type=\"array\">\n- <item name=\"template\" xsi:type=\"string\">Amazon_Payment::payment-link.phtml</item>\n+ <item name=\"template\" xsi:type=\"string\">Amazon_Payment::minicart-button.phtml</item>\n<item name=\"alias\" xsi:type=\"string\">amazon.button.mini-cart</item>\n</argument>\n<argument name=\"payment\" xsi:type=\"object\">Amazon\\Payment\\Model\\Method\\Amazon</argument>\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Fix display issues with minicart
21,260
13.01.2017 15:41:04
21,600
94cda8fa173b16618228c5699fbfc12dce0cd704
Get method from order, not quote
[ { "change_type": "MODIFY", "old_path": "src/Payment/Observer/CompleteOrderStatus.php", "new_path": "src/Payment/Observer/CompleteOrderStatus.php", "diff": "@@ -19,27 +19,19 @@ use Amazon\\Core\\Helper\\Data;\nuse Amazon\\Payment\\Model\\Method\\Amazon;\nuse Magento\\Framework\\Event\\Observer;\nuse Magento\\Framework\\Event\\ObserverInterface;\n-use Magento\\Quote\\Api\\PaymentMethodManagementInterface;\nuse Magento\\Sales\\Api\\Data\\OrderInterface;\nuse Magento\\Sales\\Model\\Order;\nclass CompleteOrderStatus implements ObserverInterface\n{\n- /**\n- * @var PaymentMethodManagementInterface\n- */\n- protected $paymentMethodManagement;\n-\n/**\n* @var Data\n*/\nprotected $coreHelper;\npublic function __construct(\n- PaymentMethodManagementInterface $paymentMethodManagement,\nData $coreHelper\n) {\n- $this->paymentMethodManagement = $paymentMethodManagement;\n$this->coreHelper = $coreHelper;\n}\n@@ -49,7 +41,7 @@ class CompleteOrderStatus implements ObserverInterface\n* @var OrderInterface $order\n*/\n$order = $observer->getOrder();\n- $payment = $this->paymentMethodManagement->get($order->getQuoteId());\n+ $payment = $order->getPayment();\n$newOrderStatus = $this->coreHelper->getNewOrderStatus();\nif ($newOrderStatus\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Get method from order, not quote
21,259
18.01.2017 12:48:25
0
b0b58b078de1d8866557a9711691578844ef3419
added scope parameter to payment widgets
[ { "change_type": "MODIFY", "old_path": "src/Payment/view/frontend/web/js/view/checkout-widget-address.js", "new_path": "src/Payment/view/frontend/web/js/view/checkout-widget-address.js", "diff": "@@ -48,7 +48,8 @@ define(\n},\noptions: {\nsellerId: window.amazonPayment.merchantId,\n- addressWidgetDOMId: 'addressBookWidgetDiv'\n+ addressWidgetDOMId: 'addressBookWidgetDiv',\n+ widgetScope: window.amazonPayment.loginScope\n},\nisCustomerLoggedIn: customer.isLoggedIn,\nisAmazonAccountLoggedIn: amazonStorage.isAmazonAccountLoggedIn,\n@@ -70,6 +71,7 @@ define(\nrenderAddressWidget: function () {\nnew OffAmazonPayments.Widgets.AddressBook({\nsellerId: self.options.sellerId,\n+ scope: self.options.widgetScope,\nonOrderReferenceCreate: function (orderReference) {\nvar orderid = orderReference.getAmazonOrderReferenceId();\namazonStorage.setOrderReference(orderid);\n" }, { "change_type": "MODIFY", "old_path": "src/Payment/view/frontend/web/js/view/payment/method-renderer/amazon-payment-widget.js", "new_path": "src/Payment/view/frontend/web/js/view/payment/method-renderer/amazon-payment-widget.js", "diff": "@@ -49,7 +49,8 @@ define(\noptions: {\nsellerId: window.amazonPayment.merchantId,\n- paymentWidgetDOMId: 'walletWidgetDiv'\n+ paymentWidgetDOMId: 'walletWidgetDiv',\n+ widgetScope: window.amazonPayment.loginScope\n},\nisCustomerLoggedIn: customer.isLoggedIn,\nisAmazonAccountLoggedIn: amazonStorage.isAmazonAccountLoggedIn,\n@@ -74,6 +75,7 @@ define(\nrenderPaymentWidget: function () {\nnew OffAmazonPayments.Widgets.Wallet({\nsellerId: self.options.sellerId,\n+ scope: self.options.widgetScope,\namazonOrderReferenceId: amazonStorage.getOrderReference(),\nonPaymentSelect: function (orderReference) {\namazonStorage.isPlaceOrderDisabled(true);\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
added scope parameter to payment widgets
21,259
25.01.2017 12:19:37
-3,600
a3ae76797ef2ee08092c43b0e93d67437f99ac5c
Changing layout to checkout, according to Magento 2.1 value
[ { "change_type": "MODIFY", "old_path": "src/Payment/view/frontend/layout/checkout_index_index.xml", "new_path": "src/Payment/view/frontend/layout/checkout_index_index.xml", "diff": "* permissions and limitations under the License.\n*/\n-->\n-<page xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" layout=\"1column\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework:View/Layout/etc/page_configuration.xsd\">\n+<page xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" layout=\"checkout\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework:View/Layout/etc/page_configuration.xsd\">\n<body>\n<referenceBlock name=\"minicart\">\n<arguments>\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Changing layout to checkout, according to Magento 2.1 value
21,259
08.02.2017 11:35:48
-3,600
e0081fa7002b33172052f0ac236a641d2eff762f
keeping the name for now
[ { "change_type": "MODIFY", "old_path": "composer.json", "new_path": "composer.json", "diff": "{\n- \"name\": \"amzn/amazon-payments-magento-2-plugin\",\n+ \"name\": \"amazon/module-login-and-pay\",\n\"description\": \"Official Magento2 Plugin to integrate with Amazon Payments\",\n\"type\": \"magento2-module\",\n\"version\": \"1.0.10\",\n" }, { "change_type": "MODIFY", "old_path": "marketplace-composer.json", "new_path": "marketplace-composer.json", "diff": "{\n- \"name\": \"amzn/module-login-and-pay\",\n+ \"name\": \"amazon/module-login-and-pay\",\n\"description\": \"Official Magento2 Plugin to integrate with Amazon Payments\",\n\"type\": \"metapackage\",\n\"version\": \"1.0.10\",\n" }, { "change_type": "MODIFY", "old_path": "src/Core/composer.json", "new_path": "src/Core/composer.json", "diff": "{\n- \"name\": \"amzn/module-core\",\n+ \"name\": \"amazon/module-core\",\n\"description\": \"Shared functionality for Amazon Login and Amazon Payment modules\",\n\"type\": \"magento2-module\",\n\"version\": \"1.0.10\",\n" }, { "change_type": "MODIFY", "old_path": "src/Login/composer.json", "new_path": "src/Login/composer.json", "diff": "{\n- \"name\": \"amzn/module-login\",\n+ \"name\": \"amazon/module-login\",\n\"description\": \"Amazon Login module\",\n\"type\": \"magento2-module\",\n\"version\": \"1.0.10\",\n\"Apache-2.0\"\n],\n\"require\": {\n- \"amzn/module-core\": \"^1.0.1\",\n+ \"amazon/module-core\": \"^1.0.1\",\n\"magento/module-customer\": \"^100.1.0\",\n\"magento/module-checkout\": \"^100.1.0\"\n},\n" }, { "change_type": "MODIFY", "old_path": "src/Payment/composer.json", "new_path": "src/Payment/composer.json", "diff": "{\n- \"name\": \"amzn/module-payment\",\n+ \"name\": \"amazon/module-payment\",\n\"description\": \"Amazon Payment module\",\n\"type\": \"magento2-module\",\n\"version\": \"1.0.10\",\n\"Apache-2.0\"\n],\n\"require\": {\n- \"amzn/module-core\": \"^1.0.1\",\n- \"amzn/module-login\": \"^1.0.1\",\n+ \"amazon/module-core\": \"^1.0.1\",\n+ \"amazon/module-login\": \"^1.0.1\",\n\"magento/module-eav\": \"^100.1.0\",\n\"magento/module-sales\": \"^100.1.0\",\n\"magento/module-quote\": \"^100.1.0\",\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
keeping the name for now
21,259
08.02.2017 16:38:57
-3,600
2b3422e6cda71dabdbabcbd1ddecfe9250adab39
GH issue and PR template added
[ { "change_type": "ADD", "old_path": null, "new_path": ".github/ISSUE_TEMPLATE.md", "diff": "+<!-- Thanks for contributing! Please pick a meaningful title and fill in the details below. -->\n+\n+#### What I expected\n+\n+<!-- What you or customer expected when performing the steps -->\n+\n+#### What happened instead\n+\n+<!-- What actual results you or customer got -->\n+\n+#### Steps to reproduce the issue\n+\n+<!-- Please add detailed steps to reproduce the issue. -->\n+\n+#### Your setup\n+\n+* Magento version:\n+* Magento Edition: Community / Enterprise / Enterprise Cloud\n+* JavaScript Console: Please add a screenshot of the Chrome Javascript console to speed up the process\n+* Shop URL : <!-- if you are willing to share -->\n+\n+<!--\n+PLEASE NOTE\n+- These comments won't show up when you submit the issue.\n+- Everything is optional, but try to add as many details as possible.\n+- Screenshot worth a thousand words, use screenshots if possible.\n+-->\n" }, { "change_type": "ADD", "old_path": null, "new_path": ".github/PULL_REQUEST_TEMPLATE.md", "diff": "+Fixes # .\n+\n+#### Additional details about this PR\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": ".gitignore", "new_path": ".gitignore", "diff": "vendor/\nbin/\nauth.json\n-\n-.github/*\n\\ No newline at end of file\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
GH issue and PR template added
21,259
22.02.2017 11:24:21
-3,600
91723f057ba4c032b199f55aca5254d2498d5561
re-brand language fixes
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "* Magento 2.1+\n* [Magento 2 System Requirements](http://devdocs.magento.com/guides/v2.0/install-gde/system-requirements.html)\n* SSL is installed on your site and active on Checkout and Login pages\n-* A verified Amazon Pay account\n+* A verified Amazon Payments merchant account\n## Installation and Configuration\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
re-brand language fixes
21,259
22.02.2017 12:32:28
-3,600
7e5332705ab56df9477cab4e11a8ba51a306f00c
Short Readme update
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "Please follow the instructions in the [User Guide] (https://amzn.github.io/amazon-payments-magento-2-plugin)\n## Release Notes\n-### v1.1.0 Rebrand, final module name, public launch\n+### v1.1.0 Rebrand\n#### Enhancements:\n* This release does not add any new features\n#### Bug Fixes:\n* This release does not fix any bugs\n-### v1.0.10 Automated key exchange, new streamlined registration, condensed UI\n+### v1.0.10 Small fixes\n#### Enhancements:\n* #31 Scope parameter propagated to the Amazon Pay widgets\n* #11 Integrate checkout agreement blocks in the checkout\n#### Bug Fixes:\n- * #27 Fix capture error when auth is greater than 7 days old\n+ * #27 Get the payment method from the order instead of the quote\n* #33 Fix the checkout layout block to be in line with Magento 2.1\n-\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Short Readme update
21,238
02.03.2017 17:04:34
28,800
5420aa577c25c5fc6b47a25ea1419512a7f51f74
Updating platform_id
[ { "change_type": "MODIFY", "old_path": "src/Payment/Model/OrderInformationManagement.php", "new_path": "src/Payment/Model/OrderInformationManagement.php", "diff": "@@ -128,7 +128,7 @@ class OrderInformationManagement implements OrderInformationManagementInterface\n'Magento Version : ' . $this->productMetadata->getVersion() . ' ' .\n'Plugin Version : ' . $this->paymentHelper->getModuleVersion()\n,\n- 'platform_id' => $this->coreHelper->getMerchantId(ScopeInterface::SCOPE_STORE, $storeId)\n+ 'platform_id' => 'A2ZAYEJU54T1BM'\n];\n$responseParser = $this->clientFactory->create($storeId)->setOrderReferenceDetails($data);\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Updating platform_id
21,257
03.03.2017 07:09:12
0
5b6346d98070db59c981b92a18472b8fd209d866
Display all store URLs in admin area for whitelisting
[ { "change_type": "MODIFY", "old_path": "src/Core/Block/Adminhtml/Form/Field/IpnUrl.php", "new_path": "src/Core/Block/Adminhtml/Form/Field/IpnUrl.php", "diff": "@@ -23,16 +23,18 @@ class IpnUrl extends BaseField\n{\nprotected function _renderValue(AbstractElement $element)\n{\n- $value = '';\n- $store = $this->_storeManager->getStore($this->getRequest()->getParam('store', 0));\n+ $stores = $this->_storeManager->getStores();\n+ $valueReturn = '';\n+ foreach ($stores as $store) {\n$baseUrl = $store->getBaseUrl(UrlInterface::URL_TYPE_WEB, true);\n-\nif ($baseUrl) {\n$value = $baseUrl . 'amazonpayments/payment/ipn/';\n+ $valueReturn .= \"<div>\".$value.\"</div>\";\n+ }\n}\n- return '<td class=\"value\">' . $value . '</td>';\n+ return '<td class=\"value\">' . $valueReturn . '</td>';\n}\nprotected function _renderInheritCheckbox(AbstractElement $element)\n" }, { "change_type": "MODIFY", "old_path": "src/Core/Block/Adminhtml/Form/Field/JsOrigin.php", "new_path": "src/Core/Block/Adminhtml/Form/Field/JsOrigin.php", "diff": "@@ -25,17 +25,19 @@ class JsOrigin extends BaseField\n{\nprotected function _renderValue(AbstractElement $element)\n{\n- $value = '';\n- $store = $this->_storeManager->getStore($this->getRequest()->getParam('store', 0));\n+ $stores = $this->_storeManager->getStores();\n+ $valueReturn = '';\n+ foreach ($stores as $store) {\n$baseUrl = $store->getBaseUrl(UrlInterface::URL_TYPE_WEB, true);\n-\nif ($baseUrl) {\n$uri = UriFactory::factory($baseUrl);\n$value = $uri->getScheme() . '://' . $uri->getHost();\n+ $valueReturn .= \"<div>\".$value.\"</div>\";\n+ }\n}\n- return '<td class=\"value\">' . $value . '</td>';\n+ return '<td class=\"value\">' . $valueReturn . '</td>';\n}\nprotected function _renderInheritCheckbox(AbstractElement $element)\n" }, { "change_type": "MODIFY", "old_path": "src/Core/Block/Adminhtml/Form/Field/RedirectUrl.php", "new_path": "src/Core/Block/Adminhtml/Form/Field/RedirectUrl.php", "diff": "@@ -23,16 +23,18 @@ class RedirectUrl extends BaseField\n{\nprotected function _renderValue(AbstractElement $element)\n{\n- $value = '';\n- $store = $this->_storeManager->getStore($this->getRequest()->getParam('store', 0));\n+ $stores = $this->_storeManager->getStores();\n+ $valueReturn = '';\n+ foreach ($stores as $store) {\n$baseUrl = $store->getBaseUrl(UrlInterface::URL_TYPE_WEB, true);\n-\nif ($baseUrl) {\n$value = $baseUrl . 'amazon/login/processAuthHash/';\n+ $valueReturn .= \"<div>\".$value.\"</div>\";\n+ }\n}\n- return '<td class=\"value\">' . $value . '</td>';\n+ return '<td class=\"value\">' . $valueReturn . '</td>';\n}\nprotected function _renderInheritCheckbox(AbstractElement $element)\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
AMAZON-16: Display all store URLs in admin area for whitelisting - https://github.com/amzn/amazon-payments-magento-2-plugin/issues/35
21,259
07.03.2017 13:54:49
-3,600
55a6aecb08f3cb123f0bfd3b3c95d87608d693b2
final name of the module
[ { "change_type": "MODIFY", "old_path": "composer.json", "new_path": "composer.json", "diff": "{\n- \"name\": \"amzn/amazon-pay-magento-2-module\",\n+ \"name\": \"amzn/amazon-pay-and-login-magento-2-module\",\n\"description\": \"Official Magento2 Plugin to integrate with Amazon Pay and Login with Amazon\",\n\"type\": \"magento2-module\",\n\"version\": \"1.1.0\",\n" }, { "change_type": "MODIFY", "old_path": "marketplace-composer.json", "new_path": "marketplace-composer.json", "diff": "{\n- \"name\": \"amzn/amazon-pay-magento-2-module\",\n+ \"name\": \"amzn/amazon-pay-and-login-magento-2-module\",\n\"description\": \"Official Magento2 Plugin to integrate with Amazon Pay and Login with Amazon\",\n\"type\": \"metapackage\",\n\"version\": \"1.1.0\",\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
final name of the module
21,243
07.03.2017 13:20:10
0
999c4e0db7e59a498b42a467a6c447c698fc9dba
Created option to disable Login button usage on homepage/cms pages to speed up the initial load
[ { "change_type": "MODIFY", "old_path": "src/Core/Block/Config.php", "new_path": "src/Core/Block/Config.php", "diff": "@@ -74,6 +74,7 @@ class Config extends Template\n'customerLoginPageUrl' => $this->url->getLoginUrl(),\n'sandboxSimulationOptions' => [],\n'loginScope' => $this->coreHelper->getLoginScope(),\n+ 'allowAmLoginLoading' => $this->coreHelper->allowAmLoginLoading(),\n'isEuPaymentRegion' => $this->coreHelper->isEuPaymentRegion(),\n'oAuthHashRedirectUrl' => $this->coreHelper->getOAuthRedirectUrl(),\n'isQuoteDirty' => $this->categoryExclusionHelper->isQuoteDirty(),\n" }, { "change_type": "MODIFY", "old_path": "src/Core/Helper/Data.php", "new_path": "src/Core/Helper/Data.php", "diff": "@@ -609,6 +609,20 @@ class Data extends AbstractHelper\n&& $this->scopeConfig->isSetFlag('payment/amazon_payment/pwa_pp_button_is_visible', $scope, $scopeCode);\n}\n+ /**\n+ * @param string $scope\n+ * @param null $scopeCode\n+ * @return bool\n+ */\n+ public function allowAmLoginLoading($scope = ScopeInterface::SCOPE_STORE, $scopeCode = null)\n+ {\n+ return $this->scopeConfig->isSetFlag(\n+ 'customer/startup/amazon_login_in_popup',\n+ $scope,\n+ $scopeCode\n+ );\n+ }\n+\n/**\n* @param string $scope\n* @param null|string $scopeCode\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Login/etc/adminhtml/system.xml", "diff": "+<?xml version=\"1.0\"?>\n+<!--\n+/**\n+ * Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\").\n+ * You may not use this file except in compliance with the License.\n+ * A copy of the License is located at\n+ *\n+ * http://aws.amazon.com/apache2.0\n+ *\n+ * or in the \"license\" file accompanying this file. This file is distributed\n+ * on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n+ * express or implied. See the License for the specific language governing\n+ * permissions and limitations under the License.\n+ */\n+-->\n+<config xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:module:Magento_Config:etc/system_file.xsd\">\n+ <system>\n+ <section id=\"customer\">\n+ <group id=\"startup\">\n+ <field id=\"amazon_login_in_popup\" translate=\"label comment\" type=\"select\" sortOrder=\"1\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"0\" canRestore=\"1\">\n+ <label>Amazon Login available in Authentication popup</label>\n+ <source_model>Magento\\Config\\Model\\Config\\Source\\Yesno</source_model>\n+ <comment>Disabling this may decrease page load time but will also remove the Amazon Login option from authentication popup.</comment>\n+ </field>\n+ </group>\n+ </section>\n+ </system>\n+</config>\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Login/etc/config.xml", "diff": "+<?xml version=\"1.0\"?>\n+<!--\n+/**\n+ * Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\").\n+ * You may not use this file except in compliance with the License.\n+ * A copy of the License is located at\n+ *\n+ * http://aws.amazon.com/apache2.0\n+ *\n+ * or in the \"license\" file accompanying this file. This file is distributed\n+ * on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n+ * express or implied. See the License for the specific language governing\n+ * permissions and limitations under the License.\n+ */\n+-->\n+<config xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:module:Magento_Store:etc/config.xsd\">\n+ <default>\n+ <customer>\n+ <startup>\n+ <amazon_login_in_popup>1</amazon_login_in_popup>\n+ </startup>\n+ </customer>\n+ </default>\n+</config>\n" }, { "change_type": "MODIFY", "old_path": "src/Login/view/frontend/layout/default.xml", "new_path": "src/Login/view/frontend/layout/default.xml", "diff": "<item name=\"authenticationPopup\" xsi:type=\"array\">\n<item name=\"children\" xsi:type=\"array\">\n<item name=\"amazon-button\" xsi:type=\"array\">\n- <item name=\"component\" xsi:type=\"string\">Amazon_Login/js/view/login-button</item>\n+ <item name=\"component\" xsi:type=\"string\">Amazon_Login/js/view/login-button-wrapper</item>\n<item name=\"sortOrder\" xsi:type=\"string\">0</item>\n<item name=\"displayArea\" xsi:type=\"string\">additional-login-form-fields</item>\n<item name=\"config\" xsi:type=\"array\">\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Login/view/frontend/web/js/view/login-button-wrapper.js", "diff": "+/**\n+ * Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\").\n+ * You may not use this file except in compliance with the License.\n+ * A copy of the License is located at\n+ *\n+ * http://aws.amazon.com/apache2.0\n+ *\n+ * or in the \"license\" file accompanying this file. This file is distributed\n+ * on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n+ * express or implied. See the License for the specific language governing\n+ * permissions and limitations under the License.\n+ */\n+\n+if (window.amazonPayment.allowAmLoginLoading == true) {\n+ define(['require', 'Amazon_Login/js/view/login-button'], function (require) {\n+ return require(\"Amazon_Login/js/view/login-button\");\n+ });\n+} else {\n+ define(['require', 'uiComponent'], function (require) {\n+ return require(\"uiComponent\");\n+ });\n+}\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
AMAZON-26: Created option to disable Login button usage on homepage/cms pages to speed up the initial load
21,243
07.03.2017 15:32:34
0
5692125433d1f9436b4a2ec5322e728c1f1bbf75
Added a switch to turn off minicart button loading from admin
[ { "change_type": "MODIFY", "old_path": "src/Core/Helper/Data.php", "new_path": "src/Core/Helper/Data.php", "diff": "@@ -609,6 +609,16 @@ class Data extends AbstractHelper\n&& $this->scopeConfig->isSetFlag('payment/amazon_payment/pwa_pp_button_is_visible', $scope, $scopeCode);\n}\n+ /**\n+ * @param string $scope\n+ * @param null $scopeCode\n+ * @return bool\n+ */\n+ public function isPayButtonAvailableInMinicart($scope = ScopeInterface::SCOPE_STORE, $scopeCode = null)\n+ {\n+ return $this->scopeConfig->isSetFlag('payment/amazon_payment/minicart_button_is_visible', $scope, $scopeCode);\n+ }\n+\n/**\n* @param string $scope\n* @param null $scopeCode\n" }, { "change_type": "MODIFY", "old_path": "src/Core/etc/adminhtml/system.xml", "new_path": "src/Core/etc/adminhtml/system.xml", "diff": "<source_model>Magento\\Config\\Model\\Config\\Source\\Yesno</source_model>\n<config_path>payment/amazon_payment/pwa_pp_button_is_visible</config_path>\n</field>\n+ <field id=\"minicart_button_is_visible\" translate=\"label comment\" type=\"select\" sortOrder=\"70\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"0\">\n+ <label>Amazon Pay button is visible in Minicart</label>\n+ <source_model>Magento\\Config\\Model\\Config\\Source\\Yesno</source_model>\n+ <config_path>payment/amazon_payment/minicart_button_is_visible</config_path>\n+ <comment>Disabling this may decrease page load time in CMS pages and homepage.</comment>\n+ </field>\n</group>\n</group>\n<group id=\"advanced\" translate=\"label\" type=\"text\" sortOrder=\"20\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n" }, { "change_type": "MODIFY", "old_path": "src/Core/etc/config.xml", "new_path": "src/Core/etc/config.xml", "diff": "<can_use_checkout>1</can_use_checkout>\n<packstation_terms>Packstation,Pack-Station,Pack Station,PO Box,Post Office box,Locker</packstation_terms>\n<pwa_pp_button_is_visible>1</pwa_pp_button_is_visible>\n+ <minicart_button_is_visible>1</minicart_button_is_visible>\n<button_type>full</button_type>\n<button_size>medium</button_size>\n<logging>1</logging>\n" }, { "change_type": "MODIFY", "old_path": "src/Payment/Block/Minicart/Button.php", "new_path": "src/Payment/Block/Minicart/Button.php", "diff": "@@ -18,6 +18,7 @@ namespace Amazon\\Payment\\Block\\Minicart;\nuse Magento\\Checkout\\Model\\Session;\nuse Magento\\Payment\\Model\\MethodInterface;\nuse Amazon\\Payment\\Helper\\Data;\n+use Amazon\\Core\\Helper\\Data as AmazonCoreHelper;\nuse Magento\\Paypal\\Block\\Express\\InContext;\nuse Magento\\Framework\\View\\Element\\Template;\nuse Magento\\Catalog\\Block\\ShortcutInterface;\n@@ -59,12 +60,18 @@ class Button extends Template implements ShortcutInterface\nprivate $session;\n/**\n- * Constructor\n+ * @var AmazonCoreHelper\n+ */\n+ private $coreHelper;\n+\n+ /**\n+ * Button constructor.\n* @param Context $context\n* @param ResolverInterface $localeResolver\n* @param Data $mainHelper\n- * @param MethodInterface $payment\n* @param Session $session\n+ * @param MethodInterface $payment\n+ * @param AmazonCoreHelper $coreHelper\n* @param array $data\n*/\npublic function __construct(\n@@ -73,6 +80,7 @@ class Button extends Template implements ShortcutInterface\nData $mainHelper,\nSession $session,\nMethodInterface $payment,\n+ AmazonCoreHelper $coreHelper,\narray $data = []\n) {\nparent::__construct($context, $data);\n@@ -81,6 +89,7 @@ class Button extends Template implements ShortcutInterface\n$this->mainHelper = $mainHelper;\n$this->payment = $payment;\n$this->session = $session;\n+ $this->coreHelper = $coreHelper;\n}\n/**\n@@ -88,7 +97,8 @@ class Button extends Template implements ShortcutInterface\n*/\nprotected function shouldRender()\n{\n- return $this->payment->isAvailable($this->session->getQuote())\n+ return $this->coreHelper->isPayButtonAvailableInMinicart()\n+ && $this->payment->isAvailable($this->session->getQuote())\n&& $this->isMiniCart;\n}\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
AMAZON-26: Added a switch to turn off minicart button loading from admin
21,273
16.03.2017 16:03:51
0
18bfcc855b685ef000d490f33c5a2151cc49457b
Adjusted amazon-core require deps By adding jquery/jquery-storageapi as a require dependency $.cookieStorage is always available. In some instances it is not available, depending on what scripts are used in any given instanc.e
[ { "change_type": "MODIFY", "old_path": "src/Payment/view/frontend/web/js/amazon-core.js", "new_path": "src/Payment/view/frontend/web/js/amazon-core.js", "diff": "@@ -18,7 +18,8 @@ define([\n'ko',\n'amazonPaymentConfig',\n'amazonWidgetsLoader',\n- 'bluebird'\n+ 'bluebird',\n+ 'jquery/jquery-storageapi'\n], function ($, ko, amazonPaymentConfig) {\n\"use strict\";\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Adjusted amazon-core require deps By adding jquery/jquery-storageapi as a require dependency $.cookieStorage is always available. In some instances it is not available, depending on what scripts are used in any given instanc.e
21,259
17.03.2017 12:30:39
-3,600
ed619c4179cd8e939d8d119e855e97762f8f906c
Title underlines have been to short
[ { "change_type": "MODIFY", "old_path": "docs/customisation.rst", "new_path": "docs/customisation.rst", "diff": "@@ -2,7 +2,7 @@ Frontend Customisation\n========================\nQ: I'd like to add a `Amazon Pay` or `Login with Amazon` button elsewhere on my site\n--------------------------\n+------------------------------------------------------------------------------------\nIf you are wanting to add one of these buttons to a new location on your site you need to update the **XML** for the page you want to add it to.\n@@ -37,7 +37,7 @@ If you wish to add a `Amazon Pay` button elsewhere in your store, you can follow\nYou can position and target which block the button appears in as with the `Login with Amazon` button. If you need more information on how to position and add new blocks into Magento 2 please see the `Magento 2 documentation <http://devdocs.magento.com/guides/v2.1/frontend-dev-guide/layouts/layout-overview.html>`_\nQ: I'd like to customise the authorisation decline e-mail\n--------------------------\n+---------------------------------------------------------\nYou can easily customise the authorisation decline e-mails by creating a version in your own theme. To do this you need to copy the current template into your own theme:\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Title underlines have been to short
21,259
17.03.2017 12:31:29
-3,600
0c16d18db87e20c8a8c003f96cfa6b4c7a664451
Title underline fixed
[ { "change_type": "MODIFY", "old_path": "docs/prerequisites.rst", "new_path": "docs/prerequisites.rst", "diff": "@@ -14,7 +14,7 @@ System requirements\n.. _prerequisites-amazon-account-setup:\n**Amazon Pay and Login with Amazon** account setup\n--------------------------------------------\n+--------------------------------------------------\nRegistering an Amazon Payments merchant Account\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Title underline fixed
21,265
24.03.2017 08:04:41
0
f8eae73476b20a7f56adbf9064329210eb423a60
Removed admin layout file because all it contained was reference to non-existing css file
[ { "change_type": "DELETE", "old_path": "src/Core/view/adminhtml/layout/adminhtml_system_config_edit.xml", "new_path": null, "diff": "-<?xml version=\"1.0\"?>\n-<!--\n-/**\n- * Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n- *\n- * Licensed under the Apache License, Version 2.0 (the \"License\").\n- * You may not use this file except in compliance with the License.\n- * A copy of the License is located at\n- *\n- * http://aws.amazon.com/apache2.0\n- *\n- * or in the \"license\" file accompanying this file. This file is distributed\n- * on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n- * express or implied. See the License for the specific language governing\n- * permissions and limitations under the License.\n- */\n--->\n-<page xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" layout=\"admin-2columns-left\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework:View/Layout/etc/page_configuration.xsd\">\n- <head>\n- <css src=\"Magento_Catalog::catalog/category-selector.css\"/>\n- </head>\n-</page>\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
AMAZON-28: Removed admin layout file because all it contained was reference to non-existing css file
21,243
24.03.2017 08:44:22
0
9417b4ad065286f08fc35358c0f09a65a0410cc6
Make sure URLs displayed are unique
[ { "change_type": "MODIFY", "old_path": "src/Core/Block/Adminhtml/Form/Field/IpnUrl.php", "new_path": "src/Core/Block/Adminhtml/Form/Field/IpnUrl.php", "diff": "@@ -25,15 +25,21 @@ class IpnUrl extends BaseField\n{\n$stores = $this->_storeManager->getStores();\n$valueReturn = '';\n+ $urlArray = array();\nforeach ($stores as $store) {\n$baseUrl = $store->getBaseUrl(UrlInterface::URL_TYPE_WEB, true);\nif ($baseUrl) {\n$value = $baseUrl . 'amazonpayments/payment/ipn/';\n- $valueReturn .= \"<div>\".$value.\"</div>\";\n+ $urlArray[] = \"<div>\".$value.\"</div>\";\n}\n}\n+ $urlArray = array_unique($urlArray);\n+ foreach ($urlArray as $uniqueUrl) {\n+ $valueReturn .= \"<div>\".$uniqueUrl.\"</div>\";\n+ }\n+\nreturn '<td class=\"value\">' . $valueReturn . '</td>';\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Core/Block/Adminhtml/Form/Field/JsOrigin.php", "new_path": "src/Core/Block/Adminhtml/Form/Field/JsOrigin.php", "diff": "@@ -27,16 +27,21 @@ class JsOrigin extends BaseField\n{\n$stores = $this->_storeManager->getStores();\n$valueReturn = '';\n+ $urlArray = array();\nforeach ($stores as $store) {\n$baseUrl = $store->getBaseUrl(UrlInterface::URL_TYPE_WEB, true);\nif ($baseUrl) {\n$uri = UriFactory::factory($baseUrl);\n- $value = $uri->getScheme() . '://' . $uri->getHost();\n- $valueReturn .= \"<div>\".$value.\"</div>\";\n+ $urlArray[] = $uri->getScheme() . '://' . $uri->getHost();\n}\n}\n+ $urlArray = array_unique($urlArray);\n+ foreach ($urlArray as $uniqueUrl) {\n+ $valueReturn .= \"<div>\".$uniqueUrl.\"</div>\";\n+ }\n+\nreturn '<td class=\"value\">' . $valueReturn . '</td>';\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Core/Block/Adminhtml/Form/Field/RedirectUrl.php", "new_path": "src/Core/Block/Adminhtml/Form/Field/RedirectUrl.php", "diff": "@@ -25,15 +25,21 @@ class RedirectUrl extends BaseField\n{\n$stores = $this->_storeManager->getStores();\n$valueReturn = '';\n+ $urlArray = array();\nforeach ($stores as $store) {\n$baseUrl = $store->getBaseUrl(UrlInterface::URL_TYPE_WEB, true);\nif ($baseUrl) {\n$value = $baseUrl . 'amazon/login/processAuthHash/';\n- $valueReturn .= \"<div>\".$value.\"</div>\";\n+ $urlArray[] = \"<div>\".$value.\"</div>\";\n}\n}\n+ $urlArray = array_unique($urlArray);\n+ foreach ($urlArray as $uniqueUrl) {\n+ $valueReturn .= \"<div>\".$uniqueUrl.\"</div>\";\n+ }\n+\nreturn '<td class=\"value\">' . $valueReturn . '</td>';\n}\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
AMAZON-16: Make sure URLs displayed are unique
21,252
24.03.2017 09:00:10
0
e6df6ab16ff8dc38beb0beab1214a7d95c01f34e
Admin version data added
[ { "change_type": "ADD", "old_path": null, "new_path": "src/Core/Block/Adminhtml/System/Config/Form/Version.php", "diff": "+<?php\n+\n+namespace Amazon\\Core\\Block\\Adminhtml\\System\\Config\\Form;\n+\n+use Magento\\Backend\\Block\\Template\\Context;\n+use Magento\\Framework\\Module\\ModuleListInterface;\n+\n+class Version extends \\Magento\\Config\\Block\\System\\Config\\Form\\Field\n+{\n+ const MODULE_AMAZON_CORE = 'Amazon_Core';\n+ const MODULE_AMAZON_LOGIN = 'Amazon_Login';\n+ const MODULE_AMAZON_PAYMENT = 'Amazon_Payment';\n+\n+ protected $_moduleList;\n+\n+ public function __construct(\n+ ModuleListInterface $moduleList,\n+ Context $context,\n+ array $data = []\n+ ) {\n+ $this->_moduleList = $moduleList;\n+ parent::__construct($context, $data);\n+ }\n+\n+ public function render(\\Magento\\Framework\\Data\\Form\\Element\\AbstractElement $element)\n+ {\n+ $output = '<div style=\"background-color:#eee;padding:1em;border:1px solid #ddd;\">';\n+ $output .= 'Amazon Core version: ' . $this->getVersion(self::MODULE_AMAZON_CORE) . '<br style=\"display:inherit;\" />';\n+ $output .= 'Amazon Login version: ' . $this->getVersion(self::MODULE_AMAZON_LOGIN) . '<br style=\"display:inherit;\" />';\n+ $output .= 'Amazon Payment version: ' . $this->getVersion(self::MODULE_AMAZON_PAYMENT);\n+ $output .= \"</div>\";\n+ return $output;\n+ }\n+\n+ protected function getVersion($module)\n+ {\n+ $version = $this->_moduleList->getOne($module);\n+ if ($version && isset($version['setup_version'])) {\n+ return $version['setup_version'];\n+ } else {\n+ return 'Missing!';\n+ }\n+ }\n+}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "src/Core/etc/adminhtml/system.xml", "new_path": "src/Core/etc/adminhtml/system.xml", "diff": "<section id=\"payment\">\n<group id=\"amazon_payment\" translate=\"label\" type=\"text\" sortOrder=\"8\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n<label>Amazon Pay</label>\n+ <field id=\"version\" type=\"text\" translate=\"label comment\" sortOrder=\"10\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n+ <frontend_model>Amazon\\Core\\Block\\Adminhtml\\System\\Config\\Form\\Version</frontend_model>\n+ </field>\n<group id=\"general\" translate=\"label\" type=\"text\" sortOrder=\"10\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n<label>General</label>\n<group id=\"credentials\" translate=\"label\" type=\"text\" sortOrder=\"10\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
AMAZON-29: Admin version data added
21,252
24.03.2017 11:13:32
0
6e5e42d4bec57c5a17cf4b4b611abef7b733c99f
Charge on Order notification now uses success style instead of warning
[ { "change_type": "MODIFY", "old_path": "src/Payment/view/frontend/web/template/notification.html", "new_path": "src/Payment/view/frontend/web/template/notification.html", "diff": "<!-- ko if: (isAmazonAccountLoggedIn) -->\n<!-- ko if: (chargeOnOrder) -->\n<!-- ko if: (isEuPaymentRegion) -->\n- <div class=\"message warning\"><span data-bind=\"text: message\"></span></div>\n+ <div class=\"message success\"><span data-bind=\"text: message\"></span></div>\n<!-- /ko -->\n<!-- /ko -->\n<!-- /ko -->\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
AMAZON-30: Charge on Order notification now uses success style instead of warning
21,243
03.04.2017 06:01:39
0
4427d4ce3b8de1fd7e57a4455d214bb40cea0e1a
Add configuration option for "Store Name"
[ { "change_type": "MODIFY", "old_path": "src/Core/Helper/Data.php", "new_path": "src/Core/Helper/Data.php", "diff": "@@ -469,6 +469,26 @@ class Data extends AbstractHelper\n);\n}\n+ /*\n+ * @return string\n+ */\n+ public function getStoreName($scope = ScopeInterface::SCOPE_STORE, $scopeCode = null)\n+ {\n+ return $this->scopeConfig->getValue(\n+ 'payment/amazon_payment/storename',\n+ $scope,\n+ $scopeCode\n+ );\n+ }\n+\n+ /*\n+ * @return string\n+ */\n+ public function getStoreFrontName($storeId)\n+ {\n+ return $this->storeManager->getStore($storeId)->getName();\n+ }\n+\n/*\n* @return string\n*/\n" }, { "change_type": "MODIFY", "old_path": "src/Core/etc/adminhtml/system.xml", "new_path": "src/Core/etc/adminhtml/system.xml", "diff": "<source_model>Magento\\Sales\\Model\\Config\\Source\\Order\\Status\\Processing</source_model>\n<config_path>payment/amazon_payment/new_order_status</config_path>\n</field>\n+ <field id=\"storename\" translate=\"label\" type=\"text\" sortOrder=\"30\" showInDefault=\"1\" showInWebsite=\"0\" showInStore=\"1\">\n+ <label>Store Name</label>\n+ <config_path>payment/amazon_payment/storename</config_path>\n+ </field>\n</group>\n<group id=\"sales_exclusions\" translate=\"label\" type=\"text\" sortOrder=\"30\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n<label>Sales Exclusions</label>\n" }, { "change_type": "MODIFY", "old_path": "src/Payment/Helper/Email.php", "new_path": "src/Payment/Helper/Email.php", "diff": "@@ -74,10 +74,17 @@ class Email extends AbstractHelper\n$order->getStoreId()\n);\n+ $storeName = $this->coreHelper->getStoreName(ScopeInterface::SCOPE_STORE, $order->getStoreId());\n+ if (!$storeName) {\n+ $storeName = $this->coreHelper->getStoreFrontName($order->getStoreId());\n+ }\n+\n$vars = [\n'amazonAccountUrl' => $this->amazonCoreHelper\n->getAmazonAccountUrlByPaymentRegion($paymentRegionByOrderStore),\n+ 'storeName' => $storeName,\n];\n+\n$emailTransportBuilder->setTemplateVars($vars);\n$emailTransportBuilder->getTransport()->sendMessage();\n@@ -92,6 +99,11 @@ class Email extends AbstractHelper\n{\n$emailTransportBuilder = $this->emailTransportBuilderFactory->create();\n+ $storeName = $this->coreHelper->getStoreName(ScopeInterface::SCOPE_STORE, $order->getStoreId());\n+ if (!$storeName) {\n+ $storeName = $this->coreHelper->getStoreFrontName($order->getStoreId());\n+ }\n+\n$emailTransportBuilder->addTo($order->getCustomerEmail(), $order->getCustomerName());\n$emailTransportBuilder->setFrom('general');\n$emailTransportBuilder->setTemplateIdentifier('amazon_payments_auth_hard_decline');\n@@ -101,7 +113,12 @@ class Email extends AbstractHelper\n'store' => $order->getStoreId()\n]\n);\n- $emailTransportBuilder->setTemplateVars([]);\n+\n+ $vars = [\n+ 'storeName' => $storeName,\n+ ];\n+\n+ $emailTransportBuilder->setTemplateVars($vars);\n$emailTransportBuilder->getTransport()->sendMessage();\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Payment/Model/OrderInformationManagement.php", "new_path": "src/Payment/Model/OrderInformationManagement.php", "diff": "@@ -118,12 +118,17 @@ class OrderInformationManagement implements OrderInformationManagementInterface\n$this->setReservedOrderId($quote);\n+ $storeName = $this->coreHelper->getStoreName(ScopeInterface::SCOPE_STORE, $storeId);\n+ if (!$storeName) {\n+ $storeName = $quote->getStore()->getName();\n+ }\n+\n$data = [\n'amazon_order_reference_id' => $amazonOrderReferenceId,\n'amount' => $quote->getGrandTotal(),\n'currency_code' => $quote->getQuoteCurrencyCode(),\n'seller_order_id' => $quote->getReservedOrderId(),\n- 'store_name' => $quote->getStore()->getName(),\n+ 'store_name' => $storeName,\n'custom_information' =>\n'Magento Version : ' . $this->productMetadata->getVersion() . ' ' .\n'Plugin Version : ' . $this->paymentHelper->getModuleVersion()\n" }, { "change_type": "MODIFY", "old_path": "src/Payment/view/frontend/email/hard-declined-auth.html", "new_path": "src/Payment/view/frontend/email/hard-declined-auth.html", "diff": "<p>{{trans \"Valued customer\"}},</p>\n<br>\n<p>\n- {{trans \"Unfortunately Amazon Pay declined the payment for your order in our online shop %storeName. Please contact us.\" storeName=$store.getFrontendName()}}.\n+ {{trans \"Unfortunately Amazon Pay declined the payment for your order in our online shop %storeName. Please contact us.\" storeName=$storeName}}.\n</p>\n<p>{{trans \"Kind regards\"}},</p>\n" }, { "change_type": "MODIFY", "old_path": "src/Payment/view/frontend/email/soft-declined-auth.html", "new_path": "src/Payment/view/frontend/email/soft-declined-auth.html", "diff": "<p>{{trans \"Valued customer\"}},</p>\n<br>\n<p>\n- {{trans \"Thank you very much for your order at %storeName\" storeName=$store.getFrontendName()}}.\n+ {{trans \"Thank you very much for your order at %storeName\" storeName=$storeName}}.\n{{trans \"Amazon Pay was not able to process your payment\"}}.\n</p>\n<p>\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
AMAZON-17: Add configuration option for "Store Name"
21,252
13.04.2017 08:34:43
-3,600
024998368b2fc35719644840ac19bbca561cf575
Added a feature to block Amazon checkout widget when quote grand total is 0
[ { "change_type": "MODIFY", "old_path": "src/Core/Helper/CategoryExclusion.php", "new_path": "src/Core/Helper/CategoryExclusion.php", "diff": "@@ -77,6 +77,11 @@ class CategoryExclusion extends AbstractHelper\n*/\npublic function isQuoteDirty()\n{\n+ // Quote is 0 or less\n+ if ($this->quote->getGrandTotal() <= 0) {\n+ return true;\n+ }\n+\nif (!empty($this->getExcludedCategories())) {\n/** @var \\Magento\\Quote\\Model\\Quote\\Item\\AbstractItem $quoteItem */\nforeach ($this->quote->getAllItems() as $quoteItem) {\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
AMAZON-31: Added a feature to block Amazon checkout widget when quote grand total is 0
21,252
17.04.2017 07:58:58
-3,600
e445852c2d14fd5057a9ca2f838cb4b93d3903cc
Shipping information plugin now ignores quote with grand total 0
[ { "change_type": "MODIFY", "old_path": "src/Payment/Helper/Shortcut/CheckoutValidator.php", "new_path": "src/Payment/Helper/Shortcut/CheckoutValidator.php", "diff": "@@ -57,7 +57,6 @@ class CheckoutValidator implements ValidatorInterface\n*/\npublic function validate($code, $isInCatalog)\n{\n- return false;\nreturn $this->_shortcutValidator->isContextAvailable($code, $isInCatalog)\n&& $this->_shortcutValidator->isPriceOrSetAvailable($isInCatalog)\n&& $this->isMethodQuoteAvailable($code, $isInCatalog)\n" }, { "change_type": "MODIFY", "old_path": "src/Payment/Plugin/ShippingInformationManagement.php", "new_path": "src/Payment/Plugin/ShippingInformationManagement.php", "diff": "@@ -51,6 +51,12 @@ class ShippingInformationManagement\n$return = $proceed($cartId, $shippingInformation);\n$quote = $this->cartRepository->getActive($cartId);\n+\n+ /* Grand total is 0, skip rest of the plugin */\n+ if ($quote->getGrandTotal() <= 0) {\n+ return $return;\n+ }\n+\n$amazonOrderReferenceId = $quote->getExtensionAttributes()->getAmazonOrderReferenceId();\nif ($amazonOrderReferenceId) {\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
AMAZON-31: Shipping information plugin now ignores quote with grand total 0
21,252
17.04.2017 09:08:08
-3,600
b5ccf0529403e2087334ee1bb0f3d6d811ad78d8
Card charge notification removed
[ { "change_type": "MODIFY", "old_path": "src/Payment/view/frontend/layout/checkout_index_index.xml", "new_path": "src/Payment/view/frontend/layout/checkout_index_index.xml", "diff": "<item name=\"components\" xsi:type=\"array\">\n<item name=\"checkout\" xsi:type=\"array\">\n<item name=\"children\" xsi:type=\"array\">\n+ <!--\n<item name=\"amazon-payment-notification\" xsi:type=\"array\">\n<item name=\"component\" xsi:type=\"string\">Amazon_Payment/js/view/notification</item>\n<item name=\"displayArea\" xsi:type=\"string\">messages</item>\n<item name=\"message\" xsi:type=\"string\" translate=\"true\">Your card will be charged on completion of this order.</item>\n</item>\n</item>\n+ -->\n<item name=\"steps\" xsi:type=\"array\">\n<item name=\"children\" xsi:type=\"array\">\n<item name=\"shipping-step\" xsi:type=\"array\">\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
AMAZON-30: Card charge notification removed
21,238
18.04.2017 11:56:23
25,200
2cd784f54a3ab22907cf877eff0a5da73b73304e
Updating supported versions of PHP per Magento documentation
[ { "change_type": "MODIFY", "old_path": "marketplace-composer.json", "new_path": "marketplace-composer.json", "diff": "\"Apache-2.0\"\n],\n\"require\": {\n- \"php\": \"~5.6.0|7.0.2|~7.0.6\",\n+ \"php\": \"~5.6.5|7.0.2|7.0.4|~7.0.6\",\n\"amzn/login-and-pay-with-amazon-sdk-php\": \"^2.1.0\",\n\"amzn/amazon-pay-and-login-with-amazon-core-module\": \"^1.1.0\",\n\"amzn/login-with-amazon-module\": \"^1.1.0\",\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Updating supported versions of PHP per Magento documentation - http://devdocs.magento.com/guides/v2.1/install-gde/system-requirements-tech.html
21,243
28.04.2017 08:41:36
-3,600
a58edcc9694bfb21bdfb481bfb60525fee153ef8
Do not remove 'free' method in case it exists
[ { "change_type": "MODIFY", "old_path": "src/Payment/view/frontend/web/js/view/payment/list.js", "new_path": "src/Payment/view/frontend/web/js/view/payment/list.js", "diff": "@@ -42,7 +42,7 @@ define([\ncheckoutDataResolver.resolvePaymentMethod();\n//remove renderer for \"deleted\" payment methods\n_.each(changes, function (change) {\n- if (amazonStorage.isAmazonAccountLoggedIn() && change.value.method !== 'amazon_payment') {\n+ if (this._shouldRemovePaymentMethod(change.value.method)) {\nthis.removeRenderer(change.value.method);\nchange.status = 'deleted';\n}\n@@ -54,6 +54,15 @@ define([\nreturn this;\n},\n+ /**\n+ * Check if a payment method is applicable with Amazon Pay\n+ * @param method\n+ * @returns {boolean}\n+ * @private\n+ */\n+ _shouldRemovePaymentMethod: function (method) {\n+ return amazonStorage.isAmazonAccountLoggedIn() && method !== 'amazon_payment' && method !== 'free';\n+ },\n/**\n* handle decline codes\n* @private\n@@ -91,7 +100,7 @@ define([\n//if the payment methods are already set\n$(document).on('rendered', '#amazon_payment', function () {\n_.each(paymentMethods(), function (payment) {\n- if (amazonStorage.isAmazonAccountLoggedIn() && payment.method !== 'amazon_payment') {\n+ if (this._shouldRemovePaymentMethod(payment.method)) {\nthis.removeRenderer(payment.method);\n}\n}, self);\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
AMAZON-31: Do not remove 'free' method in case it exists
21,243
28.04.2017 08:55:50
-3,600
b080c8088b921f4ea8be77a63760712293b50fb3
Restore original validation line
[ { "change_type": "MODIFY", "old_path": "src/Payment/Helper/Shortcut/CheckoutValidator.php", "new_path": "src/Payment/Helper/Shortcut/CheckoutValidator.php", "diff": "@@ -57,6 +57,7 @@ class CheckoutValidator implements ValidatorInterface\n*/\npublic function validate($code, $isInCatalog)\n{\n+ return false;\nreturn $this->_shortcutValidator->isContextAvailable($code, $isInCatalog)\n&& $this->_shortcutValidator->isPriceOrSetAvailable($isInCatalog)\n&& $this->isMethodQuoteAvailable($code, $isInCatalog)\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
AMAZON-31: Restore original validation line
21,252
03.05.2017 13:26:41
-3,600
8328dbdb175643d5eac2ba882927ae452bb401e1
Version info update
[ { "change_type": "MODIFY", "old_path": "src/Core/Block/Adminhtml/System/Config/Form/Version.php", "new_path": "src/Core/Block/Adminhtml/System/Config/Form/Version.php", "diff": "@@ -25,9 +25,7 @@ class Version extends \\Magento\\Config\\Block\\System\\Config\\Form\\Field\npublic function render(\\Magento\\Framework\\Data\\Form\\Element\\AbstractElement $element)\n{\n$output = '<div style=\"background-color:#eee;padding:1em;border:1px solid #ddd;\">';\n- $output .= 'Amazon Core version: ' . $this->getVersion(self::MODULE_AMAZON_CORE) . '<br style=\"display:inherit;\" />';\n- $output .= 'Amazon Login version: ' . $this->getVersion(self::MODULE_AMAZON_LOGIN) . '<br style=\"display:inherit;\" />';\n- $output .= 'Amazon Payment version: ' . $this->getVersion(self::MODULE_AMAZON_PAYMENT);\n+ $output .= 'Extension version: ' . $this->getVersion(self::MODULE_AMAZON_CORE);\n$output .= \"</div>\";\nreturn $output;\n}\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
AMAZON-29: Version info update
21,252
11.05.2017 13:44:00
-3,600
8ba5d30aadba6a2a384143f634ed07ba1fb5656a
Forces extension explicitly use built in modernizr plugin
[ { "change_type": "MODIFY", "old_path": "src/Payment/view/frontend/web/js/amazon-button.js", "new_path": "src/Payment/view/frontend/web/js/amazon-button.js", "diff": "@@ -21,7 +21,7 @@ define([\n'modernizr/modernizr',\n'amazonCore',\n'jquery/ui'\n-], function ($, customerData, sectionConfig, amazonPaymentConfig, amazonCsrf) {\n+], function ($, customerData, sectionConfig, amazonPaymentConfig, amazonCsrf, mdrnzr) {\n\"use strict\";\nvar _this,\n@@ -79,7 +79,7 @@ define([\n},\nusePopUp: function () {\n//always use redirect journey on product page and touch devices\n- return ((window.location.protocol === 'https:' && !$('body').hasClass('catalog-product-view')) && !Modernizr.touch);\n+ return ((window.location.protocol === 'https:' && !$('body').hasClass('catalog-product-view')) && !mdrnzr.touch);\n},\n/**\n* onAmazonPaymentsReady\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
AMAZON-38: Forces extension explicitly use built in modernizr plugin
21,243
12.05.2017 08:44:16
-3,600
7cfdabf9d717560624731fa01639721e82f64c55
Fixed a condition that is no longer necessary
[ { "change_type": "MODIFY", "old_path": "src/Core/Helper/CategoryExclusion.php", "new_path": "src/Core/Helper/CategoryExclusion.php", "diff": "@@ -77,11 +77,6 @@ class CategoryExclusion extends AbstractHelper\n*/\npublic function isQuoteDirty()\n{\n- // Quote is 0 or less\n- if ($this->quote->getGrandTotal() <= 0) {\n- return true;\n- }\n-\nif (!empty($this->getExcludedCategories())) {\n/** @var \\Magento\\Quote\\Model\\Quote\\Item\\AbstractItem $quoteItem */\nforeach ($this->quote->getAllItems() as $quoteItem) {\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
AMAZON-31: Fixed a condition that is no longer necessary
21,243
12.05.2017 10:53:42
-3,600
d9b8f7c647d5830a7e637d73e36bb01ef39812fd
Refix the Modernizr requirement with adding support for both v2 and v3 APIs
[ { "change_type": "MODIFY", "old_path": "src/Payment/view/frontend/web/js/amazon-button.js", "new_path": "src/Payment/view/frontend/web/js/amazon-button.js", "diff": "@@ -21,7 +21,7 @@ define([\n'modernizr/modernizr',\n'amazonCore',\n'jquery/ui'\n-], function ($, customerData, sectionConfig, amazonPaymentConfig, amazonCsrf, mdrnzr) {\n+], function ($, customerData, sectionConfig, amazonPaymentConfig, amazonCsrf) {\n\"use strict\";\nvar _this,\n@@ -77,9 +77,18 @@ define([\n_popupCallback: function () {\nreturn _this.usePopUp() ? _this.secureHttpsCallback : amazonPaymentConfig.getValue('oAuthHashRedirectUrl');\n},\n+ /**\n+ * Are touch events available\n+ * (Supports both v2 and v3 Modernizr)\n+ * @returns {Boolean}\n+ * @private\n+ */\n+ _touchSupported: function () {\n+ return Modernizr.touch !== undefined ? Modernizr.touch : Modernizr.touchevents;\n+ },\nusePopUp: function () {\n//always use redirect journey on product page and touch devices\n- return ((window.location.protocol === 'https:' && !$('body').hasClass('catalog-product-view')) && !mdrnzr.touch);\n+ return ((window.location.protocol === 'https:' && !$('body').hasClass('catalog-product-view')) && !_this._touchSupported());\n},\n/**\n* onAmazonPaymentsReady\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
AMAZON-38: Refix the Modernizr requirement with adding support for both v2 and v3 APIs
21,252
18.05.2017 15:19:33
-3,600
a435f9bd3526c3a742d9701238b808e809e994ee
Comments, internationalisation
[ { "change_type": "MODIFY", "old_path": "src/Core/Block/Adminhtml/System/Config/Form/Version.php", "new_path": "src/Core/Block/Adminhtml/System/Config/Form/Version.php", "diff": "@@ -11,8 +11,17 @@ class Version extends \\Magento\\Config\\Block\\System\\Config\\Form\\Field\nconst MODULE_AMAZON_LOGIN = 'Amazon_Login';\nconst MODULE_AMAZON_PAYMENT = 'Amazon_Payment';\n+ /**\n+ * @var ModuleListInterface\n+ */\nprotected $_moduleList;\n+ /**\n+ * Version constructor.\n+ * @param ModuleListInterface $moduleList\n+ * @param Context $context\n+ * @param array $data\n+ */\npublic function __construct(\nModuleListInterface $moduleList,\nContext $context,\n@@ -22,21 +31,29 @@ class Version extends \\Magento\\Config\\Block\\System\\Config\\Form\\Field\nparent::__construct($context, $data);\n}\n+ /**\n+ * @param \\Magento\\Framework\\Data\\Form\\Element\\AbstractElement $element\n+ * @return string\n+ */\npublic function render(\\Magento\\Framework\\Data\\Form\\Element\\AbstractElement $element)\n{\n$output = '<div style=\"background-color:#eee;padding:1em;border:1px solid #ddd;\">';\n- $output .= 'Extension version: ' . $this->getVersion(self::MODULE_AMAZON_CORE);\n+ $output .= __('Extension version') . ': ' . $this->getVersion(self::MODULE_AMAZON_CORE);\n$output .= \"</div>\";\nreturn $output;\n}\n+ /**\n+ * @param $module\n+ * @return \\Magento\\Framework\\Phrase\n+ */\nprotected function getVersion($module)\n{\n$version = $this->_moduleList->getOne($module);\nif ($version && isset($version['setup_version'])) {\nreturn $version['setup_version'];\n} else {\n- return 'Missing!';\n+ return __('Missing!');\n}\n}\n}\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
AMAZON-29: Comments, internationalisation
21,243
19.05.2017 08:13:03
-3,600
940704bc55fc947000ce5e76aa8ea9cff8cb24ed
Updated code safety, do not operate or order when payment != amazon
[ { "change_type": "MODIFY", "old_path": "src/Payment/Observer/CompleteOrder.php", "new_path": "src/Payment/Observer/CompleteOrder.php", "diff": "@@ -30,30 +30,44 @@ class CompleteOrder implements ObserverInterface\n*/\nprotected $orderInformationManagement;\n+ /**\n+ * CompleteOrder constructor.\n+ * @param OrderInformationManagement $orderInformationManagement\n+ */\npublic function __construct(\nOrderInformationManagement $orderInformationManagement\n) {\n$this->orderInformationManagement = $orderInformationManagement;\n}\n+ /**\n+ * @param Observer $observer\n+ */\npublic function execute(Observer $observer)\n{\n/**\n* @var OrderInterface $order\n*/\n$order = $observer->getOrder();\n- $complete = Order::STATE_COMPLETE;\n- if ($order->getState() == $complete && $order->getStoredData()[OrderInterface::STATE] != $complete) {\n+ if ($order->getPayment() && $order->getPayment()->getMethod() != Amazon::PAYMENT_METHOD_CODE) {\n+ return;\n+ }\n+\n+ if ($order->getState() == Order::STATE_COMPLETE &&\n+ $order->getStoredData()[OrderInterface::STATE] != Order::STATE_COMPLETE) {\n$this->closeOrderReference($order);\n}\n}\n+ /**\n+ * @param OrderInterface $order\n+ */\nprotected function closeOrderReference(OrderInterface $order)\n{\ntry {\n$amazonOrderReferenceId = $order->getExtensionAttributes()->getAmazonOrderReferenceId();\n- if ($amazonOrderReferenceId && Amazon::PAYMENT_METHOD_CODE == $order->getPayment()->getMethod()) {\n+ if ($amazonOrderReferenceId) {\n$this->orderInformationManagement->closeOrderReference($amazonOrderReferenceId, $order->getStoreId());\n}\n} catch (Exception $e) {\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
AMAZON-43: Updated code safety, do not operate or order when payment != amazon
21,238
30.05.2017 14:20:29
25,200
c3e29057ad4b52b1c85c8e795e3648766315c92d
Update installation.rst Fix typo.
[ { "change_type": "MODIFY", "old_path": "docs/installation.rst", "new_path": "docs/installation.rst", "diff": "@@ -8,7 +8,7 @@ Pre-installation steps\nInstallation process\n--------------------\nCurrently, the installation via the web setup wizard is the preferred way of installing the extension.\n-Please follow this guide_ to learm how this works.\n+Please follow this guide_ to learn how this works.\n.. _guide: http://docs.magento.com/marketplace/user_guide/quick-tour/install-extension.html\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Update installation.rst Fix typo.
21,238
15.06.2017 23:37:30
25,200
dacc43761cbdae3fca744ebd8d9122e6c39a1b8f
Modify Installation Section of docs
[ { "change_type": "MODIFY", "old_path": "docs/installation.rst", "new_path": "docs/installation.rst", "diff": "@@ -5,20 +5,24 @@ Pre-installation steps\n----------------------\n* Create a backup of your shop before proceeding to install.\n-Installation process\n---------------------\n-The installation via the web setup wizard is the preferred way of installing the extension.\n-Please follow this guide_ to learm how this works.\n+Web Setup Wizard / Magento Marketplace Install Method (Preferred)\n+-----------------------------------------------------------------\n+The installation via the Web Setup Wizard is the preferred method of installation.\n+Please follow the `Magento Marketplace User Guide`_ to learn how this works.\n-.. _guide: http://docs.magento.com/marketplace/user_guide/quick-tour/install-extension.html\n+Our extension can be found here: https://marketplace.magento.com/amzn-amazon-pay-and-login-magento-2-module.html\n+.. _`Magento Marketplace User Guide`: http://docs.magento.com/marketplace/user_guide/quick-tour/install-extension.html\n+\n+Manual Composer Install Method\n+------------------------------\nIn case you are not able or willing to use the web installation, you can install the extension using composer.\n-- Sign in to your server via ssh\n-- cd into you Magento instalation directory\n+- Sign in to your server via SSH\n+- `cd` into you Magento installation directory\n- Install the extension via composer: `composer require amzn/amazon-payments-magento-2-plugin:^1.1.0`\n- Enable the extension: `php bin/magento module:enable Amazon_Core Amazon_Login Amazon_Payment`\n- Upgrade the Magento instalation: `php bin/magento setup:upgrade`\n-- Follow any advice the upgrade routine will give\n+- Follow any advice the upgrade routine provides\n- Deploy static content: `php bin/magento setup:static-content:deploy xx_XX yy_YY` where xx_XX, yy_YY, ... are the locales you are aiming to support\n- Check permissions on directories and files and set them correctly if needed\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Modify Installation Section of docs
21,238
18.06.2017 15:57:10
25,200
694c74791809dd52fadab387a802747d6eae8083
Update overview.rst Updating getting the extension section.
[ { "change_type": "MODIFY", "old_path": "docs/overview.rst", "new_path": "docs/overview.rst", "diff": "@@ -20,6 +20,9 @@ Extension features\nGetting the extension\n---------------------\n-TBC\n+The extension can be installed using the following methods:\n+\n+* Preferred Method - From the Magento Marketplace using the Web Setup Wizard\n+* Manually using composer from the command line\nRefer to the :doc:`installation` section to get more details concerning installation procedure.\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Update overview.rst Updating getting the extension section.
21,238
19.06.2017 14:43:04
25,200
5018462f7c6ac7382027aec5cdc3fb0c16128464
Update conf.py updating version number
[ { "change_type": "MODIFY", "old_path": "docs/conf.py", "new_path": "docs/conf.py", "diff": "@@ -60,9 +60,9 @@ author = u'Amazon.com Inc or its affiliates'\n# built documents.\n#\n# The short X.Y version.\n-version = u'1.1.0'\n+version = u'1.1.1'\n# The full version, including alpha/beta/rc tags.\n-release = u'1.1.0'\n+release = u'1.1.1'\n# The language for content autogenerated by Sphinx. Refer to documentation\n# for a list of supported languages.\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Update conf.py updating version number
21,243
22.06.2017 11:12:14
-3,600
2080ec7c170598be319203d0d3889a605b72f81a
Changed the way how 'amazon_payment' is retreived to fix a bug where amazon widget would not be reloaded in case of auth is declined
[ { "change_type": "MODIFY", "old_path": "src/Payment/view/frontend/web/js/view/payment/list.js", "new_path": "src/Payment/view/frontend/web/js/view/payment/list.js", "diff": "@@ -125,12 +125,10 @@ define([\n* @private\n*/\n_reInitializeAmazonWalletWidget: function () {\n- var items = this.getRegion('payment-method-items');\n- _.find(items(), function (value) {\n- if (value.index === 'amazon_payment') {\n- value.renderPaymentWidget();\n+ var child = this.getChild('amazon_payment');\n+ if (child) {\n+ child.renderPaymentWidget();\n}\n- }, this);\n},\n/**\n* hides editable content and links to prevent unexptect behaviour\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
AMAZON-46: Changed the way how 'amazon_payment' is retreived to fix a bug where amazon widget would not be reloaded in case of auth is declined
21,238
28.06.2017 10:44:06
25,200
58fa9f89ad539d58036ee78fc7515b60d7a6536d
Update amazon-button.js Update comment for usePopUp logic to explain why we use the conditional check we do.
[ { "change_type": "MODIFY", "old_path": "src/Payment/view/frontend/web/js/amazon-button.js", "new_path": "src/Payment/view/frontend/web/js/amazon-button.js", "diff": "@@ -86,8 +86,15 @@ define([\n_touchSupported: function () {\nreturn Modernizr.touch !== undefined ? Modernizr.touch : Modernizr.touchevents;\n},\n+ /**\n+ * Should we use the pop up login flow?\n+ * - are we on an HTTPS page (required for popup)\n+ * - confirm we are not on the product detail page (items are added asynchronously to the cart, hence popups will be blocked)\n+ * - confirm we are not using a touch device (redirect provides a better mobile experience)\n+ * @returns {Boolean}\n+ * @public\n+ */\nusePopUp: function () {\n- //always use redirect journey on product page and touch devices\nreturn ((window.location.protocol === 'https:' && !$('body').hasClass('catalog-product-view')) && !_this._touchSupported());\n},\n/**\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
Update amazon-button.js Update comment for usePopUp logic to explain why we use the conditional check we do.
21,246
12.07.2017 07:44:58
25,200
175d11633af8f863f4d34075bf07f86bac49b45b
add SimplePath functionality
[ { "change_type": "ADD", "old_path": null, "new_path": "src/Core/Block/Adminhtml/System/Config/SimplePathAdmin.php", "diff": "+<?php\n+\n+namespace Amazon\\Core\\Block\\Adminhtml\\System\\Config;\n+\n+use Amazon\\Core\\Helper\\CategoryExclusion;\n+use Amazon\\Core\\Helper\\Data;\n+use Amazon\\Core\\Model\\Config\\SimplePath;\n+use Magento\\Customer\\Model\\Url;\n+use Magento\\Framework\\View\\Element\\Template;\n+use Magento\\Framework\\View\\Element\\Template\\Context;\n+\n+class SimplePathAdmin extends Template\n+{\n+ /**\n+ * @var \\Amazon\\Core\\Model\\Config\\simplePath\n+ */\n+ protected $_model;\n+\n+\n+ function __construct(\n+ Context $context,\n+ SimplePath $simplePath,\n+ \\Magento\\Framework\\UrlInterface $urlInterface\n+ )\n+ {\n+ parent::__construct($context);\n+ $this->simplePath = $simplePath;\n+ $this->urlInterface = $urlInterface;\n+ }\n+\n+ /**\n+ * Return SimplePath settings\n+ */\n+ function getAmazonSpJson()\n+ {\n+ return json_encode($this->simplePath->getJsonAmazonSpConfig());\n+ }\n+\n+ /**\n+ * Render only on Payment Methods page\n+ */\n+ protected function _toHtml()\n+ {\n+ return strpos($this->urlInterface->getCurrentUrl(), 'payment') === FALSE ? '' : parent::_toHtml();\n+ }\n+}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Core/Controller/Adminhtml/Simplepath/Poll.php", "diff": "+<?php\n+\n+namespace Amazon\\Core\\Controller\\Adminhtml\\Simplepath;\n+\n+use Magento\\Backend\\App\\Action\\Context;\n+use Magento\\Backend\\Controller\\Adminhtml\\System;\n+\n+class Poll extends System\n+{\n+\n+\n+ public function __construct(\n+ Context $context,\n+ \\Amazon\\Core\\Model\\Config\\SimplePath $simplePath,\n+ \\Magento\\Framework\\App\\Config\\ScopeConfigInterface $scopeConfig,\n+ \\Magento\\Framework\\Controller\\Result\\JsonFactory $jsonResultFactory\n+ )\n+ {\n+ parent::__construct($context);\n+ $this->simplePath = $simplePath;\n+ $this->scopeConfig = $scopeConfig;\n+ $this->jsonResultFactory = $jsonResultFactory;\n+\n+ }\n+\n+\n+ /**\n+ * Detect whether Amazon credentials are set (polled by Ajax)\n+ */\n+ public function execute()\n+ {\n+ // Keypair is destroyed when credentials are saved\n+ $shouldRefresh = !($this->scopeConfig->getValue(\\Amazon\\Core\\Model\\Config\\SimplePath::CONFIG_XML_PATH_PUBLIC_KEY, 'default', 0));\n+\n+ if ($shouldRefresh) {\n+ $this->simplePath->autoEnable();\n+ }\n+\n+ $result = $this->jsonResultFactory->create();\n+ $result->setData((int)$shouldRefresh);\n+ return $result;\n+ }\n+}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Core/Controller/Simplepath/Listener.php", "diff": "+<?php\n+\n+namespace Amazon\\Core\\Controller\\Simplepath;\n+\n+class Listener extends \\Magento\\Framework\\App\\Action\\Action\n+{\n+\n+ // @var \\Magento\\Framework\\Controller\\Result\\JsonFactory\n+ protected $jsonResultFactory;\n+\n+ // @var \\Amazon\\Core\\Model\\Config\\SimplePath\n+ protected $simplepath;\n+\n+\n+ public function __construct(\n+ \\Magento\\Framework\\App\\Action\\Context $context,\n+ \\Magento\\Framework\\Controller\\Result\\JsonFactory $jsonResultFactory,\n+ \\Amazon\\Core\\Model\\Config\\SimplePath $simplepath,\n+ \\Magento\\Framework\\App\\Config\\ScopeConfigInterface $scopeConfig\n+\n+ ) {\n+ $this->simplepath = $simplepath;\n+ $this->jsonResultFactory = $jsonResultFactory;\n+ $this->scopeConfig = $scopeConfig;\n+ parent::__construct($context);\n+ }\n+\n+\n+ /**\n+ * Parse POST request from Amazon and import keys\n+ */\n+ public function execute()\n+ {\n+\n+ $url = parse_url(\\Amazon\\Core\\Model\\Config\\SimplePath::API_ENDPOINT_DOWNLOAD_KEYS);\n+\n+ header('Access-Control-Allow-Origin: https://' . $url['host']);\n+ header('Access-Control-Allow-Methods: GET, POST');\n+ header('Access-Control-Allow-Headers: Content-Type');\n+\n+ $payload = $this->_request->getParam('payload');\n+\n+ $result = $this->jsonResultFactory->create();\n+\n+ $return = array('result' => 'error', 'message' => 'Empty response.');\n+\n+ try {\n+ if ($payload && strpos($payload, 'encryptedKey') !== FALSE) {\n+\n+ $json = $this->simplepath->decryptPayload($payload, false);\n+\n+ if ($json) {\n+ $return = array('result' => 'success');\n+ }\n+ } else {\n+ $result->setHttpResponseCode(\\Magento\\Framework\\Webapi\\Exception::HTTP_BAD_REQUEST);\n+ $return = array('result' => 'error', 'message' => 'payload parameter not found.');\n+ }\n+\n+ } catch (Exception $e) {\n+ $result->setHttpResponseCode(\\Magento\\Framework\\Webapi\\Exception::HTTP_BAD_REQUEST);\n+ $return = array('result' => 'error', 'message' => $e->getMessage());\n+ }\n+\n+ $result->setData($return);\n+\n+ return $result;\n+ }\n+\n+\n+ /**\n+ * Overridden to allow POST without form key\n+ *\n+ * @return bool\n+ */\n+ public function _processUrlKeys()\n+ {\n+ $_isValidFormKey = true;\n+ $_isValidSecretKey = true;\n+ $_keyErrorMsg = '';\n+ if ($this->_auth->isLoggedIn()) {\n+ if ($this->_backendUrl->useSecretKey()) {\n+ $_isValidSecretKey = $this->_validateSecretKey();\n+ $_keyErrorMsg = __('You entered an invalid Secret Key. Please refresh the page.');\n+ }\n+ }\n+ if (!$_isValidFormKey || !$_isValidSecretKey) {\n+ $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true);\n+ $this->_actionFlag->set('', self::FLAG_NO_POST_DISPATCH, true);\n+ if ($this->getRequest()->getQuery('isAjax', false) || $this->getRequest()->getQuery('ajax', false)) {\n+ $this->getResponse()->representJson(\n+ $this->_objectManager->get(\n+ 'Magento\\Framework\\Json\\Helper\\Data'\n+ )->jsonEncode(\n+ ['error' => true, 'message' => $_keyErrorMsg]\n+ )\n+ );\n+ } else {\n+ $this->_redirect($this->_backendUrl->getStartupPageUrl());\n+ }\n+ return false;\n+ }\n+ return true;\n+ }\n+\n+}\n" }, { "change_type": "MODIFY", "old_path": "src/Core/Model/Config/Credentials/Json.php", "new_path": "src/Core/Model/Config/Credentials/Json.php", "diff": "@@ -17,6 +17,7 @@ namespace Amazon\\Core\\Model\\Config\\Credentials;\nuse Amazon\\Core\\Helper\\Data;\nuse Amazon\\Core\\Model\\Validation\\JsonConfigDataValidatorFactory;\n+use Amazon\\Core\\Model\\Config\\SimplePath;\nuse Magento\\Config\\Model\\ResourceModel\\Config as ConfigWriter;\nuse Magento\\Framework\\Encryption\\EncryptorInterface;\nuse Magento\\Framework\\Json\\DecoderInterface;\n@@ -57,6 +58,11 @@ class Json\n*/\nprotected $encryptor;\n+ /**\n+ * @var SimplePath\n+ */\n+ protected $simplePath;\n+\n/**\n* @param Data $amazonCoreHelper\n* @param JsonConfigDataValidatorFactory $jsonConfigDataValidator\n@@ -71,7 +77,8 @@ class Json\nConfigWriter $configWriter,\nMessageManager $messageManager,\nDecoderInterface $jsonDecoder,\n- EncryptorInterface $encryptor\n+ EncryptorInterface $encryptor,\n+ SimplePath $simplePath\n) {\n$this->amazonCoreHelper = $amazonCoreHelper;\n$this->jsonConfigDataValidatorFactory = $jsonConfigDataValidator;\n@@ -79,6 +86,7 @@ class Json\n$this->messageManager = $messageManager;\n$this->jsonDecoder = $jsonDecoder;\n$this->encryptor = $encryptor;\n+ $this->simplePath = $simplePath;\n}\n/**\n@@ -103,6 +111,11 @@ class Json\n$arrayCredentials = $this->jsonDecoder->decode($jsonCredentials);\n$this->wipeJsonCredentialsConfig($scopeData);\n+ // Decrypt SimplePath JSON\n+ if (isset($arrayCredentials['encryptedKey'])) {\n+ $arrayCredentials = $this->jsonDecoder->decode($this->simplePath->decryptPayload(json_encode($arrayCredentials), false, false));\n+ }\n+\nforeach ($this->amazonCoreHelper->getAmazonCredentialsFields() as $mandatoryField) {\n$valueToSave = $arrayCredentials[$mandatoryField];\n$encryptedFields = array_flip($this->amazonCoreHelper->getAmazonCredentialsEncryptedFields());\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Core/Model/Config/SimplePath.php", "diff": "+<?php\n+\n+namespace Amazon\\Core\\Model\\Config;\n+\n+use Amazon\\Core\\Helper\\Data;\n+use Magento\\Framework\\App\\State;\n+use Magento\\Framework\\App\\Cache\\Type\\Config as CacheTypeConfig;\n+use Magento\\Store\\Model\\ScopeInterface;\n+use Magento\\Backend\\Model\\UrlInterface;\n+\n+class SimplePath\n+{\n+ const API_ENDPOINT_DOWNLOAD_KEYS = 'https://payments.amazon.com/register';\n+ const API_ENDPOINT_GET_PUBLICKEY = 'https://payments.amazon.com/register/getpublickey';\n+\n+ const PARAM_SP_ID = 'A2K7HE1S3M5XJ';\n+\n+ const CONFIG_XML_PATH_PRIVATE_KEY = 'payment/amazon_payments/simplepath/privatekey';\n+ const CONFIG_XML_PATH_PUBLIC_KEY = 'payment/amazon_payments/simplepath/publickey';\n+\n+ /**\n+ * @var \\Magento\\Backend\\Model\\UrlInterface\n+ */\n+ protected $backendUrl;\n+\n+ /**\n+ * SimplePath constructor.\n+ *\n+ * @param ScopeConfigInterface $config\n+ * @param Data $coreHelper\n+ * @param State $state\n+ */\n+ //public function __construct(ScopeConfigInterface $config, Data $coreHelper, State $state, UrlInterface $backendUrl)\n+\n+ public function __construct(\n+ \\Magento\\Framework\\App\\Config\\ConfigResource\\ConfigInterface $config,\n+ \\Magento\\Framework\\App\\Config\\ScopeConfigInterface $scopeConfig,\n+ \\Magento\\Framework\\Encryption\\EncryptorInterface $encryptor,\n+ \\Magento\\Store\\Model\\StoreManagerInterface $storeManager,\n+ \\Magento\\Backend\\Model\\UrlInterface $backendUrl,\n+ \\phpseclib\\Crypt\\RSA $rsa,\n+ \\phpseclib\\Crypt\\AES $aes,\n+ \\Magento\\Framework\\App\\Cache\\Manager $cacheManager,\n+ \\Magento\\Framework\\App\\Request\\Http $request,\n+ \\Magento\\Framework\\App\\ResourceConnection $connection,\n+ \\Magento\\Framework\\Module\\ModuleListInterface $moduleList,\n+ \\Magento\\Framework\\App\\ProductMetadataInterface $productMeta,\n+ \\Magento\\Framework\\Message\\ManagerInterface $messageManager,\n+ \\Psr\\Log\\LoggerInterface $logger\n+ )\n+ {\n+\n+ $this->config = $config;\n+ $this->scopeConfig = $scopeConfig;\n+ $this->encryptor = $encryptor;\n+ $this->storeManager = $storeManager;\n+ $this->backendUrl = $backendUrl;\n+ $this->rsa = $rsa;\n+ $this->aes = $aes;\n+ $this->cacheManager = $cacheManager;\n+ $this->request = $request;\n+ $this->connection = $connection;\n+ $this->moduleList = $moduleList;\n+ $this->productMeta = $productMeta;\n+ $this->logger = $logger;\n+\n+ $this->messageManager = $messageManager;\n+ }\n+\n+ /**\n+ * Generate and save RSA keys\n+ */\n+ public function generateKeys()\n+ {\n+ //$keys = $rsa->generateKeys(array('private_key_bits' => 2048, 'privateKeyBits' => 2048, 'hashAlgorithm' => 'sha1'));\n+\n+ $keys = $this->rsa->createKey(2048);\n+\n+ $this->config\n+ ->saveConfig(self::CONFIG_XML_PATH_PUBLIC_KEY, $keys['publickey'], 'default', 0)\n+ ->saveConfig(self::CONFIG_XML_PATH_PRIVATE_KEY, $this->encryptor->encrypt($keys['privatekey']), 'default', 0);\n+\n+ $this->cacheManager->clean([CacheTypeConfig::TYPE_IDENTIFIER]);\n+\n+ return $keys;\n+ }\n+\n+ /**\n+ * Delete key-pair from config\n+ */\n+ public function destroyKeys()\n+ {\n+ $this->config\n+ ->deleteConfig(self::CONFIG_XML_PATH_PUBLIC_KEY, 'default', 0)\n+ ->deleteConfig(self::CONFIG_XML_PATH_PRIVATE_KEY, 'default', 0);\n+\n+ $this->cacheManager->clean([CacheTypeConfig::TYPE_IDENTIFIER]);\n+ }\n+\n+ /**\n+ * Return RSA public key\n+ *\n+ * @param bool $pemformat Return key in PEM format\n+ */\n+ public function getPublicKey($pemformat = false, $reset = false)\n+ {\n+ $publickey = $this->scopeConfig->getValue(self::CONFIG_XML_PATH_PUBLIC_KEY, 'default', 0);\n+\n+ // Generate key pair\n+ if (!$publickey || $reset || strlen($publickey) < 300) {\n+ $keys = $this->generateKeys();\n+ $publickey = $keys['publickey'];\n+ }\n+\n+ if (!$pemformat) {\n+ $publickey = str_replace(array('-----BEGIN PUBLIC KEY-----', '-----END PUBLIC KEY-----', \"\\n\"), array('','',''), $publickey);\n+ // Remove binary characters\n+ $publickey = preg_replace('/[\\x00-\\x1F\\x80-\\xFF]/', '', $publickey);\n+ }\n+ return $publickey;\n+ }\n+\n+ /**\n+ * Return RSA private key\n+ */\n+ public function getPrivateKey()\n+ {\n+ return $this->encryptor->decrypt($this->scopeConfig->getValue(self::CONFIG_XML_PATH_PRIVATE_KEY, 'default', 0));\n+ }\n+\n+ /**\n+ * Convert key to PEM format for openssl functions\n+ */\n+ public function key2pem($key)\n+ {\n+ return \"-----BEGIN PUBLIC KEY-----\\n\" .\n+ chunk_split($key, 64, \"\\n\") .\n+ \"-----END PUBLIC KEY-----\\n\";\n+ }\n+\n+ /**\n+ * Verify and decrypt JSON payload\n+ *\n+ * @param string $payloadJson\n+ */\n+ public function decryptPayload($payloadJson, $autoEnable = true, $autoSave = true)\n+ {\n+ try {\n+ $payload = (object) json_decode($payloadJson);\n+ $payloadVerify = clone $payload;\n+\n+ // Unencrypted?\n+ if (!isset($payload->encryptedKey) && isset($payload->merchant_id, $payload->access_key, $payload->secret_key)) {\n+ return $this->saveToConfig($payloadJson, $autoEnable);\n+ }\n+\n+ // Validate JSON\n+ if (!isset($payload->encryptedKey, $payload->encryptedPayload, $payload->iv, $payload->sigKeyID, $payload->signature)) {\n+ throw new \\Magento\\Framework\\Validator\\Exception(__(\"Unable to import Amazon keys. Please verify your JSON format and values.\"));\n+ }\n+\n+ // URL decode values\n+ foreach ($payload as $key => $value) {\n+ $payload->$key = urldecode($value);\n+ }\n+\n+ // Retrieve Amazon public key to verify signature\n+ try {\n+ $client = new \\Zend_Http_Client(self::API_ENDPOINT_GET_PUBLICKEY, array(\n+ 'maxredirects' => 2,\n+ 'timeout' => 30));\n+\n+ $client->setParameterGet(array('sigkey_id' => $payload->sigKeyID));\n+\n+ $response = $client->request();\n+ $amazonPublickey = urldecode($response->getBody());\n+\n+ } catch (Exception $e) {\n+ throw new \\Magento\\Framework\\Validator\\Exception(__($e->getMessage()));\n+ }\n+\n+ // Use raw JSON (without signature or URL decode) as the data to verify signature\n+ unset($payloadVerify->signature);\n+ $payloadVerifyJson = json_encode($payloadVerify);\n+\n+ // Verify signature using Amazon publickey and JSON paylaod\n+ if ($amazonPublickey && openssl_verify($payloadVerifyJson, base64_decode($payload->signature), $this->key2pem($amazonPublickey), 'SHA256')) {\n+\n+ // Decrypt Amazon key using own private key\n+ $decryptedKey = null;\n+ openssl_private_decrypt(base64_decode($payload->encryptedKey), $decryptedKey, $this->getPrivateKey(), OPENSSL_PKCS1_OAEP_PADDING);\n+\n+ // Decrypt final payload (AES 128-bit CBC)\n+ if (function_exists('mcrypt_decrypt')) {\n+ $finalPayload = @mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $decryptedKey, base64_decode($payload->encryptedPayload), MCRYPT_MODE_CBC, base64_decode($payload->iv));\n+ } else {\n+ // This uses openssl_decrypt, which may have issues\n+ $this->aes->setKey($decryptedKey);\n+ $this->aes->setIV(base64_decode($payload->iv, true));\n+ $this->aes->setKeyLength(128);\n+ $finalPayload = $this->aes->decrypt($payload->encryptedPayload);\n+ }\n+\n+ // Remove binary characters\n+ $finalPayload = preg_replace('/[\\x00-\\x1F\\x80-\\xFF]/', '', $finalPayload);\n+\n+ if (json_decode($finalPayload)) {\n+ if ($autoSave) {\n+ $this->saveToConfig($finalPayload, $autoEnable);\n+ $this->destroyKeys();\n+ }\n+\n+ return $finalPayload;\n+ }\n+\n+ } else {\n+ throw new \\Magento\\Framework\\Validator\\Exception(\"Unable to verify signature for JSON payload.\");\n+ }\n+\n+ } catch (Exception $e) {\n+ $this->logger->critical($e);\n+ $this->messageManager->addError(__($e->getMessage()));\n+\n+ $link = 'https://payments.amazon.com/help/202024240';\n+ $this->messageManager->addError(__(\"If you're experiencing consistent errors with transferring keys, click <a href=\\\"%s\\\" target=\\\"_blank\\\">Manual Transfer Instructions</a> to learn more.\", $link));\n+ }\n+\n+ return false;\n+ }\n+\n+ /**\n+ * Save values to Mage config\n+ *\n+ * @param string $json\n+ */\n+ public function saveToConfig($json, $autoEnable = true)\n+ {\n+ if ($values = (object) json_decode($json)) {\n+ foreach ($values as $key => $value) {\n+ $values->{strtolower($key)} = $value;\n+ }\n+\n+ $this->config->saveConfig('payment/amazon_payment/merchant_id', $values->merchant_id, 'default', 0);\n+ $this->config->saveConfig('payment/amazon_payment/client_id', $values->client_id, 'default', 0);\n+ $this->config->saveConfig('payment/amazon_payment/client_secret', $this->encryptor->encrypt($values->client_secret), 'default', 0);\n+ $this->config->saveConfig('payment/amazon_payment/access_key', $values->access_key, 'default', 0);\n+ $this->config->saveConfig('payment/amazon_payment/secret_key', $this->encryptor->encrypt($values->secret_key), 'default', 0);\n+\n+ if ($autoEnable) {\n+ $this->autoEnable();\n+ }\n+\n+ $this->cacheManager->clean([CacheTypeConfig::TYPE_IDENTIFIER]);\n+\n+ return true;\n+ }\n+ }\n+\n+ /**\n+ * Auto-enable payment method\n+ */\n+ public function autoEnable()\n+ {\n+ if (!$this->scopeConfig->getValue('payment/amazon_payment/pwa_enabled')) {\n+ $this->config->saveConfig('payment/amazon_payment/pwa_enabled', true, 'default', 0);\n+ $this->messageManager->addSuccess(__(\"Login and Pay with Amazon is now enabled.\"));\n+ }\n+ }\n+\n+ /**\n+ * Return listener URL\n+ */\n+ public function getReturnUrl()\n+ {\n+ /*\n+ //$url = $this->_backendUrl->getUrl('amazon_payments/simplepath', array('_store' => Mage::helper('amazon_payments')->getAdminStoreId(), '_forced_secure' => true));\n+ $url = $this->_backendUrl->getUrl('amazon_payments/simplepath');\n+ // $this->_storeManager->getStore()->getBaseUrl()\n+ // Add index.php\n+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB, true);\n+ return str_replace($baseUrl, $baseUrl . 'index.php/', $url);\n+ */\n+\n+ $baseUrl = $this->storeManager->getStore()->getBaseUrl(UrlInterface::URL_TYPE_WEB, true);\n+ $baseUrl = str_replace('http:', 'https:', $baseUrl);\n+ return $baseUrl . 'amazon_core/simplepath/listener';\n+\n+ //return $this->storeManager->getStore()->getUrl('amazon_core/simplepath/listener', array('_secure' => true, '_forced_secure' => true));\n+ }\n+\n+ /**\n+ * Return simplepath URL\n+ */\n+ public function getSimplepathUrl()\n+ {\n+ return self::API_ENDPOINT_DOWNLOAD_KEYS . '?returnUrl=' . urlencode($this->getReturnUrl()) .\n+ '&pub_key=' . urlencode($this->getPublicKey()) .\n+ '#event/fromSP';\n+ }\n+\n+ /**\n+ * Return array of form POST params for SimplePath sign up\n+ */\n+ public function getFormParams()\n+ {\n+ // Retrieve store URLs from config table\n+ $urls = array();\n+ $db = $this->connection->getConnection();\n+ $select = $db->select()\n+ ->from(\n+ ['c' => 'core_config_data']\n+ )\n+ ->where('c.path IN (?)', array('web/unsecure/base_url', 'web/secure/base_url'));\n+\n+ foreach ($db->fetchAll($select) as $row) {\n+ $url = parse_url($row['value']);\n+\n+ if (isset($url['host'])){\n+ $urls[] = 'https://' . $url['host'];\n+ }\n+ }\n+\n+ $urls = array_unique($urls);\n+\n+\n+ $version = $this->moduleList->getOne('Amazon_Core');\n+ $coreVersion = ($version && isset($version['setup_version'])) ? $version['setup_version'] : '--';\n+\n+ return array(\n+ 'locale' => $this->scopeConfig->getValue('general/country/default'),\n+ 'spId' => self::PARAM_SP_ID,\n+ 'allowedLoginDomains[]' => $urls,\n+ 'spSoftwareVersion' => $coreVersion,\n+ 'spAmazonPluginVersion' => $this->productMeta->getVersion(),\n+ );\n+ }\n+\n+ /**\n+ * Return array of config for JSON AmazonSp variable.\n+ */\n+ public function getJsonAmazonSpConfig()\n+ {\n+ return array(\n+ 'amazonUrl' => $this->getSimplepathUrl(),\n+ 'pollUrl' => $this->backendUrl->getUrl('amazonsp/simplepath/poll'),\n+ 'spUrl' => $this->backendUrl->getUrl('amazonsp/simplepath/spurl'),\n+ 'importUrl' => $this->backendUrl->getUrl('amazonsp/simplepath/import'),\n+ 'isSecure' => (int) ($this->request->isSecure()),\n+ 'region' => (int) $this->scopeConfig->getValue('general/country/default'),\n+ //'isUsa' => (int) (Mage::helper('amazon_payments')->getAdminConfig() == 'US' && Mage::helper('amazon_payments')->getAdminRegion() != 'eu'),\n+ 'hasOpenssl' => (int) (extension_loaded('openssl')),\n+ 'formParams' => $this->getFormParams(),\n+ );\n+ }\n+}\n" }, { "change_type": "MODIFY", "old_path": "src/Core/Model/Validation/JsonConfigDataValidator.php", "new_path": "src/Core/Model/Validation/JsonConfigDataValidator.php", "diff": "@@ -66,6 +66,11 @@ class JsonConfigDataValidator extends AbstractValidator\nprotected function mandatoryFieldsExist($decodedCredentials)\n{\n+ // SimplePath\n+ if (isset($decodedCredentials['encryptedKey'])) {\n+ return true;\n+ }\n+\nforeach ($this->amazonCoreHelper->getAmazonCredentialsFields() as $mandatoryField) {\nif (!isset($decodedCredentials[$mandatoryField])) {\nreturn false;\n" }, { "change_type": "MODIFY", "old_path": "src/Core/etc/adminhtml/routes.xml", "new_path": "src/Core/etc/adminhtml/routes.xml", "diff": "<route id=\"amazonlogs\" frontName=\"amazonlogs\">\n<module name=\"Amazon_Core\" />\n</route>\n+ <route id=\"amazonsp\" frontName=\"amazonsp\">\n+ <module name=\"Amazon_Core\" />\n+ </route>\n</router>\n</config>\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "src/Core/etc/adminhtml/system.xml", "new_path": "src/Core/etc/adminhtml/system.xml", "diff": "<section id=\"payment\">\n<group id=\"amazon_payment\" translate=\"label\" type=\"text\" sortOrder=\"8\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n<label>Amazon Pay</label>\n+ <comment><![CDATA[\n+\n+ <div id=\"amazon_simplepath\">\n+ <span style=\"display:inline-block;padding-bottom:1em;\">\n+ <button><span>Get started with account registration</span></button>\n+ &nbsp; &nbsp;\n+ <button><span>My account is ready, I need to connect it to Magento</span></button>\n+ </span>\n+ <span style=\"display:inline-block;\">\n+ &nbsp; or &nbsp;\n+ <a href=\"#\" id=\"simplepath-skip\">I've already setup Pay with Amazon, I want to edit my settings</a>\n+ </span>\n+\n+ <p style=\"color:red;display:none\" id=\"amazon_https_required\">In order to enable automatic account configuration using Amazon's secure key exchange, please turn on secure admin pages in System > Configuration > Web > Use secure URLs in Admin.</p>\n+ <p style=\"color:red;display:none\" id=\"amazon_openssl_required\">In order to set keys, the OpenSSL PHP library is required.</p>\n+ <p style=\"color:red;display:none\" id=\"amazon_reload\">Updating your config with new keys, please wait...</p>\n+\n+ </div>\n+\n+ <div id=\"amazon_simplepath_back\" style=\"display:none;margin-bottom:1em;margin-top:-0.5em;\">\n+ <a href=\"#\">&laquo; Back</a>\n+ </div>\n+\n+ ]]></comment>\n<field id=\"version\" type=\"text\" translate=\"label comment\" sortOrder=\"10\" showInDefault=\"1\" showInWebsite=\"1\" showInStore=\"1\">\n<frontend_model>Amazon\\Core\\Block\\Adminhtml\\System\\Config\\Form\\Version</frontend_model>\n</field>\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Core/etc/frontend/routes.xml", "diff": "+<?xml version=\"1.0\"?>\n+<config xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework:App/etc/routes.xsd\">\n+ <router id=\"standard\">\n+ <route id=\"amazon_core\" frontName=\"amazon_core\">\n+ <module name=\"Amazon_Core\" />\n+ </route>\n+ </router>\n+</config>\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Core/view/adminhtml/layout/adminhtml_system_config_edit.xml", "diff": "+<page xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" layout=\"admin-2columns-left\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework:View/Layout/etc/page_configuration.xsd\">\n+ <body>\n+ <referenceContainer name=\"js\">\n+ <block class=\"Amazon\\Core\\Block\\Adminhtml\\System\\Config\\SimplePathAdmin\" template=\"Amazon_Core::system/config/simplepath_admin.phtml\" cacheable=\"false\" />\n+ </referenceContainer>\n+ </body>\n+</page>\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Core/view/adminhtml/templates/system/config/simplepath_admin.phtml", "diff": "+<script>\n+\n+var AmazonSp = <?php echo $this->getAmazonSpJson(); ?>;\n+\n+require([\"prototype\"], function(){\n+\n+ var amazonPollInterval = 1500; // poll every ms for keys\n+ var amazonPollTimer = null;\n+\n+\n+ var amazonSimplepath = $(\"amazon_simplepath\");\n+ var amazonFields = $$(\"#payment_us_amazon_payment .form-list\");\n+ var amazonSpBack = $(\"amazon_simplepath_back\");\n+\n+\n+ if ($(\"payment_us_amazon_payment_general_credentials_merchant_id\") != null) {\n+ if (!$(\"payment_us_amazon_payment_general_credentials_merchant_id\").value) {\n+ amazonFields.each(Element.hide);\n+ } else {\n+ amazonSpBack.show();\n+ amazonSimplepath.hide();\n+\n+ if (window.location.hash == \"#payment_amazon_payments-head\") {\n+ showAmazonConfig();\n+ }\n+ }\n+ }\n+\n+ // Generate form to post to Amazon\n+ var form = new Element('form', { method: 'post', action: AmazonSp.amazonUrl, id: 'simplepath_form', target: 'simplepath'});\n+ //$$('body')[0].insert(form);\n+ amazonSimplepath.wrap(form);\n+\n+ // Convert formParams JSON to hidden inputs\n+ var formInput;\n+ for (var key in AmazonSp.formParams) {\n+ if (typeof AmazonSp.formParams[key] == 'object' || typeof AmazonSp.formParams[key] == 'array') {\n+ for (var i in AmazonSp.formParams[key]) {\n+ if (typeof AmazonSp.formParams[key][i] != \"function\") {\n+ form.insert(new Element('input', { type: 'hidden', name: key, value: AmazonSp.formParams[key][i]}));\n+ }\n+ }\n+ } else {\n+ form.insert(new Element('input', { type: 'hidden', name: key, value: AmazonSp.formParams[key]}));\n+ }\n+ }\n+\n+ // Get Started clicked\n+ $(\"simplepath_form\").observe(\"submit\", function(e) {\n+ var heights = [660, 720, 810, 900];\n+ var popupHeight = heights[0];\n+ for (var i in heights) {\n+ popupHeight = (window.innerHeight >= heights[i]) ? heights[i] : popupHeight;\n+ }\n+\n+ window.launchPopup('', 768, popupHeight);\n+\n+ //amazonFields[1].show();\n+ amazonFields.each(Element.show);\n+\n+ if (!amazonPollTimer) {\n+ amazonPollTimer = setTimeout(pollForKeys, amazonPollInterval);\n+ }\n+ });\n+\n+ // User is skipping simplepath\n+ amazonSimplepath.select(\"a\")[0].observe(\"click\", function(e) {\n+ e.stop();\n+ amazonSpBack.show();\n+ showAmazonConfig();\n+ });\n+\n+ // User clicked 'Back'\n+ $(\"amazon_simplepath_back\").select(\"a\")[0].observe(\"click\", function(e) {\n+ e.stop();\n+ amazonSpBack.hide();\n+ amazonSimplepath.show();\n+ });\n+\n+\n+ function showAmazonConfig() {\n+ amazonFields.each(Element.show);\n+ amazonSimplepath.hide();\n+ amazonSpBack.show();\n+\n+ if (!$('payment_us_amazon_payment_general-head').hasClassName('open')) {\n+ $('payment_us_amazon_payment_general-head').click();\n+ $('payment_us_amazon_payment_general_credentials-head').click();\n+ $('payment_us_amazon_payment_general_options-head').click();\n+ }\n+ }\n+\n+\n+ function pollForKeys() {\n+ new Ajax.Request(AmazonSp.pollUrl, {\n+ method:'get',\n+ onSuccess: function(transport) {\n+ if (transport.responseText == '1') {\n+ $(\"amazon_reload\").show();\n+ document.location.replace(document.location + \"#payment_amazon_payments-head\");\n+ location.reload();\n+ } else {\n+ amazonPollTimer = setTimeout(pollForKeys, amazonPollInterval);\n+ }\n+\n+ },\n+ onFailure: function() { },\n+ // Disable \"Please Wait\" modal\n+ onCreate: function(request) {\n+ Ajax.Responders.unregister(varienLoaderHandler.handler);\n+ },\n+ });\n+ }\n+\n+\n+});\n+\n+// Add Mage validator to fix \"Save Config\" button from not submitting\n+require([\"jquery\", \"jquery/validate\"], function($) {\n+ $(\"#simplepath_form\").validate();\n+});\n+\n+\n+</script>\n+\n+\n+<script>\n+// Amazon Pop-up\n+(function () {\n+ 'use strict';\n+\n+ function launchPopup(url, requestedWidth, requestedHeight) {\n+ var leftOffset = getLeftOffset(requestedWidth),\n+ topOffset = getTopOffset(requestedHeight),\n+ newWindow = window.open(url, 'simplepath', 'scrollbars=yes, width=' + requestedWidth + ', height=' + requestedHeight + ', top=' + topOffset + ', left=' + leftOffset);\n+\n+ if (window.focus) {\n+ newWindow.focus();\n+ }\n+ }\n+\n+ function getLeftOffset(requestedWidth) {\n+ var dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : screen.left;\n+\n+ return ((windowWidth() / 2) - (requestedWidth / 2)) + dualScreenLeft;\n+ }\n+\n+ function getTopOffset(requestedHeight) {\n+ var dualScreenTop = window.screenTop !== undefined ? window.screenTop : screen.top;\n+\n+ return ((windowHeight() / 2) - (requestedHeight / 2)) + dualScreenTop;\n+ }\n+\n+ function windowWidth() {\n+ if (window.innerWidth) {\n+ return window.innerWidth;\n+ } else if (document.documentElement.clientWidth) {\n+ return document.documentElement.clientWidth;\n+ } else {\n+ return screen.width;\n+ }\n+ }\n+\n+ function windowHeight() {\n+ if (window.innerHeight) {\n+ return window.innerHeight;\n+ } else if (document.documentElement.clientHeight) {\n+ return document.documentElement.clientHeight;\n+ } else {\n+ return screen.height;\n+ }\n+ }\n+\n+ window.launchPopup = launchPopup;\n+})();\n+</script>\n\\ No newline at end of file\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
add SimplePath functionality
21,246
14.07.2017 14:30:41
25,200
696186ce12a4cbfac06c4c73d17ab0db9e7c552b
add EU endpoint and fix config scope
[ { "change_type": "MODIFY", "old_path": "src/Core/Controller/Simplepath/Listener.php", "new_path": "src/Core/Controller/Simplepath/Listener.php", "diff": "@@ -32,20 +32,22 @@ class Listener extends \\Magento\\Framework\\App\\Action\\Action\npublic function execute()\n{\n- $url = parse_url(\\Amazon\\Core\\Model\\Config\\SimplePath::API_ENDPOINT_DOWNLOAD_KEYS);\n+ $url = parse_url($this->simplepath->getEndpointRegister());\nheader('Access-Control-Allow-Origin: https://' . $url['host']);\n- header('Access-Control-Allow-Methods: GET, POST');\n- header('Access-Control-Allow-Headers: Content-Type');\n+ header('Access-Control-Allow-Methods: GET, POST, OPTIONS');\n+ header('Access-Control-Allow-Headers: Content-Type, X-CSRF-Token');\n$payload = $this->_request->getParam('payload');\n$result = $this->jsonResultFactory->create();\n- $return = array('result' => 'error', 'message' => 'Empty response.');\n+ $return = array('result' => 'error', 'message' => 'Empty payload');\ntry {\n- if ($payload && strpos($payload, 'encryptedKey') !== FALSE) {\n+ if (strpos($payload, 'encryptedKey') === FALSE) {\n+ $return = array('result' => 'error', 'message' => 'Invalid payload: ' . $payload);\n+ } else if ($payload) {\n$json = $this->simplepath->decryptPayload($payload, false);\n@@ -53,15 +55,17 @@ class Listener extends \\Magento\\Framework\\App\\Action\\Action\n$return = array('result' => 'success');\n}\n} else {\n- $result->setHttpResponseCode(\\Magento\\Framework\\Webapi\\Exception::HTTP_BAD_REQUEST);\n$return = array('result' => 'error', 'message' => 'payload parameter not found.');\n}\n} catch (Exception $e) {\n- $result->setHttpResponseCode(\\Magento\\Framework\\Webapi\\Exception::HTTP_BAD_REQUEST);\n$return = array('result' => 'error', 'message' => $e->getMessage());\n}\n+ if ($this->_request->isPost() && (empty($return['result']) || $return['result'] == 'error')) {\n+ $result->setHttpResponseCode(\\Magento\\Framework\\Webapi\\Exception::HTTP_BAD_REQUEST);\n+ }\n+\n$result->setData($return);\nreturn $result;\n" }, { "change_type": "MODIFY", "old_path": "src/Core/Model/Config/SimplePath.php", "new_path": "src/Core/Model/Config/SimplePath.php", "diff": "@@ -5,66 +5,136 @@ namespace Amazon\\Core\\Model\\Config;\nuse Amazon\\Core\\Helper\\Data;\nuse Magento\\Framework\\App\\State;\nuse Magento\\Framework\\App\\Cache\\Type\\Config as CacheTypeConfig;\n-use Magento\\Store\\Model\\ScopeInterface;\nuse Magento\\Backend\\Model\\UrlInterface;\n+use Magento\\Payment\\Helper\\Formatter;\nclass SimplePath\n{\n- const API_ENDPOINT_DOWNLOAD_KEYS = 'https://payments.amazon.com/register';\n- const API_ENDPOINT_GET_PUBLICKEY = 'https://payments.amazon.com/register/getpublickey';\n-\n- const PARAM_SP_ID = 'A2K7HE1S3M5XJ';\nconst CONFIG_XML_PATH_PRIVATE_KEY = 'payment/amazon_payments/simplepath/privatekey';\nconst CONFIG_XML_PATH_PUBLIC_KEY = 'payment/amazon_payments/simplepath/publickey';\n- /**\n- * @var \\Magento\\Backend\\Model\\UrlInterface\n- */\n- protected $backendUrl;\n+ protected $_spIds = [\n+ 'USD' => 'AUGT0HMCLQVX1',\n+ 'GBP' => 'A1BJXVS5F6XP',\n+ 'EUR' => 'A2ZAYEJU54T1BM',\n+ 'JPY' => 'A1MCJZEB1HY93J',\n+ ];\n+\n+ protected $_mapCurrencyRegion = [\n+ 'EUR' => 'de',\n+ 'USD' => 'us',\n+ 'GBP' => 'uk',\n+ 'JPY' => 'ja',\n+ ];\n+\n+ protected $_storeId;\n+ protected $_websiteId;\n+ protected $_scope;\n+ protected $_scopeId;\n/**\n* SimplePath constructor.\n- *\n- * @param ScopeConfigInterface $config\n- * @param Data $coreHelper\n- * @param State $state\n*/\n- //public function __construct(ScopeConfigInterface $config, Data $coreHelper, State $state, UrlInterface $backendUrl)\n-\npublic function __construct(\n\\Magento\\Framework\\App\\Config\\ConfigResource\\ConfigInterface $config,\n\\Magento\\Framework\\App\\Config\\ScopeConfigInterface $scopeConfig,\n+ \\Magento\\Framework\\App\\ProductMetadataInterface $productMeta,\n\\Magento\\Framework\\Encryption\\EncryptorInterface $encryptor,\n+ \\Magento\\Framework\\Message\\ManagerInterface $messageManager,\n+ \\Magento\\Framework\\Module\\ModuleListInterface $moduleList,\n+ \\Magento\\Framework\\App\\ResourceConnection $connection,\n+ \\Magento\\Framework\\App\\Cache\\Manager $cacheManager,\n+ \\Magento\\Framework\\App\\Request\\Http $request,\n+ \\Magento\\Framework\\App\\State $state,\n\\Magento\\Store\\Model\\StoreManagerInterface $storeManager,\n\\Magento\\Backend\\Model\\UrlInterface $backendUrl,\n+ \\Magento\\Paypal\\Model\\Config $paypal,\n+ \\Psr\\Log\\LoggerInterface $logger,\n\\phpseclib\\Crypt\\RSA $rsa,\n- \\phpseclib\\Crypt\\AES $aes,\n- \\Magento\\Framework\\App\\Cache\\Manager $cacheManager,\n- \\Magento\\Framework\\App\\Request\\Http $request,\n- \\Magento\\Framework\\App\\ResourceConnection $connection,\n- \\Magento\\Framework\\Module\\ModuleListInterface $moduleList,\n- \\Magento\\Framework\\App\\ProductMetadataInterface $productMeta,\n- \\Magento\\Framework\\Message\\ManagerInterface $messageManager,\n- \\Psr\\Log\\LoggerInterface $logger\n+ \\phpseclib\\Crypt\\AES $aes\n)\n{\n$this->config = $config;\n$this->scopeConfig = $scopeConfig;\n+ $this->productMeta = $productMeta;\n$this->encryptor = $encryptor;\n- $this->storeManager = $storeManager;\n$this->backendUrl = $backendUrl;\n- $this->rsa = $rsa;\n- $this->aes = $aes;\n$this->cacheManager = $cacheManager;\n- $this->request = $request;\n$this->connection = $connection;\n$this->moduleList = $moduleList;\n- $this->productMeta = $productMeta;\n+ $this->state = $state;\n+ $this->request = $request;\n+ $this->storeManager = $storeManager;\n+ $this->paypal = $paypal;\n$this->logger = $logger;\n+ $this->rsa = $rsa;\n+ $this->aes = $aes;\n$this->messageManager = $messageManager;\n+\n+ // Find store ID and scope\n+ $this->_websiteId = $request->getParam('website', 0);\n+ $this->_storeId = $request->getParam('store', 0);\n+ $this->_scope = $request->getParam('scope');\n+\n+ // Website scope\n+ if ($this->_websiteId) {\n+ $this->_scope = !$this->_scope ? 'websites' : $this->_scope;\n+ } else {\n+ $this->_websiteId = $storeManager->getWebsite()->getId();\n+ }\n+\n+ // Store scope\n+ if ($this->_storeId) {\n+ $this->_websiteId = $this->storeManager->getStore($this->_storeId)->getWebsite()->getId();\n+ $this->_scope = !$this->_scope ? 'stores' : $this->_scope;\n+ } else {\n+ $this->_storeId = $storeManager->getWebsite($this->_websiteId)->getDefaultStore()->getId();\n+ }\n+\n+ // Set scope ID\n+ switch ($this->_scope) {\n+ case 'websites':\n+ $this->_scopeId = $this->_websiteId;\n+ break;\n+ case 'stores':\n+ $this->_scopeId = $this->_storeId;\n+ break;\n+ default:\n+ $this->_scope = 'default';\n+ $this->_scopeId = 0;\n+ break;\n+ }\n+ }\n+\n+\n+\n+ /**\n+ * Return domain\n+ */\n+ private function getEndpointDomain()\n+ {\n+ return in_array($this->getRegion(), array('EU', 'UK'))\n+ ? 'https://payments-eu.amazon.com/'\n+ : 'https://payments.amazon.com/';\n+ }\n+\n+ /**\n+ * Return register popup endpoint URL\n+ */\n+ public function getEndpointRegister()\n+ {\n+ return $this->getEndpointDomain() . 'register';\n+ }\n+\n+ /**\n+ * Return pubkey endpoint URL\n+ */\n+ public function getEndpointPubkey()\n+ {\n+ return $this->getEndpointDomain() . 'register/getpublickey';\n}\n/**\n@@ -72,8 +142,6 @@ class SimplePath\n*/\npublic function generateKeys()\n{\n- //$keys = $rsa->generateKeys(array('private_key_bits' => 2048, 'privateKeyBits' => 2048, 'hashAlgorithm' => 'sha1'));\n-\n$keys = $this->rsa->createKey(2048);\n$this->config\n@@ -149,8 +217,8 @@ class SimplePath\n$payload = (object) json_decode($payloadJson);\n$payloadVerify = clone $payload;\n- // Unencrypted?\n- if (!isset($payload->encryptedKey) && isset($payload->merchant_id, $payload->access_key, $payload->secret_key)) {\n+ // Unencrypted via admin\n+ if ($this->state->getAreaCode() == 'adminhtml' && isset($payload->merchant_id, $payload->access_key, $payload->secret_key)) {\nreturn $this->saveToConfig($payloadJson, $autoEnable);\n}\n@@ -166,7 +234,7 @@ class SimplePath\n// Retrieve Amazon public key to verify signature\ntry {\n- $client = new \\Zend_Http_Client(self::API_ENDPOINT_GET_PUBLICKEY, array(\n+ $client = new \\Zend_Http_Client($this->getEndpointPubkey(), array(\n'maxredirects' => 2,\n'timeout' => 30));\n@@ -194,7 +262,7 @@ class SimplePath\nif (function_exists('mcrypt_decrypt')) {\n$finalPayload = @mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $decryptedKey, base64_decode($payload->encryptedPayload), MCRYPT_MODE_CBC, base64_decode($payload->iv));\n} else {\n- // This uses openssl_decrypt, which may have issues\n+ // This library uses openssl_decrypt, which may have issues\n$this->aes->setKey($decryptedKey);\n$this->aes->setIV(base64_decode($payload->iv, true));\n$this->aes->setKeyLength(128);\n@@ -240,11 +308,17 @@ class SimplePath\n$values->{strtolower($key)} = $value;\n}\n- $this->config->saveConfig('payment/amazon_payment/merchant_id', $values->merchant_id, 'default', 0);\n- $this->config->saveConfig('payment/amazon_payment/client_id', $values->client_id, 'default', 0);\n- $this->config->saveConfig('payment/amazon_payment/client_secret', $this->encryptor->encrypt($values->client_secret), 'default', 0);\n- $this->config->saveConfig('payment/amazon_payment/access_key', $values->access_key, 'default', 0);\n- $this->config->saveConfig('payment/amazon_payment/secret_key', $this->encryptor->encrypt($values->secret_key), 'default', 0);\n+ $this->config->saveConfig('payment/amazon_payment/merchant_id', $values->merchant_id, $this->_scope, $this->_scopeId);\n+ $this->config->saveConfig('payment/amazon_payment/client_id', $values->client_id, $this->_scope, $this->_scopeId);\n+ $this->config->saveConfig('payment/amazon_payment/client_secret', $this->encryptor->encrypt($values->client_secret), $this->_scope, $this->_scopeId);\n+ $this->config->saveConfig('payment/amazon_payment/access_key', $values->access_key, $this->_scope, $this->_scopeId);\n+ $this->config->saveConfig('payment/amazon_payment/secret_key', $this->encryptor->encrypt($values->secret_key), $this->_scope, $this->_scopeId);\n+\n+ $currency = $this->getConfig('currency/options/default');\n+ if (isset($this->_mapCurrencyRegion[$currency])) {\n+ $this->config->saveConfig('payment/amazon_payment/payment_region', $this->_mapCurrencyRegion[$currency], $this->_scope, $this->_scopeId);\n+ }\n+\nif ($autoEnable) {\n$this->autoEnable();\n@@ -261,8 +335,8 @@ class SimplePath\n*/\npublic function autoEnable()\n{\n- if (!$this->scopeConfig->getValue('payment/amazon_payment/pwa_enabled')) {\n- $this->config->saveConfig('payment/amazon_payment/pwa_enabled', true, 'default', 0);\n+ if (!$this->getConfig('payment/amazon_payment/pwa_enabled')) {\n+ $this->config->saveConfig('payment/amazon_payment/pwa_enabled', true, $this->_scope, $this->_scopeId);\n$this->messageManager->addSuccess(__(\"Login and Pay with Amazon is now enabled.\"));\n}\n}\n@@ -272,20 +346,9 @@ class SimplePath\n*/\npublic function getReturnUrl()\n{\n- /*\n- //$url = $this->_backendUrl->getUrl('amazon_payments/simplepath', array('_store' => Mage::helper('amazon_payments')->getAdminStoreId(), '_forced_secure' => true));\n- $url = $this->_backendUrl->getUrl('amazon_payments/simplepath');\n- // $this->_storeManager->getStore()->getBaseUrl()\n- // Add index.php\n- $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB, true);\n- return str_replace($baseUrl, $baseUrl . 'index.php/', $url);\n- */\n-\n- $baseUrl = $this->storeManager->getStore()->getBaseUrl(UrlInterface::URL_TYPE_WEB, true);\n+ $baseUrl = $this->storeManager->getStore($this->_storeId)->getBaseUrl(UrlInterface::URL_TYPE_WEB, true);\n$baseUrl = str_replace('http:', 'https:', $baseUrl);\n- return $baseUrl . 'amazon_core/simplepath/listener';\n-\n- //return $this->storeManager->getStore()->getUrl('amazon_core/simplepath/listener', array('_secure' => true, '_forced_secure' => true));\n+ return $baseUrl . 'amazon_core/simplepath/listener?website='.$this->_websiteId.'&store='.$this->_storeId.'&scope='.$this->_scope;\n}\n/**\n@@ -293,7 +356,7 @@ class SimplePath\n*/\npublic function getSimplepathUrl()\n{\n- return self::API_ENDPOINT_DOWNLOAD_KEYS . '?returnUrl=' . urlencode($this->getReturnUrl()) .\n+ return $this->getEndpointRegister() . '?returnUrl=' . urlencode($this->getReturnUrl()) .\n'&pub_key=' . urlencode($this->getPublicKey()) .\n'#event/fromSP';\n}\n@@ -326,28 +389,53 @@ class SimplePath\n$version = $this->moduleList->getOne('Amazon_Core');\n$coreVersion = ($version && isset($version['setup_version'])) ? $version['setup_version'] : '--';\n+ $currency = $this->getConfig('currency/options/default');\n+\nreturn array(\n- 'locale' => $this->scopeConfig->getValue('general/country/default'),\n- 'spId' => self::PARAM_SP_ID,\n+ 'locale' => $this->getConfig('general/country/default'),\n+ 'spId' => isset($this->_spIds[$currency]) ? $this->_spIds[$currency] : '',\n'allowedLoginDomains[]' => $urls,\n'spSoftwareVersion' => $coreVersion,\n'spAmazonPluginVersion' => $this->productMeta->getVersion(),\n);\n}\n+ /**\n+ * Return config value based on scope and scope ID\n+ */\n+ public function getConfig($path)\n+ {\n+ return $this->scopeConfig->getValue($path, $this->_scope, $this->_scopeId);\n+ }\n+\n+ /**\n+ * Return payment region based on currency\n+ */\n+ public function getRegion()\n+ {\n+ $currency = $this->getConfig('currency/options/default');\n+\n+ $region = isset($this->_mapCurrencyRegion[$currency]) ? strtoupper($this->_mapCurrencyRegion[$currency]) : '';\n+ if ($region == 'DE') {\n+ $region = 'EU';\n+ }\n+\n+ return $region;\n+ }\n+\n+\n/**\n* Return array of config for JSON AmazonSp variable.\n*/\npublic function getJsonAmazonSpConfig()\n{\nreturn array(\n+ 'co' => $this->getConfig('paypal/general/merchant_country'),\n+ 'region' => $this->getRegion(),\n+ 'currency' => $this->getConfig('currency/options/default'),\n'amazonUrl' => $this->getSimplepathUrl(),\n- 'pollUrl' => $this->backendUrl->getUrl('amazonsp/simplepath/poll'),\n- 'spUrl' => $this->backendUrl->getUrl('amazonsp/simplepath/spurl'),\n- 'importUrl' => $this->backendUrl->getUrl('amazonsp/simplepath/import'),\n+ 'pollUrl' => $this->backendUrl->getUrl('amazonsp/simplepath/poll/'),\n'isSecure' => (int) ($this->request->isSecure()),\n- 'region' => (int) $this->scopeConfig->getValue('general/country/default'),\n- //'isUsa' => (int) (Mage::helper('amazon_payments')->getAdminConfig() == 'US' && Mage::helper('amazon_payments')->getAdminRegion() != 'eu'),\n'hasOpenssl' => (int) (extension_loaded('openssl')),\n'formParams' => $this->getFormParams(),\n);\n" }, { "change_type": "MODIFY", "old_path": "src/Core/etc/adminhtml/system.xml", "new_path": "src/Core/etc/adminhtml/system.xml", "diff": "<comment><![CDATA[\n<div id=\"amazon_simplepath\">\n- <span style=\"display:inline-block;padding-bottom:1em;\">\n+\n+ <!-- @see simplepath_admin.phtml -->\n+\n+ <div id=\"simplepath_hint\">You will be registering for a [REGION] account based on the base currency of your shop ([CURRENCY]). For more information, click <a href=\"https://amzn.github.io/amazon-payments-magento-2-plugin/configuration.html#advanced\" target=\"_blank\">here</a>.</div>\n+\n+ <span style=\"display:inline-block;padding:1em 0em;\">\n<button><span>Get started with account registration</span></button>\n&nbsp; &nbsp;\n<button><span>My account is ready, I need to connect it to Magento</span></button>\n" }, { "change_type": "MODIFY", "old_path": "src/Core/view/adminhtml/templates/system/config/simplepath_admin.phtml", "new_path": "src/Core/view/adminhtml/templates/system/config/simplepath_admin.phtml", "diff": "var AmazonSp = <?php echo $this->getAmazonSpJson(); ?>;\n+console.log(AmazonSp);\n+\nrequire([\"prototype\"], function(){\n- var amazonPollInterval = 1500; // poll every ms for keys\n- var amazonPollTimer = null;\n+ // Check if SimplePath is supported\n+ if (!AmazonSp.region || AmazonSp.region == 'JA') {\n+ return;\n+ }\n+ // Country code for ID selectors\n+ var co = AmazonSp.co.toLowerCase();\n+\n+ // Poll every ms for keys\n+ var amazonPollInterval = 1500;\n+ var amazonPollTimer = null;\nvar amazonSimplepath = $(\"amazon_simplepath\");\n- var amazonFields = $$(\"#payment_us_amazon_payment .form-list\");\n+ var amazonFields = $$(\"#payment_\"+co+\"_amazon_payment .form-list\");\nvar amazonSpBack = $(\"amazon_simplepath_back\");\n+ // Set region/currency hint\n+ var hint = $(\"simplepath_hint\").innerHTML;\n+ hint = hint.replace(\"[REGION]\", AmazonSp.region);\n+ hint = hint.replace(\"[CURRENCY]\", AmazonSp.currency);\n+ $(\"simplepath_hint\").innerHTML = hint;\n- if ($(\"payment_us_amazon_payment_general_credentials_merchant_id\") != null) {\n- if (!$(\"payment_us_amazon_payment_general_credentials_merchant_id\").value) {\n+ // Show/hide fields\n+ if ($(\"payment_\"+co+\"_amazon_payment_general_credentials_merchant_id\") != null) {\n+ if (!$(\"payment_\"+co+\"_amazon_payment_general_credentials_merchant_id\").value) {\namazonFields.each(Element.hide);\n} else {\namazonSpBack.show();\n@@ -28,7 +44,6 @@ require([\"prototype\"], function(){\n// Generate form to post to Amazon\nvar form = new Element('form', { method: 'post', action: AmazonSp.amazonUrl, id: 'simplepath_form', target: 'simplepath'});\n- //$$('body')[0].insert(form);\namazonSimplepath.wrap(form);\n// Convert formParams JSON to hidden inputs\n@@ -55,7 +70,6 @@ require([\"prototype\"], function(){\nwindow.launchPopup('', 768, popupHeight);\n- //amazonFields[1].show();\namazonFields.each(Element.show);\nif (!amazonPollTimer) {\n@@ -64,7 +78,7 @@ require([\"prototype\"], function(){\n});\n// User is skipping simplepath\n- amazonSimplepath.select(\"a\")[0].observe(\"click\", function(e) {\n+ amazonSimplepath.select(\"#simplepath-skip\")[0].observe(\"click\", function(e) {\ne.stop();\namazonSpBack.show();\nshowAmazonConfig();\n@@ -83,14 +97,14 @@ require([\"prototype\"], function(){\namazonSimplepath.hide();\namazonSpBack.show();\n- if (!$('payment_us_amazon_payment_general-head').hasClassName('open')) {\n- $('payment_us_amazon_payment_general-head').click();\n- $('payment_us_amazon_payment_general_credentials-head').click();\n- $('payment_us_amazon_payment_general_options-head').click();\n+ if (!$(\"payment_\"+co+\"_amazon_payment_general-head\").hasClassName('open')) {\n+ $(\"payment_\"+co+\"_amazon_payment_general-head\").click();\n+ $(\"payment_\"+co+\"_amazon_payment_general_credentials-head\").click();\n}\n}\n+ // Perform Ajax request looking for new keys\nfunction pollForKeys() {\nnew Ajax.Request(AmazonSp.pollUrl, {\nmethod:'get',\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
add EU endpoint and fix config scope
21,246
18.07.2017 09:57:05
25,200
b01a016b64cf646da6328c3efe9c63ec07806746
fix getCredentialsJson scope bug
[ { "change_type": "MODIFY", "old_path": "src/Core/Observer/PaymentConfigSaveAfter.php", "new_path": "src/Core/Observer/PaymentConfigSaveAfter.php", "diff": "@@ -79,7 +79,7 @@ class PaymentConfigSaveAfter implements ObserverInterface\npublic function execute(Observer $observer)\n{\n$scopeData = $this->getScopeData($observer);\n- $jsonCredentials = $this->amazonCoreHelper->getCredentialsJson();\n+ $jsonCredentials = $this->amazonCoreHelper->getCredentialsJson($scopeData['scope'], $scopeData['scope_id']);\nif (!empty($jsonCredentials)) {\n$this->appConfig->reinit();\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
fix getCredentialsJson scope bug
21,246
18.07.2017 09:58:05
25,200
3edd74b086973cffaf1b02f0c55070e30616717d
add Import From Clipboard and fix popup width for EU
[ { "change_type": "MODIFY", "old_path": "src/Core/view/adminhtml/templates/system/config/simplepath_admin.phtml", "new_path": "src/Core/view/adminhtml/templates/system/config/simplepath_admin.phtml", "diff": "@@ -18,25 +18,25 @@ require([\"prototype\"], function(){\nvar amazonPollInterval = 1500;\nvar amazonPollTimer = null;\n- var amazonSimplepath = $(\"amazon_simplepath\");\n- var amazonFields = $$(\"#payment_\"+co+\"_amazon_payment .form-list\");\n- var amazonSpBack = $(\"amazon_simplepath_back\");\n+ var amazonSimplepath = $('amazon_simplepath');\n+ var amazonFields = $$('#payment_'+co+'_amazon_payment .form-list');\n+ var amazonSpBack = $('amazon_simplepath_back');\n// Set region/currency hint\n- var hint = $(\"simplepath_hint\").innerHTML;\n- hint = hint.replace(\"[REGION]\", AmazonSp.region);\n- hint = hint.replace(\"[CURRENCY]\", AmazonSp.currency);\n- $(\"simplepath_hint\").innerHTML = hint;\n+ var hint = $('simplepath_hint').innerHTML;\n+ hint = hint.replace('[REGION]', AmazonSp.region);\n+ hint = hint.replace('[CURRENCY]', AmazonSp.currency);\n+ $('simplepath_hint').innerHTML = hint;\n// Show/hide fields\n- if ($(\"payment_\"+co+\"_amazon_payment_general_credentials_merchant_id\") != null) {\n- if (!$(\"payment_\"+co+\"_amazon_payment_general_credentials_merchant_id\").value) {\n+ if ($('payment_'+co+'_amazon_payment_general_credentials_merchant_id') != null) {\n+ if (!$('payment_'+co+'_amazon_payment_general_credentials_merchant_id').value) {\namazonFields.each(Element.hide);\n} else {\namazonSpBack.show();\namazonSimplepath.hide();\n- if (window.location.hash == \"#payment_amazon_payments-head\") {\n+ if (window.location.hash == '#payment_amazon_payments-head') {\nshowAmazonConfig();\n}\n}\n@@ -51,7 +51,7 @@ require([\"prototype\"], function(){\nfor (var key in AmazonSp.formParams) {\nif (typeof AmazonSp.formParams[key] == 'object' || typeof AmazonSp.formParams[key] == 'array') {\nfor (var i in AmazonSp.formParams[key]) {\n- if (typeof AmazonSp.formParams[key][i] != \"function\") {\n+ if (typeof AmazonSp.formParams[key][i] != 'function') {\nform.insert(new Element('input', { type: 'hidden', name: key, value: AmazonSp.formParams[key][i]}));\n}\n}\n@@ -61,31 +61,69 @@ require([\"prototype\"], function(){\n}\n// Get Started clicked\n- $(\"simplepath_form\").observe(\"submit\", function(e) {\n+ $('simplepath_form').observe('submit', function(e) {\nvar heights = [660, 720, 810, 900];\nvar popupHeight = heights[0];\nfor (var i in heights) {\npopupHeight = (window.innerHeight >= heights[i]) ? heights[i] : popupHeight;\n}\n- window.launchPopup('', 768, popupHeight);\n+ var popupWidth = this.action.indexOf('payments-eu') == -1 ? 768 : 1050;\n+ window.launchPopup('', popupWidth, popupHeight);\n+ // Show fields and import\namazonFields.each(Element.show);\nif (!amazonPollTimer) {\namazonPollTimer = setTimeout(pollForKeys, amazonPollInterval);\n}\n+\n+ // Add \"Import From Clipboard\"\n+ var elJson = $('payment_'+co+'_amazon_payment_general_credentials_credentials_json');\n+ if (elJson) {\n+ // Enable Crednetials JSON config field\n+ var elJsonCheckDefault = $$('#payment_'+co+'_amazon_payment_general_credentials_credentials_json_inherit:checked');\n+ if (elJsonCheckDefault && elJsonCheckDefault.length) {\n+ elJsonCheckDefault[0].click();\n+ }\n+\n+ // Add Import/Save button\n+ amazonSimplepath.insert({after: '<button id=\"saveJson\" class=\"action-default scalable save primary ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only\">Import From Clipboard</button>'});\n+ $('saveJson').observe(\"click\", function(e) {\n+ e.stop();\n+ elJson.value = $('json-import').value;\n+ $('save').click();\n+ });\n+\n+ // Add import textarea\n+ amazonSimplepath.insert({after: '<br/><textarea id=\"json-import\" rows=\"2\" cols=\"15\"></textarea>'});\n+ }\n+\n+ // Autoset payment region (for EU/UK)\n+ var region = AmazonSp.region.toLowerCase();\n+ if (region == 'eu') {\n+ region = 'de';\n+ }\n+ var elCheckDefault = $$('#payment_'+co+'_amazon_payment_general_credentials_payment_region_inherit:checked');\n+ if (elCheckDefault && elCheckDefault.length) {\n+ elCheckDefault[0].click();\n+ }\n+ var elRegion = $('payment_'+co+'_amazon_payment_general_credentials_payment_region');\n+ if (elRegion) {\n+ elRegion.value = region;\n+ }\n+\n});\n// User is skipping simplepath\n- amazonSimplepath.select(\"#simplepath-skip\")[0].observe(\"click\", function(e) {\n+ amazonSimplepath.select('#simplepath-skip')[0].observe('click', function(e) {\ne.stop();\namazonSpBack.show();\nshowAmazonConfig();\n});\n// User clicked 'Back'\n- $(\"amazon_simplepath_back\").select(\"a\")[0].observe(\"click\", function(e) {\n+ $('amazon_simplepath_back').select('a')[0].observe('click', function(e) {\ne.stop();\namazonSpBack.hide();\namazonSimplepath.show();\n@@ -97,9 +135,9 @@ require([\"prototype\"], function(){\namazonSimplepath.hide();\namazonSpBack.show();\n- if (!$(\"payment_\"+co+\"_amazon_payment_general-head\").hasClassName('open')) {\n- $(\"payment_\"+co+\"_amazon_payment_general-head\").click();\n- $(\"payment_\"+co+\"_amazon_payment_general_credentials-head\").click();\n+ if (!$('payment_'+co+'_amazon_payment_general-head').hasClassName('open')) {\n+ $('payment_'+co+'_amazon_payment_general-head').click();\n+ $('payment_'+co+'_amazon_payment_general_credentials-head').click();\n}\n}\n@@ -110,8 +148,8 @@ require([\"prototype\"], function(){\nmethod:'get',\nonSuccess: function(transport) {\nif (transport.responseText == '1') {\n- $(\"amazon_reload\").show();\n- document.location.replace(document.location + \"#payment_amazon_payments-head\");\n+ $('amazon_reload').show();\n+ document.location.replace(document.location + '#payment_amazon_payments-head');\nlocation.reload();\n} else {\namazonPollTimer = setTimeout(pollForKeys, amazonPollInterval);\n@@ -131,7 +169,7 @@ require([\"prototype\"], function(){\n// Add Mage validator to fix \"Save Config\" button from not submitting\nrequire([\"jquery\", \"jquery/validate\"], function($) {\n- $(\"#simplepath_form\").validate();\n+ $('#simplepath_form').validate();\n});\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
add Import From Clipboard and fix popup width for EU
21,246
18.07.2017 10:41:11
25,200
ae36d0430f13bf0761d272f507bd899d45311402
fix default merchant location when null
[ { "change_type": "MODIFY", "old_path": "src/Core/Model/Config/SimplePath.php", "new_path": "src/Core/Model/Config/SimplePath.php", "diff": "@@ -429,8 +429,10 @@ class SimplePath\n*/\npublic function getJsonAmazonSpConfig()\n{\n+ $co = $this->getConfig('paypal/general/merchant_country');\n+\nreturn array(\n- 'co' => $this->getConfig('paypal/general/merchant_country'),\n+ 'co' => $co ? $co : 'US',\n'region' => $this->getRegion(),\n'currency' => $this->getConfig('currency/options/default'),\n'amazonUrl' => $this->getSimplepathUrl(),\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
fix default merchant location when null
21,246
18.07.2017 10:44:14
25,200
0de8be092dced1c395cb3390f12177abc6bbe357
fix multiple import textareas
[ { "change_type": "MODIFY", "old_path": "src/Core/view/adminhtml/templates/system/config/simplepath_admin.phtml", "new_path": "src/Core/view/adminhtml/templates/system/config/simplepath_admin.phtml", "diff": "@@ -80,7 +80,7 @@ require([\"prototype\"], function(){\n// Add \"Import From Clipboard\"\nvar elJson = $('payment_'+co+'_amazon_payment_general_credentials_credentials_json');\n- if (elJson) {\n+ if (elJson && $('save-json') == null) {\n// Enable Crednetials JSON config field\nvar elJsonCheckDefault = $$('#payment_'+co+'_amazon_payment_general_credentials_credentials_json_inherit:checked');\nif (elJsonCheckDefault && elJsonCheckDefault.length) {\n@@ -88,8 +88,8 @@ require([\"prototype\"], function(){\n}\n// Add Import/Save button\n- amazonSimplepath.insert({after: '<button id=\"saveJson\" class=\"action-default scalable save primary ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only\">Import From Clipboard</button>'});\n- $('saveJson').observe(\"click\", function(e) {\n+ amazonSimplepath.insert({after: '<button id=\"save-json\" class=\"action-default scalable save primary ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only\">Import From Clipboard</button>'});\n+ $('save-json').observe('click', function(e) {\ne.stop();\nelJson.value = $('json-import').value;\n$('save').click();\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
fix multiple import textareas
21,246
18.07.2017 10:48:45
25,200
7a378b2807961ca56aef1b85ca7ac9d4697b3482
add JSON placeholder text
[ { "change_type": "MODIFY", "old_path": "src/Core/view/adminhtml/templates/system/config/simplepath_admin.phtml", "new_path": "src/Core/view/adminhtml/templates/system/config/simplepath_admin.phtml", "diff": "@@ -96,7 +96,7 @@ require([\"prototype\"], function(){\n});\n// Add import textarea\n- amazonSimplepath.insert({after: '<br/><textarea id=\"json-import\" rows=\"2\" cols=\"15\"></textarea>'});\n+ amazonSimplepath.insert({after: '<br/><textarea id=\"json-import\" rows=\"2\" cols=\"15\" placeholder=\"Paste JSON credentials here\"></textarea>'});\n}\n// Autoset payment region (for EU/UK)\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
add JSON placeholder text
21,246
19.07.2017 08:19:55
25,200
23e235f28bfe7ef43ec87b950d213ee9cdcf8ca2
fix form params merchantLoginRedirectURLs and locale
[ { "change_type": "MODIFY", "old_path": "src/Core/Model/Config/SimplePath.php", "new_path": "src/Core/Model/Config/SimplePath.php", "diff": "@@ -367,7 +367,7 @@ class SimplePath\npublic function getFormParams()\n{\n// Retrieve store URLs from config table\n- $urls = array();\n+ $baseUrls = array();\n$db = $this->connection->getConnection();\n$select = $db->select()\n->from(\n@@ -379,11 +379,22 @@ class SimplePath\n$url = parse_url($row['value']);\nif (isset($url['host'])){\n- $urls[] = 'https://' . $url['host'];\n+ $baseUrls[] = 'https://' . $url['host'];\n}\n}\n+ $baseUrls = array_unique($baseUrls);\n- $urls = array_unique($urls);\n+ // Get redirect URLs\n+ $urlArray = array();\n+ $stores = $this->storeManager->getStores();\n+ foreach ($stores as $store) {\n+ $baseUrl = $store->getBaseUrl(UrlInterface::URL_TYPE_WEB, true);\n+ if ($baseUrl) {\n+ $value = $baseUrl . 'amazon/login/processAuthHash/';\n+ $urlArray[] = $value;\n+ }\n+ }\n+ $urlArray = array_unique($urlArray);\n$version = $this->moduleList->getOne('Amazon_Core');\n@@ -392,11 +403,14 @@ class SimplePath\n$currency = $this->getConfig('currency/options/default');\nreturn array(\n- 'locale' => $this->getConfig('general/country/default'),\n+ 'locale' => $this->getConfig('general/locale/code'),\n'spId' => isset($this->_spIds[$currency]) ? $this->_spIds[$currency] : '',\n- 'allowedLoginDomains[]' => $urls,\n'spSoftwareVersion' => $coreVersion,\n'spAmazonPluginVersion' => $this->productMeta->getVersion(),\n+ 'merchantStoreDescription' => $this->getConfig('general/store_information/name'),\n+ 'merchantLoginDomains[]' => $baseUrls,\n+ 'merchantLoginRedirectURLs[]' => $urlArray,\n+\n);\n}\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
fix form params merchantLoginRedirectURLs and locale
21,246
20.07.2017 12:07:35
25,200
0fdc2dc08292921d17538c52aa7d6165d278ca96
post SP params as post and update EU label to Euro Region
[ { "change_type": "MODIFY", "old_path": "src/Core/Model/Config/SimplePath.php", "new_path": "src/Core/Model/Config/SimplePath.php", "diff": "@@ -356,9 +356,7 @@ class SimplePath\n*/\npublic function getSimplepathUrl()\n{\n- return $this->getEndpointRegister() . '?returnUrl=' . urlencode($this->getReturnUrl()) .\n- '&pub_key=' . urlencode($this->getPublicKey()) .\n- '#event/fromSP';\n+ return $this->getEndpointRegister() . '#event/fromSP';\n}\n/**\n@@ -403,7 +401,10 @@ class SimplePath\n$currency = $this->getConfig('currency/options/default');\nreturn array(\n+ 'keyShareURL' => $this->getReturnUrl(),\n+ 'publicKey' => $this->getPublicKey(),\n'locale' => $this->getConfig('general/locale/code'),\n+ 'source' => 'SPPL',\n'spId' => isset($this->_spIds[$currency]) ? $this->_spIds[$currency] : '',\n'spSoftwareVersion' => $coreVersion,\n'spAmazonPluginVersion' => $this->productMeta->getVersion(),\n@@ -431,7 +432,7 @@ class SimplePath\n$region = isset($this->_mapCurrencyRegion[$currency]) ? strtoupper($this->_mapCurrencyRegion[$currency]) : '';\nif ($region == 'DE') {\n- $region = 'EU';\n+ $region = 'Euro Region';\n}\nreturn $region ? $region : 'US';\n" }, { "change_type": "MODIFY", "old_path": "src/Core/view/adminhtml/templates/system/config/simplepath_admin.phtml", "new_path": "src/Core/view/adminhtml/templates/system/config/simplepath_admin.phtml", "diff": "@@ -101,7 +101,7 @@ require([\"prototype\"], function(){\n// Autoset payment region (for EU/UK)\nvar region = AmazonSp.region.toLowerCase();\n- if (region == 'eu') {\n+ if (region.indexOf('eu') != -1) {\nregion = 'de';\n}\nvar elCheckDefault = $$('#payment_'+co+'_amazon_payment_general_credentials_payment_region_inherit:checked');\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
post SP params as post and update EU label to Euro Region
21,246
20.07.2017 14:04:38
25,200
ecb2f5837e1af3fc7b3c8652d3de2a02c8cae685
fix SP version params
[ { "change_type": "MODIFY", "old_path": "src/Core/Model/Config/SimplePath.php", "new_path": "src/Core/Model/Config/SimplePath.php", "diff": "@@ -406,8 +406,8 @@ class SimplePath\n'locale' => $this->getConfig('general/locale/code'),\n'source' => 'SPPL',\n'spId' => isset($this->_spIds[$currency]) ? $this->_spIds[$currency] : '',\n- 'spSoftwareVersion' => $coreVersion,\n- 'spAmazonPluginVersion' => $this->productMeta->getVersion(),\n+ 'spSoftwareVersion' => $this->productMeta->getVersion(),\n+ 'spAmazonPluginVersion' => $coreVersion,\n'merchantStoreDescription' => $this->getConfig('general/store_information/name'),\n'merchantLoginDomains[]' => $baseUrls,\n'merchantLoginRedirectURLs[]' => $urlArray,\n" } ]
PHP
Apache License 2.0
amzn/amazon-payments-magento-2-plugin
fix SP version params

📜 CommitChronicle 🔮

This is the dataset for commit message generation (and/or completion), introduced in the paper "From Commit Message Generation to History-Aware Commit Message Completion", ASE 2023.

Its key features:

  • large-scale and multilingual: contains 10.7M commits from 11.9k GitHub repositories in 20 programming languages;
  • diverse: avoids restrictive filtering on commit messages or commit diffs structure;
  • suitable for experiments with commit history: provides metadata about commit authors and dates and uses split-by-project.

Dataset Creation

🔍 For further details, please refer to:

We used GitHub Search tool and official GitHub API to select relevant repositories with permissive licenses (Apache, BSD 3-clause, MIT). On February 9th, 2023, we collected all commits made since 2017 from these repositories via PyDriller. Next, we extensively cleaned the data, including filtering outliers, dropping commits from bot authors, and dropping duplicates. Note: to avoid disclosing personal information, we replaced the commit authors' names and emails with unique identifiers.

Dataset Structure

Data Instances

Each data instance in the dataset is a commit. A commit example would look like the following:

{
  'repo': 'saridormi/commit_chronicle',
  'hash': 'a7fb3b64184f0af5b08285cce14b9139baa94049',
  'author': 123,
  'date': '05.07.2021 15:10:07',
  'timezone': 0,
  'license': 'MIT License',
  'language': 'Jupyter Notebook',
  'message': 'Add license badge to readme',
  'original_message': 'Add license badge to readme',
  'mods': [{'change_type': 'MODIFY',
            'new_path': 'README.md',
            'old_path': 'README.md'
            'diff': '@@ -1,6 +1,6 @@\n'
                    ' # Commits dataset\n'
                    ' \n'
                    '-> :heavy_exclamation_mark: **TODO:** license\n'
                    '+![GitHub](https://img.shields.io/github/license/saridormi/commits_dataset?style=for-the-badge)\n'}],
}

Data Fields

Each example has the following fields:

Field Description
repo Commit repository.
hash Commit hash.
author Unique id for commit author
date Commit date (from author).
timezone Commit timezone (from author).
license Commit repository's license.
language Commit repository's main language.
message Commit message (after processing).
original_message Commit message (without any processing).
mods List of file modifications from commit.

Each file modification has the following fields:

Field Description
change_type Type of change to current file. One of: ADD, COPY, RENAME, DELETE, MODIFY or UNKNOWN.
old_path Path to file before change (might be empty).
new_path Path to file after change (might be empty).
diff git diff for current file.

Data Splits

We provide the following configurations:

  • default
    • train: full training split (7.66M commits)
    • validation: full validation split (1.55M commits)
    • test: full test split (1.49M commits)
  • subset_cmg
    • test: test subset used for experiments with CMG approaches (204k commits)
  • subset_llm
    • test: test subset used for experiments with a LLM (4k commits)

Considerations for Using the Data

Adopted from the Stack.

The released dataset may contain sensitive information such as emails, IP addresses, and API/ssh keys that have previously been published to public repositories on GitHub. In the event that the dataset contains personal information, researchers should only use public, non-personal information in support of conducting and publishing their open-access research. Personal information should not be used for spamming purposes, including sending unsolicited emails or selling of personal information.

The dataset is a collection of commits from repositories with various licenses. Any use of all or part of the code gathered in this dataset must abide by the terms of the original licenses, including attribution clauses when relevant. We facilitate this by providing provenance information for each data point.

Citation

TODO
Downloads last month
2,077
Edit dataset card

Models trained or fine-tuned on JetBrains-Research/commit-chronicle

Collection including JetBrains-Research/commit-chronicle