login_and_pay_for_magento - Version 1.4.0

Version Notes

v1.4.0 Release
Enhancements:
- Enabled automated key exchange between Amazon and Magento for merchants
- New simplified and streamlined registration process to help merchants start making transactions sooner
- Redesigned UX to group and collapse settings
- Removed duplication of keys in the Login with Amazon settings

Other Feature Additions:
- Now using randomized internal reference IDs (e.g. for re-authorizations)

Pull Requests Merged:
#146 Update Shopping Cart Button Placement
#121 Override mage address validation and force Amazon address for shipping calculation
#143 Updates to Api.php
#164 Fixed call to a method on a non-object
#163 Fixed Content-Type header duplicate
#150 Added OneStepCheckout.com support
#188 Update modman paths
#192 Center the Amazon Badge just like Paypal is
#184 Fix where users were getting a Mixed Content warning on cart page

Bug Fixes:
#139 Fix capture error when auth is greater than 7 days old
#132 Add 'None' (new) payment action
#151 Obey account sharing scope config
#152 Fix multi-site refund, cancel, async, etc.
#170 Billing address fixes
#156 Restrict/disable Amazon widgets during standalone checkout order placement
#162 Disable Place Order if no payment method set
#158 Improve async testing and declines
#157 Restrict address widget and shipping method if payment declined
#156 Disable iframe and divs for IE 10
#158 Add email template for async declines
#176 Don't redirect to secure cart if Amazon payment method is disabled
#175 Don't inject JS when payment method disabled
#158 Add wallet widget on order detail page for async declines
#180 Always display login button on Checkout page
#157 Disable shipping widget and method on declines
#158 Use 'Login with Amazon' button instead of 'Pay'
#131 Add Sync auth in front of Async auth
#157 remove exception message
#174 Add Pay with Amazon button in mini cart
#181 Close Amazon Order when order state changed to COMPLETE (e.g. when order is shipped)
#182 Add Login button to register/account creation page
#193 Change payment decline email to transactional email for cron compatibility
#161 Add jQuery.noConflict() to fix JS errors and conflicts with prototype
#197 Fix amazon account logout
#198 Fix JS error when shipping method is hidden (e.g. virtual products)
#140 Auth Decline Errors could be more user friendly
#190 Add hard decline email for async
#206 Remove Widgets.js if cart is empty or 'Display on Product Page' is set to No

Download this release

Release Info

Developer Amazon Payments
Extension login_and_pay_for_magento
Version 1.4.0
Comparing to
See all releases


Code changes from version 1.3.0 to 1.4.0

Files changed (81) hide show
  1. app/code/community/Amazon/Diagnostics/controllers/Adminhtml/DiagnosticsController.php +136 -53
  2. app/code/community/Amazon/Diagnostics/etc/config.xml +1 -1
  3. app/code/community/Amazon/Diagnostics/etc/system.xml +47 -39
  4. app/code/community/Amazon/Login/Block/Button.php +0 -47
  5. app/code/community/Amazon/Login/Block/Script.php +0 -56
  6. app/code/community/Amazon/Login/Helper/Data.php +0 -67
  7. app/code/community/Amazon/Login/Model/Login.php +0 -18
  8. app/code/community/Amazon/Login/Model/Resource/Login.php +0 -17
  9. app/code/community/Amazon/Login/Model/System/Config/Backend/Enabled.php +0 -53
  10. app/code/community/Amazon/Login/Model/System/Config/Source/Buttoncolor.php +0 -21
  11. app/code/community/Amazon/Login/Model/System/Config/Source/Buttonsize.php +0 -20
  12. app/code/community/Amazon/Login/Model/System/Config/Source/Buttontype.php +0 -21
  13. app/code/community/Amazon/Login/etc/adminhtml.xml +0 -34
  14. app/code/community/Amazon/Login/etc/config.xml +0 -101
  15. app/code/community/Amazon/Login/etc/system.xml +0 -155
  16. app/code/community/Amazon/Login/sql/login_setup/install-0.1.0.php +0 -46
  17. app/code/community/Amazon/Payments/Block/Adminhtml/System/Config/Simplepathimport.php +22 -0
  18. app/code/community/Amazon/Payments/Block/Button.php +11 -3
  19. app/code/community/Amazon/Payments/Block/Login/Button.php +131 -0
  20. app/code/community/Amazon/Payments/Block/Login/Script.php +105 -0
  21. app/code/community/Amazon/{Login/Block → Payments/Block/Login}/Verify.php +4 -4
  22. app/code/community/Amazon/Payments/Block/Onepage/Widget.php +25 -0
  23. app/code/community/Amazon/Payments/Block/Sales/View.php +49 -0
  24. app/code/community/Amazon/Payments/Block/Script.php +92 -0
  25. app/code/community/Amazon/Payments/Controller/Checkout.php +23 -4
  26. app/code/community/Amazon/Payments/Helper/Data.php +74 -2
  27. app/code/community/Amazon/Payments/Model/Api.php +16 -16
  28. app/code/community/Amazon/Payments/Model/Async.php +52 -12
  29. app/code/community/Amazon/Payments/Model/Config.php +3 -6
  30. app/code/community/Amazon/{Login → Payments}/Model/Customer.php +7 -7
  31. app/code/community/Amazon/{Login/Model/Api.php → Payments/Model/Login.php} +71 -79
  32. app/code/community/Amazon/Payments/Model/Observer/Action.php +10 -3
  33. app/code/community/Amazon/Payments/Model/Observer/Order.php +19 -3
  34. app/code/community/Amazon/Payments/Model/PaymentMethod.php +64 -18
  35. app/code/community/Amazon/Payments/Model/Resource/Login.php +31 -0
  36. app/code/community/Amazon/Payments/Model/SimplePath.php +283 -0
  37. app/code/community/Amazon/Payments/Model/System/Config/Backend/Clientid.php +0 -30
  38. app/code/community/Amazon/Payments/Model/System/Config/Backend/Clientsecret.php +0 -30
  39. app/code/community/Amazon/Payments/Model/System/Config/Backend/Enabled.php +39 -9
  40. app/code/community/Amazon/{Login → Payments}/Model/System/Config/Backend/Popupcomment.php +8 -6
  41. app/code/community/Amazon/Payments/Model/System/Config/Backend/Simplepath.php +23 -0
  42. app/code/community/Amazon/Payments/Model/System/Config/Source/Paymentaction.php +1 -0
  43. app/code/community/Amazon/Payments/Model/Type/Checkout.php +2 -18
  44. app/code/community/Amazon/Payments/controllers/Adminhtml/Amazon/PaymentsController.php +0 -1
  45. app/code/community/Amazon/Payments/controllers/Adminhtml/Amazon/SimplepathController.php +64 -0
  46. app/code/community/Amazon/{Login → Payments}/controllers/CustomerController.php +6 -7
  47. app/code/community/Amazon/Payments/controllers/OnepageController.php +16 -0
  48. app/code/community/Amazon/Payments/controllers/OrderController.php +50 -0
  49. app/code/community/Amazon/Payments/controllers/SimplepathController.php +49 -0
  50. app/code/community/Amazon/Payments/etc/config.xml +52 -10
  51. app/code/community/Amazon/Payments/etc/system.xml +412 -282
  52. app/code/community/Amazon/Payments/sql/payments_setup/install-0.1.0.php +39 -0
  53. app/code/community/Amazon/Payments/sql/payments_setup/upgrade-1.3.0-1.4.0.php +27 -0
  54. app/design/adminhtml/default/default/layout/amazon_payments.xml +6 -1
  55. app/design/frontend/base/default/layout/amazon_login.xml +0 -62
  56. app/design/frontend/base/default/layout/amazon_payments.xml +163 -22
  57. app/design/frontend/base/default/template/amazon_login/button.phtml +0 -32
  58. app/design/frontend/base/default/template/amazon_payments/button.phtml +2 -1
  59. app/design/frontend/base/default/template/amazon_payments/button_badge.phtml +2 -2
  60. app/design/frontend/base/default/template/amazon_payments/checkout.phtml +83 -12
  61. app/design/frontend/base/default/template/amazon_payments/login/button.phtml +65 -0
  62. app/design/frontend/base/default/template/amazon_payments/login/logout.phtml +19 -0
  63. app/design/frontend/base/default/template/{amazon_login → amazon_payments/login}/script.phtml +38 -7
  64. app/design/frontend/base/default/template/{amazon_login → amazon_payments/login}/script_authorize.phtml +1 -1
  65. app/design/frontend/base/default/template/{amazon_login → amazon_payments/login}/verify.phtml +1 -1
  66. app/design/frontend/base/default/template/amazon_payments/mark.phtml +1 -1
  67. app/design/frontend/base/default/template/amazon_payments/onepage/button.phtml +5 -3
  68. app/design/frontend/base/default/template/amazon_payments/onepage/login_cancel.phtml +1 -1
  69. app/design/frontend/base/default/template/amazon_payments/onepage/widget.phtml +10 -0
  70. app/design/frontend/base/default/template/amazon_payments/sales/order/amazon_wallet.phtml +55 -0
  71. app/design/frontend/base/default/template/amazon_payments/script.phtml +37 -38
  72. app/etc/modules/Amazon_Login.xml +0 -17
  73. app/etc/modules/Amazon_Payments.xml +0 -3
  74. app/locale/en_US/template/email/amazon_payments_async_decline_hard.html +39 -0
  75. app/locale/en_US/template/email/amazon_payments_async_decline_soft.html +42 -0
  76. lib/MarketplaceWebServiceSellers/Model/ResponseHeaderMetadata.php +0 -89
  77. lib/MarketplaceWebServiceSellers/Model/ResponseMetadata.php +0 -94
  78. package.xml +48 -26
  79. skin/adminhtml/default/default/amazonpayments/amazonpayments.js +211 -0
  80. skin/frontend/base/default/amazon_payments/css/styles_checkout.css +25 -19
  81. skin/frontend/base/default/amazon_payments/css/styles_onepage.css +4 -0
app/code/community/Amazon/Diagnostics/controllers/Adminhtml/DiagnosticsController.php CHANGED
@@ -37,19 +37,33 @@ class Amazon_Diagnostics_Adminhtml_DiagnosticsController extends Mage_Adminhtml_
37
  $this->getLogs();
38
 
39
  /* send the response */
40
- Mage::app()->getResponse()->setBody(print_r($this->_global_results, true));
41
  }
42
 
43
  private function getMagento() {
44
- $this->_global_results['magento']['version'] = Mage::getVersion();
45
- $this->_global_results['magento']['edition'] = Mage::getEdition();
46
- $this->_global_results['magento']['base_path'] = $this->_basepath;
47
- $this->_global_results['magento']['secure_frontend'] = (Mage::getStoreConfig('web/secure/use_in_frontend') == 1 ? 'yes' : 'no');
48
- $this->_global_results['magento']['store_name'] = Mage::getStoreConfig('general/store_information/name');
 
 
 
 
 
 
 
 
 
 
 
 
49
  }
50
 
51
  private function getPayments() {
52
- $payments_secret_key = Mage::getStoreConfig('payment/amazon_payments/access_secret');
 
 
53
  if (strlen($payments_secret_key) > 6) {
54
  $payments_secret_key = substr($payments_secret_key, 0, 3) . "..." . substr($payments_secret_key, strlen($payments_secret_key - 3), 3);
55
  }
@@ -67,50 +81,72 @@ class Amazon_Diagnostics_Adminhtml_DiagnosticsController extends Mage_Adminhtml_
67
  break;
68
  }
69
 
70
- $this->_global_results['payments']['enabled'] = (Mage::getStoreConfig('payment/amazon_payments/enabled') == 1 ? 'yes' : 'no');
71
- $this->_global_results['payments']['seller_id'] = "'" . $payments_seller_id . "'";
 
72
  if (preg_match('/\s/', $payments_seller_id)) {
73
- $this->_global_results['payments']['seller_id'] .= " ** white space detected **";
74
  }
75
- $this->_global_results['payments']['access_key'] = "'" . $payments_access_key . "'";
76
  if (preg_match('/\s/', $payments_access_key)) {
77
- $this->_global_results['payments']['access_key'] .= " ** white space detected **";
78
  }
79
- $this->_global_results['payments']['secret_key'] = "'" . $payments_secret_key . "'";
80
  if (preg_match('/\s/', $payments_secret_key)) {
81
- $this->_global_results['secret_key'] .= "** white space detected **";
82
  }
83
- $this->_global_results['payments']['page_type'] = $page_type;
84
- $this->_global_results['payments']['button_on_cart'] = (Mage::getStoreConfig('payment/amazon_payments/show_pay_cart') == 1 ? 'yes' : 'no');
85
- $this->_global_results['payments']['action'] = Mage::getStoreConfig('payment/amazon_payments/payment_action');
86
- $this->_global_results['payments']['secure_cart'] = (Mage::getSingleton('amazon_payments/config')->isSecureCart() == 1 ? 'yes' : 'no');
87
- $this->_global_results['payments']['payment_option'] = (Mage::getStoreConfig('payment/amazon_payments/use_in_checkout') == 1 ? 'yes' : 'no');
88
- $this->_global_results['payments']['async'] = (Mage::getStoreConfig('payment/amazon_payments/is_async') == 1 ? 'yes' : 'no');
89
- $this->_global_results['payments']['sandbox'] = (Mage::getStoreConfig('payment/amazon_payments/sandbox') == 1 ? 'yes' : 'no');
 
 
 
 
 
 
 
 
 
 
 
 
90
  }
91
 
92
  private function getLogin() {
 
 
93
  $login_client_id = Mage::getStoreConfig('amazon_login/settings/client_id');
94
  $login_client_secret = Mage::getStoreConfig('amazon_login/settings/client_secret');
95
  if (strlen($login_client_secret) > 6) {
96
  $login_client_secret = substr($login_client_secret, 0, 3) . "..." . substr($login_client_secret, strlen($login_client_secret - 3), 3);
97
  }
98
 
99
- $this->_global_results['login']['enabled'] = (Mage::getStoreConfig('amazon_login/settings/enabled') == 1 ? 'yes' : 'no');
100
- $this->_global_results['login']['button_type'] = Mage::getStoreConfig('amazon_login/settings/button_type');
101
- $this->_global_results['login']['popup'] = (Mage::getStoreConfig('amazon_login/settings/popup') == 1 ? 'yes' : 'no');
102
- $this->_global_results['login']['client_id'] = "'" . $login_client_id . "'";
103
  if (preg_match('/\s/', $login_client_id)) {
104
- $this->_global_results['login']['client_id'] = " ** white space detected **";
105
  }
106
- $this->_global_results['login']['client_secret'] = "'" . $login_client_secret . "'";
107
  if (preg_match('/\s/', $login_client_secret)) {
108
- $this->_global_results['login']['client_secret'] .= "** white space detected **";
109
  }
 
 
 
 
 
 
110
  }
111
 
112
  private function getModules() {
113
 
 
114
  $modules_folder = $this->_apppath . "/etc/modules";
115
 
116
  try {
@@ -141,11 +177,12 @@ class Amazon_Diagnostics_Adminhtml_DiagnosticsController extends Mage_Adminhtml_
141
  /* filter out core modules and */
142
  if ($v['codePool'] !== 'core') {
143
 
 
144
  /* get status */
145
- $this->_modules[$k]['active'] = $v['active'];
146
 
147
  /* get codepool */
148
- $this->_modules[$k]['pool'] = $v['codePool'];
149
 
150
  /* parse the module config.xml */
151
  $modulepath = implode("/", explode("_", $k));
@@ -156,14 +193,16 @@ class Amazon_Diagnostics_Adminhtml_DiagnosticsController extends Mage_Adminhtml_
156
  $mxml = json_decode($mxml, true);
157
 
158
  /* get version */
159
- $this->_modules[$k]['version'] = $mxml['modules'][$k]['version'];
160
 
161
  /* get global blocks */
 
162
  if (isset($mxml['global']['blocks'])) {
163
  foreach ($mxml['global']['blocks'] as $mk => $mv) {
164
- $this->_modules[$k]['blocks'][] = $mk;
165
  }
166
  }
 
167
  }
168
  }
169
  }
@@ -172,56 +211,100 @@ class Amazon_Diagnostics_Adminhtml_DiagnosticsController extends Mage_Adminhtml_
172
  }
173
  } catch (Exception $e) {
174
  /* log any errors */
175
- $this->_global_results['errors'][] = $e->getMessage();
176
  }
177
  @closedir($h);
178
- $this->_global_results['modules'] = $this->_modules;
179
  }
180
 
181
  private function getLogs() {
182
 
183
  try {
 
184
  /* get list of log files */
185
  if ($h = opendir($this->_logpath)) {
186
 
187
  /* loop through the files */
188
  while (false !== ($entry = readdir($h))) {
189
 
190
- /* we don't want . and .. */
191
- if ($entry !== "." && $entry !== "..") {
192
-
193
- /* not using due to exceeding memory limits on large files */
194
- //$filearray = file($this->_logpath . "/" . $entry, FILE_SKIP_EMPTY_LINES);
195
-
196
- $filearray = array();
197
-
198
- /* get last 15 lines of any logs */
 
 
 
 
 
 
199
  $lh = @fopen($this->_logpath . "/" . $entry, "r");
200
  if ($lh) {
 
201
  while (($buffer = fgets($lh, 8192)) !== false) {
202
- if (count($filearray) < 15) {
203
- array_push($filearray, trim($buffer));
204
- } else {
205
- $junk = array_pop($filearray);
206
- array_push($filearray, trim($buffer));
 
 
 
 
 
207
  }
208
  }
209
- $this->_logs[pathinfo($this->_logpath . "/" . $entry, PATHINFO_FILENAME)] = $filearray;
210
  } else {
211
-
212
  /* couldn't read the file */
213
- $this->_logs[pathinfo($this->_logpath . "/" . $entry, PATHINFO_FILENAME)] = "Could not read file.";
 
 
 
 
 
 
 
 
 
 
 
 
214
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
215
  @fclose($lh);
216
  }
217
  }
218
  }
219
  } catch (Exception $e) {
220
  /* log any errors */
221
- $this->_global_results['errors'][] = $e->getMessage();
222
  }
223
  @closedir($h);
224
- $this->_global_results['logs'] = $this->_logs;
225
  }
226
 
 
 
 
227
  }
37
  $this->getLogs();
38
 
39
  /* send the response */
40
+ Mage::app()->getResponse()->setBody();
41
  }
42
 
43
  private function getMagento() {
44
+
45
+ $this->log("===== MAGENTO =====");
46
+ $this->log("version: ". Mage::getVersion());
47
+ try {
48
+ $this->log("edition: ". Mage::getEdition());
49
+ } catch (Exception $e) {
50
+ /* getEdition() does not appear until 1.7 */
51
+ $this->log("edition: <1.7");
52
+ }
53
+ $this->log("base_path: ". $this->_basepath);
54
+ $this->log("secure_frontend: ". (Mage::getStoreConfig('web/secure/use_in_frontend') == 1 ? 'yes' : 'no'));
55
+ $this->log("store_name: ". Mage::getStoreConfig('general/store_information/name'));
56
+ if(defined('COMPILER_INCLUDE_PATH')) {
57
+ $this->log("compilation: enabled");
58
+ } else {
59
+ $this->log("compilation: disabled");
60
+ }
61
  }
62
 
63
  private function getPayments() {
64
+
65
+ $this->log("\n===== PAYMENT SETTINGS =====");
66
+ $payments_secret_key = Mage::helper('core')->decrypt(Mage::getStoreConfig('payment/amazon_payments/access_secret'));
67
  if (strlen($payments_secret_key) > 6) {
68
  $payments_secret_key = substr($payments_secret_key, 0, 3) . "..." . substr($payments_secret_key, strlen($payments_secret_key - 3), 3);
69
  }
81
  break;
82
  }
83
 
84
+ $enabled = Mage::getStoreConfig('payment/amazon_payments/enabled') == 1 ? 'yes' : 'no';
85
+
86
+ $payments_seller_id = "'" . $payments_seller_id . "'";
87
  if (preg_match('/\s/', $payments_seller_id)) {
88
+ $payments_seller_id .= " ** white space detected **";
89
  }
90
+ $payments_access_key = "'" . $payments_access_key . "'";
91
  if (preg_match('/\s/', $payments_access_key)) {
92
+ $payments_access_key .= " ** white space detected **";
93
  }
94
+ $payments_secret_key = "'" . $payments_secret_key . "'";
95
  if (preg_match('/\s/', $payments_secret_key)) {
96
+ $payments_secret_key .= "** white space detected **";
97
  }
98
+
99
+ $payments_button_on_cart = (Mage::getStoreConfig('payment/amazon_payments/show_pay_cart') == 1 ? 'yes' : 'no');
100
+ $payments_action = Mage::getStoreConfig('payment/amazon_payments/payment_action');
101
+ $payments_secure_cart = (Mage::getSingleton('amazon_payments/config')->isSecureCart() == 1 ? 'yes' : 'no');
102
+ $payments_payment_option = (Mage::getStoreConfig('payment/amazon_payments/use_in_checkout') == 1 ? 'yes' : 'no');
103
+ $payments_async = (Mage::getStoreConfig('payment/amazon_payments/is_async') == 1 ? 'yes' : 'no');
104
+ $payments_sandbox = (Mage::getStoreConfig('payment/amazon_payments/sandbox') == 1 ? 'yes' : 'no');
105
+
106
+ $this->log("enabled: ". $enabled);
107
+ $this->log("sandbox: ". $payments_sandbox);
108
+ $this->log("seller_id: ". $payments_seller_id);
109
+ $this->log("access_key: ". $payments_access_key);
110
+ $this->log("secret_key: ". $payments_secret_key);
111
+ $this->log("page_type: ". $page_type);
112
+ $this->log("button_on_cart: ". $payments_button_on_cart);
113
+ $this->log("action: ". $payments_action);
114
+ $this->log("secure_cart: ". $payments_secure_cart);
115
+ $this->log("payment_option: ". $payments_payment_option);
116
+ $this->log("async: ". $payments_async);
117
  }
118
 
119
  private function getLogin() {
120
+
121
+ $this->log("\n===== LOGIN SETTINGS =====");
122
  $login_client_id = Mage::getStoreConfig('amazon_login/settings/client_id');
123
  $login_client_secret = Mage::getStoreConfig('amazon_login/settings/client_secret');
124
  if (strlen($login_client_secret) > 6) {
125
  $login_client_secret = substr($login_client_secret, 0, 3) . "..." . substr($login_client_secret, strlen($login_client_secret - 3), 3);
126
  }
127
 
128
+ $login_enabled = (Mage::getStoreConfig('amazon_login/settings/enabled') == 1 ? 'yes' : 'no');
129
+ $login_button_type = Mage::getStoreConfig('amazon_login/settings/button_type');
130
+ $login_popup = (Mage::getStoreConfig('amazon_login/settings/popup') == 1 ? 'yes' : 'no');
131
+ $login_client_id = "'" . $login_client_id . "'";
132
  if (preg_match('/\s/', $login_client_id)) {
133
+ $login_client_id = " ** white space detected **";
134
  }
135
+ $login_client_secret = "'" . $login_client_secret . "'";
136
  if (preg_match('/\s/', $login_client_secret)) {
137
+ $login_client_secret .= "** white space detected **";
138
  }
139
+
140
+ $this->log("enabled: ". $login_enabled);
141
+ $this->log("button_type: ". $login_button_type);
142
+ $this->log("popup: ". $login_popup);
143
+ $this->log("client_id: ". $login_client_id);
144
+ $this->log("client_secret: ". $login_client_secret);
145
  }
146
 
147
  private function getModules() {
148
 
149
+ $this->log("\n===== MODULES =====");
150
  $modules_folder = $this->_apppath . "/etc/modules";
151
 
152
  try {
177
  /* filter out core modules and */
178
  if ($v['codePool'] !== 'core') {
179
 
180
+ $this->log("[". $k ."]");
181
  /* get status */
182
+ $this->log(" active: ". $v['active']);
183
 
184
  /* get codepool */
185
+ $this->log(" pool: ". $v['codePool']);
186
 
187
  /* parse the module config.xml */
188
  $modulepath = implode("/", explode("_", $k));
193
  $mxml = json_decode($mxml, true);
194
 
195
  /* get version */
196
+ $this->log(" version: ". $mxml['modules'][$k]['version']);
197
 
198
  /* get global blocks */
199
+ $this->log(" [blocks]");
200
  if (isset($mxml['global']['blocks'])) {
201
  foreach ($mxml['global']['blocks'] as $mk => $mv) {
202
+ $this->log(" ". $mk);
203
  }
204
  }
205
+ $this->log("");
206
  }
207
  }
208
  }
211
  }
212
  } catch (Exception $e) {
213
  /* log any errors */
214
+ $this->log("Error in module list: ". $e->getMessage());
215
  }
216
  @closedir($h);
 
217
  }
218
 
219
  private function getLogs() {
220
 
221
  try {
222
+ echo "\n===== EXCEPTION LOG =====\n";
223
  /* get list of log files */
224
  if ($h = opendir($this->_logpath)) {
225
 
226
  /* loop through the files */
227
  while (false !== ($entry = readdir($h))) {
228
 
229
+ /* we don't want . and ..
230
+ * modified to only check exception.log for now. will remove if needed
231
+ * but it felt extaneous.
232
+ */
233
+ if ($entry !== "." && $entry !== ".." && $entry == "exception.log") {
234
+
235
+ $amazon_lines = array(); // store occurrences of all lines containing 'amazon'
236
+ $tail_amount = 25; //
237
+ $cnt = 0; // keep track of current line number
238
+ $lines_before = 10; // number of lines before 'amazon' to keep
239
+ $lines_after = 10; // number of lines after 'amazon' to keep
240
+
241
+ /* get relevant portions of all log files. this is a list of all occurrences of 'amazon'
242
+ * including 'lines_before'/'lines_after' both before and after the line.
243
+ */
244
  $lh = @fopen($this->_logpath . "/" . $entry, "r");
245
  if ($lh) {
246
+ $logname = pathinfo($this->_logpath . "/" . $entry, PATHINFO_FILENAME);
247
  while (($buffer = fgets($lh, 8192)) !== false) {
248
+ $buffer = trim($buffer);
249
+ if($buffer !== "") {
250
+ if(stristr($buffer, 'amazon')) {
251
+ if(($cnt - $lines_before) >= 0) {
252
+ $amazon_lines[] = array($cnt - $lines_before, $cnt + $lines_after);
253
+ } else {
254
+ $amazon_lines[] = array(0, $cnt + $lines_after);
255
+ }
256
+ }
257
+ $cnt++;
258
  }
259
  }
 
260
  } else {
 
261
  /* couldn't read the file */
262
+ echo "Could not read ". $logname ." log.\n";
263
+ }
264
+
265
+ $newa = array(); // new temporary array to store lines
266
+ foreach($amazon_lines as $k => $v) {
267
+ foreach(range($v[0], $v[1]) as $r) {
268
+ if(!in_array($r, $newa)) {
269
+ $newa[$r] = 1;
270
+ }
271
+ if($r == $v[1]) {
272
+ $newa[] = 0; // where to snip
273
+ }
274
+ }
275
  }
276
+
277
+ rewind($lh);
278
+
279
+ $cnt = 0; // reset line number
280
+ $relevant_lines = array();
281
+ while (($buffer = fgets($lh, 8192)) !== false) {
282
+ $buffer = trim($buffer);
283
+ if($buffer !== "") {
284
+ foreach($newa as $k => $v) {
285
+ if($cnt == $k) {
286
+ echo $buffer ."\n";
287
+ if($v == 0) {
288
+ echo "\n---------- snip ----------\n\n";
289
+ }
290
+ }
291
+ }
292
+ $cnt++;
293
+ }
294
+ }
295
+
296
  @fclose($lh);
297
  }
298
  }
299
  }
300
  } catch (Exception $e) {
301
  /* log any errors */
302
+ $this->log("Error getting logs: ". $e->getMessage());
303
  }
304
  @closedir($h);
 
305
  }
306
 
307
+ private function log($s) {
308
+ echo $s ."\n";
309
+ }
310
  }
app/code/community/Amazon/Diagnostics/etc/config.xml CHANGED
@@ -10,7 +10,7 @@
10
  <config>
11
  <modules>
12
  <Amazon_Diagnostics>
13
- <version>1.0.0</version>
14
  </Amazon_Diagnostics>
15
  </modules>
16
  <global>
10
  <config>
11
  <modules>
12
  <Amazon_Diagnostics>
13
+ <version>1.1.0</version>
14
  </Amazon_Diagnostics>
15
  </modules>
16
  <global>
app/code/community/Amazon/Diagnostics/etc/system.xml CHANGED
@@ -11,48 +11,56 @@
11
  -->
12
  <config>
13
  <sections>
14
- <dev>
15
  <groups>
16
- <diagnostics translate="label">
17
- <label>Login and Pay with Amazon Diagnostics</label>
18
- <frontend_type>text</frontend_type>
19
- <sort_order>0</sort_order>
20
- <show_in_default>1</show_in_default>
21
- <show_in_website>1</show_in_website>
22
- <show_in_store>0</show_in_store>
23
- <comment>
24
- <![CDATA[
25
- Login and Pay with Amazon Diagnostics can be used to help developers troubleshoot your Login and Pay with Amazon integration.
26
- <br/>
27
- <div style="clear:both;"></div>
28
- ]]>
29
- </comment>
30
  <fields>
31
- <check translate="label">
32
- <frontend_type>button</frontend_type>
33
- <frontend_model>amazon_diagnostics/adminhtml_system_config_form_button</frontend_model>
34
- <sort_order>0</sort_order>
35
- <show_in_default>1</show_in_default>
36
- <show_in_website>1</show_in_website>
37
- <show_in_store>0</show_in_store>
38
- </check>
39
- <results translate='label'>
40
- <label>Results:</label>
41
- <comment>
42
- <![CDATA[
43
- Copy/paste results to developer support if requested.
44
- ]]>
45
- </comment>
46
- <frontend_type>textarea</frontend_type>
47
- <frontend_model>amazon_diagnostics/adminhtml_system_config_form_textarea</frontend_model>
48
- <sort_order>5</sort_order>
49
- <show_in_default>1</show_in_default>
50
- <show_in_website>1</show_in_website>
51
- <show_in_store>0</show_in_store>
52
- </results>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  </fields>
54
- </diagnostics>
55
  </groups>
56
- </dev>
57
  </sections>
58
  </config>
11
  -->
12
  <config>
13
  <sections>
14
+ <payment>
15
  <groups>
16
+ <amazon_payments translate="label">
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  <fields>
18
+ <ap_developer type="group" translate="label">
19
+ <fields>
20
+ <ap_diagnostics type="group" translate="label">
21
+ <label>Amazon Diagnostics</label>
22
+ <frontend_type>text</frontend_type>
23
+ <sort_order>1000</sort_order>
24
+ <show_in_default>1</show_in_default>
25
+ <show_in_website>1</show_in_website>
26
+ <show_in_store>0</show_in_store>
27
+ <comment>
28
+ <![CDATA[
29
+ Amazon Diagnostics can be used to help developers troubleshoot your Amazon Payments integration.
30
+ <br/>
31
+ <div style="clear:both;"></div>
32
+ ]]>
33
+ </comment>
34
+ <fields>
35
+ <check translate="label">
36
+ <frontend_type>button</frontend_type>
37
+ <frontend_model>amazon_diagnostics/adminhtml_system_config_form_button</frontend_model>
38
+ <sort_order>0</sort_order>
39
+ <show_in_default>1</show_in_default>
40
+ <show_in_website>1</show_in_website>
41
+ <show_in_store>0</show_in_store>
42
+ </check>
43
+ <results translate='label'>
44
+ <label>Results:</label>
45
+ <comment>
46
+ <![CDATA[
47
+ Copy/paste results to developer support if requested.
48
+ ]]>
49
+ </comment>
50
+ <frontend_type>textarea</frontend_type>
51
+ <frontend_model>amazon_diagnostics/adminhtml_system_config_form_textarea</frontend_model>
52
+ <sort_order>5</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>0</show_in_store>
56
+ </results>
57
+ </fields>
58
+ </ap_diagnostics>
59
+ </fields>
60
+ </ap_developer>
61
  </fields>
62
+ </amazon_payments>
63
  </groups>
64
+ </payment>
65
  </sections>
66
  </config>
app/code/community/Amazon/Login/Block/Button.php DELETED
@@ -1,47 +0,0 @@
1
- <?php
2
- /**
3
- * Amazon Login
4
- *
5
- * @category Amazon
6
- * @package Amazon_Login
7
- * @copyright Copyright (c) 2014 Amazon.com
8
- * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
- */
10
-
11
- class Amazon_Login_Block_Button extends Mage_Core_Block_Template
12
- {
13
- public function getButtonImage()
14
- {
15
- $button = '';
16
-
17
- switch (Mage::getStoreConfig('amazon_login/settings/button_color')) {
18
- case 'DarkGray':
19
- $button .= '_drkgry_';
20
- break;
21
- case 'LightGray':
22
- $button .= '_gry_';
23
- break;
24
- default:
25
- $button .= '_gold_';
26
- break;
27
- }
28
-
29
- $isLarge = (Mage::getStoreConfig('amazon_login/settings/button_size') == 'large');
30
-
31
- switch (Mage::getStoreConfig('amazon_login/settings/button_type')) {
32
- case 'Login':
33
- $button .= $isLarge ? '152x64' : '76x32';
34
- break;
35
- case 'A':
36
- $button .= $isLarge ? '64x64' : '32x32';
37
- break;
38
- default:
39
- $button .= $isLarge ? '312x64' : '156x32';
40
- break;
41
- }
42
-
43
- return 'https://images-na.ssl-images-amazon.com/images/G/01/lwa/btnLWA' . $button . '.png';
44
-
45
- }
46
-
47
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Amazon/Login/Block/Script.php DELETED
@@ -1,56 +0,0 @@
1
- <?php
2
- /**
3
- * Amazon Login
4
- *
5
- * @category Amazon
6
- * @package Amazon_Login
7
- * @copyright Copyright (c) 2014 Amazon.com
8
- * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
- */
10
-
11
- class Amazon_Login_Block_Script extends Mage_Core_Block_Template
12
- {
13
-
14
- /**
15
- * Is popup window?
16
- *
17
- * @return bool
18
- */
19
- public function isPopup()
20
- {
21
- return ($this->helper('amazon_login')->isPopup());
22
- }
23
-
24
- /**
25
- * Is sandbox mode?
26
- */
27
- public function isSandboxEnabled()
28
- {
29
- return (Mage::getStoreConfig('payment/amazon_payments/sandbox'));
30
- }
31
-
32
- /**
33
- * Get client ID
34
- */
35
- public function getClientId()
36
- {
37
- return Mage::getModel('amazon_login/api')->getClientId();
38
- }
39
-
40
- /**
41
- * Get additional scope
42
- */
43
- public function getAdditionalScope()
44
- {
45
- return $this->helper('amazon_login')->getAdditionalScope();
46
- }
47
-
48
- /**
49
- * Get login auth URL
50
- */
51
- public function getLoginAuthUrl()
52
- {
53
- return $this->helper('amazon_login')->getLoginAuthUrl();
54
- }
55
-
56
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Amazon/Login/Helper/Data.php DELETED
@@ -1,67 +0,0 @@
1
- <?php
2
- /**
3
- * Login with Amazon Helper
4
- *
5
- * @category Amazon
6
- * @package Amazon_Login
7
- * @copyright Copyright (c) 2014 Amazon.com
8
- * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
- */
10
-
11
- class Amazon_Login_Helper_Data extends Mage_Core_Helper_Abstract
12
- {
13
- /**
14
- * Retrieve customer verify url
15
- *
16
- * @return string
17
- */
18
- public function getVerifyUrl()
19
- {
20
- return $this->_getUrl('amazon_login/customer/verify');
21
- }
22
-
23
- /**
24
- * Retrieve Amazon Profile in session
25
- */
26
- public function getAmazonProfileSession()
27
- {
28
- return Mage::getSingleton('customer/session')->getAmazonProfile();
29
- }
30
-
31
- /**
32
- * Retreive additional login access scope
33
- */
34
- public function getAdditionalScope()
35
- {
36
- $scope = trim(Mage::getStoreConfig('amazon_login/settings/additional_scope'));
37
- return ($scope) ? ' ' . $scope : '';
38
- }
39
-
40
- /**
41
- * Return login authorize URL
42
- *
43
- * @return string
44
- */
45
- public function getLoginAuthUrl()
46
- {
47
- return $this->_getUrl('amazon_login/customer/authorize', array('_forced_secure' => true));
48
- }
49
-
50
- /**
51
- * Is login a popup or full-page redirect?
52
- */
53
- public function isPopup()
54
- {
55
- return (Mage::getStoreConfig('amazon_login/settings/popup'));
56
- }
57
-
58
- /**
59
- * Is Amazon_Login enabled in config?
60
- */
61
- public function isEnabled()
62
- {
63
- return (Mage::getStoreConfig('amazon_login/settings/enabled'));
64
- }
65
-
66
-
67
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Amazon/Login/Model/Login.php DELETED
@@ -1,18 +0,0 @@
1
- <?php
2
- /**
3
- * Login with Amazon
4
- *
5
- * @category Amazon
6
- * @package Amazon_Login
7
- * @copyright Copyright (c) 2014 Amazon.com
8
- * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
- */
10
-
11
- class Amazon_Login_Model_Login extends Mage_Core_Model_Abstract
12
- {
13
- public function _construct()
14
- {
15
- parent::_construct();
16
- $this->_init('amazon_login/login');
17
- }
18
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Amazon/Login/Model/Resource/Login.php DELETED
@@ -1,17 +0,0 @@
1
- <?php
2
- /**
3
- * Login with Amazon
4
- *
5
- * @category Amazon
6
- * @package Amazon_Login
7
- * @copyright Copyright (c) 2014 Amazon.com
8
- * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
- */
10
-
11
- class Amazon_Login_Model_Resource_Login extends Mage_Core_Model_Mysql4_Abstract
12
- {
13
- public function _construct()
14
- {
15
- $this->_init('amazon_login/login', 'login_id');
16
- }
17
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Amazon/Login/Model/System/Config/Backend/Enabled.php DELETED
@@ -1,53 +0,0 @@
1
- <?php
2
- /**
3
- * Validate Client ID and Client Secret
4
- *
5
- * @category Amazon
6
- * @package Amazon_Login
7
- * @copyright Copyright (c) 2014 Amazon.com
8
- * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
- */
10
-
11
- class Amazon_Login_Model_System_Config_Backend_Enabled extends Mage_Core_Model_Config_Data
12
- {
13
- /**
14
- * Perform API call to Amazon to validate Client ID/Secret
15
- *
16
- */
17
- public function save()
18
- {
19
- $data = $this->getFieldsetData();
20
- $isEnabled = $this->getValue();
21
-
22
- if ($data['client_id'] && $data['client_secret']) {
23
- $_api = Mage::getModel('amazon_login/api');
24
-
25
- // REST API params
26
- $params = array(
27
- 'grant_type' => 'authorization_code',
28
- 'code' => 'SplxlOBeZQQYbYS6WxSbIA', // Dummy code from docs
29
- 'client_id' => trim($data['client_id']),
30
- 'client_secret' => trim($data['client_secret']),
31
- );
32
-
33
- $response = $_api->request('auth/o2/token', $params);
34
-
35
- if (!$response) {
36
- Mage::getSingleton('core/session')->addError('Error: Unable to perform HTTP request to Amazon API.');
37
- }
38
- else if ($response && isset($response['error'])) {
39
- if ($response['error'] == 'invalid_client') {
40
- Mage::getSingleton('core/session')->addError('Client authentication failed. Please verify your Client ID and Client Secret.');
41
- $this->setValue(0); // Set "Enabled" to "No"
42
- }
43
- else {
44
- Mage::getSingleton('core/session')->addSuccess('Successfully connected to Amazon API with Client ID and Client Secret.');
45
- }
46
- }
47
- }
48
-
49
-
50
- return parent::save();
51
- }
52
- }
53
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Amazon/Login/Model/System/Config/Source/Buttoncolor.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
- /**
3
- * Amazon Login
4
- *
5
- * @category Amazon
6
- * @package Amazon_Login
7
- * @copyright Copyright (c) 2014 Amazon.com
8
- * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
- */
10
-
11
- class Amazon_Login_Model_System_Config_Source_Buttoncolor
12
- {
13
- public function toOptionArray()
14
- {
15
- return array(
16
- array('value'=>'Gold', 'label'=>Mage::helper('adminhtml')->__('Gold')),
17
- array('value'=>'DarkGray', 'label'=>Mage::helper('adminhtml')->__('Dark Gray')),
18
- array('value'=>'LightGray', 'label'=>Mage::helper('adminhtml')->__('Light Gray')),
19
- );
20
- }
21
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Amazon/Login/Model/System/Config/Source/Buttonsize.php DELETED
@@ -1,20 +0,0 @@
1
- <?php
2
- /**
3
- * Amazon Login
4
- *
5
- * @category Amazon
6
- * @package Amazon_Login
7
- * @copyright Copyright (c) 2014 Amazon.com
8
- * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
- */
10
-
11
- class Amazon_Login_Model_System_Config_Source_Buttonsize
12
- {
13
- public function toOptionArray()
14
- {
15
- return array(
16
- array('value'=>'medium', 'label'=>Mage::helper('adminhtml')->__('Medium')),
17
- array('value'=>'large', 'label'=>Mage::helper('adminhtml')->__('Large')),
18
- );
19
- }
20
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Amazon/Login/Model/System/Config/Source/Buttontype.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
- /**
3
- * Amazon Login
4
- *
5
- * @category Amazon
6
- * @package Amazon_Login
7
- * @copyright Copyright (c) 2014 Amazon.com
8
- * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
- */
10
-
11
- class Amazon_Login_Model_System_Config_Source_Buttontype
12
- {
13
- public function toOptionArray()
14
- {
15
- return array(
16
- array('value'=>'LwA', 'label'=>Mage::helper('adminhtml')->__('Login with Amazon')),
17
- array('value'=>'Login', 'label'=>Mage::helper('adminhtml')->__('Login')),
18
- array('value'=>'A', 'label'=>Mage::helper('adminhtml')->__('Amazon logo')),
19
- );
20
- }
21
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Amazon/Login/etc/adminhtml.xml DELETED
@@ -1,34 +0,0 @@
1
- <?xml version="1.0"?>
2
- <!--
3
- /**
4
- * @category Amazon
5
- * @package Amazon_Login
6
- * @copyright Copyright (c) 2014 Amazon.com
7
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
- */
9
- -->
10
- <config>
11
- <acl>
12
- <resources>
13
- <all>
14
- <title>Allow Everything</title>
15
- </all>
16
- <admin>
17
- <children>
18
- <system>
19
- <children>
20
- <config>
21
- <children>
22
- <amazon_login translate="title">
23
- <title>Login with Amazon</title>
24
- <sort_order>100</sort_order>
25
- </amazon_login>
26
- </children>
27
- </config>
28
- </children>
29
- </system>
30
- </children>
31
- </admin>
32
- </resources>
33
- </acl>
34
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Amazon/Login/etc/config.xml DELETED
@@ -1,101 +0,0 @@
1
- <?xml version="1.0"?>
2
- <!--
3
- /**
4
- * @category Amazon
5
- * @package Amazon_Login
6
- * @copyright Copyright (c) 2014 Amazon.com
7
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
- */
9
- -->
10
- <config>
11
- <modules>
12
- <Amazon_Login>
13
- <version>0.1.0</version>
14
- </Amazon_Login>
15
- </modules>
16
- <global>
17
- <blocks>
18
- <amazon_login>
19
- <class>Amazon_Login_Block</class>
20
- </amazon_login>
21
- </blocks>
22
- <models>
23
- <amazon_login>
24
- <class>Amazon_Login_Model</class>
25
- <resourceModel>login_mysql4</resourceModel>
26
- </amazon_login>
27
- <login_mysql4>
28
- <class>Amazon_Login_Model_Resource</class>
29
- <entities>
30
- <login>
31
- <table>amazon_login</table>
32
- </login>
33
- </entities>
34
- </login_mysql4>
35
- </models>
36
-
37
- <resources>
38
- <login_setup>
39
- <setup>
40
- <module>Amazon_Login</module>
41
- </setup>
42
- <connection>
43
- <use>core_setup</use>
44
- </connection>
45
- </login_setup>
46
- <login_write>
47
- <connection>
48
- <use>core_write</use>
49
- </connection>
50
- </login_write>
51
- <login_read>
52
- <connection>
53
- <use>core_read</use>
54
- </connection>
55
- </login_read>
56
- </resources>
57
-
58
- <helpers>
59
- <amazon_login>
60
- <class>Amazon_Login_Helper</class>
61
- </amazon_login>
62
- </helpers>
63
- </global>
64
-
65
-
66
-
67
- <frontend>
68
- <secure_url>
69
- <amazon_login_verify>/amazon_login/customer/verify</amazon_login_verify>
70
- </secure_url>
71
- <routers>
72
- <amazon_login>
73
- <use>standard</use>
74
- <args>
75
- <module>Amazon_Login</module>
76
- <frontName>amazon_login</frontName>
77
- </args>
78
- </amazon_login>
79
- </routers>
80
- <layout>
81
- <updates>
82
- <amazon_login>
83
- <file>amazon_login.xml</file>
84
- </amazon_login>
85
- </updates>
86
- </layout>
87
- </frontend>
88
-
89
- <default>
90
- <amazon_login>
91
- <settings>
92
- <enabled>1</enabled>
93
- <popup>1</popup>
94
- <button_type>LwA</button_type>
95
- <button_color>Gold</button_color>
96
- <button_size>medium</button_size>
97
- </settings>
98
- </amazon_login>
99
- </default>
100
-
101
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Amazon/Login/etc/system.xml DELETED
@@ -1,155 +0,0 @@
1
- <?xml version="1.0"?>
2
- <!--
3
- /**
4
- * Login with Amazon
5
- *
6
- * @category Amazon
7
- * @package Amazon_Login
8
- * @copyright Copyright (c) 2014 Amazon.com
9
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
10
- */
11
- -->
12
- <config>
13
- <sections>
14
- <amazon_login translate="label">
15
- <label>Login with Amazon</label>
16
- <tab>customer</tab>
17
- <frontend_type>text</frontend_type>
18
- <sort_order>1000</sort_order>
19
- <show_in_default>1</show_in_default>
20
- <show_in_website>1</show_in_website>
21
- <show_in_store>1</show_in_store>
22
-
23
- <groups>
24
- <settings translate="label">
25
- <label>Settings</label>
26
- <frontend_type>text</frontend_type>
27
- <sort_order>100</sort_order>
28
- <show_in_default>1</show_in_default>
29
- <show_in_website>1</show_in_website>
30
- <show_in_store>1</show_in_store>
31
- <comment>
32
- <![CDATA[
33
-
34
- <a href="http://login.amazon.com/" target="_blank"><img src="http://g-ecx.images-amazon.com/images/G/01/lwa/common/images/lwa_dev_logo._V371482133_.png" /></a>
35
- <br/>
36
- <strong>Setup</strong>
37
- <ol style="list-style:inside decimal;">
38
- <li>Access your client credentials by registering a new application through <a href="https://sellercentral.amazon.com/" target="_blank">Amazon Seller Central</a>.
39
- <li>Whitelist your domain under "Allowed JavaScript Origins."
40
- <li>Under General->Web, enable "Use Secure URLs in Frontend." (HTTPS is required.)
41
- <li>Amazon Payments (Login and Pay) is configured under Sales->Payment Methods.
42
- </ol>
43
-
44
-
45
- <div style="clear:both;"></div>
46
- ]]>
47
- </comment>
48
- <fields>
49
-
50
- <enabled translate="label">
51
- <label>Enabled</label>
52
- <frontend_type>select</frontend_type>
53
- <source_model>adminhtml/system_config_source_yesno</source_model>
54
- <backend_model>amazon_login/system_config_backend_enabled</backend_model>
55
- <sort_order>10</sort_order>
56
- <show_in_default>1</show_in_default>
57
- <show_in_website>1</show_in_website>
58
- <show_in_store>1</show_in_store>
59
- </enabled>
60
-
61
- <client_id translate="label">
62
- <label>Client ID</label>
63
- <frontend_type>text</frontend_type>
64
- <sort_order>20</sort_order>
65
- <show_in_default>1</show_in_default>
66
- <show_in_website>1</show_in_website>
67
- <show_in_store>1</show_in_store>
68
- </client_id>
69
-
70
- <client_secret translate="label">
71
- <label>Client Secret</label>
72
- <frontend_type>text</frontend_type>
73
- <sort_order>30</sort_order>
74
- <show_in_default>1</show_in_default>
75
- <show_in_website>1</show_in_website>
76
- <show_in_store>1</show_in_store>
77
- </client_secret>
78
-
79
- <popup translate="label">
80
- <label>Pop-up</label>
81
- <comment><model>amazon_login/system_config_backend_popupcomment</model></comment>
82
- <frontend_type>select</frontend_type>
83
- <source_model>adminhtml/system_config_source_yesno</source_model>
84
- <sort_order>40</sort_order>
85
- <show_in_default>1</show_in_default>
86
- <show_in_website>1</show_in_website>
87
- <show_in_store>1</show_in_store>
88
- </popup>
89
-
90
- <heading_button translate="label">
91
- <label>Button Style</label>
92
- <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
93
- <sort_order>70</sort_order>
94
- <show_in_default>1</show_in_default>
95
- <show_in_website>1</show_in_website>
96
- <show_in_store>0</show_in_store>
97
- </heading_button>
98
-
99
- <button_type translate="label">
100
- <label>Button Label</label>
101
- <frontend_type>select</frontend_type>
102
- <source_model>amazon_login/system_config_source_buttontype</source_model>
103
- <sort_order>71</sort_order>
104
- <show_in_default>1</show_in_default>
105
- <show_in_website>1</show_in_website>
106
- <show_in_store>1</show_in_store>
107
- </button_type>
108
-
109
- <button_color translate="label">
110
- <label>Button Color</label>
111
- <frontend_type>select</frontend_type>
112
- <source_model>amazon_login/system_config_source_buttoncolor</source_model>
113
- <sort_order>72</sort_order>
114
- <show_in_default>1</show_in_default>
115
- <show_in_website>1</show_in_website>
116
- <show_in_store>1</show_in_store>
117
- </button_color>
118
-
119
- <button_size translate="label">
120
- <label>Button Size</label>
121
- <frontend_type>select</frontend_type>
122
- <source_model>amazon_login/system_config_source_buttonsize</source_model>
123
- <sort_order>73</sort_order>
124
- <show_in_default>1</show_in_default>
125
- <show_in_website>1</show_in_website>
126
- <show_in_store>1</show_in_store>
127
- </button_size>
128
-
129
- <heading_advanced translate="label">
130
- <label>Advanced</label>
131
- <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
132
- <sort_order>110</sort_order>
133
- <show_in_default>1</show_in_default>
134
- <show_in_website>1</show_in_website>
135
- </heading_advanced>
136
-
137
- <additional_scope translate="label">
138
- <label>Additional Access Scope</label>
139
- <comment>
140
- <![CDATA[Optional access scope strings during login.]]>
141
- </comment>
142
- <frontend_type>text</frontend_type>
143
- <sort_order>120</sort_order>
144
- <show_in_default>1</show_in_default>
145
- <show_in_website>1</show_in_website>
146
- <show_in_store>1</show_in_store>
147
- </additional_scope>
148
-
149
- </fields>
150
- </settings>
151
- </groups>
152
-
153
- </amazon_login>
154
- </sections>
155
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Amazon/Login/sql/login_setup/install-0.1.0.php DELETED
@@ -1,46 +0,0 @@
1
- <?php
2
- /**
3
- * Amazon Login
4
- *
5
- * @category Amazon
6
- * @package Amazon_Login
7
- * @copyright Copyright (c) 2014 Amazon.com
8
- * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
- */
10
-
11
- $installer = $this;
12
-
13
- $installer->startSetup();
14
-
15
- $amazon_table = $installer->getConnection()
16
- ->newTable($installer->getTable('amazon_login/login'))
17
- ->addColumn('login_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
18
- 'identity' => true,
19
- 'unsigned' => true,
20
- 'nullable' => false,
21
- 'primary' => true
22
- ), 'Login ID')
23
- ->addColumn('customer_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array (
24
- 'nullable' => false,
25
- 'unsigned' => true
26
- ), 'Customer Entity ID')
27
- ->addColumn('amazon_uid', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array (
28
- 'nullable' => true,
29
- 'unsigned' => true
30
- ), 'Amazon User ID')
31
- ->addIndex($installer->getIdxName('amazon_login/login', array('customer_id')), array('customer_id'))
32
- ->addIndex($installer->getIdxName('amazon_login/login', array('amazon_uid')), array('amazon_uid'));
33
-
34
- $installer->getConnection()->createTable($amazon_table);
35
-
36
- $installer->getConnection()->addConstraint(
37
- 'fk_amazon_login_customer_entity_id',
38
- $installer->getTable('amazon_login/login'),
39
- 'customer_id',
40
- $installer->getTable('customer/entity'),
41
- 'entity_id',
42
- 'cascade',
43
- 'restrict'
44
- );
45
-
46
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Amazon/Payments/Block/Adminhtml/System/Config/Simplepathimport.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Amazon_Payments_Block_Adminhtml_System_Config_Simplepathimport extends Mage_Adminhtml_Block_System_Config_Form_Field implements Varien_Data_Form_Element_Renderer_Interface{
4
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
5
+ {
6
+ $buttonBlock = Mage::app()->getLayout()->createBlock('adminhtml/widget_button');
7
+
8
+ $params = array(
9
+ 'website' => $buttonBlock->getRequest()->getParam('website')
10
+ );
11
+
12
+ $data = array(
13
+ 'label' => Mage::helper('adminhtml')->__('Import From Clipboard'),
14
+ 'onclick' => 'return false;',
15
+ 'class' => '',
16
+ );
17
+
18
+ $html = $buttonBlock->setData($data)->toHtml();
19
+
20
+ return $html;
21
+ }
22
+ }
app/code/community/Amazon/Payments/Block/Button.php CHANGED
@@ -54,7 +54,7 @@ class Amazon_Payments_Block_Button extends Mage_Core_Block_Template
54
  */
55
  public function getAdditionalScope()
56
  {
57
- return $this->helper('amazon_login')->getAdditionalScope();
58
  }
59
 
60
  /**
@@ -90,6 +90,7 @@ class Amazon_Payments_Block_Button extends Mage_Core_Block_Template
90
  {
91
  return !Mage::getSingleton('checkout/session')->getQuote()->validateMinimumAmount();
92
  }
 
93
  /**
94
  * Is Amazon Login enabled?
95
  *
@@ -97,7 +98,7 @@ class Amazon_Payments_Block_Button extends Mage_Core_Block_Template
97
  */
98
  public function isAmazonLoginEnabled()
99
  {
100
- return $this->helper('amazon_login')->isEnabled();
101
  }
102
 
103
  /**
@@ -144,7 +145,14 @@ class Amazon_Payments_Block_Button extends Mage_Core_Block_Template
144
  */
145
  public function isPopup()
146
  {
147
- return ($this->helper('amazon_login')->isPopup());
 
 
 
 
 
 
 
148
  }
149
 
150
  }
54
  */
55
  public function getAdditionalScope()
56
  {
57
+ return $this->helper('amazon_payments')->getAdditionalScope();
58
  }
59
 
60
  /**
90
  {
91
  return !Mage::getSingleton('checkout/session')->getQuote()->validateMinimumAmount();
92
  }
93
+
94
  /**
95
  * Is Amazon Login enabled?
96
  *
98
  */
99
  public function isAmazonLoginEnabled()
100
  {
101
+ return $this->helper('amazon_payments')->isEnabled();
102
  }
103
 
104
  /**
145
  */
146
  public function isPopup()
147
  {
148
+ // Use redirect for sidecart/minicart pay button
149
+ if ($this->getNameInLayout() == 'AmazonPayButtonSideCart'
150
+ && !Mage::app()->getStore()->isCurrentlySecure()
151
+ ) {
152
+ return 0;
153
+ }
154
+
155
+ return ($this->helper('amazon_payments')->isPopup());
156
  }
157
 
158
  }
app/code/community/Amazon/Payments/Block/Login/Button.php ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Amazon Login
4
+ *
5
+ * @category Amazon
6
+ * @package Amazon_Payments
7
+ * @copyright Copyright (c) 2014 Amazon.com
8
+ * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
+ */
10
+
11
+ class Amazon_Payments_Block_Login_Button extends Mage_Core_Block_Template
12
+ {
13
+ public function getButtonImage()
14
+ {
15
+ $config = Mage::getSingleton('amazon_payments/config');
16
+ $button = '';
17
+
18
+ switch ($config->getButtonColor()) {
19
+ case 'DarkGray':
20
+ $button .= '_drkgry_';
21
+ break;
22
+ case 'LightGray':
23
+ $button .= '_gry_';
24
+ break;
25
+ default:
26
+ $button .= '_gold_';
27
+ break;
28
+ }
29
+
30
+ $isLarge = ($config->getButtonSize() == 'large');
31
+
32
+ switch ($config->getButtonType()) {
33
+ case 'PwA':
34
+ $button .= $isLarge ? '152x64' : '76x32';
35
+ break;
36
+ case 'A':
37
+ $button .= $isLarge ? '64x64' : '32x32';
38
+ break;
39
+ default:
40
+ $button .= $isLarge ? '312x64' : '156x32';
41
+ break;
42
+ }
43
+
44
+ return 'https://images-na.ssl-images-amazon.com/images/G/01/lwa/btnLWA' . $button . '.png';
45
+ }
46
+
47
+ /**
48
+ * Is Amazon Payments enabled?
49
+ *
50
+ * @return bool
51
+ */
52
+ public function isAmazonPaymentsEnabled()
53
+ {
54
+ return $this->helper('amazon_payments')->isEnabled();
55
+ }
56
+
57
+ /**
58
+ * Is popup window?
59
+ *
60
+ * @return bool
61
+ */
62
+ public function isPopup()
63
+ {
64
+ return ($this->helper('amazon_payments')->isPopup());
65
+ }
66
+
67
+ /**
68
+ * Get additional login scope
69
+ */
70
+ public function getAdditionalScope()
71
+ {
72
+ return $this->helper('amazon_payments')->getAdditionalScope();
73
+ }
74
+
75
+ /**
76
+ * Get button type
77
+ */
78
+ public function getButtonType()
79
+ {
80
+ $type = Mage::getSingleton('amazon_payments/config')->getButtonType();
81
+
82
+ // Change "Pay" buttons to "Login"
83
+ switch ($type) {
84
+ case 'PwA': $type = 'LwA'; break;
85
+ case 'Pay': $type = 'Login'; break;
86
+ }
87
+
88
+ return $type;
89
+ }
90
+
91
+ /**
92
+ * Get button size
93
+ */
94
+ public function getButtonSize()
95
+ {
96
+ return Mage::getSingleton('amazon_payments/config')->getButtonSize();
97
+ }
98
+
99
+ /**
100
+ * Get button color
101
+ */
102
+ public function getButtonColor()
103
+ {
104
+ return Mage::getSingleton('amazon_payments/config')->getButtonColor();
105
+ }
106
+
107
+ /**
108
+ * Return seller ID
109
+ */
110
+ public function getSellerId()
111
+ {
112
+ return $this->helper('amazon_payments')->getSellerId();
113
+ }
114
+
115
+ /**
116
+ * Get login auth URL
117
+ */
118
+ public function getLoginAuthUrl()
119
+ {
120
+ return $this->getUrl('amazon_payments/checkout/authorize', array('_forced_secure'=>true));
121
+ }
122
+
123
+ /**
124
+ * Return URL to use for checkout
125
+ */
126
+ public function getCheckoutUrl()
127
+ {
128
+ return $this->helper('amazon_payments')->getCheckoutUrl() . 'account/redirect';
129
+ }
130
+
131
+ }
app/code/community/Amazon/Payments/Block/Login/Script.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Amazon Login
4
+ *
5
+ * @category Amazon
6
+ * @package Amazon_Payments
7
+ * @copyright Copyright (c) 2014 Amazon.com
8
+ * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
+ */
10
+
11
+ class Amazon_Payments_Block_Login_Script extends Mage_Core_Block_Template
12
+ {
13
+
14
+ /**
15
+ * Return Widgets.js URL
16
+ */
17
+ public function getWidgetsUrl()
18
+ {
19
+ switch (Mage::getStoreConfig('amazon_login/settings/region')) {
20
+ case 'uk':
21
+ $staticRegion = 'eu';
22
+ $widgetRegion = 'uk';
23
+ $lpa = 'lpa/';
24
+ break;
25
+
26
+ case 'de':
27
+ $staticRegion = 'eu';
28
+ $widgetRegion = 'de';
29
+ $lpa = 'lpa/';
30
+ break;
31
+
32
+ // US
33
+ default:
34
+ $staticRegion = 'na';
35
+ $widgetRegion = 'us';
36
+ $lpa = '';
37
+ break;
38
+ }
39
+
40
+ $sandbox = $this->isSandboxEnabled() ? 'sandbox/' : '';
41
+
42
+ return "https://static-$staticRegion.payments-amazon.com/OffAmazonPayments/$widgetRegion/{$sandbox}{$lpa}js/Widgets.js?sellerId=" . $this->getSellerId();
43
+ }
44
+
45
+ /**
46
+ * Is popup window?
47
+ *
48
+ * @return bool
49
+ */
50
+ public function isPopup()
51
+ {
52
+ return ($this->helper('amazon_payments')->isPopup());
53
+ }
54
+
55
+ /**
56
+ * Is sandbox mode?
57
+ */
58
+ public function isSandboxEnabled()
59
+ {
60
+ return (Mage::getStoreConfig('payment/amazon_payments/sandbox'));
61
+ }
62
+
63
+ /**
64
+ * Get client ID
65
+ */
66
+ public function getClientId()
67
+ {
68
+ return Mage::getModel('amazon_payments/config')->getClientId();
69
+ }
70
+
71
+ /**
72
+ * Return seller ID
73
+ */
74
+ public function getSellerId()
75
+ {
76
+ return $this->helper('amazon_payments')->getSellerId();
77
+ }
78
+
79
+ /**
80
+ * Get additional scope
81
+ */
82
+ public function getAdditionalScope()
83
+ {
84
+ return $this->helper('amazon_payments')->getAdditionalScope();
85
+ }
86
+
87
+ /**
88
+ * Get login auth URL
89
+ */
90
+ public function getLoginAuthUrl()
91
+ {
92
+ return $this->helper('amazon_payments')->getLoginAuthUrl();
93
+ }
94
+
95
+ /**
96
+ * Is Amazon Payments enabled?
97
+ *
98
+ * @return bool
99
+ */
100
+ public function isAmazonPaymentsEnabled()
101
+ {
102
+ return $this->helper('amazon_payments')->isEnabled();
103
+ }
104
+
105
+ }
app/code/community/Amazon/{Login/Block → Payments/Block/Login}/Verify.php RENAMED
@@ -3,22 +3,22 @@
3
  * Amazon Login
4
  *
5
  * @category Amazon
6
- * @package Amazon_Login
7
  * @copyright Copyright (c) 2014 Amazon.com
8
  * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
  */
10
 
11
- class Amazon_Login_Block_Verify extends Mage_Core_Block_Template
12
  {
13
  public function getEmail()
14
  {
15
- $profile = $this->helper('amazon_login')->getAmazonProfileSession();
16
  return $profile['email'];
17
  }
18
 
19
  public function getPostActionUrl()
20
  {
21
- return $this->helper('amazon_login')->getVerifyUrl() . '?redirect=' . htmlentities($this->getRequest()->getParam('redirect'));
22
  }
23
 
24
  public function getForgotPasswordUrl()
3
  * Amazon Login
4
  *
5
  * @category Amazon
6
+ * @package Amazon_Payments
7
  * @copyright Copyright (c) 2014 Amazon.com
8
  * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
  */
10
 
11
+ class Amazon_Payments_Block_Login_Verify extends Mage_Core_Block_Template
12
  {
13
  public function getEmail()
14
  {
15
+ $profile = $this->helper('amazon_payments')->getAmazonProfileSession();
16
  return $profile['email'];
17
  }
18
 
19
  public function getPostActionUrl()
20
  {
21
+ return $this->helper('amazon_payments')->getVerifyUrl() . '?redirect=' . htmlentities($this->getRequest()->getParam('redirect'));
22
  }
23
 
24
  public function getForgotPasswordUrl()
app/code/community/Amazon/Payments/Block/Onepage/Widget.php CHANGED
@@ -43,4 +43,29 @@ class Amazon_Payments_Block_Onepage_Widget extends Mage_Checkout_Block_Onepage_A
43
  //return !$this->getQuote()->isVirtual();
44
  }
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  }
43
  //return !$this->getQuote()->isVirtual();
44
  }
45
 
46
+ /**
47
+ * Get additional form HTML
48
+ *
49
+ * @return string
50
+ */
51
+ public function getAdditionalForm()
52
+ {
53
+ $output = '';
54
+ if (Mage::helper('core')->isModuleEnabled('Amasty_Customerattr')) {
55
+ $output .= Mage::helper('amcustomerattr')->fields();
56
+ }
57
+ return $output;
58
+ }
59
+
60
+ /**
61
+ * Newsletter module availability
62
+ *
63
+ * @return boolean
64
+ */
65
+ public function isNewsletterEnabled()
66
+ {
67
+ return (Mage::helper('core')->isModuleOutputEnabled('Mage_Newsletter') &&
68
+ !Mage::getModel('newsletter/subscriber')->loadByCustomer(Mage::getSingleton('customer/session')->getCustomer())->isSubscribed());
69
+ }
70
+
71
  }
app/code/community/Amazon/Payments/Block/Sales/View.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Amazon Payments
4
+ *
5
+ * @category Amazon
6
+ * @package Amazon_Payments
7
+ * @copyright Copyright (c) 2014 Amazon.com
8
+ * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
+ */
10
+
11
+ class Amazon_Payments_Block_Sales_View extends Mage_Sales_Block_Order_View
12
+ {
13
+
14
+ /**
15
+ * Is order on hold and suspended?
16
+ */
17
+ protected function isSuspended()
18
+ {
19
+ if ($this->getOrder()->getPayment()->getMethod() == 'amazon_payments' && $this->getOrder()->getState() == Mage_Sales_Model_Order::STATE_HOLDED) {
20
+
21
+ $_api = Mage::getModel('amazon_payments/api')->setStore($this->getOrder()->getStoreId());
22
+ $orderReferenceDetails = $_api->getOrderReferenceDetails($this->getAmazonOrderReferenceId());
23
+
24
+ if ($orderReferenceDetails->getOrderReferenceStatus()->getState() == Amazon_Payments_Model_Api::AUTH_STATUS_SUSPENDED) {
25
+ return true;
26
+ }
27
+ }
28
+ return false;
29
+
30
+ }
31
+
32
+ /**
33
+ * Return Amazon Order Reference Id
34
+ */
35
+ protected function getAmazonOrderReferenceId()
36
+ {
37
+ return $this->getOrder()->getPayment()->getAdditionalInformation('order_reference');
38
+ }
39
+
40
+ /**
41
+ * Return seller ID
42
+ */
43
+ public function getSellerId()
44
+ {
45
+ return $this->helper('amazon_payments')->getSellerId();
46
+ }
47
+
48
+
49
+ }
app/code/community/Amazon/Payments/Block/Script.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Amazon Payments
4
+ *
5
+ * @category Amazon
6
+ * @package Amazon_Payments
7
+ * @copyright Copyright (c) 2014 Amazon.com
8
+ * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
+ */
10
+
11
+ class Amazon_Payments_Block_Script extends Mage_Core_Block_Template
12
+ {
13
+ /**
14
+ * Disable loading Widgets.js for <default> (every page) if cart is empty
15
+ */
16
+ protected function _afterToHtml($html)
17
+ {
18
+ if ($this->getIsDefault() && Mage::helper('checkout/cart')->getItemsCount() == 0) {
19
+ return;
20
+ }
21
+ else {
22
+ return $html;
23
+ }
24
+ }
25
+
26
+ /**
27
+ * Return Widgets.js URL
28
+ */
29
+ public function getWidgetsUrl()
30
+ {
31
+ $_helper = $this->helper('amazon_payments');
32
+
33
+ switch ($_helper->getConfig()->getRegion()) {
34
+ case 'uk':
35
+ $staticRegion = 'eu';
36
+ $widgetRegion = 'uk';
37
+ $lpa = 'lpa/';
38
+ break;
39
+
40
+ case 'de':
41
+ $staticRegion = 'eu';
42
+ $widgetRegion = 'de';
43
+ $lpa = 'lpa/';
44
+ break;
45
+
46
+ // US
47
+ default:
48
+ $staticRegion = 'na';
49
+ $widgetRegion = 'us';
50
+ $lpa = '';
51
+ break;
52
+ }
53
+
54
+ $sandbox = $_helper->isAmazonSandbox() ? 'sandbox/' : '';
55
+
56
+ return "https://static-$staticRegion.payments-amazon.com/OffAmazonPayments/$widgetRegion/{$sandbox}{$lpa}js/Widgets.js?sellerId=" . $_helper->getSellerId();
57
+ }
58
+
59
+ /**
60
+ * Return standalone URL
61
+ */
62
+ public function getStandaloneUrl()
63
+ {
64
+ return $this->helper('amazon_payments')->getStandaloneUrl();
65
+ }
66
+
67
+ /**
68
+ * Return client ID
69
+ */
70
+ public function getClientId()
71
+ {
72
+ return $this->helper('amazon_payments')->getClientId();
73
+ }
74
+
75
+ /**
76
+ * Show modal?
77
+ */
78
+ public function showModal()
79
+ {
80
+ return $this->helper('amazon_payments')->showModal();
81
+ }
82
+
83
+ /**
84
+ * Is login pop-up enabled?
85
+ */
86
+ public function isPopup()
87
+ {
88
+ return Mage::helper('amazon_payments/data')->isPopup();
89
+ }
90
+
91
+
92
+ }
app/code/community/Amazon/Payments/Controller/Checkout.php CHANGED
@@ -27,6 +27,7 @@ abstract class Amazon_Payments_Controller_Checkout extends Mage_Checkout_Control
27
  public function preDispatch()
28
  {
29
  parent::preDispatch();
 
30
  $this->_amazonOrderReferenceId = htmlentities($this->getRequest()->getParam('amazon_order_reference_id'));
31
 
32
  if (!$this->_amazonOrderReferenceId) {
@@ -41,7 +42,7 @@ abstract class Amazon_Payments_Controller_Checkout extends Mage_Checkout_Control
41
  $token = htmlentities($this->getRequest()->getParam('access_token'));
42
 
43
  if ($token) {
44
- $_amazonLogin = Mage::getModel('amazon_login/customer');
45
 
46
  if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
47
  if (!$this->_getConfig()->isGuestCheckout() || !$this->_getOnepage()->getQuote()->isAllowedGuestCheckout()) {
@@ -62,7 +63,10 @@ abstract class Amazon_Payments_Controller_Checkout extends Mage_Checkout_Control
62
  // Full-page redirect (user did not sign in using popup)
63
  if ($this->getRequest()->getParam('nopopup')) {
64
  $this->_redirectUrl(Mage::helper('amazon_payments')->getCheckoutUrl(false) . '#access_token=' . $token);
65
-
 
 
 
66
  }
67
  // Redirect to clean URL
68
  else if (!$this->getRequest()->getParam('ajax')) {
@@ -83,6 +87,19 @@ abstract class Amazon_Payments_Controller_Checkout extends Mage_Checkout_Control
83
  Mage::helper('amazon_payments/data')->clearSession();
84
  }
85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
 
87
  /**
88
  * Validate ajax request and redirect on failure
@@ -203,6 +220,7 @@ abstract class Amazon_Payments_Controller_Checkout extends Mage_Checkout_Control
203
  'lastname' => $lastName,
204
  'street' => array($address->getAddressLine1(), $address->getAddressLine2()),
205
  'city' => $address->getCity(),
 
206
  'region_id' => $regionId,
207
  'postcode' => $address->getPostalCode(),
208
  'country_id' => $address->getCountryCode(),
@@ -218,13 +236,13 @@ abstract class Amazon_Payments_Controller_Checkout extends Mage_Checkout_Control
218
  // Set billing address (if allowed by scope)
219
  if ($orderReferenceDetails->getBillingAddress()) {
220
  $billing = $orderReferenceDetails->getBillingAddress()->getPhysicalAddress();
221
- $data['use_for_shipping'] = false;
222
 
223
  $name = $billing->getName();
224
  $firstName = substr($name, 0, strrpos($name, ' '));
225
  $lastName = substr($name, strlen($firstName) + 1);
226
 
227
- $regionModel = Mage::getModel('directory/region')->loadByCode($address->getStateOrRegion(), $address->getCountryCode());
228
  $regionId = $regionModel->getId();
229
 
230
  $dataBilling = array(
@@ -232,6 +250,7 @@ abstract class Amazon_Payments_Controller_Checkout extends Mage_Checkout_Control
232
  'lastname' => $lastName,
233
  'street' => array($billing->getAddressLine1(), $billing->getAddressLine2()),
234
  'city' => $billing->getCity(),
 
235
  'region_id' => $regionId,
236
  'postcode' => $billing->getPostalCode(),
237
  'country_id' => $billing->getCountryCode(),
27
  public function preDispatch()
28
  {
29
  parent::preDispatch();
30
+
31
  $this->_amazonOrderReferenceId = htmlentities($this->getRequest()->getParam('amazon_order_reference_id'));
32
 
33
  if (!$this->_amazonOrderReferenceId) {
42
  $token = htmlentities($this->getRequest()->getParam('access_token'));
43
 
44
  if ($token) {
45
+ $_amazonLogin = Mage::getModel('amazon_payments/customer');
46
 
47
  if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
48
  if (!$this->_getConfig()->isGuestCheckout() || !$this->_getOnepage()->getQuote()->isAllowedGuestCheckout()) {
63
  // Full-page redirect (user did not sign in using popup)
64
  if ($this->getRequest()->getParam('nopopup')) {
65
  $this->_redirectUrl(Mage::helper('amazon_payments')->getCheckoutUrl(false) . '#access_token=' . $token);
66
+ }
67
+ // Redirect to account page
68
+ else if (Mage::app()->getRequest()->getParams('account') == 'redirect') {
69
+ $this->_redirect('customer/account');
70
  }
71
  // Redirect to clean URL
72
  else if (!$this->getRequest()->getParam('ajax')) {
87
  Mage::helper('amazon_payments/data')->clearSession();
88
  }
89
 
90
+ /**
91
+ * Redirect to account
92
+ */
93
+ public function accountAction()
94
+ {
95
+ // User logged in at order details page and wants to update payment method from async decline
96
+ if ($orderIdRedirect = Mage::getModel('core/cookie')->get('amazonOrderIdRedirect')) {
97
+ Mage::getModel('core/cookie')->delete('amazonOrderIdRedirect');
98
+ $this->_redirect('sales/order/view/order_id/' . $orderIdRedirect);
99
+ } else {
100
+ $this->_redirect('customer/account');
101
+ }
102
+ }
103
 
104
  /**
105
  * Validate ajax request and redirect on failure
220
  'lastname' => $lastName,
221
  'street' => array($address->getAddressLine1(), $address->getAddressLine2()),
222
  'city' => $address->getCity(),
223
+ 'region' => $address->getStateOrRegion(),
224
  'region_id' => $regionId,
225
  'postcode' => $address->getPostalCode(),
226
  'country_id' => $address->getCountryCode(),
236
  // Set billing address (if allowed by scope)
237
  if ($orderReferenceDetails->getBillingAddress()) {
238
  $billing = $orderReferenceDetails->getBillingAddress()->getPhysicalAddress();
239
+ //$data['use_for_shipping'] = false;
240
 
241
  $name = $billing->getName();
242
  $firstName = substr($name, 0, strrpos($name, ' '));
243
  $lastName = substr($name, strlen($firstName) + 1);
244
 
245
+ $regionModel = Mage::getModel('directory/region')->loadByCode($billing->getStateOrRegion(), $billing->getCountryCode());
246
  $regionId = $regionModel->getId();
247
 
248
  $dataBilling = array(
250
  'lastname' => $lastName,
251
  'street' => array($billing->getAddressLine1(), $billing->getAddressLine2()),
252
  'city' => $billing->getCity(),
253
+ 'region' => $billing->getStateOrRegion(),
254
  'region_id' => $regionId,
255
  'postcode' => $billing->getPostalCode(),
256
  'country_id' => $billing->getCountryCode(),
app/code/community/Amazon/Payments/Helper/Data.php CHANGED
@@ -159,19 +159,29 @@ class Amazon_Payments_Helper_Data extends Mage_Core_Helper_Abstract
159
  */
160
  public function switchOnepageLoginTemplateIf($amazonTemplate, $defaultTemplate)
161
  {
162
- if ($this->getConfig()->isCheckoutOnepage()) {
163
  return $amazonTemplate;
164
  } else {
165
  return $defaultTemplate;
166
  }
167
  }
168
 
 
 
 
 
 
 
 
 
169
  /**
170
  * Show modal?
171
  */
172
  public function showModal()
173
  {
174
- return (Mage::app()->getRequest()->getParam('amazon_modal') && $this->getConfig()->isCheckoutModal());
 
 
175
  }
176
 
177
  /**
@@ -183,4 +193,66 @@ class Amazon_Payments_Helper_Data extends Mage_Core_Helper_Abstract
183
  {
184
  return ($this->getConfig()->isButtonBadgeEnabled() && $this->getConfig()->isEnabled());
185
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  }
159
  */
160
  public function switchOnepageLoginTemplateIf($amazonTemplate, $defaultTemplate)
161
  {
162
+ if ($this->isEnabled()) {
163
  return $amazonTemplate;
164
  } else {
165
  return $defaultTemplate;
166
  }
167
  }
168
 
169
+ /**
170
+ * Is Payment Method enabled?
171
+ */
172
+ public function isEnabled()
173
+ {
174
+ return $this->getConfig()->isEnabled();
175
+ }
176
+
177
  /**
178
  * Show modal?
179
  */
180
  public function showModal()
181
  {
182
+ return (Mage::app()->getRequest()->getParam('amazon_modal')
183
+ && !Mage::app()->getRequest()->getParam('ajax')
184
+ && $this->getConfig()->isCheckoutModal());
185
  }
186
 
187
  /**
193
  {
194
  return ($this->getConfig()->isButtonBadgeEnabled() && $this->getConfig()->isEnabled());
195
  }
196
+
197
+ /**
198
+ * Retrieve customer verify url
199
+ *
200
+ * @return string
201
+ */
202
+ public function getVerifyUrl()
203
+ {
204
+ return $this->_getUrl('amazon_payments/customer/verify');
205
+ }
206
+
207
+ /**
208
+ * Retrieve Amazon Profile in session
209
+ */
210
+ public function getAmazonProfileSession()
211
+ {
212
+ return Mage::getSingleton('customer/session')->getAmazonProfile();
213
+ }
214
+
215
+ /**
216
+ * Retreive additional login access scope
217
+ */
218
+ public function getAdditionalScope()
219
+ {
220
+ $scope = trim(Mage::getStoreConfig('amazon_login/settings/additional_scope'));
221
+ return ($scope) ? ' ' . $scope : '';
222
+ }
223
+
224
+ /**
225
+ * Return login authorize URL
226
+ *
227
+ * @return string
228
+ */
229
+ public function getLoginAuthUrl()
230
+ {
231
+ return $this->_getUrl('amazon_payments/customer/authorize', array('_forced_secure' => true));
232
+ }
233
+
234
+ /**
235
+ * Is login a popup or full-page redirect?
236
+ */
237
+ public function isPopup()
238
+ {
239
+ return (Mage::getStoreConfig('amazon_login/settings/popup'));
240
+ }
241
+
242
+ /**
243
+ * Get config by website or store admin scope
244
+ */
245
+ public function getAdminConfig($path)
246
+ {
247
+ if ($storeCode = Mage::app()->getRequest()->getParam('store')) {
248
+ return Mage::getStoreConfig($path, $storeCode);
249
+ }
250
+ else if ($websiteCode = Mage::app()->getRequest()->getParam('website')) {
251
+ return Mage::app()->getWebsite($websiteCode)->getConfig($path);
252
+ }
253
+ else {
254
+ return Mage::getStoreConfig($path);
255
+ }
256
+ }
257
+
258
  }
app/code/community/Amazon/Payments/Model/Api.php CHANGED
@@ -8,7 +8,7 @@
8
  * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
  */
10
 
11
- class Amazon_Payments_Model_Api
12
  {
13
  const ORDER_PLATFORM_ID = 'A2K7HE1S3M5XJ';
14
 
@@ -21,7 +21,7 @@ class Amazon_Payments_Model_Api
21
  const AUTH_STATUS_SUSPENDED = 'Suspended';
22
 
23
  protected $api;
24
- protected $log_file = 'amazon.log';
25
 
26
  /**
27
  * Return and/or initiate Amazon's Client Library API
@@ -32,13 +32,13 @@ class Amazon_Payments_Model_Api
32
  {
33
  if (!$this->api) {
34
  $config = array(
35
- 'merchantId' => $this->getConfig()->getSellerId(),
36
- 'accessKey' => $this->getConfig()->getAccessKey(),
37
- 'secretKey' => $this->getConfig()->getAccessSecret(),
38
- 'region' => $this->getConfig()->getRegion(),
39
- 'environment' => ($this->getConfig()->isSandbox()) ? 'sandbox' : 'live',
40
  'applicationName' => 'Amazon Payments Magento Extension',
41
- 'applicationVersion' => current(Mage::getConfig()->getNode('modules/Amazon_Payments/version')),
42
  'serviceURL' => '',
43
  'widgetURL' => '',
44
  'caBundleFile' => '',
@@ -64,7 +64,7 @@ class Amazon_Payments_Model_Api
64
  protected function _getRequiredParams()
65
  {
66
  return array(
67
- 'SellerId' => $this->getConfig()->getSellerId(),
68
  );
69
  }
70
 
@@ -105,13 +105,13 @@ class Amazon_Payments_Model_Api
105
  // Debugging/Logging
106
  if ($this->_isLoggingEnabled()) {
107
 
108
- Mage::log('Request: ' . $method . "\n" . print_r($request, true), null, $this->log_file);
109
 
110
  $time = round(microtime(TRUE) - $start_time, 2) . ' seconds.';
111
- Mage::log($method . " Time: " . $time, null, $this->log_file);
112
 
113
  if (isset($exception)) {
114
- Mage::log($exception->__toString(), Zend_Log::ERR, $this->log_file);
115
  }
116
  else {
117
 
@@ -123,7 +123,7 @@ class Amazon_Payments_Model_Api
123
  $fields[substr($methodName, 3)] = $response->$methodName();
124
  }
125
  }
126
- Mage::log('Response: ' . print_r($fields, true), null, $this->log_file);
127
  }
128
  }
129
 
@@ -141,7 +141,7 @@ class Amazon_Payments_Model_Api
141
  * @return OffAmazonPaymentsService_Model_AuthorizeResponse
142
  * @link http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_Authorize.html
143
  */
144
- public function authorize($orderReferenceId, $authorizationReferenceId, $authorizationAmount, $authorizationCurrency, $captureNow = false, $softDescriptor = null, $sellerAuthorizationNote = null)
145
  {
146
  $request = array(
147
  'AmazonOrderReferenceId' => $orderReferenceId,
@@ -153,7 +153,7 @@ class Amazon_Payments_Model_Api
153
  'CaptureNow' => $captureNow,
154
  );
155
 
156
- if (!$this->getConfig()->isAsync()) {
157
  $request['TransactionTimeout'] = 0; // Synchronous Mode
158
  }
159
 
@@ -199,7 +199,7 @@ class Amazon_Payments_Model_Api
199
  ),
200
  );
201
 
202
- if (!$this->getConfig()->isAsync()) {
203
  $request['TransactionTimeout'] = 0; // Synchronous Mode
204
  }
205
 
8
  * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
  */
10
 
11
+ class Amazon_Payments_Model_Api extends Varien_Object
12
  {
13
  const ORDER_PLATFORM_ID = 'A2K7HE1S3M5XJ';
14
 
21
  const AUTH_STATUS_SUSPENDED = 'Suspended';
22
 
23
  protected $api;
24
+ protected $logFile = 'amazon.log';
25
 
26
  /**
27
  * Return and/or initiate Amazon's Client Library API
32
  {
33
  if (!$this->api) {
34
  $config = array(
35
+ 'merchantId' => $this->getConfig()->getSellerId($this->getStoreId()),
36
+ 'accessKey' => $this->getConfig()->getAccessKey($this->getStoreId()),
37
+ 'secretKey' => $this->getConfig()->getAccessSecret($this->getStoreId()),
38
+ 'region' => $this->getConfig()->getRegion($this->getStoreId()),
39
+ 'environment' => ($this->getConfig()->isSandbox($this->getStoreId())) ? 'sandbox' : 'live',
40
  'applicationName' => 'Amazon Payments Magento Extension',
41
+ 'applicationVersion' => (string) Mage::getConfig()->getNode('modules/Amazon_Payments/version'),
42
  'serviceURL' => '',
43
  'widgetURL' => '',
44
  'caBundleFile' => '',
64
  protected function _getRequiredParams()
65
  {
66
  return array(
67
+ 'SellerId' => $this->getConfig()->getSellerId($this->getStoreId()),
68
  );
69
  }
70
 
105
  // Debugging/Logging
106
  if ($this->_isLoggingEnabled()) {
107
 
108
+ Mage::log('Request: ' . $method . "\n" . print_r($request, true), null, $this->logFile);
109
 
110
  $time = round(microtime(TRUE) - $start_time, 2) . ' seconds.';
111
+ Mage::log($method . " Time: " . $time, null, $this->logFile);
112
 
113
  if (isset($exception)) {
114
+ Mage::log($exception->__toString(), Zend_Log::ERR, $this->logFile);
115
  }
116
  else {
117
 
123
  $fields[substr($methodName, 3)] = $response->$methodName();
124
  }
125
  }
126
+ Mage::log('Response: ' . print_r($fields, true), null, $this->logFile);
127
  }
128
  }
129
 
141
  * @return OffAmazonPaymentsService_Model_AuthorizeResponse
142
  * @link http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_Authorize.html
143
  */
144
+ public function authorize($orderReferenceId, $authorizationReferenceId, $authorizationAmount, $authorizationCurrency, $captureNow = false, $softDescriptor = null, $sellerAuthorizationNote = null, $forceSync = false)
145
  {
146
  $request = array(
147
  'AmazonOrderReferenceId' => $orderReferenceId,
153
  'CaptureNow' => $captureNow,
154
  );
155
 
156
+ if (!$this->getConfig()->isAsync($this->getStoreId()) || $forceSync) {
157
  $request['TransactionTimeout'] = 0; // Synchronous Mode
158
  }
159
 
199
  ),
200
  );
201
 
202
+ if (!$this->getConfig()->isAsync($this->getStoreId())) {
203
  $request['TransactionTimeout'] = 0; // Synchronous Mode
204
  }
205
 
app/code/community/Amazon/Payments/Model/Async.php CHANGED
@@ -14,9 +14,11 @@ class Amazon_Payments_Model_Async extends Mage_Core_Model_Abstract
14
  /**
15
  * Return Amazon API
16
  */
17
- protected function _getApi()
18
  {
19
- return Mage::getSingleton('amazon_payments/api');
 
 
20
  }
21
 
22
  /**
@@ -43,12 +45,39 @@ class Amazon_Payments_Model_Async extends Mage_Core_Model_Abstract
43
  return false;
44
  }
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  /**
47
  * Poll Amazon API to receive order status and update Magento order.
48
  */
49
  public function syncOrderStatus(Mage_Sales_Model_Order $order, $isManualSync = false)
50
  {
51
- $_api = $this->_getApi();
52
  $message = '';
53
 
54
  try {
@@ -63,32 +92,37 @@ class Amazon_Payments_Model_Async extends Mage_Core_Model_Abstract
63
 
64
  // Last transaction ID is Amazon Authorize Reference ID
65
  $lastAmazonReference = $order->getPayment()->getLastTransId();
66
- $resultAuthorize = $this->_getApi()->getAuthorizationDetails($lastAmazonReference);
67
  $amazonAuthorizationState = $resultAuthorize->getAuthorizationStatus()->getState();
68
  $reasonCode = $resultAuthorize->getAuthorizationStatus()->getReasonCode();
69
 
70
  // Re-authorize if holded, an Open order reference, and manual sync
71
  if ($order->getState() == Mage_Sales_Model_Order::STATE_HOLDED && $orderReferenceDetails->getOrderReferenceStatus()->getState() == 'Open' && $isManualSync) {
72
  $payment = $order->getPayment();
73
- $amount = $payment->getAmountOrdered();
74
- $method = $payment->getMethodInstance();
75
 
76
  // Re-authorize
77
  $payment->setTransactionId($amazonOrderReference);
 
 
 
78
 
79
  switch ($method->getConfigData('payment_action')) {
80
  case $method::ACTION_AUTHORIZE:
81
- $method->authorize($payment, $amount, false);
82
  break;
83
 
84
  case $method::ACTION_AUTHORIZE_CAPTURE:
85
- $method->authorize($payment, $amount, true);
86
  break;
87
  default:
88
  break;
89
  }
90
 
91
  // Resync
 
 
92
  $this->syncOrderStatus($order);
93
  return;
94
  }
@@ -107,13 +141,19 @@ class Amazon_Payments_Model_Async extends Mage_Core_Model_Abstract
107
  $order->setState(Mage_Sales_Model_Order::STATE_HOLDED, true);
108
  }
109
 
110
- $message .= " Order placed on hold due to $reasonCode. Please direct customer to Amazon Payments site to update their payment method.";
 
 
 
 
 
 
111
  break;
112
 
113
  // Open (Authorize Only)
114
  case Amazon_Payments_Model_Api::AUTH_STATUS_OPEN:
115
  $order->setState(Mage_Sales_Model_Order::STATE_NEW);
116
- $order->setStatus($_api->getConfig()->getNewOrderStatus());
117
  break;
118
 
119
  // Closed (Authorize and Capture)
@@ -122,9 +162,9 @@ class Amazon_Payments_Model_Async extends Mage_Core_Model_Abstract
122
  // Payment captured; create invoice
123
  if ($reasonCode == 'MaxCapturesProcessed') {
124
  $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING);
125
- $order->setStatus($_api->getConfig()->getNewOrderStatus());
126
 
127
- if ($this->_createInvoice($order, $orderReferenceDetails->getIdList()->getmember())) {
128
  $message .= ' ' . Mage::helper('payment')->__('Invoice created.');
129
  }
130
  }
14
  /**
15
  * Return Amazon API
16
  */
17
+ protected function _getApi($storeId = null)
18
  {
19
+ $_api = Mage::getModel('amazon_payments/api');
20
+ $_api->setStoreId($storeId);
21
+ return $_api;
22
  }
23
 
24
  /**
45
  return false;
46
  }
47
 
48
+ /**
49
+ * Send Payment Decline email
50
+ */
51
+ protected function _sendPaymentDeclineEmail(Mage_Sales_Model_Order $order, $type = 'soft')
52
+ {
53
+ $emailTemplate = Mage::getModel('core/email_template')->loadDefault('amazon_payments_async_decline_' . $type);
54
+
55
+ $orderUrl = Mage::getUrl('sales/order/view', array(
56
+ 'order_id' => $order->getId(),
57
+ '_store' => $order->getStoreId(),
58
+ '_forced_secure' => true,
59
+ ));
60
+
61
+ $templateParams = array(
62
+ 'order_url' => $orderUrl,
63
+ 'store' => Mage::app()->getStore($order->getStoreId()),
64
+ 'customer' => Mage::getModel('customer/customer')->load($order->getCustomerId()),
65
+ );
66
+
67
+ $sender = array(
68
+ 'name' => Mage::getStoreConfig('trans_email/ident_general/email', $order->getStoreId()),
69
+ 'email' => Mage::getStoreConfig('trans_email/ident_general/name', $order->getStoreId())
70
+ );
71
+
72
+ $emailTemplate->sendTransactional($emailTemplate->getId(), $sender, $order->getCustomerEmail(), $order->getCustomerName(), $templateParams, $order->getStoreId());
73
+ }
74
+
75
  /**
76
  * Poll Amazon API to receive order status and update Magento order.
77
  */
78
  public function syncOrderStatus(Mage_Sales_Model_Order $order, $isManualSync = false)
79
  {
80
+ $_api = $this->_getApi($order->getStoreId());
81
  $message = '';
82
 
83
  try {
92
 
93
  // Last transaction ID is Amazon Authorize Reference ID
94
  $lastAmazonReference = $order->getPayment()->getLastTransId();
95
+ $resultAuthorize = $this->_getApi($order->getStoreId())->getAuthorizationDetails($lastAmazonReference);
96
  $amazonAuthorizationState = $resultAuthorize->getAuthorizationStatus()->getState();
97
  $reasonCode = $resultAuthorize->getAuthorizationStatus()->getReasonCode();
98
 
99
  // Re-authorize if holded, an Open order reference, and manual sync
100
  if ($order->getState() == Mage_Sales_Model_Order::STATE_HOLDED && $orderReferenceDetails->getOrderReferenceStatus()->getState() == 'Open' && $isManualSync) {
101
  $payment = $order->getPayment();
102
+ $amount = $payment->getAmountOrdered();
103
+ $method = $payment->getMethodInstance();
104
 
105
  // Re-authorize
106
  $payment->setTransactionId($amazonOrderReference);
107
+ $payment->setAdditionalInformation('sandbox', null); // Remove decline and other test simulations
108
+
109
+ $method->setForceSync(true);
110
 
111
  switch ($method->getConfigData('payment_action')) {
112
  case $method::ACTION_AUTHORIZE:
113
+ $resultAuthorize = $method->authorize($payment, $amount, false);
114
  break;
115
 
116
  case $method::ACTION_AUTHORIZE_CAPTURE:
117
+ $resultAuthorize = $method->authorize($payment, $amount, true);
118
  break;
119
  default:
120
  break;
121
  }
122
 
123
  // Resync
124
+ $order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, true);
125
+ $order->save();
126
  $this->syncOrderStatus($order);
127
  return;
128
  }
141
  $order->setState(Mage_Sales_Model_Order::STATE_HOLDED, true);
142
  }
143
 
144
+ if ($reasonCode == 'InvalidPaymentMethod') {
145
+ $this->_sendPaymentDeclineEmail($order, 'soft');
146
+ $message .= " Order placed on hold due to $reasonCode. Email sent to customer with link to order details page and instructions to update their payment method.";
147
+ } else {
148
+ $this->_sendPaymentDeclineEmail($order, 'hard');
149
+ $message .= " Order placed on hold due to $reasonCode. Email sent to customer with instructions to contact seller.";
150
+ }
151
  break;
152
 
153
  // Open (Authorize Only)
154
  case Amazon_Payments_Model_Api::AUTH_STATUS_OPEN:
155
  $order->setState(Mage_Sales_Model_Order::STATE_NEW);
156
+ $order->setStatus($_api->getConfig()->getNewOrderStatus($order->getStoreId()));
157
  break;
158
 
159
  // Closed (Authorize and Capture)
162
  // Payment captured; create invoice
163
  if ($reasonCode == 'MaxCapturesProcessed') {
164
  $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING);
165
+ $order->setStatus($_api->getConfig()->getNewOrderStatus($order->getStoreId()));
166
 
167
+ if ($this->_createInvoice($order, $resultAuthorize->getIdList()->getmember())) {
168
  $message .= ' ' . Mage::helper('payment')->__('Invoice created.');
169
  }
170
  }
app/code/community/Amazon/Payments/Model/Config.php CHANGED
@@ -37,9 +37,6 @@ class Amazon_Payments_Model_Config
37
  const CONFIG_XML_PATH_BUTTON_SIZE = 'payment/amazon_payments/button_size';
38
  const CONFIG_XML_PATH_BUTTON_BADGE = 'payment/amazon_payments/button_badge';
39
 
40
- const CONFIG_XML_PATH_LOGIN_ENABLED = 'amazon_login/settings/enabled';
41
-
42
-
43
  /**
44
  * Retrieve config value for store by path
45
  *
@@ -89,7 +86,7 @@ class Amazon_Payments_Model_Config
89
  */
90
  public function isGuestCheckout($store = null)
91
  {
92
- return ! (bool) $this->_getStoreConfig(self::CONFIG_XML_PATH_LOGIN_ENABLED, $store);
93
  }
94
 
95
  /**
@@ -122,7 +119,7 @@ class Amazon_Payments_Model_Config
122
  */
123
  public function getClientSecret($store = null)
124
  {
125
- return trim($this->_getStoreConfig(self::CONFIG_XML_PATH_CLIENT_SECRET, $store));
126
  }
127
 
128
  /**
@@ -144,7 +141,7 @@ class Amazon_Payments_Model_Config
144
  */
145
  public function getAccessKey($store = null)
146
  {
147
- return trim($this->_getStoreConfig(self::CONFIG_XML_PATH_ACCESS_KEY, $store));
148
  }
149
 
150
  /**
37
  const CONFIG_XML_PATH_BUTTON_SIZE = 'payment/amazon_payments/button_size';
38
  const CONFIG_XML_PATH_BUTTON_BADGE = 'payment/amazon_payments/button_badge';
39
 
 
 
 
40
  /**
41
  * Retrieve config value for store by path
42
  *
86
  */
87
  public function isGuestCheckout($store = null)
88
  {
89
+ return false;
90
  }
91
 
92
  /**
119
  */
120
  public function getClientSecret($store = null)
121
  {
122
+ return Mage::helper('core')->decrypt(trim($this->_getStoreConfig(self::CONFIG_XML_PATH_CLIENT_SECRET, $store)));
123
  }
124
 
125
  /**
141
  */
142
  public function getAccessKey($store = null)
143
  {
144
+ return $this->_getStoreConfig(self::CONFIG_XML_PATH_ACCESS_KEY, $store);
145
  }
146
 
147
  /**
app/code/community/Amazon/{Login → Payments}/Model/Customer.php RENAMED
@@ -3,12 +3,12 @@
3
  * Login with Amazon Customer Model
4
  *
5
  * @category Amazon
6
- * @package Amazon_Login
7
  * @copyright Copyright (c) 2014 Amazon.com
8
  * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
  */
10
 
11
- class Amazon_Login_Model_Customer extends Mage_Customer_Model_Customer
12
  {
13
  /**
14
  * Log user in via Amazon token
@@ -23,8 +23,8 @@ class Amazon_Login_Model_Customer extends Mage_Customer_Model_Customer
23
 
24
  if ($amazonProfile && isset($amazonProfile['user_id']) && isset($amazonProfile['email'])) {
25
  // Load Amazon Login association
26
- $row = Mage::getModel('amazon_login/login')->load($amazonProfile['user_id'], 'amazon_uid');
27
-
28
  if ($row->getLoginId()) {
29
  // Load customer by id
30
  $this->setWebsiteId(Mage::app()->getWebsite()->getId())->load($row->getCustomerId());
@@ -40,7 +40,7 @@ class Amazon_Login_Model_Customer extends Mage_Customer_Model_Customer
40
  Mage::getSingleton('checkout/session')->setAmazonAccessTokenVerify($token);
41
 
42
  Mage::app()->getResponse()
43
- ->setRedirect(Mage::helper('amazon_login')->getVerifyUrl() . '?redirect=' . $redirectOnVerify, 301)
44
  ->sendResponse();
45
 
46
  exit;
@@ -69,7 +69,7 @@ class Amazon_Login_Model_Customer extends Mage_Customer_Model_Customer
69
  */
70
  public function getAmazonProfile($token)
71
  {
72
- return Mage::getModel('amazon_login/api')->request('user/profile?access_token=' . urlencode($token));
73
  }
74
 
75
  /**
@@ -128,7 +128,7 @@ class Amazon_Login_Model_Customer extends Mage_Customer_Model_Customer
128
  */
129
  public function createAssociation($amazonProfile, $customer_id)
130
  {
131
- Mage::getModel('amazon_login/login')
132
  ->setCustomerId($customer_id)
133
  ->setAmazonUid($amazonProfile['user_id'])
134
  ->save();
3
  * Login with Amazon Customer Model
4
  *
5
  * @category Amazon
6
+ * @package Amazon_Payments
7
  * @copyright Copyright (c) 2014 Amazon.com
8
  * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
  */
10
 
11
+ class Amazon_Payments_Model_Customer extends Mage_Customer_Model_Customer
12
  {
13
  /**
14
  * Log user in via Amazon token
23
 
24
  if ($amazonProfile && isset($amazonProfile['user_id']) && isset($amazonProfile['email'])) {
25
  // Load Amazon Login association
26
+ $row = Mage::getModel('amazon_payments/login')->load($amazonProfile['user_id'], 'amazon_uid');
27
+
28
  if ($row->getLoginId()) {
29
  // Load customer by id
30
  $this->setWebsiteId(Mage::app()->getWebsite()->getId())->load($row->getCustomerId());
40
  Mage::getSingleton('checkout/session')->setAmazonAccessTokenVerify($token);
41
 
42
  Mage::app()->getResponse()
43
+ ->setRedirect(Mage::helper('amazon_payments')->getVerifyUrl() . '?redirect=' . $redirectOnVerify, 301)
44
  ->sendResponse();
45
 
46
  exit;
69
  */
70
  public function getAmazonProfile($token)
71
  {
72
+ return Mage::getModel('amazon_payments/login')->request('user/profile?access_token=' . urlencode($token));
73
  }
74
 
75
  /**
128
  */
129
  public function createAssociation($amazonProfile, $customer_id)
130
  {
131
+ Mage::getModel('amazon_payments/login')
132
  ->setCustomerId($customer_id)
133
  ->setAmazonUid($amazonProfile['user_id'])
134
  ->save();
app/code/community/Amazon/{Login/Model/Api.php → Payments/Model/Login.php} RENAMED
@@ -1,79 +1,71 @@
1
- <?php
2
- /**
3
- * Access Amazon's API
4
- *
5
- * @category Amazon
6
- * @package Amazon_Login
7
- * @copyright Copyright (c) 2014 Amazon.com
8
- * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
- */
10
-
11
- class Amazon_Login_Model_Api
12
- {
13
-
14
- private $http_client_config = array(
15
- 'maxredirects' => 2,
16
- 'timeout' => 30);
17
-
18
- /**
19
- * Get config Client ID
20
- */
21
- public function getClientId()
22
- {
23
- return trim(Mage::getStoreConfig('amazon_login/settings/client_id'));
24
- }
25
-
26
- /**
27
- * Get config Client Secret
28
- */
29
- public function getClientSecret()
30
- {
31
- return trim(Mage::getStoreConfig('amazon_login/settings/client_secret'));
32
- }
33
-
34
- /**
35
- * Perform an API request to Amazon
36
- *
37
- * @param string $path
38
- * REST path e.g. user/profile
39
- * @param array $postParams
40
- * POST paramaters
41
- * @return result
42
- */
43
- public function request($path, array $postParams = array())
44
- {
45
- $sandbox = (Mage::getStoreConfig('payment/amazon_payments/sandbox')) ? 'sandbox.' : '';
46
-
47
- $client = new Zend_Http_Client();
48
- $client->setUri("https://api.{$sandbox}amazon.com/$path");
49
- $client->setConfig($this->http_client_config);
50
- $client->setMethod($postParams ? 'POST' : 'GET');
51
-
52
- foreach ($postParams as $key => $value) {
53
- $client->setParameterPost($key, $value);
54
- }
55
-
56
- try {
57
- $response = $client->request();
58
- } catch (Zend_Http_Client_Adapter_Exception $e) {
59
- Mage::logException($e);
60
- return;
61
- }
62
-
63
- $data = $response->getBody();
64
-
65
- try {
66
- $data = Zend_Json::decode($data, true);
67
- }
68
- catch (Exception $e) {
69
- Mage::logException($e);
70
- }
71
-
72
- if (empty($data)) {
73
- return false;
74
- }
75
- else {
76
- return $data;
77
- }
78
- }
79
- }
1
+ <?php
2
+ /**
3
+ * Login with Amazon
4
+ *
5
+ * @category Amazon
6
+ * @package Amazon_Payments
7
+ * @copyright Copyright (c) 2014 Amazon.com
8
+ * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
+ */
10
+
11
+ class Amazon_Payments_Model_Login extends Mage_Core_Model_Abstract
12
+ {
13
+
14
+ private $http_client_config = array(
15
+ 'maxredirects' => 2,
16
+ 'timeout' => 30);
17
+
18
+ public function _construct()
19
+ {
20
+ parent::_construct();
21
+ $this->_init('amazon_payments/login');
22
+ }
23
+
24
+ /**
25
+ * Perform an API request to Amazon Login API
26
+ *
27
+ * @param string $path
28
+ * REST path e.g. user/profile
29
+ * @param array $postParams
30
+ * POST paramaters
31
+ * @return result
32
+ */
33
+ public function request($path, array $postParams = array())
34
+ {
35
+ $config = Mage::getSingleton('amazon_payments/config');
36
+
37
+ $sandbox = $config->isSandbox() ? 'sandbox.' : '';
38
+
39
+ $client = new Zend_Http_Client();
40
+ $client->setUri("https://api.{$sandbox}amazon.com/$path");
41
+ $client->setConfig($this->http_client_config);
42
+ $client->setMethod($postParams ? 'POST' : 'GET');
43
+
44
+ foreach ($postParams as $key => $value) {
45
+ $client->setParameterPost($key, $value);
46
+ }
47
+
48
+ try {
49
+ $response = $client->request();
50
+ } catch (Zend_Http_Client_Adapter_Exception $e) {
51
+ Mage::logException($e);
52
+ return;
53
+ }
54
+
55
+ $data = $response->getBody();
56
+
57
+ try {
58
+ $data = Zend_Json::decode($data, true);
59
+ }
60
+ catch (Exception $e) {
61
+ Mage::logException($e);
62
+ }
63
+
64
+ if (empty($data)) {
65
+ return false;
66
+ }
67
+ else {
68
+ return $data;
69
+ }
70
+ }
71
+ }
 
 
 
 
 
 
 
 
app/code/community/Amazon/Payments/Model/Observer/Action.php CHANGED
@@ -17,9 +17,16 @@ class Amazon_Payments_Model_Observer_Action
17
  */
18
  public function secureCart(Varien_Event_Observer $observer)
19
  {
20
- if (!Mage::app()->getStore()->isCurrentlySecure() && strpos(Mage::getStoreConfig('web/secure/base_url'), 'https') !== false && Mage::getSingleton('amazon_payments/config')->isSecureCart()) {
 
 
 
 
21
  $redirectUrl = Mage::getUrl('checkout/cart/', array('_forced_secure' => true));
22
- Mage::app()->getResponse()->setRedirect($redirectUrl)->sendResponse();
 
 
 
23
  }
24
  }
25
- }
17
  */
18
  public function secureCart(Varien_Event_Observer $observer)
19
  {
20
+ if (Mage::getSingleton('amazon_payments/config')->isEnabled()
21
+ && Mage::getSingleton('amazon_payments/config')->isSecureCart()
22
+ && !Mage::app()->getStore()->isCurrentlySecure()
23
+ && strpos(Mage::getStoreConfig('web/secure/base_url'), 'https') !== false
24
+ ) {
25
  $redirectUrl = Mage::getUrl('checkout/cart/', array('_forced_secure' => true));
26
+ Mage::app()->getResponse()
27
+ ->setRedirect($redirectUrl)
28
+ ->sendResponse();
29
+ exit;
30
  }
31
  }
32
+ }
app/code/community/Amazon/Payments/Model/Observer/Order.php CHANGED
@@ -21,8 +21,7 @@ class Amazon_Payments_Model_Observer_Order
21
  $customer = $order->getCustomer();
22
  $payment = $order->getPayment();
23
 
24
- if ($customer->getId() && $payment->getMethodInstance()->getCode() == 'amazon_payments') {
25
-
26
  $customerAddress = $order->getShippingAddress() ? $order->getShippingAddress() : $order->getBillingAddress();
27
 
28
  $newAddress = Mage::getModel('customer/address')
@@ -51,4 +50,21 @@ class Amazon_Payments_Model_Observer_Order
51
 
52
  }
53
  }
54
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  $customer = $order->getCustomer();
22
  $payment = $order->getPayment();
23
 
24
+ if ($customer && $customer->getId() && $payment->getMethodInstance()->getCode() == 'amazon_payments') {
 
25
  $customerAddress = $order->getShippingAddress() ? $order->getShippingAddress() : $order->getBillingAddress();
26
 
27
  $newAddress = Mage::getModel('customer/address')
50
 
51
  }
52
  }
53
+
54
+
55
+ /**
56
+ * Event: sales_order_save_commit_after
57
+ *
58
+ * Close Amazon ORO
59
+ */
60
+ public function closeAmazonOrder(Varien_Event_Observer $observer)
61
+ {
62
+ $order = $observer->getEvent()->getOrder();
63
+ $payment = $order->getPayment();
64
+
65
+ if ($order->getState() == Mage_Sales_Model_Order::STATE_COMPLETE && $order->getOrigData('state') != Mage_Sales_Model_Order::STATE_COMPLETE
66
+ && $payment->getMethodInstance()->getCode() == 'amazon_payments') {
67
+ Mage::getModel('amazon_payments/api')->closeOrderReference($payment->getAdditionalInformation('order_reference'));
68
+ }
69
+ }
70
+ }
app/code/community/Amazon/Payments/Model/PaymentMethod.php CHANGED
@@ -30,12 +30,16 @@ class Amazon_Payments_Model_PaymentMethod extends Mage_Payment_Model_Method_Abst
30
  protected $_canFetchTransactionInfo = true;
31
  protected $_canReviewPayment = false;
32
 
 
 
33
  /**
34
  * Return Amazon API
35
  */
36
- protected function _getApi()
37
  {
38
- return Mage::getSingleton('amazon_payments/api');
 
 
39
  }
40
 
41
  /**
@@ -44,7 +48,7 @@ class Amazon_Payments_Model_PaymentMethod extends Mage_Payment_Model_Method_Abst
44
  protected function _getMagentoReferenceId(Varien_Object $payment)
45
  {
46
  $order = $payment->getOrder();
47
- return $order->getIncrementId() . '-' . strtotime($payment->getCreatedAt());
48
  }
49
 
50
  /**
@@ -89,7 +93,7 @@ class Amazon_Payments_Model_PaymentMethod extends Mage_Payment_Model_Method_Abst
89
  }
90
 
91
  // Asynchronous Mode always returns Pending
92
- if ($this->getConfigData('is_async')) {
93
  // "Pending Payment" indicates async for internal use
94
  $stateObject->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT);
95
  $stateObject->setStatus('pending');
@@ -112,21 +116,27 @@ class Amazon_Payments_Model_PaymentMethod extends Mage_Payment_Model_Method_Abst
112
  $sellerAuthorizationNote = null;
113
 
114
  // Sandbox simulation testing for Stand Alone Checkout
115
- if ($payment->getAdditionalInformation('sandbox') && $this->_getApi()->getConfig()->isSandbox()) {
116
  $sellerAuthorizationNote = $payment->getAdditionalInformation('sandbox');
 
 
 
 
 
117
  }
118
 
119
  // For core and third-party checkouts, may test credit card decline by uncommenting:
120
  //$sellerAuthorizationNote = '{"SandboxSimulation": {"State":"Declined", "ReasonCode":"InvalidPaymentMethod", "PaymentMethodUpdateTimeInMins":5}}';
121
 
122
- $result = $this->_getApi()->authorize(
123
  $payment->getTransactionId(),
124
  $this->_getMagentoReferenceId($payment) . '-auth',
125
  $amount,
126
  $order->getBaseCurrencyCode(),
127
  $captureNow,
128
  ($captureNow) ? $this->_getSoftDescriptor() : null,
129
- $sellerAuthorizationNote
 
130
  );
131
 
132
  $status = $result->getAuthorizationStatus();
@@ -143,7 +153,7 @@ class Amazon_Payments_Model_PaymentMethod extends Mage_Payment_Model_Method_Abst
143
  // Add transaction
144
  if ($captureNow) {
145
 
146
- if (!$this->getConfigData('is_async')) {
147
  $transactionSave = Mage::getModel('core/resource_transaction');
148
 
149
  $captureReferenceIds = $result->getIdList()->getmember();
@@ -174,16 +184,42 @@ class Amazon_Payments_Model_PaymentMethod extends Mage_Payment_Model_Method_Abst
174
 
175
  $payment->addTransaction($transactionType, null, false, $message);
176
 
 
177
  break;
178
 
179
  case Amazon_Payments_Model_Api::AUTH_STATUS_DECLINED:
180
- // Cancel order reference
181
  if ($status->getReasonCode() == 'TransactionTimedOut') {
182
- $this->_getApi()->cancelOrderReference($payment->getTransactionId());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  }
184
 
185
  $this->_setErrorCheck();
186
- Mage::throwException("Amazon could not process your order.\n\n" . $status->getReasonCode() . " (" . $status->getState() . ")\n" . $status->getReasonDescription());
 
 
 
 
 
 
 
 
187
  break;
188
  default:
189
  $this->_setErrorCheck();
@@ -241,7 +277,7 @@ class Amazon_Payments_Model_PaymentMethod extends Mage_Payment_Model_Method_Abst
241
  $apiResult = $this->_getApi()->confirmOrderReference($orderReferenceId);
242
  }
243
  catch (Exception $e) {
244
- Mage::throwException("Please try another Amazon payment method." . "\n\n" . substr($e->getMessage(), 0, strpos($e->getMessage(), 'Stack trace')));
245
  $this->_setErrorCheck();
246
  return;
247
  }
@@ -249,7 +285,7 @@ class Amazon_Payments_Model_PaymentMethod extends Mage_Payment_Model_Method_Abst
249
  $payment->setIsTransactionClosed(false);
250
  $payment->setSkipOrderProcessing(true);
251
 
252
- $comment = $this->getConfigData('is_async') ? 'Asynchronous ' : '';
253
  $comment .= $this->_getApi()->getConfig()->isSandbox() ? 'Sandbox ' : '';
254
  $comment .= 'Order of %s sent to Amazon Payments.';
255
  $message = Mage::helper('payment')->__($comment, $order->getStore()->convertPrice($amount, true, false));
@@ -302,9 +338,9 @@ class Amazon_Payments_Model_PaymentMethod extends Mage_Payment_Model_Method_Abst
302
 
303
  $order = $payment->getOrder();
304
 
305
- $result = $this->_getApi()->capture(
 
306
  $authReferenceId,
307
- $this->_getMagentoReferenceId($payment) . '-capture',
308
  $amount,
309
  $order->getBaseCurrencyCode(),
310
  $this->_getSoftDescriptor()
@@ -316,6 +352,8 @@ class Amazon_Payments_Model_PaymentMethod extends Mage_Payment_Model_Method_Abst
316
  // Error handling
317
  switch ($status->getState()) {
318
  case Amazon_Payments_Model_Api::AUTH_STATUS_PENDING:
 
 
319
  case Amazon_Payments_Model_Api::AUTH_STATUS_DECLINED:
320
  case Amazon_Payments_Model_Api::AUTH_STATUS_CLOSED:
321
  $this->_setErrorCheck();
@@ -354,9 +392,9 @@ class Amazon_Payments_Model_PaymentMethod extends Mage_Payment_Model_Method_Abst
354
 
355
  $order = $payment->getOrder();
356
 
357
- $result = $this->_getApi()->refund(
358
  $payment->getRefundTransactionId(),
359
- $this->_getMagentoReferenceId($payment) . substr(md5($this->_getMagentoReferenceId($payment) . microtime() ),-4) . '-refund',
360
  $amount,
361
  $order->getBaseCurrencyCode(),
362
  null,
@@ -393,6 +431,7 @@ class Amazon_Payments_Model_PaymentMethod extends Mage_Payment_Model_Method_Abst
393
  */
394
  protected function _void(Varien_Object $payment)
395
  {
 
396
  $orderTransaction = $payment->lookupTransaction(false, Mage_Sales_Model_Order_Payment_Transaction::TYPE_ORDER);
397
 
398
  if (!$orderTransaction) {
@@ -403,7 +442,7 @@ class Amazon_Payments_Model_PaymentMethod extends Mage_Payment_Model_Method_Abst
403
  }
404
 
405
  if ($orderTransaction) {
406
- $this->_getApi()->cancelOrderReference($orderTransactionId);
407
  }
408
  return $this;
409
  }
@@ -455,5 +494,12 @@ class Amazon_Payments_Model_PaymentMethod extends Mage_Payment_Model_Method_Abst
455
  return (Mage::getSingleton('amazon_payments/config')->isEnabled() && Mage::helper('amazon_payments')->isEnableProductPayments() && ((Mage::helper('amazon_payments')->isCheckoutAmazonSession() && $this->getConfigData('checkout_page') == 'onepage') || $this->getConfigData('use_in_checkout')));
456
  }
457
 
 
 
 
 
 
 
 
458
 
459
  }
30
  protected $_canFetchTransactionInfo = true;
31
  protected $_canReviewPayment = false;
32
 
33
+ protected $isForceSync = true; // Force synchronous transaction
34
+
35
  /**
36
  * Return Amazon API
37
  */
38
+ protected function _getApi($storeId = null)
39
  {
40
+ $_api = Mage::getModel('amazon_payments/api');
41
+ $_api->setStoreId($storeId);
42
+ return $_api;
43
  }
44
 
45
  /**
48
  protected function _getMagentoReferenceId(Varien_Object $payment)
49
  {
50
  $order = $payment->getOrder();
51
+ return $order->getIncrementId() . '-' . substr(md5($order->getIncrementId() . microtime() ), -6);
52
  }
53
 
54
  /**
93
  }
94
 
95
  // Asynchronous Mode always returns Pending
96
+ if (!$this->isForceSync && $this->getConfigData('is_async')) {
97
  // "Pending Payment" indicates async for internal use
98
  $stateObject->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT);
99
  $stateObject->setStatus('pending');
116
  $sellerAuthorizationNote = null;
117
 
118
  // Sandbox simulation testing for Stand Alone Checkout
119
+ if ($payment->getAdditionalInformation('sandbox') && $this->_getApi($order->getStoreId())->getConfig()->isSandbox()) {
120
  $sellerAuthorizationNote = $payment->getAdditionalInformation('sandbox');
121
+
122
+ // Allow async decline testing
123
+ if ($this->getConfigData('is_async') && strpos($sellerAuthorizationNote, 'InvalidPaymentMethod') !== false) {
124
+ $this->isForceSync = false;
125
+ }
126
  }
127
 
128
  // For core and third-party checkouts, may test credit card decline by uncommenting:
129
  //$sellerAuthorizationNote = '{"SandboxSimulation": {"State":"Declined", "ReasonCode":"InvalidPaymentMethod", "PaymentMethodUpdateTimeInMins":5}}';
130
 
131
+ $result = $this->_getApi($order->getStoreId())->authorize(
132
  $payment->getTransactionId(),
133
  $this->_getMagentoReferenceId($payment) . '-auth',
134
  $amount,
135
  $order->getBaseCurrencyCode(),
136
  $captureNow,
137
  ($captureNow) ? $this->_getSoftDescriptor() : null,
138
+ $sellerAuthorizationNote,
139
+ $this->isForceSync
140
  );
141
 
142
  $status = $result->getAuthorizationStatus();
153
  // Add transaction
154
  if ($captureNow) {
155
 
156
+ if ($this->isForceSync) { // Not async
157
  $transactionSave = Mage::getModel('core/resource_transaction');
158
 
159
  $captureReferenceIds = $result->getIdList()->getmember();
184
 
185
  $payment->addTransaction($transactionType, null, false, $message);
186
 
187
+
188
  break;
189
 
190
  case Amazon_Payments_Model_Api::AUTH_STATUS_DECLINED:
191
+
192
  if ($status->getReasonCode() == 'TransactionTimedOut') {
193
+ // Perform async if TTO
194
+ if ($this->isForceSync && $this->getConfigData('is_async')) {
195
+ // Remove sandbox simulation test
196
+ if (strpos($sellerAuthorizationNote, 'TransactionTimedOut') !== false) {
197
+ $payment->setAdditionalInformation('sandbox', null);
198
+ }
199
+ $this->isForceSync = false;
200
+
201
+ $order->addStatusHistoryComment('Error: TransactionTimedOut, performing asynchronous authorization.');
202
+ $order->save();
203
+
204
+ $this->_authorize($payment, $amount, $captureNow);
205
+ return;
206
+ }
207
+ // Cancel order reference
208
+ else {
209
+ $this->_getApi($order->getStoreId())->cancelOrderReference($payment->getTransactionId());
210
+ }
211
  }
212
 
213
  $this->_setErrorCheck();
214
+
215
+ // specific error handling for InvalidPaymentMethod decline scenario
216
+ if($status->getReasonCode() == 'InvalidPaymentMethod') {
217
+ Mage::throwException("There was a problem with your payment. Please select another payment method from the Amazon Wallet and try again.");
218
+ break;
219
+ }
220
+
221
+ // all other declines - AmazonRejected && ProcessingFailure && TransactionTimedOut (when async is off)
222
+ Mage::throwException("Amazon could not process your order. Please try again. If this continues, please select a different payment option.\n\n" . $status->getReasonCode() . " (" . $status->getState() . ")\n" . $status->getReasonDescription());
223
  break;
224
  default:
225
  $this->_setErrorCheck();
277
  $apiResult = $this->_getApi()->confirmOrderReference($orderReferenceId);
278
  }
279
  catch (Exception $e) {
280
+ Mage::throwException("Please try another Amazon payment method."); // . "\n\n" . substr($e->getMessage(), 0, strpos($e->getMessage(), 'Stack trace')));
281
  $this->_setErrorCheck();
282
  return;
283
  }
285
  $payment->setIsTransactionClosed(false);
286
  $payment->setSkipOrderProcessing(true);
287
 
288
+ $comment = '';
289
  $comment .= $this->_getApi()->getConfig()->isSandbox() ? 'Sandbox ' : '';
290
  $comment .= 'Order of %s sent to Amazon Payments.';
291
  $message = Mage::helper('payment')->__($comment, $order->getStore()->convertPrice($amount, true, false));
338
 
339
  $order = $payment->getOrder();
340
 
341
+ $result = $this->_getApi($order->getStoreId())->capture(
342
+ $authReferenceId,
343
  $authReferenceId,
 
344
  $amount,
345
  $order->getBaseCurrencyCode(),
346
  $this->_getSoftDescriptor()
352
  // Error handling
353
  switch ($status->getState()) {
354
  case Amazon_Payments_Model_Api::AUTH_STATUS_PENDING:
355
+ Mage::getSingleton('adminhtml/session')->addError('The invoice you are trying to create is for an authorization that is more than 7 days old. A capture request has been made. Please try and create this invoice again in 1 hour, allowing time for the capture to process.');
356
+ // cont'd...
357
  case Amazon_Payments_Model_Api::AUTH_STATUS_DECLINED:
358
  case Amazon_Payments_Model_Api::AUTH_STATUS_CLOSED:
359
  $this->_setErrorCheck();
392
 
393
  $order = $payment->getOrder();
394
 
395
+ $result = $this->_getApi($order->getStoreId())->refund(
396
  $payment->getRefundTransactionId(),
397
+ $this->_getMagentoReferenceId($payment) . '-refund',
398
  $amount,
399
  $order->getBaseCurrencyCode(),
400
  null,
431
  */
432
  protected function _void(Varien_Object $payment)
433
  {
434
+ $order = $payment->getOrder();
435
  $orderTransaction = $payment->lookupTransaction(false, Mage_Sales_Model_Order_Payment_Transaction::TYPE_ORDER);
436
 
437
  if (!$orderTransaction) {
442
  }
443
 
444
  if ($orderTransaction) {
445
+ $this->_getApi($order->getStoreId())->cancelOrderReference($orderTransactionId);
446
  }
447
  return $this;
448
  }
494
  return (Mage::getSingleton('amazon_payments/config')->isEnabled() && Mage::helper('amazon_payments')->isEnableProductPayments() && ((Mage::helper('amazon_payments')->isCheckoutAmazonSession() && $this->getConfigData('checkout_page') == 'onepage') || $this->getConfigData('use_in_checkout')));
495
  }
496
 
497
+ /**
498
+ * Force sync instead of async
499
+ */
500
+ public function setForceSync($isForceSync)
501
+ {
502
+ $this->isForceSync = $isForceSync;
503
+ }
504
 
505
  }
app/code/community/Amazon/Payments/Model/Resource/Login.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Login with Amazon
4
+ *
5
+ * @category Amazon
6
+ * @package Amazon_Payments
7
+ * @copyright Copyright (c) 2014 Amazon.com
8
+ * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
+ */
10
+
11
+ class Amazon_Payments_Model_Resource_Login extends Mage_Core_Model_Mysql4_Abstract
12
+ {
13
+ public function _construct()
14
+ {
15
+ $this->_init('amazon_payments/login', 'login_id');
16
+ }
17
+
18
+ protected function _getLoadSelect($field, $value, $object)
19
+ {
20
+ $select = parent::_getLoadSelect($field, $value, $object);
21
+
22
+ // Obey Account Sharing scope
23
+ if (Mage::getModel('customer/config_share')->isWebsiteScope()) {
24
+ $select->join(
25
+ array('customer' => $this->getTable('customer/entity')),
26
+ $this->getMainTable() . '.customer_id = customer.entity_id AND customer.website_id = ' . Mage::app()->getWebsite()->getId()
27
+ );
28
+ }
29
+ return $select;
30
+ }
31
+ }
app/code/community/Amazon/Payments/Model/SimplePath.php ADDED
@@ -0,0 +1,283 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Amazon Payments
4
+ *
5
+ * @category Amazon
6
+ * @package Amazon_Payments
7
+ * @copyright Copyright (c) 2014 Amazon.com
8
+ * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
+ */
10
+
11
+ class Amazon_Payments_Model_SimplePath
12
+ {
13
+ const API_ENDPOINT_DOWNLOAD_KEYS = 'https://payments.amazon.com/register';
14
+ const API_ENDPOINT_GET_PUBLICKEY = 'https://payments.amazon.com/register/getpublickey';
15
+
16
+ const PARAM_SP_ID = 'A2K7HE1S3M5XJ';
17
+
18
+ const CONFIG_XML_PATH_PRIVATE_KEY = 'payment/amazon_payments/simplepath/privatekey';
19
+ const CONFIG_XML_PATH_PUBLIC_KEY = 'payment/amazon_payments/simplepath/publickey';
20
+
21
+ /**
22
+ * Generate and save RSA keys
23
+ */
24
+ public function generateKeys()
25
+ {
26
+ $rsa = new Zend_Crypt_Rsa;
27
+ $keys = $rsa->generateKeys(array('private_key_bits' => 2048, 'hashAlgorithm' => 'sha1'));
28
+
29
+ Mage::getConfig()
30
+ ->saveConfig(self::CONFIG_XML_PATH_PUBLIC_KEY, $keys['publicKey'], 'default', 0)
31
+ ->saveConfig(self::CONFIG_XML_PATH_PRIVATE_KEY, Mage::helper('core')->encrypt($keys['privateKey']), 'default', 0);
32
+
33
+ Mage::app()->cleanCache();
34
+
35
+ return $keys;
36
+ }
37
+
38
+ /**
39
+ * Delete key-pair from config
40
+ */
41
+ public function destroyKeys()
42
+ {
43
+ Mage::getConfig()
44
+ ->deleteConfig(self::CONFIG_XML_PATH_PUBLIC_KEY, 'default', 0)
45
+ ->deleteConfig(self::CONFIG_XML_PATH_PRIVATE_KEY, 'default', 0);
46
+
47
+ Mage::app()->cleanCache();
48
+ }
49
+
50
+ /**
51
+ * Return RSA public key
52
+ *
53
+ * @param bool $pemformat Return key in PEM format
54
+ */
55
+ public function getPublicKey($pemformat = false, $reset = false)
56
+ {
57
+ $publickey = Mage::getStoreConfig(self::CONFIG_XML_PATH_PUBLIC_KEY, 0);
58
+
59
+ // Generate key pair
60
+ if (!$publickey || $reset) {
61
+ $keys = $this->generateKeys();
62
+ $publickey = $keys['publicKey'];
63
+ }
64
+
65
+ if (!$pemformat) {
66
+ $publickey = str_replace(array('-----BEGIN PUBLIC KEY-----', '-----END PUBLIC KEY-----', "\n"), array('','',''), $publickey);
67
+ }
68
+ return $publickey;
69
+ }
70
+
71
+ /**
72
+ * Return RSA private key
73
+ */
74
+ public function getPrivateKey()
75
+ {
76
+ return Mage::helper('core')->decrypt(Mage::getStoreConfig(self::CONFIG_XML_PATH_PRIVATE_KEY, 0));
77
+ }
78
+
79
+ /**
80
+ * Convert key to PEM format for openssl functions
81
+ */
82
+ public function key2pem($key)
83
+ {
84
+ return "-----BEGIN PUBLIC KEY-----\n" .
85
+ chunk_split($key, 64, "\n") .
86
+ "-----END PUBLIC KEY-----\n";
87
+ }
88
+
89
+ /**
90
+ * Verify and decrypt JSON payload
91
+ *
92
+ * @param string $payloadJson
93
+ */
94
+ public function decryptPayload($payloadJson, $autoEnable = true)
95
+ {
96
+ try {
97
+ $payload = Zend_Json::decode($payloadJson, Zend_Json::TYPE_OBJECT);
98
+ $payloadVerify = clone $payload;
99
+
100
+ // Unencrypted?
101
+ if (isset($payload->merchant_id, $payload->access_key, $payload->secret_key)) {
102
+ return $this->saveToConfig($payloadJson, $autoEnable);
103
+ }
104
+
105
+ // Validate JSON
106
+ if (!isset($payload->encryptedKey, $payload->encryptedPayload, $payload->iv, $payload->sigKeyID, $payload->signature)) {
107
+ Mage::throwException("Unable to import Amazon keys. Please verify your JSON format and values.");
108
+ }
109
+
110
+ // URL decode values
111
+ foreach ($payload as $key => $value) {
112
+ $payload->$key = urldecode($value);
113
+ }
114
+
115
+ // Retrieve Amazon public key to verify signature
116
+ try {
117
+ $client = new Zend_Http_Client(self::API_ENDPOINT_GET_PUBLICKEY, array(
118
+ 'maxredirects' => 2,
119
+ 'timeout' => 30));
120
+
121
+ $client->setParameterGet(array('sigkey_id' => $payload->sigKeyID));
122
+
123
+ $response = $client->request();
124
+ $amazonPublickey = urldecode($response->getBody());
125
+
126
+ } catch (Exception $e) {
127
+ Mage::throwException($e->getMessage());
128
+ }
129
+
130
+ // Use raw JSON (without signature or URL decode) as the data to verify signature
131
+ unset($payloadVerify->signature);
132
+ $payloadVerifyJson = Zend_Json::encode($payloadVerify);
133
+
134
+ // Verify signature using Amazon publickey and JSON paylaod
135
+ if ($amazonPublickey && openssl_verify($payloadVerifyJson, base64_decode($payload->signature), $this->key2pem($amazonPublickey), 'SHA256')) {
136
+
137
+ // Decrypt Amazon key using own private key
138
+ $decryptedKey = null;
139
+ openssl_private_decrypt(base64_decode($payload->encryptedKey), $decryptedKey, $this->getPrivateKey(), OPENSSL_PKCS1_OAEP_PADDING);
140
+
141
+ // Decrypt final payload (AES 128-bit)
142
+ $finalPayload = mcrypt_cbc(MCRYPT_RIJNDAEL_128, $decryptedKey, base64_decode($payload->encryptedPayload), MCRYPT_DECRYPT, base64_decode($payload->iv));
143
+
144
+ // Remove binary characters
145
+ $finalPayload = preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $finalPayload);
146
+
147
+ if (Zend_Json::decode($finalPayload)) {
148
+ $this->saveToConfig($finalPayload, $autoEnable);
149
+ $this->destroyKeys();
150
+ return $finalPayload;
151
+ }
152
+
153
+ } else {
154
+ Mage::throwException("Unable to verify signature for JSON payload.");
155
+ }
156
+
157
+ } catch (Exception $e) {
158
+ Mage::logException($e);
159
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('amazon_payments')->__($e->getMessage()));
160
+
161
+ $link = 'https://payments.amazon.com/help/202024240';
162
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('amazon_payments')->__("If you're experiencing consistant errors with transfering keys, click <a href=\"%s\" target=\"_blank\">Manual Transfer Instructions</a> to learn more.", $link));
163
+ }
164
+
165
+ return false;
166
+ }
167
+
168
+ /**
169
+ * Save values to Mage config
170
+ *
171
+ * @param string $json
172
+ */
173
+ public function saveToConfig($json, $autoEnable = true)
174
+ {
175
+ if ($values = Zend_Json::decode($json, Zend_Json::TYPE_OBJECT)) {
176
+ foreach ($values as $key => $value) {
177
+ $values->{strtolower($key)} = $value;
178
+ }
179
+ $config = Mage::getModel('core/config');
180
+ $amazonConfig = Mage::getSingleton('amazon_payments/config');
181
+
182
+ $config->saveConfig($amazonConfig::CONFIG_XML_PATH_SELLER_ID, $values->merchant_id, 'default', 0);
183
+ $config->saveConfig($amazonConfig::CONFIG_XML_PATH_CLIENT_ID, $values->client_id, 'default', 0);
184
+ $config->saveConfig($amazonConfig::CONFIG_XML_PATH_CLIENT_SECRET, Mage::helper('core')->encrypt($values->client_secret), 'default', 0);
185
+ $config->saveConfig($amazonConfig::CONFIG_XML_PATH_ACCESS_KEY, $values->access_key, 'default', 0);
186
+ $config->saveConfig($amazonConfig::CONFIG_XML_PATH_ACCESS_SECRET, Mage::helper('core')->encrypt($values->secret_key), 'default', 0);
187
+
188
+
189
+ if ($autoEnable) {
190
+ $this->autoEnable();
191
+ }
192
+
193
+ Mage::app()->cleanCache();
194
+
195
+ return true;
196
+ }
197
+ }
198
+
199
+ /**
200
+ * Auto-enable payment method
201
+ */
202
+ public function autoEnable()
203
+ {
204
+ $enableMessage = Mage::helper('amazon_payments')->__("Login and Pay with Amazon is now enabled.");
205
+
206
+ $config = Mage::getModel('core/config');
207
+ $amazonConfig = Mage::getSingleton('amazon_payments/config');
208
+
209
+ if (!Mage::getStoreConfig($amazonConfig::CONFIG_XML_PATH_ENABLED)) {
210
+ $config->saveConfig($amazonConfig::CONFIG_XML_PATH_ENABLED, true, 'default', 0);
211
+ Mage::getSingleton('adminhtml/session')
212
+ ->addSuccess($enableMessage)
213
+ ->setEnableMessage($enableMessage);
214
+ }
215
+ }
216
+
217
+ /**
218
+ * Return listner URL
219
+ */
220
+ public function getListenerUrl()
221
+ {
222
+ $url = Mage::getUrl('amazon_payments/simplepath', array('_store' => 1, '_forced_secure' => true));
223
+ // Add index.php
224
+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB, true);
225
+ return str_replace($baseUrl, $baseUrl . 'index.php/', $url);
226
+ }
227
+
228
+ /**
229
+ * Return simplepath URL
230
+ */
231
+ public function getSimplepathUrl()
232
+ {
233
+ return self::API_ENDPOINT_DOWNLOAD_KEYS . '?returnUrl=' . $this->getListenerUrl() .
234
+ '&pub_key=' . urlencode($this->getPublicKey()) .
235
+ '#event/fromSP';
236
+ }
237
+
238
+ /**
239
+ * Return array of form POST params for SimplePath sign up
240
+ */
241
+ public function getFormParams()
242
+ {
243
+ // Retrieve store URLs from config
244
+ $urls = array();
245
+ $db = Mage::getSingleton('core/resource')->getConnection('core_read');
246
+
247
+ $select = $db->select()
248
+ ->from('core_config_data')
249
+ ->where('path IN (?)', array('web/unsecure/base_url', 'web/secure/base_url'));
250
+
251
+ foreach ($db->fetchAll($select) as $row) {
252
+ $url = parse_url($row['value']);
253
+ $urls[] = 'https://' . $url['host'];
254
+ }
255
+
256
+ return array(
257
+ 'locale' => Mage::getStoreConfig('general/country/default'),
258
+ 'spId' => self::PARAM_SP_ID,
259
+ 'allowedLoginDomains[]' => array_unique($urls),
260
+ 'spSoftwareVersion' => Mage::getVersion(),
261
+ 'spAmazonPluginVersion' => Mage::getConfig()->getModuleConfig("Amazon_Payments")->version,
262
+ );
263
+ }
264
+
265
+ /**
266
+ * Return array of config for JSON AmazonSp variable.
267
+ *
268
+ * @see Amazon_Payments_Model_System_Config_Backend_Enabled->getCommentText()
269
+ */
270
+ public function getJsonAmazonSpConfig()
271
+ {
272
+ return array(
273
+ 'amazonUrl' => $this->getSimplepathUrl(),
274
+ 'pollUrl' => Mage::helper('adminhtml')->getUrl('adminhtml/amazon_simplepath/poll'),
275
+ //'spUrl' => Mage::helper("adminhtml")->getUrl('adminhtml/amazon_simplepath/spurl'),
276
+ 'importUrl' => Mage::helper('adminhtml')->getUrl('adminhtml/amazon_simplepath/import'),
277
+ 'isSecure' => (int) (Mage::app()->getFrontController()->getRequest()->isSecure()),
278
+ 'isUsa' => (int) (Mage::helper('amazon_payments')->getAdminConfig('general/country/default') == 'US'),
279
+ 'hasOpenssl' => (int) (extension_loaded('openssl')),
280
+ 'formParams' => $this->getFormParams(),
281
+ );
282
+ }
283
+ }
app/code/community/Amazon/Payments/Model/System/Config/Backend/Clientid.php DELETED
@@ -1,30 +0,0 @@
1
- <?php
2
- /**
3
- * Amazon Payments
4
- *
5
- * @category Amazon
6
- * @package Amazon_Payments
7
- * @copyright Copyright (c) 2014 Amazon.com
8
- * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
- */
10
-
11
- class Amazon_Payments_Model_System_Config_Backend_Clientid extends Mage_Core_Model_Config_Data
12
- {
13
- private $_path = 'amazon_login/settings/client_id';
14
-
15
- /**
16
- * Use Amazon_Login Client ID
17
- */
18
- public function save()
19
- {
20
- Mage::getConfig()->saveConfig($this->_path, $this->value);
21
- return parent::save();
22
- }
23
-
24
- public function afterLoad()
25
- {
26
- $this->value = Mage::getStoreConfig($this->_path);
27
- $this->_afterLoad();
28
- }
29
-
30
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Amazon/Payments/Model/System/Config/Backend/Clientsecret.php DELETED
@@ -1,30 +0,0 @@
1
- <?php
2
- /**
3
- * Amazon Payments
4
- *
5
- * @category Amazon
6
- * @package Amazon_Payments
7
- * @copyright Copyright (c) 2014 Amazon.com
8
- * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
- */
10
-
11
- class Amazon_Payments_Model_System_Config_Backend_Clientsecret extends Mage_Core_Model_Config_Data
12
- {
13
- private $_path = 'amazon_login/settings/client_secret';
14
-
15
- /**
16
- * Use Amazon_Login Client ID
17
- */
18
- public function save()
19
- {
20
- Mage::getConfig()->saveConfig($this->_path, $this->value);
21
- return parent::save();
22
- }
23
-
24
- public function afterLoad()
25
- {
26
- $this->value = Mage::getStoreConfig($this->_path);
27
- $this->_afterLoad();
28
- }
29
-
30
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Amazon/Payments/Model/System/Config/Backend/Enabled.php CHANGED
@@ -16,11 +16,11 @@ class Amazon_Payments_Model_System_Config_Backend_Enabled extends Mage_Core_Mode
16
  public function save()
17
  {
18
 
19
- $data = $this->getFieldsetData();
20
  $isEnabled = $this->getValue();
21
 
22
  if ($isEnabled) {
23
- if ($data['seller_id'] && !ctype_alnum($data['seller_id'])) {
24
  Mage::getSingleton('core/session')->addError('Error: Please verify your Seller ID (alphanumeric characters only).');
25
  }
26
  }
@@ -32,10 +32,15 @@ class Amazon_Payments_Model_System_Config_Backend_Enabled extends Mage_Core_Mode
32
  */
33
  public function _afterSaveCommit()
34
  {
35
- $data = $this->getFieldsetData();
36
  $isEnabled = $this->getValue();
37
 
38
- if ($isEnabled) {
 
 
 
 
 
39
  $config = array (
40
  'ServiceURL' => "https://mws.amazonservices.com/Sellers/2011-07-01",
41
  'ProxyHost' => null,
@@ -45,14 +50,14 @@ class Amazon_Payments_Model_System_Config_Backend_Enabled extends Mage_Core_Mode
45
  'MaxErrorRetry' => 3,
46
  );
47
  $service = new MarketplaceWebServiceSellers_Client(
48
- $data['access_key'],
49
- $data['access_secret'],
50
  'Login and Pay for Magento',
51
  '1.3',
52
  $config);
53
 
54
  $request = new MarketplaceWebServiceSellers_Model_ListMarketplaceParticipationsRequest();
55
- $request->setSellerId($data['seller_id']);
56
  try {
57
  $service->ListMarketplaceParticipations($request);
58
  Mage::getSingleton('core/session')->addSuccess("All of your Amazon API keys are correct!");
@@ -83,12 +88,37 @@ class Amazon_Payments_Model_System_Config_Backend_Enabled extends Mage_Core_Mode
83
 
84
  /**
85
  * Return dynamic help/comment text
86
- *
87
  */
88
  public function getCommentText(Mage_Core_Model_Config_Element $element, $currentValue)
89
  {
90
  $version = Mage::getConfig()->getModuleConfig("Amazon_Payments")->version;
91
- return "v$version";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  }
93
 
94
  }
16
  public function save()
17
  {
18
 
19
+ $data = $this->_getCredentials();
20
  $isEnabled = $this->getValue();
21
 
22
  if ($isEnabled) {
23
+ if ($data['seller_id']['value'] && !ctype_alnum($data['seller_id']['value'])) {
24
  Mage::getSingleton('core/session')->addError('Error: Please verify your Seller ID (alphanumeric characters only).');
25
  }
26
  }
32
  */
33
  public function _afterSaveCommit()
34
  {
35
+ $data = $this->_getCredentials();
36
  $isEnabled = $this->getValue();
37
 
38
+ $access_secret = $data['access_secret']['value'];
39
+ if (strpos($access_secret, '*****') !== FALSE) { // Encrypted
40
+ $access_secret = Mage::getSingleton('amazon_payments/config')->getAccessSecret();
41
+ }
42
+
43
+ if ($isEnabled && $data['access_key']['value']) {
44
  $config = array (
45
  'ServiceURL' => "https://mws.amazonservices.com/Sellers/2011-07-01",
46
  'ProxyHost' => null,
50
  'MaxErrorRetry' => 3,
51
  );
52
  $service = new MarketplaceWebServiceSellers_Client(
53
+ $data['access_key']['value'],
54
+ $access_secret,
55
  'Login and Pay for Magento',
56
  '1.3',
57
  $config);
58
 
59
  $request = new MarketplaceWebServiceSellers_Model_ListMarketplaceParticipationsRequest();
60
+ $request->setSellerId($data['seller_id']['value']);
61
  try {
62
  $service->ListMarketplaceParticipations($request);
63
  Mage::getSingleton('core/session')->addSuccess("All of your Amazon API keys are correct!");
88
 
89
  /**
90
  * Return dynamic help/comment text
 
91
  */
92
  public function getCommentText(Mage_Core_Model_Config_Element $element, $currentValue)
93
  {
94
  $version = Mage::getConfig()->getModuleConfig("Amazon_Payments")->version;
95
+
96
+ // @see Amazon_Payments_Model_SimplePath->saveToConfig()
97
+ $enabledMessage = Mage::getSingleton('adminhtml/session')->getEnableMessage();
98
+ if ($enabledMessage) {
99
+ $enabledMessage = '<div style="color:red">' . $enabledMessage . '</div>';
100
+ Mage::getSingleton('adminhtml/session')->unsEnableMessage();
101
+ }
102
+
103
+ // SimplePath
104
+ return "v$version
105
+
106
+ $enabledMessage
107
+
108
+ <!-- SimplePath -->
109
+ <script>
110
+ var AmazonSp = " . Zend_Json::encode(Mage::getSingleton('amazon_payments/simplePath')->getJsonAmazonSpConfig()) . ";
111
+ </script>
112
+ ";
113
+ }
114
+
115
+ /**
116
+ * Return credentials
117
+ */
118
+ private function _getCredentials()
119
+ {
120
+ $groups = $this->getData('groups');
121
+ return $groups['ap_credentials']['fields'];
122
  }
123
 
124
  }
app/code/community/Amazon/{Login → Payments}/Model/System/Config/Backend/Popupcomment.php RENAMED
@@ -1,14 +1,14 @@
1
  <?php
2
  /**
3
- * Amazon Login
4
  *
5
  * @category Amazon
6
- * @package Amazon_Login
7
  * @copyright Copyright (c) 2014 Amazon.com
8
  * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
  */
10
 
11
- class Amazon_Login_Model_System_Config_Backend_Popupcomment extends Mage_Core_Model_Config_Data
12
  {
13
  /**
14
  * Return dynamic help/comment text
@@ -16,16 +16,18 @@ class Amazon_Login_Model_System_Config_Backend_Popupcomment extends Mage_Core_Mo
16
  */
17
  public function getCommentText(Mage_Core_Model_Config_Element $element, $currentValue)
18
  {
 
19
  $replace_cleanup = array('index.php/', ':80', ':443');
20
 
21
- return 'Pop-up window or full-page redirect.<br />
22
  <div style="border:1px solid #ccc; color:#666; padding:8px; margin-top:0.5em; font-size:90%">
23
  If "No," add these URLs in Seller Central under "Allowed Return URLs":<br />
24
  <ul style="list-style:disc inside">
25
- <li>' . str_replace($replace_cleanup, '', Mage::getUrl('amazon_login/customer/authorize', array('_forced_secure' => true))) . '</li>
26
- <li>' . str_replace($replace_cleanup, '', Mage::getUrl('amazon_payments/checkout/authorize', array('_forced_secure' => true))) . '</li>
27
  </ul>
28
  </div>
 
29
 
30
 
31
  ';
1
  <?php
2
  /**
3
+ * Amazon payments
4
  *
5
  * @category Amazon
6
+ * @package Amazon_Payments
7
  * @copyright Copyright (c) 2014 Amazon.com
8
  * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
  */
10
 
11
+ class Amazon_Payments_Model_System_Config_Backend_Popupcomment extends Mage_Core_Model_Config_Data
12
  {
13
  /**
14
  * Return dynamic help/comment text
16
  */
17
  public function getCommentText(Mage_Core_Model_Config_Element $element, $currentValue)
18
  {
19
+
20
  $replace_cleanup = array('index.php/', ':80', ':443');
21
 
22
+ return '
23
  <div style="border:1px solid #ccc; color:#666; padding:8px; margin-top:0.5em; font-size:90%">
24
  If "No," add these URLs in Seller Central under "Allowed Return URLs":<br />
25
  <ul style="list-style:disc inside">
26
+ <li>' . str_replace($replace_cleanup, '', Mage::getUrl('amazon_payments/customer/authorize', array('_store' => 1, '_forced_secure' => true))) . '</li>
27
+ <li>' . str_replace($replace_cleanup, '', Mage::getUrl('amazon_payments/checkout/authorize', array('_store' => 1, '_forced_secure' => true))) . '</li>
28
  </ul>
29
  </div>
30
+ <style>#payment_amazon_payments_popupcomment{display:none;}</style>
31
 
32
 
33
  ';
app/code/community/Amazon/Payments/Model/System/Config/Backend/Simplepath.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Amazon Payments
4
+ *
5
+ * @category Amazon
6
+ * @package Amazon_Payments
7
+ * @copyright Copyright (c) 2014 Amazon.com
8
+ * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
+ */
10
+
11
+ class Amazon_Payments_Model_System_Config_Backend_Simplepath extends Mage_Core_Model_Config_Data
12
+ {
13
+ /**
14
+ * Validate data
15
+ */
16
+ public function save()
17
+ {
18
+ // Don't save
19
+ //return parent::save();
20
+ }
21
+
22
+
23
+ }
app/code/community/Amazon/Payments/Model/System/Config/Source/Paymentaction.php CHANGED
@@ -15,6 +15,7 @@ class Amazon_Payments_Model_System_Config_Source_Paymentaction
15
  return array(
16
  array('value'=>'authorize_capture', 'label'=>Mage::helper('adminhtml')->__('Authorize and Capture')),
17
  array('value'=>'authorize', 'label'=>Mage::helper('adminhtml')->__('Authorize Only')),
 
18
  );
19
  }
20
  }
15
  return array(
16
  array('value'=>'authorize_capture', 'label'=>Mage::helper('adminhtml')->__('Authorize and Capture')),
17
  array('value'=>'authorize', 'label'=>Mage::helper('adminhtml')->__('Authorize Only')),
18
+ array('value'=>'new', 'label'=>Mage::helper('adminhtml')->__('None')),
19
  );
20
  }
21
  }
app/code/community/Amazon/Payments/Model/Type/Checkout.php CHANGED
@@ -58,25 +58,9 @@ class Amazon_Payments_Model_Type_Checkout extends Mage_Checkout_Model_Type_Onepa
58
 
59
  $address = $this->getQuote()->getShippingAddress();
60
 
61
- /* @var $addressForm Mage_Customer_Model_Form */
62
- /*
63
- $addressForm = Mage::getModel('customer/form');
64
- $addressForm->setFormCode('customer_address_edit')
65
- ->setEntityType('customer_address')
66
- ->setIsAjaxRequest(Mage::app()->getRequest()->isAjax());
67
-
68
- $addressForm->setEntity($address);
69
- // emulate request object
70
- $addressData = $addressForm->extractData($addressForm->prepareRequest($data));
71
-
72
- $addressForm->compactData($addressData);
73
- // unset shipping address attributes which were not shown in form
74
- foreach ($addressForm->getAttributes() as $attribute) {
75
- if (!isset($data[$attribute->getAttributeCode()])) {
76
- $address->setData($attribute->getAttributeCode(), NULL);
77
- }
78
  }
79
- */
80
 
81
  $address->setCustomerAddressId(null);
82
  // Additional form data, not fetched by extractData (as it fetches only attributes)
58
 
59
  $address = $this->getQuote()->getShippingAddress();
60
 
61
+ foreach ($data as $attribute => $value) {
62
+ $address->setData($attribute, $value);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  }
 
64
 
65
  $address->setCustomerAddressId(null);
66
  // Additional form data, not fetched by extractData (as it fetches only attributes)
app/code/community/Amazon/Payments/controllers/Adminhtml/Amazon/PaymentsController.php CHANGED
@@ -37,6 +37,5 @@ class Amazon_Payments_Adminhtml_Amazon_PaymentsController extends Mage_Adminhtml
37
 
38
  Mage::app()->getResponse()->setRedirect(Mage::helper('adminhtml')->getUrl("adminhtml/sales_order/view", array('order_id' => $orderId)));
39
  }
40
-
41
  }
42
  }
37
 
38
  Mage::app()->getResponse()->setRedirect(Mage::helper('adminhtml')->getUrl("adminhtml/sales_order/view", array('order_id' => $orderId)));
39
  }
 
40
  }
41
  }
app/code/community/Amazon/Payments/controllers/Adminhtml/Amazon/SimplepathController.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Amazon Payments SimplePath
4
+ *
5
+ * @category Amazon
6
+ * @package Amazon_Payments
7
+ * @copyright Copyright (c) 2014 Amazon.com
8
+ * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
+ */
10
+
11
+ class Amazon_Payments_Adminhtml_Amazon_SimplepathController extends Mage_Adminhtml_Controller_Action
12
+ {
13
+ /**
14
+ * Return SimplePath URL with regenerated key-pair
15
+ */
16
+ public function spurlAction()
17
+ {
18
+ $this->getResponse()->setHeader('Content-type', 'application/json');
19
+ $this->getResponse()->setBody(Mage::getSingleton('amazon_payments/simplePath')->getSimplepathUrl());
20
+ }
21
+
22
+ /**
23
+ * Detect whether Amazon credentials are set (polled by Ajax)
24
+ */
25
+ public function pollAction()
26
+ {
27
+ // Keypair is destroyed when credentials are saved
28
+ $shouldRefresh = !Mage::getStoreConfig(Amazon_Payments_Model_SimplePath::CONFIG_XML_PATH_PUBLIC_KEY, 0) ? 1 : 0;
29
+
30
+ if ($shouldRefresh) {
31
+ Mage::getModel('amazon_payments/simplePath')->autoEnable();
32
+ }
33
+
34
+ $this->getResponse()->setHeader('Content-type', 'application/json');
35
+ $this->getResponse()->setBody($shouldRefresh);
36
+ }
37
+
38
+ /**
39
+ * Import config values via clipboard
40
+ */
41
+ public function importAction()
42
+ {
43
+ $response = array();
44
+
45
+ $value = trim($this->getRequest()->getParam('json'));
46
+
47
+ if ($value) {
48
+ $value = str_replace('&quot;', '"', $value);
49
+ $_simplePath = Mage::getModel('amazon_payments/simplePath');
50
+
51
+ $json = $_simplePath->decryptPayload($value);
52
+
53
+ if ($json === true) {
54
+ Mage::getSingleton('adminhtml/session')->addSuccess("Login and Pay with Amazon credentials imported.");
55
+ } else if ($json) {
56
+ Mage::getSingleton('adminhtml/session')->addSuccess("Login and Pay with Amazon credentials imported.");
57
+ }
58
+
59
+ $response['success'] = true;
60
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
61
+ }
62
+ }
63
+
64
+ }
app/code/community/Amazon/{Login → Payments}/controllers/CustomerController.php RENAMED
@@ -1,14 +1,14 @@
1
  <?php
2
  /**
3
- * Login with Amazon Customer Controller
4
  *
5
  * @category Amazon
6
- * @package Amazon_Login
7
  * @copyright Copyright (c) 2014 Amazon.com
8
  * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
  */
10
 
11
- class Amazon_Login_CustomerController extends Mage_Core_Controller_Front_Action
12
  {
13
 
14
  /**
@@ -25,7 +25,7 @@ class Amazon_Login_CustomerController extends Mage_Core_Controller_Front_Action
25
  }
26
 
27
  if ($token) {
28
- $customer = Mage::getModel('amazon_login/customer')->loginWithToken($token);
29
 
30
  if ($customer->getId()) {
31
  $this->_redirectUrl(Mage::helper('customer')->getDashboardUrl());
@@ -61,11 +61,11 @@ class Amazon_Login_CustomerController extends Mage_Core_Controller_Front_Action
61
  public function verifyAction()
62
  {
63
  if ($login = $this->getRequest()->getParam('login')) {
64
- $profile = Mage::helper('amazon_login')->getAmazonProfileSession();
65
 
66
  try {
67
  if (Mage::getSingleton('customer/session')->login($profile['email'], $login['password'])) {
68
- Mage::getSingleton('amazon_login/customer')->createAssociation($profile, Mage::getSingleton('customer/session')->getCustomer()->getId());
69
 
70
  if ($token = Mage::getSingleton('checkout/session')->getAmazonAccessTokenVerify()) {
71
  Mage::getSingleton('checkout/session')->setAmazonAccessToken($token);
@@ -88,7 +88,6 @@ class Amazon_Login_CustomerController extends Mage_Core_Controller_Front_Action
88
 
89
  }
90
 
91
-
92
  $this->loadLayout();
93
  $this->_initLayoutMessages('customer/session');
94
  $this->renderLayout();
1
  <?php
2
  /**
3
+ * Amazon Payments
4
  *
5
  * @category Amazon
6
+ * @package Amazon_Payments
7
  * @copyright Copyright (c) 2014 Amazon.com
8
  * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
  */
10
 
11
+ class Amazon_Payments_CustomerController extends Mage_Core_Controller_Front_Action
12
  {
13
 
14
  /**
25
  }
26
 
27
  if ($token) {
28
+ $customer = Mage::getModel('amazon_payments/customer')->loginWithToken($token);
29
 
30
  if ($customer->getId()) {
31
  $this->_redirectUrl(Mage::helper('customer')->getDashboardUrl());
61
  public function verifyAction()
62
  {
63
  if ($login = $this->getRequest()->getParam('login')) {
64
+ $profile = Mage::helper('amazon_payments')->getAmazonProfileSession();
65
 
66
  try {
67
  if (Mage::getSingleton('customer/session')->login($profile['email'], $login['password'])) {
68
+ Mage::getSingleton('amazon_payments/customer')->createAssociation($profile, Mage::getSingleton('customer/session')->getCustomer()->getId());
69
 
70
  if ($token = Mage::getSingleton('checkout/session')->getAmazonAccessTokenVerify()) {
71
  Mage::getSingleton('checkout/session')->setAmazonAccessToken($token);
88
 
89
  }
90
 
 
91
  $this->loadLayout();
92
  $this->_initLayoutMessages('customer/session');
93
  $this->renderLayout();
app/code/community/Amazon/Payments/controllers/OnepageController.php CHANGED
@@ -56,6 +56,22 @@ class Amazon_Payments_OnepageController extends Amazon_Payments_Controller_Check
56
  );
57
  }
58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  }
60
  // Catch any API errors like invalid keys
61
  catch (Exception $e) {
56
  );
57
  }
58
 
59
+ $data = $this->getRequest()->getPost('billing', array());
60
+
61
+ // Save Amasty Customer Attributes
62
+ if (isset($data['amcustomerattr'])) {
63
+ Mage::app()->getRequest()->setPost('amcustomerattr', $data['amcustomerattr']);
64
+ Mage::getSingleton('customer/session')->getCustomer()->save();
65
+ }
66
+
67
+ // Sign Up for Newsletter
68
+ if ($this->getRequest()->getPost('is_subscribed', false)) {
69
+ Mage::getSingleton('customer/session')->getCustomer()
70
+ ->setStoreId(Mage::app()->getStore()->getId())
71
+ ->setIsSubscribed(true)
72
+ ->save();
73
+ }
74
+
75
  }
76
  // Catch any API errors like invalid keys
77
  catch (Exception $e) {
app/code/community/Amazon/Payments/controllers/OrderController.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Amazon Payments Order Controller
4
+ *
5
+ * @category Amazon
6
+ * @package Amazon_Payments
7
+ * @copyright Copyright (c) 2014 Amazon.com
8
+ * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
+ */
10
+
11
+ class Amazon_Payments_OrderController extends Mage_Core_Controller_Front_Action
12
+ {
13
+
14
+ /**
15
+ * Confirm order and re-authorize
16
+ */
17
+ public function confirmAction()
18
+ {
19
+ $orderId = $this->getRequest()->getParam('order_id');
20
+ $order = Mage::getModel('sales/order')->load($orderId);
21
+
22
+ $orderUrl = Mage::getUrl('sales/order/view', array(
23
+ 'order_id' => $order->getId(),
24
+ '_store' => $order->getStoreId(),
25
+ ));
26
+
27
+ if ($order->getPayment()->getMethod() == 'amazon_payments' && $order->getState() == Mage_Sales_Model_Order::STATE_HOLDED) {
28
+ $orderReferenceId = $order->getPayment()->getAdditionalInformation('order_reference');
29
+
30
+ $_api = Mage::getModel('amazon_payments/api')->setStore($order->getStoreId());
31
+
32
+ try {
33
+ $apiResult = $_api->confirmOrderReference($orderReferenceId);
34
+
35
+ // Re-authorize
36
+ Mage::getModel('amazon_payments/async')->syncOrderStatus($order, true);
37
+
38
+ Mage::getSingleton('core/session')->addSuccess('Thank you for updating your payment method.');
39
+
40
+ }
41
+ catch (Exception $e) {
42
+ Mage::getSingleton('core/session')->addError('Please try another payment method.');
43
+ Mage::logException($e);
44
+ }
45
+ }
46
+
47
+ $this->_redirect('sales/order/view/order_id/' . $order->getId());
48
+ }
49
+
50
+ }
app/code/community/Amazon/Payments/controllers/SimplepathController.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Amazon Payments
5
+ *
6
+ * @category Amazon
7
+ * @package Amazon_Payments
8
+ * @copyright Copyright (c) 2014 Amazon.com
9
+ * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
10
+ */
11
+
12
+ class Amazon_Payments_SimplepathController extends Mage_Core_Controller_Front_Action
13
+ {
14
+ /**
15
+ * Simplepath callback
16
+ */
17
+ public function indexAction()
18
+ {
19
+ $url = parse_url(Amazon_Payments_Model_SimplePath::API_ENDPOINT_DOWNLOAD_KEYS);
20
+
21
+ header('Access-Control-Allow-Origin: https://' . $url['host']);
22
+ header('Access-Control-Allow-Methods: GET, POST');
23
+ header('Access-Control-Allow-Headers: Content-Type');
24
+
25
+ $payloadJson = Mage::app()->getRequest()->getParam('payload');
26
+
27
+ $this->getResponse()->setHeader('Content-type', 'application/json');
28
+
29
+ try {
30
+ if ($payloadJson) {
31
+ $_simplePath = Mage::getModel('amazon_payments/simplePath');
32
+ $json = $_simplePath->decryptPayload($payloadJson, false);
33
+
34
+ if ($json) {
35
+ $this->getResponse()->setBody(Zend_Json::encode(array('result' => 'success')));
36
+ }
37
+ } else {
38
+ $this->getResponse()->setHeader('HTTP/1.0','400',true);
39
+ $this->getResponse()->setBody(Zend_Json::encode(array('result' => 'error', 'message' => 'payload parameter not found.')));
40
+ }
41
+
42
+ } catch (Exception $e) {
43
+ $this->getResponse()->setHeader('HTTP/1.0','400',true);
44
+ $this->getResponse()->setBody(Zend_Json::encode(array('result' => 'error', 'message' => $e->getMessage())));
45
+ }
46
+ }
47
+
48
+
49
+ }
app/code/community/Amazon/Payments/etc/config.xml CHANGED
@@ -10,8 +10,12 @@
10
  <config>
11
  <modules>
12
  <Amazon_Payments>
13
- <version>1.3.0</version>
14
  </Amazon_Payments>
 
 
 
 
15
  </modules>
16
  <global>
17
  <blocks>
@@ -22,7 +26,16 @@
22
  <models>
23
  <amazon_payments>
24
  <class>Amazon_Payments_Model</class>
 
25
  </amazon_payments>
 
 
 
 
 
 
 
 
26
  <sales>
27
  <rewrite>
28
  <order_creditmemo>Amazon_Payments_Model_Order_Creditmemo</order_creditmemo>
@@ -34,14 +47,26 @@
34
  <class>Amazon_Payments_Helper</class>
35
  </amazon_payments>
36
  </helpers>
37
-
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  <rewrite>
39
  <amazon_payments_checkout>
40
  <from><![CDATA[#^/checkout/amazon_payments#]]></from>
41
  <to>/amazon_payments/checkout</to>
42
  </amazon_payments_checkout>
43
  </rewrite>
44
-
45
  <resources>
46
  <payments_setup>
47
  <setup>
@@ -53,7 +78,6 @@
53
  </connection>
54
  </payments_setup>
55
  </resources>
56
-
57
  </global>
58
  <admin>
59
  <routers>
@@ -61,6 +85,7 @@
61
  <args>
62
  <modules>
63
  <Amazon_Payments after="Mage_Adminhtml">Amazon_Payments_Adminhtml</Amazon_Payments>
 
64
  </modules>
65
  </args>
66
  </adminhtml>
@@ -83,14 +108,25 @@
83
  </amazon_payments>
84
  </observers>
85
  </adminhtml_widget_container_html_before>
 
 
 
 
 
 
 
 
86
  </events>
87
  </adminhtml>
88
-
89
  <frontend>
90
  <secure_url>
91
  <cart_updatepost>/checkout/cart/updatePost</cart_updatepost>
 
 
92
  <checkout_amazon>/checkout/amazon_payments</checkout_amazon>
93
  <amazon_checkout>/amazon_payments/checkout</amazon_checkout>
 
 
94
  </secure_url>
95
  <routers>
96
  <amazon_payments>
@@ -143,13 +179,13 @@
143
  </custom_quote_process>
144
  </events>
145
  </frontend>
146
-
147
  <default>
148
  <payment>
149
  <amazon_payments>
150
- <title>Amazon Payments</title>
151
  <model>amazon_payments/paymentMethod</model>
152
  <payment_action>authorize_capture</payment_action>
 
153
  <show_pay_cart>1</show_pay_cart>
154
  <order_status>processing</order_status>
155
  <active>1</active>
@@ -158,10 +194,17 @@
158
  <button_color>Gold</button_color>
159
  <button_size>medium</button_size>
160
  <button_badge>1</button_badge>
 
 
 
161
  </amazon_payments>
162
  </payment>
 
 
 
 
 
163
  </default>
164
-
165
  <crontab>
166
  <jobs>
167
  <amazon_payments_async>
@@ -170,5 +213,4 @@
170
  </amazon_payments_async>
171
  </jobs>
172
  </crontab>
173
-
174
- </config>
10
  <config>
11
  <modules>
12
  <Amazon_Payments>
13
+ <version>1.4.0</version>
14
  </Amazon_Payments>
15
+ <Amazon_Login>
16
+ <!-- Disable legacy module -->
17
+ <active>false</active>
18
+ </Amazon_Login>
19
  </modules>
20
  <global>
21
  <blocks>
26
  <models>
27
  <amazon_payments>
28
  <class>Amazon_Payments_Model</class>
29
+ <resourceModel>login_mysql4</resourceModel>
30
  </amazon_payments>
31
+ <login_mysql4>
32
+ <class>Amazon_Payments_Model_Resource</class>
33
+ <entities>
34
+ <login>
35
+ <table>amazon_login</table>
36
+ </login>
37
+ </entities>
38
+ </login_mysql4>
39
  <sales>
40
  <rewrite>
41
  <order_creditmemo>Amazon_Payments_Model_Order_Creditmemo</order_creditmemo>
47
  <class>Amazon_Payments_Helper</class>
48
  </amazon_payments>
49
  </helpers>
50
+ <template>
51
+ <email>
52
+ <amazon_payments_async_decline_soft>
53
+ <label>Amazon Payments Async Decline (Soft)</label>
54
+ <file>amazon_payments_async_decline_soft.html</file>
55
+ <type>html</type>
56
+ </amazon_payments_async_decline_soft>
57
+ <amazon_payments_async_decline_hard>
58
+ <label>Amazon Payments Async Decline (Hard)</label>
59
+ <file>amazon_payments_async_decline_hard.html</file>
60
+ <type>html</type>
61
+ </amazon_payments_async_decline_hard>
62
+ </email>
63
+ </template>
64
  <rewrite>
65
  <amazon_payments_checkout>
66
  <from><![CDATA[#^/checkout/amazon_payments#]]></from>
67
  <to>/amazon_payments/checkout</to>
68
  </amazon_payments_checkout>
69
  </rewrite>
 
70
  <resources>
71
  <payments_setup>
72
  <setup>
78
  </connection>
79
  </payments_setup>
80
  </resources>
 
81
  </global>
82
  <admin>
83
  <routers>
85
  <args>
86
  <modules>
87
  <Amazon_Payments after="Mage_Adminhtml">Amazon_Payments_Adminhtml</Amazon_Payments>
88
+ <Amazon_Simplepath after="Mage_Adminhtml">Amazon_Simplepath_Adminhtml</Amazon_Simplepath>
89
  </modules>
90
  </args>
91
  </adminhtml>
108
  </amazon_payments>
109
  </observers>
110
  </adminhtml_widget_container_html_before>
111
+ <sales_order_save_commit_after>
112
+ <observers>
113
+ <amazon_payments_observer>
114
+ <class>Amazon_Payments_Model_Observer_Order</class>
115
+ <method>closeAmazonOrder</method>
116
+ </amazon_payments_observer>
117
+ </observers>
118
+ </sales_order_save_commit_after>
119
  </events>
120
  </adminhtml>
 
121
  <frontend>
122
  <secure_url>
123
  <cart_updatepost>/checkout/cart/updatePost</cart_updatepost>
124
+ <cart_couponpost>/checkout/cart/couponPost</cart_couponpost>
125
+ <cart_estimatepost>/checkout/cart/estimatePost</cart_estimatepost>
126
  <checkout_amazon>/checkout/amazon_payments</checkout_amazon>
127
  <amazon_checkout>/amazon_payments/checkout</amazon_checkout>
128
+ <simplepath>/amazon_payments/simplepath</simplepath>
129
+ <amazon_login_verify>/amazon_payments/customer/verify</amazon_login_verify>
130
  </secure_url>
131
  <routers>
132
  <amazon_payments>
179
  </custom_quote_process>
180
  </events>
181
  </frontend>
 
182
  <default>
183
  <payment>
184
  <amazon_payments>
185
+ <title>Login and Pay with Amazon</title>
186
  <model>amazon_payments/paymentMethod</model>
187
  <payment_action>authorize_capture</payment_action>
188
+ <checkout_page>amazon</checkout_page>
189
  <show_pay_cart>1</show_pay_cart>
190
  <order_status>processing</order_status>
191
  <active>1</active>
194
  <button_color>Gold</button_color>
195
  <button_size>medium</button_size>
196
  <button_badge>1</button_badge>
197
+ <popup>1</popup>
198
+ <access_secret backend_model="adminhtml/system_config_backend_encrypted" />
199
+ <client_secret backend_model="adminhtml/system_config_backend_encrypted" />
200
  </amazon_payments>
201
  </payment>
202
+ <amazon_login>
203
+ <settings>
204
+ <popup>1</popup>
205
+ </settings>
206
+ </amazon_login>
207
  </default>
 
208
  <crontab>
209
  <jobs>
210
  <amazon_payments_async>
213
  </amazon_payments_async>
214
  </jobs>
215
  </crontab>
216
+ </config>
 
app/code/community/Amazon/Payments/etc/system.xml CHANGED
@@ -15,33 +15,67 @@
15
 
16
  <groups>
17
  <amazon_payments translate="label">
18
- <label>Amazon Payments / Login and Pay with Amazon</label>
19
- <frontend_type>text</frontend_type>
20
  <sort_order>100</sort_order>
 
21
  <show_in_default>1</show_in_default>
22
  <show_in_website>1</show_in_website>
23
  <show_in_store>1</show_in_store>
 
 
24
  <comment>
25
  <![CDATA[
26
-
27
- <a href="https://payments.amazon.com/" target="_blank"><img src="https://images-na.ssl-images-amazon.com/images/G/01/Iris3_US/en_US/inca/images/btnPaywAMZN-gld-Desktop-2x.png" /></a>
28
- <br/><br />
29
- Login and Pay with Amazon helps you increase conversion, reduce fraud, acquire new customers and build loyalty.
30
  <br /><br />
31
 
32
- <strong>Configuring Amazon Payments</strong>
33
- <ol style="list-style:inside decimal;">
34
- <li>Register or login to retrieve your account keys: &nbsp<button onclick="javascript:window.open(&#39;https://sellercentral.amazon.com/hz/me/sp/signup?solutionProviderOptions=lwa%3Bmws-acc%3B&marketplaceId=AGWSWK15IEJJ7&solutionProviderToken=AAAAAQAAAAEAAAAQCz2wulRfR9nOADyzVQrq5wAAAHAIIULh6RBNvlw68WY5S9ATlmInlyg2PLVF44yUVowkyjvDZPhtLf3UYn6fshHlKqwR4qptfBeltbxLtLrrIfK6JoxzuWe9FRTnCfSey8a0sFKuL3mwNenjLyMC9BAN1xU0S6pebxA2mz8t8Y1v5Axi&solutionProviderId=A2K7HE1S3M5XJ&#39;, &#39;get_keys&#39,&#39;left=50, top=50, width=950, height=750&#39;); return false;" class="scalable" type="button"><span>Login to Get Your Keys</span></button>
35
- <li>Add your url to "Allowed JavaScript Origins" in <a href="https://sellercentral.amazon.com/" target="_blank">Amazon Seller Central</a>.
36
- <li>Under General->Web, enable "Use Secure URLs in Frontend." (HTTPS is required.)
37
- </ol>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
 
39
  <div style="clear:both;"></div>
40
  ]]>
41
  </comment>
42
 
 
43
  <fields>
44
 
 
45
  <enabled translate="label">
46
  <label>Enabled</label>
47
  <frontend_type>select</frontend_type>
@@ -54,289 +88,385 @@
54
  <show_in_store>0</show_in_store>
55
  </enabled>
56
 
57
- <heading_creds translate="label">
58
- <label>Client Credentials</label>
59
- <frontend_type>text</frontend_type>
60
- <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
61
- <sort_order>10</sort_order>
62
  <show_in_default>1</show_in_default>
63
  <show_in_website>1</show_in_website>
64
- <show_in_store>0</show_in_store>
65
- </heading_creds>
66
-
67
- <seller_id translate="label">
68
- <label>Seller/Merchant ID</label>
69
- <frontend_type>text</frontend_type>
70
- <sort_order>15</sort_order>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  <show_in_default>1</show_in_default>
72
  <show_in_website>1</show_in_website>
73
- <show_in_store>0</show_in_store>
74
- </seller_id>
75
-
76
- <access_key translate="label">
77
- <label>MWS Access Key</label>
78
- <frontend_type>text</frontend_type>
79
  <sort_order>20</sort_order>
80
- <show_in_default>1</show_in_default>
81
- <show_in_website>1</show_in_website>
82
- <show_in_store>0</show_in_store>
83
- </access_key>
84
- <access_secret translate="label">
85
- <label>MWS Secret Key</label>
86
- <frontend_type>text</frontend_type>
87
- <sort_order>30</sort_order>
88
- <show_in_default>1</show_in_default>
89
- <show_in_website>1</show_in_website>
90
- <show_in_store>0</show_in_store>
91
- </access_secret>
92
-
93
- <client_id translate="label">
94
- <label>Client ID</label>
95
- <frontend_type>text</frontend_type>
96
- <backend_model>amazon_payments/system_config_backend_clientid</backend_model>
97
- <sort_order>31</sort_order>
98
- <show_in_default>1</show_in_default>
99
- <show_in_website>1</show_in_website>
100
- <show_in_store>0</show_in_store>
101
- </client_id>
102
-
103
- <client_secret translate="label">
104
- <label>Client Secret</label>
105
- <frontend_type>text</frontend_type>
106
- <backend_model>amazon_payments/system_config_backend_clientsecret</backend_model>
107
- <sort_order>32</sort_order>
108
- <show_in_default>1</show_in_default>
109
- <show_in_website>1</show_in_website>
110
- <show_in_store>0</show_in_store>
111
- </client_secret>
112
-
113
- <!--
114
- <region translate="label">
115
- <label>API Region</label>
116
- <frontend_type>select</frontend_type>
117
- <source_model>amazon_payments/system_config_source_region</source_model>
118
- <sort_order>35</sort_order>
119
- <show_in_default>1</show_in_default>
120
- <show_in_website>1</show_in_website>
121
- <show_in_store>1</show_in_store>
122
- </region>
123
- -->
124
-
125
- <heading_config translate="label">
126
- <label>Checkout Configuration</label>
127
- <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
128
- <sort_order>100</sort_order>
129
- <show_in_default>1</show_in_default>
130
- <show_in_website>1</show_in_website>
131
- <show_in_store>0</show_in_store>
132
- </heading_config>
133
-
134
-
135
- <checkout_page translate="label">
136
- <label>Checkout Page Type</label>
137
- <frontend_type>select</frontend_type>
138
- <source_model>amazon_payments/system_config_source_checkoutpage</source_model>
139
- <sort_order>110</sort_order>
140
- <show_in_default>1</show_in_default>
141
- <show_in_website>1</show_in_website>
142
- <show_in_store>0</show_in_store>
143
- </checkout_page>
144
-
145
- <show_pay_cart translate="label">
146
- <label>Show Pay with Amazon Button on Cart</label>
147
- <comment><![CDATA[Only applies when OnePage Checkout is used, otherwise button is always shown.]]></comment>
148
- <frontend_type>select</frontend_type>
149
- <source_model>adminhtml/system_config_source_yesno</source_model>
150
- <sort_order>120</sort_order>
151
- <show_in_default>1</show_in_default>
152
- <show_in_website>1</show_in_website>
153
- <show_in_store>0</show_in_store>
154
- </show_pay_cart>
155
-
156
- <payment_action translate="label">
157
- <label>Payment Action</label>
158
- <frontend_type>select</frontend_type>
159
- <source_model>amazon_payments/system_config_source_paymentaction</source_model>
160
- <sort_order>130</sort_order>
161
- <show_in_default>1</show_in_default>
162
- <show_in_website>1</show_in_website>
163
- <show_in_store>0</show_in_store>
164
- </payment_action>
165
-
166
- <order_status translate="label">
167
- <label>New Order Status</label>
168
- <frontend_type>select</frontend_type>
169
- <source_model>adminhtml/system_config_source_order_status_newprocessing</source_model>
170
- <sort_order>140</sort_order>
171
- <show_in_default>1</show_in_default>
172
- <show_in_website>1</show_in_website>
173
- <show_in_store>0</show_in_store>
174
- </order_status>
175
-
176
- <store_name translate="label">
177
- <label>Email Store Name</label>
178
- <frontend_type>text</frontend_type>
179
- <comment><![CDATA[Store name to display in Amazon emails. If left blank, current Magento store name will be used.]]></comment>
180
- <sort_order>150</sort_order>
181
- <show_in_default>0</show_in_default>
182
- <show_in_website>1</show_in_website>
183
- <show_in_store>1</show_in_store>
184
- </store_name>
185
-
186
- <visible_on_product translate="label">
187
- <label>Shortcut on Product View</label>
188
- <comment><![CDATA[Pop-up must be set to "No" under Customers->Login with Amazon.]]></comment>
189
- <frontend_type>select</frontend_type>
190
- <source_model>adminhtml/system_config_source_yesno</source_model>
191
- <sort_order>160</sort_order>
192
- <show_in_default>1</show_in_default>
193
- <show_in_website>1</show_in_website>
194
- <show_in_store>1</show_in_store>
195
- </visible_on_product>
196
-
197
- <secure_cart translate="label">
198
- <label>Secure Cart Page</label>
199
- <comment><![CDATA[HTTPS is required to use the Amazon button on the cart page.]]></comment>
200
- <frontend_type>select</frontend_type>
201
- <source_model>adminhtml/system_config_source_yesno</source_model>
202
- <sort_order>170</sort_order>
203
- <show_in_default>1</show_in_default>
204
- <show_in_website>1</show_in_website>
205
- <show_in_store>0</show_in_store>
206
- </secure_cart>
207
-
208
- <use_in_checkout translate="label">
209
- <label>Display as Payment Option</label>
210
- <comment><![CDATA[Add pay button under "Payment Information" during checkout. (Recommended flow is to display button before user enters billing and shipping information.)]]></comment>
211
- <frontend_type>select</frontend_type>
212
- <source_model>adminhtml/system_config_source_yesno</source_model>
213
- <sort_order>180</sort_order>
214
- <show_in_default>1</show_in_default>
215
- <show_in_website>1</show_in_website>
216
- <show_in_store>0</show_in_store>
217
- </use_in_checkout>
218
-
219
- <sort_order translate="label">
220
- <label>Sort Order</label>
221
- <frontend_type>text</frontend_type>
222
- <sort_order>190</sort_order>
223
- <show_in_default>1</show_in_default>
224
- <show_in_website>1</show_in_website>
225
- <show_in_store>0</show_in_store>
226
- <frontend_class>validate-number</frontend_class>
227
- <depends><use_in_checkout>1</use_in_checkout></depends>
228
- </sort_order>
229
-
230
- <is_async translate="label">
231
- <label>Asynchronous Mode</label>
232
- <comment><![CDATA[In asynchronous mode, the payment is returned as a Pending status instead of an immediate Open or Declined status. Customers will need to be notified of a Declined status.]]></comment>
233
- <frontend_type>select</frontend_type>
234
- <source_model>adminhtml/system_config_source_yesno</source_model>
235
- <sort_order>200</sort_order>
236
- <show_in_default>1</show_in_default>
237
- <show_in_website>1</show_in_website>
238
- <show_in_store>0</show_in_store>
239
- </is_async>
240
-
241
- <heading_button translate="label">
242
- <label>Button Style</label>
243
- <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
244
- <sort_order>400</sort_order>
245
- <show_in_default>1</show_in_default>
246
- <show_in_website>1</show_in_website>
247
- <show_in_store>0</show_in_store>
248
- </heading_button>
249
-
250
- <button_type translate="label">
251
- <label>Button Label</label>
252
- <frontend_type>select</frontend_type>
253
- <source_model>amazon_payments/system_config_source_buttontype</source_model>
254
- <sort_order>410</sort_order>
255
- <show_in_default>1</show_in_default>
256
- <show_in_website>1</show_in_website>
257
- <show_in_store>1</show_in_store>
258
- </button_type>
259
-
260
- <button_color translate="label">
261
- <label>Button Color</label>
262
- <frontend_type>select</frontend_type>
263
- <source_model>amazon_payments/system_config_source_buttoncolor</source_model>
264
- <sort_order>430</sort_order>
265
- <show_in_default>1</show_in_default>
266
- <show_in_website>1</show_in_website>
267
- <show_in_store>1</show_in_store>
268
- </button_color>
269
-
270
- <button_size translate="label">
271
- <label>Button Size</label>
272
- <frontend_type>select</frontend_type>
273
- <source_model>amazon_payments/system_config_source_buttonsize</source_model>
274
- <sort_order>440</sort_order>
275
- <show_in_default>1</show_in_default>
276
- <show_in_website>1</show_in_website>
277
- <show_in_store>1</show_in_store>
278
- </button_size>
279
-
280
- <button_badge translate="label">
281
- <label>Display Acceptance Badge</label>
282
- <comment><![CDATA[Display "Amazon Payments" acceptance mark in right sidebar.]]></comment>
283
- <frontend_type>select</frontend_type>
284
- <source_model>adminhtml/system_config_source_yesno</source_model>
285
- <sort_order>450</sort_order>
286
- <show_in_default>1</show_in_default>
287
- <show_in_website>1</show_in_website>
288
- <show_in_store>0</show_in_store>
289
- </button_badge>
290
-
291
- <heading_dev translate="label">
292
- <label>Development</label>
293
- <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
294
- <sort_order>500</sort_order>
295
- <show_in_default>1</show_in_default>
296
- <show_in_website>1</show_in_website>
297
- <show_in_store>0</show_in_store>
298
- </heading_dev>
299
-
300
- <sandbox translate="label">
301
- <label>Sandbox Mode</label>
302
- <frontend_type>select</frontend_type>
303
- <source_model>adminhtml/system_config_source_yesno</source_model>
304
- <sort_order>510</sort_order>
305
  <show_in_default>1</show_in_default>
306
  <show_in_website>1</show_in_website>
307
- <show_in_store>0</show_in_store>
308
- </sandbox>
309
-
310
- <debug translate="label">
311
- <label>Debug Mode</label>
312
- <comment>
313
- <![CDATA[Save API responses to Magento log]]>
314
- </comment>
315
- <frontend_type>select</frontend_type>
316
- <source_model>adminhtml/system_config_source_yesno</source_model>
317
- <sort_order>520</sort_order>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
318
  <show_in_default>1</show_in_default>
319
  <show_in_website>1</show_in_website>
320
- <show_in_store>0</show_in_store>
321
- </debug>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
322
 
323
- <restricted_ips translate="label">
324
- <label>Restrict by IP</label>
325
- <comment>
326
- <![CDATA[Display to only whitelisted IPs found in <br>Developer -> Developer Client Restrictions]]>
327
- </comment>
328
- <frontend_type>select</frontend_type>
329
- <source_model>adminhtml/system_config_source_yesno</source_model>
330
- <sort_order>530</sort_order>
331
- <show_in_default>1</show_in_default>
332
- <show_in_website>1</show_in_website>
333
- <show_in_store>0</show_in_store>
334
- </restricted_ips>
335
 
336
  </fields>
337
  </amazon_payments>
338
  </groups>
339
-
340
  </payment>
341
  </sections>
342
- </config>
15
 
16
  <groups>
17
  <amazon_payments translate="label">
18
+ <label>Login and Pay with Amazon</label>
 
19
  <sort_order>100</sort_order>
20
+ <expanded>1</expanded>
21
  <show_in_default>1</show_in_default>
22
  <show_in_website>1</show_in_website>
23
  <show_in_store>1</show_in_store>
24
+
25
+
26
  <comment>
27
  <![CDATA[
28
+ Login and Pay with Amazon helps you increase conversation, reduce fraud, acquire new customers and build loyalty. <a href="https://payments.amazon.com/" target="_blank">Learn More.</a>
 
 
 
29
  <br /><br />
30
 
31
+
32
+ <div id="amazon_simplepath">
33
+ <span style="display:inline-block;padding-bottom:1em;">
34
+ <button><span>Get started with account registration</span></button>
35
+ &nbsp; &nbsp;
36
+ <button><span>My account is ready, I need to connect it to Magento</span></button>
37
+ </span>
38
+ <span style="display:inline-block;">
39
+ &nbsp; or &nbsp;
40
+ <a href="#" id="simplepath-skip">I've already setup Pay with Amazon, I want to edit my settings</a>
41
+ </span>
42
+
43
+ <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>
44
+ <p style="color:red;display:none" id="amazon_openssl_required">In order to set keys, the OpenSSL PHP library is required.</p>
45
+ <p style="color:red;display:none" id="amazon_reload">Updating your config with new keys, please wait...</p>
46
+
47
+ </div>
48
+
49
+ <div id="amazon_simplepath_back" style="display:none;margin-bottom:1em;margin-top:-0.5em;">
50
+ <a href="#">&laquo; Back</a>
51
+ </div>
52
+
53
+
54
+ <div id="amazon_instructions">
55
+
56
+ <strong>Steps to Launch Login and Pay with Amazon</strong>
57
+ <ol style="list-style:inside decimal;">
58
+ <li>Register through our custom <a href="https://sellercentral.amazon.com/hz/me/sp/signup?solutionProviderOptions=lwa%3Bmws-acc%3B&marketplaceId=AGWSWK15IEJJ7&solutionProviderToken=AAAAAQAAAAEAAAAQCz2wulRfR9nOADyzVQrq5wAAAHAIIULh6RBNvlw68WY5S9ATlmInlyg2PLVF44yUVowkyjvDZPhtLf3UYn6fshHlKqwR4qptfBeltbxLtLrrIfK6JoxzuWe9FRTnCfSey8a0sFKuL3mwNenjLyMC9BAN1xU0S6pebxA2mz8t8Y1v5Axi&solutionProviderId=A2K7HE1S3M5XJ" target="_blank">Magento registration</a> or visit <a href="https://payments.amazon.com/signup" target="_blank">https://payments.amazon.com/signup</a>
59
+ <!--
60
+ Register or login to retrieve your account keys: &nbsp<button onclick="javascript:window.open(&#39;&#39;, &#39;get_keys&#39,&#39;left=50, top=50, width=950, height=750&#39;); return false;" class="scalable" type="button"><span>Login to Get Your Keys</span></button></span></button>
61
+ -->
62
+
63
+
64
+ <li>Visit <a href="https://sellercentral.amazon.com/" target="_blank">Amazon Seller Central</a> and Configure OAuth "Allowed Javascript Origins" in your Login with Amazon settings.
65
+ <li>Under General->Web, enable "Use Secure URLs in Frontend." (HTTPS is required.)
66
+ </ol>
67
+ </div>
68
+
69
+
70
 
71
  <div style="clear:both;"></div>
72
  ]]>
73
  </comment>
74
 
75
+
76
  <fields>
77
 
78
+
79
  <enabled translate="label">
80
  <label>Enabled</label>
81
  <frontend_type>select</frontend_type>
88
  <show_in_store>0</show_in_store>
89
  </enabled>
90
 
91
+ <ap_credentials type="group" translate="label">
92
+ <label>Credentials</label>
 
 
 
93
  <show_in_default>1</show_in_default>
94
  <show_in_website>1</show_in_website>
95
+ <expanded>1</expanded>
96
+ <frontend_model>adminhtml/system_config_form_fieldset</frontend_model>
97
+ <sort_order>10</sort_order>
98
+ <fields>
99
+
100
+ <simplepath_import_button>
101
+ <frontend_type>button</frontend_type>
102
+ <frontend_model>amazon_payments/adminhtml_system_config_simplepathimport</frontend_model>
103
+ <sort_order>6</sort_order>
104
+ <show_in_default>1</show_in_default>
105
+ <show_in_website>1</show_in_website>
106
+ <show_in_store>0</show_in_store>
107
+ </simplepath_import_button>
108
+ <simplepath_json translate="label">
109
+ <label>Import From Clipboard</label>
110
+ <frontend_type>textarea</frontend_type>
111
+ <backend_model>amazon_payments/system_config_backend_simplepath</backend_model>
112
+ <comment><![CDATA[<button><span>Save</span></button>]]></comment>
113
+ <sort_order>7</sort_order>
114
+ <show_in_default>1</show_in_default>
115
+ <show_in_website>1</show_in_website>
116
+ <show_in_store>0</show_in_store>
117
+ </simplepath_json>
118
+ <seller_id translate="label">
119
+ <label>SellerId/MerchantId</label>
120
+ <frontend_type>text</frontend_type>
121
+ <sort_order>15</sort_order>
122
+ <show_in_default>1</show_in_default>
123
+ <show_in_website>1</show_in_website>
124
+ <show_in_store>0</show_in_store>
125
+ <config_path>payment/amazon_payments/seller_id</config_path>
126
+ </seller_id>
127
+ <access_key translate="label">
128
+ <label>MWS Access Key</label>
129
+ <frontend_type>text</frontend_type>
130
+ <sort_order>20</sort_order>
131
+ <show_in_default>1</show_in_default>
132
+ <show_in_website>1</show_in_website>
133
+ <show_in_store>0</show_in_store>
134
+ <config_path>payment/amazon_payments/access_key</config_path>
135
+ </access_key>
136
+ <access_secret translate="label">
137
+ <label>MWS Secret Key</label>
138
+ <frontend_type>obscure</frontend_type>
139
+ <sort_order>30</sort_order>
140
+ <show_in_default>1</show_in_default>
141
+ <show_in_website>1</show_in_website>
142
+ <show_in_store>0</show_in_store>
143
+ <config_path>payment/amazon_payments/access_secret</config_path>
144
+ <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
145
+ </access_secret>
146
+ <client_id translate="label">
147
+ <label>Client ID</label>
148
+ <frontend_type>text</frontend_type>
149
+ <sort_order>31</sort_order>
150
+ <show_in_default>1</show_in_default>
151
+ <show_in_website>1</show_in_website>
152
+ <show_in_store>0</show_in_store>
153
+ <config_path>payment/amazon_payments/client_id</config_path>
154
+ </client_id>
155
+ <client_secret translate="label">
156
+ <label>Client Secret</label>
157
+ <frontend_type>obscure</frontend_type>
158
+ <sort_order>32</sort_order>
159
+ <show_in_default>1</show_in_default>
160
+ <show_in_website>1</show_in_website>
161
+ <show_in_store>0</show_in_store>
162
+ <config_path>payment/amazon_payments/client_secret</config_path>
163
+ <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
164
+ </client_secret>
165
+
166
+ <sandbox translate="label">
167
+ <label>Sandbox Mode</label>
168
+ <frontend_type>select</frontend_type>
169
+ <source_model>adminhtml/system_config_source_yesno</source_model>
170
+ <sort_order>510</sort_order>
171
+ <show_in_default>1</show_in_default>
172
+ <show_in_website>1</show_in_website>
173
+ <show_in_store>0</show_in_store>
174
+ <config_path>payment/amazon_payments/sandbox</config_path>
175
+ </sandbox>
176
+
177
+ <!--
178
+ <region translate="label">
179
+ <label>API Region</label>
180
+ <frontend_type>select</frontend_type>
181
+ <source_model>amazon_payments/system_config_source_region</source_model>
182
+ <sort_order>35</sort_order>
183
+ <show_in_default>1</show_in_default>
184
+ <show_in_website>1</show_in_website>
185
+ <show_in_store>1</show_in_store>
186
+ <config_path>payment/amazon_payments/region</config_path>
187
+ </region>
188
+ -->
189
+
190
+ </fields>
191
+ </ap_credentials>
192
+
193
+ <ap_checkout type="group" translate="label">
194
+ <label>Checkout Style</label>
195
  <show_in_default>1</show_in_default>
196
  <show_in_website>1</show_in_website>
 
 
 
 
 
 
197
  <sort_order>20</sort_order>
198
+ <fields>
199
+ <checkout_page translate="label">
200
+ <label>Checkout Page Type</label>
201
+ <frontend_type>select</frontend_type>
202
+ <source_model>amazon_payments/system_config_source_checkoutpage</source_model>
203
+ <sort_order>110</sort_order>
204
+ <show_in_default>1</show_in_default>
205
+ <show_in_website>1</show_in_website>
206
+ <show_in_store>0</show_in_store>
207
+ <config_path>payment/amazon_payments/checkout_page</config_path>
208
+ </checkout_page>
209
+ <show_pay_cart translate="label">
210
+ <label>Show Pay with Amazon Button on Cart</label>
211
+ <comment><![CDATA[Only applies when OnePage Checkout is used, otherwise button is always shown.]]></comment>
212
+ <frontend_type>select</frontend_type>
213
+ <source_model>adminhtml/system_config_source_yesno</source_model>
214
+ <sort_order>120</sort_order>
215
+ <show_in_default>1</show_in_default>
216
+ <show_in_website>1</show_in_website>
217
+ <show_in_store>0</show_in_store>
218
+ <config_path>payment/amazon_payments/show_pay_cart</config_path>
219
+ </show_pay_cart>
220
+ <visible_on_product translate="label">
221
+ <label>Shortcut on Product View</label>
222
+ <comment><![CDATA[Pop-up must be set to "No" under "Login with Amazon" below.]]></comment>
223
+ <frontend_type>select</frontend_type>
224
+ <source_model>adminhtml/system_config_source_yesno</source_model>
225
+ <sort_order>160</sort_order>
226
+ <show_in_default>1</show_in_default>
227
+ <show_in_website>1</show_in_website>
228
+ <show_in_store>1</show_in_store>
229
+ <config_path>payment/amazon_payments/visible_on_product</config_path>
230
+ </visible_on_product>
231
+ <use_in_checkout translate="label">
232
+ <label>Display as Payment Option</label>
233
+ <comment><![CDATA[Add pay button under "Payment Information" during checkout. (Recommended flow is to display button before user enters billing and shipping information.)]]></comment>
234
+ <frontend_type>select</frontend_type>
235
+ <source_model>adminhtml/system_config_source_yesno</source_model>
236
+ <sort_order>180</sort_order>
237
+ <show_in_default>1</show_in_default>
238
+ <show_in_website>1</show_in_website>
239
+ <show_in_store>0</show_in_store>
240
+ <config_path>payment/amazon_payments/use_in_checkout</config_path>
241
+ </use_in_checkout>
242
+ <sort_order translate="label">
243
+ <label>Sort Order</label>
244
+ <frontend_type>text</frontend_type>
245
+ <sort_order>190</sort_order>
246
+ <show_in_default>1</show_in_default>
247
+ <show_in_website>1</show_in_website>
248
+ <show_in_store>0</show_in_store>
249
+ <frontend_class>validate-number</frontend_class>
250
+ <depends><use_in_checkout>1</use_in_checkout></depends>
251
+ <config_path>payment/amazon_payments/sort_order</config_path>
252
+ </sort_order>
253
+ <buttons type="group" translate="label">
254
+ <label>Button Styles</label>
255
+ <show_in_default>1</show_in_default>
256
+ <show_in_website>1</show_in_website>
257
+ <show_in_store>1</show_in_store>
258
+ <sort_order>200</sort_order>
259
+ <fields>
260
+ <button_type translate="label">
261
+ <label>Button Label</label>
262
+ <frontend_type>select</frontend_type>
263
+ <source_model>amazon_payments/system_config_source_buttontype</source_model>
264
+ <sort_order>410</sort_order>
265
+ <show_in_default>1</show_in_default>
266
+ <show_in_website>1</show_in_website>
267
+ <show_in_store>1</show_in_store>
268
+ <config_path>payment/amazon_payments/button_type</config_path>
269
+ </button_type>
270
+ <button_color translate="label">
271
+ <label>Button Color</label>
272
+ <frontend_type>select</frontend_type>
273
+ <source_model>amazon_payments/system_config_source_buttoncolor</source_model>
274
+ <sort_order>430</sort_order>
275
+ <show_in_default>1</show_in_default>
276
+ <show_in_website>1</show_in_website>
277
+ <show_in_store>1</show_in_store>
278
+ <config_path>payment/amazon_payments/button_color</config_path>
279
+ </button_color>
280
+ <button_size translate="label">
281
+ <label>Button Size</label>
282
+ <frontend_type>select</frontend_type>
283
+ <source_model>amazon_payments/system_config_source_buttonsize</source_model>
284
+ <sort_order>440</sort_order>
285
+ <show_in_default>1</show_in_default>
286
+ <show_in_website>1</show_in_website>
287
+ <show_in_store>1</show_in_store>
288
+ <config_path>payment/amazon_payments/button_size</config_path>
289
+ </button_size>
290
+ <button_badge translate="label">
291
+ <label>Display Acceptance Badge</label>
292
+ <comment><![CDATA[Display "Amazon Payments" acceptance mark in right sidebar.]]></comment>
293
+ <frontend_type>select</frontend_type>
294
+ <source_model>adminhtml/system_config_source_yesno</source_model>
295
+ <sort_order>450</sort_order>
296
+ <show_in_default>1</show_in_default>
297
+ <show_in_website>1</show_in_website>
298
+ <show_in_store>0</show_in_store>
299
+ <config_path>payment/amazon_payments/button_badge</config_path>
300
+ </button_badge>
301
+ </fields>
302
+ </buttons>
303
+ <ap_login type="group" translate="label">
304
+ <label>Login with Amazon</label>
305
+ <show_in_default>1</show_in_default>
306
+ <show_in_website>1</show_in_website>
307
+ <show_in_store>1</show_in_store>
308
+ <sort_order>210</sort_order>
309
+ <fields>
310
+ <popup translate="label">
311
+ <label>Pop-up</label>
312
+ <comment>
313
+ <![CDATA[Pop-up window or full-page redirect.]]>
314
+ </comment>
315
+ <frontend_type>select</frontend_type>
316
+ <source_model>adminhtml/system_config_source_yesno</source_model>
317
+ <sort_order>40</sort_order>
318
+ <show_in_default>1</show_in_default>
319
+ <show_in_website>1</show_in_website>
320
+ <show_in_store>1</show_in_store>
321
+ <config_path>amazon_login/settings/popup</config_path>
322
+ </popup>
323
+ <popupcomment>
324
+ <frontend_type>note</frontend_type>
325
+ <comment><model>amazon_payments/system_config_backend_popupcomment</model></comment>
326
+ <depends><popup>0</popup></depends>
327
+ <sort_order>41</sort_order>
328
+ <show_in_default>1</show_in_default>
329
+ <show_in_website>1</show_in_website>
330
+ <show_in_store>1</show_in_store>
331
+ </popupcomment>
332
+ <additional_scope translate="label" module="amazon_payments">
333
+ <label>Additional Access Scope</label>
334
+ <comment>
335
+ <![CDATA[Optional access scope strings during login.]]>
336
+ </comment>
337
+ <frontend_type>text</frontend_type>
338
+ <sort_order>50</sort_order>
339
+ <show_in_default>1</show_in_default>
340
+ <show_in_website>1</show_in_website>
341
+ <show_in_store>1</show_in_store>
342
+ <config_path>amazon_login/settings/additional_scope</config_path>
343
+ </additional_scope>
344
+ </fields>
345
+ </ap_login>
346
+ </fields>
347
+ </ap_checkout>
348
+
349
+ <ap_transaction type="group" translate="label">
350
+ <label>Transaction</label>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
351
  <show_in_default>1</show_in_default>
352
  <show_in_website>1</show_in_website>
353
+ <show_in_store>1</show_in_store>
354
+ <sort_order>30</sort_order>
355
+ <fields>
356
+ <payment_action translate="label">
357
+ <label>Payment Action</label>
358
+ <frontend_type>select</frontend_type>
359
+ <source_model>amazon_payments/system_config_source_paymentaction</source_model>
360
+ <sort_order>130</sort_order>
361
+ <show_in_default>1</show_in_default>
362
+ <show_in_website>1</show_in_website>
363
+ <show_in_store>0</show_in_store>
364
+ <config_path>payment/amazon_payments/payment_action</config_path>
365
+ </payment_action>
366
+ <payment_action_none_note translate="label">
367
+ <frontend_type>note</frontend_type>
368
+ <comment><![CDATA[You have set orders to not have funds authorized, so you should set the New Order Status below to a custom status other than "Pending" or "Processing." Funds will need to be captured from a third-party system.]]></comment>
369
+ <sort_order>135</sort_order>
370
+ <show_in_default>1</show_in_default>
371
+ <show_in_website>1</show_in_website>
372
+ <show_in_store>0</show_in_store>
373
+ <depends><payment_action>new</payment_action></depends>
374
+ </payment_action_none_note>
375
+ <order_status translate="label">
376
+ <label>New Order Status</label>
377
+ <frontend_type>select</frontend_type>
378
+ <source_model>adminhtml/system_config_source_order_status_newprocessing</source_model>
379
+ <sort_order>140</sort_order>
380
+ <show_in_default>1</show_in_default>
381
+ <show_in_website>1</show_in_website>
382
+ <show_in_store>0</show_in_store>
383
+ <config_path>payment/amazon_payments/order_status</config_path>
384
+ </order_status>
385
+ <store_name translate="label">
386
+ <label>Email Store Name</label>
387
+ <frontend_type>text</frontend_type>
388
+ <comment><![CDATA[Store name to display in Amazon emails. If left blank, current Magento store name will be used.]]></comment>
389
+ <sort_order>150</sort_order>
390
+ <show_in_default>0</show_in_default>
391
+ <show_in_website>1</show_in_website>
392
+ <show_in_store>1</show_in_store>
393
+ <config_path>payment/amazon_payments/store_name</config_path>
394
+ </store_name>
395
+
396
+ <ap_advanced type="group" translate="label">
397
+ <label>Advanced Transaction Options</label>
398
+ <show_in_default>1</show_in_default>
399
+ <show_in_website>1</show_in_website>
400
+ <show_in_store>1</show_in_store>
401
+ <sort_order>210</sort_order>
402
+ <fields>
403
+ <is_async translate="label">
404
+ <label>Asynchronous Mode</label>
405
+ <comment><![CDATA[In asynchronous mode, the payment is returned as a Pending status instead of an immediate Open or Declined status. Customers will need to be notified of a Declined status.]]></comment>
406
+ <frontend_type>select</frontend_type>
407
+ <source_model>adminhtml/system_config_source_yesno</source_model>
408
+ <sort_order>200</sort_order>
409
+ <show_in_default>1</show_in_default>
410
+ <show_in_website>1</show_in_website>
411
+ <show_in_store>0</show_in_store>
412
+ <config_path>payment/amazon_payments/is_async</config_path>
413
+ </is_async>
414
+ </fields>
415
+ </ap_advanced>
416
+ </fields>
417
+ </ap_transaction>
418
+
419
+ <ap_developer type="group" translate="label">
420
+ <label>Developer</label>
421
  <show_in_default>1</show_in_default>
422
  <show_in_website>1</show_in_website>
423
+ <show_in_store>1</show_in_store>
424
+ <sort_order>40</sort_order>
425
+ <fields>
426
+ <secure_cart translate="label">
427
+ <label>Secure Cart Page</label>
428
+ <comment><![CDATA[HTTPS is required to use the Amazon button on the cart page.]]></comment>
429
+ <frontend_type>select</frontend_type>
430
+ <source_model>adminhtml/system_config_source_yesno</source_model>
431
+ <sort_order>170</sort_order>
432
+ <show_in_default>1</show_in_default>
433
+ <show_in_website>1</show_in_website>
434
+ <show_in_store>0</show_in_store>
435
+ <config_path>payment/amazon_payments/secure_cart</config_path>
436
+ </secure_cart>
437
+ <debug translate="label">
438
+ <label>Debug Mode</label>
439
+ <comment>
440
+ <![CDATA[Save API responses to Magento log]]>
441
+ </comment>
442
+ <frontend_type>select</frontend_type>
443
+ <source_model>adminhtml/system_config_source_yesno</source_model>
444
+ <sort_order>520</sort_order>
445
+ <show_in_default>1</show_in_default>
446
+ <show_in_website>1</show_in_website>
447
+ <show_in_store>0</show_in_store>
448
+ <config_path>payment/amazon_payments/debug</config_path>
449
+ </debug>
450
+ <restricted_ips translate="label">
451
+ <label>Restrict by IP</label>
452
+ <comment>
453
+ <![CDATA[Display to only whitelisted IPs found in <br>Developer -> Developer Client Restrictions]]>
454
+ </comment>
455
+ <frontend_type>select</frontend_type>
456
+ <source_model>adminhtml/system_config_source_yesno</source_model>
457
+ <sort_order>530</sort_order>
458
+ <show_in_default>1</show_in_default>
459
+ <show_in_website>1</show_in_website>
460
+ <show_in_store>0</show_in_store>
461
+ <config_path>payment/amazon_payments/restricted_ips</config_path>
462
+ </restricted_ips>
463
+ </fields>
464
+ </ap_developer>
465
 
 
 
 
 
 
 
 
 
 
 
 
 
466
 
467
  </fields>
468
  </amazon_payments>
469
  </groups>
 
470
  </payment>
471
  </sections>
472
+ </config>
app/code/community/Amazon/Payments/sql/payments_setup/install-0.1.0.php CHANGED
@@ -39,4 +39,43 @@ $installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'disable_amazonpaym
39
  'is_configurable' => false
40
  ));
41
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  $installer->endSetup();
39
  'is_configurable' => false
40
  ));
41
 
42
+ /**
43
+ * Create amazon_login table
44
+ */
45
+ $amazon_login_table = $installer->getTable('amazon_payments/login');
46
+
47
+ if ($installer->getConnection()->isTableExists($amazon_login_table) != true) {
48
+
49
+ $amazon_table = $installer->getConnection()
50
+ ->newTable($installer->getTable('amazon_payments/login'))
51
+ ->addColumn('login_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
52
+ 'identity' => true,
53
+ 'unsigned' => true,
54
+ 'nullable' => false,
55
+ 'primary' => true
56
+ ), 'Login ID')
57
+ ->addColumn('customer_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array (
58
+ 'nullable' => false,
59
+ 'unsigned' => true
60
+ ), 'Customer Entity ID')
61
+ ->addColumn('amazon_uid', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array (
62
+ 'nullable' => true,
63
+ 'unsigned' => true
64
+ ), 'Amazon User ID')
65
+ ->addIndex($installer->getIdxName('amazon_payments/login', array('customer_id')), array('customer_id'))
66
+ ->addIndex($installer->getIdxName('amazon_payments/login', array('amazon_uid')), array('amazon_uid'));
67
+
68
+ $installer->getConnection()->createTable($amazon_table);
69
+
70
+ $installer->getConnection()->addConstraint(
71
+ 'fk_amazon_login_customer_entity_id',
72
+ $installer->getTable('amazon_payments/login'),
73
+ 'customer_id',
74
+ $installer->getTable('customer/entity'),
75
+ 'entity_id',
76
+ 'cascade',
77
+ 'restrict'
78
+ );
79
+ }
80
+
81
  $installer->endSetup();
app/code/community/Amazon/Payments/sql/payments_setup/upgrade-1.3.0-1.4.0.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Amazon Payments
4
+ *
5
+ * @category Amazon
6
+ * @package Amazon_Payments
7
+ * @copyright Copyright (c) 2014 Amazon.com
8
+ * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
+ */
10
+
11
+
12
+ $installer = $this;
13
+
14
+ $installer->startSetup();
15
+
16
+ $db = $installer->getConnection();
17
+
18
+ // Encrypt keys
19
+ $select = $db->select()
20
+ ->from('core_config_data')
21
+ ->where('path IN (?)', array('payment/amazon_payments/access_secret', 'payment/amazon_payments/client_secret'));
22
+
23
+ foreach ($db->fetchAll($select) as $row) {
24
+ $db->update('core_config_data', array('value' => Mage::helper('core')->encrypt(trim($row['value']))), 'config_id=' . $row['config_id']);
25
+ }
26
+
27
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/amazon_payments.xml CHANGED
@@ -5,4 +5,9 @@
5
  <block type="amazon_payments/adminhtml_notifications" name="amazon_payments_notifications" template="amazon_payments/notifications.phtml"></block>
6
  </reference>
7
  </default>
8
- </layout>
 
 
 
 
 
5
  <block type="amazon_payments/adminhtml_notifications" name="amazon_payments_notifications" template="amazon_payments/notifications.phtml"></block>
6
  </reference>
7
  </default>
8
+ <adminhtml_system_config_edit>
9
+ <reference name="head">
10
+ <action method="addItem"><type>skin_js</type><name>amazonpayments/amazonpayments.js</name></action>
11
+ </reference>
12
+ </adminhtml_system_config_edit>
13
+ </layout>
app/design/frontend/base/default/layout/amazon_login.xml DELETED
@@ -1,62 +0,0 @@
1
- <?xml version="1.0"?>
2
- <!--
3
- /**
4
- * Login with Amazon
5
- *
6
- * @category Amazon
7
- * @package Amazon_Login
8
- * @copyright Copyright (c) 2014 Amazon.com
9
- * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
10
- */
11
- -->
12
- <layout version="0.1.0">
13
- <customer_account_login translate="label">
14
-
15
- <block type="amazon_login/script" name="amazon_login.script" template="amazon_login/script.phtml" />
16
- <block type="amazon_login/button" name="amazon_login.button" template="amazon_login/button.phtml" after="customer_form_login" />
17
-
18
- <!-- ifconfig only works with action -->
19
- <reference name="before_body_end">
20
- <action method="append" ifconfig="amazon_login/settings/enabled">
21
- <block>amazon_login.script</block>
22
- </action>
23
- </reference>
24
-
25
- <reference name="content">
26
- <action method="append" ifconfig="amazon_login/settings/enabled">
27
- <block>amazon_login.button</block>
28
- </action>
29
- </reference>
30
- </customer_account_login>
31
-
32
-
33
- <customer_account_logoutsuccess>
34
- <reference name="content">
35
- <block type="amazon_login/script" name="amazon_login.script.logout" template="amazon_login/script.phtml" />
36
- </reference>
37
- </customer_account_logoutsuccess>
38
-
39
-
40
- <amazon_login_customer_verify translate="label">
41
- <label>Login with Amazon</label>
42
- <remove name="right"/>
43
- <remove name="left"/>
44
-
45
- <reference name="content">
46
-
47
- <block type="core/messages" name="global_messages" as="global_messages"/>
48
- <block type="core/messages" name="messages" as="messages"/>
49
-
50
- <block type="amazon_login/verify" name="amazon_login.verify" template="amazon_login/verify.phtml">
51
-
52
- </block>
53
- </reference>
54
- </amazon_login_customer_verify>
55
-
56
- <amazon_login_customer_authorize translate="label">
57
- <reference name="content">
58
- <block type="amazon_login/script" name="amazon_login.script.authorize" template="amazon_login/script_authorize.phtml" />
59
- </reference>
60
- </amazon_login_customer_authorize>
61
-
62
- </layout>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/layout/amazon_payments.xml CHANGED
@@ -24,30 +24,29 @@
24
  </reference>
25
 
26
  <reference name="checkout.cart">
27
- <block type="core/template" name="amazon_payments.script" template="amazon_payments/script.phtml" />
28
- <block type="amazon_payments/button" name="AmazonPayButtonTop" template="amazon_payments/button.phtml"/>
29
- <block type="amazon_payments/button" name="AmazonPayButtonMethod" template="amazon_payments/button.phtml"/>
30
 
31
  <!-- ifconfig only works with action -->
32
- <reference name="after_body_start">
33
  <action method="append" ifconfig="payment/amazon_payments/enabled">
34
  <block>amazon_payments.script</block>
35
  </action>
36
  </reference>
37
 
38
- <reference name="checkout.cart.top_methods">
39
- <action method="append" ifconfig="payment/amazon_payments/enabled">
40
- <block>AmazonPayButtonTop</block>
41
- </action>
42
- </reference>
43
 
44
- <reference name="checkout.cart.methods">
45
- <action method="append" ifconfig="payment/amazon_payments/enabled">
46
- <block>AmazonPayButtonMethod</block>
47
- </action>
48
- </reference>
 
 
 
 
 
 
49
 
50
- </reference>
51
  </checkout_cart_index>
52
 
53
 
@@ -57,7 +56,7 @@
57
  <checkout_onepage_index>
58
 
59
  <reference name="head">
60
- <block type="core/template" name="amazon_payments.script" template="amazon_payments/script.phtml" />
61
  </reference>
62
 
63
  <reference name="checkout.onepage">
@@ -65,6 +64,7 @@
65
  </reference>
66
 
67
  <reference name="checkout.onepage.login">
 
68
  <action method="setTemplate" ifconfig="payment/amazon_payments/enabled">
69
  <template helper="amazon_payments/data/switchOnepageLoginTemplateIf">
70
  <template_amazon>amazon_payments/onepage/login.phtml</template_amazon>
@@ -188,7 +188,7 @@
188
  </reference>
189
 
190
  <reference name="head">
191
- <block type="core/template" name="amazon_payments.script" template="amazon_payments/script.phtml" />
192
  </reference>
193
  </checkout_amazon_payments_index>
194
 
@@ -247,7 +247,7 @@
247
  -->
248
  <amazon_payments_checkout_authorize translate="label">
249
  <reference name="content">
250
- <block type="amazon_login/script" name="amazon_login.script.authorize" template="amazon_login/script_authorize.phtml" />
251
  </reference>
252
  </amazon_payments_checkout_authorize>
253
 
@@ -259,9 +259,18 @@
259
 
260
  <block type="amazon_payments/button" name="addtocart-amazon-button" template="amazon_payments/button_shortcut.phtml" />
261
 
 
 
 
 
 
 
 
 
262
  <reference name="head">
263
- <block type="core/template" name="amazon_payments.script" template="amazon_payments/script.phtml" />
264
  </reference>
 
265
 
266
  <reference name="product.info.addtocart">
267
  <action method="append" ifconfig="payment/amazon_payments/visible_on_product">
@@ -275,6 +284,21 @@
275
 
276
  </catalog_product_view>
277
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
278
  <!--
279
  Acceptance Mark/Badge
280
  -->
@@ -301,7 +325,7 @@
301
  -->
302
  <firecheckout_index_index translate="label">
303
  <reference name="head">
304
- <block type="core/template" name="amazon_payments.script" template="amazon_payments/script.phtml" />
305
  </reference>
306
  </firecheckout_index_index>
307
 
@@ -310,9 +334,126 @@
310
  -->
311
  <opc_index_index translate="label">
312
  <reference name="head">
313
- <block type="core/template" name="amazon_payments.script" template="amazon_payments/script.phtml" />
314
  </reference>
315
  </opc_index_index>
316
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
317
 
318
- </layout>
24
  </reference>
25
 
26
  <reference name="checkout.cart">
27
+ <block type="amazon_payments/script" name="amazon_payments.script" template="amazon_payments/script.phtml" />
 
 
28
 
29
  <!-- ifconfig only works with action -->
30
+ <reference name="before_body_end">
31
  <action method="append" ifconfig="payment/amazon_payments/enabled">
32
  <block>amazon_payments.script</block>
33
  </action>
34
  </reference>
35
 
36
+ </reference>
 
 
 
 
37
 
38
+ <!-- To Move Amazon Payments button around on the cart page, change the after="" attribute to before="" in the below block tags -->
39
+
40
+ <reference name="checkout.cart.top_methods">
41
+ <!-- replace 'after="-"' with 'before="checkout.cart.methods.onepage.top"' to move the Amazon Payments button in front of the Checkout button -->
42
+ <block type="amazon_payments/button" after="-" name="AmazonPayButtonTop" template="amazon_payments/button.phtml"/>
43
+ </reference>
44
+
45
+ <reference name="checkout.cart.methods">
46
+ <!-- replace 'after="-"' with 'before="checkout.cart.methods.onepage.bottom"' to move the Amazon Payments button in front of the Checkout button -->
47
+ <block type="amazon_payments/button" after="-" name="AmazonPayButtonMethod" template="amazon_payments/button.phtml"/>
48
+ </reference>
49
 
 
50
  </checkout_cart_index>
51
 
52
 
56
  <checkout_onepage_index>
57
 
58
  <reference name="head">
59
+ <block type="amazon_payments/script" name="amazon_payments.script" template="amazon_payments/script.phtml" />
60
  </reference>
61
 
62
  <reference name="checkout.onepage">
64
  </reference>
65
 
66
  <reference name="checkout.onepage.login">
67
+ <!-- Remove this to prevent "Login with Amazon" button from appearing on checkout -->
68
  <action method="setTemplate" ifconfig="payment/amazon_payments/enabled">
69
  <template helper="amazon_payments/data/switchOnepageLoginTemplateIf">
70
  <template_amazon>amazon_payments/onepage/login.phtml</template_amazon>
188
  </reference>
189
 
190
  <reference name="head">
191
+ <block type="amazon_payments/script" name="amazon_payments.script" template="amazon_payments/script.phtml" />
192
  </reference>
193
  </checkout_amazon_payments_index>
194
 
247
  -->
248
  <amazon_payments_checkout_authorize translate="label">
249
  <reference name="content">
250
+ <block type="amazon_payments/login_script" name="amazon_login.script.authorize" template="amazon_payments/login/script_authorize.phtml" />
251
  </reference>
252
  </amazon_payments_checkout_authorize>
253
 
259
 
260
  <block type="amazon_payments/button" name="addtocart-amazon-button" template="amazon_payments/button_shortcut.phtml" />
261
 
262
+ <block type="amazon_payments/script" name="amazon_payments.script" template="amazon_payments/script.phtml" />
263
+ <reference name="head">
264
+ <action method="append" ifconfig="payment/amazon_payments/visible_on_product">
265
+ <block>amazon_payments.script</block>
266
+ </action>
267
+ </reference>
268
+
269
+ <!--
270
  <reference name="head">
271
+ <block type="amazon_payments/script" name="amazon_payments.script" template="amazon_payments/script.phtml" />
272
  </reference>
273
+ -->
274
 
275
  <reference name="product.info.addtocart">
276
  <action method="append" ifconfig="payment/amazon_payments/visible_on_product">
284
 
285
  </catalog_product_view>
286
 
287
+
288
+ <!--
289
+ Sidecart/Minicart Shortcut
290
+ -->
291
+ <default>
292
+ <reference name="head">
293
+ <block type="amazon_payments/script" name="amazon_payments.script" template="amazon_payments/script.phtml">
294
+ <action method="setIsDefault"><is_default>1</is_default></action>
295
+ </block>
296
+ </reference>
297
+ <reference name="cart_sidebar.extra_actions">
298
+ <block type="amazon_payments/button" name="AmazonPayButtonSideCart" template="amazon_payments/button.phtml"/>
299
+ </reference>
300
+ </default>
301
+
302
  <!--
303
  Acceptance Mark/Badge
304
  -->
325
  -->
326
  <firecheckout_index_index translate="label">
327
  <reference name="head">
328
+ <block type="amazon_payments/script" name="amazon_payments.script" template="amazon_payments/script.phtml" />
329
  </reference>
330
  </firecheckout_index_index>
331
 
334
  -->
335
  <opc_index_index translate="label">
336
  <reference name="head">
337
+ <block type="amazon_payments/script" name="amazon_payments.script" template="amazon_payments/script.phtml" />
338
  </reference>
339
  </opc_index_index>
340
 
341
+ <!--
342
+ OneStepCheckout.com checkout
343
+ -->
344
+ <onestepcheckout_index_index>
345
+
346
+ <reference name="head">
347
+ <block type="amazon_payments/script" name="amazon_payments.script" template="amazon_payments/script.phtml" />
348
+ </reference>
349
+
350
+ <reference name="checkout.onepage">
351
+ <block type="amazon_payments/button" name="amazonpaymentsbutton" template="amazon_payments/onepage/button.phtml"/>
352
+ </reference>
353
+
354
+ <reference name="checkout.onepage.login">
355
+ <action method="setTemplate" ifconfig="payment/amazon_payments/enabled">
356
+ <template helper="amazon_payments/data/switchOnepageLoginTemplateIf">
357
+ <template_amazon>amazon_payments/onepage/login.phtml</template_amazon>
358
+ <template_default>checkout/onepage/login.phtml</template_default>
359
+ </template>
360
+ </action>
361
+
362
+ <block type="core/text_list" name="col1_before" />
363
+ <block type="core/text_list" name="col2_before" />
364
+
365
+ <reference name="col1_before">
366
+ <block type="amazon_payments/button" name="AmazonPayButtonBefore" template="amazon_payments/onepage/button.phtml"/>
367
+ </reference>
368
+
369
+ <reference name="col2_before">
370
+ <block type="amazon_payments/button" name="AmazonPayButtonAdditional" template="amazon_payments/onepage/button.phtml"/>
371
+ </reference>
372
+ </reference>
373
+
374
+ </onestepcheckout_index_index>
375
+
376
+ <!--
377
+ Add Wallet Widget for Async Declines
378
+ -->
379
+ <sales_order_view translate="label">
380
+ <reference name="head">
381
+ <block type="amazon_payments/script" name="amazon_payments.script" template="amazon_payments/script.phtml" />
382
+ </reference>
383
+ <reference name="my.account.wrapper">
384
+ <block type="amazon_payments/sales_view" template="amazon_payments/sales/order/amazon_wallet.phtml" before="info">
385
+ <block type="amazon_payments/login_button" name="amazon_login.no-or" template="amazon_payments/login/button.phtml"/>
386
+ </block>
387
+ </reference>
388
+ </sales_order_view>
389
+
390
+
391
+ <!--
392
+ Login
393
+ -->
394
+ <customer_account_login translate="label">
395
+
396
+ <block type="amazon_payments/login_script" name="amazon_login.script" template="amazon_payments/login/script.phtml" />
397
+ <block type="amazon_payments/login_button" name="amazon_login.button_login" template="amazon_payments/login/button.phtml" after="customer_form_login" />
398
+
399
+ <!-- ifconfig only works with action -->
400
+ <reference name="after_body_start">
401
+ <action method="append" ifconfig="payment/amazon_payments/enabled">
402
+ <block>amazon_login.script</block>
403
+ </action>
404
+ </reference>
405
+
406
+ <reference name="content">
407
+ <action method="append" ifconfig="payment/amazon_payments/enabled">
408
+ <block>amazon_login.button_login</block>
409
+ </action>
410
+ </reference>
411
+ </customer_account_login>
412
+
413
+ <customer_account_create translate="label">
414
+ <block type="amazon_payments/login_script" name="amazon_login.script" template="amazon_payments/login/script.phtml" />
415
+ <block type="amazon_payments/login_button" name="amazon_login.button_create" template="amazon_payments/login/button.phtml" after="customer_form_login" />
416
+
417
+ <reference name="after_body_start">
418
+ <action method="append" ifconfig="payment/amazon_payments/enabled">
419
+ <block>amazon_login.script</block>
420
+ </action>
421
+ </reference>
422
+
423
+ <reference name="customer.form.register.fields.before">
424
+ <action method="append" ifconfig="payment/amazon_payments/enabled">
425
+ <block>amazon_login.button_create</block>
426
+ </action>
427
+ </reference>
428
+ </customer_account_create>
429
+
430
+
431
+ <customer_account_logoutsuccess>
432
+ <reference name="content">
433
+ <block type="amazon_payments/login_script" name="amazon_login.script.logout" template="amazon_payments/login/script.phtml" />
434
+ </reference>
435
+ </customer_account_logoutsuccess>
436
+
437
+ <amazon_payments_customer_verify translate="label">
438
+ <label>Login with Amazon</label>
439
+ <remove name="right"/>
440
+ <remove name="left"/>
441
+
442
+ <reference name="content">
443
+
444
+ <block type="core/messages" name="global_messages" as="global_messages"/>
445
+ <block type="core/messages" name="messages" as="messages"/>
446
+
447
+ <block type="amazon_payments/login_verify" name="amazon_login.verify" template="amazon_payments/login/verify.phtml">
448
+
449
+ </block>
450
+ </reference>
451
+ </amazon_payments_customer_verify>
452
+
453
+ <amazon_payments_customer_authorize translate="label">
454
+ <reference name="content">
455
+ <block type="amazon_payments/login_script" name="amazon_login.script.authorize" template="amazon_payments/login/script_authorize.phtml" />
456
+ </reference>
457
+ </amazon_payments_customer_authorize>
458
 
459
+ </layout>
app/design/frontend/base/default/template/amazon_login/button.phtml DELETED
@@ -1,32 +0,0 @@
1
- <?php
2
- /**
3
- * Login with Amazon
4
- *
5
- * @category Amazon
6
- * @package Amazon_Login
7
- * @copyright Copyright (c) 2014 Amazon.com
8
- * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
- */
10
- ?>
11
-
12
-
13
- <?php
14
-
15
- /**
16
- * More button styles: http://login.amazon.com/button-guide
17
- */
18
-
19
- ?>
20
-
21
- <div id="amazon-buttons-wrapper" class="col2-set">
22
- <div class="col-1">
23
- <div class="amazon-login-button-wrapper">
24
- <strong>- <?php echo $this->__('OR'); ?> -</strong>
25
- <br />
26
-
27
- <button class="amazon-login-button" style="cursor:pointer; background:none; border:0;">
28
- <img src="<?php echo $this->getButtonImage(); ?>" alt="Login with Amazon" border="0" />
29
- </button>
30
- </div>
31
- </div>
32
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/amazon_payments/button.phtml CHANGED
@@ -7,10 +7,11 @@
7
  * @copyright Copyright (c) 2014 Amazon.com
8
  * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
  */
 
10
  ?>
11
  <?php if ($this->isAmazonPayButtonEnabled()): ?>
12
 
13
- <div id="<?php echo $this->getAmazonPayButtonId(); ?>"></div>
14
 
15
  <script type="text/javascript">
16
  var authRequest;
7
  * @copyright Copyright (c) 2014 Amazon.com
8
  * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
  */
10
+
11
  ?>
12
  <?php if ($this->isAmazonPayButtonEnabled()): ?>
13
 
14
+ <div id="<?php echo $this->getAmazonPayButtonId(); ?>" class="amazon-pay-button" style="float:right;margin-bottom:10px;"></div>
15
 
16
  <script type="text/javascript">
17
  var authRequest;
app/design/frontend/base/default/template/amazon_payments/button_badge.phtml CHANGED
@@ -12,9 +12,9 @@
12
  <?php if ($this->isButtonBadgeEnabled()): ?>
13
 
14
  <div class="amazon-payments-logo" style="text-align:center;">
15
- <a href="https://payments.amazon.com/customer" target="_blank">
16
  <img src="https://images-na.ssl-images-amazon.com/images/G/01/Iris3_US/en_US/inca/images/60x38-whitegrad-x2.png" border="0" alt="Amazon Payments" />
17
  </a>
18
  </div>
19
 
20
- <?php endif; ?>
12
  <?php if ($this->isButtonBadgeEnabled()): ?>
13
 
14
  <div class="amazon-payments-logo" style="text-align:center;">
15
+ <a href="https://payments.amazon.com/customer" target="_blank" style="max-width: 100%; display: inline-block;">
16
  <img src="https://images-na.ssl-images-amazon.com/images/G/01/Iris3_US/en_US/inca/images/60x38-whitegrad-x2.png" border="0" alt="Amazon Payments" />
17
  </a>
18
  </div>
19
 
20
+ <?php endif; ?>
app/design/frontend/base/default/template/amazon_payments/checkout.phtml CHANGED
@@ -15,7 +15,7 @@
15
  <h1><?php echo $this->__('Checkout') ?></h1>
16
  </div>
17
 
18
- <?php echo $this->__('Amazon Payments uses information from your Amazon account to place your order.'); ?>
19
  <?php echo $this->__('Click <a href="#" id="amazon-cancel">here</a> to change your payment method.'); ?>
20
 
21
 
@@ -26,11 +26,13 @@
26
 
27
  <div id="amazon-widget-address-wrapper" class="amazon-widget-wrapper">
28
  <h2><?php echo $this->__('Shipping Address'); ?></h2>
 
29
  <div id="amazon-widget-address"></div>
30
  </div>
31
 
32
  <?php if ($this->getChild('shipping_method')->isShow()) : ?>
33
  <div id="shipping-method-wrapper">
 
34
  <?php echo $this->getChildHtml('shipping_method') ?>
35
  </div>
36
  <?php endif; ?>
@@ -41,6 +43,7 @@
41
 
42
  <div id="amazon-widget-wrapper" class="amazon-widget-wrapper">
43
  <h2><?php echo $this->__('Payment'); ?></h2>
 
44
  <div id="amazon-widget-wallet"></div>
45
  </div>
46
 
@@ -62,7 +65,7 @@
62
  <small>
63
  {"SandboxSimulation": {"State":"Declined", "ReasonCode":"InvalidPaymentMethod"}}
64
  <br />
65
- (<a href="http://docs.developer.amazonservices.com/en_US/apa_guide/APAGuide_Testing.html" target="_blank">More Info</a>)<br />
66
  </small>
67
 
68
 
@@ -87,13 +90,15 @@ var AmazonPaymentsMageCheckout = Class.create();
87
  AmazonPaymentsMageCheckout.prototype = {
88
  initialize: function(opts){
89
  this.opts = opts;
 
 
90
  //this.setShippingMethod();
91
  },
92
 
93
  // Dynamically load shipping method HTML
94
  setShippingMethod: function() {
95
  if (this.opts.shippingMethod) {
96
- this.toggleOrderSubmit(true);
97
 
98
  var request = new Ajax.Request(this.opts.shippingMethod.url, {
99
  method: 'post',
@@ -123,7 +128,7 @@ AmazonPaymentsMageCheckout.prototype = {
123
  }
124
  }
125
 
126
- this.toggleOrderSubmit(true);
127
 
128
  var request = new Ajax.Request(this.opts.review.url, {
129
  method: 'post',
@@ -148,7 +153,7 @@ AmazonPaymentsMageCheckout.prototype = {
148
  $$(".button.btn-checkout").invoke('writeAttribute','onclick', 'amazonPaymentsMageCheckout.saveOrder()');
149
  this.agreementsForm = $('checkout-agreements')
150
  $("amz-review-loader").hide();
151
- this.toggleOrderSubmit(false);
152
  },
153
 
154
  saveOrder: function() {
@@ -166,7 +171,8 @@ AmazonPaymentsMageCheckout.prototype = {
166
  params.sandbox = sandbox.getValue();
167
  }
168
 
169
- this.toggleOrderSubmit(true);
 
170
 
171
  var request = new Ajax.Request(this.opts.save.url, {
172
  method: 'post',
@@ -193,6 +199,10 @@ AmazonPaymentsMageCheckout.prototype = {
193
  window.top.location.href = this.successUrl;
194
  }
195
  else{
 
 
 
 
196
  var msg = response.error_messages;
197
  if (typeof(msg)=='object') {
198
  msg = msg.join("\n");
@@ -209,12 +219,15 @@ AmazonPaymentsMageCheckout.prototype = {
209
  setTimeout(loadAmazonWallet, 2000); // Refresh Wallet
210
  }
211
 
 
 
 
 
212
  }
213
 
214
- this.toggleOrderSubmit(false);
215
  },
216
 
217
- toggleOrderSubmit: function(isDisabled) {
218
  var btn = $$(".button.btn-checkout");
219
  var review = $("checkout-review-table-wrapper");
220
  var loader = $("amz-review-loader");
@@ -222,16 +235,64 @@ AmazonPaymentsMageCheckout.prototype = {
222
  if (isDisabled) {
223
  if (review) {
224
  review.setOpacity(0.5);
225
- loader.show();
 
 
 
226
  }
227
  btn.each(function(el, i) { el.disable(); });
228
  } else {
229
  if (review) {
230
  review.setOpacity(1);
231
  loader.hide();
 
232
  }
233
  btn.each(function(el, i) { el.enable(); });
234
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
235
  }
236
  };
237
 
@@ -263,7 +324,16 @@ var lastPrice;
263
  var ShippingMethod = Class.create();
264
  var Review = Class.create();
265
 
266
-
 
 
 
 
 
 
 
 
 
267
  </script>
268
 
269
 
@@ -277,6 +347,7 @@ new OffAmazonPayments.Widgets.AddressBook({
277
  },
278
  onAddressSelect: function(orderReference) {
279
  amazonPaymentsMageCheckout.setShippingMethod();
 
280
  },
281
  design: {
282
  designMode: 'responsive'
@@ -301,10 +372,10 @@ function loadAmazonWallet() {
301
  },
302
 
303
  onPaymentSelect: function(orderReference) {
304
-
305
  },
306
  onError: function(error) {
307
- console.log(error.getErrorMessage());
308
  }
309
  }).bind("amazon-widget-wallet");
310
  }
15
  <h1><?php echo $this->__('Checkout') ?></h1>
16
  </div>
17
 
18
+ <?php echo $this->__('Login and Pay with Amazon uses information from your Amazon account to place your order.'); ?>
19
  <?php echo $this->__('Click <a href="#" id="amazon-cancel">here</a> to change your payment method.'); ?>
20
 
21
 
26
 
27
  <div id="amazon-widget-address-wrapper" class="amazon-widget-wrapper">
28
  <h2><?php echo $this->__('Shipping Address'); ?></h2>
29
+ <div class="amz-widget-loader" style="display:none;"></div>
30
  <div id="amazon-widget-address"></div>
31
  </div>
32
 
33
  <?php if ($this->getChild('shipping_method')->isShow()) : ?>
34
  <div id="shipping-method-wrapper">
35
+ <div id="shipping-method-disable" style="display:none;"></div>
36
  <?php echo $this->getChildHtml('shipping_method') ?>
37
  </div>
38
  <?php endif; ?>
43
 
44
  <div id="amazon-widget-wrapper" class="amazon-widget-wrapper">
45
  <h2><?php echo $this->__('Payment'); ?></h2>
46
+ <div class="amz-widget-loader" style="display:none;"></div>
47
  <div id="amazon-widget-wallet"></div>
48
  </div>
49
 
65
  <small>
66
  {"SandboxSimulation": {"State":"Declined", "ReasonCode":"InvalidPaymentMethod"}}
67
  <br />
68
+ (<a href="https://payments.amazon.com/documentation/lpwa/201749840#201750790" target="_blank">More Info</a>)<br />
69
  </small>
70
 
71
 
90
  AmazonPaymentsMageCheckout.prototype = {
91
  initialize: function(opts){
92
  this.opts = opts;
93
+ this.hasPayment = false;
94
+ this.hasReviewLoader = false;
95
  //this.setShippingMethod();
96
  },
97
 
98
  // Dynamically load shipping method HTML
99
  setShippingMethod: function() {
100
  if (this.opts.shippingMethod) {
101
+ this.restrictPlaceOrder(true);
102
 
103
  var request = new Ajax.Request(this.opts.shippingMethod.url, {
104
  method: 'post',
128
  }
129
  }
130
 
131
+ this.restrictPlaceOrder(true);
132
 
133
  var request = new Ajax.Request(this.opts.review.url, {
134
  method: 'post',
153
  $$(".button.btn-checkout").invoke('writeAttribute','onclick', 'amazonPaymentsMageCheckout.saveOrder()');
154
  this.agreementsForm = $('checkout-agreements')
155
  $("amz-review-loader").hide();
156
+ this.restrictPlaceOrder(false);
157
  },
158
 
159
  saveOrder: function() {
171
  params.sandbox = sandbox.getValue();
172
  }
173
 
174
+ this.restrictPlaceOrder(true);
175
+ this.restrictWidgets(true);
176
 
177
  var request = new Ajax.Request(this.opts.save.url, {
178
  method: 'post',
199
  window.top.location.href = this.successUrl;
200
  }
201
  else{
202
+
203
+ this.restrictPlaceOrder(false);
204
+ this.restrictWidgets(false);
205
+
206
  var msg = response.error_messages;
207
  if (typeof(msg)=='object') {
208
  msg = msg.join("\n");
219
  setTimeout(loadAmazonWallet, 2000); // Refresh Wallet
220
  }
221
 
222
+ if (msg.indexOf("Declined") != -1) {
223
+ this.restrictShipping();
224
+ }
225
+
226
  }
227
 
 
228
  },
229
 
230
+ restrictPlaceOrder: function(isDisabled, hideLoader) {
231
  var btn = $$(".button.btn-checkout");
232
  var review = $("checkout-review-table-wrapper");
233
  var loader = $("amz-review-loader");
235
  if (isDisabled) {
236
  if (review) {
237
  review.setOpacity(0.5);
238
+ if (!hideLoader) {
239
+ loader.show();
240
+ this.hasReviewLoader = true;
241
+ }
242
  }
243
  btn.each(function(el, i) { el.disable(); });
244
  } else {
245
  if (review) {
246
  review.setOpacity(1);
247
  loader.hide();
248
+ this.hasReviewLoader = false;
249
  }
250
  btn.each(function(el, i) { el.enable(); });
251
  }
252
+ },
253
+
254
+ restrictWidgets: function(isDisabled) {
255
+ var widget = $$(".amazon-widget-wrapper .widget-container, #shipping-method-wrapper");
256
+ var loader = $$(".amz-widget-loader");
257
+ var smdisable = $("shipping-method-disable");
258
+
259
+ if (isDisabled) {
260
+ widget.each(function(el, i) {
261
+ el.setOpacity(0.5);
262
+ el.setStyle({"pointer-events" : "none"});
263
+ });
264
+ loader.each(function(el, i) {
265
+ el.show();
266
+ });
267
+ if (smdisable) {
268
+ smdisable.show();
269
+ }
270
+ } else {
271
+ widget.each(function(el, i) {
272
+ el.setOpacity(1);
273
+ el.setStyle({"pointer-events" : "auto"});
274
+ });
275
+ loader.each(function(el, i) {
276
+ el.hide();
277
+ });
278
+ if (smdisable) {
279
+ smdisable.hide();
280
+ }
281
+ }
282
+ },
283
+
284
+ restrictShipping: function() {
285
+ clearInterval(restrictInterval);
286
+
287
+ $$("#shipping-method-wrapper, #amazon-widget-address-wrapper").each(function(el, i) {
288
+ el.setOpacity(0.5);
289
+ //el.setStyle({"pointer-events" : "none"});
290
+ });
291
+ $$("#amazon-widget-address-wrapper .amz-widget-loader").each(function(el, i) {
292
+ el.show();
293
+ el.setStyle({"background" : "none"});
294
+ });
295
+ $("shipping-method-disable").show();
296
  }
297
  };
298
 
324
  var ShippingMethod = Class.create();
325
  var Review = Class.create();
326
 
327
+ // Poll if payment method is set ("Place Order" is loaded via ajax and can't depend on widget events)
328
+ var restrictInterval = setInterval(function() {
329
+ if (!amazonPaymentsMageCheckout.hasReviewLoader) {
330
+ if (amazonPaymentsMageCheckout.hasPayment) {
331
+ amazonPaymentsMageCheckout.restrictPlaceOrder(false);
332
+ } else {
333
+ amazonPaymentsMageCheckout.restrictPlaceOrder(true, true);
334
+ }
335
+ }
336
+ }, 100);
337
  </script>
338
 
339
 
347
  },
348
  onAddressSelect: function(orderReference) {
349
  amazonPaymentsMageCheckout.setShippingMethod();
350
+ amazonPaymentsMageCheckout.hasPayment = false;
351
  },
352
  design: {
353
  designMode: 'responsive'
372
  },
373
 
374
  onPaymentSelect: function(orderReference) {
375
+ amazonPaymentsMageCheckout.hasPayment = true;
376
  },
377
  onError: function(error) {
378
+ console.log(error.getErrorMessage());
379
  }
380
  }).bind("amazon-widget-wallet");
381
  }
app/design/frontend/base/default/template/amazon_payments/login/button.phtml ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Login with Amazon
4
+ *
5
+ * @category Amazon
6
+ * @package Amazon_Payments
7
+ * @copyright Copyright (c) 2014 Amazon.com
8
+ * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
+ */
10
+ ?>
11
+
12
+ <div id="amazon-buttons-wrapper" class="col2-set">
13
+ <div class="col-1">
14
+ <div class="amazon-login-button-wrapper">
15
+
16
+ <?php if ($this->getNameInLayout() == 'amazon_login.button_login') : ?>
17
+ <strong class="amazon-or">- <?php echo $this->__('OR'); ?> -</strong>
18
+ <br />
19
+ <?php endif; ?>
20
+
21
+ <?php if (!$this->isAmazonPaymentsEnabled()) : // Old embed method (does not require seller id) ?>
22
+
23
+ <button class="amazon-login-button" style="cursor:pointer; background:none; border:0;">
24
+ <img src="<?php echo $this->getButtonImage(); ?>" alt="Login with Amazon" border="0" />
25
+ </button>
26
+
27
+ <?php else : // Use Amazon Payments embed method ?>
28
+
29
+ <div id="amazon-login-button"></div>
30
+
31
+ <script type="text/javascript">
32
+ var authRequest;
33
+
34
+ var AmazonButtonOptions = {
35
+ type: "<?php echo $this->getButtonType(); ?>",
36
+ color: "<?php echo $this->getButtonColor(); ?>",
37
+ size: "<?php echo $this->getButtonSize(); ?>",
38
+ authorization: function() {
39
+ loginOptions = {
40
+ scope: "profile payments:widget payments:shipping_address<?php print $this->getAdditionalScope(); ?>",
41
+ response_type: 'token',
42
+ popup: <?php print $this->isPopup(); ?>
43
+ };
44
+
45
+ authRequest = amazon.Login.authorize (loginOptions, "<?php echo (!$this->isPopup()) ? $this->getLoginAuthUrl() : $this->getCheckoutUrl(); ?>");
46
+ },
47
+ onError: function(error) {
48
+ console.log(error);
49
+ }
50
+ };
51
+
52
+ OffAmazonPayments.Button("amazon-login-button", "<?php echo $this->getSellerId(); ?>", AmazonButtonOptions);
53
+
54
+ </script>
55
+
56
+ <?php endif; ?>
57
+
58
+ <?php if ($this->getNameInLayout() == 'amazon_login.button_create') : ?>
59
+ <strong class="amazon-or">- <?php echo $this->__('OR'); ?> -</strong>
60
+ <br />
61
+ <?php endif; ?>
62
+
63
+ </div>
64
+ </div>
65
+ </div>
app/design/frontend/base/default/template/amazon_payments/login/logout.phtml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Login with Amazon
4
+ *
5
+ * @category Amazon
6
+ * @package Amazon_Payments
7
+ * @copyright Copyright (c) 2014 Amazon.com
8
+ * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
+ */
10
+ ?>
11
+
12
+ <script type="text/javascript">
13
+
14
+ window.onAmazonLoginReady = function() {
15
+ amazon.Login.logout();
16
+ document.cookie = "amazon_Login_accessToken=; expires=Thu, 01 Jan 1970 00:00:00 GMT";
17
+ };
18
+
19
+ </script>
app/design/frontend/base/default/template/{amazon_login → amazon_payments/login}/script.phtml RENAMED
@@ -3,7 +3,7 @@
3
  * Login with Amazon
4
  *
5
  * @category Amazon
6
- * @package Amazon_Login
7
  * @copyright Copyright (c) 2014 Amazon.com
8
  * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
  */
@@ -15,6 +15,8 @@
15
  */
16
  ?>
17
 
 
 
18
  <div id="amazon-root"></div>
19
  <script type="text/javascript">
20
 
@@ -71,15 +73,44 @@ $$('.amazon-login-button').each(function(el) {
71
 
72
  </script>
73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  <?php if ($this->getNameInLayout() == 'amazon_login.script.logout') : ?>
75
 
76
- <script type="text/javascript">
 
 
 
 
77
 
78
- window.onAmazonLoginReady = function() {
79
- amazon.Login.logout();
80
- document.cookie = "amazon_Login_accessToken=; expires=Thu, 01 Jan 1970 00:00:00 GMT";
81
- };
82
 
83
- </script>
84
 
85
  <?php endif; ?>
3
  * Login with Amazon
4
  *
5
  * @category Amazon
6
+ * @package Amazon_Payments
7
  * @copyright Copyright (c) 2014 Amazon.com
8
  * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
  */
15
  */
16
  ?>
17
 
18
+ <?php if (!$this->isAmazonPaymentsEnabled() || $this->getNameInLayout() == 'amazon_login.script.logout') : ?>
19
+
20
  <div id="amazon-root"></div>
21
  <script type="text/javascript">
22
 
73
 
74
  </script>
75
 
76
+
77
+ <?php else : // Amazon Payments is enabled ?>
78
+
79
+ <script type='text/javascript'>
80
+ window.onAmazonLoginReady = function() {
81
+ amazon.Login.setClientId('<?php echo $this->getClientId(); ?>');
82
+
83
+ <?php if (!$this->isPopup()) : ?>
84
+ amazon.Login.setUseCookie(true);
85
+ <?php endif; ?>
86
+
87
+ };
88
+
89
+ <?php if (!$this->isPopup()) : ?>
90
+ src = '<?php echo $this->getWidgetsUrl(); ?>';
91
+ <?php endif; ?>
92
+
93
+ </script>
94
+
95
+ <script type='text/javascript' src='<?php echo $this->getWidgetsUrl(); ?>'></script>
96
+ <script>jQuery.noConflict();</script>
97
+
98
+
99
+ <?php endif; ?>
100
+
101
+
102
+
103
  <?php if ($this->getNameInLayout() == 'amazon_login.script.logout') : ?>
104
 
105
+ <script type="text/javascript">
106
+ function amazonLogout() {
107
+ amazon.Login.logout();
108
+ document.cookie = "amazon_Login_accessToken=; expires=Thu, 01 Jan 1970 00:00:00 GMT";
109
+ }
110
 
111
+ window.onAmazonLoginReady = amazonLogout; // If not loading Widget JS
112
+ amazonLogout();
 
 
113
 
114
+ </script>
115
 
116
  <?php endif; ?>
app/design/frontend/base/default/template/{amazon_login → amazon_payments/login}/script_authorize.phtml RENAMED
@@ -3,7 +3,7 @@
3
  * Login with Amazon
4
  *
5
  * @category Amazon
6
- * @package Amazon_Login
7
  * @copyright Copyright (c) 2014 Amazon.com
8
  * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
  */
3
  * Login with Amazon
4
  *
5
  * @category Amazon
6
+ * @package Amazon_Payments
7
  * @copyright Copyright (c) 2014 Amazon.com
8
  * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
  */
app/design/frontend/base/default/template/{amazon_login → amazon_payments/login}/verify.phtml RENAMED
@@ -3,7 +3,7 @@
3
  * Login with Amazon
4
  *
5
  * @category Amazon
6
- * @package Amazon_Login
7
  * @copyright Copyright (c) 2014 Amazon.com
8
  * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
  */
3
  * Login with Amazon
4
  *
5
  * @category Amazon
6
+ * @package Amazon_Payments
7
  * @copyright Copyright (c) 2014 Amazon.com
8
  * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
  */
app/design/frontend/base/default/template/amazon_payments/mark.phtml CHANGED
@@ -16,4 +16,4 @@
16
  <img src="https://images-na.ssl-images-amazon.com/images/G/01/lwa/btnLWA_gold_32x32.png" height="23">
17
  -->
18
 
19
- <?php print $this->__('Amazon Payments'); ?>
16
  <img src="https://images-na.ssl-images-amazon.com/images/G/01/lwa/btnLWA_gold_32x32.png" height="23">
17
  -->
18
 
19
+ <?php print $this->__('Login and Pay with Amazon'); ?>
app/design/frontend/base/default/template/amazon_payments/onepage/button.phtml CHANGED
@@ -21,10 +21,12 @@
21
  size: "<?php echo $this->getButtonSize(); ?>",
22
  authorization: function() {
23
  loginOptions = {
24
- scope: "profile payments:widget payments:shipping_address<?php print $this->getAdditionalScope(); ?>"
 
 
25
  };
26
 
27
- authRequest = amazon.Login.authorize (loginOptions, "<?php echo $this->getOnepageCheckoutUrl(); ?>");
28
  },
29
  onError: function(error) {
30
  console.log(error);
@@ -39,4 +41,4 @@
39
  <p><strong>- <?php echo $this->__('OR'); ?> -</strong></p>
40
  <br />
41
 
42
- <?php endif; ?>
21
  size: "<?php echo $this->getButtonSize(); ?>",
22
  authorization: function() {
23
  loginOptions = {
24
+ scope: "profile payments:widget payments:shipping_address<?php print $this->getAdditionalScope(); ?>",
25
+ response_type: 'token',
26
+ popup: <?php print $this->isPopup(); ?>
27
  };
28
 
29
+ authRequest = amazon.Login.authorize (loginOptions, "<?php echo (!$this->isPopup()) ? $this->getLoginAuthUrl() : $this->getCheckoutUrl(); ?>");
30
  },
31
  onError: function(error) {
32
  console.log(error);
41
  <p><strong>- <?php echo $this->__('OR'); ?> -</strong></p>
42
  <br />
43
 
44
+ <?php endif; ?>
app/design/frontend/base/default/template/amazon_payments/onepage/login_cancel.phtml CHANGED
@@ -10,7 +10,7 @@
10
  ?>
11
 
12
  <br />
13
- <?php echo $this->__('Amazon Payments uses information from your Amazon account to place your order.'); ?>
14
 
15
  <div class="col2-set">
16
  <div class="col-1">
10
  ?>
11
 
12
  <br />
13
+ <?php echo $this->__('Login and Pay with Amazon uses information from your Amazon account to place your order.'); ?>
14
 
15
  <div class="col2-set">
16
  <div class="col-1">
app/design/frontend/base/default/template/amazon_payments/onepage/widget.phtml CHANGED
@@ -29,7 +29,17 @@
29
  <div id="amazon-widget-wallet"></div>
30
  </div>
31
 
 
 
 
 
 
 
32
 
 
 
 
 
33
 
34
  <div class="buttons-set" id="widget-buttons-container">
35
  <button type="button" title="<?php echo $this->__('Continue') ?>" class="button" onclick="amazonWidgetStep.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
29
  <div id="amazon-widget-wallet"></div>
30
  </div>
31
 
32
+ <div id="additional-form-fields">
33
+ <?php if ($this->isNewsletterEnabled()): ?>
34
+ <p>
35
+ <input type="checkbox" name="is_subscribed" title="<?php echo $this->__('Sign Up for Newsletter') ?>" value="1" id="is_subscribed" class="checkbox" />
36
+ <label for="is_subscribed"><?php echo $this->__('Sign Up for Newsletter') ?></label>
37
+ </p>
38
 
39
+ <?php endif ?>
40
+
41
+ <?php echo $this->getAdditionalForm(); ?>
42
+ </div>
43
 
44
  <div class="buttons-set" id="widget-buttons-container">
45
  <button type="button" title="<?php echo $this->__('Continue') ?>" class="button" onclick="amazonWidgetStep.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
app/design/frontend/base/default/template/amazon_payments/sales/order/amazon_wallet.phtml ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Amazon Payments
4
+ *
5
+ * @category Amazon
6
+ * @package Amazon_Payments
7
+ * @copyright Copyright (c) 2014 Amazon.com
8
+ * @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
9
+ */
10
+ ?>
11
+
12
+ <?php if ($this->isSuspended()) : ?>
13
+
14
+ <div class="page-title title-buttons">
15
+ <h1><?php echo $this->__('Payment Declined By Amazon Payments'); ?></h1>
16
+ </div>
17
+
18
+ <p><?php echo $this->__('Please update your payment method below:'); ?></p>
19
+
20
+
21
+ <div id="amazon-widget-wallet" style="width: 400px; height: 228px;margin:1em 0;"></div>
22
+
23
+ <div class="actions">
24
+ <button id="amazon-update-button" onclick="setLocation('<?php echo Mage::getUrl('amazon_payments/order/confirm/order_id/' . $this->getOrder()->getId()); ?>'); this.disabled = true;" class="button" title="<?php echo $this->__('Update Order'); ?>" type="button"><span><span><?php echo $this->__('Update Order'); ?></span></span></button>
25
+ <div id="amazon-button-wrapper" style="display:none;">
26
+ <?php echo $this->getBlockHtml('amazon_login.no-or'); ?>
27
+ </div>
28
+ </div>
29
+
30
+ <br />
31
+
32
+
33
+ <!-- Address Book Widget JS -->
34
+ <script>
35
+ var amazonWallet = new OffAmazonPayments.Widgets.Wallet({
36
+ sellerId: '<?php echo $this->getSellerId(); ?>',
37
+ amazonOrderReferenceId: '<?php echo $this->getAmazonOrderReferenceId(); ?>',
38
+ design: {
39
+ designMode: 'responsive',
40
+ },
41
+ onPaymentSelect: function(orderReference) {
42
+
43
+ },
44
+ onError: function(error) {
45
+ console.log(error.getErrorMessage());
46
+ if (error.getErrorCode() == 'BuyerSessionExpired') {
47
+ $("amazon-update-button").hide();
48
+ $("amazon-button-wrapper").show();
49
+ Mage.Cookies.set("amazonOrderIdRedirect", <?php echo $this->getOrder()->getId(); ?>);
50
+ }
51
+ }
52
+ }).bind("amazon-widget-wallet");
53
+ </script>
54
+
55
+ <?php endif; ?>
app/design/frontend/base/default/template/amazon_payments/script.phtml CHANGED
@@ -10,34 +10,31 @@
10
  ?>
11
 
12
  <?php
13
- $_helper = Mage::helper('amazon_payments/data');
14
-
15
- $sandbox = ($_helper->isAmazonSandbox()) ? 'sandbox/' : '';
16
- $jsAmazon = 'https://static-na.payments-amazon.com/OffAmazonPayments/us/' . $sandbox . 'js/Widgets.js?sellerId=' . $_helper->getSellerId();
17
-
18
- $isPopup = Mage::helper('amazon_login/data')->isPopup();
19
  ?>
20
 
21
  <script type='text/javascript'>
22
  window.onAmazonLoginReady = function() {
23
- amazon.Login.setClientId('<?php echo $_helper->getClientId(); ?>');
24
 
25
- <?php if (!$isPopup) : ?>
26
  amazon.Login.setUseCookie(true);
27
  <?php endif; ?>
28
 
29
  };
30
 
31
- <?php if (!$isPopup) : ?>
32
- src = '<?php echo $jsAmazon; ?>';
33
  <?php endif; ?>
34
 
35
  </script>
36
 
37
- <script type='text/javascript' src='<?php echo $jsAmazon; ?>'></script>
 
38
 
39
-
40
- <?php if ($_helper->showModal()) : ?>
41
 
42
  <script type="text/javascript">
43
 
@@ -49,30 +46,32 @@ AmazonModal.prototype.initialize = function(width) {
49
 
50
  AmazonModal.prototype.show = function(url) {
51
 
52
- this.oPopup = new Window({
53
- id:'amazon_modal',
54
- className: 'alphacube',
55
- url: url,
56
- width: this.width,
57
- height: 700,
58
- minimizable: false,
59
- maximizable: false,
60
- showEffectOptions: {
61
- duration: 0.4
62
- },
63
- hideEffectOptions:{
64
- duration: 0.4
65
- },
66
- destroyOnClose: true,
67
- onShow: function() { Event.observe($('overlay_modal'), 'click', function() { Windows.closeAll(); }) },
68
- onClose: function() { $('overlay_modal').remove(); }
69
- });
70
- this.oPopup.setZIndex(100);
71
- this.oPopup.showCenter(true);
72
-
73
- // Reponsive modal
74
- Event.observe(window, "resize", this.resize.bind(this));
75
- this.resize();
 
 
76
  }
77
 
78
  AmazonModal.prototype.resize = function() {
@@ -90,7 +89,7 @@ AmazonModal.prototype.resize = function() {
90
 
91
  document.observe("dom:loaded", function() {
92
  var amazonModal = new AmazonModal(1020);
93
- amazonModal.show('<?php print $_helper->getStandaloneUrl(); ?>?ajax=1&<?php print htmlentities($_SERVER['QUERY_STRING']); ?>');
94
  });
95
 
96
 
10
  ?>
11
 
12
  <?php
13
+ if (!Mage::helper('amazon_payments/data')->isEnabled()) {
14
+ return;
15
+ }
 
 
 
16
  ?>
17
 
18
  <script type='text/javascript'>
19
  window.onAmazonLoginReady = function() {
20
+ amazon.Login.setClientId('<?php echo $this->getClientId(); ?>');
21
 
22
+ <?php if (!$this->isPopup()) : ?>
23
  amazon.Login.setUseCookie(true);
24
  <?php endif; ?>
25
 
26
  };
27
 
28
+ <?php if (!$this->isPopup()) : ?>
29
+ src = '<?php echo $this->getWidgetsUrl(); ?>';
30
  <?php endif; ?>
31
 
32
  </script>
33
 
34
+ <script type='text/javascript' src='<?php echo $this->getWidgetsUrl(); ?>'></script>
35
+ <script>jQuery.noConflict();</script>
36
 
37
+ <?php if ($this->showModal()) : ?>
 
38
 
39
  <script type="text/javascript">
40
 
46
 
47
  AmazonModal.prototype.show = function(url) {
48
 
49
+ if ($('amazon_modal') == undefined) {
50
+ this.oPopup = new Window({
51
+ id: 'amazon_modal',
52
+ className: 'alphacube',
53
+ url: url,
54
+ width: this.width,
55
+ height: 700,
56
+ minimizable: false,
57
+ maximizable: false,
58
+ showEffectOptions: {
59
+ duration: 0.4
60
+ },
61
+ hideEffectOptions:{
62
+ duration: 0.4
63
+ },
64
+ destroyOnClose: true,
65
+ onShow: function() { Event.observe($('overlay_modal'), 'click', function() { Windows.closeAll(); }) },
66
+ onClose: function() { $('overlay_modal').remove(); }
67
+ });
68
+ this.oPopup.setZIndex(100);
69
+ this.oPopup.showCenter(true);
70
+
71
+ // Reponsive modal
72
+ Event.observe(window, "resize", this.resize.bind(this));
73
+ this.resize();
74
+ }
75
  }
76
 
77
  AmazonModal.prototype.resize = function() {
89
 
90
  document.observe("dom:loaded", function() {
91
  var amazonModal = new AmazonModal(1020);
92
+ amazonModal.show('<?php print $this->getStandaloneUrl(); ?>?ajax=1&<?php print htmlentities($_SERVER['QUERY_STRING']); ?>');
93
  });
94
 
95
 
app/etc/modules/Amazon_Login.xml DELETED
@@ -1,17 +0,0 @@
1
- <?xml version="1.0"?>
2
- <!--
3
- /**
4
- * @category Amazon
5
- * @package Amazon_Login
6
- * @copyright Copyright (c) 2014 Amazon.com
7
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
- */
9
- -->
10
- <config>
11
- <modules>
12
- <Amazon_Login>
13
- <active>true</active>
14
- <codePool>community</codePool>
15
- </Amazon_Login>
16
- </modules>
17
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/etc/modules/Amazon_Payments.xml CHANGED
@@ -12,9 +12,6 @@
12
  <Amazon_Payments>
13
  <active>true</active>
14
  <codePool>community</codePool>
15
- <depends>
16
- <Amazon_Login />
17
- </depends>
18
  </Amazon_Payments>
19
  </modules>
20
  </config>
12
  <Amazon_Payments>
13
  <active>true</active>
14
  <codePool>community</codePool>
 
 
 
15
  </Amazon_Payments>
16
  </modules>
17
  </config>
app/locale/en_US/template/email/amazon_payments_async_decline_hard.html ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject Please contact us about your order @-->
2
+ <!--@vars
3
+ {"store url=\"\"":"Store Url",
4
+ "var logo_url":"Email Logo Image Url",
5
+ "htmlescape var=$customer.name":"Customer Name",
6
+ "var order url":"Order details URL"}
7
+ @-->
8
+
9
+ <!--@styles
10
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
11
+ @-->
12
+
13
+ <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
14
+ <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
15
+ <table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
16
+ <tr>
17
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
18
+ <!-- [ header starts here] -->
19
+ <table bgcolor="FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
20
+ <tr>
21
+ <td valign="top">
22
+ <a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td>
23
+ </tr>
24
+ <!-- [ middle starts here] -->
25
+ <tr>
26
+ <td valign="top">
27
+ <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;"">Dear {{htmlescape var=$customer.name}},</h1>
28
+ <p style="font-size:12px; line-height:16px; margin:0;">Unfortunately Amazon Payments declined the payment for your order in our online shop {{var store.name}}. Please contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> or by phone at {{config path='general/store_information/phone'}}.</p>
29
+ </td>
30
+ </tr>
31
+ <tr>
32
+ <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you again, <strong>{{var store.getFrontendName()}}</strong></p></center></td>
33
+ </tr>
34
+ </table>
35
+ </td>
36
+ </tr>
37
+ </table>
38
+ </div>
39
+ </body>
app/locale/en_US/template/email/amazon_payments_async_decline_soft.html ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject Payment Declined: Please update your payment method on {{var store.name}}! @-->
2
+ <!--@vars
3
+ {"store url=\"\"":"Store Url",
4
+ "var logo_url":"Email Logo Image Url",
5
+ "htmlescape var=$customer.name":"Customer Name",
6
+ "var order url":"Order details URL"}
7
+ @-->
8
+
9
+ <!--@styles
10
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
11
+ @-->
12
+
13
+ <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
14
+ <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
15
+ <table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
16
+ <tr>
17
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
18
+ <!-- [ header starts here] -->
19
+ <table bgcolor="FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
20
+ <tr>
21
+ <td valign="top">
22
+ <a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td>
23
+ </tr>
24
+ <!-- [ middle starts here] -->
25
+ <tr>
26
+ <td valign="top">
27
+ <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;"">Dear {{htmlescape var=$customer.name}},</h1>
28
+ <p style="font-size:12px; line-height:16px; margin:0;">Amazon Payments could not process your payment. Please visit your order details page below and update your payment method:</p>
29
+ <p style="font-size:12px; line-height:16px; margin:1.5em; margin-right:0;"><a href="{{var order_url}}">{{var order_url}}</a></p>
30
+
31
+ <p style="font-size:12px; line-height:16px; margin:0;">If you have any questions about your account or any other matter, please feel free to contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> or by phone at {{config path='general/store_information/phone'}}.</p>
32
+ </td>
33
+ </tr>
34
+ <tr>
35
+ <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you again, <strong>{{var store.getFrontendName()}}</strong></p></center></td>
36
+ </tr>
37
+ </table>
38
+ </td>
39
+ </tr>
40
+ </table>
41
+ </div>
42
+ </body>
lib/MarketplaceWebServiceSellers/Model/ResponseHeaderMetadata.php DELETED
@@ -1,89 +0,0 @@
1
- <?php
2
- /*******************************************************************************
3
- * Copyright 2009-2014 Amazon Services. All Rights Reserved.
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- *
6
- * You may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at: http://aws.amazon.com/apache2.0
8
- * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
9
- * CONDITIONS OF ANY KIND, either express or implied. See the License for the
10
- * specific language governing permissions and limitations under the License.
11
- *******************************************************************************
12
- * PHP Version 5
13
- * @category Amazon
14
- * @package Marketplace Web Service Sellers
15
- * @version 2011-07-01
16
- * Library Version: 2014-10-20
17
- * Generated: Fri Oct 17 18:34:06 GMT 2014
18
- */
19
-
20
- class MarketplaceWebServiceSellers_Model_ResponseHeaderMetadata {
21
-
22
- const REQUEST_ID = 'x-mws-request-id';
23
- const RESPONSE_CONTEXT = 'x-mws-response-context';
24
- const TIMESTAMP = 'x-mws-timestamp';
25
- const QUOTA_MAX = 'x-mws-quota-max';
26
- const QUOTA_REMAINING = 'x-mws-quota-remaining';
27
- const QUOTA_RESETS_AT = 'x-mws-quota-resetsOn';
28
-
29
- private $metadata = array();
30
-
31
- public function __construct($requestId = null, $responseContext = null, $timestamp = null,
32
- $quotaMax = null, $quotaMax = null, $quotaResetsAt = null) {
33
- $this->metadata[self::REQUEST_ID] = $requestId;
34
- $this->metadata[self::RESPONSE_CONTEXT] = $responseContext;
35
- $this->metadata[self::TIMESTAMP] = $timestamp;
36
- $this->metadata[self::QUOTA_MAX] = $quotaMax;
37
- $this->metadata[self::QUOTA_REMAINING] = $quotaMax;
38
- $this->metadata[self::QUOTA_RESETS_AT] = $quotaResetsAt;
39
- }
40
-
41
- public function getRequestId() {
42
- return $this->metadata[self::REQUEST_ID];
43
- }
44
-
45
- public function getResponseContext() {
46
- return $this->metadata[self::RESPONSE_CONTEXT];
47
- }
48
-
49
- public function getTimestamp() {
50
- return $this->metadata[self::TIMESTAMP];
51
- }
52
-
53
- /**
54
- * Gets the max quota allowed for a quota period
55
- * (from the x-mws-quota-max header)
56
- *
57
- * @return the max quota allowed for a quota period
58
- */
59
- public function getQuotaMax() {
60
- return $this->metadata[self::QUOTA_MAX];
61
- }
62
-
63
- /**
64
- * Gets the quota remaining within this quota period
65
- * (from the x-mws-quota-remaining header)
66
- *
67
- * @return the quota remaining within this quota period
68
- */
69
- public function getQuotaRemaining() {
70
- return $this->metadata[self::QUOTA_REMAINING];
71
- }
72
-
73
- /**
74
- * Gets the time that this quota period ends
75
- * (from the x-mws-quota-resetsOn header)
76
- *
77
- * @return the time that this quota period ends
78
- */
79
- public function getQuotaResetsAt() {
80
- return $this->metadata[self::QUOTA_RESETS_AT];
81
- }
82
-
83
- public function __toString() {
84
- return "RequestId: " . $this->getRequestId() . ", ResponseContext: " . $this->getResponseContext() .
85
- ", Timestamp: " . $this->getTimestamp() . ", Quota Max: " . $this->getQuotaMax() .
86
- ", Quota Remaining: " . $this->getQuotaRemaining() . ", Quota Resets At: " . $this->getQuotaResetsAt();
87
- }
88
-
89
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/MarketplaceWebServiceSellers/Model/ResponseMetadata.php DELETED
@@ -1,94 +0,0 @@
1
- <?php
2
- /*******************************************************************************
3
- * Copyright 2009-2014 Amazon Services. All Rights Reserved.
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- *
6
- * You may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at: http://aws.amazon.com/apache2.0
8
- * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
9
- * CONDITIONS OF ANY KIND, either express or implied. See the License for the
10
- * specific language governing permissions and limitations under the License.
11
- *******************************************************************************
12
- * PHP Version 5
13
- * @category Amazon
14
- * @package Marketplace Web Service Sellers
15
- * @version 2011-07-01
16
- * Library Version: 2014-10-20
17
- * Generated: Fri Oct 17 18:34:06 GMT 2014
18
- */
19
-
20
- /**
21
- * @see MarketplaceWebServiceSellers_Model
22
- */
23
-
24
- require_once (dirname(__FILE__) . '/../Model.php');
25
-
26
-
27
- /**
28
- * MarketplaceWebServiceSellers_Model_ResponseMetadata
29
- *
30
- * Properties:
31
- * <ul>
32
- *
33
- * <li>RequestId: string</li>
34
- *
35
- * </ul>
36
- */
37
-
38
- class MarketplaceWebServiceSellers_Model_ResponseMetadata extends MarketplaceWebServiceSellers_Model {
39
-
40
- public function __construct($data = null)
41
- {
42
- $this->_fields = array (
43
- 'RequestId' => array('FieldValue' => null, 'FieldType' => 'string'),
44
- );
45
- parent::__construct($data);
46
- }
47
-
48
- /**
49
- * Get the value of the RequestId property.
50
- *
51
- * @return String RequestId.
52
- */
53
- public function getRequestId()
54
- {
55
- return $this->_fields['RequestId']['FieldValue'];
56
- }
57
-
58
- /**
59
- * Set the value of the RequestId property.
60
- *
61
- * @param string requestId
62
- * @return this instance
63
- */
64
- public function setRequestId($value)
65
- {
66
- $this->_fields['RequestId']['FieldValue'] = $value;
67
- return $this;
68
- }
69
-
70
- /**
71
- * Check to see if RequestId is set.
72
- *
73
- * @return true if RequestId is set.
74
- */
75
- public function isSetRequestId()
76
- {
77
- return !is_null($this->_fields['RequestId']['FieldValue']);
78
- }
79
-
80
- /**
81
- * Set the value of RequestId, return this.
82
- *
83
- * @param requestId
84
- * The new value to set.
85
- *
86
- * @return This instance.
87
- */
88
- public function withRequestId($value)
89
- {
90
- $this->setRequestId($value);
91
- return $this;
92
- }
93
-
94
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>login_and_pay_for_magento</name>
4
- <version>1.3.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.apache.org/licenses/LICENSE-2.0.html">Apache License, Version 2.0</license>
7
  <channel>community</channel>
@@ -31,40 +31,62 @@
31
  Keep your customers secure! Leverage the same user authentication system used on Amazon.com.&lt;/p&gt;&#xD;
32
  &#xD;
33
  </description>
34
- <notes>v1.3.0 Release&#xD;
35
  Enhancements:&#xD;
36
- - Automated Amazon key checking on save from admin page&#xD;
37
- - Fixed an issue in Asyncrhonous mode where orders wouldnt be updated if any previous orders had mutiple payment methods attached&#xD;
38
- - Added diagnostics tool to help support&#xD;
 
39
  &#xD;
40
  Other Feature Additions:&#xD;
41
- - Added modman, composer.json support (see https://github.com/magento-hackathon/magento-composer-installer)&#xD;
42
- - Async cron job is more durable, will not exit on errors&#xD;
43
- - Better manual syncing on async orders when admin presses Sync With Amazon button&#xD;
44
- - Async capture bug&#xD;
45
- - Better messaging to buyer when existing customer account is found&#xD;
46
  &#xD;
47
  Pull Requests Merged:&#xD;
48
- #134 Add modman, composer.json &#xD;
49
- #125 Update Amazon Login Account Merging Text &#xD;
50
- #120 Diagnostics &#xD;
51
- #119 Check for user_id in amazon profile data. &#xD;
52
- #117 Fixed Amazon Login after Amazon account e-mail change &#xD;
 
 
 
 
53
  &#xD;
54
  Bug Fixes:&#xD;
55
- #122 Sandbox orders should be identifiable to a merchant &#xD;
56
- #116 Display Plugin Version in Config &#xD;
57
- #110 Disable Login with Amazon from customer account page if disabled product in cart&#xD;
58
- #107 Onepage checkout. Moving to Amazon logged in user persists checkout preview items &#xD;
59
- #106 Add key checking on save from payment configuration &#xD;
60
- #104 Order Review Block Issues on Some Sites&#xD;
61
- #103 Add Site Badge&#xD;
62
- #102 Add Badge to OnePage Payment Label&#xD;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  </notes>
64
  <authors><author><name>Amazon Payments</name><user>payments-cp-devel</user><email>payments-cp-devel@amazon.com</email></author></authors>
65
- <date>2015-02-24</date>
66
- <time>18:11:44</time>
67
- <contents><target name="magecommunity"><dir name="Amazon"><dir name="Diagnostics"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><file name="Button.php" hash="db8abb5277728f87d8c2c7a87b742fd1"/><file name="Textarea.php" hash="66064028ab9b3af0eaacc9610fccefea"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="e8800fc7aad8435830912270b9f8934d"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="DiagnosticsController.php" hash="6a858701139b15b56512e5651427dda7"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="e05b867b605e5bf45d96b309deca3840"/><file name="config.xml" hash="5d67503384148675dd519e42ceb3aae6"/><file name="system.xml" hash="bba43fb7caa81fd00c0a98adda4fd4ff"/></dir></dir><dir name="Login"><dir name="Block"><file name="Button.php" hash="6522fd3c81a5959c75979b8d17a62000"/><file name="Script.php" hash="40c4cca328e24521e3562f1466251c55"/><file name="Verify.php" hash="7345e0c12f6f558029dfbea647441e81"/></dir><dir name="Helper"><file name="Data.php" hash="ae6797f0228b6cada765368d661d6bf6"/></dir><dir name="Model"><file name="Api.php" hash="48a3f6306d97f31fa4c3b954a665f334"/><file name="Customer.php" hash="ce836d13885b02c5cf41b7ddbd02e44c"/><file name="Login.php" hash="81a09b4f2c0c62e874ad209ef78ef462"/><dir name="Resource"><file name="Login.php" hash="cea5ac352d61cace9965f1cb940a7272"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><file name="Enabled.php" hash="94bc7fde24ab2ee54ed15bbe7084f118"/><file name="Popupcomment.php" hash="ebcfc96661affbbe5de8ab4d4fc9d4bb"/></dir><dir name="Source"><file name="Buttoncolor.php" hash="ac335e432cd8e47c9ca4be601c706072"/><file name="Buttonsize.php" hash="76ef1db11834db449a7d52c34f3668d8"/><file name="Buttontype.php" hash="5e333d6cb1d70d0227766d78e390530b"/></dir></dir></dir></dir><dir name="controllers"><file name="CustomerController.php" hash="d326a02cb53c18bb78f988adb94a6478"/></dir><dir name="etc"><file name="adminhtml.xml" hash="0aa18eecfebd3e0bb1d84cd6b1040f50"/><file name="config.xml" hash="5f320a09ff6ab1d1799b43b6ddaa3d51"/><file name="system.xml" hash="cc00b85cef386caf51e2cfa729183091"/></dir><dir name="sql"><dir name="login_setup"><file name="install-0.1.0.php" hash="690c4c33f4c5221185c0589e3add63b3"/></dir></dir></dir><dir name="Payments"><dir name="Block"><dir name="Adminhtml"><file name="Notifications.php" hash="793824c5014d1269f0aee1a795e948b9"/></dir><file name="Button.php" hash="067ec17c7909052fe60fcc431ff3069b"/><file name="Checkout.php" hash="532f647be6bd8ed047ae72d380461b7a"/><file name="Form.php" hash="d4de8f8cef523b792b31f2d7be157af3"/><file name="Link.php" hash="47c237fe4604333b2080588c5498a865"/><dir name="Onepage"><file name="Progress.php" hash="ab5ba2e80b849d77f81f10d64e0a141c"/><file name="Widget.php" hash="3bdd30d05fe8af5ef5be4ccacadd6bc4"/></dir><file name="Onepage.php" hash="1d865069483bbe776f511119e0e2252b"/><dir name="Review"><file name="Info.php" hash="8d3688c55137971b18aec41272cf13a6"/></dir><file name="Review.php" hash="d9cf9b6ef7d6f063a06e006e01f09513"/></dir><dir name="Controller"><file name="Checkout.php" hash="898f925b89e5230bb72962bdd8bda0e3"/></dir><dir name="Helper"><file name="Data.php" hash="ce942bfa3bf835aab83ae87eeeae604c"/></dir><dir name="Model"><file name="Api.php" hash="d6991ebdc6c9610599172ec9d5544957"/><file name="Async.php" hash="f2f260346ae7fd34d0b7121b5993f72d"/><file name="Config.php" hash="171715d47e571ced6b4649f79c60c2bc"/><dir name="Observer"><file name="Action.php" hash="d38e500e635b4531ef71f08e92375f34"/><file name="Adminhtml.php" hash="54596e530f3cd3365b8c61313827c0b6"/><file name="Onepage.php" hash="7541e3931dcdaa334860840f2fb11b54"/><file name="Order.php" hash="783f2f46726c4db21f5e5d2b47a9b25d"/></dir><dir name="Order"><file name="Creditmemo.php" hash="6732791d2839272564cf27ecda80707c"/></dir><file name="PaymentMethod.php" hash="119e65f3976033d51c21c49e1c9789af"/><dir name="System"><dir name="Config"><dir name="Backend"><file name="Clientid.php" hash="4512003bcffedf26bc2fe415b91b1be7"/><file name="Clientsecret.php" hash="d2d5f275e4275676e3f494da704e41da"/><file name="Enabled.php" hash="420b81387e51e14dae8220fd17897bdb"/></dir><dir name="Source"><file name="Buttoncolor.php" hash="2564780faa369e54339bded78a882636"/><file name="Buttonsize.php" hash="7f740927b5a58a3ea15d07ac4cfbed28"/><file name="Buttontype.php" hash="735083e4848fa2258b95670b1a546843"/><file name="Checkoutpage.php" hash="2969f9eaa9d87571e0fa8f005e2cdeaf"/><file name="Paymentaction.php" hash="4dba1ce3518538d1a5add743d65c8695"/><file name="Region.php" hash="0718cf97d03a8c56c73fb7ea3a103bc5"/></dir></dir></dir><dir name="Type"><file name="Checkout.php" hash="5465e73384c60df94c9243bb09262dff"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Amazon"><file name="PaymentsController.php" hash="21442b140d7a8a5350019925e750290b"/></dir></dir><file name="CheckoutController.php" hash="6d005be14745219d5f7d28d4c6f51a4b"/><file name="IndexController.php" hash="128f218a9e1bf4af4f7b380f14d87a52"/><file name="OnepageController.php" hash="cc03d109ee1cf98f85aba606f5a44654"/></dir><dir name="etc"><file name="adminhtml.xml" hash="3c56d63f30e0e5cc8c22d3686046631b"/><file name="config.xml" hash="09d0ae764799124ec65558a8741e604b"/><file name="system.xml" hash="08b19094feb2beb005fa41c2c8d61758"/></dir><dir name="sql"><dir name="payments_setup"><file name="install-0.1.0.php" hash="658f9d8c8634b3158cee7b59866e6f39"/></dir></dir></dir></dir></target><target name="magelib"><dir name="OffAmazonPayments"><file name="Model.php" hash="a608217f17166ba11901f5334ad445de"/><file name=".autoloader.php" hash="193fddab8b5ca74646bb78243c0c7dda"/></dir><dir name="OffAmazonPaymentsNotifications"><file name="Client.php" hash="0ab53a8a0a0c069f13e1de3731eaebde"/><dir name="Impl"><file name="IpnNotificationParser.php" hash="fcad418dc58a93e87b854e4067f1e24d"/><file name="Message.php" hash="2ab8cb01bd97ceaeaae0df2bf93ddbf5"/><file name="OpenSslVerifySignature.php" hash="427e2e171daab9ef454ca4ce939edd68"/><file name="SnsMessageParser.php" hash="6a1088096d27a3cdc586e4c298ddf068"/><file name="SnsMessageValidator.php" hash="076f63d5960e4c72a3dc63a76e75316c"/><file name="VerifySignature.php" hash="b18edb328fbe91c1c7b0aa8afe2904d0"/><file name="XmlNotificationParser.php" hash="4881b7d021a86215e43798497bceea24"/></dir><file name="Interface.php" hash="effe919508aab0c2aa1e585d2783c4e6"/><file name="InvalidMessageException.php" hash="2edda9cd6cc0c059846c4858cedfcd66"/><dir name="Model"><file name="AuthorizationDetails.php" hash="843711e02fb56fffcdfb6afcf097e373"/><file name="AuthorizationNotification.php" hash="b00c64bd48ae3bd3c3fa6d991e4b9f5c"/><file name="BillingAgreement.php" hash="677eadcbc4c91282eab548afc6482fdc"/><file name="BillingAgreementLimits.php" hash="a1bd8e8ec111f516528e09340c47de4a"/><file name="BillingAgreementNotification.php" hash="e39a3189bdc937b29b8488e0ef62b562"/><file name="BillingAgreementStatus.php" hash="fae14e95f03245fe6c53e7c7b725c5ca"/><file name="CaptureDetails.php" hash="adb45ebf66daa15990e032025a420e1b"/><file name="CaptureNotification.php" hash="14c2bdc8f6bd6ce881f4403d1f08c6ef"/><file name="IdList.php" hash="2907bdba4b5a534f535c026c40e6d6cc"/><file name="IpnNotificationMetadata.php" hash="58674fca7aa30eea82cb4cba17dec04e"/><file name="MerchantRegistrationDetails.php" hash="37ecb29de3d2d98fbe6f6c8c23f670a2"/><file name="NotificationImpl.php" hash="bfd2e22da29de6dfa15c82a19240132a"/><file name="NotificationMetadataImpl.php" hash="b297f69b967338d433ff90054e06da4b"/><file name="OrderItemCategories.php" hash="a0655ec5a9127ddbd51174ef9e046c5d"/><file name="OrderReference.php" hash="94b51567b72f62355d885e37e365a032"/><file name="OrderReferenceNotification.php" hash="8e6e3a67bf0ae55e86bd718ceca20e0e"/><file name="OrderReferenceStatus.php" hash="e29870a166b75c6d90955a08e0dfe048"/><file name="OrderTotal.php" hash="4141b92ed1bdeb9cfa4c13837df41221"/><file name="Price.php" hash="d94b947bb989fb974e076f2727a0dceb"/><file name="ProviderCreditDetails.php" hash="bf29c9938744effcd759cd95b8a7beab"/><file name="ProviderCreditNotification.php" hash="14b3d8a09ee0feb53cfb701e93e3180e"/><file name="ProviderCreditReversalDetails.php" hash="e9980476af6da3f09de6faff86220f85"/><file name="ProviderCreditReversalNotification.php" hash="bfff2d0e347b1f1dd9e96b0612c87b46"/><file name="ProviderCreditReversalSummary.php" hash="1e69dc1cde4ffac600f89487930cc38c"/><file name="ProviderCreditReversalSummaryList.php" hash="b4b7edc94d7dad37221ca1da5f0969f9"/><file name="ProviderCreditSummary.php" hash="946e787472dc1ee7c9dbcb5d29d62af2"/><file name="ProviderCreditSummaryList.php" hash="fad79864ec1797eed4412d9463c0d02c"/><file name="RefundDetails.php" hash="e0c9fd8c1a921097b4c7e6eb71c20f47"/><file name="RefundNotification.php" hash="28f003801abeb45e0978df05068d73da"/><file name="SellerBillingAgreementAttributes.php" hash="79572632ec2c776fb6a7e96554d7291a"/><file name="SellerOrderAttributes.php" hash="aa6f71cb667d2efb50cc336603b6029c"/><file name="SnsNotificationMetadata.php" hash="835ebe9f84b23e6d59e3f7e2101df531"/><file name="SolutionProviderMerchantNotification.php" hash="91b02852ed507b91e70907e5db488f6f"/><file name="SolutionProviderOption.php" hash="33eca51f6789687e5472cded23be5328"/><file name="SolutionProviderOptions.php" hash="806d915cdd1bd0be5c0e92a3040d49aa"/><file name="Status.php" hash="60765642cca51b523276421d995be784"/></dir><file name="Notification.php" hash="edaf311309c64b67a4fd82ccb86393a3"/><file name="NotificationMetadata.php" hash="9ffe2779593da053e82587dbb61da7d1"/></dir><dir name="OffAmazonPaymentsService"><file name="Client.php" hash="2b5807dda8510506c32adda6686f19e8"/><file name="Environments.php" hash="d84e7322b3394033b427f91be0a0abdb"/><file name="Exception.php" hash="dd85e54cfa5783c7ef7b1f93ca3995b2"/><file name="Interface.php" hash="ca1693109051f319740e4cd7e8ed4de7"/><file name="MerchantValues.php" hash="adb10859cd24d7ab62fecb3c0b67b90d"/><dir name="Model"><file name="Address.php" hash="3b3c00f4b50a4a6f42da15701343ce91"/><file name="AuthorizationDetails.php" hash="77aa03389903c2f777930d838d396da5"/><file name="AuthorizeOnBillingAgreementRequest.php" hash="fcb797660fa5c9cde02c4d482ec69f79"/><file name="AuthorizeOnBillingAgreementResponse.php" hash="c641d4e41db304d6f8f4136ea5d2f500"/><file name="AuthorizeOnBillingAgreementResult.php" hash="7b10d0dc68e7cbf18681abb4e600cca4"/><file name="AuthorizeRequest.php" hash="e7944fb6372becb0c3dd022bb30a9140"/><file name="AuthorizeResponse.php" hash="fb396a94285cacc3eb0fb798a0895466"/><file name="AuthorizeResult.php" hash="0c8f0581538ebba22a5dac5287c0fcc9"/><file name="BillingAddress.php" hash="bef3c0a443ba48ad19d832b91e8740b9"/><file name="BillingAgreementAttributes.php" hash="fe9c760e12c3db71125412ada5a65ec2"/><file name="BillingAgreementDetails.php" hash="0fef2badb342c32a01c44389bcfb52bc"/><file name="BillingAgreementLimits.php" hash="974d1252d7b914169203acdfa6e7082b"/><file name="BillingAgreementStatus.php" hash="002b0516c52264ea95847ea840d68545"/><file name="Buyer.php" hash="83759bcb729cdd8718cdb80182d9a237"/><file name="CancelOrderReferenceRequest.php" hash="86a2753aac94ae645fda1117cf90a926"/><file name="CancelOrderReferenceResponse.php" hash="4d6bc1d4818d81fd5b5820510b608275"/><file name="CancelOrderReferenceResult.php" hash="32013170a09bccf0aac178a7acb56a30"/><file name="CaptureDetails.php" hash="9ca070a0a890be4ec84d7a7264b33800"/><file name="CaptureRequest.php" hash="436da55de37deb4227a685167eb4eaa3"/><file name="CaptureResponse.php" hash="05540d55de14a3252f909fd17c8b62b6"/><file name="CaptureResult.php" hash="20e0bc168c13eb69848f09b520232eeb"/><file name="CloseAuthorizationRequest.php" hash="92d56fd8a0ae338213fdd4f8a5d1b5fc"/><file name="CloseAuthorizationResponse.php" hash="d5887ecf3981534842a9a2371ae063f0"/><file name="CloseAuthorizationResult.php" hash="0505c8c12f3b5252ad389c0c5b94ca8d"/><file name="CloseBillingAgreementRequest.php" hash="c845cdde3cde3242d4c40b1381e0ab2f"/><file name="CloseBillingAgreementResponse.php" hash="51530b8a5d14896488dbf82d6b5a37dc"/><file name="CloseBillingAgreementResult.php" hash="21cb77e2fa38defbc076263c71593168"/><file name="CloseOrderReferenceRequest.php" hash="85ae367281cb4d59f5d347be8bf0147d"/><file name="CloseOrderReferenceResponse.php" hash="d06107418145176a4038f2b0937fd9d7"/><file name="CloseOrderReferenceResult.php" hash="17bc6d72eb29b021fad7d8a222f366dc"/><file name="ConfirmBillingAgreementRequest.php" hash="965b88fe77576f07ce439bc4909e5723"/><file name="ConfirmBillingAgreementResponse.php" hash="989a66f5c217ad50a2a36afd00c763f1"/><file name="ConfirmBillingAgreementResult.php" hash="f0acdd5b7e2e1027bec651e6a6f4681d"/><file name="ConfirmOrderReferenceRequest.php" hash="8561edc4d074fd376e647bd0cdf9a686"/><file name="ConfirmOrderReferenceResponse.php" hash="b94a17b5afd4d923bda35d606c974982"/><file name="Constraint.php" hash="436ed3c926e321bcc9d9c6eaf9b4003a"/><file name="Constraints.php" hash="0063db27ee04067daf94c448f57d5c30"/><file name="CreateOrderReferenceForIdRequest.php" hash="b1c22ce6d83e510d0b9530c99b955711"/><file name="CreateOrderReferenceForIdResponse.php" hash="c811a7c44241a8b968bf4408218ac08f"/><file name="CreateOrderReferenceForIdResult.php" hash="f532299b151a1c4fe4264891737efeaf"/><file name="Destination.php" hash="4e6067e4a3b5f9acb3b9c96452b216fe"/><file name="Error.php" hash="56651e2c89e0214a3c4226903ca84d87"/><file name="ErrorResponse.php" hash="6df06e3cca71a1e73dbcde4bc6b30a3f"/><file name="GetAuthorizationDetailsRequest.php" hash="a0eb816954b6770a7fd8d54d0d75bc1a"/><file name="GetAuthorizationDetailsResponse.php" hash="82b879ccc0212f0752446b40d5338332"/><file name="GetAuthorizationDetailsResult.php" hash="a23e9463ce78b01cc51c45c21b065b6e"/><file name="GetBillingAgreementDetailsRequest.php" hash="91f33b1b1533cc4e98a019ce2c405850"/><file name="GetBillingAgreementDetailsResponse.php" hash="3abcae092618211ae5487f678a45c94f"/><file name="GetBillingAgreementDetailsResult.php" hash="37dc2407a2e9e8dd3e7feae1f690d160"/><file name="GetCaptureDetailsRequest.php" hash="48a9edebb0c7c8284241ac12b53e2d41"/><file name="GetCaptureDetailsResponse.php" hash="49cb6ae36cfba0aedef3c74c24256d53"/><file name="GetCaptureDetailsResult.php" hash="9110dbde9258a74d9933f8a50d10bd3b"/><file name="GetOrderReferenceDetailsRequest.php" hash="b1704b0e1e1f98778501792b82403c50"/><file name="GetOrderReferenceDetailsResponse.php" hash="3ea19407068d478f6c2b077bf8489a74"/><file name="GetOrderReferenceDetailsResult.php" hash="51bc2cd9a665edfb00cec970fc1fd328"/><file name="GetProviderCreditDetailsRequest.php" hash="2ff598dcc690c90b36727351f95bc76a"/><file name="GetProviderCreditDetailsResponse.php" hash="7ec3943a5c7fb0890d1304ccf52cb7d3"/><file name="GetProviderCreditDetailsResult.php" hash="a9033131b919f4f79b1000268892e64b"/><file name="GetProviderCreditReversalDetailsRequest.php" hash="5502cdd97afce7c42d177706cdcb7d0b"/><file name="GetProviderCreditReversalDetailsResponse.php" hash="19d4d9337646583f4a69776965a9f193"/><file name="GetProviderCreditReversalDetailsResult.php" hash="bb56c2f2ec45144234d7534352fe35c4"/><file name="GetRefundDetailsRequest.php" hash="c798b0b57c53e22d20e7e4a92d9eb225"/><file name="GetRefundDetailsResponse.php" hash="c1011e3b07e32792c4ac8ceabab3bc6b"/><file name="GetRefundDetailsResult.php" hash="463db01fb3a45adf9634116f3397f8a7"/><file name="IdList.php" hash="07daf191c601560ddfe50440f9006450"/><file name="OrderItemCategories.php" hash="2820e45ffb6cb36a14368a1dfe89fa84"/><file name="OrderReferenceAttributes.php" hash="990daffb0857fca0c05292ae2fb465cf"/><file name="OrderReferenceDetails.php" hash="2c75125691a884aa8bdc40318bce3b06"/><file name="OrderReferenceStatus.php" hash="04459e930111cf70c989196440f6400f"/><file name="OrderTotal.php" hash="6fda4ce95b066f960eebe41731717925"/><file name="ParentDetails.php" hash="1c6738a58079ffdaaef6e3d5e6afff01"/><file name="Price.php" hash="ea1d5a6e473542f5b0cb8ed1e70436bd"/><file name="ProviderCredit.php" hash="9834503bcc2f619b38157400984377e4"/><file name="ProviderCreditDetails.php" hash="a74f8e42aacd945989e6c5513d808fb3"/><file name="ProviderCreditList.php" hash="1c90c2d71fd33e9b059503b0b0815b53"/><file name="ProviderCreditReversal.php" hash="37aa96053d61a290d98d595d3c3c9226"/><file name="ProviderCreditReversalDetails.php" hash="7585eab585360dcabe7acb0e616f3afb"/><file name="ProviderCreditReversalList.php" hash="e30c2373f4a708443e7dde8f75e1d794"/><file name="ProviderCreditReversalSummary.php" hash="03b0b5aefae44ea5dcac06a4322e57cd"/><file name="ProviderCreditReversalSummaryList.php" hash="23a82515eb4d9f288dbc97691fef9153"/><file name="ProviderCreditSummary.php" hash="530091cb8d5e103ca3e44a0a3384eff2"/><file name="ProviderCreditSummaryList.php" hash="23115d04c6987208d7ba307781e433a5"/><file name="RefundDetails.php" hash="01866f818651ad6c0a7bc12d3c7e6644"/><file name="RefundRequest.php" hash="22b14eadcf9679a92c4325225dbf8c39"/><file name="RefundResponse.php" hash="b01d5c4c81a040bca2e1109e5d34b3e9"/><file name="RefundResult.php" hash="8f2478b1f27a295bff8f30664fd45235"/><file name="ResponseHeaderMetadata.php" hash="d8024e3bf444e8a843a6f2f6a2f836ca"/><file name="ResponseMetadata.php" hash="18e8035d5fc28d2919c1500b9f8734c5"/><file name="ReverseProviderCreditRequest.php" hash="d1b710b8911346ee0437de4e6178ac8e"/><file name="ReverseProviderCreditResponse.php" hash="38c6958d2ceb9ee244e86adee3c55acf"/><file name="ReverseProviderCreditResult.php" hash="313db1523bd575da7ab1fd956866a15d"/><file name="SellerBillingAgreementAttributes.php" hash="b4dc6401ae4340df3c484c00622d234f"/><file name="SellerOrderAttributes.php" hash="9ec79bc1be30eb322d7e88c4102a4ced"/><file name="SetBillingAgreementDetailsRequest.php" hash="9b47c3c72825fe661948aa36a2947da2"/><file name="SetBillingAgreementDetailsResponse.php" hash="7b6886f3597c434e585fb576d84fd9eb"/><file name="SetBillingAgreementDetailsResult.php" hash="d03a4c84cb96eb30f7ef5c76f981d086"/><file name="SetOrderReferenceDetailsRequest.php" hash="eed7e3485bc27f9f73cf7b67a893a1fa"/><file name="SetOrderReferenceDetailsResponse.php" hash="145bdfcfbf3bb091e0eada1361d6f581"/><file name="SetOrderReferenceDetailsResult.php" hash="246c06e0c62ee6a6ec0cfe504940c12d"/><file name="Status.php" hash="11c00f2cc32b11d4cfb8541d5ba2c279"/><file name="ValidateBillingAgreementRequest.php" hash="60250e9c62eaffa0a841bce7238ace22"/><file name="ValidateBillingAgreementResponse.php" hash="c77eebf5805b5972de84a814b3872cc7"/><file name="ValidateBillingAgreementResult.php" hash="95d4e8efc88317a097e376a4aa37a287"/></dir><file name="Model.php" hash="1147a05809ff0cc5f115bb213e38cf02"/><file name="OffAmazonPaymentsService.config.inc.php" hash="20807040ef4565a6b78f09cda6529a34"/><file name="RegionSpecificProperties.php" hash="b18f449745ebbbde5eae769eaf89ade1"/><file name="Regions.php" hash="a544d12c6321899770c039426e063cce"/></dir><dir name="MarketplaceWebServiceSellers"><file name="Client.php" hash="9a9b59ba596e1b08d53dd3d07715fa3d"/><file name="Exception.php" hash="022774b205223fb2e09988a6881b57b0"/><file name="Interface.php" hash="8b5cef37a1c02865998510e07b3ad5f0"/><file name="KeycheckClient.php" hash="9a9b59ba596e1b08d53dd3d07715fa3d"/><dir name="Model"><file name="ListMarketplaceParticipationsRequest.php" hash="59e66ae0991177be83cefbcaa962b155"/><file name="ListMarketplaceParticipationsResponse.php" hash="16b6fed10df863cd5ad05c29f85bf920"/><file name="ListMarketplaceParticipationsResult.php" hash="daecc8554eef98039eba934ce51720e5"/><file name="ListMarketplaces.php" hash="151f584eb5e3cd24be59b2f1309fdf97"/><file name="ListParticipations.php" hash="d0179c65514949255db5a2ea2f1a4796"/><file name="Marketplace.php" hash="c234ffbd0c5f0250b9d448a0d8687d2b"/><file name="Participation.php" hash="50f95fa7c5398a1e8be70700103a754c"/><file name="ResponseHeaderMetaData.php" hash="516b66964035a6bfb40177f7d200ab9c"/><file name="ResponseHeaderMetadata.php" hash="516b66964035a6bfb40177f7d200ab9c"/><file name="ResponseMetaData.php" hash="3095644d4bd240ef6a6069f1f3f7bfde"/><file name="ResponseMetadata.php" hash="3095644d4bd240ef6a6069f1f3f7bfde"/></dir><file name="Model.php" hash="1a27b28fc0e8a0fa60494c5847c51e7f"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="amazon_payments.xml" hash="86dc7900219559e892ffc0728e8bb136"/></dir><dir name="template"><dir name="amazon_payments"><file name="button.phtml" hash="59dc517bafe5ea4c3e35ed71d5ddf9ab"/><file name="notifications.phtml" hash="b94eb031ad1f207078fd705818641503"/><file name="textarea.phtml" hash="6045e3a122766622d18e8d7ad7239af4"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="amazon_login.xml" hash="8a64187752279fe95b7d46052b032f08"/><file name="amazon_payments.xml" hash="71b10955a0fb416886b327b8a6abab34"/></dir><dir name="template"><dir name="amazon_login"><file name="button.phtml" hash="f480e98b14c76a712f71a9f396dec198"/><file name="script.phtml" hash="d88a072633c10bc92aa43e2b23632ae1"/><file name="script_authorize.phtml" hash="b48b1dd8bd8c2f79e3656f16d522f388"/><file name="verify.phtml" hash="65ab4a0115af59faf1e5ff3f0341e102"/></dir><dir name="amazon_payments"><file name="button.phtml" hash="e799a97c3f971e10d4f6d6a0ca025d6a"/><file name="button_badge.phtml" hash="4ca1e3ed42f0cd5fc5ba7ce2ae83b127"/><file name="button_shortcut.phtml" hash="08609929765e01f759d5259727d9dbe1"/><file name="cart.phtml" hash="20375f05aabc98f1384f1d7bf74750fc"/><file name="checkout.phtml" hash="424ccd4ae774e7181694132eaef2a803"/><file name="form.phtml" hash="4cbc8e5d2d8c91fdb604c8f71b3cf51d"/><file name="mark.phtml" hash="ca75879d9eec4444385bcb8b52c8b946"/><dir name="onepage"><file name="button.phtml" hash="a30ed2b190c5a04c2a66a1bad8be6dcd"/><file name="login.phtml" hash="0bf0f852666f60f603268a5443dc2329"/><file name="login_cancel.phtml" hash="ef82f978828a3f81bb9b6c525c5874e1"/><dir name="progress"><file name="widget.phtml" hash="cc26b9857c9f95f5a239e0adb94f6c3e"/></dir><file name="widget.phtml" hash="097c4e6fbc51b16fb2bd52293c3afeb0"/></dir><file name="script.phtml" hash="b298e7b8f164831eb8488ab84aab93eb"/><file name="shipping_method.phtml" hash="b8ab8fcb1a91d7646e0f53d0997c231f"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="amazon_payments"><dir name="css"><file name="popup_alphacube.css" hash="bef655ef0df54d92bd06cec2b2c1a202"/><file name="styles_checkout.css" hash="54b6cf8ea2957b247b668605dfc00d00"/><file name="styles_onepage.css" hash="8c0889b17279ccfb2e7cbd018c3b554c"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Amazon_Login.xml" hash="d8a59c5f864353ed00225b56d4567e19"/><file name="Amazon_Payments.xml" hash="524c5cecde418e14ed6e44c16fd8bae6"/><file name="Amazon_Diagnostics.xml" hash="c56ca83a95a5a3f929fd2ad4e88bd518"/></dir></target></contents>
68
  <compatible/>
69
  <dependencies><required><php><min>5.2.1</min><max>6.0.0</max></php></required></dependencies>
70
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>login_and_pay_for_magento</name>
4
+ <version>1.4.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.apache.org/licenses/LICENSE-2.0.html">Apache License, Version 2.0</license>
7
  <channel>community</channel>
31
  Keep your customers secure! Leverage the same user authentication system used on Amazon.com.&lt;/p&gt;&#xD;
32
  &#xD;
33
  </description>
34
+ <notes>v1.4.0 Release&#xD;
35
  Enhancements:&#xD;
36
+ - Enabled automated key exchange between Amazon and Magento for merchants&#xD;
37
+ - New simplified and streamlined registration process to help merchants start making transactions sooner&#xD;
38
+ - Redesigned UX to group and collapse settings&#xD;
39
+ - Removed duplication of keys in the Login with Amazon settings&#xD;
40
  &#xD;
41
  Other Feature Additions:&#xD;
42
+ - Now using randomized internal reference IDs (e.g. for re-authorizations)&#xD;
 
 
 
 
43
  &#xD;
44
  Pull Requests Merged:&#xD;
45
+ #146 Update Shopping Cart Button Placement&#xD;
46
+ #121 Override mage address validation and force Amazon address for shipping calculation&#xD;
47
+ #143 Updates to Api.php&#xD;
48
+ #164 Fixed call to a method on a non-object&#xD;
49
+ #163 Fixed Content-Type header duplicate&#xD;
50
+ #150 Added OneStepCheckout.com support&#xD;
51
+ #188 Update modman paths&#xD;
52
+ #192 Center the Amazon Badge just like Paypal is&#xD;
53
+ #184 Fix where users were getting a Mixed Content warning on cart page&#xD;
54
  &#xD;
55
  Bug Fixes:&#xD;
56
+ #139 Fix capture error when auth is greater than 7 days old&#xD;
57
+ #132 Add 'None' (new) payment action&#xD;
58
+ #151 Obey account sharing scope config&#xD;
59
+ #152 Fix multi-site refund, cancel, async, etc.&#xD;
60
+ #170 Billing address fixes&#xD;
61
+ #156 Restrict/disable Amazon widgets during standalone checkout order placement&#xD;
62
+ #162 Disable Place Order if no payment method set&#xD;
63
+ #158 Improve async testing and declines&#xD;
64
+ #157 Restrict address widget and shipping method if payment declined&#xD;
65
+ #156 Disable iframe and divs for IE 10&#xD;
66
+ #158 Add email template for async declines&#xD;
67
+ #176 Don't redirect to secure cart if Amazon payment method is disabled&#xD;
68
+ #175 Don't inject JS when payment method disabled&#xD;
69
+ #158 Add wallet widget on order detail page for async declines&#xD;
70
+ #180 Always display login button on Checkout page&#xD;
71
+ #157 Disable shipping widget and method on declines&#xD;
72
+ #158 Use 'Login with Amazon' button instead of 'Pay'&#xD;
73
+ #131 Add Sync auth in front of Async auth&#xD;
74
+ #157 remove exception message&#xD;
75
+ #174 Add Pay with Amazon button in mini cart&#xD;
76
+ #181 Close Amazon Order when order state changed to COMPLETE (e.g. when order is shipped)&#xD;
77
+ #182 Add Login button to register/account creation page&#xD;
78
+ #193 Change payment decline email to transactional email for cron compatibility&#xD;
79
+ #161 Add jQuery.noConflict() to fix JS errors and conflicts with prototype&#xD;
80
+ #197 Fix amazon account logout&#xD;
81
+ #198 Fix JS error when shipping method is hidden (e.g. virtual products)&#xD;
82
+ #140 Auth Decline Errors could be more user friendly&#xD;
83
+ #190 Add hard decline email for async&#xD;
84
+ #206 Remove Widgets.js if cart is empty or 'Display on Product Page' is set to No&#xD;
85
  </notes>
86
  <authors><author><name>Amazon Payments</name><user>payments-cp-devel</user><email>payments-cp-devel@amazon.com</email></author></authors>
87
+ <date>2016-03-30</date>
88
+ <time>21:18:30</time>
89
+ <contents><target name="magecommunity"><dir name="Amazon"><dir name="Diagnostics"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><file name="Button.php" hash="db8abb5277728f87d8c2c7a87b742fd1"/><file name="Textarea.php" hash="66064028ab9b3af0eaacc9610fccefea"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="e8800fc7aad8435830912270b9f8934d"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="DiagnosticsController.php" hash="5d617a0b551a91c70945f4d678ba5cb4"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="e05b867b605e5bf45d96b309deca3840"/><file name="config.xml" hash="2a8837903c46948e17d947eae1527fab"/><file name="system.xml" hash="c1a8d849fb7342cd122e0f445a8de117"/></dir></dir><dir name="Payments"><dir name="Block"><dir name="Adminhtml"><file name="Notifications.php" hash="793824c5014d1269f0aee1a795e948b9"/><dir name="System"><dir name="Config"><file name="Simplepathimport.php" hash="1f961d99dd02ea0b6ad886c7e65885cc"/></dir></dir></dir><file name="Button.php" hash="b9094d9f7fc1ba1affa6eca1c681844a"/><file name="Checkout.php" hash="532f647be6bd8ed047ae72d380461b7a"/><file name="Form.php" hash="d4de8f8cef523b792b31f2d7be157af3"/><file name="Link.php" hash="47c237fe4604333b2080588c5498a865"/><dir name="Login"><file name="Button.php" hash="4e2416622427848eb17785277f2bb300"/><file name="Script.php" hash="9e3f4503e5714958eb3417b56c7a6477"/><file name="Verify.php" hash="c0b4a13d81f2f67bb6f0448c54264aee"/></dir><dir name="Onepage"><file name="Progress.php" hash="ab5ba2e80b849d77f81f10d64e0a141c"/><file name="Widget.php" hash="fe33171163dad6751fef425a0d88adb5"/></dir><file name="Onepage.php" hash="1d865069483bbe776f511119e0e2252b"/><dir name="Review"><file name="Info.php" hash="8d3688c55137971b18aec41272cf13a6"/></dir><file name="Review.php" hash="d9cf9b6ef7d6f063a06e006e01f09513"/><dir name="Sales"><file name="View.php" hash="fe64b8167da350b68971766af740e4f5"/></dir><file name="Script.php" hash="0a5b1bb668a7feb89bf0252b00d48252"/></dir><dir name="Controller"><file name="Checkout.php" hash="52119513775ba46d484024d7059958bf"/></dir><dir name="Helper"><file name="Data.php" hash="1845612eff9ecb69234f7dfdb5e78a1f"/></dir><dir name="Model"><file name="Api.php" hash="5010e72a41d065fc73b546c9e0633c46"/><file name="Async.php" hash="2ce8391b42bd4cf46ec1388ae274e88d"/><file name="Config.php" hash="09d66f092432281ca4db266946debe53"/><file name="Customer.php" hash="974941930716e9f0626b75681f2f2aa6"/><file name="Login.php" hash="34865bdc03c1d686d31678f16cb9140b"/><dir name="Observer"><file name="Action.php" hash="496c68b07856a26615a6970ff1c6dba0"/><file name="Adminhtml.php" hash="54596e530f3cd3365b8c61313827c0b6"/><file name="Onepage.php" hash="7541e3931dcdaa334860840f2fb11b54"/><file name="Order.php" hash="6218558c5cc55834e61479175ed122bc"/></dir><dir name="Order"><file name="Creditmemo.php" hash="6732791d2839272564cf27ecda80707c"/></dir><file name="PaymentMethod.php" hash="6a0cd07cf5b90150337af861a0fdef7a"/><dir name="Resource"><file name="Login.php" hash="8651de25cb8340e03c46202d3ecb800e"/></dir><file name="SimplePath.php" hash="5799377f39b56e3684999a8f67deb504"/><dir name="System"><dir name="Config"><dir name="Backend"><file name="Enabled.php" hash="d7479a7d92fb02da7149ddc19f01e82c"/><file name="Popupcomment.php" hash="bed36a5f3b3794dec8f811592c8ce73c"/><file name="Simplepath.php" hash="789f5578e8613d30c501a89ba407fce5"/></dir><dir name="Source"><file name="Buttoncolor.php" hash="2564780faa369e54339bded78a882636"/><file name="Buttonsize.php" hash="7f740927b5a58a3ea15d07ac4cfbed28"/><file name="Buttontype.php" hash="735083e4848fa2258b95670b1a546843"/><file name="Checkoutpage.php" hash="2969f9eaa9d87571e0fa8f005e2cdeaf"/><file name="Paymentaction.php" hash="602ecc788d8f5669ee0f000aebbf859a"/><file name="Region.php" hash="0718cf97d03a8c56c73fb7ea3a103bc5"/></dir></dir></dir><dir name="Type"><file name="Checkout.php" hash="204f358ef9d803f7a1b441cae558b638"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Amazon"><file name="PaymentsController.php" hash="9fafa9e25cc75eb637a9f987c199d85c"/><file name="SimplepathController.php" hash="39822de071eafeedea8876a9a5684e0a"/></dir></dir><file name="CheckoutController.php" hash="6d005be14745219d5f7d28d4c6f51a4b"/><file name="CustomerController.php" hash="c5a48e931491d27180668e06b1cf184f"/><file name="IndexController.php" hash="128f218a9e1bf4af4f7b380f14d87a52"/><file name="OnepageController.php" hash="c9d9afcb6f1e06af7689953922ff3138"/><file name="OrderController.php" hash="aa98666e5914d46e008a3dff746b1c31"/><file name="SimplepathController.php" hash="1f33a4362df4b7ff6a3504912ead329c"/></dir><dir name="etc"><file name="adminhtml.xml" hash="3c56d63f30e0e5cc8c22d3686046631b"/><file name="config.xml" hash="fad9b03e8a6c4d222846343a8920df7a"/><file name="system.xml" hash="627f5db2754af7fb9c3c4d7caf24cbde"/></dir><dir name="sql"><dir name="payments_setup"><file name="install-0.1.0.php" hash="56cd481dd3c0b6e55c22c8cbbee67c28"/><file name="upgrade-1.3.0-1.4.0.php" hash="a246d714560a4fb187e055a82803f187"/></dir></dir></dir></dir></target><target name="magelib"><dir name="OffAmazonPayments"><file name="Model.php" hash="a608217f17166ba11901f5334ad445de"/><file name=".autoloader.php" hash="193fddab8b5ca74646bb78243c0c7dda"/></dir><dir name="OffAmazonPaymentsNotifications"><file name="Client.php" hash="0ab53a8a0a0c069f13e1de3731eaebde"/><dir name="Impl"><file name="IpnNotificationParser.php" hash="fcad418dc58a93e87b854e4067f1e24d"/><file name="Message.php" hash="2ab8cb01bd97ceaeaae0df2bf93ddbf5"/><file name="OpenSslVerifySignature.php" hash="427e2e171daab9ef454ca4ce939edd68"/><file name="SnsMessageParser.php" hash="6a1088096d27a3cdc586e4c298ddf068"/><file name="SnsMessageValidator.php" hash="076f63d5960e4c72a3dc63a76e75316c"/><file name="VerifySignature.php" hash="b18edb328fbe91c1c7b0aa8afe2904d0"/><file name="XmlNotificationParser.php" hash="4881b7d021a86215e43798497bceea24"/></dir><file name="Interface.php" hash="effe919508aab0c2aa1e585d2783c4e6"/><file name="InvalidMessageException.php" hash="2edda9cd6cc0c059846c4858cedfcd66"/><dir name="Model"><file name="AuthorizationDetails.php" hash="843711e02fb56fffcdfb6afcf097e373"/><file name="AuthorizationNotification.php" hash="b00c64bd48ae3bd3c3fa6d991e4b9f5c"/><file name="BillingAgreement.php" hash="677eadcbc4c91282eab548afc6482fdc"/><file name="BillingAgreementLimits.php" hash="a1bd8e8ec111f516528e09340c47de4a"/><file name="BillingAgreementNotification.php" hash="e39a3189bdc937b29b8488e0ef62b562"/><file name="BillingAgreementStatus.php" hash="fae14e95f03245fe6c53e7c7b725c5ca"/><file name="CaptureDetails.php" hash="adb45ebf66daa15990e032025a420e1b"/><file name="CaptureNotification.php" hash="14c2bdc8f6bd6ce881f4403d1f08c6ef"/><file name="IdList.php" hash="2907bdba4b5a534f535c026c40e6d6cc"/><file name="IpnNotificationMetadata.php" hash="58674fca7aa30eea82cb4cba17dec04e"/><file name="MerchantRegistrationDetails.php" hash="37ecb29de3d2d98fbe6f6c8c23f670a2"/><file name="NotificationImpl.php" hash="bfd2e22da29de6dfa15c82a19240132a"/><file name="NotificationMetadataImpl.php" hash="b297f69b967338d433ff90054e06da4b"/><file name="OrderItemCategories.php" hash="a0655ec5a9127ddbd51174ef9e046c5d"/><file name="OrderReference.php" hash="94b51567b72f62355d885e37e365a032"/><file name="OrderReferenceNotification.php" hash="8e6e3a67bf0ae55e86bd718ceca20e0e"/><file name="OrderReferenceStatus.php" hash="e29870a166b75c6d90955a08e0dfe048"/><file name="OrderTotal.php" hash="4141b92ed1bdeb9cfa4c13837df41221"/><file name="Price.php" hash="d94b947bb989fb974e076f2727a0dceb"/><file name="ProviderCreditDetails.php" hash="bf29c9938744effcd759cd95b8a7beab"/><file name="ProviderCreditNotification.php" hash="14b3d8a09ee0feb53cfb701e93e3180e"/><file name="ProviderCreditReversalDetails.php" hash="e9980476af6da3f09de6faff86220f85"/><file name="ProviderCreditReversalNotification.php" hash="bfff2d0e347b1f1dd9e96b0612c87b46"/><file name="ProviderCreditReversalSummary.php" hash="1e69dc1cde4ffac600f89487930cc38c"/><file name="ProviderCreditReversalSummaryList.php" hash="b4b7edc94d7dad37221ca1da5f0969f9"/><file name="ProviderCreditSummary.php" hash="946e787472dc1ee7c9dbcb5d29d62af2"/><file name="ProviderCreditSummaryList.php" hash="fad79864ec1797eed4412d9463c0d02c"/><file name="RefundDetails.php" hash="e0c9fd8c1a921097b4c7e6eb71c20f47"/><file name="RefundNotification.php" hash="28f003801abeb45e0978df05068d73da"/><file name="SellerBillingAgreementAttributes.php" hash="79572632ec2c776fb6a7e96554d7291a"/><file name="SellerOrderAttributes.php" hash="aa6f71cb667d2efb50cc336603b6029c"/><file name="SnsNotificationMetadata.php" hash="835ebe9f84b23e6d59e3f7e2101df531"/><file name="SolutionProviderMerchantNotification.php" hash="91b02852ed507b91e70907e5db488f6f"/><file name="SolutionProviderOption.php" hash="33eca51f6789687e5472cded23be5328"/><file name="SolutionProviderOptions.php" hash="806d915cdd1bd0be5c0e92a3040d49aa"/><file name="Status.php" hash="60765642cca51b523276421d995be784"/></dir><file name="Notification.php" hash="edaf311309c64b67a4fd82ccb86393a3"/><file name="NotificationMetadata.php" hash="9ffe2779593da053e82587dbb61da7d1"/></dir><dir name="OffAmazonPaymentsService"><file name="Client.php" hash="2b5807dda8510506c32adda6686f19e8"/><file name="Environments.php" hash="d84e7322b3394033b427f91be0a0abdb"/><file name="Exception.php" hash="dd85e54cfa5783c7ef7b1f93ca3995b2"/><file name="Interface.php" hash="ca1693109051f319740e4cd7e8ed4de7"/><file name="MerchantValues.php" hash="adb10859cd24d7ab62fecb3c0b67b90d"/><dir name="Model"><file name="Address.php" hash="3b3c00f4b50a4a6f42da15701343ce91"/><file name="AuthorizationDetails.php" hash="77aa03389903c2f777930d838d396da5"/><file name="AuthorizeOnBillingAgreementRequest.php" hash="fcb797660fa5c9cde02c4d482ec69f79"/><file name="AuthorizeOnBillingAgreementResponse.php" hash="c641d4e41db304d6f8f4136ea5d2f500"/><file name="AuthorizeOnBillingAgreementResult.php" hash="7b10d0dc68e7cbf18681abb4e600cca4"/><file name="AuthorizeRequest.php" hash="e7944fb6372becb0c3dd022bb30a9140"/><file name="AuthorizeResponse.php" hash="fb396a94285cacc3eb0fb798a0895466"/><file name="AuthorizeResult.php" hash="0c8f0581538ebba22a5dac5287c0fcc9"/><file name="BillingAddress.php" hash="bef3c0a443ba48ad19d832b91e8740b9"/><file name="BillingAgreementAttributes.php" hash="fe9c760e12c3db71125412ada5a65ec2"/><file name="BillingAgreementDetails.php" hash="0fef2badb342c32a01c44389bcfb52bc"/><file name="BillingAgreementLimits.php" hash="974d1252d7b914169203acdfa6e7082b"/><file name="BillingAgreementStatus.php" hash="002b0516c52264ea95847ea840d68545"/><file name="Buyer.php" hash="83759bcb729cdd8718cdb80182d9a237"/><file name="CancelOrderReferenceRequest.php" hash="86a2753aac94ae645fda1117cf90a926"/><file name="CancelOrderReferenceResponse.php" hash="4d6bc1d4818d81fd5b5820510b608275"/><file name="CancelOrderReferenceResult.php" hash="32013170a09bccf0aac178a7acb56a30"/><file name="CaptureDetails.php" hash="9ca070a0a890be4ec84d7a7264b33800"/><file name="CaptureRequest.php" hash="436da55de37deb4227a685167eb4eaa3"/><file name="CaptureResponse.php" hash="05540d55de14a3252f909fd17c8b62b6"/><file name="CaptureResult.php" hash="20e0bc168c13eb69848f09b520232eeb"/><file name="CloseAuthorizationRequest.php" hash="92d56fd8a0ae338213fdd4f8a5d1b5fc"/><file name="CloseAuthorizationResponse.php" hash="d5887ecf3981534842a9a2371ae063f0"/><file name="CloseAuthorizationResult.php" hash="0505c8c12f3b5252ad389c0c5b94ca8d"/><file name="CloseBillingAgreementRequest.php" hash="c845cdde3cde3242d4c40b1381e0ab2f"/><file name="CloseBillingAgreementResponse.php" hash="51530b8a5d14896488dbf82d6b5a37dc"/><file name="CloseBillingAgreementResult.php" hash="21cb77e2fa38defbc076263c71593168"/><file name="CloseOrderReferenceRequest.php" hash="85ae367281cb4d59f5d347be8bf0147d"/><file name="CloseOrderReferenceResponse.php" hash="d06107418145176a4038f2b0937fd9d7"/><file name="CloseOrderReferenceResult.php" hash="17bc6d72eb29b021fad7d8a222f366dc"/><file name="ConfirmBillingAgreementRequest.php" hash="965b88fe77576f07ce439bc4909e5723"/><file name="ConfirmBillingAgreementResponse.php" hash="989a66f5c217ad50a2a36afd00c763f1"/><file name="ConfirmBillingAgreementResult.php" hash="f0acdd5b7e2e1027bec651e6a6f4681d"/><file name="ConfirmOrderReferenceRequest.php" hash="8561edc4d074fd376e647bd0cdf9a686"/><file name="ConfirmOrderReferenceResponse.php" hash="b94a17b5afd4d923bda35d606c974982"/><file name="Constraint.php" hash="436ed3c926e321bcc9d9c6eaf9b4003a"/><file name="Constraints.php" hash="0063db27ee04067daf94c448f57d5c30"/><file name="CreateOrderReferenceForIdRequest.php" hash="b1c22ce6d83e510d0b9530c99b955711"/><file name="CreateOrderReferenceForIdResponse.php" hash="c811a7c44241a8b968bf4408218ac08f"/><file name="CreateOrderReferenceForIdResult.php" hash="f532299b151a1c4fe4264891737efeaf"/><file name="Destination.php" hash="4e6067e4a3b5f9acb3b9c96452b216fe"/><file name="Error.php" hash="56651e2c89e0214a3c4226903ca84d87"/><file name="ErrorResponse.php" hash="6df06e3cca71a1e73dbcde4bc6b30a3f"/><file name="GetAuthorizationDetailsRequest.php" hash="a0eb816954b6770a7fd8d54d0d75bc1a"/><file name="GetAuthorizationDetailsResponse.php" hash="82b879ccc0212f0752446b40d5338332"/><file name="GetAuthorizationDetailsResult.php" hash="a23e9463ce78b01cc51c45c21b065b6e"/><file name="GetBillingAgreementDetailsRequest.php" hash="91f33b1b1533cc4e98a019ce2c405850"/><file name="GetBillingAgreementDetailsResponse.php" hash="3abcae092618211ae5487f678a45c94f"/><file name="GetBillingAgreementDetailsResult.php" hash="37dc2407a2e9e8dd3e7feae1f690d160"/><file name="GetCaptureDetailsRequest.php" hash="48a9edebb0c7c8284241ac12b53e2d41"/><file name="GetCaptureDetailsResponse.php" hash="49cb6ae36cfba0aedef3c74c24256d53"/><file name="GetCaptureDetailsResult.php" hash="9110dbde9258a74d9933f8a50d10bd3b"/><file name="GetOrderReferenceDetailsRequest.php" hash="b1704b0e1e1f98778501792b82403c50"/><file name="GetOrderReferenceDetailsResponse.php" hash="3ea19407068d478f6c2b077bf8489a74"/><file name="GetOrderReferenceDetailsResult.php" hash="51bc2cd9a665edfb00cec970fc1fd328"/><file name="GetProviderCreditDetailsRequest.php" hash="2ff598dcc690c90b36727351f95bc76a"/><file name="GetProviderCreditDetailsResponse.php" hash="7ec3943a5c7fb0890d1304ccf52cb7d3"/><file name="GetProviderCreditDetailsResult.php" hash="a9033131b919f4f79b1000268892e64b"/><file name="GetProviderCreditReversalDetailsRequest.php" hash="5502cdd97afce7c42d177706cdcb7d0b"/><file name="GetProviderCreditReversalDetailsResponse.php" hash="19d4d9337646583f4a69776965a9f193"/><file name="GetProviderCreditReversalDetailsResult.php" hash="bb56c2f2ec45144234d7534352fe35c4"/><file name="GetRefundDetailsRequest.php" hash="c798b0b57c53e22d20e7e4a92d9eb225"/><file name="GetRefundDetailsResponse.php" hash="c1011e3b07e32792c4ac8ceabab3bc6b"/><file name="GetRefundDetailsResult.php" hash="463db01fb3a45adf9634116f3397f8a7"/><file name="IdList.php" hash="07daf191c601560ddfe50440f9006450"/><file name="OrderItemCategories.php" hash="2820e45ffb6cb36a14368a1dfe89fa84"/><file name="OrderReferenceAttributes.php" hash="990daffb0857fca0c05292ae2fb465cf"/><file name="OrderReferenceDetails.php" hash="2c75125691a884aa8bdc40318bce3b06"/><file name="OrderReferenceStatus.php" hash="04459e930111cf70c989196440f6400f"/><file name="OrderTotal.php" hash="6fda4ce95b066f960eebe41731717925"/><file name="ParentDetails.php" hash="1c6738a58079ffdaaef6e3d5e6afff01"/><file name="Price.php" hash="ea1d5a6e473542f5b0cb8ed1e70436bd"/><file name="ProviderCredit.php" hash="9834503bcc2f619b38157400984377e4"/><file name="ProviderCreditDetails.php" hash="a74f8e42aacd945989e6c5513d808fb3"/><file name="ProviderCreditList.php" hash="1c90c2d71fd33e9b059503b0b0815b53"/><file name="ProviderCreditReversal.php" hash="37aa96053d61a290d98d595d3c3c9226"/><file name="ProviderCreditReversalDetails.php" hash="7585eab585360dcabe7acb0e616f3afb"/><file name="ProviderCreditReversalList.php" hash="e30c2373f4a708443e7dde8f75e1d794"/><file name="ProviderCreditReversalSummary.php" hash="03b0b5aefae44ea5dcac06a4322e57cd"/><file name="ProviderCreditReversalSummaryList.php" hash="23a82515eb4d9f288dbc97691fef9153"/><file name="ProviderCreditSummary.php" hash="530091cb8d5e103ca3e44a0a3384eff2"/><file name="ProviderCreditSummaryList.php" hash="23115d04c6987208d7ba307781e433a5"/><file name="RefundDetails.php" hash="01866f818651ad6c0a7bc12d3c7e6644"/><file name="RefundRequest.php" hash="22b14eadcf9679a92c4325225dbf8c39"/><file name="RefundResponse.php" hash="b01d5c4c81a040bca2e1109e5d34b3e9"/><file name="RefundResult.php" hash="8f2478b1f27a295bff8f30664fd45235"/><file name="ResponseHeaderMetadata.php" hash="d8024e3bf444e8a843a6f2f6a2f836ca"/><file name="ResponseMetadata.php" hash="18e8035d5fc28d2919c1500b9f8734c5"/><file name="ReverseProviderCreditRequest.php" hash="d1b710b8911346ee0437de4e6178ac8e"/><file name="ReverseProviderCreditResponse.php" hash="38c6958d2ceb9ee244e86adee3c55acf"/><file name="ReverseProviderCreditResult.php" hash="313db1523bd575da7ab1fd956866a15d"/><file name="SellerBillingAgreementAttributes.php" hash="b4dc6401ae4340df3c484c00622d234f"/><file name="SellerOrderAttributes.php" hash="9ec79bc1be30eb322d7e88c4102a4ced"/><file name="SetBillingAgreementDetailsRequest.php" hash="9b47c3c72825fe661948aa36a2947da2"/><file name="SetBillingAgreementDetailsResponse.php" hash="7b6886f3597c434e585fb576d84fd9eb"/><file name="SetBillingAgreementDetailsResult.php" hash="d03a4c84cb96eb30f7ef5c76f981d086"/><file name="SetOrderReferenceDetailsRequest.php" hash="eed7e3485bc27f9f73cf7b67a893a1fa"/><file name="SetOrderReferenceDetailsResponse.php" hash="145bdfcfbf3bb091e0eada1361d6f581"/><file name="SetOrderReferenceDetailsResult.php" hash="246c06e0c62ee6a6ec0cfe504940c12d"/><file name="Status.php" hash="11c00f2cc32b11d4cfb8541d5ba2c279"/><file name="ValidateBillingAgreementRequest.php" hash="60250e9c62eaffa0a841bce7238ace22"/><file name="ValidateBillingAgreementResponse.php" hash="c77eebf5805b5972de84a814b3872cc7"/><file name="ValidateBillingAgreementResult.php" hash="95d4e8efc88317a097e376a4aa37a287"/></dir><file name="Model.php" hash="1147a05809ff0cc5f115bb213e38cf02"/><file name="OffAmazonPaymentsService.config.inc.php" hash="20807040ef4565a6b78f09cda6529a34"/><file name="RegionSpecificProperties.php" hash="b18f449745ebbbde5eae769eaf89ade1"/><file name="Regions.php" hash="a544d12c6321899770c039426e063cce"/></dir><dir name="MarketplaceWebServiceSellers"><file name="Client.php" hash="9a9b59ba596e1b08d53dd3d07715fa3d"/><file name="Exception.php" hash="022774b205223fb2e09988a6881b57b0"/><file name="Interface.php" hash="8b5cef37a1c02865998510e07b3ad5f0"/><file name="KeycheckClient.php" hash="9a9b59ba596e1b08d53dd3d07715fa3d"/><dir name="Model"><file name="ListMarketplaceParticipationsRequest.php" hash="59e66ae0991177be83cefbcaa962b155"/><file name="ListMarketplaceParticipationsResponse.php" hash="16b6fed10df863cd5ad05c29f85bf920"/><file name="ListMarketplaceParticipationsResult.php" hash="daecc8554eef98039eba934ce51720e5"/><file name="ListMarketplaces.php" hash="151f584eb5e3cd24be59b2f1309fdf97"/><file name="ListParticipations.php" hash="d0179c65514949255db5a2ea2f1a4796"/><file name="Marketplace.php" hash="c234ffbd0c5f0250b9d448a0d8687d2b"/><file name="Participation.php" hash="50f95fa7c5398a1e8be70700103a754c"/><file name="ResponseHeaderMetaData.php" hash="516b66964035a6bfb40177f7d200ab9c"/><file name="ResponseMetaData.php" hash="3095644d4bd240ef6a6069f1f3f7bfde"/></dir><file name="Model.php" hash="1a27b28fc0e8a0fa60494c5847c51e7f"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="amazon_payments.xml" hash="b90e9bc0744abc0ee504dd0a882d1d22"/></dir><dir name="template"><dir name="amazon_payments"><file name="button.phtml" hash="59dc517bafe5ea4c3e35ed71d5ddf9ab"/><file name="notifications.phtml" hash="b94eb031ad1f207078fd705818641503"/><file name="textarea.phtml" hash="6045e3a122766622d18e8d7ad7239af4"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="amazon_payments.xml" hash="574978d4d851db8cf32b6a49058b0f42"/></dir><dir name="template"><dir name="amazon_payments"><file name="button.phtml" hash="8136f613215fbf17546331a5b2a8c4a5"/><file name="button_badge.phtml" hash="0631a879de25eacaa71da38c1e9ebd73"/><file name="button_shortcut.phtml" hash="08609929765e01f759d5259727d9dbe1"/><file name="cart.phtml" hash="20375f05aabc98f1384f1d7bf74750fc"/><file name="checkout.phtml" hash="abdd545c35e309fc3860f242fe3b6229"/><file name="form.phtml" hash="4cbc8e5d2d8c91fdb604c8f71b3cf51d"/><dir name="login"><file name="button.phtml" hash="6af0d50c67e8e9231ce1a58903a46cea"/><file name="logout.phtml" hash="dadc5dae9e6f650e2bff36e09ed9d4db"/><file name="script.phtml" hash="9325c457ad9f1e7b278c13a119030733"/><file name="script_authorize.phtml" hash="13b088811587395579e2f2412e50bec1"/><file name="verify.phtml" hash="10594cb55b719da4a5f75af3f52ef09e"/></dir><file name="mark.phtml" hash="f6fbeb5fbf57bd6fe177bf5cb54743ef"/><dir name="onepage"><file name="button.phtml" hash="d124d850223ca99e3e209c646da32d34"/><file name="login.phtml" hash="0bf0f852666f60f603268a5443dc2329"/><file name="login_cancel.phtml" hash="aaef9de126880e9bae5bfeaf26f517e7"/><dir name="progress"><file name="widget.phtml" hash="cc26b9857c9f95f5a239e0adb94f6c3e"/></dir><file name="widget.phtml" hash="b471d9dc25524dfb197b5d9d45823f83"/></dir><dir name="sales"><dir name="order"><file name="amazon_wallet.phtml" hash="fefafd36bd5df2e02ec020dd278fd947"/></dir></dir><file name="script.phtml" hash="409d39f1f1bb32d921ce506bc6cd40b3"/><file name="shipping_method.phtml" hash="b8ab8fcb1a91d7646e0f53d0997c231f"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="amazon_payments"><dir name="css"><file name="popup_alphacube.css" hash="bef655ef0df54d92bd06cec2b2c1a202"/><file name="styles_checkout.css" hash="7d68b8a77b862c61b6cb2dc9050d0c3b"/><file name="styles_onepage.css" hash="c59f7238c15f7e088e8587a65405a21b"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="amazonpayments"><file name="amazonpayments.js" hash="a359964bbc66633a29feba53740bc13b"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Amazon_Payments.xml" hash="78ccdee9536630d55cab0a62a93945ef"/><file name="Amazon_Diagnostics.xml" hash="c56ca83a95a5a3f929fd2ad4e88bd518"/></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><file name="amazon_payments_async_decline_hard.html" hash="fceca30d8dd084ccb7d4aac2f4512d05"/><file name="amazon_payments_async_decline_soft.html" hash="adfcf82d47d2c548694f74eb93993490"/></dir></dir></dir></target></contents>
90
  <compatible/>
91
  <dependencies><required><php><min>5.2.1</min><max>6.0.0</max></php></required></dependencies>
92
  </package>
skin/adminhtml/default/default/amazonpayments/amazonpayments.js ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Amazon Payments Adminhtml
3
+ *
4
+ * var AmazonSp is set by Amazon_Payments_Model_SimplePath->getJsonAmazonSpConfig()
5
+ */
6
+
7
+ var amazonPollInterval = 1500; // poll every ms for keys
8
+ var amazonPollTimer = null;
9
+
10
+ document.observe("dom:loaded", function() {
11
+ if ($("payment_amazon_payments")) {
12
+ var amazonSimplepath = $("amazon_simplepath");
13
+ var amazonInstructions = $("amazon_instructions");
14
+ var amazonFields = $$("#payment_amazon_payments tr");
15
+ var amazonImport = $("row_payment_ap_credentials_simplepath_json");
16
+ var amazonImportButton = $("row_payment_ap_credentials_simplepath_import_button");
17
+ var amazonSpBack = $("amazon_simplepath_back");
18
+
19
+ amazonInstructions.hide();
20
+ amazonFields.each(Element.hide);
21
+ if (amazonImport != null) amazonImport.hide();
22
+
23
+ if ($("payment_ap_credentials_seller_id") == null || $("payment_ap_credentials_seller_id").value) {
24
+ showAmazonConfig();
25
+ }
26
+
27
+ // Generate form to post to Amazon
28
+ var form = new Element('form', { method: 'post', action: AmazonSp.amazonUrl, id: 'simplepath_form', target: 'simplepath'});
29
+ amazonSimplepath.wrap(form);
30
+
31
+ // Convert formParams JSON to hidden inputs
32
+ var formInput;
33
+ for (var key in AmazonSp.formParams) {
34
+ if (typeof AmazonSp.formParams[key] == 'object' || typeof AmazonSp.formParams[key] == 'array') {
35
+ for (var i in AmazonSp.formParams[key]) {
36
+ if (typeof AmazonSp.formParams[key][i] != "function") {
37
+ form.insert(new Element('input', { type: 'hidden', name: key, value: AmazonSp.formParams[key][i]}));
38
+ }
39
+ }
40
+ } else {
41
+ form.insert(new Element('input', { type: 'hidden', name: key, value: AmazonSp.formParams[key]}));
42
+ }
43
+ }
44
+
45
+ // Get Started clicked
46
+ $("simplepath_form").observe("submit", function(e) {
47
+ var heights = [660, 720, 810, 900];
48
+ var popupHeight = heights[0];
49
+ for (var i in heights) {
50
+ popupHeight = (window.innerHeight >= heights[i]) ? heights[i] : popupHeight;
51
+ }
52
+
53
+ window.launchPopup('', 768, popupHeight);
54
+
55
+ amazonFields[1].show();
56
+ amazonImport.show();
57
+ amazonImportButton.hide();
58
+
59
+ if (!amazonPollTimer) {
60
+ amazonPollTimer = setTimeout(pollForKeys, amazonPollInterval);
61
+ }
62
+
63
+ });
64
+
65
+ // User is skipping simplepath
66
+ amazonSimplepath.select("a")[0].observe("click", function(e) {
67
+ e.stop();
68
+ amazonSpBack.show();
69
+ showAmazonConfig();
70
+ });
71
+
72
+ // User clicked 'Back'
73
+ $("amazon_simplepath_back").select("a")[0].observe("click", function(e) {
74
+ e.stop();
75
+ amazonSpBack.hide();
76
+ amazonSimplepath.show();
77
+ amazonInstructions.hide();
78
+
79
+ });
80
+
81
+ // Show clipboard import textbox
82
+ amazonImportButton.select("button")[0].observe("click", function(e) {
83
+ amazonImportButton.hide();
84
+ amazonImport.show();
85
+ });
86
+
87
+ // User clicked import 'Save'
88
+ $("row_payment_ap_credentials_simplepath_json").select("button")[0].observe("click", function(e) {
89
+ e.stop();
90
+ this.className = "disabled";
91
+
92
+ new Ajax.Request(AmazonSp.importUrl, {
93
+ method:'post',
94
+ parameters: { 'json': $("payment_ap_credentials_simplepath_json").value },
95
+ onSuccess: function(transport) {
96
+ location.reload();
97
+ },
98
+ onFailure: function() { }
99
+ });
100
+ });
101
+
102
+ if (!AmazonSp.isSecure) {
103
+ $("amazon_https_required").show();
104
+ }
105
+ if (!AmazonSp.hasOpenssl) {
106
+ $("amazon_openssl_required").show();
107
+ }
108
+
109
+
110
+ if (!AmazonSp.isUsa) {
111
+ showAmazonConfig();
112
+ }
113
+
114
+
115
+
116
+ }
117
+
118
+ function showAmazonConfig() {
119
+ amazonFields.each(Element.show);
120
+ amazonSimplepath.hide();
121
+ amazonImport.hide();
122
+ amazonSpBack.show();
123
+
124
+ if ($("payment_ap_credentials_seller_id") == null || $("payment_ap_credentials_seller_id").value) {
125
+ amazonInstructions.hide();
126
+ } else {
127
+ amazonInstructions.show();
128
+ }
129
+
130
+
131
+ }
132
+
133
+
134
+ function pollForKeys() {
135
+ new Ajax.Request(AmazonSp.pollUrl, {
136
+ method:'get',
137
+ onSuccess: function(transport) {
138
+ if (transport.responseText == '1') {
139
+ $("amazon_reload").show();
140
+ document.location.replace(document.location + "#payment_amazon_payments-head");
141
+ location.reload();
142
+ } else {
143
+ amazonPollTimer = setTimeout(pollForKeys, amazonPollInterval);
144
+ }
145
+
146
+ },
147
+ onFailure: function() { },
148
+ // Disable "Please Wait" modal
149
+ onCreate: function(request) {
150
+ Ajax.Responders.unregister(varienLoaderHandler.handler);
151
+ },
152
+ });
153
+ }
154
+
155
+
156
+
157
+ });
158
+
159
+
160
+
161
+
162
+
163
+ // Amazon Pop-up
164
+ (function () {
165
+ 'use strict';
166
+
167
+ function launchPopup(url, requestedWidth, requestedHeight) {
168
+ var leftOffset = getLeftOffset(requestedWidth),
169
+ topOffset = getTopOffset(requestedHeight),
170
+ newWindow = window.open(url, 'simplepath', 'scrollbars=yes, width=' + requestedWidth + ', height=' + requestedHeight + ', top=' + topOffset + ', left=' + leftOffset);
171
+
172
+ if (window.focus) {
173
+ newWindow.focus();
174
+ }
175
+ }
176
+
177
+ function getLeftOffset(requestedWidth) {
178
+ var dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : screen.left;
179
+
180
+ return ((windowWidth() / 2) - (requestedWidth / 2)) + dualScreenLeft;
181
+ }
182
+
183
+ function getTopOffset(requestedHeight) {
184
+ var dualScreenTop = window.screenTop !== undefined ? window.screenTop : screen.top;
185
+
186
+ return ((windowHeight() / 2) - (requestedHeight / 2)) + dualScreenTop;
187
+ }
188
+
189
+ function windowWidth() {
190
+ if (window.innerWidth) {
191
+ return window.innerWidth;
192
+ } else if (document.documentElement.clientWidth) {
193
+ return document.documentElement.clientWidth;
194
+ } else {
195
+ return screen.width;
196
+ }
197
+ }
198
+
199
+ function windowHeight() {
200
+ if (window.innerHeight) {
201
+ return window.innerHeight;
202
+ } else if (document.documentElement.clientHeight) {
203
+ return document.documentElement.clientHeight;
204
+ } else {
205
+ return screen.height;
206
+ }
207
+ }
208
+
209
+ window.launchPopup = launchPopup;
210
+ })();
211
+
skin/frontend/base/default/amazon_payments/css/styles_checkout.css CHANGED
@@ -41,6 +41,10 @@
41
  height: 250px;
42
  }
43
 
 
 
 
 
44
  #shipping-method-wrapper {
45
  margin-top:2em;
46
  border-top:1px solid #ededed;
@@ -73,6 +77,12 @@
73
 
74
  }
75
 
 
 
 
 
 
 
76
  #checkout-amazon-payments button.btn-checkout span {
77
  color:#4f3310;
78
  background:none;
@@ -95,6 +105,21 @@
95
  z-index:10;
96
  }
97
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
 
99
  /* Forgot an Item */
100
  #review-buttons-container .f-left {
@@ -171,22 +196,3 @@ textarea#sandbox { width:100%;}
171
  border-right:0;
172
  }
173
  }
174
-
175
- /*
176
- @media all and (max-width: 900px) {
177
- #col-1-amz {
178
- width:49%;
179
- }
180
- #col-2-amz {
181
- width:50%;
182
- margin-right:0;
183
- }
184
- #col-3-amz {
185
- float:none;
186
- width:auto;
187
- margin-right:0;
188
- }
189
- }
190
- */
191
-
192
-
41
  height: 250px;
42
  }
43
 
44
+ .amazon-widget-wrapper {
45
+ position:relative;
46
+ }
47
+
48
  #shipping-method-wrapper {
49
  margin-top:2em;
50
  border-top:1px solid #ededed;
77
 
78
  }
79
 
80
+ #checkout-amazon-payments .button.btn-checkout[disabled] {
81
+ color:#999;
82
+ cursor: default;
83
+ opacity:0.5;
84
+ }
85
+
86
  #checkout-amazon-payments button.btn-checkout span {
87
  color:#4f3310;
88
  background:none;
105
  z-index:10;
106
  }
107
 
108
+ .amz-widget-loader {
109
+ position:absolute;
110
+ height:100%;
111
+ width:100%;
112
+ padding:5px;
113
+ background:url(https://images-na.ssl-images-amazon.com/images/G/01/ep/loading-large.gif) center center no-repeat;
114
+ z-index:13;
115
+ }
116
+
117
+ #shipping-method-disable {
118
+ position:absolute;
119
+ height:100%;
120
+ width:100%;
121
+ z-index:12;
122
+ }
123
 
124
  /* Forgot an Item */
125
  #review-buttons-container .f-left {
196
  border-right:0;
197
  }
198
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
skin/frontend/base/default/amazon_payments/css/styles_onepage.css CHANGED
@@ -32,6 +32,10 @@
32
  z-index:50;
33
  }
34
 
 
 
 
 
35
  @media all and (max-width: 640px) {
36
  #amazon-widget-address-wrapper,
37
  #amazon-widget-wallet-wrapper {
32
  z-index:50;
33
  }
34
 
35
+ #additional-form-fields {
36
+ clear:both;
37
+ }
38
+
39
  @media all and (max-width: 640px) {
40
  #amazon-widget-address-wrapper,
41
  #amazon-widget-wallet-wrapper {