Gene_Braintree - Version 2.1.0

Version Notes

Connect your Magento store to Braintree to accept Credit Cards & PayPal using V.Zero SDK

Download this release

Release Info

Developer Dave Macaulay
Extension Gene_Braintree
Version 2.1.0
Comparing to
See all releases


Code changes from version 2.0.4 to 2.1.0

Files changed (53) hide show
  1. app/code/community/Gene/Braintree/Block/Express/Button.php +16 -67
  2. app/code/community/Gene/Braintree/Block/Express/Setup.php +139 -0
  3. app/code/community/Gene/Braintree/Model/Observer.php +13 -2
  4. app/code/community/Gene/Braintree/Model/Paymentmethod/Creditcard.php +1 -1
  5. app/code/community/Gene/Braintree/Model/Wrapper/Braintree.php +8 -0
  6. app/code/community/Gene/Braintree/controllers/ExpressController.php +14 -9
  7. app/code/community/Gene/Braintree/etc/config.xml +1 -1
  8. app/code/community/Gene/Braintree/etc/system.xml +1 -1
  9. app/code/community/Gene/Braintree/sql/gene_braintree_setup/upgrade-2.0.4-2.1.0.php +58 -0
  10. app/design/adminhtml/default/default/layout/gene/braintree.xml +10 -2
  11. app/design/adminhtml/default/default/template/gene/braintree/js.phtml +0 -3
  12. app/design/frontend/base/default/layout/gene/braintree.xml +25 -6
  13. app/design/frontend/base/default/template/gene/braintree/creditcard/hostedfields.phtml +0 -3
  14. app/design/frontend/base/default/template/gene/braintree/express/button.phtml +1 -0
  15. app/design/frontend/base/default/template/gene/braintree/express/cart.phtml +24 -48
  16. app/design/frontend/base/default/template/gene/braintree/express/catalog.phtml +26 -31
  17. app/design/frontend/base/default/template/gene/braintree/js/awesomecheckout.phtml +1 -1
  18. app/design/frontend/base/default/template/gene/braintree/js/default.phtml +26 -52
  19. app/design/frontend/base/default/template/gene/braintree/js/idev.phtml +4 -3
  20. app/design/frontend/base/default/template/gene/braintree/js/setup.phtml +21 -15
  21. js/gene/braintree/braintree-0.1.js +0 -7
  22. js/gene/braintree/config.codekit +93 -16
  23. js/gene/braintree/express.js +21 -61
  24. js/gene/braintree/express/abstract-min.js +1 -0
  25. js/gene/braintree/express/paypal-min.js +1 -0
  26. js/gene/braintree/source/express/abstract.js +365 -0
  27. js/gene/braintree/source/express/paypal.js +49 -0
  28. js/gene/braintree/source/vzero-integration.js +798 -0
  29. js/gene/braintree/source/vzero-paypal.js +261 -0
  30. js/gene/braintree/source/vzero.js +1139 -0
  31. js/gene/braintree/vzero-0.7-min.js +0 -1
  32. js/gene/braintree/vzero-0.7-min.js.map +0 -1
  33. js/gene/braintree/vzero-0.7.js +0 -2293
  34. js/gene/braintree/vzero-integration-min.js +1 -0
  35. js/gene/braintree/vzero-min.js +1 -0
  36. js/gene/braintree/vzero-paypal-min.js +1 -0
  37. package.xml +4 -4
  38. skin/frontend/base/default/css/gene/braintree/aheadworks.css +53 -0
  39. skin/frontend/base/default/css/gene/braintree/amasty.css +53 -0
  40. skin/frontend/base/default/css/gene/braintree/awesomecheckout.css +53 -0
  41. skin/frontend/base/default/css/gene/braintree/core/_hostedfields.less +61 -0
  42. skin/frontend/base/default/css/gene/braintree/core/_paypal.less +1 -0
  43. skin/frontend/base/default/css/gene/braintree/default.css +53 -0
  44. skin/frontend/base/default/css/gene/braintree/express.css +12 -0
  45. skin/frontend/base/default/css/gene/braintree/express.less +20 -0
  46. skin/frontend/base/default/css/gene/braintree/fancycheckout.css +53 -0
  47. skin/frontend/base/default/css/gene/braintree/firecheckout.css +53 -0
  48. skin/frontend/base/default/css/gene/braintree/fme.css +53 -0
  49. skin/frontend/base/default/css/gene/braintree/idev.css +53 -0
  50. skin/frontend/base/default/css/gene/braintree/iwd.css +53 -0
  51. skin/frontend/base/default/css/gene/braintree/magestore.css +53 -0
  52. skin/frontend/base/default/css/gene/braintree/oye.css +53 -0
  53. skin/frontend/base/default/css/gene/braintree/unicode.css +53 -0
app/code/community/Gene/Braintree/Block/Express/Button.php CHANGED
@@ -3,34 +3,16 @@
3
  /**
4
  * Class Gene_Braintree_Block_Express_Button
5
  *
6
- * @author Aidan Threadgold <aidan@gene.co.uk>
7
  */
8
  class Gene_Braintree_Block_Express_Button extends Mage_Core_Block_Template
9
  {
10
- /**
11
- * Braintree token
12
- *
13
- * @var string
14
- */
15
- protected $_token = null;
16
-
17
  /**
18
  * Generate braintree token
19
  */
20
  protected function _construct()
21
  {
22
  parent::_construct();
23
- $this->_token = Mage::getModel('gene_braintree/wrapper_braintree')->init()->generateToken();
24
- }
25
-
26
- /**
27
- * Get braintree token
28
- *
29
- * @return string
30
- */
31
- public function getToken()
32
- {
33
- return $this->_token;
34
  }
35
 
36
  /**
@@ -40,70 +22,37 @@ class Gene_Braintree_Block_Express_Button extends Mage_Core_Block_Template
40
  */
41
  public function isEnabled()
42
  {
43
- if (Mage::getStoreConfig('payment/gene_braintree_paypal/express_active')) {
 
 
44
  return true;
45
  }
46
 
47
  return false;
48
  }
49
 
 
 
 
 
 
50
  public function isEnabledPdp()
51
  {
52
- if (Mage::getStoreConfig('payment/gene_braintree_paypal/express_pdp')) {
53
- return true;
54
- }
55
-
56
- return false;
57
- }
58
-
59
- public function isEnabledCart()
60
- {
61
- if (Mage::getStoreConfig('payment/gene_braintree_paypal/express_cart')) {
62
  return true;
63
  }
64
 
65
  return false;
66
  }
67
 
68
-
69
- /**
70
- * Get store currency code.
71
- *
72
- * @return string
73
- */
74
- public function getStoreCurrency()
75
- {
76
- return Mage::app()->getStore()->getCurrentCurrencyCode();
77
- }
78
-
79
- /**
80
- * Get the store locale.
81
- *
82
- * @return string
83
- */
84
- public function getStoreLocale()
85
- {
86
- return Mage::app()->getLocale()->getLocaleCode();;
87
- }
88
-
89
  /**
90
- * Get the current product
91
- *
92
- * @return mixed
93
- */
94
- public function getProduct()
95
- {
96
- return Mage::registry('current_product');
97
- }
98
-
99
- /**
100
- * Registry entry to determine if block has been instantiated yet
101
  *
102
  * @return bool
103
  */
104
- public function hasBeenSetup()
105
  {
106
- if (Mage::registry('gene_braintree_btn_loaded')) {
107
  return true;
108
  }
109
 
@@ -119,10 +68,10 @@ class Gene_Braintree_Block_Express_Button extends Mage_Core_Block_Template
119
  */
120
  public function _afterToHtml($html)
121
  {
122
- if (!$this->hasBeenSetup()) {
123
- Mage::register('gene_braintree_btn_loaded', true);
124
  }
125
 
126
- return $html;
127
  }
128
  }
3
  /**
4
  * Class Gene_Braintree_Block_Express_Button
5
  *
6
+ * @author Dave Macaulay <dave@gene.co.uk>
7
  */
8
  class Gene_Braintree_Block_Express_Button extends Mage_Core_Block_Template
9
  {
 
 
 
 
 
 
 
10
  /**
11
  * Generate braintree token
12
  */
13
  protected function _construct()
14
  {
15
  parent::_construct();
 
 
 
 
 
 
 
 
 
 
 
16
  }
17
 
18
  /**
22
  */
23
  public function isEnabled()
24
  {
25
+ if (Mage::getStoreConfig('payment/gene_braintree_paypal/active')
26
+ && Mage::getStoreConfig('payment/gene_braintree_paypal/express_active')
27
+ ) {
28
  return true;
29
  }
30
 
31
  return false;
32
  }
33
 
34
+ /**
35
+ * Is express enabled on the product page?
36
+ *
37
+ * @return bool
38
+ */
39
  public function isEnabledPdp()
40
  {
41
+ if ($this->isEnabled() && Mage::getStoreConfig('payment/gene_braintree_paypal/express_pdp')) {
 
 
 
 
 
 
 
 
 
42
  return true;
43
  }
44
 
45
  return false;
46
  }
47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  /**
49
+ * Is express enabled in the cart?
 
 
 
 
 
 
 
 
 
 
50
  *
51
  * @return bool
52
  */
53
+ public function isEnabledCart()
54
  {
55
+ if ($this->isEnabled() && Mage::getStoreConfig('payment/gene_braintree_paypal/express_cart')) {
56
  return true;
57
  }
58
 
68
  */
69
  public function _afterToHtml($html)
70
  {
71
+ if ($this->isEnabled()) {
72
+ return $html;
73
  }
74
 
75
+ return '';
76
  }
77
  }
app/code/community/Gene/Braintree/Block/Express/Setup.php ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class Gene_Braintree_Block_Express_Button
5
+ *
6
+ * @author Aidan Threadgold <aidan@gene.co.uk>
7
+ */
8
+ class Gene_Braintree_Block_Express_Setup extends Mage_Core_Block_Template
9
+ {
10
+ /**
11
+ * Braintree token
12
+ *
13
+ * @var string
14
+ */
15
+ protected $_token = null;
16
+
17
+ /**
18
+ * Generate braintree token
19
+ */
20
+ protected function _construct()
21
+ {
22
+ parent::_construct();
23
+ $this->_token = Mage::getModel('gene_braintree/wrapper_braintree')->init()->generateToken();
24
+ }
25
+
26
+ /**
27
+ * Get braintree token
28
+ *
29
+ * @return string
30
+ */
31
+ public function getToken()
32
+ {
33
+ return $this->_token;
34
+ }
35
+
36
+ /**
37
+ * Is the express mode enabled
38
+ *
39
+ * @return bool
40
+ */
41
+ public function isEnabled()
42
+ {
43
+ if (Mage::getStoreConfig('payment/gene_braintree_paypal/active')
44
+ && Mage::getStoreConfig('payment/gene_braintree_paypal/express_active')
45
+ ) {
46
+ return true;
47
+ }
48
+
49
+ return false;
50
+ }
51
+
52
+ /**
53
+ * Is express enabled on the product page?
54
+ *
55
+ * @return bool
56
+ */
57
+ public function isEnabledPdp()
58
+ {
59
+ if ($this->isEnabled() && Mage::getStoreConfig('payment/gene_braintree_paypal/express_pdp')) {
60
+ return true;
61
+ }
62
+
63
+ return false;
64
+ }
65
+
66
+ /**
67
+ * Is express enabled in the cart?
68
+ *
69
+ * @return bool
70
+ */
71
+ public function isEnabledCart()
72
+ {
73
+ if ($this->isEnabled() && Mage::getStoreConfig('payment/gene_braintree_paypal/express_cart')) {
74
+ return true;
75
+ }
76
+
77
+ return false;
78
+ }
79
+
80
+ /**
81
+ * Get store currency code.
82
+ *
83
+ * @return string
84
+ */
85
+ public function getStoreCurrency()
86
+ {
87
+ return Mage::app()->getStore()->getCurrentCurrencyCode();
88
+ }
89
+
90
+ /**
91
+ * Get the store locale.
92
+ *
93
+ * @return string
94
+ */
95
+ public function getStoreLocale()
96
+ {
97
+ return Mage::app()->getLocale()->getLocaleCode();;
98
+ }
99
+
100
+ /**
101
+ * Get the current product
102
+ *
103
+ * @return mixed
104
+ */
105
+ public function getProduct()
106
+ {
107
+ return Mage::registry('current_product');
108
+ }
109
+
110
+ /**
111
+ * Registry entry to determine if block has been instantiated yet
112
+ *
113
+ * @return bool
114
+ */
115
+ public function hasBeenSetup()
116
+ {
117
+ if (Mage::registry('gene_braintree_btn_loaded')) {
118
+ return true;
119
+ }
120
+
121
+ return false;
122
+ }
123
+
124
+ /**
125
+ * Registry entry to mark this block as instantiated
126
+ *
127
+ * @param string $html
128
+ *
129
+ * @return string
130
+ */
131
+ public function _afterToHtml($html)
132
+ {
133
+ if (!$this->hasBeenSetup()) {
134
+ Mage::register('gene_braintree_btn_loaded', true);
135
+ }
136
+
137
+ return $html;
138
+ }
139
+ }
app/code/community/Gene/Braintree/Model/Observer.php CHANGED
@@ -252,8 +252,19 @@ class Gene_Braintree_Model_Observer
252
  */
253
  public function addIncludePath()
254
  {
255
- set_include_path(BP . DS . 'lib' . DS . 'Gene' . PS . get_include_path());
256
 
257
  return $this;
258
  }
259
- }
 
 
 
 
 
 
 
 
 
 
 
252
  */
253
  public function addIncludePath()
254
  {
255
+ self::initIncludePath();
256
 
257
  return $this;
258
  }
259
+
260
+ /**
261
+ * Add the include path needed for the new location of the SDK
262
+ */
263
+ public static function initIncludePath()
264
+ {
265
+ // Check to see if the system can resolve the Braintree_Version class
266
+ if (!stream_resolve_include_path('Braintree/Version.php')) {
267
+ set_include_path(BP . DS . 'lib' . DS . 'Gene' . PS . get_include_path());
268
+ }
269
+ }
270
+ }
app/code/community/Gene/Braintree/Model/Paymentmethod/Creditcard.php CHANGED
@@ -480,7 +480,7 @@ class Gene_Braintree_Model_Paymentmethod_Creditcard extends Gene_Braintree_Model
480
  $this->handleFraud($result, $payment);
481
 
482
  // If 3D secure is enabled, presume it's passed
483
- if ($this->_is3DEnabled()) {
484
  $additionalInfo['threeDSecure'] = Mage::helper('gene_braintree')->__('Passed');
485
  }
486
 
480
  $this->handleFraud($result, $payment);
481
 
482
  // If 3D secure is enabled, presume it's passed
483
+ if ($this->_is3DEnabled() && $result->transaction->threeDSecureInfo->liabilityShifted == 1) {
484
  $additionalInfo['threeDSecure'] = Mage::helper('gene_braintree')->__('Passed');
485
  }
486
 
app/code/community/Gene/Braintree/Model/Wrapper/Braintree.php CHANGED
@@ -55,6 +55,14 @@ class Gene_Braintree_Model_Wrapper_Braintree extends Mage_Core_Model_Abstract
55
  */
56
  protected $init = false;
57
 
 
 
 
 
 
 
 
 
58
  /**
59
  * Setup the environment
60
  *
55
  */
56
  protected $init = false;
57
 
58
+ /**
59
+ * Ensure our include path is included correctly
60
+ */
61
+ protected function _construct()
62
+ {
63
+ Gene_Braintree_Model_Observer::initIncludePath();
64
+ }
65
+
66
  /**
67
  * Setup the environment
68
  *
app/code/community/Gene/Braintree/controllers/ExpressController.php CHANGED
@@ -67,8 +67,14 @@ class Gene_Braintree_ExpressController extends Mage_Core_Controller_Front_Action
67
  {
68
  parse_str($this->getRequest()->getParam('form_data'), $formData);
69
 
 
 
 
 
 
 
70
  // Validate form key
71
- if (Mage::getSingleton('core/session')->getFormKey() != $formData['form_key']) {
72
  Mage::getSingleton('core/session')->addError(Mage::helper('gene_braintree')->__('We were unable to start the express checkout.'));
73
 
74
  return $this->_redirect("braintree/express/error");
@@ -79,10 +85,9 @@ class Gene_Braintree_ExpressController extends Mage_Core_Controller_Front_Action
79
  Mage::getSingleton('core/session')->setBraintreeNonce(null);
80
 
81
  // Where the user came from - product or cart page
82
- if (!isset($formData['source'])) {
83
- $formData['source'] = "product";
84
- }
85
- Mage::getSingleton('core/session')->setBraintreeExpressSource($formData['source']);
86
 
87
  $paypal = json_decode($this->getRequest()->getParam('paypal'), true);
88
  // Check for a valid nonce
@@ -139,15 +144,15 @@ class Gene_Braintree_ExpressController extends Mage_Core_Controller_Front_Action
139
  $address = Mage::getModel('sales/quote_address');
140
  $address->setFirstname($firstName)
141
  ->setLastname($lastName)
142
- ->setStreet($paypalData['shippingAddress']['extendedAddress'] . ' ' . $paypalData['shippingAddress']['streetAddress'])
143
- ->setCity($paypalData['shippingAddress']['locality'])
144
- ->setCountryId($paypalData['shippingAddress']['countryCodeAlpha2'])
145
  ->setPostcode($paypalData['shippingAddress']['postalCode'])
146
  ->setTelephone('0000000000');
147
 
148
  // Check if the region is needed
149
  if (Mage::helper('directory')->isRegionRequired($address->getCountryId())) {
150
- $region = Mage::getModel('directory/region')->loadbyCode($paypalData['shippingAddress']['region'], $address->getCountryId());
151
  $regionId = $region->getRegionId();
152
 
153
  if (empty($regionId)) {
67
  {
68
  parse_str($this->getRequest()->getParam('form_data'), $formData);
69
 
70
+ // Retrieve the form_key from the request
71
+ $formKey = $this->getRequest()->getParam(
72
+ 'form_key',
73
+ (isset($formData['form_key']) ? $formData['form_key'] : false)
74
+ );
75
+
76
  // Validate form key
77
+ if (Mage::getSingleton('core/session')->getFormKey() != $formKey) {
78
  Mage::getSingleton('core/session')->addError(Mage::helper('gene_braintree')->__('We were unable to start the express checkout.'));
79
 
80
  return $this->_redirect("braintree/express/error");
85
  Mage::getSingleton('core/session')->setBraintreeNonce(null);
86
 
87
  // Where the user came from - product or cart page
88
+ Mage::getSingleton('core/session')->setBraintreeExpressSource(
89
+ $this->getRequest()->getParam('source', 'product')
90
+ );
 
91
 
92
  $paypal = json_decode($this->getRequest()->getParam('paypal'), true);
93
  // Check for a valid nonce
144
  $address = Mage::getModel('sales/quote_address');
145
  $address->setFirstname($firstName)
146
  ->setLastname($lastName)
147
+ ->setStreet($paypalData['shippingAddress']['line1'] . ' ' . $paypalData['shippingAddress']['line2'])
148
+ ->setCity($paypalData['shippingAddress']['city'])
149
+ ->setCountryId($paypalData['shippingAddress']['countryCode'])
150
  ->setPostcode($paypalData['shippingAddress']['postalCode'])
151
  ->setTelephone('0000000000');
152
 
153
  // Check if the region is needed
154
  if (Mage::helper('directory')->isRegionRequired($address->getCountryId())) {
155
+ $region = Mage::getModel('directory/region')->loadbyCode($paypalData['shippingAddress']['state'], $address->getCountryId());
156
  $regionId = $region->getRegionId();
157
 
158
  if (empty($regionId)) {
app/code/community/Gene/Braintree/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Gene_Braintree>
5
- <version>2.0.4</version>
6
  </Gene_Braintree>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <Gene_Braintree>
5
+ <version>2.1.0</version>
6
  </Gene_Braintree>
7
  </modules>
8
  <global>
app/code/community/Gene/Braintree/etc/system.xml CHANGED
@@ -621,7 +621,7 @@
621
  <show_in_website>1</show_in_website>
622
  <show_in_store>1</show_in_store>
623
  <comment><![CDATA[
624
- The 3D Secure feature enables the shopper to enter a password to confirm their identity with the card issuer. If accepted they then complete their order, and when received by you, you have much more confidence that is genuine and real.
625
  ]]></comment>
626
  </threedsecure>
627
 
621
  <show_in_website>1</show_in_website>
622
  <show_in_store>1</show_in_store>
623
  <comment><![CDATA[
624
+ The 3D Secure feature enables the shopper to enter a password to confirm their identity with the card issuer. If accepted they then complete their order, and when received by you, you have much more confidence that is genuine and real.<br /><strong>Notice:</strong> To use 3D secure your checkout must run over HTTPs, this is required for both production and sandbox configurations.
625
  ]]></comment>
626
  </threedsecure>
627
 
app/code/community/Gene/Braintree/sql/gene_braintree_setup/upgrade-2.0.4-2.1.0.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /* @var $installer Gene_Braintree_Model_Entity_Setup */
4
+ $installer = $this;
5
+ $installer->startSetup();
6
+
7
+ // Update the white list for AnattaDesign Awesome Checkout
8
+ if (Mage::helper('core')->isModuleEnabled('AnattaDesign_AwesomeCheckout')) {
9
+ $whiteListConfigXmlPath = 'awesomecheckout/advanced/whitelisted_css_js';
10
+ $whiteList = array(
11
+ 'gene/braintree/vzero-min.js',
12
+ 'gene/braintree/vzero-paypal-min.js',
13
+ 'gene/braintree/vzero-integration-min.js',
14
+ 'css/gene/braintree/awesomecheckout.css'
15
+ );
16
+
17
+ // Update values on the default scope
18
+ if ($currentWhiteList = $this->getStoreConfig($whiteListConfigXmlPath)) {
19
+ $currentWhiteListArray = explode("\n", $currentWhiteList);
20
+ if (is_array($currentWhiteListArray) && count($currentWhiteListArray) > 0) {
21
+ $whiteList = array_merge($currentWhiteListArray, $whiteList);
22
+ }
23
+ }
24
+
25
+ // Save the new default config values
26
+ Mage::getConfig()->saveConfig(
27
+ $whiteListConfigXmlPath,
28
+ implode("\n", $whiteList),
29
+ 'default',
30
+ 0
31
+ );
32
+
33
+ // Loop through the stores and ensure they're all up to date
34
+ $stores = Mage::getModel('core/store')->getCollection();
35
+ foreach ($stores as $store) {
36
+
37
+ // Update values on the default scope
38
+ if ($currentWhiteList = $this->getStoreConfig($whiteListConfigXmlPath, $store)) {
39
+ $currentWhiteListArray = explode("\n", $currentWhiteList);
40
+ if (is_array($currentWhiteListArray) && count($currentWhiteListArray) > 0) {
41
+ $whiteList = array_merge($currentWhiteListArray, $whiteList);
42
+ }
43
+ }
44
+
45
+ // Save the new default config values
46
+ Mage::getConfig()->saveConfig(
47
+ $whiteListConfigXmlPath,
48
+ implode("\n", $whiteList),
49
+ 'stores',
50
+ $store->getId()
51
+ );
52
+ }
53
+
54
+ // Clean the cache
55
+ Mage::getConfig()->cleanCache();
56
+ }
57
+
58
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/gene/braintree.xml CHANGED
@@ -17,14 +17,22 @@
17
  <adminhtml_sales_order_create_index>
18
  <reference name="head">
19
  <action method="addCss"><file>css/gene/braintree/adminhtml.css</file></action>
20
- <action method="addJs"><file>gene/braintree/vzero-0.7-min.js</file></action>
 
 
21
 
22
  <!-- If Braintree_Payments is enabled remove the JS -->
23
  <action method="removeItem"><type>js</type><name>braintree/braintree-1.3.4.js</name></action>
24
  </reference>
25
  <reference name="js">
26
  <block type="core/text" name="braintree-js">
27
- <action method="setText"><text><![CDATA[<script src="https://js.braintreegateway.com/js/braintree-2.26.0.min.js"></script>]]></text></action>
 
 
 
 
 
 
28
  </block>
29
  </reference>
30
  <reference name="before_body_end">
17
  <adminhtml_sales_order_create_index>
18
  <reference name="head">
19
  <action method="addCss"><file>css/gene/braintree/adminhtml.css</file></action>
20
+ <action method="addJs"><file>gene/braintree/vzero-min.js</file></action>
21
+ <action method="addJs"><file>gene/braintree/vzero-paypal-min.js</file></action>
22
+ <action method="addJs"><file>gene/braintree/vzero-integration-min.js</file></action>
23
 
24
  <!-- If Braintree_Payments is enabled remove the JS -->
25
  <action method="removeItem"><type>js</type><name>braintree/braintree-1.3.4.js</name></action>
26
  </reference>
27
  <reference name="js">
28
  <block type="core/text" name="braintree-js">
29
+ <action method="setText"><text><![CDATA[
30
+ <script src="https://js.braintreegateway.com/web/3.5.0/js/client.min.js"></script>
31
+ <script src="https://js.braintreegateway.com/web/3.5.0/js/hosted-fields.min.js"></script>
32
+ <script src="https://js.braintreegateway.com/web/3.5.0/js/three-d-secure.min.js"></script>
33
+ <script src="https://js.braintreegateway.com/web/3.5.0/js/paypal.min.js"></script>
34
+ <script src="https://js.braintreegateway.com/web/3.5.0/js/data-collector.min.js"></script>
35
+ ]]></text></action>
36
  </block>
37
  </reference>
38
  <reference name="before_body_end">
app/design/adminhtml/default/default/template/gene/braintree/js.phtml CHANGED
@@ -10,9 +10,6 @@
10
  ['order-billing_address_postcode']
11
  );
12
 
13
- // Init the environment
14
- vzero.init();
15
-
16
  vZero.addMethods({
17
  /**
18
  * Update data has no value in the admin
10
  ['order-billing_address_postcode']
11
  );
12
 
 
 
 
13
  vZero.addMethods({
14
  /**
15
  * Update data has no value in the admin
app/design/frontend/base/default/layout/gene/braintree.xml CHANGED
@@ -5,9 +5,17 @@
5
  <gene_braintree_assets>
6
  <reference name="head">
7
  <block type="core/text" name="braintree-js">
8
- <action method="setText"><text><![CDATA[<script src="https://js.braintreegateway.com/js/braintree-2.26.0.min.js"></script>]]></text></action>
 
 
 
 
 
 
9
  </block>
10
- <action method="addJs"><file>gene/braintree/vzero-0.7-min.js</file></action>
 
 
11
  <!-- If Braintree_Payments is enabled remove their JS -->
12
  <action method="removeItem"><type>js</type><name>braintree/braintree-1.3.4.js</name></action>
13
  </reference>
@@ -333,12 +341,16 @@
333
  <catalog_product_view>
334
  <update handle="gene_braintree_assets" />
335
  <reference name="head">
336
- <action method="addJs"><file>gene/braintree/express.js</file></action>
 
337
  <action method="addCss"><file>css/gene/braintree/default.css</file></action>
338
  <action method="addCss"><file>css/gene/braintree/express.css</file></action>
339
  </reference>
340
  <reference name="before_body_end">
341
- <block type="gene_braintree/express_button" name="gene_braintree_express_catalog_button" template="gene/braintree/express/catalog.phtml" />
 
 
 
342
  </reference>
343
  </catalog_product_view>
344
 
@@ -346,12 +358,19 @@
346
  <checkout_cart_index>
347
  <update handle="gene_braintree_assets" />
348
  <reference name="head">
349
- <action method="addJs"><file>gene/braintree/express.js</file></action>
 
350
  <action method="addCss"><file>css/gene/braintree/default.css</file></action>
351
  <action method="addCss"><file>css/gene/braintree/express.css</file></action>
352
  </reference>
353
  <reference name="before_body_end">
354
- <block type="gene_braintree/express_button" name="gene_braintree_express_cart_button" template="gene/braintree/express/cart.phtml" />
 
 
 
 
 
 
355
  </reference>
356
  </checkout_cart_index>
357
 
5
  <gene_braintree_assets>
6
  <reference name="head">
7
  <block type="core/text" name="braintree-js">
8
+ <action method="setText"><text><![CDATA[
9
+ <script src="https://js.braintreegateway.com/web/3.5.0/js/client.min.js"></script>
10
+ <script src="https://js.braintreegateway.com/web/3.5.0/js/hosted-fields.min.js"></script>
11
+ <script src="https://js.braintreegateway.com/web/3.5.0/js/three-d-secure.min.js"></script>
12
+ <script src="https://js.braintreegateway.com/web/3.5.0/js/paypal.min.js"></script>
13
+ <script src="https://js.braintreegateway.com/web/3.5.0/js/data-collector.min.js"></script>
14
+ ]]></text></action>
15
  </block>
16
+ <action method="addJs"><file>gene/braintree/vzero-min.js</file></action>
17
+ <action method="addJs"><file>gene/braintree/vzero-paypal-min.js</file></action>
18
+ <action method="addJs"><file>gene/braintree/vzero-integration-min.js</file></action>
19
  <!-- If Braintree_Payments is enabled remove their JS -->
20
  <action method="removeItem"><type>js</type><name>braintree/braintree-1.3.4.js</name></action>
21
  </reference>
341
  <catalog_product_view>
342
  <update handle="gene_braintree_assets" />
343
  <reference name="head">
344
+ <action method="addJs"><file>gene/braintree/express/abstract-min.js</file></action>
345
+ <action method="addJs"><file>gene/braintree/express/paypal-min.js</file></action>
346
  <action method="addCss"><file>css/gene/braintree/default.css</file></action>
347
  <action method="addCss"><file>css/gene/braintree/express.css</file></action>
348
  </reference>
349
  <reference name="before_body_end">
350
+ <block type="gene_braintree/express_setup" name="gene_braintree_express_catalog_button" template="gene/braintree/express/catalog.phtml" />
351
+ </reference>
352
+ <reference name="product.info.addtocart">
353
+ <block type="gene_braintree/express_button" name="product.info.extrabuttons.paypal.express" template="gene/braintree/express/button.phtml" after="-" />
354
  </reference>
355
  </catalog_product_view>
356
 
358
  <checkout_cart_index>
359
  <update handle="gene_braintree_assets" />
360
  <reference name="head">
361
+ <action method="addJs"><file>gene/braintree/express/abstract-min.js</file></action>
362
+ <action method="addJs"><file>gene/braintree/express/paypal-min.js</file></action>
363
  <action method="addCss"><file>css/gene/braintree/default.css</file></action>
364
  <action method="addCss"><file>css/gene/braintree/express.css</file></action>
365
  </reference>
366
  <reference name="before_body_end">
367
+ <block type="gene_braintree/express_setup" name="gene_braintree_express_cart_button" template="gene/braintree/express/cart.phtml" />
368
+ </reference>
369
+ <reference name="checkout.cart.top_methods">
370
+ <block type="gene_braintree/express_button" name="checkout.cart.methods.onepage.top.paypal.express" template="gene/braintree/express/button.phtml" after="-" />
371
+ </reference>
372
+ <reference name="checkout.cart.methods">
373
+ <block type="gene_braintree/express_button" name="checkout.cart.methods.onepage.top.paypal.express" template="gene/braintree/express/button.phtml" after="checkout.cart.methods.onepage.bottom" />
374
  </reference>
375
  </checkout_cart_index>
376
 
app/design/frontend/base/default/template/gene/braintree/creditcard/hostedfields.phtml CHANGED
@@ -68,10 +68,7 @@ $_code = $this->getMethodCode()
68
  </ul>
69
  </div>
70
 
71
- <?php /* Do not remove or modify this code, the div is hidden and used to fire the hosted fields tokenization */ ?>
72
  <div id="braintree-hosted-submit">
73
- <button type="submit" data-blockCapture="true"></button>
74
-
75
  <!-- Fields for the payment method -->
76
  <input type="text" name="payment[payment_method_nonce]" value="" id="creditcard-payment-nonce" class="validate-fire-hosted" />
77
  </div>
68
  </ul>
69
  </div>
70
 
 
71
  <div id="braintree-hosted-submit">
 
 
72
  <!-- Fields for the payment method -->
73
  <input type="text" name="payment[payment_method_nonce]" value="" id="creditcard-payment-nonce" class="validate-fire-hosted" />
74
  </div>
app/design/frontend/base/default/template/gene/braintree/express/button.phtml ADDED
@@ -0,0 +1 @@
 
1
+ <button class="button pp-express-buy-btn braintree-paypal-loading" disabled="disabled" data-paypalexpress="true"><?php echo $this->__('Checkout with PayPal'); ?></button>
app/design/frontend/base/default/template/gene/braintree/express/cart.phtml CHANGED
@@ -1,24 +1,4 @@
1
- <?php
2
- /*
3
- * @var Gene_Braintree_Block_Express_Button $this
4
- */
5
- ?>
6
-
7
-
8
- <?php if( !$this->isEnabled() || !$this->isEnabledCart() ) return; ?>
9
-
10
- <?php /* Check if this block has already been setup, so we don't have multuple divs */
11
- if( !$this->hasBeenSetup() ): ?>
12
- <div id="pp-express-overlay"></div>
13
- <div id="pp-express-modal"></div>
14
- <div id="pp-express-container"></div>
15
-
16
- <!-- Form to pass formkey over to controllers -->
17
- <form id="pp_express_form">
18
- <input type="hidden" name="source" value="cart" />
19
- <?php echo $this->getBlockHtml('formkey') ?>
20
- </form>
21
- <?php endif; ?>
22
 
23
  <script type="text/javascript">
24
  if (typeof Translator !== 'object' && typeof Translate == 'object') {
@@ -32,32 +12,28 @@ if( !$this->hasBeenSetup() ): ?>
32
  })
33
  }
34
 
35
- Event.observe(window, 'load', function() {
36
- if (typeof ppExpress === 'object') {
37
- ppExpress.addBtn({
38
- token: '<?php echo $this->getToken(); ?>',
39
- currency: '<?php echo $this->getStoreCurrency(); ?>',
40
- priceFormat: <?php echo Mage::helper('core')->jsonEncode(Mage::app()->getLocale()->getJsPriceFormat()); ?>,
41
- locale: '<?php echo strtolower($this->getStoreLocale()); ?>',
42
- authUrl: '<?php echo $this->getUrl('braintree/express/authorization') ?>',
43
- shippingSaveUrl:'<?php echo $this->getUrl('braintree/express/saveShipping') ?>',
44
- couponSaveUrl: '<?php echo $this->getUrl('braintree/express/saveCoupon') ?>',
45
- successUrl: '<?php echo $this->getUrl("checkout/onepage/success"); ?>',
46
- buyButtonPlacement: function() {
47
- var placement = document.getElementsByClassName("checkout-types");
48
- if (placement.length <= 0) {
49
- return false;
50
- }
51
-
52
- for(var i=0; i < placement.length; i++) {
53
- if( placement[i].classList.contains("top") ) {
54
- return placement[i];
55
- }
56
- }
57
-
58
- return false;
59
  }
60
- });
61
- }
62
- });
 
 
 
 
63
  </script>
1
+ <?php if (!$this->isEnabled() || !$this->isEnabledCart()) return; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  <script type="text/javascript">
4
  if (typeof Translator !== 'object' && typeof Translate == 'object') {
12
  })
13
  }
14
 
15
+ (function () {
16
+ document.observe("dom:loaded", function() {
17
+ var express = new BraintreePayPalExpress(
18
+ '<?php echo $this->getToken(); ?>',
19
+ '<?php echo Mage::app()->getStore()->getFrontendName(); ?>',
20
+ '<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>',
21
+ 'cart',
22
+ {
23
+ authUrl: '<?php echo $this->getUrl('braintree/express/authorization') ?>',
24
+ shippingSaveUrl:'<?php echo $this->getUrl('braintree/express/saveShipping') ?>',
25
+ couponSaveUrl: '<?php echo $this->getUrl('braintree/express/saveCoupon') ?>',
26
+ successUrl: '<?php echo $this->getUrl("checkout/onepage/success"); ?>',
27
+ },
28
+ {
29
+ locale: '<?php echo strtolower($this->getStoreLocale()); ?>',
30
+ token: '<?php echo $this->getToken(); ?>',
 
 
 
 
 
 
 
 
31
  }
32
+ );
33
+ express.attachToButtons($$('[data-paypalexpress]'));
34
+
35
+ // Expose the ppExpress object to the window for backwards compatibility
36
+ window.ppExpress = express;
37
+ });
38
+ })();
39
  </script>
app/design/frontend/base/default/template/gene/braintree/express/catalog.phtml CHANGED
@@ -1,20 +1,6 @@
1
- <?php
2
- /*
3
- * @var Gene_Braintree_Block_Express_Button $this
4
- */
5
- ?>
6
-
7
- <?php if( !$this->isEnabled() || !$this->isEnabledPdp()) return; ?>
8
-
9
- <?php /* Check if this block has already been setup, so we don't have multuple divs */
10
- if( !$this->hasBeenSetup() ): ?>
11
- <div id="pp-express-overlay"></div>
12
- <div id="pp-express-modal"></div>
13
- <div id="pp-express-container"></div>
14
- <?php endif; ?>
15
 
16
  <script type="text/javascript">
17
- <?php if( !$this->hasBeenSetup() ): ?>
18
  if (typeof Translator !== 'object' && typeof Translate == 'object') {
19
  var Translator = new Translate([]);
20
  }
@@ -25,21 +11,30 @@ if( !$this->hasBeenSetup() ): ?>
25
  "Checkout with PayPal": "<?php echo $this->__("Checkout with PayPal"); ?>"
26
  })
27
  }
28
- <?php endif; ?>
29
 
30
- Event.observe(window, 'load', function() {
31
- if (typeof ppExpress === 'object') {
32
- ppExpress.addBtn({
33
- token: '<?php echo $this->getToken(); ?>',
34
- currency: '<?php echo $this->getStoreCurrency(); ?>',
35
- priceFormat: <?php echo Mage::helper('core')->jsonEncode(Mage::app()->getLocale()->getJsPriceFormat()); ?>,
36
- locale: '<?php echo strtolower($this->getStoreLocale()); ?>',
37
- productId: <?php echo (int) $this->getProduct()->getId(); ?>,
38
- authUrl: '<?php echo $this->getUrl('braintree/express/authorization') ?>',
39
- shippingSaveUrl:'<?php echo $this->getUrl('braintree/express/saveShipping') ?>',
40
- couponSaveUrl: '<?php echo $this->getUrl('braintree/express/saveCoupon') ?>',
41
- successUrl: '<?php echo $this->getUrl("checkout/onepage/success"); ?>'
42
- });
43
- }
44
- });
 
 
 
 
 
 
 
 
 
 
45
  </script>
1
+ <?php if (!$this->isEnabled() || !$this->isEnabledPdp()) return; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  <script type="text/javascript">
 
4
  if (typeof Translator !== 'object' && typeof Translate == 'object') {
5
  var Translator = new Translate([]);
6
  }
11
  "Checkout with PayPal": "<?php echo $this->__("Checkout with PayPal"); ?>"
12
  })
13
  }
 
14
 
15
+ (function () {
16
+ document.observe("dom:loaded", function() {
17
+ var express = new BraintreePayPalExpress(
18
+ '<?php echo $this->getToken(); ?>',
19
+ '<?php echo Mage::app()->getStore()->getFrontendName(); ?>',
20
+ '<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>',
21
+ 'product',
22
+ {
23
+ authUrl: '<?php echo $this->getUrl('braintree/express/authorization') ?>',
24
+ shippingSaveUrl:'<?php echo $this->getUrl('braintree/express/saveShipping') ?>',
25
+ couponSaveUrl: '<?php echo $this->getUrl('braintree/express/saveCoupon') ?>',
26
+ successUrl: '<?php echo $this->getUrl("checkout/onepage/success"); ?>',
27
+ },
28
+ {
29
+ locale: '<?php echo strtolower($this->getStoreLocale()); ?>',
30
+ token: '<?php echo $this->getToken(); ?>',
31
+ productId: <?php echo (int) $this->getProduct()->getId(); ?>,
32
+ }
33
+ );
34
+ express.attachToButtons($$('[data-paypalexpress]'));
35
+
36
+ // Expose the ppExpress object to the window for backwards compatibility
37
+ window.ppExpress = express;
38
+ });
39
+ })();
40
  </script>
app/design/frontend/base/default/template/gene/braintree/js/awesomecheckout.phtml CHANGED
@@ -66,7 +66,7 @@
66
  var reviewResponse = _originalReviewInitialize.apply(this, arguments);
67
 
68
  // Run our magical function
69
- vzeroIntegration.updatePayPalButton();
70
 
71
  return reviewResponse;
72
  };
66
  var reviewResponse = _originalReviewInitialize.apply(this, arguments);
67
 
68
  // Run our magical function
69
+ vzeroIntegration.onReviewInit();
70
 
71
  return reviewResponse;
72
  };
app/design/frontend/base/default/template/gene/braintree/js/default.phtml CHANGED
@@ -17,13 +17,12 @@
17
  // Store a pointer to the vZero integration
18
  var vzeroIntegration = this;
19
 
20
- // Store the original version of Payment.save();
21
- var _originalPaymentSave = Payment.prototype.save;
22
- Payment.prototype.save = function() {
23
 
24
  // Do the standard validation
25
- var validator = new Validation(this.form);
26
- if (this.validate() && validator.validate() && vzeroIntegration.shouldInterceptSubmit('creditcard')) {
27
 
28
  // Store a pointer to the payment class
29
  var paymentThis = this;
@@ -31,37 +30,13 @@
31
 
32
  // If everything was a success on the checkout end, let's submit the vZero integration
33
  vzeroIntegration.submit('creditcard', function () {
34
- return _originalPaymentSave.apply(paymentThis, paymentArguments);
35
  });
36
 
37
  } else {
38
  // If not run the original code
39
- return _originalPaymentSave.apply(this, arguments);
40
  }
41
-
42
- };
43
-
44
- // As the default checkout submits more data on the review step, we need to make sure various elements are disabled
45
- var _originalReviewSave = Review.prototype.save;
46
- Review.prototype.save = function() {
47
-
48
- // Force on device data
49
- vzeroIntegration.enableDeviceData();
50
-
51
- // If we should intercept the submit, disable the credit card form
52
- if (vzeroIntegration.shouldInterceptSubmit('creditcard')) {
53
- vzeroIntegration.disableCreditCardForm();
54
- }
55
-
56
- // Do the original action
57
- var reviewResponse = _originalReviewSave.apply(this, arguments);
58
-
59
- // Just in case there is an error
60
- if (vzeroIntegration.shouldInterceptSubmit('creditcard')) {
61
- vzeroIntegration.enableCreditCardForm();
62
- }
63
-
64
- return reviewResponse;
65
  };
66
 
67
  },
@@ -84,7 +59,7 @@
84
  var reviewResponse = _originalReviewInitialize.apply(this, arguments);
85
 
86
  // Run our magical function
87
- vzeroIntegration.updatePayPalButton();
88
 
89
  return reviewResponse;
90
  };
@@ -99,6 +74,20 @@
99
  vzeroIntegration.initSavedMethods();
100
  };
101
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  }
103
 
104
  });
@@ -112,25 +101,10 @@
112
  (window.vzero || false),
113
  (window.vzeroPaypal || false),
114
  '<div id="paypal-complete"><div id="paypal-container"></div></div>',
115
- '#review-buttons-container button'
 
 
 
116
  );
117
 
118
- </script>
119
- <style type="text/css">
120
- #paypal-label {
121
- line-height: 44px;
122
- float: left;
123
- margin-right: 12px;
124
- }
125
- #braintree-paypal-button {
126
- line-height: initial;
127
- padding: 0;
128
- float: left;
129
- }
130
- #braintree-paypal-loggedin {
131
- display: none!important;
132
- }
133
- #braintree-paypal-loggedout {
134
- display: block!important;
135
- }
136
- </style>
17
  // Store a pointer to the vZero integration
18
  var vzeroIntegration = this;
19
 
20
+ // As the default checkout submits more data on the review step, we need to make sure various elements are disabled
21
+ var _originalReviewSave = Review.prototype.save;
22
+ Review.prototype.save = function() {
23
 
24
  // Do the standard validation
25
+ if (vzeroIntegration.shouldInterceptSubmit('creditcard')) {
 
26
 
27
  // Store a pointer to the payment class
28
  var paymentThis = this;
30
 
31
  // If everything was a success on the checkout end, let's submit the vZero integration
32
  vzeroIntegration.submit('creditcard', function () {
33
+ return _originalReviewSave.apply(paymentThis, paymentArguments);
34
  });
35
 
36
  } else {
37
  // If not run the original code
38
+ return _originalReviewSave.apply(this, arguments);
39
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  };
41
 
42
  },
59
  var reviewResponse = _originalReviewInitialize.apply(this, arguments);
60
 
61
  // Run our magical function
62
+ vzeroIntegration.onReviewInit();
63
 
64
  return reviewResponse;
65
  };
74
  vzeroIntegration.initSavedMethods();
75
  };
76
 
77
+ },
78
+
79
+ /**
80
+ * Set the loading state
81
+ */
82
+ setLoading: function () {
83
+ checkout.setLoadWaiting('review');
84
+ },
85
+
86
+ /**
87
+ * Reset the loading state
88
+ */
89
+ resetLoading: function () {
90
+ checkout.setLoadWaiting(false);
91
  }
92
 
93
  });
101
  (window.vzero || false),
102
  (window.vzeroPaypal || false),
103
  '<div id="paypal-complete"><div id="paypal-container"></div></div>',
104
+ '#review-buttons-container button',
105
+ false,
106
+ false,
107
+ true // Submit after payment
108
  );
109
 
110
+ </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/gene/braintree/js/idev.phtml CHANGED
@@ -70,9 +70,10 @@
70
 
71
  // Observe the click event
72
  var _originalSubmitEvent = $('onestepcheckout-form').submit;
73
- $('onestepcheckout-form').submit = function braintreeOverride() {
 
74
 
75
- if (vzeroIntegration.shouldInterceptSubmit('creditcard')) {
76
 
77
  // If everything was a success on the checkout end, let's submit the vZero integration
78
  vzeroIntegration.submit('creditcard', function () {
@@ -92,7 +93,7 @@
92
  */
93
  submitCheckout: function() {
94
  // Submit the checkout
95
- return $('onestepcheckout-form').submit();
96
  }
97
 
98
  });
70
 
71
  // Observe the click event
72
  var _originalSubmitEvent = $('onestepcheckout-form').submit;
73
+ $('onestepcheckout-form').submit = function braintreeOverride(forceOriginal) {
74
+ forceOriginal = forceOriginal || false;
75
 
76
+ if (!forceOriginal && vzeroIntegration.shouldInterceptSubmit('creditcard')) {
77
 
78
  // If everything was a success on the checkout end, let's submit the vZero integration
79
  vzeroIntegration.submit('creditcard', function () {
93
  */
94
  submitCheckout: function() {
95
  // Submit the checkout
96
+ return $('onestepcheckout-form').submit(true);
97
  }
98
 
99
  });
app/design/frontend/base/default/template/gene/braintree/js/setup.phtml CHANGED
@@ -5,9 +5,8 @@
5
  /* @var $this Gene_Braintree_Block_Js */
6
  ?>
7
  <script type="text/javascript">
8
-
9
  // Only init the vzero class once
10
- if(vzero === undefined) {
11
 
12
  // Pass some data over to vZero integration JS
13
  var vzero = new vZero(
@@ -22,22 +21,19 @@
22
  '<?php echo Mage::getUrl('braintree/checkout/vaultToNonce', array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure())); ?>'
23
  );
24
 
25
- <?php if($this->isPayPalActive()): ?>
26
- // Pass some data through to the PayPal integration
27
- var vzeroPaypal = new vZeroPayPalButton(
28
- '<?php echo $this->getClientToken(); ?>',
29
- '<?php echo Mage::app()->getStore()->getFrontendName(); ?>',
30
- <?php echo $this->getSingleUse(); ?>,
31
- '<?php echo $this->getLocale(); ?>',
32
- <?php echo $this->getSingleFutureUse(); ?>
33
- );
 
34
  <?php endif; ?>
35
 
36
- // Init the environment
37
- vzero.init();
38
-
39
  }
40
-
41
  </script>
42
 
43
  <script type="text/html" id="braintree-paypal-button">
@@ -50,6 +46,16 @@
50
  </button>
51
  </script>
52
 
 
 
 
 
 
 
 
 
 
 
53
  <?php
54
  /**
55
  * We always want to hide the logged in aspect of the PayPal button, only ever display the button
5
  /* @var $this Gene_Braintree_Block_Js */
6
  ?>
7
  <script type="text/javascript">
 
8
  // Only init the vzero class once
9
+ if (typeof vzero === 'undefined') {
10
 
11
  // Pass some data over to vZero integration JS
12
  var vzero = new vZero(
21
  '<?php echo Mage::getUrl('braintree/checkout/vaultToNonce', array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure())); ?>'
22
  );
23
 
24
+ <?php if ($this->isPayPalActive()) : ?>
25
+ // Pass some data through to the PayPal integration
26
+ var vzeroPaypal = new vZeroPayPalButton(
27
+ '<?php echo $this->getClientToken(); ?>',
28
+ '<?php echo Mage::app()->getStore()->getFrontendName(); ?>',
29
+ <?php echo $this->getSingleUse(); ?>,
30
+ '<?php echo $this->getLocale(); ?>',
31
+ <?php echo $this->getSingleFutureUse(); ?>,
32
+ vzero
33
+ );
34
  <?php endif; ?>
35
 
 
 
 
36
  }
 
37
  </script>
38
 
39
  <script type="text/html" id="braintree-paypal-button">
46
  </button>
47
  </script>
48
 
49
+ <div id="three-d-modal" class="hidden">
50
+ <div class="bt-mask"></div>
51
+ <div class="bt-modal-frame">
52
+ <div class="bt-modal-header">
53
+ <div class="header-text"><?php echo $this->__('Authentication'); ?></div>
54
+ </div>
55
+ <div class="bt-modal-body"></div>
56
+ </div>
57
+ </div>
58
+
59
  <?php
60
  /**
61
  * We always want to hide the logged in aspect of the PayPal button, only ever display the button
js/gene/braintree/braintree-0.1.js DELETED
@@ -1,7 +0,0 @@
1
- !function(){function t(e,n){e instanceof t?(this.enc=e.enc,this.pos=e.pos):(this.enc=e,this.pos=n)}function e(t,e,n,i,r){this.stream=t,this.header=e,this.length=n,this.tag=i,this.sub=r}function n(t){var e,n,i="";for(e=0;e+3<=t.length;e+=3)n=parseInt(t.substring(e,e+3),16),i+=ee.charAt(n>>6)+ee.charAt(63&n);for(e+1==t.length?(n=parseInt(t.substring(e,e+1),16),i+=ee.charAt(n<<2)):e+2==t.length&&(n=parseInt(t.substring(e,e+2),16),i+=ee.charAt(n>>2)+ee.charAt((3&n)<<4));(3&i.length)>0;)i+=ne;return i}function i(t){var e,n,i,r="",o=0;for(e=0;e<t.length&&t.charAt(e)!=ne;++e)i=ee.indexOf(t.charAt(e)),0>i||(0==o?(r+=l(i>>2),n=3&i,o=1):1==o?(r+=l(n<<2|i>>4),n=15&i,o=2):2==o?(r+=l(n),r+=l(i>>2),n=3&i,o=3):(r+=l(n<<2|i>>4),r+=l(15&i),o=0));return 1==o&&(r+=l(n<<2)),r}function r(t){var e,n=i(t),r=new Array;for(e=0;2*e<n.length;++e)r[e]=parseInt(n.substring(2*e,2*e+2),16);return r}function o(t,e,n){null!=t&&("number"==typeof t?this.fromNumber(t,e,n):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}function s(){return new o(null)}function a(t,e,n,i,r,o){for(;--o>=0;){var s=e*this[t++]+n[i]+r;r=Math.floor(s/67108864),n[i++]=67108863&s}return r}function u(t,e,n,i,r,o){for(var s=32767&e,a=e>>15;--o>=0;){var u=32767&this[t],c=this[t++]>>15,l=a*u+c*s;u=s*u+((32767&l)<<15)+n[i]+(1073741823&r),r=(u>>>30)+(l>>>15)+a*c+(r>>>30),n[i++]=1073741823&u}return r}function c(t,e,n,i,r,o){for(var s=16383&e,a=e>>14;--o>=0;){var u=16383&this[t],c=this[t++]>>14,l=a*u+c*s;u=s*u+((16383&l)<<14)+n[i]+r,r=(u>>28)+(l>>14)+a*c,n[i++]=268435455&u}return r}function l(t){return ue.charAt(t)}function p(t,e){var n=ce[t.charCodeAt(e)];return null==n?-1:n}function h(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s}function d(t){this.t=1,this.s=0>t?-1:0,t>0?this[0]=t:-1>t?this[0]=t+this.DV:this.t=0}function f(t){var e=s();return e.fromInt(t),e}function m(t,e){var n;if(16==e)n=4;else if(8==e)n=3;else if(256==e)n=8;else if(2==e)n=1;else if(32==e)n=5;else{if(4!=e)return void this.fromRadix(t,e);n=2}this.t=0,this.s=0;for(var i=t.length,r=!1,s=0;--i>=0;){var a=8==n?255&t[i]:p(t,i);0>a?"-"==t.charAt(i)&&(r=!0):(r=!1,0==s?this[this.t++]=a:s+n>this.DB?(this[this.t-1]|=(a&(1<<this.DB-s)-1)<<s,this[this.t++]=a>>this.DB-s):this[this.t-1]|=a<<s,s+=n,s>=this.DB&&(s-=this.DB))}8==n&&0!=(128&t[0])&&(this.s=-1,s>0&&(this[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),r&&o.ZERO.subTo(this,this)}function g(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t}function y(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var n,i=(1<<e)-1,r=!1,o="",s=this.t,a=this.DB-s*this.DB%e;if(s-->0)for(a<this.DB&&(n=this[s]>>a)>0&&(r=!0,o=l(n));s>=0;)e>a?(n=(this[s]&(1<<a)-1)<<e-a,n|=this[--s]>>(a+=this.DB-e)):(n=this[s]>>(a-=e)&i,0>=a&&(a+=this.DB,--s)),n>0&&(r=!0),r&&(o+=l(n));return r?o:"0"}function b(){var t=s();return o.ZERO.subTo(this,t),t}function v(){return this.s<0?this.negate():this}function _(t){var e=this.s-t.s;if(0!=e)return e;var n=this.t;if(e=n-t.t,0!=e)return this.s<0?-e:e;for(;--n>=0;)if(0!=(e=this[n]-t[n]))return e;return 0}function E(t){var e,n=1;return 0!=(e=t>>>16)&&(t=e,n+=16),0!=(e=t>>8)&&(t=e,n+=8),0!=(e=t>>4)&&(t=e,n+=4),0!=(e=t>>2)&&(t=e,n+=2),0!=(e=t>>1)&&(t=e,n+=1),n}function w(){return this.t<=0?0:this.DB*(this.t-1)+E(this[this.t-1]^this.s&this.DM)}function A(t,e){var n;for(n=this.t-1;n>=0;--n)e[n+t]=this[n];for(n=t-1;n>=0;--n)e[n]=0;e.t=this.t+t,e.s=this.s}function C(t,e){for(var n=t;n<this.t;++n)e[n-t]=this[n];e.t=Math.max(this.t-t,0),e.s=this.s}function N(t,e){var n,i=t%this.DB,r=this.DB-i,o=(1<<r)-1,s=Math.floor(t/this.DB),a=this.s<<i&this.DM;for(n=this.t-1;n>=0;--n)e[n+s+1]=this[n]>>r|a,a=(this[n]&o)<<i;for(n=s-1;n>=0;--n)e[n]=0;e[s]=a,e.t=this.t+s+1,e.s=this.s,e.clamp()}function T(t,e){e.s=this.s;var n=Math.floor(t/this.DB);if(n>=this.t)return void(e.t=0);var i=t%this.DB,r=this.DB-i,o=(1<<i)-1;e[0]=this[n]>>i;for(var s=n+1;s<this.t;++s)e[s-n-1]|=(this[s]&o)<<r,e[s-n]=this[s]>>i;i>0&&(e[this.t-n-1]|=(this.s&o)<<r),e.t=this.t-n,e.clamp()}function O(t,e){for(var n=0,i=0,r=Math.min(t.t,this.t);r>n;)i+=this[n]-t[n],e[n++]=i&this.DM,i>>=this.DB;if(t.t<this.t){for(i-=t.s;n<this.t;)i+=this[n],e[n++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;n<t.t;)i-=t[n],e[n++]=i&this.DM,i>>=this.DB;i-=t.s}e.s=0>i?-1:0,-1>i?e[n++]=this.DV+i:i>0&&(e[n++]=i),e.t=n,e.clamp()}function S(t,e){var n=this.abs(),i=t.abs(),r=n.t;for(e.t=r+i.t;--r>=0;)e[r]=0;for(r=0;r<i.t;++r)e[r+n.t]=n.am(0,i[r],e,r,0,n.t);e.s=0,e.clamp(),this.s!=t.s&&o.ZERO.subTo(e,e)}function I(t){for(var e=this.abs(),n=t.t=2*e.t;--n>=0;)t[n]=0;for(n=0;n<e.t-1;++n){var i=e.am(n,e[n],t,2*n,0,1);(t[n+e.t]+=e.am(n+1,2*e[n],t,2*n+1,i,e.t-n-1))>=e.DV&&(t[n+e.t]-=e.DV,t[n+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(n,e[n],t,2*n,0,1)),t.s=0,t.clamp()}function x(t,e,n){var i=t.abs();if(!(i.t<=0)){var r=this.abs();if(r.t<i.t)return null!=e&&e.fromInt(0),void(null!=n&&this.copyTo(n));null==n&&(n=s());var a=s(),u=this.s,c=t.s,l=this.DB-E(i[i.t-1]);l>0?(i.lShiftTo(l,a),r.lShiftTo(l,n)):(i.copyTo(a),r.copyTo(n));var p=a.t,h=a[p-1];if(0!=h){var d=h*(1<<this.F1)+(p>1?a[p-2]>>this.F2:0),f=this.FV/d,m=(1<<this.F1)/d,g=1<<this.F2,y=n.t,b=y-p,v=null==e?s():e;for(a.dlShiftTo(b,v),n.compareTo(v)>=0&&(n[n.t++]=1,n.subTo(v,n)),o.ONE.dlShiftTo(p,v),v.subTo(a,a);a.t<p;)a[a.t++]=0;for(;--b>=0;){var _=n[--y]==h?this.DM:Math.floor(n[y]*f+(n[y-1]+g)*m);if((n[y]+=a.am(0,_,n,b,0,p))<_)for(a.dlShiftTo(b,v),n.subTo(v,n);n[y]<--_;)n.subTo(v,n)}null!=e&&(n.drShiftTo(p,e),u!=c&&o.ZERO.subTo(e,e)),n.t=p,n.clamp(),l>0&&n.rShiftTo(l,n),0>u&&o.ZERO.subTo(n,n)}}}function P(t){var e=s();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(o.ZERO)>0&&t.subTo(e,e),e}function R(t){this.m=t}function D(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function M(t){return t}function U(t){t.divRemTo(this.m,null,t)}function k(t,e,n){t.multiplyTo(e,n),this.reduce(n)}function F(t,e){t.squareTo(e),this.reduce(e)}function L(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var e=3&t;return e=e*(2-(15&t)*e)&15,e=e*(2-(255&t)*e)&255,e=e*(2-((65535&t)*e&65535))&65535,e=e*(2-t*e%this.DV)%this.DV,e>0?this.DV-e:-e}function j(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function B(t){var e=s();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(o.ZERO)>0&&this.m.subTo(e,e),e}function H(t){var e=s();return t.copyTo(e),this.reduce(e),e}function V(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var n=32767&t[e],i=n*this.mpl+((n*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(n=e+this.m.t,t[n]+=this.m.am(0,i,t,e,0,this.m.t);t[n]>=t.DV;)t[n]-=t.DV,t[++n]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)}function z(t,e){t.squareTo(e),this.reduce(e)}function Y(t,e,n){t.multiplyTo(e,n),this.reduce(n)}function G(){return 0==(this.t>0?1&this[0]:this.s)}function W(t,e){if(t>4294967295||1>t)return o.ONE;var n=s(),i=s(),r=e.convert(this),a=E(t)-1;for(r.copyTo(n);--a>=0;)if(e.sqrTo(n,i),(t&1<<a)>0)e.mulTo(i,r,n);else{var u=n;n=i,i=u}return e.revert(n)}function q(t,e){var n;return n=256>t||e.isEven()?new R(e):new j(e),this.exp(t,n)}function Q(t,e){return new o(t,e)}function K(t,e){if(e<t.length+11)throw new Error("Message too long for RSA");for(var n=new Array,i=t.length-1;i>=0&&e>0;){var r=t.charCodeAt(i--);128>r?n[--e]=r:r>127&&2048>r?(n[--e]=63&r|128,n[--e]=r>>6|192):(n[--e]=63&r|128,n[--e]=r>>6&63|128,n[--e]=r>>12|224)}n[--e]=0;for(var s=0,a=0,u=0;e>2;)0==u&&(a=le.random.randomWords(1,0)[0]),s=a>>u&255,u=(u+8)%32,0!=s&&(n[--e]=s);return n[--e]=2,n[--e]=0,new o(n)}function $(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}function Z(t,e){if(!(null!=t&&null!=e&&t.length>0&&e.length>0))throw new Error("Invalid RSA public key");this.n=Q(t,16),this.e=parseInt(e,16)}function X(t){return t.modPowInt(this.e,this.n)}function J(t){var e=K(t,this.n.bitLength()+7>>3);if(null==e)return null;var n=this.doPublic(e);if(null==n)return null;var i=n.toString(16);return 0==(1&i.length)?i:"0"+i}t.prototype.get=function(t){if(void 0==t&&(t=this.pos++),t>=this.enc.length)throw"Requesting byte offset "+t+" on a stream of length "+this.enc.length;return this.enc[t]},t.prototype.hexDigits="0123456789ABCDEF",t.prototype.hexByte=function(t){return this.hexDigits.charAt(t>>4&15)+this.hexDigits.charAt(15&t)},t.prototype.hexDump=function(t,e){for(var n="",i=t;e>i;++i)switch(n+=this.hexByte(this.get(i)),15&i){case 7:n+=" ";break;case 15:n+="\n";break;default:n+=" "}return n},t.prototype.parseStringISO=function(t,e){for(var n="",i=t;e>i;++i)n+=String.fromCharCode(this.get(i));return n},t.prototype.parseStringUTF=function(t,e){for(var n="",i=0,r=t;e>r;){var i=this.get(r++);n+=String.fromCharCode(128>i?i:i>191&&224>i?(31&i)<<6|63&this.get(r++):(15&i)<<12|(63&this.get(r++))<<6|63&this.get(r++))}return n},t.prototype.reTime=/^((?:1[89]|2\d)?\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,t.prototype.parseTime=function(t,e){var n=this.parseStringISO(t,e),i=this.reTime.exec(n);return i?(n=i[1]+"-"+i[2]+"-"+i[3]+" "+i[4],i[5]&&(n+=":"+i[5],i[6]&&(n+=":"+i[6],i[7]&&(n+="."+i[7]))),i[8]&&(n+=" UTC","Z"!=i[8]&&(n+=i[8],i[9]&&(n+=":"+i[9]))),n):"Unrecognized time: "+n},t.prototype.parseInteger=function(t,e){var n=e-t;if(n>4){n<<=3;var i=this.get(t);if(0==i)n-=8;else for(;128>i;)i<<=1,--n;return"("+n+" bit)"}for(var r=0,o=t;e>o;++o)r=r<<8|this.get(o);return r},t.prototype.parseBitString=function(t,e){var n=this.get(t),i=(e-t-1<<3)-n,r="("+i+" bit)";if(20>=i){var o=n;r+=" ";for(var s=e-1;s>t;--s){for(var a=this.get(s),u=o;8>u;++u)r+=a>>u&1?"1":"0";o=0}}return r},t.prototype.parseOctetString=function(t,e){var n=e-t,i="("+n+" byte) ";n>20&&(e=t+20);for(var r=t;e>r;++r)i+=this.hexByte(this.get(r));return n>20&&(i+=String.fromCharCode(8230)),i},t.prototype.parseOID=function(t,e){for(var n,i=0,r=0,o=t;e>o;++o){var s=this.get(o);i=i<<7|127&s,r+=7,128&s||(void 0==n?n=parseInt(i/40)+"."+i%40:n+="."+(r>=31?"bigint":i),i=r=0),n+=String.fromCharCode()}return n},e.prototype.typeName=function(){if(void 0==this.tag)return"unknown";var t=this.tag>>6,e=(this.tag>>5&1,31&this.tag);switch(t){case 0:switch(e){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString";default:return"Universal_"+e.toString(16)}case 1:return"Application_"+e.toString(16);case 2:return"["+e+"]";case 3:return"Private_"+e.toString(16)}},e.prototype.content=function(){if(void 0==this.tag)return null;var t=this.tag>>6;if(0!=t)return null==this.sub?null:"("+this.sub.length+")";var e=31&this.tag,n=this.posContent(),i=Math.abs(this.length);switch(e){case 1:return 0==this.stream.get(n)?"false":"true";case 2:return this.stream.parseInteger(n,n+i);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(n,n+i);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(n,n+i);case 6:return this.stream.parseOID(n,n+i);case 16:case 17:return"("+this.sub.length+" elem)";case 12:return this.stream.parseStringUTF(n,n+i);case 18:case 19:case 20:case 21:case 22:case 26:return this.stream.parseStringISO(n,n+i);case 23:case 24:return this.stream.parseTime(n,n+i)}return null},e.prototype.toString=function(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null==this.sub?"null":this.sub.length)+"]"},e.prototype.print=function(t){if(void 0==t&&(t=""),document.writeln(t+this),null!=this.sub){t+=" ";for(var e=0,n=this.sub.length;n>e;++e)this.sub[e].print(t)}},e.prototype.toPrettyString=function(t){void 0==t&&(t="");var e=t+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(e+="+"),e+=this.length,32&this.tag?e+=" (constructed)":3!=this.tag&&4!=this.tag||null==this.sub||(e+=" (encapsulates)"),e+="\n",null!=this.sub){t+=" ";for(var n=0,i=this.sub.length;i>n;++n)e+=this.sub[n].toPrettyString(t)}return e},e.prototype.posStart=function(){return this.stream.pos},e.prototype.posContent=function(){return this.stream.pos+this.header},e.prototype.posEnd=function(){return this.stream.pos+this.header+Math.abs(this.length)},e.decodeLength=function(t){var e=t.get(),n=127&e;if(n==e)return n;if(n>3)throw"Length over 24 bits not supported at position "+(t.pos-1);if(0==n)return-1;e=0;for(var i=0;n>i;++i)e=e<<8|t.get();return e},e.hasContent=function(n,i,r){if(32&n)return!0;if(3>n||n>4)return!1;var o=new t(r);3==n&&o.get();var s=o.get();if(s>>6&1)return!1;try{var a=e.decodeLength(o);return o.pos-r.pos+a==i}catch(u){return!1}},e.decode=function(n){n instanceof t||(n=new t(n,0));var i=new t(n),r=n.get(),o=e.decodeLength(n),s=n.pos-i.pos,a=null;if(e.hasContent(r,o,n)){var u=n.pos;if(3==r&&n.get(),a=[],o>=0){for(var c=u+o;n.pos<c;)a[a.length]=e.decode(n);if(n.pos!=c)throw"Content size is not correct for container starting at offset "+u}else try{for(;;){var l=e.decode(n);if(0==l.tag)break;a[a.length]=l}o=u-n.pos}catch(p){throw"Exception while decoding undefined length content: "+p}}else n.pos+=o;return new e(i,s,o,r,a)};var te,ee="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ne="=",ie=0xdeadbeefcafe,re=15715070==(16777215&ie);re&&"Microsoft Internet Explorer"==navigator.appName?(o.prototype.am=u,te=30):re&&"Netscape"!=navigator.appName?(o.prototype.am=a,te=26):(o.prototype.am=c,te=28),o.prototype.DB=te,o.prototype.DM=(1<<te)-1,o.prototype.DV=1<<te;var oe=52;o.prototype.FV=Math.pow(2,oe),o.prototype.F1=oe-te,o.prototype.F2=2*te-oe;var se,ae,ue="0123456789abcdefghijklmnopqrstuvwxyz",ce=new Array;for(se="0".charCodeAt(0),ae=0;9>=ae;++ae)ce[se++]=ae;for(se="a".charCodeAt(0),ae=10;36>ae;++ae)ce[se++]=ae;for(se="A".charCodeAt(0),ae=10;36>ae;++ae)ce[se++]=ae;R.prototype.convert=D,R.prototype.revert=M,R.prototype.reduce=U,R.prototype.mulTo=k,R.prototype.sqrTo=F,j.prototype.convert=B,j.prototype.revert=H,j.prototype.reduce=V,j.prototype.mulTo=Y,j.prototype.sqrTo=z,o.prototype.copyTo=h,o.prototype.fromInt=d,o.prototype.fromString=m,o.prototype.clamp=g,o.prototype.dlShiftTo=A,o.prototype.drShiftTo=C,o.prototype.lShiftTo=N,o.prototype.rShiftTo=T,o.prototype.subTo=O,o.prototype.multiplyTo=S,o.prototype.squareTo=I,o.prototype.divRemTo=x,o.prototype.invDigit=L,o.prototype.isEven=G,o.prototype.exp=W,o.prototype.toString=y,o.prototype.negate=b,o.prototype.abs=v,o.prototype.compareTo=_,o.prototype.bitLength=w,o.prototype.mod=P,o.prototype.modPowInt=q,o.ZERO=f(0),o.ONE=f(1),$.prototype.doPublic=X,$.prototype.setPublic=Z,$.prototype.encrypt=J;var le={cipher:{},hash:{},keyexchange:{},mode:{},misc:{},codec:{},exception:{corrupt:function(t){this.toString=function(){return"CORRUPT: "+this.message},this.message=t},invalid:function(t){this.toString=function(){return"INVALID: "+this.message},this.message=t},bug:function(t){this.toString=function(){return"BUG: "+this.message},this.message=t},notReady:function(t){this.toString=function(){return"NOT READY: "+this.message},this.message=t}}};"undefined"!=typeof module&&module.exports&&(module.exports=le),le.cipher.aes=function(t){this._tables[0][0][0]||this._precompute();var e,n,i,r,o,s=this._tables[0][4],a=this._tables[1],u=t.length,c=1;if(4!==u&&6!==u&&8!==u)throw new le.exception.invalid("invalid aes key size");for(this._key=[r=t.slice(0),o=[]],e=u;4*u+28>e;e++)i=r[e-1],(e%u===0||8===u&&e%u===4)&&(i=s[i>>>24]<<24^s[i>>16&255]<<16^s[i>>8&255]<<8^s[255&i],e%u===0&&(i=i<<8^i>>>24^c<<24,c=c<<1^283*(c>>7))),r[e]=r[e-u]^i;for(n=0;e;n++,e--)i=r[3&n?e:e-4],o[n]=4>=e||4>n?i:a[0][s[i>>>24]]^a[1][s[i>>16&255]]^a[2][s[i>>8&255]]^a[3][s[255&i]]},le.cipher.aes.prototype={encrypt:function(t){return this._crypt(t,0)},decrypt:function(t){return this._crypt(t,1)},_tables:[[[],[],[],[],[]],[[],[],[],[],[]]],_precompute:function(){var t,e,n,i,r,o,s,a,u,c=this._tables[0],l=this._tables[1],p=c[4],h=l[4],d=[],f=[];for(t=0;256>t;t++)f[(d[t]=t<<1^283*(t>>7))^t]=t;for(e=n=0;!p[e];e^=i||1,n=f[n]||1)for(s=n^n<<1^n<<2^n<<3^n<<4,s=s>>8^255&s^99,p[e]=s,h[s]=e,o=d[r=d[i=d[e]]],u=16843009*o^65537*r^257*i^16843008*e,a=257*d[s]^16843008*s,t=0;4>t;t++)c[t][e]=a=a<<24^a>>>8,l[t][s]=u=u<<24^u>>>8;for(t=0;5>t;t++)c[t]=c[t].slice(0),l[t]=l[t].slice(0)},_crypt:function(t,e){if(4!==t.length)throw new le.exception.invalid("invalid aes block size");var n,i,r,o,s=this._key[e],a=t[0]^s[0],u=t[e?3:1]^s[1],c=t[2]^s[2],l=t[e?1:3]^s[3],p=s.length/4-2,h=4,d=[0,0,0,0],f=this._tables[e],m=f[0],g=f[1],y=f[2],b=f[3],v=f[4];for(o=0;p>o;o++)n=m[a>>>24]^g[u>>16&255]^y[c>>8&255]^b[255&l]^s[h],i=m[u>>>24]^g[c>>16&255]^y[l>>8&255]^b[255&a]^s[h+1],r=m[c>>>24]^g[l>>16&255]^y[a>>8&255]^b[255&u]^s[h+2],l=m[l>>>24]^g[a>>16&255]^y[u>>8&255]^b[255&c]^s[h+3],h+=4,a=n,u=i,c=r;for(o=0;4>o;o++)d[e?3&-o:o]=v[a>>>24]<<24^v[u>>16&255]<<16^v[c>>8&255]<<8^v[255&l]^s[h++],n=a,a=u,u=c,c=l,l=n;return d}},le.bitArray={bitSlice:function(t,e,n){return t=le.bitArray._shiftRight(t.slice(e/32),32-(31&e)).slice(1),void 0===n?t:le.bitArray.clamp(t,n-e)},extract:function(t,e,n){var i,r=Math.floor(-e-n&31);return i=-32&(e+n-1^e)?t[e/32|0]<<32-r^t[e/32+1|0]>>>r:t[e/32|0]>>>r,i&(1<<n)-1},concat:function(t,e){if(0===t.length||0===e.length)return t.concat(e);var n=t[t.length-1],i=le.bitArray.getPartial(n);return 32===i?t.concat(e):le.bitArray._shiftRight(e,i,0|n,t.slice(0,t.length-1))},bitLength:function(t){var e,n=t.length;return 0===n?0:(e=t[n-1],32*(n-1)+le.bitArray.getPartial(e))},clamp:function(t,e){if(32*t.length<e)return t;t=t.slice(0,Math.ceil(e/32));var n=t.length;return e=31&e,n>0&&e&&(t[n-1]=le.bitArray.partial(e,t[n-1]&2147483648>>e-1,1)),t},partial:function(t,e,n){return 32===t?e:(n?0|e:e<<32-t)+1099511627776*t},getPartial:function(t){return Math.round(t/1099511627776)||32},equal:function(t,e){if(le.bitArray.bitLength(t)!==le.bitArray.bitLength(e))return!1;var n,i=0;for(n=0;n<t.length;n++)i|=t[n]^e[n];return 0===i},_shiftRight:function(t,e,n,i){var r,o,s=0;for(void 0===i&&(i=[]);e>=32;e-=32)i.push(n),n=0;if(0===e)return i.concat(t);for(r=0;r<t.length;r++)i.push(n|t[r]>>>e),n=t[r]<<32-e;return s=t.length?t[t.length-1]:0,o=le.bitArray.getPartial(s),i.push(le.bitArray.partial(e+o&31,e+o>32?n:i.pop(),1)),i},_xor4:function(t,e){return[t[0]^e[0],t[1]^e[1],t[2]^e[2],t[3]^e[3]]}},le.codec.hex={fromBits:function(t){var e,n="";for(e=0;e<t.length;e++)n+=((0|t[e])+0xf00000000000).toString(16).substr(4);return n.substr(0,le.bitArray.bitLength(t)/4)},toBits:function(t){var e,n,i=[];for(t=t.replace(/\s|0x/g,""),n=t.length,t+="00000000",e=0;e<t.length;e+=8)i.push(0^parseInt(t.substr(e,8),16));return le.bitArray.clamp(i,4*n)}},le.codec.utf8String={fromBits:function(t){var e,n,i="",r=le.bitArray.bitLength(t);for(e=0;r/8>e;e++)0===(3&e)&&(n=t[e/4]),i+=String.fromCharCode(n>>>24),n<<=8;return decodeURIComponent(escape(i))},toBits:function(t){t=unescape(encodeURIComponent(t));var e,n=[],i=0;for(e=0;e<t.length;e++)i=i<<8|t.charCodeAt(e),3===(3&e)&&(n.push(i),i=0);return 3&e&&n.push(le.bitArray.partial(8*(3&e),i)),n}},le.codec.base64={_chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",fromBits:function(t,e,n){var i,r="",o=0,s=le.codec.base64._chars,a=0,u=le.bitArray.bitLength(t);for(n&&(s=s.substr(0,62)+"-_"),i=0;6*r.length<u;)r+=s.charAt((a^t[i]>>>o)>>>26),6>o?(a=t[i]<<6-o,o+=26,i++):(a<<=6,o-=6);for(;3&r.length&&!e;)r+="=";return r},toBits:function(t,e){t=t.replace(/\s|=/g,"");var n,i,r=[],o=0,s=le.codec.base64._chars,a=0;for(e&&(s=s.substr(0,62)+"-_"),n=0;n<t.length;n++){if(i=s.indexOf(t.charAt(n)),0>i)throw new le.exception.invalid("this isn't base64!");o>26?(o-=26,r.push(a^i>>>o),a=i<<32-o):(o+=6,a^=i<<32-o)}return 56&o&&r.push(le.bitArray.partial(56&o,a,1)),r}},le.codec.base64url={fromBits:function(t){return le.codec.base64.fromBits(t,1,1)},toBits:function(t){return le.codec.base64.toBits(t,1)}},void 0===le.beware&&(le.beware={}),le.beware["CBC mode is dangerous because it doesn't protect message integrity."]=function(){le.mode.cbc={name:"cbc",encrypt:function(t,e,n,i){if(i&&i.length)throw new le.exception.invalid("cbc can't authenticate data");if(128!==le.bitArray.bitLength(n))throw new le.exception.invalid("cbc iv must be 128 bits");var r,o=le.bitArray,s=o._xor4,a=o.bitLength(e),u=0,c=[];if(7&a)throw new le.exception.invalid("pkcs#5 padding only works for multiples of a byte");for(r=0;a>=u+128;r+=4,u+=128)n=t.encrypt(s(n,e.slice(r,r+4))),c.splice(r,0,n[0],n[1],n[2],n[3]);return a=16843009*(16-(a>>3&15)),n=t.encrypt(s(n,o.concat(e,[a,a,a,a]).slice(r,r+4))),c.splice(r,0,n[0],n[1],n[2],n[3]),c},decrypt:function(t,e,n,i){if(i&&i.length)throw new le.exception.invalid("cbc can't authenticate data");if(128!==le.bitArray.bitLength(n))throw new le.exception.invalid("cbc iv must be 128 bits");if(127&le.bitArray.bitLength(e)||!e.length)throw new le.exception.corrupt("cbc ciphertext must be a positive multiple of the block size");var r,o,s,a=le.bitArray,u=a._xor4,c=[];for(i=i||[],r=0;r<e.length;r+=4)o=e.slice(r,r+4),s=u(n,t.decrypt(o)),c.splice(r,0,s[0],s[1],s[2],s[3]),n=o;if(o=255&c[r-1],0==o||o>16)throw new le.exception.corrupt("pkcs#5 padding corrupt");if(s=16843009*o,!a.equal(a.bitSlice([s,s,s,s],0,8*o),a.bitSlice(c,32*c.length-8*o,32*c.length)))throw new le.exception.corrupt("pkcs#5 padding corrupt");return a.bitSlice(c,0,32*c.length-8*o)}}},le.misc.hmac=function(t,e){this._hash=e=e||le.hash.sha256;var n,i=[[],[]],r=e.prototype.blockSize/32;for(this._baseHash=[new e,new e],t.length>r&&(t=e.hash(t)),n=0;r>n;n++)i[0][n]=909522486^t[n],i[1][n]=1549556828^t[n];this._baseHash[0].update(i[0]),this._baseHash[1].update(i[1])},le.misc.hmac.prototype.encrypt=le.misc.hmac.prototype.mac=function(t,e){var n=new this._hash(this._baseHash[0]).update(t,e).finalize();return new this._hash(this._baseHash[1]).update(n).finalize()},le.hash.sha256=function(t){this._key[0]||this._precompute(),t?(this._h=t._h.slice(0),this._buffer=t._buffer.slice(0),this._length=t._length):this.reset()},le.hash.sha256.hash=function(t){return(new le.hash.sha256).update(t).finalize()},le.hash.sha256.prototype={blockSize:512,reset:function(){return this._h=this._init.slice(0),this._buffer=[],this._length=0,this},update:function(t){"string"==typeof t&&(t=le.codec.utf8String.toBits(t));var e,n=this._buffer=le.bitArray.concat(this._buffer,t),i=this._length,r=this._length=i+le.bitArray.bitLength(t);for(e=512+i&-512;r>=e;e+=512)this._block(n.splice(0,16));return this},finalize:function(){var t,e=this._buffer,n=this._h;for(e=le.bitArray.concat(e,[le.bitArray.partial(1,1)]),t=e.length+2;15&t;t++)e.push(0);for(e.push(Math.floor(this._length/4294967296)),e.push(0|this._length);e.length;)this._block(e.splice(0,16));return this.reset(),n},_init:[],_key:[],_precompute:function(){function t(t){return 4294967296*(t-Math.floor(t))|0}var e,n=0,i=2;t:for(;64>n;i++){for(e=2;i>=e*e;e++)if(i%e===0)continue t;8>n&&(this._init[n]=t(Math.pow(i,.5))),this._key[n]=t(Math.pow(i,1/3)),n++}},_block:function(t){var e,n,i,r,o=t.slice(0),s=this._h,a=this._key,u=s[0],c=s[1],l=s[2],p=s[3],h=s[4],d=s[5],f=s[6],m=s[7];for(e=0;64>e;e++)16>e?n=o[e]:(i=o[e+1&15],r=o[e+14&15],n=o[15&e]=(i>>>7^i>>>18^i>>>3^i<<25^i<<14)+(r>>>17^r>>>19^r>>>10^r<<15^r<<13)+o[15&e]+o[e+9&15]|0),n=n+m+(h>>>6^h>>>11^h>>>25^h<<26^h<<21^h<<7)+(f^h&(d^f))+a[e],m=f,f=d,d=h,h=p+n|0,p=l,l=c,c=u,u=n+(c&l^p&(c^l))+(c>>>2^c>>>13^c>>>22^c<<30^c<<19^c<<10)|0;s[0]=s[0]+u|0,s[1]=s[1]+c|0,s[2]=s[2]+l|0,s[3]=s[3]+p|0,s[4]=s[4]+h|0,s[5]=s[5]+d|0,s[6]=s[6]+f|0,s[7]=s[7]+m|0}},le.random={randomWords:function(t,e){var n,i,r=[],o=this.isReady(e);if(o===this._NOT_READY)throw new le.exception.notReady("generator isn't seeded");for(o&this._REQUIRES_RESEED&&this._reseedFromPools(!(o&this._READY)),n=0;t>n;n+=4)(n+1)%this._MAX_WORDS_PER_BURST===0&&this._gate(),i=this._gen4words(),r.push(i[0],i[1],i[2],i[3]);return this._gate(),r.slice(0,t)},setDefaultParanoia:function(t){this._defaultParanoia=t},addEntropy:function(t,e,n){n=n||"user";var i,r,o,s=(new Date).valueOf(),a=this._robins[n],u=this.isReady(),c=0;switch(i=this._collectorIds[n],void 0===i&&(i=this._collectorIds[n]=this._collectorIdNext++),void 0===a&&(a=this._robins[n]=0),this._robins[n]=(this._robins[n]+1)%this._pools.length,typeof t){case"number":void 0===e&&(e=1),this._pools[a].update([i,this._eventId++,1,e,s,1,0|t]);break;case"object":var l=Object.prototype.toString.call(t);if("[object Uint32Array]"===l){for(o=[],r=0;r<t.length;r++)o.push(t[r]);t=o}else for("[object Array]"!==l&&(c=1),r=0;r<t.length&&!c;r++)"number"!=typeof t[r]&&(c=1);if(!c){if(void 0===e)for(e=0,r=0;r<t.length;r++)for(o=t[r];o>0;)e++,o>>>=1;this._pools[a].update([i,this._eventId++,2,e,s,t.length].concat(t))}break;case"string":void 0===e&&(e=t.length),this._pools[a].update([i,this._eventId++,3,e,s,t.length]),this._pools[a].update(t);break;default:c=1}if(c)throw new le.exception.bug("random: addEntropy only supports number, array of numbers or string");this._poolEntropy[a]+=e,this._poolStrength+=e,u===this._NOT_READY&&(this.isReady()!==this._NOT_READY&&this._fireEvent("seeded",Math.max(this._strength,this._poolStrength)),this._fireEvent("progress",this.getProgress()))},isReady:function(t){var e=this._PARANOIA_LEVELS[void 0!==t?t:this._defaultParanoia];return this._strength&&this._strength>=e?this._poolEntropy[0]>this._BITS_PER_RESEED&&(new Date).valueOf()>this._nextReseed?this._REQUIRES_RESEED|this._READY:this._READY:this._poolStrength>=e?this._REQUIRES_RESEED|this._NOT_READY:this._NOT_READY},getProgress:function(t){var e=this._PARANOIA_LEVELS[t?t:this._defaultParanoia];return this._strength>=e?1:this._poolStrength>e?1:this._poolStrength/e},startCollectors:function(){if(!this._collectorsStarted){if(window.addEventListener)window.addEventListener("load",this._loadTimeCollector,!1),window.addEventListener("mousemove",this._mouseCollector,!1);else{if(!document.attachEvent)throw new le.exception.bug("can't attach event");document.attachEvent("onload",this._loadTimeCollector),document.attachEvent("onmousemove",this._mouseCollector)}this._collectorsStarted=!0}},stopCollectors:function(){this._collectorsStarted&&(window.removeEventListener?(window.removeEventListener("load",this._loadTimeCollector,!1),window.removeEventListener("mousemove",this._mouseCollector,!1)):window.detachEvent&&(window.detachEvent("onload",this._loadTimeCollector),window.detachEvent("onmousemove",this._mouseCollector)),this._collectorsStarted=!1)},addEventListener:function(t,e){this._callbacks[t][this._callbackI++]=e},removeEventListener:function(t,e){var n,i,r=this._callbacks[t],o=[];for(i in r)r.hasOwnProperty(i)&&r[i]===e&&o.push(i);for(n=0;n<o.length;n++)i=o[n],delete r[i]},_pools:[new le.hash.sha256],_poolEntropy:[0],_reseedCount:0,_robins:{},_eventId:0,_collectorIds:{},_collectorIdNext:0,_strength:0,_poolStrength:0,_nextReseed:0,_key:[0,0,0,0,0,0,0,0],_counter:[0,0,0,0],_cipher:void 0,_defaultParanoia:6,_collectorsStarted:!1,_callbacks:{progress:{},seeded:{}},_callbackI:0,_NOT_READY:0,_READY:1,_REQUIRES_RESEED:2,_MAX_WORDS_PER_BURST:65536,_PARANOIA_LEVELS:[0,48,64,96,128,192,256,384,512,768,1024],_MILLISECONDS_PER_RESEED:3e4,_BITS_PER_RESEED:80,_gen4words:function(){for(var t=0;4>t&&(this._counter[t]=this._counter[t]+1|0,!this._counter[t]);t++);return this._cipher.encrypt(this._counter)},_gate:function(){this._key=this._gen4words().concat(this._gen4words()),this._cipher=new le.cipher.aes(this._key)},_reseed:function(t){this._key=le.hash.sha256.hash(this._key.concat(t)),this._cipher=new le.cipher.aes(this._key);for(var e=0;4>e&&(this._counter[e]=this._counter[e]+1|0,!this._counter[e]);e++);},_reseedFromPools:function(t){var e,n=[],i=0;for(this._nextReseed=n[0]=(new Date).valueOf()+this._MILLISECONDS_PER_RESEED,e=0;16>e;e++)n.push(4294967296*Math.random()|0);for(e=0;e<this._pools.length&&(n=n.concat(this._pools[e].finalize()),i+=this._poolEntropy[e],this._poolEntropy[e]=0,t||!(this._reseedCount&1<<e));e++);this._reseedCount>=1<<this._pools.length&&(this._pools.push(new le.hash.sha256),this._poolEntropy.push(0)),this._poolStrength-=i,i>this._strength&&(this._strength=i),this._reseedCount++,this._reseed(n)},_mouseCollector:function(t){var e=t.x||t.clientX||t.offsetX||0,n=t.y||t.clientY||t.offsetY||0;le.random.addEntropy([e,n],2,"mouse")},_loadTimeCollector:function(){le.random.addEntropy((new Date).valueOf(),2,"loadtime")},_fireEvent:function(t,e){var n,i=le.random._callbacks[t],r=[];for(n in i)i.hasOwnProperty(n)&&r.push(i[n]);for(n=0;n<r.length;n++)r[n](e)}},function(){try{var t=new Uint32Array(32);crypto.getRandomValues(t),le.random.addEntropy(t,1024,"crypto.getRandomValues")}catch(e){}}(),function(){for(var t in le.beware)le.beware.hasOwnProperty(t)&&le.beware[t]()}();var pe={sjcl:le,version:"1.3.10"};pe.generateAesKey=function(){return{key:le.random.randomWords(8,0),encrypt:function(t){return this.encryptWithIv(t,le.random.randomWords(4,0))},encryptWithIv:function(t,e){var n=new le.cipher.aes(this.key),i=le.codec.utf8String.toBits(t),r=le.mode.cbc.encrypt(n,i,e),o=le.bitArray.concat(e,r);return le.codec.base64.fromBits(o)}}},pe.create=function(t){return new pe.EncryptionClient(t)},pe.EncryptionClient=function(t){var i=this,o=[];i.publicKey=t,i.version=pe.version;var s=function(t,e){var n,i,r;n=document.createElement(t);for(i in e)e.hasOwnProperty(i)&&(r=e[i],n.setAttribute(i,r));return n},a=function(t){return window.jQuery&&t instanceof jQuery?t[0]:t.nodeType&&1===t.nodeType?t:document.getElementById(t)},u=function(t){var e,n,i,r,o=[];if("INTEGER"===t.typeName()&&(e=t.posContent(),n=t.posEnd(),i=t.stream.hexDump(e,n).replace(/[ \n]/g,""),o.push(i)),null!==t.sub)for(r=0;r<t.sub.length;r++)o=o.concat(u(t.sub[r]));return o},c=function(t){var e,n,i=[],r=t.children;for(n=0;n<r.length;n++)e=r[n],1===e.nodeType&&e.attributes["data-encrypted-name"]?i.push(e):e.children&&e.children.length>0&&(i=i.concat(c(e)));return i},l=function(){var n,i,o,s,a,c;try{a=r(t),n=e.decode(a)}catch(l){throw"Invalid encryption key. Please use the key labeled 'Client-Side Encryption Key'"}if(o=u(n),2!==o.length)throw"Invalid encryption key. Please use the key labeled 'Client-Side Encryption Key'";return s=o[0],i=o[1],c=new $,c.setPublic(s,i),c},p=function(){return{key:le.random.randomWords(8,0),sign:function(t){var e=new le.misc.hmac(this.key,le.hash.sha256),n=e.encrypt(t);return le.codec.base64.fromBits(n)}}};i.encrypt=function(t){var e=l(),r=pe.generateAesKey(),o=p(),s=r.encrypt(t),a=o.sign(le.codec.base64.toBits(s)),u=le.bitArray.concat(r.key,o.key),c=le.codec.base64.fromBits(u),h=e.encrypt(c),d="$bt4|javascript_"+i.version.replace(/\./g,"_")+"$",f=null;return h&&(f=n(h)),d+f+"$"+s+"$"+a},i.encryptForm=function(t){var e,n,r,u,l,p;for(t=a(t),p=c(t);o.length>0;){try{t.removeChild(o[0])}catch(h){}o.splice(0,1)}for(l=0;l<p.length;l++)e=p[l],r=e.getAttribute("data-encrypted-name"),n=i.encrypt(e.value),e.removeAttribute("name"),u=s("input",{value:n,type:"hidden",name:r}),o.push(u),t.appendChild(u)},i.onSubmitEncryptForm=function(t,e){var n;t=a(t),n=function(n){return i.encryptForm(t),e?e(n):n},window.jQuery?window.jQuery(t).submit(n):t.addEventListener?t.addEventListener("submit",n,!1):t.attachEvent&&t.attachEvent("onsubmit",n)},i.formEncrypter={encryptForm:i.encryptForm,extractForm:a,onSubmitEncryptForm:i.onSubmitEncryptForm},le.random.startCollectors()},window.Braintree=pe
2
- }(),!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.braintree=t()}}(function(){var t;return function e(t,n,i){function r(s,a){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[s]={exports:{}};t[s][0].call(l.exports,function(e){var n=t[s][1][e];return r(n?n:e)},l,l.exports,e,t,n,i)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s<i.length;s++)r(i[s]);return r}({1:[function(t,e){(function(n){"use strict";function i(t,e,i){if(!u.hasOwnProperty(e))throw new Error(e+" is an unsupported integration");i=i||{},o._getConfiguration({enableCORS:i.enableCORS||!1,clientToken:t},function(t,o){var s;return t?(s=p(i)(c.ROOT_ERROR_CALLBACK,l),void s({message:t.errors})):void new u[e]({channel:h(),gatewayConfiguration:o,integrationType:e,merchantConfiguration:i,analyticsConfiguration:{sdkVersion:"braintree/web/"+r,merchantAppId:n.location.host}})})}var r="2.14.2",o=t("braintree-api"),s=t("braintree-paypal"),a=t("braintree-dropin"),u=t("./integrations"),c=t("./constants"),l=t("./lib/fallback-error-handler"),p=t("./lib/lookup-callback-for"),h=t("braintree-utilities").uuid;e.exports={api:o,cse:n.Braintree,paypal:s,dropin:a,hostedFields:{VERSION:t("hosted-fields").VERSION},setup:i,VERSION:r}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./constants":440,"./integrations":445,"./lib/fallback-error-handler":447,"./lib/lookup-callback-for":449,"braintree-api":21,"braintree-dropin":236,"braintree-paypal":344,"braintree-utilities":372,"hosted-fields":377}],2:[function(t,e){(function(n){"use strict";function i(t){var e=t.analyticsConfiguration||{},i=n.braintree?n.braintree.VERSION:null,r=i?"braintree/web/"+i:"";return{sdkVersion:e.sdkVersion||r,merchantAppId:e.merchantAppId||n.location.host}}function r(t){var e,n,r;this.attrs={},t.hasOwnProperty("sharedCustomerIdentifier")&&(this.attrs.sharedCustomerIdentifier=t.sharedCustomerIdentifier),e=a(t.clientToken),r=i(t),this.driver=t.driver||m({enableCORS:g(t)}),this.analyticsUrl=e.analytics?e.analytics.url:void 0,this.clientApiUrl=e.clientApiUrl,this.customerId=t.customerId,this.challenges=e.challenges,this.integration=t.integration||"",this.sdkVersion=r.sdkVersion,this.merchantAppId=r.merchantAppId,n=s.create(this,{container:t.container,clientToken:e}),this.verify3DS=o.bind(n.verify,n),this.attrs.sharedCustomerIdentifierType=t.sharedCustomerIdentifierType,e.merchantAccountId&&(this.attrs.merchantAccountId=e.merchantAccountId),t.clientKey?this.attrs.clientKey=t.clientKey:e.authorizationFingerprint&&(this.attrs.authorizationFingerprint=e.authorizationFingerprint),this.requestTimeout=t.hasOwnProperty("timeout")?t.timeout:6e4}var o=t("braintree-utilities"),s=t("braintree-3ds"),a=t("./parse-client-token"),u=t("./util"),c=t("./sepa-mandate"),l=t("./europe-bank-account"),p=t("./credit-card"),h=t("./coinbase-account"),d=t("./paypal-account"),f=t("./normalize-api-fields").normalizeCreditCardFields,m=t("./request/choose-driver"),g=t("./should-enable-cors"),y=t("./constants");r.prototype.getCreditCards=function(t){this.driver.get(u.joinUrlFragments([this.clientApiUrl,"v1","payment_methods"]),this.attrs,function(t){var e=0,n=t.paymentMethods.length,i=[];for(e;n>e;e++)i.push(new p(t.paymentMethods[e]));return i},t,this.requestTimeout)},r.prototype.tokenizeCoinbase=function(t,e){t.options={validate:!1},this.addCoinbase(t,function(t,n){t?e(t,null):n&&n.nonce?e(t,n):e("Unable to tokenize coinbase account.",null)})},r.prototype.tokenizePayPalAccount=function(t,e){t.options={validate:!1},this.addPayPalAccount(t,function(t,n){t?e(t,null):n&&n.nonce?e(null,n):e("Unable to tokenize paypal account.",null)})},r.prototype.tokenizeCard=function(t,e){t.options={validate:!1},this.addCreditCard(t,function(t,n){n&&n.nonce?e(t,n.nonce,{type:n.type,details:n.details}):e("Unable to tokenize card.",null)})},r.prototype.lookup3DS=function(t,e){var n=u.joinUrlFragments([this.clientApiUrl,"v1/payment_methods",t.nonce,"three_d_secure/lookup"]),i=u.mergeOptions(this.attrs,{amount:t.amount});this.driver.post(n,i,function(t){return t},e,this.requestTimeout)},r.prototype.createSEPAMandate=function(t,e){var n=u.mergeOptions(this.attrs,{sepaMandate:t});this.driver.post(u.joinUrlFragments([this.clientApiUrl,"v1","sepa_mandates.json"]),n,function(t){return{sepaMandate:new c(t.europeBankAccounts[0].sepaMandates[0]),sepaBankAccount:new l(t.europeBankAccounts[0])}},e,this.requestTimeout)},r.prototype.getSEPAMandate=function(t,e){var n=u.mergeOptions(this.attrs,t);this.driver.get(u.joinUrlFragments([this.clientApiUrl,"v1","sepa_mandates.json"]),n,function(t){return{sepaMandate:new c(t.sepaMandates[0])}},e,this.requestTimeout)},r.prototype.addCoinbase=function(t,e){var n;delete t.share,n=u.mergeOptions(this.attrs,{coinbaseAccount:t,_meta:{integration:this.integration||"custom",source:"coinbase"}}),this.driver.post(u.joinUrlFragments([this.clientApiUrl,"v1","payment_methods/coinbase_accounts"]),n,function(t){return new h(t.coinbaseAccounts[0])},e,this.requestTimeout)},r.prototype.addPayPalAccount=function(t,e){var n;delete t.share,n=u.mergeOptions(this.attrs,{paypalAccount:t,_meta:{integration:this.integration||"paypal",source:"paypal"}}),this.driver.post(u.joinUrlFragments([this.clientApiUrl,"v1","payment_methods","paypal_accounts"]),n,function(t){return new d(t.paypalAccounts[0])},e,this.requestTimeout)},r.prototype.addCreditCard=function(t,e){var n,i,r=t.share;delete t.share,i=f(t),n=u.mergeOptions(this.attrs,{share:r,creditCard:i,_meta:{integration:this.integration||"custom",source:"form"}}),this.driver.post(u.joinUrlFragments([this.clientApiUrl,"v1","payment_methods/credit_cards"]),n,function(t){return new p(t.creditCards[0])},e,this.requestTimeout)},r.prototype.sendAnalyticsEvents=function(t,e){var i,r,o=this.analyticsUrl,s=[];if(t=u.isArray(t)?t:[t],!o)return void(e&&e.apply(null,[null,{}]));for(r in t)t.hasOwnProperty(r)&&s.push({kind:t[r]});i=u.mergeOptions(this.attrs,{braintree_library_version:this.sdkVersion,analytics:s,_meta:{merchantAppId:this.merchantAppId,platform:"web",platformVersion:n.navigator.userAgent,integrationType:this.integration,sdkVersion:this.sdkVersion}}),this.driver.post(o,i,function(t){return t},e,y.ANALYTICS_TIMEOUT_MS)},r.prototype.decryptBrowserswitchPayload=function(t,e){var n=u.mergeOptions(this.attrs,{asymmetric_encrypted_payload:t}),i=u.joinUrlFragments([this.clientApiUrl,"/v1/paypal_browser_switch/decrypt"]);this.driver.post(i,n,function(t){return t},e,this.requestTimeout)},r.prototype.encryptBrowserswitchReturnPayload=function(t,e,n){var i=u.mergeOptions(this.attrs,{payload:t,aesKey:e}),r=u.joinUrlFragments([this.clientApiUrl,"/v1/paypal_browser_switch/encrypt"]);this.driver.post(r,i,function(t){return t},n,this.requestTimeout)},r.prototype.exchangePaypalTokenForConsentCode=function(t,e){var n=u.mergeOptions(this.attrs,t);this.attrs.merchantAccountId&&(n.merchant_account_id=this.attrs.merchantAccountId);var i=u.joinUrlFragments([this.clientApiUrl,"/v1/paypal_account_service/merchant_consent"]);this.driver.post(i,n,function(t){return t},e,this.requestTimeout)},r.prototype.getAmexRewardsBalance=function(t,e){var n=u.mergeOptions(this.attrs,t);n.nonce&&(n.payment_method_nonce=n.nonce,delete n.nonce),this.driver.get(u.joinUrlFragments([this.clientApiUrl,"v1/payment_methods/amex_rewards_balance"]),n,function(t){return t},e,this.requestTimeout)},e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./coinbase-account":3,"./constants":4,"./credit-card":5,"./europe-bank-account":6,"./normalize-api-fields":8,"./parse-client-token":9,"./paypal-account":10,"./request/choose-driver":13,"./sepa-mandate":18,"./should-enable-cors":19,"./util":20,"braintree-3ds":29,"braintree-utilities":43}],3:[function(t,e){"use strict";function n(t){var e,n;for(e=0;e<i.length;e++)n=i[e],this[n]=t[n]}var i=["nonce","type","description","details"];e.exports=n},{}],4:[function(t,e){e.exports={apiUrls:{production:"https://api.braintreegateway.com:443",sandbox:"https://api.sandbox.braintreegateway.com:443"},errors:{UNKNOWN_ERROR:"Unknown error",INVALID_TIMEOUT:"Timeout must be a number"},ANALYTICS_TIMEOUT_MS:4e3}},{}],5:[function(t,e){"use strict";function n(t){var e,n;for(e=0;e<i.length;e++)n=i[e],this[n]=t[n]}var i=["billingAddress","branding","createdAt","createdAtMerchant","createdAtMerchantName","details","isLocked","lastUsedAt","lastUsedAtMerchant","lastUsedAtMerchantName","lastUsedByCurrentMerchant","nonce","securityQuestions","type"];e.exports=n},{}],6:[function(t,e){"use strict";function n(t){var e,n=["bic","maskedIBAN","nonce","accountHolderName"],i=0;for(i=0;i<n.length;i++)e=n[i],this[e]=t[e]}e.exports=n},{}],7:[function(t,e){"use strict";function n(t){var e=t.split("_"),n=e[0],i=e.slice(2).join("_");return{merchantId:i,environment:n}}function i(t,e){var i,c,l,p=s({enableCORS:a(t)}),h=t.clientKey,d={};h?(d.clientKey=h,c=n(h),i=u.apiUrls[c.environment]+"/merchants/"+c.merchantId+"/client_api/v1/configuration"):(l=r(t.clientToken),l.authorizationFingerprint&&(d.authorizationFingerprint=l.authorizationFingerprint,i=l.configUrl)),p.get(i,d,function(t){return o.mergeOptions(l,t)},e,t.timeout)}var r=t("./parse-client-token"),o=t("./util"),s=t("./request/choose-driver"),a=t("./should-enable-cors"),u=t("./constants");e.exports=i},{"./constants":4,"./parse-client-token":9,"./request/choose-driver":13,"./should-enable-cors":19,"./util":20}],8:[function(t,e){"use strict";function n(t){var e,n={billingAddress:t.billingAddress||{}};for(e in t)if(t.hasOwnProperty(e))switch(e.replace(/_/,"").toLowerCase()){case"postalcode":case"countryname":case"countrycodenumeric":case"countrycodealpha2":case"countrycodealpha3":case"region":case"extendedaddress":case"locality":case"firstname":case"lastname":case"company":case"streetaddress":n.billingAddress[e]=t[e];break;default:n[e]=t[e]}return n}e.exports={normalizeCreditCardFields:n}},{}],9:[function(t,e){"use strict";function n(t){var e;if(!t)throw new Error("Braintree API Client Misconfigured: clientToken required.");if("object"==typeof t&&null!==t)e=t;else{try{t=window.atob(t)}catch(n){}try{e=JSON.parse(t)}catch(r){throw new Error("Braintree API Client Misconfigured: clientToken is not valid JSON.")}}if(!e.hasOwnProperty("clientApiUrl")||!i.isWhitelistedDomain(e.clientApiUrl))throw new Error("Braintree API Client Misconfigured: the clientApiUrl provided in the clientToken is invalid.");return e}var i=t("braintree-utilities");t("./polyfill"),e.exports=n},{"./polyfill":11,"braintree-utilities":43}],10:[function(t,e){"use strict";function n(t){var e,n;for(e=0;e<i.length;e++)n=i[e],this[n]=t[n]}var i=["nonce","type","description","details"];e.exports=n},{}],11:[function(t,e){(function(t){"use strict";var n=function(t){var e=new RegExp("^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})([=]{1,2})?$"),n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",i="";if(!e.test(t))throw new Error("Non base64 encoded input passed to window.atob polyfill");var r=0;do{var o=n.indexOf(t.charAt(r++)),s=n.indexOf(t.charAt(r++)),a=n.indexOf(t.charAt(r++)),u=n.indexOf(t.charAt(r++)),c=(63&o)<<2|s>>4&3,l=(15&s)<<4|a>>2&15,p=(3&a)<<6|63&u;i+=String.fromCharCode(c)+(l?String.fromCharCode(l):"")+(p?String.fromCharCode(p):"")}while(r<t.length);return i};t.atob=t.atob||n,e.exports={atobPolyfill:n}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],12:[function(t,e){(function(n){"use strict";function i(){return p?new XMLHttpRequest:new XDomainRequest}function r(t,e,n,i,r){var o=a.createURLParams(t,e);s("GET",o,null,n,i,r)}function o(t,e,n,i,r){s("POST",t,e,n,i,r)}function s(t,e,n,r,o,s){var a,h,d=i();o=o||function(){},p?d.onreadystatechange=function(){4===d.readyState&&(a=d.status,h=c(d.responseText),a>=400||0===a?o.call(null,h||{errors:l.errors.UNKNOWN_ERROR},null):a>0&&o.call(null,null,r(h)))}:(d.onload=function(){o.call(null,null,r(c(d.responseText)))},d.onerror=function(){o.call(null,d.responseText,null)},d.onprogress=function(){},d.ontimeout=function(){o.call(null,{errors:l.errors.UNKNOWN_ERROR},null)}),d.open(t,e,!0),d.timeout=null==s?6e4:s,p&&"POST"===t&&d.setRequestHeader("Content-Type","application/json"),setTimeout(function(){d.send(u(t,n))},0)}var a=t("../util"),u=t("./prep-body"),c=t("./parse-body"),l=t("../constants"),p=n.XMLHttpRequest&&"withCredentials"in new n.XMLHttpRequest;e.exports={get:r,post:o}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../constants":4,"../util":20,"./parse-body":16,"./prep-body":17}],13:[function(t,e){"use strict";function n(t){var e=o.getUserAgent(),n=!(o.isHTTP()&&/(MSIE\s(8|9))|(Phantom)/.test(e));return t=t||{},t.enableCORS&&n?r:i}var i=t("./jsonp-driver"),r=t("./ajax-driver"),o=t("../util");e.exports=n},{"../util":20,"./ajax-driver":12,"./jsonp-driver":14}],14:[function(t,e){"use strict";function n(t,e){return t.status>=400?[t,null]:[null,e(t)]}function i(){}function r(t,e,r,o,s,a){var l;s=s||i,null==a&&(a=6e4),l=o(t,e,function(t,e){c[e]&&(clearTimeout(c[e]),s.apply(null,n(t,function(t){return r(t)})))}),"number"==typeof a?c[l]=setTimeout(function(){c[l]=null,s.apply(null,[{errors:u.errors.UNKNOWN_ERROR},null])},a):s.apply(null,[{errors:u.errors.INVALID_TIMEOUT},null])}function o(t,e,n,i,o){e._method="POST",r(t,e,n,a.get,i,o)}function s(t,e,n,i,o){r(t,e,n,a.get,i,o)}var a=t("./jsonp"),u=t("../constants"),c=[];e.exports={get:s,post:o}},{"../constants":4,"./jsonp":15}],15:[function(t,e){(function(n){"use strict";function i(t,e){var n=document.createElement("script"),i=!1;n.src=t,n.async=!0;var r=e||c.error;"function"==typeof r&&(n.onerror=function(e){r({url:t,event:e})}),n.onload=n.onreadystatechange=function(){i||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(i=!0,n.onload=n.onreadystatechange=null,n&&n.parentNode&&n.parentNode.removeChild(n))},s||(s=document.getElementsByTagName("head")[0]),s.appendChild(n)}function r(t,e,n,r){var o,s;return r=r||c.callbackName||"callback",s=r+"_json"+a.generateUUID(),e[r]=s,o=a.createURLParams(t,e),u[s]=function(t){n(t,s);try{delete u[s]}catch(e){}u[s]=null},i(o),s}function o(t){c=t}var s,a=t("../util"),u=n,c={};e.exports={get:r,init:o}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../util":20}],16:[function(t,e){"use strict";e.exports=function(t){try{t=JSON.parse(t)}catch(e){}return t}},{}],17:[function(t,e){"use strict";var n=t("lodash.isstring");e.exports=function(t,e){if(!n(t))throw new Error("Method must be a string");return"get"!==t.toLowerCase()&&null!=e&&(e=n(e)?e:JSON.stringify(e)),e}},{"lodash.isstring":51}],18:[function(t,e){"use strict";function n(t){var e,n=0,i=["accountHolderName","bic","longFormURL","mandateReferenceNumber","maskedIBAN","shortForm"];for(n=0;n<i.length;n++)e=i[n],this[e]=t[e]}e.exports=n},{}],19:[function(t,e){"use strict";e.exports=function(t){return null!=t.enableCORS?t.enableCORS:t.merchantConfiguration?t.merchantConfiguration.enableCORS:!1}},{}],20:[function(t,e){(function(n){"use strict";function i(t){var e,n,i=[];for(n=0;n<t.length;n++)e=t[n],"/"===e.charAt(e.length-1)&&(e=e.substring(0,e.length-1)),"/"===e.charAt(0)&&(e=e.substring(1)),i.push(e);return i.join("/")}function r(t){return t&&"object"==typeof t&&"number"==typeof t.length&&"[object Array]"===Object.prototype.toString.call(t)||!1}function o(){return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=Math.floor(16*Math.random()),n="x"===t?e:3&e|8;return n.toString(16)})}function s(t,e){var n,i={};for(n in t)t.hasOwnProperty(n)&&(i[n]=t[n]);for(n in e)e.hasOwnProperty(n)&&(i[n]=e[n]);return i}function a(t,e){var n,i,o,s=[];for(o in t)t.hasOwnProperty(o)&&(i=t[o],n=e?r(t)?e+"[]":e+"["+o+"]":o,s.push("object"==typeof i?a(i,n):encodeURIComponent(n)+"="+encodeURIComponent(i)));return s.join("&")}function u(t,e){return t=t||"",!p(e)&&h(e)&&(t+=-1===t.indexOf("?")?"?":"",t+=-1!==t.indexOf("=")?"&":"",t+=a(e)),t}function c(){return n.navigator.userAgent}function l(){return"http:"===n.location.protocol}var p=t("lodash.isempty"),h=t("lodash.isobject");e.exports={joinUrlFragments:i,isArray:r,generateUUID:o,mergeOptions:s,stringify:a,createURLParams:u,getUserAgent:c,isHTTP:l}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"lodash.isempty":44,"lodash.isobject":50}],21:[function(t,e){"use strict";function n(t){return new i(t)}var i=t("./lib/client"),r=t("./lib/util"),o=t("./lib/parse-client-token"),s=t("./lib/get-configuration");e.exports={Client:i,configure:n,util:r,parseClientToken:o,_getConfiguration:s}},{"./lib/client":2,"./lib/get-configuration":7,"./lib/parse-client-token":9,"./lib/util":20}],22:[function(t,e){"use strict";function n(t,e){if(e=e||"["+t+"] is not a valid DOM Element",t&&t.nodeType&&1===t.nodeType)return t;if(t&&window.jQuery&&(t instanceof jQuery||"jquery"in Object(t))&&0!==t.length)return t[0];if("string"==typeof t&&document.getElementById(t))return document.getElementById(t);throw new Error(e)}e.exports={normalizeElement:n}},{}],23:[function(t,e){"use strict";function n(t,e,n,i){t.addEventListener?t.addEventListener(e,n,i):t.attachEvent&&t.attachEvent("on"+e,n)}function i(t,e,n,i){t.removeEventListener?t.removeEventListener(e,n,i):t.detachEvent&&t.detachEvent("on"+e,n)}e.exports={addEventListener:n,removeEventListener:i}},{}],24:[function(t,e){"use strict";function n(t){return"[object Function]"===r.call(t)}function i(t,e){return function(){t.apply(e,arguments)}}var r=Object.prototype.toString;e.exports={bind:i,isFunction:n}},{}],25:[function(t,e){"use strict";function n(){return"https:"===window.location.protocol}function i(t){switch(t){case null:case void 0:return"";case!0:return"1";case!1:return"0";default:return encodeURIComponent(t)}}function r(t,e){var n,o,s=[];for(o in t)if(t.hasOwnProperty(o)){var a=t[o];n=e?e+"["+o+"]":o,"object"==typeof a?s.push(r(a,n)):void 0!==a&&null!==a&&s.push(i(n)+"="+i(a))}return s.join("&")}function o(t){for(var e={},n=t.split("&"),i=0;i<n.length;i++){var r=n[i].split("="),o=r[0],s=decodeURIComponent(r[1]);e[o]=s}return e}function s(t){var e=t.split("?");return 2!==e.length?{}:o(e[1])}e.exports={isBrowserHttps:n,makeQueryString:r,decodeQueryString:o,getParams:s}},{}],26:[function(t,e){var n=t("./lib/dom"),i=t("./lib/url"),r=t("./lib/fn"),o=t("./lib/events");e.exports={normalizeElement:n.normalizeElement,isBrowserHttps:i.isBrowserHttps,makeQueryString:i.makeQueryString,decodeQueryString:i.decodeQueryString,getParams:i.getParams,removeEventListener:o.removeEventListener,addEventListener:o.addEventListener,bind:r.bind,isFunction:r.isFunction}},{"./lib/dom":22,"./lib/events":23,"./lib/fn":24,"./lib/url":25}],27:[function(t,e){"use strict";function n(t,e){var n=window.getComputedStyle?getComputedStyle(t):t.currentStyle;return n[e]}function i(){return{html:{height:o.style.height||"",overflow:n(o,"overflow"),position:n(o,"position")},body:{height:s.style.height||"",overflow:n(s,"overflow")}}}function r(t,e){this.assetsUrl=t,this.container=e||document.body,this.iframe=null,o=document.documentElement,s=document.body,this.merchantPageDefaultStyles=i()}var o,s,a=t("braintree-utilities"),u=t("../shared/receiver"),c="1.3.0";r.prototype.get=function(t,e){var n=this,i=this.constructAuthorizationURL(t);this.container&&a.isFunction(this.container)?this.container(i+"&no_style=1"):this.insertIframe(i),new u(function(t){a.isFunction(n.container)||n.removeIframe(),e(t)})},r.prototype.removeIframe=function(){this.container&&this.container.nodeType&&1===this.container.nodeType?this.container.removeChild(this.iframe):this.container&&window.jQuery&&this.container instanceof jQuery?$(this.iframe,this.container).remove():"string"==typeof this.container&&document.getElementById(this.container).removeChild(this.iframe),this.unlockMerchantWindowSize()},r.prototype.insertIframe=function(t){var e=document.createElement("iframe");if(e.src=t,this.applyStyles(e),this.lockMerchantWindowSize(),this.container&&this.container.nodeType&&1===this.container.nodeType)this.container.appendChild(e);else if(this.container&&window.jQuery&&this.container instanceof jQuery&&0!==this.container.length)this.container.append(e);else{if("string"!=typeof this.container||!document.getElementById(this.container))throw new Error("Unable to find valid container for iframe.");document.getElementById(this.container).appendChild(e)}this.iframe=e},r.prototype.applyStyles=function(t){t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.height="100%",t.style.width="100%",t.setAttribute("frameborder","0"),t.setAttribute("allowTransparency","true"),t.style.border="0",t.style.zIndex="99999"},r.prototype.lockMerchantWindowSize=function(){o.style.overflow="hidden",s.style.overflow="hidden",s.style.height="100%"},r.prototype.unlockMerchantWindowSize=function(){var t=this.merchantPageDefaultStyles;s.style.height=t.body.height,s.style.overflow=t.body.overflow,o.style.overflow=t.html.overflow},r.prototype.constructAuthorizationURL=function(t){var e,n=window.location.href;return n.indexOf("#")>-1&&(n=n.split("#")[0]),e=a.makeQueryString({acsUrl:t.acsUrl,pareq:t.pareq,termUrl:t.termUrl+"&three_d_secure_version="+c,md:t.md,parentUrl:n}),this.assetsUrl+"/3ds/"+c+"/html/style_frame?"+e},e.exports=r},{"../shared/receiver":34,"braintree-utilities":26}],28:[function(t,e){"use strict";function n(){}function i(t,e){e=e||{},this.clientToken=e.clientToken,this.container=e.container,this.api=t,this.nonce=null,this._loader=null,this._boundHandleUserClose=r.bind(this._handleUserClose,this)}var r=t("braintree-utilities"),o=t("./authorization_service"),s=t("./loader");i.prototype.verify=function(t,e){if(!r.isFunction(e))throw this.api.sendAnalyticsEvents("3ds.web.no_callback"),new Error("No suitable callback argument was given");r.isFunction(t.onUserClose)&&(this._onUserClose=t.onUserClose),r.isFunction(t.onLookupComplete)&&(this._onLookupComplete=t.onLookupComplete),(void 0===t.useDefaultLoader||t.useDefaultLoader===!0)&&this._createDefaultLoader();var n={nonce:"",amount:t.amount},i=t.creditCard;if("string"==typeof i)n.nonce=i,this.api.sendAnalyticsEvents("3ds.web.verify.nonce"),this.startVerification(n,e);else{var o=this,s=function(t,i){return t?(o._removeDefaultLoader(),e(t)):(n.nonce=i,void o.startVerification(n,e))};this.api.sendAnalyticsEvents("3ds.web.verify.credit_card"),this.api.tokenizeCard(i,s)}},i.prototype.startVerification=function(t,e){this.api.lookup3DS(t,r.bind(this.handleLookupResponse(e),this))},i.prototype.handleLookupResponse=function(t){var e=this;return function(n,i){var s;this._onLookupComplete(),n?t(n.error):i.lookup&&i.lookup.acsUrl&&i.lookup.acsUrl.length>0?(e.nonce=i.paymentMethod.nonce,s=new o(this.clientToken.assetsUrl,this.container),s.get(i.lookup,r.bind(this.handleAuthenticationResponse(t),this)),this._detachListeners(),this._attachListeners()):(e.nonce=i.paymentMethod.nonce,t(null,{nonce:e.nonce,verificationDetails:i.threeDSecureInfo}))}},i.prototype.handleAuthenticationResponse=function(t){return function(e){var n,i=r.decodeQueryString(e);i.user_closed||(n=JSON.parse(i.auth_response),n.success?t(null,{nonce:n.paymentMethod.nonce,verificationDetails:n.threeDSecureInfo}):n.threeDSecureInfo&&n.threeDSecureInfo.liabilityShiftPossible?t(null,{nonce:this.nonce,verificationDetails:n.threeDSecureInfo}):t(n.error))}},i.prototype._attachListeners=function(){r.addEventListener(window,"message",this._boundHandleUserClose)},i.prototype._detachListeners=function(){r.removeEventListener(window,"message",this._boundHandleUserClose)},i.prototype._createDefaultLoader=function(){this._loader=new s,document.body.appendChild(this._loader.getElement())},i.prototype._removeDefaultLoader=function(){if(this._loader){var t=this._loader.getElement(),e=t.parentNode;e&&e.removeChild(t),this._loader.dispose(),this._loader=null}},i.prototype._handleUserClose=function(t){"user_closed=true"===t.data&&this._onUserClose()},i.prototype._onUserClose=n,i.prototype._onLookupComplete=function(){this._removeDefaultLoader()},e.exports=i},{"./authorization_service":27,"./loader":30,"braintree-utilities":26}],29:[function(t,e){"use strict";var n=t("./client");e.exports={create:function(t,e){var i=new n(t,e);return i}}},{"./client":28}],30:[function(t,e){"use strict";function n(){this._element=document.createElement("div"),this._element.style.cssText=this._cssDeclarations,this._display=null,this._initialize()}var i=t("./loader_display"),r=t("./loader_message"),o=t("./loader_spinner");n.prototype._cssDeclarations=["filter:progid:DXImageTransform.Microsoft.Gradient(StartColorStr=#7F000000, EndColorStr=#7F000000)","background-color: rgba(0, 0, 0, 0.5)","display: table","height: 100%","left: 0","position: fixed","right: 0","top: 0","width: 100%","z-index: 99999"].join(";"),n.prototype.getElement=function(){return this._element},n.prototype.dispose=function(){this._display.dispose(),this._display=null,this._element=null},n.prototype._initialize=function(){var t=new o,e=window.SVGElement&&window.SVGAnimateElement&&window.SVGAnimateTransformElement;e||(t=new r("Loading...")),this._display=new i(t),this.getElement().appendChild(this._display.getElement())},e.exports=n},{"./loader_display":31,"./loader_message":32,"./loader_spinner":33}],31:[function(t,e){"use strict";function n(t){this._element=document.createElement("div"),this._element.style.cssText=this._cssDeclarations,this._displayObject=t,this._initialize()}n.prototype._cssDeclarations=["display: table-cell","vertical-align: middle"].join(";"),n.prototype.getElement=function(){return this._element},n.prototype.dispose=function(){this._displayObject.dispose(),this._displayObject=null,this._element=null},n.prototype._initialize=function(){this.getElement().appendChild(this._displayObject.getElement())},e.exports=n},{}],32:[function(t,e){"use strict";function n(t){this._element=document.createElement("div"),this._element.style.cssText=this._cssDeclarations,this._element.innerHTML=t}n.prototype._cssDeclarations=["color: #fff","font-family: Helvetica, sans-serif","font-size: 12px","text-align: center"].join(";"),n.prototype.getElement=function(){return this._element},n.prototype.dispose=function(){this._element=null},e.exports=n},{}],33:[function(t,e){"use strict";function n(){this._element=document.createElement("div"),this._element.style.cssText=this._cssDeclarations,this._element.innerHTML=this._markup}n.prototype._cssDeclarations=["height: 36px","margin-left: auto","margin-right: auto","width: 36px"].join(";"),n.prototype._markup=['<svg version="1.1" id="loader-1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"','width="100%" height="100%" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">',' <path fill="#FFF" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z">',' <animateTransform attributeType="xml"',' attributeName="transform"',' type="rotate"',' from="0 25 25"',' to="360 25 25"',' dur="780ms"',' repeatCount="indefinite"',' calcMode="spline"',' keySplines="0.44, 0.22, 0, 1"',' keyTimes="0;1"/>'," </path>","</svg>"].join(""),n.prototype.getElement=function(){return this._element},n.prototype.dispose=function(){this._element=null},e.exports=n},{}],34:[function(t,e){"use strict";function n(t){this.postMessageReceiver(t),this.hashChangeReceiver(t)}var i=t("braintree-utilities");n.prototype.postMessageReceiver=function(t){var e=this;this.wrappedCallback=function(n){var i=n.data;(/^(auth_response=)/.test(i)||"user_closed=true"===i)&&(t(i),e.stopListening())},i.addEventListener(window,"message",this.wrappedCallback)},n.prototype.hashChangeReceiver=function(t){var e,n=window.location.hash,i=this;this.poll=setInterval(function(){e=window.location.hash,e.length>0&&e!==n&&(i.stopListening(),e=e.substring(1,e.length),t(e),window.location.hash=n.length>0?n:"")},10)},n.prototype.stopListening=function(){clearTimeout(this.poll),i.removeEventListener(window,"message",this.wrappedCallback)},e.exports=n},{"braintree-utilities":26}],35:[function(t,e){"use strict";var n,i=Array.prototype.indexOf;n=i?function(t,e){return t.indexOf(e)}:function(t,e){for(var n=0,i=t.length;i>n;n++)if(t[n]===e)return n;return-1},e.exports={indexOf:n}},{}],36:[function(t,e){"use strict";function n(t){var e,n,i="";for(e=0;e<t.length;e++)i+="%",n=t[e].charCodeAt(0).toString(16).toUpperCase(),n.length<2&&(i+="0"),i+=n;return i}function i(t){return decodeURIComponent(n(atob(t)))}e.exports={decodeUtf8:i}},{}],37:[function(t,e,n){arguments[4][22][0].apply(n,arguments)},{dup:22}],38:[function(t,e){"use strict";function n(t,e,n,i){t.addEventListener?t.addEventListener(e,n,i||!1):t.attachEvent&&t.attachEvent("on"+e,n)}function i(t,e,n,i){t.removeEventListener?t.removeEventListener(e,n,i||!1):t.detachEvent&&t.detachEvent("on"+e,n)}function r(t){t.preventDefault?t.preventDefault():t.returnValue=!1}e.exports={addEventListener:n,removeEventListener:i,preventDefault:r}},{}],39:[function(t,e){"use strict";function n(t){return"[object Function]"===r.call(t)}function i(t,e){return function(){return t.apply(e,arguments)}}var r=Object.prototype.toString;e.exports={bind:i,isFunction:n}},{}],40:[function(t,e){"use strict";function n(t){var e,n,i,r,o=[{min:0,max:180,chars:7},{min:181,max:620,chars:14},{min:621,max:960,chars:22}];for(r=o.length,t=t||window.innerWidth,n=0;r>n;n++)i=o[n],t>=i.min&&t<=i.max&&(e=i.chars);return e||60}function i(t,e){var n,i;return-1===t.indexOf("@")?t:(t=t.split("@"),n=t[0],i=t[1],n.length>e&&(n=n.slice(0,e)+"..."),i.length>e&&(i="..."+i.slice(-e)),n+"@"+i)}e.exports={truncateEmail:i,getMaxCharLength:n}},{}],41:[function(t,e){"use strict";function n(){return"https:"===window.location.protocol}function i(t){switch(t){case null:case void 0:return"";case!0:return"1";case!1:return"0";default:return encodeURIComponent(t)}}function r(t,e){var n,o,s=[];for(o in t)if(t.hasOwnProperty(o)){var a=t[o];n=e?e+"["+o+"]":o,"object"==typeof a?s.push(r(a,n)):void 0!==a&&null!==a&&s.push(i(n)+"="+i(a))}return s.join("&")}function o(t){for(var e={},n=t.split("&"),i=0;i<n.length;i++){var r=n[i].split("="),o=r[0],s=decodeURIComponent(r[1]);e[o]=s}return e}function s(t){var e=t.split("?");return 2!==e.length?{}:o(e[1])}function a(t){if(t=t.toLowerCase(),!/^http/.test(t))return!1;c.href=t;var e=c.hostname.split("."),n=e.slice(-2).join(".");return-1===u.indexOf(l,n)?!1:!0}var u=t("./array"),c=document.createElement("a"),l=["paypal.com","braintreepayments.com","braintreegateway.com","localhost"];e.exports={isBrowserHttps:n,makeQueryString:r,decodeQueryString:o,getParams:s,isWhitelistedDomain:a}},{"./array":35}],42:[function(t,e){"use strict";function n(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0,n="x"===t?e:3&e|8;return n.toString(16)})}e.exports=n},{}],43:[function(t,e){var n=t("./lib/dom"),i=t("./lib/url"),r=t("./lib/fn"),o=t("./lib/events"),s=t("./lib/string"),a=t("./lib/array"),u=t("./lib/base64"),c=t("./lib/uuid");e.exports={string:s,array:a,normalizeElement:n.normalizeElement,isBrowserHttps:i.isBrowserHttps,makeQueryString:i.makeQueryString,decodeQueryString:i.decodeQueryString,getParams:i.getParams,isWhitelistedDomain:i.isWhitelistedDomain,removeEventListener:o.removeEventListener,addEventListener:o.addEventListener,preventDefault:o.preventDefault,bind:r.bind,isFunction:r.isFunction,base64ToUtf8:u.decodeUtf8,uuid:c}
3
- },{"./lib/array":35,"./lib/base64":36,"./lib/dom":37,"./lib/events":38,"./lib/fn":39,"./lib/string":40,"./lib/url":41,"./lib/uuid":42}],44:[function(t,e){function n(t){return!!t&&"object"==typeof t}function i(t){return function(e){return null==e?void 0:e[t]}}function r(t){return null!=t&&o(d(t))}function o(t){return"number"==typeof t&&t>-1&&t%1==0&&h>=t}function s(t){return null==t?!0:r(t)&&(u(t)||l(t)||a(t)||n(t)&&c(t.splice))?!t.length:!p(t).length}var a=t("lodash.isarguments"),u=t("lodash.isarray"),c=t("lodash.isfunction"),l=t("lodash.isstring"),p=t("lodash.keys"),h=9007199254740991,d=i("length");e.exports=s},{"lodash.isarguments":45,"lodash.isarray":46,"lodash.isfunction":47,"lodash.isstring":51,"lodash.keys":48}],45:[function(t,e){function n(t){return!!t&&"object"==typeof t}function i(t){return function(e){return null==e?void 0:e[t]}}function r(t){return null!=t&&o(p(t))}function o(t){return"number"==typeof t&&t>-1&&t%1==0&&l>=t}function s(t){return n(t)&&r(t)&&u.call(t,"callee")&&!c.call(t,"callee")}var a=Object.prototype,u=a.hasOwnProperty,c=a.propertyIsEnumerable,l=9007199254740991,p=i("length");e.exports=s},{}],46:[function(t,e){function n(t){return!!t&&"object"==typeof t}function i(t,e){var n=null==t?void 0:t[e];return a(n)?n:void 0}function r(t){return"number"==typeof t&&t>-1&&t%1==0&&y>=t}function o(t){return s(t)&&f.call(t)==c}function s(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function a(t){return null==t?!1:o(t)?m.test(h.call(t)):n(t)&&l.test(t)}var u="[object Array]",c="[object Function]",l=/^\[object .+?Constructor\]$/,p=Object.prototype,h=Function.prototype.toString,d=p.hasOwnProperty,f=p.toString,m=RegExp("^"+h.call(d).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),g=i(Array,"isArray"),y=9007199254740991,b=g||function(t){return n(t)&&r(t.length)&&f.call(t)==u};e.exports=b},{}],47:[function(t,e){function n(t){return i(t)&&s.call(t)==r}function i(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}var r="[object Function]",o=Object.prototype,s=o.toString;e.exports=n},{}],48:[function(t,e){function n(t){return function(e){return null==e?void 0:e[t]}}function i(t){return null!=t&&o(y(t))}function r(t,e){return t="number"==typeof t||h.test(t)?+t:-1,e=null==e?g:e,t>-1&&t%1==0&&e>t}function o(t){return"number"==typeof t&&t>-1&&t%1==0&&g>=t}function s(t){for(var e=u(t),n=e.length,i=n&&t.length,s=!!i&&o(i)&&(p(t)||l(t)),a=-1,c=[];++a<n;){var h=e[a];(s&&r(h,i)||f.call(t,h))&&c.push(h)}return c}function a(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function u(t){if(null==t)return[];a(t)||(t=Object(t));var e=t.length;e=e&&o(e)&&(p(t)||l(t))&&e||0;for(var n=t.constructor,i=-1,s="function"==typeof n&&n.prototype===t,u=Array(e),c=e>0;++i<e;)u[i]=i+"";for(var h in t)c&&r(h,e)||"constructor"==h&&(s||!f.call(t,h))||u.push(h);return u}var c=t("lodash._getnative"),l=t("lodash.isarguments"),p=t("lodash.isarray"),h=/^\d+$/,d=Object.prototype,f=d.hasOwnProperty,m=c(Object,"keys"),g=9007199254740991,y=n("length"),b=m?function(t){var e=null==t?void 0:t.constructor;return"function"==typeof e&&e.prototype===t||"function"!=typeof t&&i(t)?s(t):a(t)?m(t):[]}:s;e.exports=b},{"lodash._getnative":49,"lodash.isarguments":45,"lodash.isarray":46}],49:[function(t,e){function n(t){return!!t&&"object"==typeof t}function i(t,e){var n=null==t?void 0:t[e];return s(n)?n:void 0}function r(t){return o(t)&&h.call(t)==a}function o(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function s(t){return null==t?!1:r(t)?d.test(l.call(t)):n(t)&&u.test(t)}var a="[object Function]",u=/^\[object .+?Constructor\]$/,c=Object.prototype,l=Function.prototype.toString,p=c.hasOwnProperty,h=c.toString,d=RegExp("^"+l.call(p).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=i},{}],50:[function(t,e){function n(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}e.exports=n},{}],51:[function(t,e){function n(t){return!!t&&"object"==typeof t}function i(t){return"string"==typeof t||n(t)&&s.call(t)==r}var r="[object String]",o=Object.prototype,s=o.toString;e.exports=i},{}],52:[function(t,e){"use strict";function n(t){if(t=t||{},this.channel=t.channel,!this.channel)throw new Error("Channel ID must be specified");this.merchantUrl=t.merchantUrl,this._isDestroyed=!1,this._isVerbose=!1,this._listeners=[],this._log("new bus on channel "+this.channel,[location.href])}var i=t("framebus"),r=t("./lib/events"),o=t("./lib/check-origin").checkOrigin;n.prototype.on=function(t,e){var n,r,s=e,a=this;this._isDestroyed||(this.merchantUrl&&(s=function(){o(this.origin,a.merchantUrl)&&e.apply(this,arguments)}),n=this._namespaceEvent(t),r=Array.prototype.slice.call(arguments),r[0]=n,r[1]=s,this._log("on",r),i.on.apply(i,r),this._listeners.push({eventName:t,handler:s,originalHandler:e}))},n.prototype.emit=function(t){var e;this._isDestroyed||(e=Array.prototype.slice.call(arguments),e[0]=this._namespaceEvent(t),this._log("emit",e),i.emit.apply(i,e))},n.prototype._offDirect=function(t){var e=Array.prototype.slice.call(arguments);this._isDestroyed||(e[0]=this._namespaceEvent(t),this._log("off",e),i.off.apply(i,e))},n.prototype.off=function(t,e){var n,i,r=e;if(!this._isDestroyed){if(this.merchantUrl)for(n=0;n<this._listeners.length;n++)i=this._listeners[n],i.originalHandler===e&&(r=i.handler);this._offDirect.call(this,t,r)}},n.prototype._namespaceEvent=function(t){return["braintree",this.channel,t].join(":")},n.prototype.teardown=function(){var t,e;for(e=0;e<this._listeners.length;e++)t=this._listeners[e],this._offDirect(t.eventName,t.handler);this._listeners.length=0,this._isDestroyed=!0},n.prototype._log=function(t,e){this._isVerbose&&console.log(t,e)},n.events=r,e.exports=n},{"./lib/check-origin":53,"./lib/events":54,framebus:55}],53:[function(t,e){"use strict";function n(t,e){var n,r,o=document.createElement("a");return o.href=e,r="https:"===o.protocol?o.host.replace(/:443$/,""):"http:"===o.protocol?o.host.replace(/:80$/,""):o.host,n=o.protocol+"//"+r,n===t||i.test(t)}var i=/^https:\/\/([a-zA-Z0-9-]+\.)*(braintreepayments|braintreegateway|paypal)\.com(:\d{1,5})?$/;e.exports={checkOrigin:n}},{}],54:[function(t,e){"use strict";var n,i,r=["PAYMENT_METHOD_REQUEST","PAYMENT_METHOD_RECEIVED","PAYMENT_METHOD_GENERATED","PAYMENT_METHOD_NOT_GENERATED","PAYMENT_METHOD_CANCELLED","PAYMENT_METHOD_ERROR","CONFIGURATION_REQUEST","ROOT_METADATA_REQUEST","ERROR","WARNING","UI_POPUP_DID_OPEN","UI_POPUP_DID_CLOSE","UI_POPUP_FORCE_CLOSE","ASYNC_DEPENDENCY_INITIALIZING","ASYNC_DEPENDENCY_READY","USER_FORM_SUBMIT_REQUEST","SEND_ANALYTICS_EVENTS"],o={};for(n=0;n<r.length;n++)i=r[n],o[i]=i;e.exports=o},{}],55:[function(e,n,i){"use strict";!function(e,r){"object"==typeof i&&"undefined"!=typeof n?n.exports=r():"function"==typeof t&&t.amd?t([],r):e.framebus=r()}(this,function(){function t(t){return null==t?!1:null==t.Window?!1:t.constructor!==t.Window?!1:(v.push(t),!0)}function e(t){var e,n={};for(e in b)b.hasOwnProperty(e)&&(n[e]=b[e]);return n._origin=t||"*",n}function n(t){var e,n,i=o(this);return s(t)?!1:s(i)?!1:(n=Array.prototype.slice.call(arguments,1),e=a(t,n,i),e===!1?!1:(d(y.top,e,i),!0))}function i(t,e){var n=o(this);return g(t,e,n)?!1:(_[n]=_[n]||{},_[n][t]=_[n][t]||[],_[n][t].push(e),!0)}function r(t,e){var n,i,r=o(this);if(g(t,e,r))return!1;if(i=_[r]&&_[r][t],!i)return!1;for(n=0;n<i.length;n++)if(i[n]===e)return i.splice(n,1),!0;return!1}function o(t){return t&&t._origin||"*"}function s(t){return"string"!=typeof t}function a(t,e,n){var i=!1,r={event:t,origin:n},o=e[e.length-1];"function"==typeof o&&(r.reply=m(o,n),e=e.slice(0,-1)),r.args=e;try{i=E+JSON.stringify(r)}catch(s){throw new Error("Could not stringify event: "+s.message)}return i}function u(t){var e,n,i,r;if(t.data.slice(0,E.length)!==E)return!1;try{e=JSON.parse(t.data.slice(E.length))}catch(o){return!1}return null!=e.reply&&(n=t.origin,i=t.source,r=e.reply,e.reply=function(t){var e=a(r,[t],n);return e===!1?!1:void i.postMessage(e,n)},e.args.push(e.reply)),e}function c(t){y||(y=t||window,y.addEventListener?y.addEventListener("message",p,!1):y.attachEvent?y.attachEvent("onmessage",p):null===y.onmessage?y.onmessage=p:y=null)}function l(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0,n="x"===t?e:3&e|8;return n.toString(16)})}function p(t){var e;s(t.data)||(e=u(t),e&&(h("*",e.event,e.args,t),h(t.origin,e.event,e.args,t),f(t.data,e.origin,t.source)))}function h(t,e,n,i){var r;if(_[t]&&_[t][e])for(r=0;r<_[t][e].length;r++)_[t][e][r].apply(i,n)}function d(t,e,n){var i;try{t.postMessage(e,n)}catch(r){return}for(t.opener&&t.opener!==t&&!t.opener.closed&&t.opener!==y&&d(t.opener.top,e,n),i=0;i<t.frames.length;i++)d(t.frames[i],e,n)}function f(t,e,n){var i,r;for(i=v.length-1;i>=0;i--)r=v[i],r.closed===!0?v=v.slice(i,1):n!==r&&d(r.top,t,e)}function m(t,e){function n(r,o){t(r,o),b.target(e).unsubscribe(i,n)}var i=l();return b.target(e).subscribe(i,n),i}function g(t,e,n){return s(t)?!0:"function"!=typeof e?!0:s(n)?!0:!1}var y,b,v=[],_={},E="/*framebus*/";return c(),b={target:e,include:t,publish:n,pub:n,trigger:n,emit:n,subscribe:i,sub:i,on:i,unsubscribe:r,unsub:r,off:r}})},{}],56:[function(t,e){"use strict";function n(t){return new i(t)}var i=t("./lib/coinbase");e.exports={create:n}},{"./lib/coinbase":59}],57:[function(t,e){(function(t){"use strict";function n(e){return e=e||t.navigator.userAgent,/AppleWebKit\//.test(e)&&/Mobile\//.test(e)?e.replace(/.* OS ([0-9_]+) like Mac OS X.*/,"$1").replace(/_/g,"."):null}function i(e){e=e||t.navigator.userAgent;var n=null,i=/MSIE.(\d+)/.exec(e);return/Trident/.test(e)&&(n=11),i&&(n=parseInt(i[1],10)),n}function r(e){return e=e||t.navigator.userAgent,/Android/.test(e)?e.replace(/^.* Android ([0-9\.]+).*$/,"$1"):null}e.exports={ieVersion:i,iOSSafariVersion:n,androidVersion:r}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],58:[function(t,e){"use strict";function n(t,e,n){return t?(n.bus.emit(i.ERROR,t.error),void n._sendAnalyticsEvent("generate.nonce.failed")):(n.bus.emit(i.PAYMENT_METHOD_GENERATED,e),void n._sendAnalyticsEvent("generate.nonce.succeeded"))}var i=t("braintree-bus").events;e.exports={tokenize:n}},{"braintree-bus":67}],59:[function(t,e){(function(n){"use strict";function i(t){return{clientId:t.configuration.coinbase.clientId,redirectUrl:t.configuration.coinbase.redirectUrl,scopes:t.configuration.coinbase.scopes||h.SCOPES,meta:{authorizations_merchant_account:t.configuration.coinbase.merchantAccount||""}}}function r(t){return function(e,n){t.emit(f.events.ERROR,{type:n,message:e})}}function o(t,e){var n=(t||{}).coinbase,i=r(e);if(null==t.apiClient)i("settings.apiClient is required for coinbase",h.CONFIGURATION_ERROR);else if(t.configuration.coinbaseEnabled)if(n&&(n.container||n.button))if(n.container&&n.button)i("options.coinbase.container and options.coinbase.button are mutually exclusive",h.CONFIGURATION_ERROR);else{if(d.isSupportedBrowser())return!0;i("Coinbase is not supported by your browser. Please consider upgrading",h.UNSUPPORTED_BROWSER_ERROR)}else i("Either options.coinbase.container or options.coinbase.button is required for Coinbase integrations",h.CONFIGURATION_ERROR);else i("Coinbase is not enabled for your merchant account",h.CONFIGURATION_ERROR);return!1}function s(t){var e,r;this.destructor=new u,this.channel=t.channel,r={channel:this.channel};try{t.coinbase.container&&(r.merchantUrl=n.location.href)}catch(s){}this.bus=t.bus||new f(r),this.canCreateIntegration=o(t,this.bus),this.canCreateIntegration&&(this.buttonId=t.coinbase.button||h.BUTTON_ID,this.apiClient=t.apiClient,this.assetsUrl=t.configuration.assetsUrl,this.environment=t.configuration.coinbase.environment,this._onOAuthSuccess=a.bind(this._onOAuthSuccess,this),this._handleButtonClick=a.bind(this._handleButtonClick,this),this.popupParams=i(t),this.redirectDoneInterval=null,t.coinbase.container?(e=a.normalizeElement(t.coinbase.container),this._insertFrame(e)):(n.braintreeCoinbasePopupCallback=this._onOAuthSuccess,e=document.body,a.addEventListener(e,"click",this._handleButtonClick),this._sendAnalyticsEvent("initialized"),this.destructor.registerFunctionForTeardown(a.bind(function(){this._closePopup()},this)),this.bus.on(h.TEARDOWN_EVENT,a.bind(this.destructor.teardown,this.destructor))))}var a=t("braintree-utilities"),u=t("destructor"),c=t("./dom/composer"),l=t("./url-composer"),p=t("./callbacks"),h=t("./constants"),d=t("./detector"),f=t("braintree-bus");s.prototype._sendAnalyticsEvent=function(t){var e=this.apiClient.integration+".web.coinbase.";this.apiClient.sendAnalyticsEvents(e+t)},s.prototype._insertFrame=function(t){var e=c.createFrame({channel:this.channel});this.bus.emit(f.events.ASYNC_DEPENDENCY_INITIALIZING),t.appendChild(e),this.destructor.registerFunctionForTeardown(function(){t.removeChild(e)}),setTimeout(a.bind(function(){e.src=this.assetsUrl+"/coinbase/"+h.VERSION+"/coinbase-frame.html#"+this.channel},this),0)},s.prototype._onOAuthSuccess=function(t){return t.code?(this.bus.emit("coinbase:view:navigate","loading"),this._sendAnalyticsEvent("popup.authorized"),this.apiClient.tokenizeCoinbase({code:t.code,query:l.getQueryString()},a.bind(function(t,e){p.tokenize.apply(null,[t,e,this])},this)),void this._closePopup()):(this._sendAnalyticsEvent("popup.denied"),void this._closePopup())},s.prototype._clearPollForRedirectDone=function(){this.redirectDoneInterval&&(clearInterval(this.redirectDoneInterval),this.redirectDoneInterval=null)},s.prototype._closePopup=function(t){t=t||this.popup,null!=t&&(d.shouldCloseFromParent()&&t.close(),this._popupCleanup())},s.prototype._popupCleanup=function(){this._clearPollForRedirectDone(),this.bus.emit(f.events.UI_POPUP_DID_CLOSE,{source:h.INTEGRATION_NAME})},s.prototype._pollForRedirectDone=function(t){var e=setInterval(a.bind(function(){var e;if(null==t||t.closed)return this._sendAnalyticsEvent("popup.aborted"),void this._popupCleanup();try{if("about:blank"===t.location.href)throw new Error("Not finished loading");e=a.decodeQueryString(t.location.search.replace(/^\?/,"")).code}catch(n){return}this._onOAuthSuccess({code:e})},this),100);return this.redirectDoneInterval=e,e},s.prototype._openPopup=function(){var t;this._sendAnalyticsEvent("popup.started"),t=c.createPopup(l.compose(this._getOAuthBaseUrl(),this.popupParams)),t.focus(),this._pollForRedirectDone(t),this.bus.emit(f.events.UI_POPUP_DID_OPEN,{source:h.INTEGRATION_NAME}),this.bus.on(f.events.UI_POPUP_FORCE_CLOSE,function(e){e.target===h.INTEGRATION_NAME&&t.close()}),this.popup=t},s.prototype._getOAuthBaseUrl=function(){var t;return t="shared_sandbox"===this.environment?h.SANDBOX_OAUTH_BASE_URL:h.PRODUCTION_OAUTH_BASE_URL},s.prototype._handleButtonClick=function(t){for(var e=t.target||t.srcElement;;){if(null==e)return;if(e===t.currentTarget)return;if(e.id===this.buttonId)break;e=e.parentNode}t&&t.preventDefault?t.preventDefault():t.returnValue=!1,this._openPopup()},s.prototype.teardown=function(t){var e=this;return this.canCreateIntegration?void this.bus.emit(h.TEARDOWN_EVENT,function(){e.destructor.teardown(function(n){return n?t(n):(e.bus.teardown(),void t(null))})}):void t(null)},e.exports=s}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./callbacks":58,"./constants":60,"./detector":61,"./dom/composer":63,"./url-composer":66,"braintree-bus":67,"braintree-utilities":79,destructor:80}],60:[function(t,e){"use strict";e.exports={PRODUCTION_OAUTH_BASE_URL:"https://coinbase.com",SANDBOX_OAUTH_BASE_URL:"https://sandbox.coinbase.com",ORIGIN_URL:"https://www.coinbase.com",FRAME_NAME:"braintree-coinbase-frame",POPUP_NAME:"coinbase",BUTTON_ID:"bt-coinbase-button",SCOPES:"send",VERSION:"0.3.1",INTEGRATION_NAME:"Coinbase",CONFIGURATION_ERROR:"CONFIGURATION",UNSUPPORTED_BROWSER_ERROR:"UNSUPPORTED_BROWSER",TEARDOWN_EVENT:"coinbase:TEARDOWN"}},{}],61:[function(t,e){"use strict";function n(){var t=s.ieVersion();return!t||t>8}function i(){var t=s.androidVersion();return null==t?!1:/^5/.test(t)}function r(){return!(i()||o())}function o(){var t=s.iOSSafariVersion();return null==t?!1:/^8\.0/.test(t)||/^8\.1$/.test(t)}var s=t("./browser");e.exports={isSupportedBrowser:n,shouldCloseFromParent:r,shouldDisplayIOSClose:o,shouldDisplayLollipopClose:i}},{"./browser":57}],62:[function(t,e){"use strict";function n(t){var e=document.createElement("button");return t=t||{},e.id=t.id||"coinbase-button",e.style.backgroundColor=t.backgroundColor||"#EEE",e.style.color=t.color||"#4597C3",e.style.border=t.border||"0",e.style.borderRadius=t.borderRadius||"6px",e.style.padding=t.padding||"12px",e.innerHTML=t.innerHTML||"coinbase",e}e.exports={create:n}},{}],63:[function(t,e){"use strict";var n=t("./popup"),i=t("./button"),r=t("./frame");e.exports={createButton:i.create,createPopup:n.create,createFrame:r.create}},{"./button":62,"./frame":64,"./popup":65}],64:[function(t,e){"use strict";function n(){return r({name:i.FRAME_NAME,height:"70px",width:"100%",style:{padding:0,margin:0,border:0,outline:"none"}})}var i=t("../constants"),r=t("iframer");e.exports={create:n}},{"../constants":60,iframer:83}],65:[function(t,e){(function(n){"use strict";function i(t){var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push([n,t[n]].join("="));return e.join(",")}function r(){var t=850,e=600;return i({width:t,height:e,left:(screen.width-t)/2,top:(screen.height-e)/4})}function o(t){return n.open(t,s.POPUP_NAME,r())}var s=t("../constants");e.exports={create:o}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../constants":60}],66:[function(t,e){"use strict";function n(){return"version="+r.VERSION}function i(t,e){var i=t+"/oauth/authorize?response_type=code",r=e.redirectUrl+"?"+n();if(i+="&redirect_uri="+encodeURIComponent(r),i+="&client_id="+e.clientId,e.scopes&&(i+="&scope="+encodeURIComponent(e.scopes)),e.meta)for(var o in e.meta)e.meta.hasOwnProperty(o)&&(i+="&meta["+encodeURIComponent(o)+"]="+encodeURIComponent(e.meta[o]));return i}var r=t("./constants");e.exports={compose:i,getQueryString:n}},{"./constants":60}],67:[function(t,e,n){arguments[4][52][0].apply(n,arguments)},{"./lib/check-origin":68,"./lib/events":69,dup:52,framebus:70}],68:[function(t,e,n){arguments[4][53][0].apply(n,arguments)},{dup:53}],69:[function(t,e,n){arguments[4][54][0].apply(n,arguments)},{dup:54}],70:[function(t,e,n){arguments[4][55][0].apply(n,arguments)},{dup:55}],71:[function(t,e,n){arguments[4][35][0].apply(n,arguments)},{dup:35}],72:[function(t,e,n){arguments[4][36][0].apply(n,arguments)},{dup:36}],73:[function(t,e,n){arguments[4][22][0].apply(n,arguments)},{dup:22}],74:[function(t,e,n){arguments[4][38][0].apply(n,arguments)},{dup:38}],75:[function(t,e,n){arguments[4][39][0].apply(n,arguments)},{dup:39}],76:[function(t,e,n){arguments[4][40][0].apply(n,arguments)},{dup:40}],77:[function(t,e,n){arguments[4][41][0].apply(n,arguments)},{"./array":71,dup:41}],78:[function(t,e,n){arguments[4][42][0].apply(n,arguments)},{dup:42}],79:[function(t,e,n){arguments[4][43][0].apply(n,arguments)},{"./lib/array":71,"./lib/base64":72,"./lib/dom":73,"./lib/events":74,"./lib/fn":75,"./lib/string":76,"./lib/url":77,"./lib/uuid":78,dup:43}],80:[function(t,e){"use strict";function n(){this._teardownRegistry=[]}var i=t("batch-execute-functions"),r=t("braintree-utilities/lib/fn");n.prototype.registerFunctionForTeardown=function(t){r.isFunction(t)&&this._teardownRegistry.push(t)},n.prototype.teardown=function(t){i(this._teardownRegistry,r.bind(function(e){this._teardownRegistry=[],r.isFunction(t)&&t(e)},this))},e.exports=n},{"batch-execute-functions":81,"braintree-utilities/lib/fn":82}],81:[function(t,e){"use strict";function n(t,e){var n,r=0===t.length;r?(t(),e(null)):(n=i(e),t(n))}function i(t){var e=!1;return function(){e||(e=!0,t.apply(this,arguments))}}e.exports=function(t,e){var i=t.length,r=i;if(0===i)return void e(null);for(var o=0;i>o;o++)n(t[o],function(t){return t?void e(t):(r-=1,void(0===r&&e(null)))})}},{}],82:[function(t,e,n){arguments[4][39][0].apply(n,arguments)},{dup:39}],83:[function(t,e){"use strict";var n=t("lodash.assign"),i=t("lodash.isstring"),r=t("setattributes"),o=t("./lib/default-attributes");e.exports=function(t){var e=document.createElement("iframe"),s=n({},o,t);return s.style&&!i(s.style)&&(n(e.style,s.style),delete s.style),r(e,s),e.getAttribute("id")||(e.id=e.name),e}},{"./lib/default-attributes":84,"lodash.assign":85,"lodash.isstring":96,setattributes:97}],84:[function(t,e){e.exports={src:"about:blank",frameBorder:0,allowtransparency:!0,scrolling:"no"}},{}],85:[function(t,e){function n(t,e,n){for(var i=-1,r=o(e),s=r.length;++i<s;){var a=r[i],u=t[a],c=n(u,e[a],a,t,e);(c===c?c===u:u!==u)&&(void 0!==u||a in t)||(t[a]=c)}return t}var i=t("lodash._baseassign"),r=t("lodash._createassigner"),o=t("lodash.keys"),s=r(function(t,e,r){return r?n(t,e,r):i(t,e)});e.exports=s},{"lodash._baseassign":86,"lodash._createassigner":88,"lodash.keys":92}],86:[function(t,e){function n(t,e){return null==e?t:i(e,r(e),t)}var i=t("lodash._basecopy"),r=t("lodash.keys");e.exports=n},{"lodash._basecopy":87,"lodash.keys":92}],87:[function(t,e){function n(t,e,n){n||(n={});for(var i=-1,r=e.length;++i<r;){var o=e[i];n[o]=t[o]}return n}e.exports=n},{}],88:[function(t,e){function n(t){return o(function(e,n){var o=-1,s=null==e?0:n.length,a=s>2?n[s-2]:void 0,u=s>2?n[2]:void 0,c=s>1?n[s-1]:void 0;for("function"==typeof a?(a=i(a,c,5),s-=2):(a="function"==typeof c?c:void 0,s-=a?1:0),u&&r(n[0],n[1],u)&&(a=3>s?void 0:a,s=1);++o<s;){var l=n[o];l&&t(e,l,a)}return e})}var i=t("lodash._bindcallback"),r=t("lodash._isiterateecall"),o=t("lodash.restparam");e.exports=n},{"lodash._bindcallback":89,"lodash._isiterateecall":90,"lodash.restparam":91}],89:[function(t,e){function n(t,e,n){if("function"!=typeof t)return i;if(void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 3:return function(n,i,r){return t.call(e,n,i,r)};case 4:return function(n,i,r,o){return t.call(e,n,i,r,o)};case 5:return function(n,i,r,o,s){return t.call(e,n,i,r,o,s)}}return function(){return t.apply(e,arguments)}}function i(t){return t}e.exports=n},{}],90:[function(t,e){function n(t){return function(e){return null==e?void 0:e[t]}}function i(t){return null!=t&&s(l(t))}function r(t,e){return t="number"==typeof t||u.test(t)?+t:-1,e=null==e?c:e,t>-1&&t%1==0&&e>t}function o(t,e,n){if(!a(n))return!1;var o=typeof e;if("number"==o?i(n)&&r(e,n.length):"string"==o&&e in n){var s=n[e];return t===t?t===s:s!==s}return!1}function s(t){return"number"==typeof t&&t>-1&&t%1==0&&c>=t}function a(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}var u=/^\d+$/,c=9007199254740991,l=n("length");e.exports=o},{}],91:[function(t,e){function n(t,e){if("function"!=typeof t)throw new TypeError(i);return e=r(void 0===e?t.length-1:+e||0,0),function(){for(var n=arguments,i=-1,o=r(n.length-e,0),s=Array(o);++i<o;)s[i]=n[e+i];switch(e){case 0:return t.call(this,s);case 1:return t.call(this,n[0],s);case 2:return t.call(this,n[0],n[1],s)}var a=Array(e+1);for(i=-1;++i<e;)a[i]=n[i];return a[e]=s,t.apply(this,a)}}var i="Expected a function",r=Math.max;e.exports=n},{}],92:[function(t,e,n){arguments[4][48][0].apply(n,arguments)},{dup:48,"lodash._getnative":93,"lodash.isarguments":94,"lodash.isarray":95}],93:[function(t,e,n){arguments[4][49][0].apply(n,arguments)},{dup:49}],94:[function(t,e,n){arguments[4][45][0].apply(n,arguments)},{dup:45}],95:[function(t,e,n){arguments[4][46][0].apply(n,arguments)},{dup:46}],96:[function(t,e,n){arguments[4][51][0].apply(n,arguments)},{dup:51}],97:[function(t,e){e.exports=function(t,e){var n;for(var i in e)e.hasOwnProperty(i)&&(n=e[i],null==n?t.removeAttribute(i):t.setAttribute(i,n))}},{}],98:[function(t,e,n){arguments[4][2][0].apply(n,arguments)},{"./coinbase-account":99,"./constants":100,"./credit-card":101,"./europe-bank-account":102,"./normalize-api-fields":104,"./parse-client-token":105,"./paypal-account":106,"./request/choose-driver":109,"./sepa-mandate":114,"./should-enable-cors":115,"./util":116,"braintree-3ds":125,"braintree-utilities":139,dup:2}],99:[function(t,e,n){arguments[4][3][0].apply(n,arguments)},{dup:3}],100:[function(t,e,n){arguments[4][4][0].apply(n,arguments)},{dup:4}],101:[function(t,e,n){arguments[4][5][0].apply(n,arguments)},{dup:5}],102:[function(t,e,n){arguments[4][6][0].apply(n,arguments)},{dup:6}],103:[function(t,e,n){arguments[4][7][0].apply(n,arguments)},{"./constants":100,"./parse-client-token":105,"./request/choose-driver":109,"./should-enable-cors":115,"./util":116,dup:7}],104:[function(t,e,n){arguments[4][8][0].apply(n,arguments)},{dup:8}],105:[function(t,e,n){arguments[4][9][0].apply(n,arguments)},{"./polyfill":107,"braintree-utilities":139,dup:9}],106:[function(t,e,n){arguments[4][10][0].apply(n,arguments)},{dup:10}],107:[function(t,e,n){arguments[4][11][0].apply(n,arguments)},{dup:11}],108:[function(t,e,n){arguments[4][12][0].apply(n,arguments)},{"../constants":100,"../util":116,"./parse-body":112,"./prep-body":113,dup:12}],109:[function(t,e,n){arguments[4][13][0].apply(n,arguments)},{"../util":116,"./ajax-driver":108,"./jsonp-driver":110,dup:13}],110:[function(t,e,n){arguments[4][14][0].apply(n,arguments)},{"../constants":100,"./jsonp":111,dup:14}],111:[function(t,e,n){arguments[4][15][0].apply(n,arguments)},{"../util":116,dup:15}],112:[function(t,e,n){arguments[4][16][0].apply(n,arguments)},{dup:16}],113:[function(t,e,n){arguments[4][17][0].apply(n,arguments)},{dup:17,"lodash.isstring":147}],114:[function(t,e,n){arguments[4][18][0].apply(n,arguments)},{dup:18}],115:[function(t,e,n){arguments[4][19][0].apply(n,arguments)},{dup:19}],116:[function(t,e,n){arguments[4][20][0].apply(n,arguments)},{dup:20,"lodash.isempty":140,"lodash.isobject":146}],117:[function(t,e,n){arguments[4][21][0].apply(n,arguments)},{"./lib/client":98,"./lib/get-configuration":103,"./lib/parse-client-token":105,"./lib/util":116,dup:21}],118:[function(t,e,n){arguments[4][22][0].apply(n,arguments)},{dup:22}],119:[function(t,e,n){arguments[4][23][0].apply(n,arguments)},{dup:23}],120:[function(t,e,n){arguments[4][24][0].apply(n,arguments)},{dup:24}],121:[function(t,e,n){arguments[4][25][0].apply(n,arguments)},{dup:25}],122:[function(t,e,n){arguments[4][26][0].apply(n,arguments)},{"./lib/dom":118,"./lib/events":119,"./lib/fn":120,"./lib/url":121,dup:26}],123:[function(t,e,n){arguments[4][27][0].apply(n,arguments)},{"../shared/receiver":130,"braintree-utilities":122,dup:27}],124:[function(t,e,n){arguments[4][28][0].apply(n,arguments)},{"./authorization_service":123,"./loader":126,"braintree-utilities":122,dup:28}],125:[function(t,e,n){arguments[4][29][0].apply(n,arguments)},{"./client":124,dup:29}],126:[function(t,e,n){arguments[4][30][0].apply(n,arguments)},{"./loader_display":127,"./loader_message":128,"./loader_spinner":129,dup:30}],127:[function(t,e,n){arguments[4][31][0].apply(n,arguments)},{dup:31}],128:[function(t,e,n){arguments[4][32][0].apply(n,arguments)},{dup:32}],129:[function(t,e,n){arguments[4][33][0].apply(n,arguments)},{dup:33}],130:[function(t,e,n){arguments[4][34][0].apply(n,arguments)},{"braintree-utilities":122,dup:34}],131:[function(t,e,n){arguments[4][35][0].apply(n,arguments)},{dup:35}],132:[function(t,e,n){arguments[4][36][0].apply(n,arguments)},{dup:36}],133:[function(t,e,n){arguments[4][22][0].apply(n,arguments)},{dup:22}],134:[function(t,e,n){arguments[4][38][0].apply(n,arguments)},{dup:38}],135:[function(t,e,n){arguments[4][39][0].apply(n,arguments)},{dup:39}],136:[function(t,e,n){arguments[4][40][0].apply(n,arguments)},{dup:40}],137:[function(t,e,n){arguments[4][41][0].apply(n,arguments)},{"./array":131,dup:41}],138:[function(t,e,n){arguments[4][42][0].apply(n,arguments)},{dup:42}],139:[function(t,e,n){arguments[4][43][0].apply(n,arguments)},{"./lib/array":131,"./lib/base64":132,"./lib/dom":133,"./lib/events":134,"./lib/fn":135,"./lib/string":136,"./lib/url":137,"./lib/uuid":138,dup:43}],140:[function(t,e,n){arguments[4][44][0].apply(n,arguments)},{dup:44,"lodash.isarguments":141,"lodash.isarray":142,"lodash.isfunction":143,"lodash.isstring":147,"lodash.keys":144}],141:[function(t,e,n){arguments[4][45][0].apply(n,arguments)},{dup:45}],142:[function(t,e,n){arguments[4][46][0].apply(n,arguments)},{dup:46}],143:[function(t,e,n){arguments[4][47][0].apply(n,arguments)},{dup:47}],144:[function(t,e,n){arguments[4][48][0].apply(n,arguments)},{dup:48,"lodash._getnative":145,"lodash.isarguments":141,"lodash.isarray":142}],145:[function(t,e,n){arguments[4][49][0].apply(n,arguments)},{dup:49}],146:[function(t,e,n){arguments[4][50][0].apply(n,arguments)},{dup:50}],147:[function(t,e,n){arguments[4][51][0].apply(n,arguments)},{dup:51}],148:[function(t,e,n){arguments[4][52][0].apply(n,arguments)},{"./lib/check-origin":149,"./lib/events":150,dup:52,framebus:151}],149:[function(t,e,n){arguments[4][53][0].apply(n,arguments)},{dup:53}],150:[function(t,e,n){arguments[4][54][0].apply(n,arguments)},{dup:54}],151:[function(t,e,n){arguments[4][55][0].apply(n,arguments)},{dup:55}],152:[function(t,e,n){arguments[4][52][0].apply(n,arguments)},{"./lib/check-origin":153,"./lib/events":154,dup:52,framebus:155}],153:[function(t,e,n){arguments[4][53][0].apply(n,arguments)},{dup:53}],154:[function(t,e,n){arguments[4][54][0].apply(n,arguments)},{dup:54}],155:[function(t,e,n){arguments[4][55][0].apply(n,arguments)},{dup:55}],156:[function(t,e,n){arguments[4][35][0].apply(n,arguments)},{dup:35}],157:[function(t,e,n){arguments[4][36][0].apply(n,arguments)},{dup:36}],158:[function(t,e,n){arguments[4][22][0].apply(n,arguments)},{dup:22}],159:[function(t,e,n){arguments[4][38][0].apply(n,arguments)},{dup:38}],160:[function(t,e,n){arguments[4][39][0].apply(n,arguments)},{dup:39}],161:[function(t,e,n){arguments[4][40][0].apply(n,arguments)},{dup:40}],162:[function(t,e,n){arguments[4][41][0].apply(n,arguments)},{"./array":156,dup:41}],163:[function(t,e,n){arguments[4][42][0].apply(n,arguments)},{dup:42}],164:[function(t,e,n){arguments[4][43][0].apply(n,arguments)},{"./lib/array":156,"./lib/base64":157,"./lib/dom":158,"./lib/events":159,"./lib/fn":160,"./lib/string":161,"./lib/url":162,"./lib/uuid":163,dup:43}],165:[function(t,e,n){arguments[4][80][0].apply(n,arguments)},{"batch-execute-functions":166,"braintree-utilities/lib/fn":167,dup:80}],166:[function(t,e,n){arguments[4][81][0].apply(n,arguments)},{dup:81}],167:[function(t,e,n){arguments[4][39][0].apply(n,arguments)},{dup:39}],168:[function(t,e,n){arguments[4][83][0].apply(n,arguments)},{"./lib/default-attributes":169,dup:83,"lodash.assign":170,"lodash.isstring":181,setattributes:182}],169:[function(t,e,n){arguments[4][84][0].apply(n,arguments)},{dup:84}],170:[function(t,e,n){arguments[4][85][0].apply(n,arguments)},{dup:85,"lodash._baseassign":171,"lodash._createassigner":173,"lodash.keys":177}],171:[function(t,e,n){arguments[4][86][0].apply(n,arguments)},{dup:86,"lodash._basecopy":172,"lodash.keys":177}],172:[function(t,e,n){arguments[4][87][0].apply(n,arguments)},{dup:87}],173:[function(t,e,n){arguments[4][88][0].apply(n,arguments)},{dup:88,"lodash._bindcallback":174,"lodash._isiterateecall":175,"lodash.restparam":176}],174:[function(t,e,n){arguments[4][89][0].apply(n,arguments)},{dup:89}],175:[function(t,e,n){arguments[4][90][0].apply(n,arguments)},{dup:90}],176:[function(t,e,n){arguments[4][91][0].apply(n,arguments)},{dup:91}],177:[function(t,e,n){arguments[4][48][0].apply(n,arguments)},{dup:48,"lodash._getnative":178,"lodash.isarguments":179,"lodash.isarray":180}],178:[function(t,e,n){arguments[4][49][0].apply(n,arguments)},{dup:49}],179:[function(t,e,n){arguments[4][45][0].apply(n,arguments)},{dup:45}],180:[function(t,e,n){arguments[4][46][0].apply(n,arguments)},{dup:46}],181:[function(t,e,n){arguments[4][51][0].apply(n,arguments)},{dup:51}],182:[function(t,e,n){arguments[4][97][0].apply(n,arguments)},{dup:97}],183:[function(t,e){(function(n){"use strict";
4
- function i(t){this.options=t||{},this.destructor=new s,this.bus=new a({merchantUrl:n.location.href,channel:this.options.channel}),this.destructor.registerFunctionForTeardown(r.bind(function(){this.bus.teardown()},this)),this._initialize()}var r=t("braintree-utilities"),o=t("../../shared/util/browser"),s=t("destructor"),a=t("braintree-bus"),u=t("../../shared/constants"),c=t("./popup-view"),l=t("./modal-view");i.prototype._initialize=function(){this.app=o.isPopupSupported()?new c({src:this._buildUrl(),isHermes:this.options.isHermes,channel:this.options.channel}):new l({src:this._buildUrl(),headless:this.options.headless,isHermes:this.options.isHermes,insertFrameFunction:this.options.insertFrameFunction,channel:this.options.channel}),this.destructor.registerFunctionForTeardown(r.bind(function(){this.app.teardown()},this)),this.bus.on(u.events.CLOSE_APP,r.bind(this.close,this)),this.bus.on(u.events.FOCUS_APP,r.bind(this.focus,this)),this.bus.on(a.events.PAYMENT_METHOD_GENERATED,r.bind(this._handlePaymentMethodGenerated,this)),this.bus.on(a.events.UI_POPUP_FORCE_CLOSE,r.bind(this._handleForceClose,this))},i.prototype._buildUrl=function(){var t=this.options.paypalAssetsUrl;return t+="/pwpp/",t+=u.VERSION,t+="/html/braintree-frame.html",t+="#"+this.options.channel},i.prototype.open=function(){this.focus(),this.app.open(),this.poll()},i.prototype._handleForceClose=function(t){t.target===u.PAYPAL_INTEGRATION_NAME&&this.close()},i.prototype.close=function(){this.app.close()},i.prototype.focus=function(){r.isFunction(this.app.focus)&&this.app.focus()},i.prototype.isClosed=function(){return this.app.isClosed()},i.prototype.stopPolling=function(){clearInterval(this.pollId)},i.prototype.poll=function(){this.pollId=setInterval(r.bind(function(){this.isClosed()&&this._handleClosed()},this),100)},i.prototype._handlePaymentMethodGenerated=function(t){t.type===u.NONCE_TYPE&&this.close()},i.prototype._handleClosed=function(){this.stopPolling(),this.close(),o.isPopupSupported()&&(this.app.el=null)},i.prototype.teardown=function(){this.destructor.teardown()},e.exports=i}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../shared/constants":186,"../../shared/util/browser":191,"./modal-view":184,"./popup-view":185,"braintree-bus":152,"braintree-utilities":164,destructor:165}],184:[function(t,e){(function(n){"use strict";function i(t){this.options=t||{},this.container=document.body,this.bus=new a({merchantUrl:n.location.href,channel:t.channel}),this.options.headless?this._open=this._openHeadless:this._attachBusEvents(),this._initialize()}var r=t("braintree-utilities"),o=t("../../shared/util/browser"),s=t("../../shared/constants"),a=t("braintree-bus"),u=t("iframer");i.prototype._attachBusEvents=function(){this.bus.on(s.events.OPEN_MODAL,r.bind(this.open,this))},i.prototype._initialize=function(){var t=this.options.isHermes?s.HERMES_FRAME_NAME:s.FRAME_NAME;this.el=u({src:this.options.src,name:t,height:this.options.height||"100%",width:this.options.width||"100%",style:{position:o.isMobile()?"absolute":"fixed",top:0,left:0,bottom:0,padding:0,margin:0,border:0,outline:"none",zIndex:20001,background:"#FFFFFF"}})},i.prototype.isClosed=function(){return!this.container.contains(this.el)},i.prototype._openHeadless=function(){this.bus.emit(s.events.OPEN_MODAL)},i.prototype._open=function(){r.isFunction(this.options.insertFrameFunction)?this.options.insertFrameFunction(this.el.src):this.container.appendChild(this.el),this.bus.emit(s.events.UI_MODAL_DID_OPEN,{source:s.PAYPAL_INTEGRATION_NAME})},i.prototype.open=function(){this.isClosed()&&this._open()},i.prototype.close=function(){this.isClosed()||(this.container.removeChild(this.el),this.bus.emit(s.events.UI_MODAL_DID_CLOSE,{source:s.PAYPAL_INTEGRATION_NAME}))},i.prototype.teardown=function(){this.close(),this.bus.teardown()},e.exports=i}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../shared/constants":186,"../../shared/util/browser":191,"braintree-bus":152,"braintree-utilities":164,iframer:168}],185:[function(t,e){(function(n){"use strict";function i(t){this.options=t,this.bus=new o({merchantUrl:n.location.href,channel:this.options.channel}),t.isHermes?(this.name=r.HERMES_POPUP_NAME,this.popupHeight=r.HERMES_POPUP_HEIGHT,this.popupWidth=r.HERMES_POPUP_WIDTH):(this.name=r.POPUP_NAME,this.popupHeight=r.POPUP_HEIGHT,this.popupWidth=r.POPUP_WIDTH)}var r=t("../../shared/constants"),o=t("braintree-bus"),s=t("../../shared/useragent/browser");i.prototype._getPopupOptions=function(){return["height="+this.popupHeight,"width="+this.popupWidth,"top="+this._getTopPosition(),"left="+this._getLeftPosition(),r.POPUP_OPTIONS].join(",")},i.prototype._centerPosition=function(t,e,n){return(t-e)/2+n},i.prototype._getTopPosition=function(){var t=window.outerHeight||document.documentElement.clientHeight,e="undefined"==typeof window.screenY?window.screenTop:window.screenY;return this._centerPosition(t,this.popupHeight,e)},i.prototype._getLeftPosition=function(){var t=window.outerWidth||document.documentElement.clientWidth,e="undefined"==typeof window.screenX?window.screenLeft:window.screenX;return this._centerPosition(t,this.popupWidth,e)},i.prototype.isClosed=function(){return this.el?this.el.closed:void 0},i.prototype.open=function(){this.el||(this.el=window.open(this.options.src,this.name,this._getPopupOptions()),this.focus(),this.bus.emit(o.events.UI_POPUP_DID_OPEN,{source:r.PAYPAL_INTEGRATION_NAME}))},i.prototype.close=function(){this.el&&((s.isIE8()&&!this.isClosed()||!s.isIE8())&&this.el.close(),this.bus.emit(o.events.UI_POPUP_DID_CLOSE,{source:r.PAYPAL_INTEGRATION_NAME}))},i.prototype.focus=function(){this.el&&this.el.focus()},i.prototype.teardown=function(){this.close(),this.bus.teardown()},e.exports=i}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../shared/constants":186,"../../shared/useragent/browser":187,"braintree-bus":152}],186:[function(t,e,n){"use strict";var i,r="1.6.3",o=["GET_CLIENT_TOKEN","GET_CLIENT_OPTIONS","OPEN_MODAL","CLOSE_APP","FOCUS_APP","UI_MODAL_DID_OPEN","UI_MODAL_DID_CLOSE"];for(n.VERSION=r,n.POPUP_NAME="braintree_paypal_popup",n.HERMES_POPUP_NAME="PPFrameRedirect",n.FRAME_NAME="braintree-paypal-frame",n.HERMES_FRAME_NAME="PPFrameRedirect",n.POPUP_PATH="/pwpp/"+r+"/html/braintree-frame.html",n.POPUP_OPTIONS="resizable,scrollbars",n.POPUP_HEIGHT=470,n.POPUP_WIDTH=410,n.HERMES_POPUP_HEIGHT=535,n.HERMES_POPUP_WIDTH=450,n.BRIDGE_FRAME_NAME="bt-proxy-frame",n.HERMES_SUPPORTED_CURRENCIES=["USD","GBP","EUR","AUD","CAD","DKK","NOK","PLN","SEK","CHF","TRY"],n.HERMES_SUPPORTED_COUNTRIES=["US","GB","AU","CA","ES","FR","DE","IT","NL","NO","PL","CH","TR","DK","BE","AT"],n.NONCE_TYPE="PayPalAccount",n.PAYPAL_INTEGRATION_NAME="PayPal",n.ILLEGAL_XHR_ERROR="Illegal XHR request attempted",n.events={},i=0;i<o.length;i++)n.events[o[i]]="paypal:"+o[i]},{}],187:[function(t,e){"use strict";function n(){return h.matchUserAgent("Android")&&!i()}function i(){return h.matchUserAgent("Chrome")||h.matchUserAgent("CriOS")}function r(){return h.matchUserAgent("Firefox")}function o(){return h.matchUserAgent("Trident")||h.matchUserAgent("MSIE")}function s(){return h.matchUserAgent(/MSIE 8\.0/)}function a(){return h.matchUserAgent("Opera")||h.matchUserAgent("OPR")}function u(){return a()&&"[object OperaMini]"===Object.prototype.toString.call(window.operamini)}function c(){return h.matchUserAgent("Safari")&&!i()&&!n()}function l(){return d.isIos()&&!i()&&!c()}function p(){var t=/Version\/[\w\.]+ Chrome\/[\w\.]+ Mobile/;return d.isAndroid()&&h.matchUserAgent(t)}var h=t("./useragent"),d=t("./platform");e.exports={isAndroid:n,isChrome:i,isFirefox:r,isIE:o,isIE8:s,isOpera:a,isOperaMini:u,isSafari:c,isIosWebView:l,isAndroidWebView:p}},{"./platform":189,"./useragent":190}],188:[function(t,e){"use strict";function n(){return!i()&&(s.isAndroid()||s.isIpod()||s.isIphone()||o.matchUserAgent("IEMobile"))}function i(){return s.isIpad()||s.isAndroid()&&!o.matchUserAgent("Mobile")}function r(){return!n()&&!i()}var o=t("./useragent"),s=t("./platform");e.exports={isMobile:n,isTablet:i,isDesktop:r}},{"./platform":189,"./useragent":190}],189:[function(t,e){"use strict";function n(){return a.matchUserAgent("Android")}function i(){return a.matchUserAgent("iPad")}function r(){return a.matchUserAgent("iPod")}function o(){return a.matchUserAgent("iPhone")&&!r()}function s(){return i()||r()||o()}var a=t("./useragent");e.exports={isAndroid:n,isIpad:i,isIpod:r,isIphone:o,isIos:s}},{"./useragent":190}],190:[function(t,e,n){"use strict";function i(){return o}function r(t){var e=n.getNativeUserAgent(),i=e.match(t);return i?!0:!1}var o=window.navigator.userAgent;n.getNativeUserAgent=i,n.matchUserAgent=r},{}],191:[function(t,e){"use strict";function n(){return i()&&window.outerWidth<600}function i(){return f.test(d)}function r(){return Boolean(window.postMessage)}function o(){if(c.isOperaMini())return!1;if(l.isDesktop())return!0;if(l.isMobile()||l.isTablet()){if(c.isIE())return!1;if(p.isAndroid())return c.isAndroidWebView()?!1:!0;if(p.isIos())return c.isChrome()?!1:c.isSafari()&&h.matchUserAgent(/OS (?:8_1|8_0|8)(?!_\d)/i)?!1:c.isIosWebView()?!1:!0}return!1}function s(){if(c.isIE8())return!1;try{return window.self===window.top}catch(t){return!1}}function a(){return c.isIE()}function u(){var t=null,e="";try{new ActiveXObject("")}catch(n){e=n.name}try{t=Boolean(new ActiveXObject("htmlfile"))}catch(n){t=!1}return t="ReferenceError"!==e&&t===!1?!1:!0,!t}var c=t("../useragent/browser"),l=t("../useragent/device"),p=t("../useragent/platform"),h=t("../useragent/useragent"),d=window.navigator.userAgent,f=/[Mm]obi|tablet|iOS|Android|IEMobile|Windows\sPhone/;e.exports={isMobile:n,isMobileDevice:i,detectedPostMessage:r,isPopupSupported:o,isOverlaySupported:s,isBridgeIframeRequired:a,isMetroBrowser:u}},{"../useragent/browser":187,"../useragent/device":188,"../useragent/platform":189,"../useragent/useragent":190}],192:[function(t,e){"use strict";function n(t,e){this.host=t||window,this.channel=e||null,this.handlers=[],i.addEventListener(this.host,"message",i.bind(this.receive,this))}var i=t("braintree-utilities");n.prototype.receive=function(t){var e,i,r,o;try{r=JSON.parse(t.data)}catch(s){return}for(o=r.type,i=new n.Message(this,t.source,r.data),e=0;e<this.handlers.length;e++)this.handlers[e].type===o&&this.handlers[e].handler(i)},n.prototype.send=function(t,e,n){t.postMessage(JSON.stringify({type:this._namespaceEvent(e),data:n}),"*")},n.prototype.register=function(t,e){this.handlers.push({type:this._namespaceEvent(t),handler:e})},n.prototype.unregister=function(t,e){for(var n=this.handlers.length-1;n>=0;n--)if(this.handlers[n].type===t&&this.handlers[n].handler===e)return this.handlers.splice(n,1)},n.prototype._namespaceEvent=function(t){return this.channel?["braintree",this.channel,t].join(":"):t},n.Message=function(t,e,n){this.bus=t,this.source=e,this.content=n},n.Message.prototype.reply=function(t,e){this.bus.send(this.source,t,e)},e.exports=n},{"braintree-utilities":206}],193:[function(t,e){"use strict";function n(t,e){this.bus=t,this.target=e,this.handlers=[],this.bus.register("publish",i.bind(this._handleMessage,this))}var i=t("braintree-utilities");n.prototype._handleMessage=function(t){var e,n=t.content,i=this.handlers[n.channel];if("undefined"!=typeof i)for(e=0;e<i.length;e++)i[e](n.data)},n.prototype.publish=function(t,e){this.bus.send(this.target,"publish",{channel:t,data:e})},n.prototype.subscribe=function(t,e){this.handlers[t]=this.handlers[t]||[],this.handlers[t].push(e)},n.prototype.unsubscribe=function(t,e){var n,i=this.handlers[t];if("undefined"!=typeof i)for(n=0;n<i.length;n++)i[n]===e&&i.splice(n,1)},e.exports=n},{"braintree-utilities":206}],194:[function(t,e){"use strict";function n(t){this.bus=t,this.frames=[],this.handlers=[]}n.prototype.subscribe=function(t,e){this.handlers[t]=this.handlers[t]||[],this.handlers[t].push(e)},n.prototype.registerFrame=function(t){this.frames.push(t)},n.prototype.unregisterFrame=function(t){for(var e=0;e<this.frames.length;e++)this.frames[e]===t&&this.frames.splice(e,1)},n.prototype.publish=function(t,e){var n,i=this.handlers[t];if("undefined"!=typeof i)for(n=0;n<i.length;n++)i[n](e);for(n=0;n<this.frames.length;n++)this.bus.send(this.frames[n],"publish",{channel:t,data:e})},n.prototype.unsubscribe=function(t,e){var n,i=this.handlers[t];if("undefined"!=typeof i)for(n=0;n<i.length;n++)i[n]===e&&i.splice(n,1)},e.exports=n},{}],195:[function(t,e){"use strict";function n(t,e){this.bus=t,this.target=e||window.parent,this.counter=0,this.callbacks={},this.bus.register("rpc_response",i.bind(this._handleResponse,this))}var i=t("braintree-utilities");n.prototype._handleResponse=function(t){var e=t.content,n=this.callbacks[e.id];"function"==typeof n&&(n.apply(null,e.response),delete this.callbacks[e.id])},n.prototype.invoke=function(t,e,n){var i=this.counter++;this.callbacks[i]=n,this.bus.send(this.target,"rpc_request",{id:i,method:t,args:e})},e.exports=n},{"braintree-utilities":206}],196:[function(t,e){"use strict";function n(t){this.bus=t,this.methods={},this.bus.register("rpc_request",i.bind(this._handleRequest,this))}var i=t("braintree-utilities");n.prototype._handleRequest=function(t){var e,n=t.content,i=n.args||[],r=this.methods[n.method];"function"==typeof r&&(e=function(){t.reply("rpc_response",{id:n.id,response:Array.prototype.slice.call(arguments)})},i.push(e),r.apply(null,i))},n.prototype.reset=function(){this.methods={}},n.prototype.define=function(t,e){this.methods[t]=e},e.exports=n},{"braintree-utilities":206}],197:[function(t,e){var n=t("./lib/message-bus"),i=t("./lib/pubsub-client"),r=t("./lib/pubsub-server"),o=t("./lib/rpc-client"),s=t("./lib/rpc-server");e.exports={MessageBus:n,PubsubClient:i,PubsubServer:r,RPCClient:o,RPCServer:s}},{"./lib/message-bus":192,"./lib/pubsub-client":193,"./lib/pubsub-server":194,"./lib/rpc-client":195,"./lib/rpc-server":196}],198:[function(t,e,n){arguments[4][35][0].apply(n,arguments)},{dup:35}],199:[function(t,e,n){arguments[4][36][0].apply(n,arguments)},{dup:36}],200:[function(t,e,n){arguments[4][22][0].apply(n,arguments)},{dup:22}],201:[function(t,e,n){arguments[4][38][0].apply(n,arguments)},{dup:38}],202:[function(t,e,n){arguments[4][39][0].apply(n,arguments)},{dup:39}],203:[function(t,e,n){arguments[4][40][0].apply(n,arguments)},{dup:40}],204:[function(t,e,n){arguments[4][41][0].apply(n,arguments)},{"./array":198,dup:41}],205:[function(t,e,n){arguments[4][42][0].apply(n,arguments)},{dup:42}],206:[function(t,e,n){arguments[4][43][0].apply(n,arguments)},{"./lib/array":198,"./lib/base64":199,"./lib/dom":200,"./lib/events":201,"./lib/fn":202,"./lib/string":203,"./lib/url":204,"./lib/uuid":205,dup:43}],207:[function(t,e,n){arguments[4][35][0].apply(n,arguments)},{dup:35}],208:[function(t,e,n){arguments[4][36][0].apply(n,arguments)},{dup:36}],209:[function(t,e,n){arguments[4][22][0].apply(n,arguments)},{dup:22}],210:[function(t,e,n){arguments[4][38][0].apply(n,arguments)},{dup:38}],211:[function(t,e,n){arguments[4][39][0].apply(n,arguments)},{dup:39}],212:[function(t,e,n){arguments[4][40][0].apply(n,arguments)},{dup:40}],213:[function(t,e,n){arguments[4][41][0].apply(n,arguments)},{"./array":207,dup:41}],214:[function(t,e,n){arguments[4][42][0].apply(n,arguments)},{dup:42}],215:[function(t,e,n){arguments[4][43][0].apply(n,arguments)},{"./lib/array":207,"./lib/base64":208,"./lib/dom":209,"./lib/events":210,"./lib/fn":211,"./lib/string":212,"./lib/url":213,"./lib/uuid":214,dup:43}],216:[function(t,e,n){arguments[4][80][0].apply(n,arguments)},{"batch-execute-functions":217,"braintree-utilities/lib/fn":218,dup:80}],217:[function(t,e,n){arguments[4][81][0].apply(n,arguments)},{dup:81}],218:[function(t,e,n){arguments[4][39][0].apply(n,arguments)},{dup:39}],219:[function(t,e,n){arguments[4][83][0].apply(n,arguments)},{"./lib/default-attributes":220,dup:83,"lodash.assign":221,"lodash.isstring":232,setattributes:233}],220:[function(t,e,n){arguments[4][84][0].apply(n,arguments)},{dup:84}],221:[function(t,e,n){arguments[4][85][0].apply(n,arguments)},{dup:85,"lodash._baseassign":222,"lodash._createassigner":224,"lodash.keys":228}],222:[function(t,e,n){arguments[4][86][0].apply(n,arguments)},{dup:86,"lodash._basecopy":223,"lodash.keys":228}],223:[function(t,e,n){arguments[4][87][0].apply(n,arguments)},{dup:87}],224:[function(t,e,n){arguments[4][88][0].apply(n,arguments)},{dup:88,"lodash._bindcallback":225,"lodash._isiterateecall":226,"lodash.restparam":227}],225:[function(t,e,n){arguments[4][89][0].apply(n,arguments)},{dup:89}],226:[function(t,e,n){arguments[4][90][0].apply(n,arguments)},{dup:90}],227:[function(t,e,n){arguments[4][91][0].apply(n,arguments)},{dup:91}],228:[function(t,e,n){arguments[4][48][0].apply(n,arguments)},{dup:48,"lodash._getnative":229,"lodash.isarguments":230,"lodash.isarray":231}],229:[function(t,e,n){arguments[4][49][0].apply(n,arguments)},{dup:49}],230:[function(t,e,n){arguments[4][45][0].apply(n,arguments)},{dup:45}],231:[function(t,e,n){arguments[4][46][0].apply(n,arguments)},{dup:46}],232:[function(t,e,n){arguments[4][51][0].apply(n,arguments)},{dup:51}],233:[function(t,e,n){arguments[4][97][0].apply(n,arguments)},{dup:97}],234:[function(t,e){"use strict";function n(t){this.apiClient=t}var i=["getCreditCards","unlockCreditCard","sendAnalyticsEvents"];n.prototype.attach=function(t){function e(e){t.define(e,function(){n.apiClient[e].apply(n.apiClient,arguments)})}var n=this,r=0,o=i.length;for(r;o>r;r++)e(i[r])},e.exports=n},{}],235:[function(t,e){(function(n){"use strict";function i(t,e){var n=window.getComputedStyle?getComputedStyle(t):t.currentStyle;return n[e]}function r(){return{html:{height:a.style.height||"",overflow:i(a,"overflow"),position:i(a,"position")},body:{height:u.style.height||"",overflow:i(u,"overflow")}}}function o(){var t=/Android|iPhone|iPod|iPad/i.test(window.navigator.userAgent);return t}function s(t){var e,i,r;this.channel=t.channel,this.destructor=new p,this.merchantConfiguration=t.merchantConfiguration,this.encodedClientToken=t.gatewayConfiguration,this.analyticsConfiguration=t.analyticsConfiguration,this.paypalOptions=t.merchantConfiguration.paypal||{},this.container=null,this.merchantFormManager=null,this.root=t.root,this.configurationRequests=[],this.braintreeApiClient=c.configure({clientToken:t.gatewayConfiguration,analyticsConfiguration:this.analyticsConfiguration,integration:"dropin",enableCORS:this.merchantConfiguration.enableCORS}),this.paymentMethodNonceReceivedCallback=t.merchantConfiguration.paymentMethodNonceReceived,this.clientToken=c.parseClientToken(t.gatewayConfiguration),this.braintreeBus=new l({merchantUrl:n.location.href,channel:t.channel}),this.bus=new h.MessageBus(this.root,this.channel),this.rpcServer=new h.RPCServer(this.bus),this.apiProxyServer=new y(this.braintreeApiClient),this.apiProxyServer.attach(this.rpcServer),e=t.inlineFramePath||this.clientToken.assetsUrl+"/dropin/"+E+"/inline-frame.html",i=t.modalFramePath||this.clientToken.assetsUrl+"/dropin/"+E+"/modal-frame.html",a=document.documentElement,u=document.body,this.frames={inline:this._createFrame(e,_.INLINE_FRAME_NAME),modal:this._createFrame(i,_.MODAL_FRAME_NAME)},this.container=f(t.merchantConfiguration.container,"Unable to find valid container."),r=f(t.merchantConfiguration.form||this._findClosest(this.container,"form")),this.merchantFormManager=new b({form:r,frames:this.frames,onSubmit:this.paymentMethodNonceReceivedCallback,apiClient:this.braintreeApiClient}).initialize(),this.destructor.registerFunctionForTeardown(m(function(){this.merchantFormManager.teardown()},this)),t.gatewayConfiguration.paypalEnabled&&this._configurePayPal(),this.braintreeApiClient.sendAnalyticsEvents("dropin.web.initialized")}var a,u,c=t("braintree-api"),l=t("braintree-bus"),p=t("destructor"),h=t("braintree-rpc"),d=t("braintree-utilities"),f=d.normalizeElement,m=d.bind,g=d.isBrowserHttps,y=t("./api-proxy-server"),b=t("./merchant-form-manager"),v=t("./frame-container"),_=t("../shared/constants"),E="1.9.3",w=t("braintree-paypal/src/external/views/app-view");s.prototype.initialize=function(){var t,e=this;this._initializeModal(),this.braintreeBus.emit(l.events.ASYNC_DEPENDENCY_INITIALIZING),this.container.appendChild(this.frames.inline.element),u.appendChild(this.frames.modal.element),this.destructor.registerFunctionForTeardown(function(t){e._hideModal(function(){e.container.removeChild(e.frames.inline.element),u.removeChild(e.frames.modal.element),t()})}),this.rpcServer.define("receiveSharedCustomerIdentifier",function(n){for(e.braintreeApiClient.attrs.sharedCustomerIdentifier=n,e.braintreeApiClient.attrs.sharedCustomerIdentifierType="browser_session_cookie_store",t=0;t<e.configurationRequests.length;t++)e.configurationRequests[t](e.encodedClientToken);e.configurationRequests=[]}),this.braintreeBus.on(l.events.PAYMENT_METHOD_GENERATED,m(this._handleAltPayData,this)),this.rpcServer.define("getConfiguration",function(t){t({enableCORS:e.merchantConfiguration.enableCORS,clientToken:e.encodedClientToken,paypalOptions:e.paypalOptions,analyticsConfiguration:e.analyticsConfiguration,merchantHttps:g()})}),this.rpcServer.define("selectPaymentMethod",function(t){e.frames.modal.rpcClient.invoke("selectPaymentMethod",[t]),e._showModal()}),this.rpcServer.define("sendAddedPaymentMethod",function(t){e.merchantFormManager.setNoncePayload(t),e.frames.inline.rpcClient.invoke("receiveNewPaymentMethod",[t])}),this.rpcServer.define("sendUsedPaymentMethod",function(t){e.frames.inline.rpcClient.invoke("selectPaymentMethod",[t])}),this.rpcServer.define("sendUnlockedNonce",function(t){e.merchantFormManager.setNoncePayload(t)}),this.rpcServer.define("clearNonce",function(){e.merchantFormManager.clearNoncePayload()}),this.rpcServer.define("closeDropInModal",function(){e._hideModal()}),this.rpcServer.define("setInlineFrameHeight",function(t){e.frames.inline.element.style.height=t+"px"}),this.bus.register("ready",function(t){t.source===e.frames.inline.element.contentWindow?e.frames.inline.rpcClient=new h.RPCClient(e.bus,t.source):t.source===e.frames.modal.element.contentWindow&&(e.frames.modal.rpcClient=new h.RPCClient(e.bus,t.source))})},s.prototype._createFrame=function(t,e){return new v(t,e,this.braintreeBus)},s.prototype._initializeModal=function(){this.frames.modal.element.style.display="none",this.frames.modal.element.style.position=o()?"absolute":"fixed",this.frames.modal.element.style.top="0",this.frames.modal.element.style.left="0",this.frames.modal.element.style.height="100%",this.frames.modal.element.style.width="100%"},s.prototype._lockMerchantWindowSize=function(){setTimeout(function(){a.style.overflow="hidden",u.style.overflow="hidden",u.style.height="100%",o()&&(a.style.position="relative",a.style.height=window.innerHeight+"px")},160)},s.prototype._unlockMerchantWindowSize=function(){var t=this.merchantPageDefaultStyles;t&&(u.style.height=t.body.height,u.style.overflow=t.body.overflow,a.style.overflow=t.html.overflow,o()&&(a.style.height=t.html.height,a.style.position=t.html.position),delete this.merchantPageDefaultStyles)},s.prototype._showModal=function(){var t=this,e=this.frames.modal.element;this.merchantPageDefaultStyles=r(),e.style.display="block",this.frames.modal.rpcClient.invoke("open",[],function(){setTimeout(function(){t._lockMerchantWindowSize(),e.contentWindow.focus()},200)})},s.prototype._hideModal=function(t){this._unlockMerchantWindowSize(),this.frames.modal.element.style.display="none",t&&t()},s.prototype._configurePayPal=function(){this.paypalModalView=new w({channel:this.channel,insertFrameFunction:this.paypalOptions.insertFrame,paypalAssetsUrl:this.clientToken.paypal.assetsUrl,isHermes:!!this.paypalOptions.singleUse&&!!this.paypalOptions.amount&&!!this.paypalOptions.currency})},s.prototype._handleAltPayData=function(t){this.merchantFormManager.setNoncePayload(t),this.frames.inline.rpcClient.invoke("receiveNewPaymentMethod",[t]),this.frames.modal.rpcClient.invoke("modalViewClose")},s.prototype._findClosest=function(t,e){e=e.toUpperCase();do if(t.nodeName===e)return t;while(t=t.parentNode);throw"Unable to find a valid "+e},s.prototype.teardown=function(t){this.paypalModalView&&this.paypalModalView.teardown(),this.braintreeBus.emit(_.MODAL_FRAME_TEARDOWN_EVENT,m(function(){this.braintreeBus.emit(_.INLINE_FRAME_TEARDOWN_EVENT,m(function(){this.destructor.teardown(m(function(e){return e?t(e):(this.braintreeBus.teardown(),void t())},this))},this))},this))},e.exports=s}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../shared/constants":239,"./api-proxy-server":234,"./frame-container":237,"./merchant-form-manager":238,"braintree-api":117,"braintree-bus":148,"braintree-paypal/src/external/views/app-view":183,"braintree-rpc":197,"braintree-utilities":215,destructor:216}],236:[function(t,e){"use strict";function n(t){var e=new i(t);return e.initialize(),e}var i=t("./client"),r="1.9.3";e.exports={create:n,VERSION:r}},{"./client":235}],237:[function(t,e){"use strict";function n(){var t,e=document.createElement("fakeelement");for(t in u)if("undefined"!=typeof e.style[t])return u[t];return null}function i(t,e){function i(n){n.target===t&&"height"===n.propertyName&&(e.emit(o.events.ASYNC_DEPENDENCY_READY),t.removeEventListener(r,i))}var r=n();r?t.addEventListener(r,i):setTimeout(function(){e.emit(o.events.ASYNC_DEPENDENCY_READY)},500)}function r(t,e,n){var r="height 210ms cubic-bezier(0.390, 0.575, 0.565, 1.000)",o=a({name:e,width:"100%",height:"68",style:{transition:r,WebkitTransition:r,MozTransition:r,msTransition:r,OTransition:r,border:"0",zIndex:"9999"}});this.element=o,setTimeout(function(){o.src=t+"#"+n.channel},0),e===s.INLINE_FRAME_NAME&&i(o,n)}var o=t("braintree-bus"),s=t("../shared/constants"),a=t("iframer"),u={transition:"transitionend","-o-transition":"otransitionEnd","-moz-transition":"transitionend","-webkit-transition":"webkitTransitionEnd"};e.exports=r},{"../shared/constants":239,"braintree-bus":148,iframer:219}],238:[function(t,e){"use strict";function n(t){this.formNapper=new r(t.form),this.frames=t.frames,this.onSubmit=t.onSubmit,this.apiClient=t.apiClient}var i=t("braintree-utilities"),r=t("form-napper");n.prototype.initialize=function(){return this._isSubmitBased()&&this._setElements(),this._setEvents(),this},n.prototype.setNoncePayload=function(t){this.noncePayload=t},n.prototype.clearNoncePayload=function(){this.noncePayload=null},n.prototype._isSubmitBased=function(){return!this.onSubmit},n.prototype._isCallbackBased=function(){return!!this.onSubmit},n.prototype._setElements=function(){this.nonceInput=this.formNapper.inject("payment_method_nonce","")},n.prototype._setEvents=function(){this.formNapper.hijack(i.bind(this._handleFormSubmit,this))},n.prototype._handleFormSubmit=function(t){this.noncePayload&&this.noncePayload.nonce?this._handleNonceReply(t):this.frames.inline.rpcClient.invoke("requestNonce",[],i.bind(function(e){this.setNoncePayload(e),this._handleNonceReply(t)},this))},n.prototype._handleNonceReply=function(t){this._isCallbackBased()?this.apiClient.sendAnalyticsEvents("dropin.web.end.callback",i.bind(function(){var e=this.noncePayload;e.originalEvent=t,this.onSubmit(e),setTimeout(i.bind(function(){delete e.originalEvent,this.frames.inline.rpcClient.invoke("clearLoadingState"),this.frames.inline.rpcClient.invoke("receiveNewPaymentMethod",[e])},this),200)},this)):this._triggerFormSubmission()},n.prototype._triggerFormSubmission=function(){this.nonceInput=this.formNapper.inject("payment_method_nonce",this.noncePayload.nonce),this.apiClient.sendAnalyticsEvents("dropin.web.end.auto-submit",i.bind(function(){this.formNapper.submit()},this))},n.prototype.teardown=function(){var t;this.nonceInput&&(t=this.formNapper.htmlForm,t.removeChild(this.nonceInput)),this.formNapper.detach()},e.exports=n},{"braintree-utilities":215,"form-napper":376}],239:[function(t,e){e.exports={PAYPAL_INTEGRATION_NAME:"PayPal",INLINE_FRAME_NAME:"braintree-dropin-frame",MODAL_FRAME_NAME:"braintree-dropin-modal-frame",PAYMENT_METHOD_TYPES:["CoinbaseAccount","PayPalAccount","CreditCard"],cssClassMap:{"American Express":"american-express","Diners Club":"diners-club",DinersClub:"diners-club",Discover:"discover",JCB:"jcb",Maestro:"maestro",MasterCard:"master-card",Solo:"solo",Switch:"switch",UKMaestro:"maestro",UnionPay:"unionpay",Visa:"visa"},INLINE_FRAME_TEARDOWN_EVENT:"dropin:TEARDOWN_INLINE_FRAME",MODAL_FRAME_TEARDOWN_EVENT:"dropin:TEARDOWN_MODAL_FRAME"}},{}],240:[function(t,e){(function(t){"use strict";function n(t,e){e=e||{};var r,s,a=t.children;for(s=0;s<a.length;s++)if(r=a[s],o(r)){var u=r.getAttribute("data-braintree-name");"postal_code"===u?e.billingAddress={postalCode:r.value}:e[u]=r.value,i(r)}else r.children&&r.children.length>0&&n(r,e);return e}function i(t){try{t.attributes.removeNamedItem("name")}catch(e){}}function r(t){n(t)}function o(t){return t.nodeType===s&&t.attributes["data-braintree-name"]}var s=t.Node?t.Node.ELEMENT_NODE:1;e.exports={extractValues:n,scrubAllAttributes:r,scrubAttributes:i,isBraintreeNode:o}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],241:[function(t,e){(function(n){"use strict";function i(t,e){var i=e.merchantConfiguration,o="object"==typeof i.paymentMethodNonceInputField;this.destructor=new s,this.apiClient=t,this.isCreditCardForm=i.useCreditCard===!1?!1:!0,this.htmlForm=document.getElementById(i.id),this.paymentMethodNonceInput=c(i.paymentMethodNonceInputField),this.htmlForm.appendChild(this.paymentMethodNonceInput),this.destructor.registerFunctionForTeardown(r.bind(function(){o?this.paymentMethodNonceInput.value="":this.htmlForm.removeChild(this.paymentMethodNonceInput)},this)),this.model=new u,this.bus=new a({merchantUrl:n.location.href,channel:e.channel}),this.setEvents(),this.destructor.registerFunctionForTeardown(r.bind(function(){this.bus.teardown()},this))}var r=t("braintree-utilities"),o=t("./fields"),s=t("destructor"),a=t("braintree-bus"),u=t("./models/payment-method-model"),c=t("./get-nonce-input"),l={message:"Unable to process payments at this time",type:"IMMEDIATE"};i.prototype.setEvents=function(){this.onSubmitHandler=r.bind(this.handleSubmit,this),this.onExternalNonceReceived=r.bind(this.onExternalNonceReceived,this),this.clearExternalNonce=r.bind(this.clearExternalNonce,this),r.addEventListener(this.htmlForm,"submit",this.onSubmitHandler),this.destructor.registerFunctionForTeardown(r.bind(function(){r.removeEventListener(this.htmlForm,"submit",this.onSubmitHandler)},this)),this.bus.on(a.events.PAYMENT_METHOD_GENERATED,this.onExternalNonceReceived),this.bus.on(a.events.PAYMENT_METHOD_CANCELLED,this.clearExternalNonce)},i.prototype.handleSubmit=function(t){var e;return t.preventDefault?t.preventDefault():t.returnValue=!1,this.isCreditCardForm?(e=this.model.get("type"),e&&"CreditCard"!==e?(o.scrubAllAttributes(this.htmlForm),void this.onNonceReceived(null,this.model.attributes)):void this.apiClient.tokenizeCard(o.extractValues(this.htmlForm),r.bind(function(t,e,n){t?this.onNonceReceived(l,null):(this.model.set({nonce:e,type:n.type,details:n.details}),this.onNonceReceived(null,this.model.attributes))},this))):void this.onNonceReceived(null,this.model.attributes)},i.prototype.writeNonceToDOM=function(){this.paymentMethodNonceInput.value=this.model.get("nonce")},i.prototype.onExternalNonceReceived=function(t){this.model.set(t),this.writeNonceToDOM()},i.prototype.clearExternalNonce=function(){this.model.reset()},i.prototype.onNonceReceived=function(t){var e=this.htmlForm;return t?void this.bus.emit(a.events.ERROR,l):(r.removeEventListener(e,"submit",this.onSubmitHandler),this.writeNonceToDOM(),void(e.submit&&("function"==typeof e.submit||e.submit.call)?e.submit():setTimeout(function(){e.querySelector('[type="submit"]').click()},1)))},i.prototype.teardown=function(){this.destructor.teardown()
5
- },e.exports=i}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./fields":240,"./get-nonce-input":242,"./models/payment-method-model":243,"braintree-bus":246,"braintree-utilities":258,destructor:259}],242:[function(t,e){"use strict";e.exports=function(t){var e;if("object"==typeof t)return t;e="payment_method_nonce","string"==typeof t&&(e=t);var n=document.createElement("input");return n.name=e,n.type="hidden",n}},{}],243:[function(t,e){"use strict";function n(){this.reset()}n.prototype.get=function(t){return this.attributes[t]},n.prototype.set=function(t){this.attributes=t||{}},n.prototype.reset=function(){this.attributes={}},e.exports=n},{}],244:[function(t,e){"use strict";e.exports=function(t){for(var e=t.getElementsByTagName("*"),n={},i=0;i<e.length;i++){var r=e[i].getAttribute("data-braintree-name");n[r]=!0}if(!n.number)throw new Error('Unable to find an input with data-braintree-name="number" in your form. Please add one.');if(n.expiration_date){if(n.expiration_month||n.expiration_year)throw new Error('You have inputs with data-braintree-name="expiration_date" AND data-braintree-name="expiration_(year|month)". Please use either "expiration_date" or "expiration_year" and "expiration_month".')}else{if(!n.expiration_month&&!n.expiration_year)throw new Error('Unable to find an input with data-braintree-name="expiration_date" in your form. Please add one.');if(!n.expiration_month)throw new Error('Unable to find an input with data-braintree-name="expiration_month" in your form. Please add one.');if(!n.expiration_year)throw new Error('Unable to find an input with data-braintree-name="expiration_year" in your form. Please add one.')}}},{}],245:[function(t,e){"use strict";function n(t,e){var n=e.merchantConfiguration||{},o=document.getElementById(n.id),s=n.useCreditCard===!1?!1:!0;if(!o)throw new Error('Unable to find form with id: "'+n.id+'"');return s&&r(o),new i(t,e)}var i=t("./lib/form"),r=t("./lib/validate-annotations");e.exports={setup:n}},{"./lib/form":241,"./lib/validate-annotations":244}],246:[function(t,e,n){arguments[4][52][0].apply(n,arguments)},{"./lib/check-origin":247,"./lib/events":248,dup:52,framebus:249}],247:[function(t,e,n){arguments[4][53][0].apply(n,arguments)},{dup:53}],248:[function(t,e,n){arguments[4][54][0].apply(n,arguments)},{dup:54}],249:[function(t,e,n){arguments[4][55][0].apply(n,arguments)},{dup:55}],250:[function(t,e,n){arguments[4][35][0].apply(n,arguments)},{dup:35}],251:[function(t,e,n){arguments[4][36][0].apply(n,arguments)},{dup:36}],252:[function(t,e,n){arguments[4][22][0].apply(n,arguments)},{dup:22}],253:[function(t,e,n){arguments[4][38][0].apply(n,arguments)},{dup:38}],254:[function(t,e,n){arguments[4][39][0].apply(n,arguments)},{dup:39}],255:[function(t,e,n){arguments[4][40][0].apply(n,arguments)},{dup:40}],256:[function(t,e,n){arguments[4][41][0].apply(n,arguments)},{"./array":250,dup:41}],257:[function(t,e,n){arguments[4][42][0].apply(n,arguments)},{dup:42}],258:[function(t,e,n){arguments[4][43][0].apply(n,arguments)},{"./lib/array":250,"./lib/base64":251,"./lib/dom":252,"./lib/events":253,"./lib/fn":254,"./lib/string":255,"./lib/url":256,"./lib/uuid":257,dup:43}],259:[function(t,e,n){arguments[4][80][0].apply(n,arguments)},{"batch-execute-functions":260,"braintree-utilities/lib/fn":261,dup:80}],260:[function(t,e,n){arguments[4][81][0].apply(n,arguments)},{dup:81}],261:[function(t,e,n){arguments[4][39][0].apply(n,arguments)},{dup:39}],262:[function(t,e,n){arguments[4][2][0].apply(n,arguments)},{"./coinbase-account":263,"./constants":264,"./credit-card":265,"./europe-bank-account":266,"./normalize-api-fields":268,"./parse-client-token":269,"./paypal-account":270,"./request/choose-driver":273,"./sepa-mandate":278,"./should-enable-cors":279,"./util":280,"braintree-3ds":289,"braintree-utilities":303,dup:2}],263:[function(t,e,n){arguments[4][3][0].apply(n,arguments)},{dup:3}],264:[function(t,e,n){arguments[4][4][0].apply(n,arguments)},{dup:4}],265:[function(t,e,n){arguments[4][5][0].apply(n,arguments)},{dup:5}],266:[function(t,e,n){arguments[4][6][0].apply(n,arguments)},{dup:6}],267:[function(t,e,n){arguments[4][7][0].apply(n,arguments)},{"./constants":264,"./parse-client-token":269,"./request/choose-driver":273,"./should-enable-cors":279,"./util":280,dup:7}],268:[function(t,e,n){arguments[4][8][0].apply(n,arguments)},{dup:8}],269:[function(t,e,n){arguments[4][9][0].apply(n,arguments)},{"./polyfill":271,"braintree-utilities":303,dup:9}],270:[function(t,e,n){arguments[4][10][0].apply(n,arguments)},{dup:10}],271:[function(t,e,n){arguments[4][11][0].apply(n,arguments)},{dup:11}],272:[function(t,e,n){arguments[4][12][0].apply(n,arguments)},{"../constants":264,"../util":280,"./parse-body":276,"./prep-body":277,dup:12}],273:[function(t,e,n){arguments[4][13][0].apply(n,arguments)},{"../util":280,"./ajax-driver":272,"./jsonp-driver":274,dup:13}],274:[function(t,e,n){arguments[4][14][0].apply(n,arguments)},{"../constants":264,"./jsonp":275,dup:14}],275:[function(t,e,n){arguments[4][15][0].apply(n,arguments)},{"../util":280,dup:15}],276:[function(t,e,n){arguments[4][16][0].apply(n,arguments)},{dup:16}],277:[function(t,e,n){arguments[4][17][0].apply(n,arguments)},{dup:17,"lodash.isstring":311}],278:[function(t,e,n){arguments[4][18][0].apply(n,arguments)},{dup:18}],279:[function(t,e,n){arguments[4][19][0].apply(n,arguments)},{dup:19}],280:[function(t,e,n){arguments[4][20][0].apply(n,arguments)},{dup:20,"lodash.isempty":304,"lodash.isobject":310}],281:[function(t,e,n){arguments[4][21][0].apply(n,arguments)},{"./lib/client":262,"./lib/get-configuration":267,"./lib/parse-client-token":269,"./lib/util":280,dup:21}],282:[function(t,e,n){arguments[4][22][0].apply(n,arguments)},{dup:22}],283:[function(t,e,n){arguments[4][23][0].apply(n,arguments)},{dup:23}],284:[function(t,e,n){arguments[4][24][0].apply(n,arguments)},{dup:24}],285:[function(t,e,n){arguments[4][25][0].apply(n,arguments)},{dup:25}],286:[function(t,e,n){arguments[4][26][0].apply(n,arguments)},{"./lib/dom":282,"./lib/events":283,"./lib/fn":284,"./lib/url":285,dup:26}],287:[function(t,e,n){arguments[4][27][0].apply(n,arguments)},{"../shared/receiver":294,"braintree-utilities":286,dup:27}],288:[function(t,e,n){arguments[4][28][0].apply(n,arguments)},{"./authorization_service":287,"./loader":290,"braintree-utilities":286,dup:28}],289:[function(t,e,n){arguments[4][29][0].apply(n,arguments)},{"./client":288,dup:29}],290:[function(t,e,n){arguments[4][30][0].apply(n,arguments)},{"./loader_display":291,"./loader_message":292,"./loader_spinner":293,dup:30}],291:[function(t,e,n){arguments[4][31][0].apply(n,arguments)},{dup:31}],292:[function(t,e,n){arguments[4][32][0].apply(n,arguments)},{dup:32}],293:[function(t,e,n){arguments[4][33][0].apply(n,arguments)},{dup:33}],294:[function(t,e,n){arguments[4][34][0].apply(n,arguments)},{"braintree-utilities":286,dup:34}],295:[function(t,e,n){arguments[4][35][0].apply(n,arguments)},{dup:35}],296:[function(t,e,n){arguments[4][36][0].apply(n,arguments)},{dup:36}],297:[function(t,e,n){arguments[4][22][0].apply(n,arguments)},{dup:22}],298:[function(t,e,n){arguments[4][38][0].apply(n,arguments)},{dup:38}],299:[function(t,e,n){arguments[4][39][0].apply(n,arguments)},{dup:39}],300:[function(t,e,n){arguments[4][40][0].apply(n,arguments)},{dup:40}],301:[function(t,e,n){arguments[4][41][0].apply(n,arguments)},{"./array":295,dup:41}],302:[function(t,e,n){arguments[4][42][0].apply(n,arguments)},{dup:42}],303:[function(t,e,n){arguments[4][43][0].apply(n,arguments)},{"./lib/array":295,"./lib/base64":296,"./lib/dom":297,"./lib/events":298,"./lib/fn":299,"./lib/string":300,"./lib/url":301,"./lib/uuid":302,dup:43}],304:[function(t,e,n){arguments[4][44][0].apply(n,arguments)},{dup:44,"lodash.isarguments":305,"lodash.isarray":306,"lodash.isfunction":307,"lodash.isstring":311,"lodash.keys":308}],305:[function(t,e,n){arguments[4][45][0].apply(n,arguments)},{dup:45}],306:[function(t,e,n){arguments[4][46][0].apply(n,arguments)},{dup:46}],307:[function(t,e,n){arguments[4][47][0].apply(n,arguments)},{dup:47}],308:[function(t,e,n){arguments[4][48][0].apply(n,arguments)},{dup:48,"lodash._getnative":309,"lodash.isarguments":305,"lodash.isarray":306}],309:[function(t,e,n){arguments[4][49][0].apply(n,arguments)},{dup:49}],310:[function(t,e,n){arguments[4][50][0].apply(n,arguments)},{dup:50}],311:[function(t,e,n){arguments[4][51][0].apply(n,arguments)},{dup:51}],312:[function(t,e,n){arguments[4][52][0].apply(n,arguments)},{"./lib/check-origin":313,"./lib/events":314,dup:52,framebus:315}],313:[function(t,e,n){arguments[4][53][0].apply(n,arguments)},{dup:53}],314:[function(t,e,n){arguments[4][54][0].apply(n,arguments)},{dup:54}],315:[function(t,e,n){arguments[4][55][0].apply(n,arguments)},{dup:55}],316:[function(t,e,n){arguments[4][35][0].apply(n,arguments)},{dup:35}],317:[function(t,e,n){arguments[4][36][0].apply(n,arguments)},{dup:36}],318:[function(t,e,n){arguments[4][22][0].apply(n,arguments)},{dup:22}],319:[function(t,e,n){arguments[4][38][0].apply(n,arguments)},{dup:38}],320:[function(t,e,n){arguments[4][39][0].apply(n,arguments)},{dup:39}],321:[function(t,e,n){arguments[4][40][0].apply(n,arguments)},{dup:40}],322:[function(t,e,n){arguments[4][41][0].apply(n,arguments)},{"./array":316,dup:41}],323:[function(t,e,n){arguments[4][42][0].apply(n,arguments)},{dup:42}],324:[function(t,e,n){arguments[4][43][0].apply(n,arguments)},{"./lib/array":316,"./lib/base64":317,"./lib/dom":318,"./lib/events":319,"./lib/fn":320,"./lib/string":321,"./lib/url":322,"./lib/uuid":323,dup:43}],325:[function(t,e,n){arguments[4][80][0].apply(n,arguments)},{"batch-execute-functions":326,"braintree-utilities/lib/fn":327,dup:80}],326:[function(t,e,n){arguments[4][81][0].apply(n,arguments)},{dup:81}],327:[function(t,e,n){arguments[4][39][0].apply(n,arguments)},{dup:39}],328:[function(t,e,n){arguments[4][83][0].apply(n,arguments)},{"./lib/default-attributes":329,dup:83,"lodash.assign":330,"lodash.isstring":341,setattributes:342}],329:[function(t,e,n){arguments[4][84][0].apply(n,arguments)},{dup:84}],330:[function(t,e,n){arguments[4][85][0].apply(n,arguments)},{dup:85,"lodash._baseassign":331,"lodash._createassigner":333,"lodash.keys":337}],331:[function(t,e,n){arguments[4][86][0].apply(n,arguments)},{dup:86,"lodash._basecopy":332,"lodash.keys":337}],332:[function(t,e,n){arguments[4][87][0].apply(n,arguments)},{dup:87}],333:[function(t,e,n){arguments[4][88][0].apply(n,arguments)},{dup:88,"lodash._bindcallback":334,"lodash._isiterateecall":335,"lodash.restparam":336}],334:[function(t,e,n){arguments[4][89][0].apply(n,arguments)},{dup:89}],335:[function(t,e,n){arguments[4][90][0].apply(n,arguments)},{dup:90}],336:[function(t,e,n){arguments[4][91][0].apply(n,arguments)},{dup:91}],337:[function(t,e,n){arguments[4][48][0].apply(n,arguments)},{dup:48,"lodash._getnative":338,"lodash.isarguments":339,"lodash.isarray":340}],338:[function(t,e,n){arguments[4][49][0].apply(n,arguments)},{dup:49}],339:[function(t,e,n){arguments[4][45][0].apply(n,arguments)},{dup:45}],340:[function(t,e,n){arguments[4][46][0].apply(n,arguments)},{dup:46}],341:[function(t,e,n){arguments[4][51][0].apply(n,arguments)},{dup:51}],342:[function(t,e,n){arguments[4][97][0].apply(n,arguments)},{dup:97}],343:[function(t,e){(function(n){"use strict";function i(t,e,i){e=e||{},this._clientToken=t,this._clientOptions=e,this._clientToken.correlationId=g.generateUid(),this.destructor=new o,this.channel=i,this.bus=new s({merchantUrl:n.location.href,channel:this.channel}),this.container=r.normalizeElement(e.container),this.paymentMethodNonceInputField=e.paymentMethodNonceInputField,this.insertFrameFunction=e.insertFrame,this.onSuccess=e.onSuccess,this.onCancelled=e.onCancelled,this.loggedInView=null,this.loggedOutView=null,this.appView=null,this.merchantPageView=null,this.paymentMethodNonceInputFieldView=null,this.overlayView=null,this.bridgeIframeView=null,this.insertUI=e.headless!==!0}var r=t("braintree-utilities"),o=t("destructor"),s=t("braintree-bus"),a=t("./views/app-view"),u=t("./views/logged-in-view"),c=t("./views/logged-out-view"),l=t("./views/overlay-view"),p=t("./views/merchant-page-view"),h=t("./views/payment-method-nonce-input-field-view"),d=t("./views/bridge-iframe-view"),f=t("../shared/util/browser"),m=t("../shared/constants"),g=t("../shared/util/util");i.prototype.initialize=function(){var t=r.bind(this._handleClickLogin,this);this._createViews(),this.bus.on(m.events.GET_CLIENT_TOKEN,r.bind(this._handleGetClientToken,this)),this.bus.on(m.events.GET_CLIENT_OPTIONS,r.bind(this._handleGetClientOptions,this)),this.insertUI&&this.bus.on(s.events.PAYMENT_METHOD_GENERATED,r.bind(this._handlePaymentMethodGenerated,this)),this.bus.on(s.events.PAYMENT_METHOD_CANCELLED,r.bind(this._handlePaymentMethodCancelled,this)),r.addEventListener(document.body,"click",t),this.destructor.registerFunctionForTeardown(function(){r.removeEventListener(document.body,"click",t)})},i.prototype._createViews=function(){var t,e=[];f.isBridgeIframeRequired()&&(this.bridgeIframeView=new d({container:this.container,paypalAssetsUrl:this._clientToken.paypal.assetsUrl,channel:this.channel}),e.push(this.bridgeIframeView)),this.appView=new a({insertFrameFunction:this.insertFrameFunction,paypalAssetsUrl:this._clientToken.paypal.assetsUrl,isHermes:g.isHermesConfiguration(this._clientToken,this._clientOptions),headless:this._clientOptions.headless,channel:this.channel}),e.push(this.appView),this.insertUI&&(this.paymentMethodNonceInputFieldView=new h({container:this.container,el:this.paymentMethodNonceInputField,channel:this.channel}),e.push(this.paymentMethodNonceInputFieldView),this.merchantPageView=new p({channel:this.channel}),e.push(this.merchantPageView),this.loggedInView=new u({paypalAssetsUrl:this._clientToken.paypal.assetsUrl,container:this.container,channel:this.channel}),e.push(this.loggedInView),this.loggedOutView=new c({paypalAssetsUrl:this._clientToken.paypal.assetsUrl,container:this.container,enablePayPalButton:g.isOneTimeHermesConfiguration(this._clientOptions),locale:this._clientOptions.locale,channel:this.channel}),e.push(this.loggedOutView),f.isPopupSupported()&&f.isOverlaySupported()&&(this.overlayView=new l({paypalAssetsUrl:this._clientToken.paypal.assetsUrl,onFocus:r.bind(function(){this.bus.emit(m.events.FOCUS_APP)},this),onClose:r.bind(function(){this.bus.emit(m.events.CLOSE_APP)},this),channel:this.channel}),e.push(this.overlayView))),this.destructor.registerFunctionForTeardown(function(){for(t=0;t<e.length;t++)e[t].teardown()})},i.prototype._handleClickLogin=function(t){for(var e=t.target||t.srcElement;;){if(null==e)return;if(e===t.currentTarget)return;if(this._isButton(e))break;e=e.parentNode}g.preventDefault(t),this.launch()},i.prototype.launch=function(){this.appView.open()},i.prototype._isButton=function(t){var e="braintree-paypal-button"===t.id,n=g.isOneTimeHermesConfiguration(this._clientOptions)&&t.className.match(/paypal-button(?!-widget)/);return e||n},i.prototype._handlePaymentMethodGenerated=function(t){t.type===m.NONCE_TYPE&&r.isFunction(this.onSuccess)&&this.onSuccess(t)},i.prototype._handlePaymentMethodCancelled=function(t){t.source===m.PAYPAL_INTEGRATION_NAME&&r.isFunction(this.onCancelled)&&this.onCancelled()},i.prototype._clientTokenData=function(){return{analyticsUrl:this._clientToken.analytics?this._clientToken.analytics.url:null,authorizationFingerprint:this._clientToken.authorizationFingerprint,clientApiUrl:this._clientToken.clientApiUrl,displayName:this._clientOptions.displayName||this._clientToken.paypal.displayName,paypalAssetsUrl:this._clientToken.paypal.assetsUrl,paypalClientId:this._clientToken.paypal.clientId,paypalPrivacyUrl:this._clientToken.paypal.privacyUrl,paypalUserAgreementUrl:this._clientToken.paypal.userAgreementUrl,billingAgreementsEnabled:this._clientToken.paypal.billingAgreementsEnabled,unvettedMerchant:this._clientToken.paypal.unvettedMerchant,payeeEmail:this._clientToken.paypal.payeeEmail,correlationId:this._clientToken.correlationId,offline:this._clientOptions.offline||this._clientToken.paypal.environmentNoNetwork,sdkVersion:this._clientToken.sdkVersion,merchantAppId:this._clientToken.merchantAppId}},i.prototype._handleGetClientToken=function(t){t(this._clientTokenData())},i.prototype._clientOptionsData=function(){return{locale:this._clientOptions.locale||"en_us",onetime:this._clientOptions.singleUse||!1,integration:this._clientOptions.integration||"paypal",enableShippingAddress:this._clientOptions.enableShippingAddress||!1,enableBillingAddress:this._clientOptions.enableBillingAddress||!1,enableHermes:g.isHermesConfiguration(this._clientToken,this._clientOptions),amount:this._clientOptions.amount||null,currency:this._clientOptions.currency||null,shippingAddressOverride:this._clientOptions.shippingAddressOverride||null,enableCORS:this._clientOptions.enableCORS}},i.prototype._handleGetClientOptions=function(t){t(this._clientOptionsData())},i.prototype.teardown=function(){this.destructor.teardown(r.bind(function(){this.bus.teardown()},this))},e.exports=i}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../shared/constants":354,"../shared/util/browser":361,"../shared/util/util":363,"./views/app-view":345,"./views/bridge-iframe-view":346,"./views/logged-in-view":347,"./views/logged-out-view":348,"./views/merchant-page-view":349,"./views/overlay-view":351,"./views/payment-method-nonce-input-field-view":352,"braintree-bus":312,"braintree-utilities":324,destructor:325}],344:[function(t,e){"use strict";function n(t,e,n){var i,p;if(e=e||{},p=e.onUnsupported,"function"!=typeof p&&(p=function(t){try{console.log(t)}catch(e){}}),!t)return p(new Error('Parameter "clientToken" cannot be null')),null;if(t=y.parseClientToken(t),!t.paypalEnabled)return p(new Error("PayPal is not enabled")),null;if(!l.detectedPostMessage())return p(new Error("unsupported browser detected")),null;if(!e.container)return p(new Error("Please supply a container for the PayPal button to be appended to")),null;if(!u(t,e))return p(new Error("unsupported protocol detected")),null;if(a(t,e))return p(new Error("Unvetted merchant client token does not include a payee email")),null;if(d(t,e)&&!o(e.locale))return p(new Error("This PayPal integration does not support this country")),null;if(f(e)){if(!r(e.currency))return p(new Error("This PayPal integration does not support this currency")),null;if(!s(e.amount))return p(new Error("Amount must be a number")),null}return i=new c(t,e,n),i.initialize(),i}function i(t,e){var n,i=e.length,r=!1;for(n=0;i>n;n++)t.toLowerCase()===e[n].toLowerCase()&&(r=!0);return r}function r(t){return i(t,p.HERMES_SUPPORTED_CURRENCIES)}function o(t){return i(h(t).split("_")[1],p.HERMES_SUPPORTED_COUNTRIES)}function s(t){return t=parseFloat(t),"number"==typeof t&&!isNaN(t)&&t>=0}function a(t,e){return t.paypal.unvettedMerchant&&(!d(t,e)||!t.paypal.payeeEmail)}function u(t,e){return t.paypal.allowHttp?!0:l.isPopupSupported()?!0:"merchantHttps"in e?e.merchantHttps:g.isBrowserHttps()}var c=t("./client"),l=t("../shared/util/browser"),p=t("../shared/constants"),h=t("../shared/get-locale"),d=t("../shared/util/util").isHermesConfiguration,f=t("../shared/util/util").isOneTimeHermesConfiguration,m="1.6.3",g=t("braintree-utilities"),y=t("braintree-api");e.exports={create:n,VERSION:m}},{"../shared/constants":354,"../shared/get-locale":356,"../shared/util/browser":361,"../shared/util/util":363,"./client":343,"braintree-api":281,"braintree-utilities":324}],345:[function(t,e,n){arguments[4][183][0].apply(n,arguments)},{"../../shared/constants":354,"../../shared/util/browser":361,"./modal-view":350,"./popup-view":353,"braintree-bus":312,"braintree-utilities":324,destructor:325,dup:183}],346:[function(t,e){"use strict";function n(t){this.options=t||{},this.el=r({src:this._buildUrl(),name:i.BRIDGE_FRAME_NAME,height:1,width:1,style:{position:"static",top:0,left:0,bottom:0,padding:0,margin:0,border:0,outline:"none",background:"transparent"}}),this.options.container.appendChild(this.el)}var i=t("../../shared/constants"),r=t("iframer");n.prototype._buildUrl=function(){var t=this.options.paypalAssetsUrl;return t+="/pwpp/",t+=i.VERSION,t+="/html/bridge-frame.html",t+="#"+this.options.channel},n.prototype.teardown=function(){this.options.container.removeChild(this.el)},e.exports=n},{"../../shared/constants":354,iframer:328}],347:[function(t,e){(function(n){"use strict";function i(t){this.options=t||{},this.wrapper=this.options.container||document.body,this.destructor=new o,this.bus=new s({merchantUrl:n.location.href,channel:t.channel}),this._initialize()}var r=t("braintree-utilities"),o=t("destructor"),s=t("braintree-bus"),a=t("../../shared/util/util"),u=t("../../shared/util/dom"),c=t("../../shared/constants");i.prototype._initialize=function(){var t=r.bind(this._handleClickLogout,this);this._createViewContainer(),this._createPayPalName(),this._createEmailNode(),this._createLogoutNode(),r.addEventListener(this.logoutNode,"click",t),this.destructor.registerFunctionForTeardown(r.bind(function(){r.removeEventListener(this.logoutNode,"click",t)},this)),this.bus.on(s.events.PAYMENT_METHOD_GENERATED,r.bind(this._handlePaymentMethodGenerated,this)),this.bus.on(s.events.PAYMENT_METHOD_CANCELLED,r.bind(this._handlePaymentMethodCancelled,this))},i.prototype._createViewContainer=function(){var t=["display: none","max-width: 500px","overflow: hidden","padding: 16px","background-image: url("+this.options.paypalAssetsUrl+"/pwpp/"+c.VERSION+"/images/paypal-small.png)","background-image: url("+this.options.paypalAssetsUrl+"/pwpp/"+c.VERSION+"/images/paypal-small.svg), none","background-position: 20px 50%","background-repeat: no-repeat","background-size: 13px 15px","border-top: 1px solid #d1d4d6","border-bottom: 1px solid #d1d4d6"].join(";");this.container=document.createElement("div"),this.container.id="braintree-paypal-loggedin",this.container.style.cssText=t,this.wrapper.appendChild(this.container)},i.prototype._createPayPalName=function(){var t=["color: #283036","font-size: 13px","font-weight: 800",'font-family: "Helvetica Neue", Helvetica, Arial, sans-serif',"margin-left: 36px","-webkit-font-smoothing: antialiased","-moz-font-smoothing: antialiased","-ms-font-smoothing: antialiased","font-smoothing: antialiased"].join(";");return this.payPalName=document.createElement("span"),this.payPalName.id="bt-pp-name",this.payPalName.innerHTML="PayPal",this.payPalName.style.cssText=t,this.container.appendChild(this.payPalName)},i.prototype._createEmailNode=function(){var t=["color: #6e787f","font-size: 13px",'font-family: "Helvetica Neue", Helvetica, Arial, sans-serif',"margin-left: 5px","-webkit-font-smoothing: antialiased","-moz-font-smoothing: antialiased","-ms-font-smoothing: antialiased","font-smoothing: antialiased"].join(";");this.emailNode=document.createElement("span"),this.emailNode.id="bt-pp-email",this.emailNode.style.cssText=t,this.container.appendChild(this.emailNode)},i.prototype._createLogoutNode=function(){var t=["color: #3d95ce","font-size: 11px",'font-family: "Helvetica Neue", Helvetica, Arial, sans-serif',"line-height: 20px","margin: 0 0 0 25px","padding: 0","background-color: transparent","border: 0","cursor: pointer","text-decoration: underline","float: right","-webkit-font-smoothing: antialiased","-moz-font-smoothing: antialiased","-ms-font-smoothing: antialiased","font-smoothing: antialiased"].join(";");this.logoutNode=document.createElement("button"),this.logoutNode.id="bt-pp-cancel",this.logoutNode.innerHTML="Cancel",this.logoutNode.style.cssText=t,this.container.appendChild(this.logoutNode)},i.prototype.show=function(t){this.container.style.display="block",u.setTextContent(this.emailNode,t)},i.prototype.hide=function(){this.container.style.display="none"},i.prototype._handleClickLogout=function(t){a.preventDefault(t),this.bus.emit(s.events.PAYMENT_METHOD_CANCELLED,{source:c.PAYPAL_INTEGRATION_NAME})},i.prototype._handlePaymentMethodGenerated=function(t){var e;t.type===c.NONCE_TYPE&&(e=t&&t.details&&t.details.email?t.details.email:"",this.show(e))},i.prototype._handlePaymentMethodCancelled=function(t){t.source===c.PAYPAL_INTEGRATION_NAME&&this.hide()},i.prototype.teardown=function(){this.wrapper.removeChild(this.container),this.destructor.teardown(),this.bus.teardown()},e.exports=i}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../shared/constants":354,"../../shared/util/dom":362,"../../shared/util/util":363,"braintree-bus":312,"braintree-utilities":324,destructor:325}],348:[function(t,e){(function(n){"use strict";function i(t){this.options=t,this.wrapper=this.options.container||document.body,this.bus=new o({merchantUrl:n.location.href,channel:t.channel}),this._initialize()}var r=t("braintree-utilities"),o=t("braintree-bus"),s=t("../../shared/constants"),a=t("../../shared/get-locale");i.prototype._initialize=function(){this.createViewContainer(),this.options.enablePayPalButton?this.createCheckoutWithPayPalButton():this.createPayWithPayPalButton(),this.bus.on(o.events.PAYMENT_METHOD_GENERATED,r.bind(this._handlePaymentMethodGenerated,this)),this.bus.on(o.events.PAYMENT_METHOD_CANCELLED,r.bind(this._handlePaymentMethodCancelled,this))},i.prototype.createViewContainer=function(){this.container=document.createElement("div"),this.container.id="braintree-paypal-loggedout",this.wrapper.appendChild(this.container),this.loginNode=this.container},i.prototype.createPayWithPayPalButton=function(){var t=document.createElement("a"),e=new Image,n=["max-width: 100%","display: block","width: 100%","height: 100%","outline: none","border: 0"].join(";"),i=["display: block","width: 115px","height: 44px","overflow: hidden"].join(";");t.id="braintree-paypal-button",t.href="#",t.style.cssText=i,e.src=this.options.paypalAssetsUrl+"/pwpp/"+s.VERSION+"/images/pay-with-paypal.png",e.setAttribute("alt","Pay with PayPal"),e.style.cssText=n,t.appendChild(e),this.container.appendChild(t)},i.prototype.createCheckoutWithPayPalButton=function(){var t,e=document.createElement("script"),n={"data-merchant":"merchant-id","data-button":"checkout","data-type":"button","data-color":"blue","data-lc":a(this.options.locale)};e.src="//www.paypalobjects.com/api/button.js",e.async=!0;for(t in n)n.hasOwnProperty(t)&&e.setAttribute(t,n[t]);this.container.appendChild(e)},i.prototype.show=function(){this.container.style.display="block"},i.prototype.hide=function(){this.container.style.display="none"},i.prototype._handlePaymentMethodGenerated=function(t){t.type===s.NONCE_TYPE&&this.hide()},i.prototype._handlePaymentMethodCancelled=function(t){t.source===s.PAYPAL_INTEGRATION_NAME&&this.show()},i.prototype.teardown=function(){this.wrapper.removeChild(this.container),this.bus.teardown()},e.exports=i}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../shared/constants":354,"../../shared/get-locale":356,"braintree-bus":312,"braintree-utilities":324}],349:[function(t,e){(function(n){"use strict";function i(t){this.options=t,this.bus=new s({merchantUrl:n.location.href,channel:t.channel}),this.bus.on(u.events.UI_MODAL_DID_OPEN,a.bind(this.lockWindowSize,this)),this.bus.on(u.events.UI_MODAL_DID_CLOSE,a.bind(this.unlockWindowSize,this))}function r(t){var e=window.getComputedStyle?getComputedStyle(t):t.currentStyle;return{overflow:e.overflow||"",height:t.style.height||""}}function o(){return{html:{node:document.documentElement,styles:r(document.documentElement)},body:{node:document.body,styles:r(document.body)}}}var s=t("braintree-bus"),a=t("braintree-utilities"),u=t("../../shared/constants");i.prototype.lockWindowSize=function(){this.defaultStyles=o(),document.documentElement.style.height="100%",document.documentElement.style.overflow="hidden",document.body.style.height="100%",document.body.style.overflow="hidden"},i.prototype.unlockWindowSize=function(){this.defaultStyles&&(document.documentElement.style.height=this.defaultStyles.html.styles.height,document.documentElement.style.overflow=this.defaultStyles.html.styles.overflow,document.body.style.height=this.defaultStyles.body.styles.height,document.body.style.overflow=this.defaultStyles.body.styles.overflow,delete this.defaultStyles)},i.prototype._handleUIModalDidOpen=function(t){t.source===u.PAYPAL_INTEGRATION_NAME&&this.lockWindowSize()},i.prototype._handleUIModalDidClose=function(t){t.source===u.PAYPAL_INTEGRATION_NAME&&this.unlockWindowSize()},i.prototype.teardown=function(){this.unlockWindowSize(),this.bus.teardown()},e.exports=i}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../shared/constants":354,"braintree-bus":312,"braintree-utilities":324}],350:[function(t,e,n){arguments[4][184][0].apply(n,arguments)},{"../../shared/constants":354,"../../shared/util/browser":361,"braintree-bus":312,"braintree-utilities":324,dup:184,iframer:328}],351:[function(t,e){(function(n){"use strict";function i(t){this.options=t,this.spriteSrc=this.options.paypalAssetsUrl+"/pwpp/"+a.VERSION+"/images/pp_overlay_sprite.png",this.bus=new s({merchantUrl:n.location.href,channel:t.channel}),this.destructor=new o,this._create(),this._setupEvents(),this.bus.on(s.events.UI_POPUP_DID_OPEN,r.bind(this._handleUIPopupDidOpen,this)),this.bus.on(s.events.UI_POPUP_DID_CLOSE,r.bind(this._handleUIPopupDidClose,this))}var r=t("braintree-utilities"),o=t("destructor"),s=t("braintree-bus"),a=t("../../shared/constants");i.prototype.open=function(){document.body.contains(this.el)||document.body.appendChild(this.el)},i.prototype.close=function(){document.body.contains(this.el)&&document.body.removeChild(this.el)},i.prototype._handleUIPopupDidClose=function(t){t.source===a.PAYPAL_INTEGRATION_NAME&&this.close()},i.prototype._handleUIPopupDidOpen=function(t){t.source===a.PAYPAL_INTEGRATION_NAME&&this.open()},i.prototype._create=function(){this.el=document.createElement("div"),this.el.className="bt-overlay",this._setStyles(this.el,["z-index: 20001","position: fixed","top: 0","left: 0","height: 100%","width: 100%","text-align: center","background: #000","background: rgba(0,0,0,0.7)",'-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=52)"']),this.el.appendChild(this._createCloseIcon()),this.el.appendChild(this._createMessage())},i.prototype._createCloseIcon=function(){return this.closeIcon=document.createElement("div"),this.closeIcon.className="bt-close-overlay",this._setStyles(this.closeIcon,["position: absolute","top: 10px","right: 10px","cursor: pointer","background: url("+this.spriteSrc+") no-repeat 0 -67px","height: 14px","width: 14px"]),this.closeIcon},i.prototype._createMessage=function(){var t=document.createElement("div");return this._setStyles(t,["position: relative","top: 50%","max-width: 350px",'font-family: "HelveticaNeue", "HelveticaNeue-Light", "Helvetica Neue Light", helvetica, arial, sans-serif',"font-size: 14px","line-height: 20px","margin: -70px auto 0"]),t.appendChild(this._createLogo()),t.appendChild(this._createExplanation()),t.appendChild(this._createFocusLink()),t},i.prototype._createExplanation=function(){var t=document.createElement("div");return this._setStyles(t,["color: #FFF","margin-bottom: 20px"]),t.innerHTML="Don't see the secure PayPal browser? We'll help you re-launch the window to complete your purchase.",t},i.prototype._createLogo=function(){var t=document.createElement("div");return this._setStyles(t,["background: url("+this.spriteSrc+") no-repeat 0 0","width: 94px","height: 25px","margin: 0 auto 26px auto"]),t},i.prototype._createFocusLink=function(){return this.focusLink=document.createElement("a"),this._setStyles(this.focusLink,["color: #009be1","cursor: pointer"]),this.focusLink.innerHTML="Continue",this.focusLink},i.prototype._setStyles=function(t,e){var n=e.join(";");t.style.cssText=n},i.prototype._setupEvents=function(){var t=r.bind(this._handleClose,this),e=r.bind(this._handleFocus,this);
6
- r.addEventListener(this.closeIcon,"click",t),r.addEventListener(this.focusLink,"click",e),this.destructor.registerFunctionForTeardown(r.bind(function(){r.removeEventListener(this.closeIcon,"click",t),r.removeEventListener(this.focusLink,"click",e)},this))},i.prototype._handleClose=function(t){t.preventDefault(),this.close(),r.isFunction(this.options.onClose)&&this.options.onClose()},i.prototype._handleFocus=function(t){t.preventDefault(),r.isFunction(this.options.onFocus)&&this.options.onFocus()},i.prototype.teardown=function(){this.bus.teardown(),this.destructor.teardown(),this.close()},e.exports=i}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../shared/constants":354,"braintree-bus":312,"braintree-utilities":324,destructor:325}],352:[function(t,e){(function(n){"use strict";function i(t){this.options=t||{},this.container=this.options.container||document.body,this.el=this.options.el,this.destructor=new o,this.bus=new s({merchantUrl:n.location.href,channel:t.channel}),this._initialize()}var r=t("braintree-utilities"),o=t("destructor"),s=t("braintree-bus"),a=t("../../shared/constants");i.prototype._initialize=function(){r.isFunction(this.el)||(null!=this.el?(this.el=r.normalizeElement(this.el),this.destructor.registerFunctionForTeardown(r.bind(function(){this.clear()},this))):this.el=this.create()),this.bus.on(s.events.PAYMENT_METHOD_GENERATED,r.bind(this._handlePaymentMethodGenerated,this)),this.bus.on(s.events.PAYMENT_METHOD_CANCELLED,r.bind(this._handlePaymentMethodCancelled,this))},i.prototype.create=function(){var t=document.createElement("input");return t.name="payment_method_nonce",t.type="hidden",this.container.appendChild(t),this.destructor.registerFunctionForTeardown(r.bind(function(){this.container.removeChild(t)},this)),t},i.prototype.value=function(t){r.isFunction(this.el)?this.el(t):this.el.value=t},i.prototype.clear=function(){this.value("")},i.prototype._handlePaymentMethodCancelled=function(t){t.source===a.PAYPAL_INTEGRATION_NAME&&this.clear()},i.prototype._handlePaymentMethodGenerated=function(t){t.type===a.NONCE_TYPE&&this.value(t.nonce)},i.prototype.teardown=function(){this.destructor.teardown(),this.bus.teardown()},e.exports=i}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../shared/constants":354,"braintree-bus":312,"braintree-utilities":324,destructor:325}],353:[function(t,e,n){arguments[4][185][0].apply(n,arguments)},{"../../shared/constants":354,"../../shared/useragent/browser":357,"braintree-bus":312,dup:185}],354:[function(t,e,n){arguments[4][186][0].apply(n,arguments)},{dup:186}],355:[function(t,e){"use strict";e.exports={us:"en_us",gb:"en_uk",uk:"en_uk",de:"de_de",fr:"fr_fr",it:"it_it",es:"es_es",ca:"en_ca",au:"en_au",at:"de_de",be:"en_us",ch:"de_de",dk:"da_dk",nl:"nl_nl",no:"no_no",pl:"pl_pl",se:"sv_se",tr:"tr_tr",bg:"en_us",cy:"en_us",hr:"en_us",is:"en_us",kh:"en_us",mt:"en_us",my:"en_us",ru:"ru_ru"}},{}],356:[function(t,e){"use strict";function n(t){return-1!==t.indexOf("_")&&5===t.length}function i(t){var e,n;for(e in o)o.hasOwnProperty(e)&&(e===t?n=o[e]:o[e]===t&&(n=o[e]));return n}function r(t){var e,r;return t=t?t.toLowerCase():"us",t=t.replace(/-/g,"_"),e=n(t)?t:i(t),e?(r=e.split("_"),[r[0],r[1].toUpperCase()].join("_")):"en_US"}var o=t("../shared/data/country-code-lookup");e.exports=r},{"../shared/data/country-code-lookup":355}],357:[function(t,e,n){arguments[4][187][0].apply(n,arguments)},{"./platform":359,"./useragent":360,dup:187}],358:[function(t,e,n){arguments[4][188][0].apply(n,arguments)},{"./platform":359,"./useragent":360,dup:188}],359:[function(t,e,n){arguments[4][189][0].apply(n,arguments)},{"./useragent":360,dup:189}],360:[function(t,e,n){arguments[4][190][0].apply(n,arguments)},{dup:190}],361:[function(t,e,n){arguments[4][191][0].apply(n,arguments)},{"../useragent/browser":357,"../useragent/device":358,"../useragent/platform":359,"../useragent/useragent":360,dup:191}],362:[function(t,e){"use strict";function n(t,e){var n="innerText";document&&document.body&&"textContent"in document.body&&(n="textContent"),t[n]=e}e.exports={setTextContent:n}},{}],363:[function(t,e){"use strict";function n(){var t,e,n="";for(t=0;32>t;t++)e=Math.floor(16*Math.random()),n+=e.toString(16);return n}function i(t){return/^(true|1)$/i.test(t)}function r(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\"/g,"&quot;").replace(/\'/g,"&apos;")}function o(t){var e,n,i,r,o,s,a,u,c=t.indexOf("?"),l={};if(c>=0&&(t=t.substr(c+1)),0===t.length)return null;for(e=t.split("&"),n=0,i=e.length;i>n;n++)r=e[n],o=r.indexOf("="),s=r.substr(0,o),u=r.substr(o+1),a=decodeURIComponent(u),a=a.replace(/</g,"&lt;").replace(/>/g,"&gt;"),"false"===a&&(a=!1),(null==a||"true"===a)&&(a=!0),l[s]=a;return l}function s(t){t.preventDefault?t.preventDefault():t.returnValue=!1}function a(t){return Boolean(t.singleUse)&&Boolean(t.amount)&&Boolean(t.currency)}function u(t,e){return Boolean(t.paypal.billingAgreementsEnabled)&&!a(e)}function c(t,e){return u(t,e)||a(e)}var l="function"==typeof String.prototype.trim?function(t){return t.trim()}:function(t){return t.replace(/^\s+|\s+$/,"")},p="function"==typeof window.btoa?function(t){return window.btoa(t)}:function(t){for(var e,n,i,r,o,s,a,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c="",l=0;l<t.length;)e=t.charCodeAt(l++),n=t.charCodeAt(l++),i=t.charCodeAt(l++),r=e>>2,o=(3&e)<<4|n>>4,s=(15&n)<<2|i>>6,a=63&i,isNaN(n)?s=a=64:isNaN(i)&&(a=64),c=c+u.charAt(r)+u.charAt(o)+u.charAt(s)+u.charAt(a);return c};e.exports={trim:l,btoa:p,generateUid:n,castToBoolean:i,htmlEscape:r,parseUrlParams:o,preventDefault:s,isOneTimeHermesConfiguration:a,isBillingAgreementsHermesConfiguration:u,isHermesConfiguration:c}},{}],364:[function(t,e,n){arguments[4][35][0].apply(n,arguments)},{dup:35}],365:[function(t,e,n){arguments[4][36][0].apply(n,arguments)},{dup:36}],366:[function(t,e,n){arguments[4][22][0].apply(n,arguments)},{dup:22}],367:[function(t,e,n){arguments[4][38][0].apply(n,arguments)},{dup:38}],368:[function(t,e,n){arguments[4][39][0].apply(n,arguments)},{dup:39}],369:[function(t,e,n){arguments[4][40][0].apply(n,arguments)},{dup:40}],370:[function(t,e,n){arguments[4][41][0].apply(n,arguments)},{"./array":364,dup:41}],371:[function(t,e,n){arguments[4][42][0].apply(n,arguments)},{dup:42}],372:[function(t,e,n){arguments[4][43][0].apply(n,arguments)},{"./lib/array":364,"./lib/base64":365,"./lib/dom":366,"./lib/events":367,"./lib/fn":368,"./lib/string":369,"./lib/url":370,"./lib/uuid":371,dup:43}],373:[function(t,e,n){arguments[4][80][0].apply(n,arguments)},{"batch-execute-functions":374,"braintree-utilities/lib/fn":375,dup:80}],374:[function(t,e,n){arguments[4][81][0].apply(n,arguments)},{dup:81}],375:[function(t,e,n){arguments[4][39][0].apply(n,arguments)},{dup:39}],376:[function(t,e){(function(t){"use strict";function n(t){if(("string"==typeof t||t instanceof String)&&(t=document.getElementById(t)),!(t instanceof HTMLFormElement))throw new TypeError("FormNapper requires an HTMLFormElement element or the id string of one.");this.htmlForm=t}n.prototype.hijack=function(e){this.submitHandler||(this.submitHandler=function(t){t.preventDefault?t.preventDefault():t.returnValue=!1,e(t)},null!=t.addEventListener?this.htmlForm.addEventListener("submit",this.submitHandler,!1):null!=t.attachEvent?this.htmlForm.attachEvent("onsubmit",this.submitHandler):this.htmlForm.onsubmit=this.submitHandler)},n.prototype.inject=function(t,e){var n=this.htmlForm.querySelector('input[name="'+t+'"]');return null==n&&(n=document.createElement("input"),n.type="hidden",n.name=t,this.htmlForm.appendChild(n)),n.value=e,n},n.prototype.submit=function(){HTMLFormElement.prototype.submit.call(this.htmlForm)},n.prototype.detach=function(){this.submitHandler&&(null!=t.removeEventListener?this.htmlForm.removeEventListener("submit",this.submitHandler,!1):null!=t.detachEvent?this.htmlForm.detachEvent("onsubmit",this.submitHandler):this.htmlForm.onsubmit=null,delete this.submitHandler)},e.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],377:[function(t,e){var n=t("./lib/external"),i=t("./lib/shared/constants").events,r="1.0.0";e.exports={create:function(t){return new n(t)},events:i,VERSION:r}},{"./lib/external":379,"./lib/shared/constants":381}],378:[function(t,e){var n=t("../shared/constants");e.exports=function(t,e){return t+"/hosted-fields/"+n.VERSION+"/hosted-fields-frame.html#"+e}},{"../shared/constants":381}],379:[function(t,e){"use strict";function n(t,e){var n=document.createElement("div");return n.style.clear="both",e=e||document.body,e.appendChild(t),e.appendChild(n),{parent:e,children:[t,n]}}function i(t,e){return function(n){var i=t[n.fieldKey].containerElement,r=s(i);n.target={fieldKey:n.fieldKey,container:i},r.toggle(l.externalClasses.FOCUSED,n.isFocused).toggle(l.externalClasses.VALID,n.isValid),n.isStrictlyValidating?r.toggle(l.externalClasses.INVALID,!n.isValid):r.toggle(l.externalClasses.INVALID,!n.isPotentiallyValid),delete n.fieldKey,delete n.isStrictlyValidating,e&&e(n)}}function r(t){var e,r,p,d,f,g,y={},b=0;for(this.injectedNodes=[],this.destructor=new o,this.bus=new u({channel:t.channel,merchantUrl:location.href}),this.destructor.registerFunctionForTeardown(h.bind(function(){this.bus.teardown()},this)),this.bus.emit(u.events.ASYNC_DEPENDENCY_INITIALIZING),this.bus.emit(u.events.SEND_ANALYTICS_EVENTS,"hosted-fields.initialized"),f=0;f<l.whitelistedFields.length;f++)e=l.whitelistedFields[f],r=t.merchantConfiguration.hostedFields[e],r&&(p=document.querySelector(r.selector),p?p.querySelector('iframe[name^="braintree-"]')?this.bus.emit(u.events.ERROR,{message:'Cannot place two elements in "'+r.selector+'"'}):(d=a({type:e,name:"braintree-hosted-field-"+e,style:l.defaultIFrameStyle}),this.injectedNodes.push(n(d,p)),this.setupLabelFocus(e,p),y[e]={frameElement:d,containerElement:p},b++,setTimeout(function(e){return function(){e.src=c(t.gatewayConfiguration.assetsUrl,t.channel)}}(d),0)):(g='Unable to find element with selector "'+r.selector+'" for hostedFields.'+e,this.bus.emit(u.events.ERROR,{message:g})));this.bus.on(m.FRAME_READY,function(t){b--,t(0===b?!0:!1)}),this.bus.on(m.INPUT_EVENT,i(y,t.merchantConfiguration.hostedFields.onFieldEvent)),this.destructor.registerFunctionForTeardown(h.bind(function(){var t,e,n;for(t=0;t<this.injectedNodes.length;t++){for(n=this.injectedNodes[t],e=0;e<n.children.length;e++)n.parent.removeChild(n.children[e]);s(n.parent).remove(l.externalClasses.FOCUSED,l.externalClasses.INVALID,l.externalClasses.VALID)}},this))}var o=t("destructor"),s=t("classlist"),a=t("iframer"),u=t("braintree-bus"),c=t("./compose-url"),l=t("../shared/constants"),p=t("nodelist-to-array"),h=t("braintree-utilities"),d=t("../shared/find-parent-tags"),f=t("./should-use-label-focus"),m=l.events;r.prototype.setupLabelFocus=function(t,e){function n(){o.emit(m.TRIGGER_INPUT_FOCUS,t)}var i,r,o=this.bus;if(f()&&null!=e.id){for(i=p(document.querySelectorAll('label[for="'+e.id+'"]')),i=i.concat(d(e,"label")),r=0;r<i.length;r++)h.addEventListener(i[r],"click",n,!1);this.destructor.registerFunctionForTeardown(function(){for(r=0;r<i.length;r++)h.removeEventListener(i[r],"click",n,!1)})}},r.prototype.teardown=function(t){this.destructor.teardown(t)},e.exports=r},{"../shared/constants":381,"../shared/find-parent-tags":382,"./compose-url":378,"./should-use-label-focus":380,"braintree-bus":383,"braintree-utilities":395,classlist:396,destructor:399,iframer:402,"nodelist-to-array":417}],380:[function(t,e){"use strict";e.exports=function(){return!/(iPad|iPhone|iPod)/i.test(navigator.userAgent)}},{}],381:[function(t,e){"use strict";var n="1.0.0";e.exports={VERSION:n,events:{FRAME_READY:"hosted-fields:FRAME_READY",VALIDATE_STRICT:"hosted-fields:VALIDATE_STRICT",CONFIGURATION:"hosted-fields:CONFIGURATION",TOKENIZATION_REQUEST:"hosted-fields:TOKENIZATION_REQUEST",INPUT_EVENT:"hosted-fields:INPUT_EVENT",TRIGGER_INPUT_FOCUS:"hosted-fields:TRIGGER_INPUT_FOCUS"},externalEvents:{FOCUS:"focus",BLUR:"blur",FIELD_STATE_CHANGE:"fieldStateChange"},defaultMaxLengths:{number:19,postalCode:8,expirationDate:7,expirationMonth:2,expirationYear:4,cvv:3},externalClasses:{FOCUSED:"braintree-hosted-fields-focused",INVALID:"braintree-hosted-fields-invalid",VALID:"braintree-hosted-fields-valid"},defaultIFrameStyle:{border:"none",width:"100%",height:"100%","float":"left"},whitelistedFields:["number","cvv","expirationDate","expirationMonth","expirationYear","postalCode"],whitelistedStyles:["-moz-osx-font-smoothing","-moz-transition","-webkit-font-smoothing","-webkit-transition","color","font","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-weight","line-height","opacity","outline","text-shadow","transition"],passwordManagerFields:{number:{name:"credit-card-number",label:"Credit Card Number"},expirationDate:{name:"expiration",label:"Expiration Date"},postalCode:{name:"postal-code",label:"Postal Code"}}}},{}],382:[function(t,e){"use strict";function n(t,e){for(var n=t.parentNode,i=[];null!=n;)null!=n.tagName&&n.tagName.toLowerCase()===e&&i.push(n),n=n.parentNode;return i}e.exports=n},{}],383:[function(t,e,n){arguments[4][52][0].apply(n,arguments)},{"./lib/check-origin":384,"./lib/events":385,dup:52,framebus:386}],384:[function(t,e,n){arguments[4][53][0].apply(n,arguments)},{dup:53}],385:[function(t,e,n){arguments[4][54][0].apply(n,arguments)},{dup:54}],386:[function(t,e,n){arguments[4][55][0].apply(n,arguments)},{dup:55}],387:[function(t,e,n){arguments[4][35][0].apply(n,arguments)},{dup:35}],388:[function(t,e,n){arguments[4][36][0].apply(n,arguments)},{dup:36}],389:[function(t,e,n){arguments[4][22][0].apply(n,arguments)},{dup:22}],390:[function(t,e,n){arguments[4][38][0].apply(n,arguments)},{dup:38}],391:[function(t,e,n){arguments[4][39][0].apply(n,arguments)},{dup:39}],392:[function(t,e,n){arguments[4][40][0].apply(n,arguments)},{dup:40}],393:[function(t,e,n){arguments[4][41][0].apply(n,arguments)},{"./array":387,dup:41}],394:[function(t,e,n){arguments[4][42][0].apply(n,arguments)},{dup:42}],395:[function(t,e,n){arguments[4][43][0].apply(n,arguments)},{"./lib/array":387,"./lib/base64":388,"./lib/dom":389,"./lib/events":390,"./lib/fn":391,"./lib/string":392,"./lib/url":393,"./lib/uuid":394,dup:43}],396:[function(t,e){"use strict";function n(t){if(!(this instanceof n))return new n(t);var e,i=r(t.className).split(/\s+/);for(this._elem=t,this.length=0,e=0;e<i.length;e+=1)i[e]&&o.push.call(this,i[e])}e.exports=n;var i=t("component-indexof"),r=t("trim"),o=Array.prototype;n.prototype.add=function(){var t,e;for(e=0;e<arguments.length;e+=1)t=""+arguments[e],i(this,t)>=0||o.push.call(this,t);return this._elem.className=this.toString(),this},n.prototype.remove=function(){var t,e,n;for(n=0;n<arguments.length;n+=1)e=""+arguments[n],t=i(this,e),0>t||o.splice.call(this,t,1);return this._elem.className=this.toString(),this},n.prototype.contains=function(t){return t+="",i(this,t)>=0},n.prototype.toggle=function(t,e){return t+="",e===!0?this.add(t):e===!1?this.remove(t):this[this.contains(t)?"remove":"add"](t)},n.prototype.toString=function(){return o.join.call(this," ")}},{"component-indexof":397,trim:398}],397:[function(t,e){e.exports=function(t,e){if(t.indexOf)return t.indexOf(e);for(var n=0;n<t.length;++n)if(t[n]===e)return n;return-1}},{}],398:[function(t,e,n){function i(t){return t.replace(/^\s*|\s*$/g,"")}n=e.exports=i,n.left=function(t){return t.replace(/^\s*/,"")},n.right=function(t){return t.replace(/\s*$/,"")}},{}],399:[function(t,e,n){arguments[4][80][0].apply(n,arguments)},{"batch-execute-functions":400,"braintree-utilities/lib/fn":401,dup:80}],400:[function(t,e,n){arguments[4][81][0].apply(n,arguments)},{dup:81}],401:[function(t,e,n){arguments[4][39][0].apply(n,arguments)},{dup:39}],402:[function(t,e,n){arguments[4][83][0].apply(n,arguments)},{"./lib/default-attributes":403,dup:83,"lodash.assign":406,"lodash.isstring":404,setattributes:405}],403:[function(t,e,n){arguments[4][84][0].apply(n,arguments)},{dup:84}],404:[function(t,e,n){arguments[4][51][0].apply(n,arguments)},{dup:51}],405:[function(t,e,n){arguments[4][97][0].apply(n,arguments)},{dup:97}],406:[function(t,e,n){arguments[4][85][0].apply(n,arguments)},{dup:85,"lodash._baseassign":407,"lodash._createassigner":409,"lodash.keys":413}],407:[function(t,e,n){arguments[4][86][0].apply(n,arguments)},{dup:86,"lodash._basecopy":408,"lodash.keys":413}],408:[function(t,e,n){arguments[4][87][0].apply(n,arguments)},{dup:87}],409:[function(t,e,n){arguments[4][88][0].apply(n,arguments)},{dup:88,"lodash._bindcallback":410,"lodash._isiterateecall":411,"lodash.restparam":412}],410:[function(t,e,n){arguments[4][89][0].apply(n,arguments)},{dup:89}],411:[function(t,e,n){arguments[4][90][0].apply(n,arguments)},{dup:90}],412:[function(t,e,n){arguments[4][91][0].apply(n,arguments)},{dup:91}],413:[function(t,e,n){arguments[4][48][0].apply(n,arguments)},{dup:48,"lodash._getnative":414,"lodash.isarguments":415,"lodash.isarray":416}],414:[function(t,e,n){arguments[4][49][0].apply(n,arguments)},{dup:49}],415:[function(t,e,n){arguments[4][45][0].apply(n,arguments)},{dup:45}],416:[function(t,e,n){arguments[4][46][0].apply(n,arguments)},{dup:46}],417:[function(t,e){function n(t){try{return Array.prototype.slice.call(t)}catch(e){for(var n=[],i=0;i<t.length;i++)n.push(t[i]);return n}}"undefined"!=typeof e&&(e.exports=n)},{}],418:[function(t,e){function n(t,e,n){return"function"==typeof e?i(t,!0,r(e,n,3)):i(t,!0)}var i=t("lodash._baseclone"),r=t("lodash._bindcallback");e.exports=n},{"lodash._baseclone":419,"lodash._bindcallback":429}],419:[function(t,e){(function(n){function i(t,e,n,o,d,m,y){var b;if(n&&(b=d?n(t,o,d):n(t)),void 0!==b)return b;if(!c(t))return t;var v=f(t);if(v){if(b=s(t),!e)return l(t,b)}else{var _=z.call(t),w=_==E;if(_!=C&&_!=g&&(!w||d))return B[_]?u(t,_,e):d?t:{};if(b=a(w?{}:t),!e)return h(b,t)}m||(m=[]),y||(y=[]);for(var A=m.length;A--;)if(m[A]==t)return y[A];return m.push(t),y.push(b),(v?p:r)(t,function(r,o){b[o]=i(r,e,n,o,t,m,y)}),b}function r(t,e){return d(t,e,m)}function o(t){var e=new Y(t.byteLength),n=new G(e);return n.set(new G(t)),e}function s(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&V.call(t,"index")&&(n.index=t.index,n.input=t.input),n}function a(t){var e=t.constructor;return"function"==typeof e&&e instanceof e||(e=Object),new e}function u(t,e,n){var i=t.constructor;switch(e){case I:return o(t);case b:case v:return new i(+t);case x:case P:case R:case D:case M:case U:case k:case F:case L:var r=t.buffer;return new i(n?o(r):r,t.byteOffset,t.length);case A:case O:return new i(t);case N:var s=new i(t.source,j.exec(t));s.lastIndex=t.lastIndex}return s}function c(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}var l=t("lodash._arraycopy"),p=t("lodash._arrayeach"),h=t("lodash._baseassign"),d=t("lodash._basefor"),f=t("lodash.isarray"),m=t("lodash.keys"),g="[object Arguments]",y="[object Array]",b="[object Boolean]",v="[object Date]",_="[object Error]",E="[object Function]",w="[object Map]",A="[object Number]",C="[object Object]",N="[object RegExp]",T="[object Set]",O="[object String]",S="[object WeakMap]",I="[object ArrayBuffer]",x="[object Float32Array]",P="[object Float64Array]",R="[object Int8Array]",D="[object Int16Array]",M="[object Int32Array]",U="[object Uint8Array]",k="[object Uint8ClampedArray]",F="[object Uint16Array]",L="[object Uint32Array]",j=/\w*$/,B={};B[g]=B[y]=B[I]=B[b]=B[v]=B[x]=B[P]=B[R]=B[D]=B[M]=B[A]=B[C]=B[N]=B[O]=B[U]=B[k]=B[F]=B[L]=!0,B[_]=B[E]=B[w]=B[T]=B[S]=!1;var H=Object.prototype,V=H.hasOwnProperty,z=H.toString,Y=n.ArrayBuffer,G=n.Uint8Array;e.exports=i}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"lodash._arraycopy":420,"lodash._arrayeach":421,"lodash._baseassign":422,"lodash._basefor":424,"lodash.isarray":425,"lodash.keys":426}],420:[function(t,e){function n(t,e){var n=-1,i=t.length;for(e||(e=Array(i));++n<i;)e[n]=t[n];return e}e.exports=n},{}],421:[function(t,e){function n(t,e){for(var n=-1,i=t.length;++n<i&&e(t[n],n,t)!==!1;);return t}e.exports=n},{}],422:[function(t,e,n){arguments[4][86][0].apply(n,arguments)},{dup:86,"lodash._basecopy":423,"lodash.keys":426}],423:[function(t,e,n){arguments[4][87][0].apply(n,arguments)},{dup:87}],424:[function(t,e){function n(t){return function(e,n,r){for(var o=i(e),s=r(e),a=s.length,u=t?a:-1;t?u--:++u<a;){var c=s[u];if(n(o[c],c,o)===!1)break}return e}}function i(t){return r(t)?t:Object(t)}function r(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}var o=n();e.exports=o},{}],425:[function(t,e,n){arguments[4][46][0].apply(n,arguments)},{dup:46}],426:[function(t,e,n){arguments[4][48][0].apply(n,arguments)},{dup:48,"lodash._getnative":427,"lodash.isarguments":428,"lodash.isarray":425}],427:[function(t,e,n){arguments[4][49][0].apply(n,arguments)},{dup:49}],428:[function(t,e,n){arguments[4][45][0].apply(n,arguments)},{dup:45}],429:[function(t,e,n){arguments[4][89][0].apply(n,arguments)},{dup:89}],430:[function(t,e){function n(t,e,n){var s=r(t);return n&&o(t,e,n)&&(e=void 0),e?i(s,e):s}var i=t("lodash._baseassign"),r=t("lodash._basecreate"),o=t("lodash._isiterateecall");e.exports=n},{"lodash._baseassign":431,"lodash._basecreate":437,"lodash._isiterateecall":438}],431:[function(t,e,n){arguments[4][86][0].apply(n,arguments)},{dup:86,"lodash._basecopy":432,"lodash.keys":433}],432:[function(t,e,n){arguments[4][87][0].apply(n,arguments)},{dup:87}],433:[function(t,e,n){arguments[4][48][0].apply(n,arguments)},{dup:48,"lodash._getnative":434,"lodash.isarguments":435,"lodash.isarray":436}],434:[function(t,e,n){arguments[4][49][0].apply(n,arguments)},{dup:49}],435:[function(t,e,n){arguments[4][45][0].apply(n,arguments)},{dup:45}],436:[function(t,e,n){arguments[4][46][0].apply(n,arguments)},{dup:46}],437:[function(t,e){function n(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}var i=function(){function t(){}return function(e){if(n(e)){t.prototype=e;var i=new t;t.prototype=void 0}return i||{}}}();e.exports=i},{}],438:[function(t,e,n){arguments[4][90][0].apply(n,arguments)},{dup:90}],439:[function(t,e){"use strict";function n(t){var e,n={};if(t){for(e in t)t.hasOwnProperty(e)&&(n[i(e)]=t[e]);return n}}function i(t){return t.replace(/([A-Z])/g,function(t){return"_"+t.toLowerCase()})}e.exports={convertToLegacyShippingAddress:n}},{}],440:[function(t,e){"use strict";e.exports={ROOT_SUCCESS_CALLBACK:"onPaymentMethodReceived",ROOT_ERROR_CALLBACK:"onError",ROOT_READY_CALLBACK:"onReady"}},{}],441:[function(t,e){(function(n){"use strict";function i(){}function r(){this._dependenciesRemaining++}function o(){this._dependenciesRemaining--,0===this._dependenciesRemaining&&(delete this._dependenciesRemaining,this.bus.off(c.events.ASYNC_DEPENDENCY_INITIALIZING,this._handleDependencyInitializing),this.bus.off(c.events.ASYNC_DEPENDENCY_READY,this._handleDependencyReady),this._onIntegrationReady())}function s(t){this.configuration=t,this.isReady=!1,this.destructor=new l,this.bus=new c({channel:this.configuration.channel,merchantUrl:n.location.href}),this._createApiClient(),this._configureCallbacks(),this._configureAnalytics(),this._attachEvents(),this._emitInitializing()}var a=t("lodash.clonedeep"),u=t("braintree-api"),c=t("braintree-bus"),l=t("destructor"),p=t("braintree-utilities").bind,h=t("../constants"),d=t("../lib/sanitize-payload"),f=t("../lib/lookup-callback-for"),m=t("../lib/fallback-error-handler"),g=t("../lib/node-type"),y=g.isJQueryElement,b=g.isHTMLElement;s.prototype._emitInitializing=function(){this.bus.emit(c.events.ASYNC_DEPENDENCY_INITIALIZING)},s.prototype._createApiClient=function(){var t={clientToken:this.configuration.gatewayConfiguration,integration:this.configuration.integrationType,analyticsConfiguration:this.configuration.analyticsConfiguration};this.configuration.merchantConfiguration.enableCORS&&(t.enableCORS=!0),this.apiClient=new u.Client(t)},s.prototype._configureCallbacks=function(){function t(t){return function(e){t(d(e))}}var e=f(this.configuration.merchantConfiguration);this.onSuccess=t(e(h.ROOT_SUCCESS_CALLBACK)),this.onError=e(h.ROOT_ERROR_CALLBACK,m),this.onReady=e(h.ROOT_READY_CALLBACK)},s.prototype._configureAnalytics=function(){var t="web."+this.configuration.integrationType+".",e=this.apiClient;this.bus.on(c.events.SEND_ANALYTICS_EVENTS,function(n,i){var r;for(n instanceof Array||(n=[n]),r=0;r<n.length;r++)n[r]=t+n[r];e.sendAnalyticsEvents(n,i)})},s.prototype._attachEvents=function(){var t,e=this.configuration;this.bus.on(c.events.ERROR,this.onError),this.bus.on(c.events.PAYMENT_METHOD_RECEIVED,this.onSuccess),this.bus.on(c.events.WARNING,function(t){try{console.warn(t)}catch(e){}}),t={enableCORS:e.merchantConfiguration.enableCORS,configuration:e.gatewayConfiguration,integration:e.integrationType,analyticsConfiguration:e.analyticsConfiguration,merchantConfiguration:a(e.merchantConfiguration,function(t){return y(t)||b(t)?{}:void 0})},this.bus.on(c.events.CONFIGURATION_REQUEST,function(e){e(t)}),this._dependenciesRemaining=0,this._handleDependencyInitializing=p(r,this),this._handleDependencyReady=p(o,this),this.bus.on(c.events.ASYNC_DEPENDENCY_INITIALIZING,this._handleDependencyInitializing),this.bus.on(c.events.ASYNC_DEPENDENCY_READY,this._handleDependencyReady)},s.prototype._onIntegrationReady=function(){var t={teardown:p(function(e){function n(){throw new Error(o)}var r,o="Cannot call teardown while in progress";e=e||i;for(r in t)t.hasOwnProperty(r)&&(t[r]=n);this.destructor.teardown(p(function(){o="Cannot teardown integration more than once",this.bus.teardown(),e()},this))},this)};this.isReady=!0,this.onReady(t)},e.exports=s}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../constants":440,"../lib/fallback-error-handler":447,"../lib/lookup-callback-for":449,"../lib/node-type":450,"../lib/sanitize-payload":451,"braintree-api":21,"braintree-bus":52,"braintree-utilities":372,destructor:373,"lodash.clonedeep":418}],442:[function(t,e){"use strict";function n(){var t,e;c.apply(this,arguments),t=i(this.configuration.merchantConfiguration),this._attachBusEvents(),t.channel=this.configuration.channel,t.configuration=i(this.configuration.gatewayConfiguration),t.coinbase=i(t.coinbase||{}),t.apiClient=new o.Client({enableCORS:this.configuration.merchantConfiguration.enableCORS||!1,clientToken:this.configuration.gatewayConfiguration,integration:"coinbase"}),e=a.create(t),this.destructor.registerFunctionForTeardown(function(t){e.teardown(t)}),this.bus.emit(u.events.ASYNC_DEPENDENCY_READY)}var i=t("lodash.clonedeep"),r=t("lodash.create"),o=t("braintree-api"),s=t("braintree-utilities").bind,a=t("braintree-coinbase"),u=t("braintree-bus"),c=t("./base-integration");n.prototype=r(c.prototype,{constructor:n}),n.prototype._attachBusEvents=function(){this.bus.on(u.events.PAYMENT_METHOD_GENERATED,s(this._onPaymentMethodGenerated,this))},n.prototype._onPaymentMethodGenerated=function(t){this.bus.emit(u.events.PAYMENT_METHOD_RECEIVED,t)},e.exports=n},{"./base-integration":441,"braintree-api":21,"braintree-bus":52,"braintree-coinbase":56,"braintree-utilities":372,"lodash.clonedeep":418,"lodash.create":430}],443:[function(t,e){"use strict";function n(){m.apply(this,arguments),null!=this.configuration.merchantConfiguration.hostedFields?this._setupHostedFields():this._setupForm(),this._setupPayPal(),this._setupCoinbase(),this.bus.emit(d.events.ASYNC_DEPENDENCY_READY)}function i(t,e){return function(n){return e in t&&c.isFunction(t[e][n])?t[e][n]:function(){}}}var r=t("lodash.clonedeep"),o=t("lodash.create"),s=t("braintree-form"),a=t("braintree-paypal"),u=t("braintree-coinbase"),c=t("braintree-utilities"),l=t("hosted-fields"),p=t("form-napper"),h=t("../constants"),d=t("braintree-bus"),f=t("../compatibility").convertToLegacyShippingAddress,m=t("./base-integration"),g=t("../lib/node-type"),y=g.isJQueryElement,b=g.isHTMLElement,v=t("../lib/hosted-fields-nonce-manager");n.prototype=o(m.prototype,{constructor:n}),n.prototype._setupHostedFields=function(){var t,e=this.configuration.merchantConfiguration,n=e[h.ROOT_SUCCESS_CALLBACK],i=new p(e.id),r=l.create(this.configuration),o=new v({formNapper:i,rootCallback:n,channel:this.configuration.channel});return null==i.htmlForm?void this.bus.emit(d.events.ERROR,{type:"CONFIGURATION",message:"options.id does not reference a valid DOM element"}):(t=c.bind(o.handleSubmitRequest,o),i.hijack(t),this.bus.on(d.events.USER_FORM_SUBMIT_REQUEST,t),void this.destructor.registerFunctionForTeardown(c.bind(function(t){o.teardown(),i.detach(),r.teardown(t)},this)))},n.prototype._setupForm=function(){var t,e,n,i=this.configuration.merchantConfiguration;i.id?(n=s.setup(this.apiClient,this.configuration),t=!c.isFunction(i[h.ROOT_SUCCESS_CALLBACK]),t||(e=this.onSuccess,n.onNonceReceived=c.bind(function(t,n){t?this.bus.emit(d.events.ERROR,t):e(n)},this)),this.destructor.registerFunctionForTeardown(function(){n.teardown()})):this.bus.on(d.events.PAYMENT_METHOD_GENERATED,c.bind(function(t){this.bus.emit(d.events.PAYMENT_METHOD_RECEIVED,t)},this))},n.prototype._setupPayPal=function(){var t,e,n,o,s,u,c=this.configuration.merchantConfiguration;c.paypal&&(u=r(c.paypal,function(t){return y(t)?t[0]:b(t)?t:void 0}),t=i(c,"paypal"),e=t("onSuccess"),n=t("onCancelled"),u.paymentMethodNonceInputField||(o=document.createElement("input"),o.id="braintree-custom-integration-dummy-input",u.paymentMethodNonceInputField=o),u.onSuccess=function(t){e(t.nonce,t.details.email,f(t.details.shippingAddress))},u.onCancelled=function(){n()},c.enableCORS&&(u.enableCORS=!0),s=a.create(this.configuration.gatewayConfiguration,u,this.configuration.channel),null!=s&&this.destructor.registerFunctionForTeardown(function(){s.teardown()}))},n.prototype._setupCoinbase=function(){var t,e;this.configuration.merchantConfiguration.coinbase&&(navigator.userAgent.match(/MSIE 8\.0/)||(t=r(this.configuration.merchantConfiguration),t.channel=this.configuration.channel,t.configuration=this.configuration.gatewayConfiguration,t.apiClient=this.apiClient,delete t.paypal,e=u.create(t),this.destructor.registerFunctionForTeardown(function(t){e.teardown(t)})))},e.exports=n},{"../compatibility":439,"../constants":440,"../lib/hosted-fields-nonce-manager":448,"../lib/node-type":450,"./base-integration":441,"braintree-bus":52,"braintree-coinbase":56,"braintree-form":245,"braintree-paypal":344,"braintree-utilities":372,"form-napper":376,"hosted-fields":377,"lodash.clonedeep":418,"lodash.create":430}],444:[function(t,e){"use strict";function n(t){return a.isFunction(t.paymentMethodNonceReceived)?t.paymentMethodNonceReceived:null}function i(t){return a.isFunction(t[c.ROOT_SUCCESS_CALLBACK])}function r(){var t,e,r,o;p.apply(this,arguments),t=this.configuration.merchantConfiguration,e=n(t),r=i(t),(e||r)&&(t.paymentMethodNonceReceived=a.bind(function(t){e&&e(t.originalEvent,t.nonce),this.bus.emit(u.events.PAYMENT_METHOD_RECEIVED,l(t))},this)),o=s.create(this.configuration),this.destructor.registerFunctionForTeardown(function(t){o.teardown(t)}),this.bus.emit(u.events.ASYNC_DEPENDENCY_READY)}var o=t("lodash.create"),s=t("braintree-dropin"),a=t("braintree-utilities"),u=t("braintree-bus"),c=t("../constants"),l=t("../lib/sanitize-payload"),p=t("./base-integration");r.prototype=o(p.prototype,{constructor:r}),e.exports=r},{"../constants":440,"../lib/sanitize-payload":451,"./base-integration":441,"braintree-bus":52,"braintree-dropin":236,"braintree-utilities":372,"lodash.create":430}],445:[function(t,e){"use strict";e.exports={custom:t("./custom"),dropin:t("./dropin"),paypal:t("./paypal"),coinbase:t("./coinbase")}},{"./coinbase":442,"./custom":443,"./dropin":444,"./paypal":446}],446:[function(t,e){"use strict";
7
- function n(t){return"onSuccess"in t&&a.isFunction(t.onSuccess)?t.onSuccess:"paypal"in t&&a.isFunction(t.paypal.onSuccess)?t.paypal.onSuccess:null}function i(t){return a.isFunction(t[u.ROOT_SUCCESS_CALLBACK])}function r(){var t,e,r,o;p.apply(this,arguments),t=this.configuration.merchantConfiguration,e=n(t),r=i(t),(e||r)&&(t.onSuccess=a.bind(function(t){e&&e(t.nonce,t.details.email,l(t.details.shippingAddress)),this.bus.emit(c.events.PAYMENT_METHOD_RECEIVED,t)},this)),o=s.create(this.configuration.gatewayConfiguration,t,this.configuration.channel),this.destructor.registerFunctionForTeardown(function(){o.teardown()}),this.bus.emit(c.events.ASYNC_DEPENDENCY_READY)}var o=t("lodash.create"),s=t("braintree-paypal"),a=t("braintree-utilities"),u=t("../constants"),c=t("braintree-bus"),l=t("../compatibility").convertToLegacyShippingAddress,p=t("./base-integration");r.prototype=o(p.prototype,{constructor:r}),e.exports=r},{"../compatibility":439,"../constants":440,"./base-integration":441,"braintree-bus":52,"braintree-paypal":344,"braintree-utilities":372,"lodash.create":430}],447:[function(t,e){"use strict";e.exports=function(t){if("CONFIGURATION"===t.type||"IMMEDIATE"===t.type)throw new Error(t.message);try{console.error(JSON.stringify(t))}catch(e){}}},{}],448:[function(t,e){"use strict";function n(t){this.paymentMethod=null,this.nonceInputElement=null,this.bus=new i({channel:t.channel}),this.formNapper=t.formNapper,this.rootCallback=t.rootCallback,this._attachEvents()}var i=t("braintree-bus"),r=t("hosted-fields"),o="web.custom.hosted-fields.via.",s="payment_method_nonce";n.prototype._clearNonce=function(){this.paymentMethod=null,this.nonceInputElement=this.formNapper.inject(s,"")},n.prototype._attachEvents=function(){var t=this;this.bus.on(i.events.PAYMENT_METHOD_CANCELLED,function(){t._clearNonce()}),this.bus.on(i.events.PAYMENT_METHOD_GENERATED,function(e){t.paymentMethod=e,t.nonceInputElement=t.formNapper.inject(s,t.paymentMethod.nonce)})},n.prototype.handleSubmitRequest=function(){var t=this;this.bus.emit(r.events.TOKENIZATION_REQUEST,function(e){var n=e[0],a=e[1];return n?void t.bus.emit(i.events.ERROR,n):(t.paymentMethod=a||t.paymentMethod,null==t.paymentMethod?(t.bus.emit(r.events.VALIDATE_STRICT),void t.bus.emit(i.events.ERROR,{type:"VALIDATION",message:"User did not enter a payment method"})):void(t.rootCallback?t.bus.emit(i.events.SEND_ANALYTICS_EVENTS,o+"callback.success",function(){t.rootCallback(t.paymentMethod)}):t.bus.emit(i.events.SEND_ANALYTICS_EVENTS,o+"formsubmit.success",function(){t.nonceInputElement=t.formNapper.inject(s,t.paymentMethod.nonce),t.formNapper.submit()})))})},n.prototype.teardown=function(){this._clearNonce()},e.exports=n},{"braintree-bus":52,"hosted-fields":377}],449:[function(t,e){"use strict";function n(){}var i=t("braintree-utilities").isFunction;e.exports=function(t){return function(e,r){return i(t[e])?t[e]:i(r)?r:n}}},{"braintree-utilities":372}],450:[function(t,e){"use strict";function n(t){return"object"==typeof t&&"jquery"in t&&0!==t.length}function i(t){return t&&1===t.nodeType}e.exports={isJQueryElement:n,isHTMLElement:i}},{}],451:[function(t,e){"use strict";e.exports=function(t){return{nonce:t.nonce,details:t.details,type:t.type}}},{}]},{},[1])(1)});
 
 
 
 
 
 
 
js/gene/braintree/config.codekit CHANGED
@@ -2,49 +2,126 @@
2
  "CodeKitInfo": "This is a CodeKit 2.x project configuration file. It is designed to sync project settings across multiple machines. MODIFYING THE CONTENTS OF THIS FILE IS A POOR LIFE DECISION. If you do so, you will likely cause CodeKit to crash. This file is not useful unless accompanied by the project that created it in CodeKit 2. This file is not backwards-compatible with CodeKit 1.x. For more information, see: http:\/\/incident57.com\/codekit",
3
  "creatorBuild": "19127",
4
  "files": {
5
- "\/braintree-0.1.js": {
6
  "fileType": 64,
7
- "ignore": 0,
8
- "ignoreWasSetByUser": 0,
9
- "inputAbbreviatedPath": "\/braintree-0.1.js",
10
- "outputAbbreviatedPath": "\/min\/braintree-0.1-min.js",
11
  "outputPathIsOutsideProject": 0,
12
  "outputPathIsSetByUser": 0,
13
  "outputStyle": 1,
14
- "syntaxCheckerStyle": 1
15
  },
16
- "\/express.js": {
17
  "fileType": 64,
18
  "ignore": 1,
19
- "ignoreWasSetByUser": 1,
20
- "inputAbbreviatedPath": "\/express.js",
21
- "outputAbbreviatedPath": "\/min\/express-min.js",
22
  "outputPathIsOutsideProject": 0,
23
  "outputPathIsSetByUser": 0,
24
  "outputStyle": 1,
25
  "syntaxCheckerStyle": 1
26
  },
27
- "\/vzero-0.7-min.js": {
28
  "fileType": 64,
29
  "ignore": 1,
30
  "ignoreWasSetByUser": 0,
31
- "inputAbbreviatedPath": "\/vzero-0.7-min.js",
32
- "outputAbbreviatedPath": "\/min\/vzero-0.7-min-min.js",
33
  "outputPathIsOutsideProject": 0,
34
  "outputPathIsSetByUser": 0,
35
  "outputStyle": 1,
36
  "syntaxCheckerStyle": 1
37
  },
38
- "\/vzero-0.7.js": {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  "fileType": 64,
40
  "ignore": 0,
41
  "ignoreWasSetByUser": 0,
42
- "inputAbbreviatedPath": "\/vzero-0.7.js",
43
- "outputAbbreviatedPath": "\/vzero-0.7-min.js",
44
  "outputPathIsOutsideProject": 0,
45
  "outputPathIsSetByUser": 1,
46
  "outputStyle": 1,
47
  "syntaxCheckerStyle": 0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  }
49
  },
50
  "hooks": [
2
  "CodeKitInfo": "This is a CodeKit 2.x project configuration file. It is designed to sync project settings across multiple machines. MODIFYING THE CONTENTS OF THIS FILE IS A POOR LIFE DECISION. If you do so, you will likely cause CodeKit to crash. This file is not useful unless accompanied by the project that created it in CodeKit 2. This file is not backwards-compatible with CodeKit 1.x. For more information, see: http:\/\/incident57.com\/codekit",
3
  "creatorBuild": "19127",
4
  "files": {
5
+ "\/express.js": {
6
  "fileType": 64,
7
+ "ignore": 1,
8
+ "ignoreWasSetByUser": 1,
9
+ "inputAbbreviatedPath": "\/express.js",
10
+ "outputAbbreviatedPath": "\/min\/express-min.js",
11
  "outputPathIsOutsideProject": 0,
12
  "outputPathIsSetByUser": 0,
13
  "outputStyle": 1,
14
+ "syntaxCheckerStyle": 0
15
  },
16
+ "\/express\/abstract-min.js": {
17
  "fileType": 64,
18
  "ignore": 1,
19
+ "ignoreWasSetByUser": 0,
20
+ "inputAbbreviatedPath": "\/express\/abstract-min.js",
21
+ "outputAbbreviatedPath": "\/express\/min\/abstract-min-min.js",
22
  "outputPathIsOutsideProject": 0,
23
  "outputPathIsSetByUser": 0,
24
  "outputStyle": 1,
25
  "syntaxCheckerStyle": 1
26
  },
27
+ "\/express\/paypal-min.js": {
28
  "fileType": 64,
29
  "ignore": 1,
30
  "ignoreWasSetByUser": 0,
31
+ "inputAbbreviatedPath": "\/express\/paypal-min.js",
32
+ "outputAbbreviatedPath": "\/express\/min\/paypal-min-min.js",
33
  "outputPathIsOutsideProject": 0,
34
  "outputPathIsSetByUser": 0,
35
  "outputStyle": 1,
36
  "syntaxCheckerStyle": 1
37
  },
38
+ "\/source\/express\/abstract.js": {
39
+ "fileType": 64,
40
+ "ignore": 0,
41
+ "ignoreWasSetByUser": 0,
42
+ "inputAbbreviatedPath": "\/source\/express\/abstract.js",
43
+ "outputAbbreviatedPath": "\/express\/abstract-min.js",
44
+ "outputPathIsOutsideProject": 0,
45
+ "outputPathIsSetByUser": 1,
46
+ "outputStyle": 1,
47
+ "syntaxCheckerStyle": 0
48
+ },
49
+ "\/source\/express\/paypal.js": {
50
+ "fileType": 64,
51
+ "ignore": 0,
52
+ "ignoreWasSetByUser": 0,
53
+ "inputAbbreviatedPath": "\/source\/express\/paypal.js",
54
+ "outputAbbreviatedPath": "\/express\/paypal-min.js",
55
+ "outputPathIsOutsideProject": 0,
56
+ "outputPathIsSetByUser": 1,
57
+ "outputStyle": 1,
58
+ "syntaxCheckerStyle": 0
59
+ },
60
+ "\/source\/vzero-integration.js": {
61
+ "fileType": 64,
62
+ "ignore": 0,
63
+ "ignoreWasSetByUser": 0,
64
+ "inputAbbreviatedPath": "\/source\/vzero-integration.js",
65
+ "outputAbbreviatedPath": "\/vzero-integration-min.js",
66
+ "outputPathIsOutsideProject": 0,
67
+ "outputPathIsSetByUser": 1,
68
+ "outputStyle": 1,
69
+ "syntaxCheckerStyle": 0
70
+ },
71
+ "\/source\/vzero-paypal.js": {
72
+ "fileType": 64,
73
+ "ignore": 0,
74
+ "ignoreWasSetByUser": 0,
75
+ "inputAbbreviatedPath": "\/source\/vzero-paypal.js",
76
+ "outputAbbreviatedPath": "\/vzero-paypal-min.js",
77
+ "outputPathIsOutsideProject": 0,
78
+ "outputPathIsSetByUser": 1,
79
+ "outputStyle": 1,
80
+ "syntaxCheckerStyle": 0
81
+ },
82
+ "\/source\/vzero.js": {
83
  "fileType": 64,
84
  "ignore": 0,
85
  "ignoreWasSetByUser": 0,
86
+ "inputAbbreviatedPath": "\/source\/vzero.js",
87
+ "outputAbbreviatedPath": "\/vzero-min.js",
88
  "outputPathIsOutsideProject": 0,
89
  "outputPathIsSetByUser": 1,
90
  "outputStyle": 1,
91
  "syntaxCheckerStyle": 0
92
+ },
93
+ "\/vzero-integration-min.js": {
94
+ "fileType": 64,
95
+ "ignore": 1,
96
+ "ignoreWasSetByUser": 0,
97
+ "inputAbbreviatedPath": "\/vzero-integration-min.js",
98
+ "outputAbbreviatedPath": "\/min\/vzero-integration-min-min.js",
99
+ "outputPathIsOutsideProject": 0,
100
+ "outputPathIsSetByUser": 0,
101
+ "outputStyle": 1,
102
+ "syntaxCheckerStyle": 1
103
+ },
104
+ "\/vzero-min.js": {
105
+ "fileType": 64,
106
+ "ignore": 1,
107
+ "ignoreWasSetByUser": 0,
108
+ "inputAbbreviatedPath": "\/vzero-min.js",
109
+ "outputAbbreviatedPath": "\/min\/vzero-min-min.js",
110
+ "outputPathIsOutsideProject": 0,
111
+ "outputPathIsSetByUser": 0,
112
+ "outputStyle": 1,
113
+ "syntaxCheckerStyle": 1
114
+ },
115
+ "\/vzero-paypal-min.js": {
116
+ "fileType": 64,
117
+ "ignore": 1,
118
+ "ignoreWasSetByUser": 0,
119
+ "inputAbbreviatedPath": "\/vzero-paypal-min.js",
120
+ "outputAbbreviatedPath": "\/min\/vzero-paypal-min-min.js",
121
+ "outputPathIsOutsideProject": 0,
122
+ "outputPathIsSetByUser": 0,
123
+ "outputStyle": 1,
124
+ "syntaxCheckerStyle": 1
125
  }
126
  },
127
  "hooks": [
js/gene/braintree/express.js CHANGED
@@ -81,13 +81,7 @@ var ppExpress = (function() {
81
  * @returns {*}
82
  */
83
  buyButtonPlacement: function() {
84
- var placement = document.getElementsByClassName("add-to-cart");
85
- if (placement.length > 0) {
86
- placement = placement[0];
87
- return placement;
88
- }
89
-
90
- return false;
91
  }
92
  };
93
 
@@ -100,7 +94,6 @@ var ppExpress = (function() {
100
  }
101
 
102
  initBraintree(config);
103
- initDom(config);
104
  return true;
105
  },
106
 
@@ -320,28 +313,23 @@ var ppExpress = (function() {
320
  * Setup braintree
321
  */
322
  function initBraintree(config) {
323
- braintree.setup(config.get('token'), "custom", {
324
- paypal: {
325
- container: "pp-express-container",
326
- singleUse: false,
327
- currency: config.get('currency'),
328
- locale: config.get('locale'),
329
- enableShippingAddress: true,
330
- headless: true
331
- },
332
-
333
- onReady: function (integration) {
334
- paypalIntegration = integration;
335
- },
336
-
337
- onPaymentMethodReceived: function (obj) {
338
  api.showModal();
339
 
340
  /* Build the order */
341
  new Ajax.Request(config.get('authUrl'), {
342
  method: 'POST',
343
  parameters: {
344
- 'paypal': JSON.stringify(obj),
345
  'product_id': config.get('productId'),
346
  'form_data': $('product_addtocart_form') ? $('product_addtocart_form').serialize() : $('pp_express_form').serialize()
347
  },
@@ -355,11 +343,18 @@ var ppExpress = (function() {
355
 
356
  onFailure: function () {
357
  api.hideModal();
358
- alert( typeof Translator === "object" ? Translator.translate("We were unable to complete the request. Please try again.") : "We were unable to complete the request. Please try again." );
359
  }
360
  });
361
-
 
 
362
  }
 
 
 
 
 
363
  });
364
  }
365
 
@@ -405,41 +400,6 @@ var ppExpress = (function() {
405
  }
406
  }
407
 
408
- /**
409
- * Add the buy button and modal events
410
- */
411
- function initDom(config) {
412
- /* Hide the overlay on click */
413
- api.getOverlay().addEventListener('click', function () {
414
- api.hideModal();
415
- });
416
-
417
- /* Append the buy button container next the cart button */
418
- var placement = config.get('buyButtonPlacement')(),
419
- buyButton = config.get('buyButton')();
420
-
421
- if( !placement ) {
422
- console.error("Invalid Braintree PayPal express placement element");
423
- return;
424
- }
425
-
426
- if( !buyButton ) {
427
- console.error("Invalid Braintree PayPal button element");
428
- return;
429
- }
430
-
431
- buyButton.addEventListener('click', function (event) {
432
- event.preventDefault();
433
-
434
- /* Validate product options and start the paypal flow */
435
- if (validateForm()) {
436
- paypalIntegration.paypal.initAuthFlow();
437
- }
438
- }, false);
439
-
440
- placement.appendChild(buyButton);
441
- }
442
-
443
  /**
444
  * Validate the form
445
  *
81
  * @returns {*}
82
  */
83
  buyButtonPlacement: function() {
84
+ return '.add-to-cart';
 
 
 
 
 
 
85
  }
86
  };
87
 
94
  }
95
 
96
  initBraintree(config);
 
97
  return true;
98
  },
99
 
313
  * Setup braintree
314
  */
315
  function initBraintree(config) {
316
+ var vzeroPaypal = new vZeroPayPalButton(
317
+ config.get('token'),
318
+ '',
319
+ false,
320
+ config.get('locale')
321
+ );
322
+
323
+ var options = {
324
+ validate: validateForm(),
325
+ onSuccess: function (payload) {
 
 
 
 
 
326
  api.showModal();
327
 
328
  /* Build the order */
329
  new Ajax.Request(config.get('authUrl'), {
330
  method: 'POST',
331
  parameters: {
332
+ 'paypal': JSON.stringify(payload),
333
  'product_id': config.get('productId'),
334
  'form_data': $('product_addtocart_form') ? $('product_addtocart_form').serialize() : $('pp_express_form').serialize()
335
  },
343
 
344
  onFailure: function () {
345
  api.hideModal();
346
+ alert(typeof Translator === "object" ? Translator.translate("We were unable to complete the request. Please try again.") : "We were unable to complete the request. Please try again.");
347
  }
348
  });
349
+ },
350
+ onReady: function (integration) {
351
+ paypalIntegration = integration;
352
  }
353
+ };
354
+
355
+ // Initialize the PayPal button logic on any valid buttons on the page
356
+ $$('[data-paypalexpress]').each(function (button) {
357
+ vzeroPaypal.attachPayPalButtonEvent(button, options);
358
  });
359
  }
360
 
400
  }
401
  }
402
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
403
  /**
404
  * Validate the form
405
  *
js/gene/braintree/express/abstract-min.js ADDED
@@ -0,0 +1 @@
 
1
+ var BraintreeExpressAbstract=Class.create();BraintreeExpressAbstract.prototype={initialize:function(e,t,o,s,a,n){this.clientToken=e,this.storeFrontName=t,this.formKey=o,this.source=s,this.urls=a,this.config=n||{},this._init(),this.insertDom()},_init:function(){return!1},insertDom:function(){this.getModal()||$$("body").first().insert('<div id="pp-express-overlay"></div><div id="pp-express-modal"></div><div id="pp-express-container"></div>')},getOverlay:function(){return document.getElementById("pp-express-overlay")},getModal:function(){return document.getElementById("pp-express-modal")},hideModal:function(){this.getOverlay().style.display="none",this.getModal().style.display="none",this.getModal().innerHTML=""},showModal:function(){this.getModal().innerHTML="",this.getModal().classList.add("loading"),this.getOverlay().style.display="block",this.getModal().style.display="block"},initModal:function(e){"undefined"==typeof e.form_key&&(e.form_key=this.formKey),"undefined"==typeof e.source&&(e.source=this.source),this.showModal(),new Ajax.Request(this.urls.authUrl,{method:"POST",parameters:e,onSuccess:function(e){this.getModal().classList.remove("loading"),this.getModal().innerHTML=e.responseText,this.prepareCoupon(),this.ajaxHandler()}.bind(this),onFailure:function(){this.hideModal(),alert("object"==typeof Translator?Translator.translate("We were unable to complete the request. Please try again."):"We were unable to complete the request. Please try again.")}.bind(this)})},updateShipping:function(e){this._setLoading($("paypal-express-submit")),new Ajax.Request(this.urls.shippingSaveUrl,{method:"POST",parameters:{submit_shipping:!0,shipping_method:e},onSuccess:function(e){var t=this._getJson(e);this._unsetLoading($("paypal-express-submit")),this._updateTotals(t)}.bind(this),onFailure:function(){this._unsetLoading($("paypal-express-submit")),api.hideModal(),alert("object"==typeof Translator?Translator.translate("We were unable to complete the request. Please try again."):"We were unable to complete the request. Please try again.")}})},prepareCoupon:function(){$("paypal-express-coupon")&&$("paypal-express-coupon").observe("keypress",function(e){var t=e.which||e.keyCode;t==Event.KEY_RETURN&&(Event.stop(e),this.updateCoupon())}.bind(this))},updateCoupon:function(e){return $("paypal-express-coupon-error").hide(),!e&&$("paypal-express-coupon")&&(e=$("paypal-express-coupon").value),""==e?!1:(this._setLoading($("paypal-express-coupon-apply")),new Ajax.Request(this.urls.couponSaveUrl,{method:"POST",parameters:{coupon:e},onSuccess:function(e){var t=this._getJson(e);this._unsetLoading($("paypal-express-coupon-apply")),this._updateTotals(t),1==t.success?($("paypal-express-coupon-remove").show(),$("paypal-express-coupon-apply").hide()):t.message&&$("paypal-express-coupon-error").update(t.message).show()}.bind(this),onFailure:function(){this._unsetLoading($("paypal-express-coupon-submit")),api.hideModal(),alert("object"==typeof Translator?Translator.translate("We were unable to complete the request. Please try again."):"We were unable to complete the request. Please try again.")}}),!1)},removeCoupon:function(){$("paypal-express-coupon-error").hide(),this._setLoading($("paypal-express-coupon-remove")),new Ajax.Request(this.urls.couponSaveUrl,{method:"POST",parameters:{remove:!0},onSuccess:function(e){var t=this._getJson(e);this._unsetLoading($("paypal-express-coupon-remove")),this._updateTotals(t),1==t.success?($("paypal-express-coupon-remove").hide(),$("paypal-express-coupon-apply").show(),$("paypal-express-coupon").value="",$("paypal-express-coupon").focus()):t.message&&$("paypal-express-coupon-error").update(t.message).show()}.bind(this),onFailure:function(){this._unsetLoading($("paypal-express-coupon-submit")),api.hideModal(),alert("object"==typeof Translator?Translator.translate("We were unable to complete the request. Please try again."):"We were unable to complete the request. Please try again.")}})},_updateTotals:function(e){"undefined"!=typeof e.totals&&$("paypal-express-totals").update(e.totals)},_getJson:function(e){return"undefined"!=typeof e.responseJSON?e.responseJSON:"string"==typeof e.responseText?e.responseText.evalJSON():void 0},_setLoading:function(e){return e?(e.setAttribute("disabled","disabled"),void e.addClassName("loading")):!1},_unsetLoading:function(e){return e?(e.removeAttribute("disabled"),void e.removeClassName("loading")):!1},ajaxHandler:function(){var e=this.getModal().getElementsByTagName("form"),t=0;if(e.length>0)for(t=0;t<e.length;t++)Element.observe(e[t],"submit",function(e){return Event.stop(e),this.getModal().classList.add("loading"),this.getModal().innerHTML="",new Ajax.Request(e.target.getAttribute("action"),{method:"POST",parameters:$(e.target).serialize(!0),onSuccess:function(e){return"complete"==e.responseText?void(document.location=this.urls.successUrl):(this.getModal().classList.remove("loading"),this.getModal().innerHTML=e.responseText,void this.ajaxHandler())}.bind(this),onFailure:function(){this.hideModal(),alert("object"==typeof Translator?Translator.translate("We were unable to complete the request. Please try again."):"We were unable to complete the request. Please try again.")}.bind(this)}),!1}.bind(this))},validateForm:function(){if("object"==typeof productAddToCartForm&&productAddToCartForm.validator.validate()){if("object"==typeof productAddToCartFormOld&&productAddToCartFormOld.validator.validate())return!0;if("object"!=typeof productAddToCartFormOld)return!0}return"object"!=typeof productAddToCartForm&&"object"!=typeof productAddToCartFormOld},attachToButtons:function(e){console.warn("This method cannot be called directly.")}};
js/gene/braintree/express/paypal-min.js ADDED
@@ -0,0 +1 @@
 
1
+ var BraintreePayPalExpress=Class.create(BraintreeExpressAbstract,{vzeroPayPal:!1,_init:function(){this.vzeroPayPal=new vZeroPayPalButton(this.config.token,"",!1,this.config.locale)},attachToButtons:function(a){var t={validate:this.validateForm,onSuccess:function(a){var t={paypal:JSON.stringify(a)};"undefined"!=typeof this.config.productId&&(t.product_id=this.config.productId,t.form_data=$("product_addtocart_form")?$("product_addtocart_form").serialize():$("pp_express_form").serialize()),this.initModal(t)}.bind(this)};a.each(function(a){a.up().addClassName("braintree-paypal-express-container")}),this.vzeroPayPal.attachPayPalButtonEvent(a,t)}});
js/gene/braintree/source/express/abstract.js ADDED
@@ -0,0 +1,365 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Magento Braintree class to bridge the v.zero JS SDK and Magento
3
+ *
4
+ * @class BraintreeExpressAbstract
5
+ *
6
+ * @author Dave Macaulay <dave@gene.co.uk>
7
+ */
8
+ var BraintreeExpressAbstract = Class.create();
9
+ BraintreeExpressAbstract.prototype = {
10
+
11
+ /**
12
+ * Initialize the Braintree Express abstract class
13
+ *
14
+ * @param clientToken Client token generated from server
15
+ * @param storeFrontName The store name to show within the PayPal modal window
16
+ * @param formKey
17
+ * @param urls
18
+ * @param config
19
+ */
20
+ initialize: function (clientToken, storeFrontName, formKey, source, urls, config) {
21
+ this.clientToken = clientToken;
22
+ this.storeFrontName = storeFrontName;
23
+ this.formKey = formKey;
24
+ this.source = source;
25
+
26
+ this.urls = urls;
27
+ this.config = config || {};
28
+
29
+ this._init();
30
+ this.insertDom();
31
+ },
32
+
33
+ /**
34
+ * Private init function
35
+ *
36
+ * @returns {boolean}
37
+ * @private
38
+ */
39
+ _init: function () {
40
+ return false;
41
+ },
42
+
43
+ /**
44
+ * Insert our elements into the DOM
45
+ */
46
+ insertDom: function () {
47
+ if (!this.getModal()) {
48
+ $$('body').first().insert('<div id="pp-express-overlay"></div>' +
49
+ '<div id="pp-express-modal"></div>' +
50
+ '<div id="pp-express-container"></div>'
51
+ );
52
+ }
53
+ },
54
+
55
+ /**
56
+ * Get modal's overlay element
57
+ *
58
+ * @returns {Element}
59
+ */
60
+ getOverlay: function() {
61
+ return document.getElementById('pp-express-overlay');
62
+ },
63
+
64
+ /**
65
+ * Get the modal element
66
+ *
67
+ * @returns {Element}
68
+ */
69
+ getModal: function() {
70
+ return document.getElementById('pp-express-modal');
71
+ },
72
+
73
+ /**
74
+ * Hide the modal
75
+ */
76
+ hideModal: function() {
77
+ this.getOverlay().style.display = 'none';
78
+ this.getModal().style.display = 'none';
79
+
80
+ this.getModal().innerHTML = '';
81
+ },
82
+
83
+ /**
84
+ * Show the modal
85
+ */
86
+ showModal: function() {
87
+ this.getModal().innerHTML = '';
88
+ this.getModal().classList.add('loading');
89
+
90
+ this.getOverlay().style.display = 'block';
91
+ this.getModal().style.display = 'block';
92
+ },
93
+
94
+ /**
95
+ * Init the modal
96
+ */
97
+ initModal: function (params) {
98
+ if (typeof params.form_key === 'undefined') {
99
+ params.form_key = this.formKey;
100
+ }
101
+ if (typeof params.source === 'undefined') {
102
+ params.source = this.source;
103
+ }
104
+ this.showModal();
105
+
106
+ /* Build the order */
107
+ new Ajax.Request(this.urls.authUrl, {
108
+ method: 'POST',
109
+ parameters: params,
110
+
111
+ onSuccess: function (data) {
112
+ this.getModal().classList.remove('loading');
113
+ this.getModal().innerHTML = data.responseText;
114
+ this.prepareCoupon();
115
+ this.ajaxHandler();
116
+ }.bind(this),
117
+
118
+ onFailure: function () {
119
+ this.hideModal();
120
+ alert(typeof Translator === "object" ? Translator.translate("We were unable to complete the request. Please try again.") : "We were unable to complete the request. Please try again.");
121
+ }.bind(this)
122
+ });
123
+ },
124
+
125
+ /**
126
+ * Update the grand total display within the modal
127
+ */
128
+ updateShipping: function (method) {
129
+ this._setLoading($('paypal-express-submit'));
130
+ new Ajax.Request(this.urls.shippingSaveUrl, {
131
+ method: 'POST',
132
+ parameters: {
133
+ 'submit_shipping': true,
134
+ 'shipping_method': method
135
+ },
136
+
137
+ onSuccess: function (data) {
138
+ var response = this._getJson(data);
139
+ this._unsetLoading($('paypal-express-submit'));
140
+ this._updateTotals(response);
141
+ }.bind(this),
142
+
143
+ onFailure: function () {
144
+ this._unsetLoading($('paypal-express-submit'));
145
+ api.hideModal();
146
+ alert( typeof Translator === "object" ? Translator.translate("We were unable to complete the request. Please try again.") : "We were unable to complete the request. Please try again." );
147
+ }
148
+ });
149
+ },
150
+
151
+ /**
152
+ * Prepare the coupon form by handling users hitting enter
153
+ */
154
+ prepareCoupon: function () {
155
+ if ($('paypal-express-coupon')) {
156
+ $('paypal-express-coupon').observe('keypress', function (event) {
157
+ var key = event.which || event.keyCode;
158
+ if (key == Event.KEY_RETURN) {
159
+ Event.stop(event);
160
+ this.updateCoupon();
161
+ }
162
+ }.bind(this));
163
+ }
164
+ },
165
+
166
+ /**
167
+ * Allow customers to add coupons into their basket
168
+ *
169
+ * @param coupon
170
+ */
171
+ updateCoupon: function (coupon) {
172
+ $('paypal-express-coupon-error').hide();
173
+ if (!coupon && $('paypal-express-coupon')) {
174
+ coupon = $('paypal-express-coupon').value;
175
+ }
176
+
177
+ // Only update if the coupon is set to something
178
+ if (coupon == '') {
179
+ return false;
180
+ }
181
+
182
+ this._setLoading($('paypal-express-coupon-apply'));
183
+ new Ajax.Request(this.urls.couponSaveUrl, {
184
+ method: 'POST',
185
+ parameters: {
186
+ 'coupon': coupon
187
+ },
188
+
189
+ onSuccess: function (data) {
190
+ var response = this._getJson(data);
191
+ this._unsetLoading($('paypal-express-coupon-apply'));
192
+ this._updateTotals(response);
193
+ if (response.success == true) {
194
+ $('paypal-express-coupon-remove').show();
195
+ $('paypal-express-coupon-apply').hide();
196
+ } else if (response.message) {
197
+ $('paypal-express-coupon-error').update(response.message).show();
198
+ }
199
+ }.bind(this),
200
+
201
+ onFailure: function () {
202
+ this._unsetLoading($('paypal-express-coupon-submit'));
203
+ api.hideModal();
204
+ alert( typeof Translator === "object" ? Translator.translate("We were unable to complete the request. Please try again.") : "We were unable to complete the request. Please try again." );
205
+ }
206
+ });
207
+ return false;
208
+ },
209
+
210
+ /**
211
+ * Allow the user the ability to remove the coupon code from their quote
212
+ */
213
+ removeCoupon: function () {
214
+ $('paypal-express-coupon-error').hide();
215
+ this._setLoading($('paypal-express-coupon-remove'));
216
+ new Ajax.Request(this.urls.couponSaveUrl, {
217
+ method: 'POST',
218
+ parameters: {
219
+ 'remove': true
220
+ },
221
+
222
+ onSuccess: function (data) {
223
+ var response = this._getJson(data);
224
+ this._unsetLoading($('paypal-express-coupon-remove'));
225
+ this._updateTotals(response);
226
+ if (response.success == true) {
227
+ $('paypal-express-coupon-remove').hide();
228
+ $('paypal-express-coupon-apply').show();
229
+ $('paypal-express-coupon').value = '';
230
+ $('paypal-express-coupon').focus();
231
+ } else if (response.message) {
232
+ $('paypal-express-coupon-error').update(response.message).show();
233
+ }
234
+ }.bind(this),
235
+
236
+ onFailure: function () {
237
+ this._unsetLoading($('paypal-express-coupon-submit'));
238
+ api.hideModal();
239
+ alert( typeof Translator === "object" ? Translator.translate("We were unable to complete the request. Please try again.") : "We were unable to complete the request. Please try again." );
240
+ }
241
+ });
242
+ },
243
+
244
+ /**
245
+ * Update the totals from the response
246
+ *
247
+ * @param response
248
+ * @private
249
+ */
250
+ _updateTotals: function (response) {
251
+ if (typeof response.totals !== 'undefined') {
252
+ $('paypal-express-totals').update(response.totals);
253
+ }
254
+ },
255
+
256
+ /**
257
+ * Return the JSON from the request
258
+ *
259
+ * @param data
260
+ * @returns {*}
261
+ * @private
262
+ */
263
+ _getJson: function (data) {
264
+ if (typeof data.responseJSON !== 'undefined') {
265
+ return data.responseJSON;
266
+ } else if (typeof data.responseText === 'string') {
267
+ return data.responseText.evalJSON();
268
+ }
269
+ },
270
+
271
+ /**
272
+ * Set an element to a loading state
273
+ *
274
+ * @param element
275
+ * @private
276
+ */
277
+ _setLoading: function (element) {
278
+ if (!element) {
279
+ return false;
280
+ }
281
+ element.setAttribute('disabled', 'disabled');
282
+ element.addClassName('loading');
283
+ },
284
+
285
+ /**
286
+ * Unset the loading state
287
+ *
288
+ * @param element
289
+ * @private
290
+ */
291
+ _unsetLoading: function (element) {
292
+ if (!element) {
293
+ return false;
294
+ }
295
+ element.removeAttribute('disabled');
296
+ element.removeClassName('loading');
297
+ },
298
+
299
+ /**
300
+ * Ajax handler
301
+ */
302
+ ajaxHandler: function () {
303
+ var forms = this.getModal().getElementsByTagName('form'),
304
+ i = 0;
305
+
306
+ if (forms.length > 0) {
307
+ for (i = 0; i < forms.length; i++) {
308
+ Element.observe(forms[i], 'submit', function (e) {
309
+ Event.stop(e);
310
+
311
+ this.getModal().classList.add('loading');
312
+ this.getModal().innerHTML = '';
313
+
314
+ new Ajax.Request(e.target.getAttribute('action'), {
315
+ method: 'POST',
316
+ parameters: $(e.target).serialize(true),
317
+
318
+ onSuccess: function (data) {
319
+ if (data.responseText == 'complete') {
320
+ document.location = this.urls.successUrl;
321
+ return;
322
+ }
323
+
324
+ this.getModal().classList.remove('loading');
325
+ this.getModal().innerHTML = data.responseText;
326
+ this.ajaxHandler();
327
+ }.bind(this),
328
+
329
+ onFailure: function () {
330
+ this.hideModal();
331
+ alert(typeof Translator === "object" ? Translator.translate("We were unable to complete the request. Please try again.") : "We were unable to complete the request. Please try again.");
332
+ }.bind(this)
333
+ });
334
+
335
+ return false;
336
+ }.bind(this));
337
+ }
338
+ }
339
+ },
340
+
341
+ /**
342
+ * Validate any present forms on the page
343
+ *
344
+ * @returns {boolean}
345
+ */
346
+ validateForm: function () {
347
+ // Validate the product add to cart form
348
+ if (typeof productAddToCartForm === 'object' && productAddToCartForm.validator.validate()) {
349
+ if (typeof productAddToCartFormOld === 'object' && productAddToCartFormOld.validator.validate()) {
350
+ return true;
351
+ } else if (typeof productAddToCartFormOld !== 'object') {
352
+ return true;
353
+ }
354
+ }
355
+
356
+ return (typeof productAddToCartForm !== 'object' && typeof productAddToCartFormOld !== 'object');
357
+ },
358
+
359
+ /**
360
+ * Attach the express instance to a number of buttons
361
+ */
362
+ attachToButtons: function (buttons) {
363
+ console.warn('This method cannot be called directly.');
364
+ }
365
+ };
js/gene/braintree/source/express/paypal.js ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var BraintreePayPalExpress = Class.create(BraintreeExpressAbstract, {
2
+ vzeroPayPal: false,
3
+
4
+ /**
5
+ * Init the PayPal button class
6
+ *
7
+ * @private
8
+ */
9
+ _init: function () {
10
+ this.vzeroPayPal = new vZeroPayPalButton(
11
+ this.config.token,
12
+ '',
13
+ false,
14
+ this.config.locale
15
+ );
16
+ },
17
+
18
+ /**
19
+ * Attach the PayPal instance to the buttons
20
+ *
21
+ * @param buttons
22
+ */
23
+ attachToButtons: function (buttons) {
24
+ var options = {
25
+ validate: this.validateForm,
26
+ onSuccess: function (payload) {
27
+
28
+ var params = {
29
+ paypal: JSON.stringify(payload)
30
+ };
31
+ if (typeof this.config.productId !== 'undefined') {
32
+ params.product_id = this.config.productId;
33
+ params.form_data = $('product_addtocart_form') ? $('product_addtocart_form').serialize() : $('pp_express_form').serialize();
34
+ }
35
+
36
+ this.initModal(params);
37
+ }.bind(this)
38
+ };
39
+
40
+ // Add a class to the parents of the buttons
41
+ buttons.each(function (button) {
42
+ button.up().addClassName('braintree-paypal-express-container');
43
+ });
44
+
45
+ // Initialize the PayPal button logic on any valid buttons on the page
46
+ this.vzeroPayPal.attachPayPalButtonEvent(buttons, options);
47
+ }
48
+
49
+ });
js/gene/braintree/source/vzero-integration.js ADDED
@@ -0,0 +1,798 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * The integration class for the Default checkout
3
+ *
4
+ * @class vZeroIntegration
5
+ * @author Dave Macaulay <dave@gene.co.uk>
6
+ */
7
+ var vZeroIntegration = Class.create();
8
+ vZeroIntegration.prototype = {
9
+
10
+ /**
11
+ * Create an instance of the integration
12
+ *
13
+ * @param vzero The vZero class that's being used by the checkout
14
+ * @param vzeroPaypal The vZero PayPal object
15
+ * @param paypalWrapperMarkUp The markup used to wrap the PayPal button
16
+ * @param paypalButtonClass The class of the button we need to replace with the above mark up
17
+ * @param isOnepage Is the integration a onepage checkout?
18
+ * @param config Any further config the integration wants to push into the class
19
+ * @param submitAfterPayment Is the checkout going to submit the actual payment after the payment step? For instance a checkout with a review step
20
+ */
21
+ initialize: function (vzero, vzeroPaypal, paypalWrapperMarkUp, paypalButtonClass, isOnepage, config, submitAfterPayment) {
22
+
23
+ // Only allow the system to be initialized twice
24
+ if (vZeroIntegration.prototype.loaded) {
25
+ console.error('Your checkout is including the Braintree resources multiple times, please resolve this.');
26
+ return false;
27
+ }
28
+ vZeroIntegration.prototype.loaded = true;
29
+
30
+ this.vzero = vzero || false;
31
+ this.vzeroPaypal = vzeroPaypal || false;
32
+
33
+ // If both methods aren't present don't run the integration
34
+ if (this.vzero === false && this.vzeroPaypal === false) {
35
+ console.warn('The vzero and vzeroPaypal objects are not initiated.');
36
+ return false;
37
+ }
38
+
39
+ this.paypalWrapperMarkUp = paypalWrapperMarkUp || false;
40
+ this.paypalButtonClass = paypalButtonClass || false;
41
+ this.submitButtonClass = this.paypalButtonClass;
42
+
43
+ this.isOnepage = isOnepage || false;
44
+
45
+ this.config = config || {};
46
+
47
+ this.submitAfterPayment = submitAfterPayment || false;
48
+
49
+ this._methodSwitchTimeout = false;
50
+
51
+ // Hosted fields hasn't been initialized yet
52
+ this._hostedFieldsInit = false;
53
+
54
+ // Wait for the DOM to finish loading before creating observers
55
+ document.observe("dom:loaded", function () {
56
+
57
+ // Call the function which is going to intercept the submit event
58
+ this.prepareSubmitObserver();
59
+ this.preparePaymentMethodSwitchObserver();
60
+
61
+ }.bind(this));
62
+
63
+ // Has the hosted fields method been generated successfully?
64
+ this.hostedFieldsGenerated = false;
65
+
66
+ // On onepage checkouts we need to do some other magic
67
+ if (this.isOnepage) {
68
+ this.observeAjaxRequests();
69
+
70
+ document.observe("dom:loaded", function () {
71
+ this.initSavedPayPal();
72
+ this.initDefaultMethod();
73
+
74
+ if ($('braintree-hosted-submit') !== null) {
75
+ this.initHostedFields();
76
+ }
77
+ }.bind(this));
78
+ }
79
+
80
+ document.observe("dom:loaded", function () {
81
+ // Saved methods need events to!
82
+ this.initSavedMethods();
83
+
84
+ if ($('braintree-hosted-submit') !== null) {
85
+ this.initHostedFields();
86
+ }
87
+ }.bind(this));
88
+
89
+ // Fire our onInit event
90
+ this.vzero.fireEvent(this, 'integration.onInit', {integration: this});
91
+ },
92
+
93
+ /**
94
+ * Init the saved method events
95
+ */
96
+ initSavedMethods: function () {
97
+
98
+ // Loop through each saved card being selected
99
+ $$('#creditcard-saved-accounts input[type="radio"], #paypal-saved-accounts input[type="radio"]').each(function (element) {
100
+
101
+ // Determine which method we're observing
102
+ var parentElement = '';
103
+ var targetElement = '';
104
+ if (element.up('#creditcard-saved-accounts') !== undefined) {
105
+ parentElement = '#creditcard-saved-accounts';
106
+ targetElement = '#credit-card-form';
107
+ } else if (element.up('#paypal-saved-accounts') !== undefined) {
108
+ parentElement = '#paypal-saved-accounts';
109
+ targetElement = '.paypal-info';
110
+ }
111
+
112
+ // Observe the elements changing
113
+ $(element).stopObserving('change').observe('change', function (event) {
114
+ return this.showHideOtherMethod(parentElement, targetElement);
115
+ }.bind(this));
116
+
117
+ }.bind(this));
118
+
119
+ },
120
+
121
+ /**
122
+ * Hide or show the "other" method for both PayPal & Credit Card
123
+ *
124
+ * @param parentElement
125
+ * @param targetElement
126
+ */
127
+ showHideOtherMethod: function (parentElement, targetElement) {
128
+
129
+ // Has the user selected other?
130
+ if ($$(parentElement + ' input:checked[type=radio]').first() !== undefined && $$(parentElement + ' input:checked[type=radio]').first().value == 'other') {
131
+
132
+ if ($$(targetElement).first() !== undefined) {
133
+
134
+ // Show the credit card form
135
+ $$(targetElement).first().show();
136
+
137
+ // Enable the credit card form all the elements in the credit card form
138
+ $$(targetElement + ' input, ' + targetElement + ' select').each(function (formElement) {
139
+ formElement.removeAttribute('disabled');
140
+ });
141
+
142
+ }
143
+
144
+ } else if ($$(parentElement + ' input:checked[type=radio]').first() !== undefined) {
145
+
146
+ if ($$(targetElement).first() !== undefined) {
147
+
148
+ // Hide the new credit card form
149
+ $$(targetElement).first().hide();
150
+
151
+ // Disable all the elements in the credit card form
152
+ $$(targetElement + ' input, ' + targetElement + ' select').each(function (formElement) {
153
+ formElement.setAttribute('disabled', 'disabled');
154
+ });
155
+
156
+ }
157
+
158
+ }
159
+
160
+ this.vzero.fireEvent(this, 'integration.onShowHideOtherMethod', {
161
+ parentElement: parentElement,
162
+ targetElement: targetElement
163
+ });
164
+ },
165
+
166
+ /**
167
+ * Check to see if the "Other" option is selected and show the div correctly
168
+ */
169
+ checkSavedOther: function () {
170
+ var parentElement = '';
171
+ var targetElement = '';
172
+
173
+ if (this.getPaymentMethod() == 'gene_braintree_creditcard') {
174
+ parentElement = '#creditcard-saved-accounts';
175
+ targetElement = '#credit-card-form';
176
+ } else if (this.getPaymentMethod() == 'gene_braintree_paypal') {
177
+ parentElement = '#paypal-saved-accounts';
178
+ targetElement = '.paypal-info';
179
+ }
180
+
181
+ // Only run this action if the parent element exists on the page
182
+ if ($$(parentElement).first() !== undefined) {
183
+ this.showHideOtherMethod(parentElement, targetElement);
184
+ }
185
+
186
+ this.vzero.fireEvent(this, 'integration.checkSavedOther');
187
+ },
188
+
189
+ afterPaymentMethodSwitch: function () {
190
+ return true;
191
+ },
192
+
193
+ /**
194
+ * Init hosted fields
195
+ */
196
+ initHostedFields: function () {
197
+
198
+ // Only init hosted fields if it's enabled
199
+ if (this.vzero.hostedFields) {
200
+
201
+ // Verify the form is on the page
202
+ if ($('braintree-hosted-submit') !== null) {
203
+
204
+ // Verify this checkout has a form (would be weird to have a formless checkout, but you never know!)
205
+ if ($('braintree-hosted-submit').up('form') !== undefined) {
206
+
207
+ // Flag hosted fields being init
208
+ this._hostedFieldsInit = true;
209
+
210
+ // Store the form in the integration class
211
+ this.form = $('braintree-hosted-submit').up('form');
212
+
213
+ // Init hosted fields upon the form
214
+ this.vzero.initHostedFields(this);
215
+
216
+ } else {
217
+ console.error('Hosted Fields cannot be initialized as we\'re unable to locate the parent form.');
218
+ }
219
+ }
220
+ }
221
+ },
222
+
223
+ /**
224
+ * Init the default payment methods
225
+ */
226
+ initDefaultMethod: function () {
227
+ if (this.shouldAddPayPalButton(false)) {
228
+ this.setLoading();
229
+ this.vzero.updateData(function () {
230
+ this.resetLoading();
231
+ this.updatePayPalButton('add');
232
+ }.bind(this));
233
+ }
234
+
235
+ // Run the after payment method switch on init of the default method
236
+ this.afterPaymentMethodSwitch();
237
+
238
+ this.vzero.fireEvent(this, 'integration.onInitDefaultMethod');
239
+ },
240
+
241
+ /**
242
+ * Observe any Ajax requests and refresh the PayPal button or update the checkouts data
243
+ */
244
+ observeAjaxRequests: function () {
245
+ this.vzero.observeAjaxRequests(function () {
246
+ this.vzero.updateData(function () {
247
+
248
+ // The Ajax request might kill our events
249
+ if (this.isOnepage) {
250
+ this.initSavedPayPal();
251
+ this.rebuildPayPalButton();
252
+ this.checkSavedOther();
253
+
254
+ // If hosted fields is enabled init the environment
255
+ if (this.vzero.hostedFields) {
256
+ this.initHostedFields();
257
+ }
258
+ }
259
+
260
+ // Make sure we're observing the saved methods correctly
261
+ this.initSavedMethods();
262
+
263
+ // Run the after payment method switch on init of the default method
264
+ this.afterPaymentMethodSwitch();
265
+
266
+ // Fire an event to capture any instances of the checkout updating it's DOM
267
+ this.vzero.fireEvent(this, 'integration.onObserveAjaxRequests');
268
+
269
+ }.bind(this));
270
+ }.bind(this), (typeof this.config.ignoreAjax !== 'undefined' ? this.config.ignoreAjax : false))
271
+ },
272
+
273
+ /**
274
+ * Rebuild the PayPal button if it's been removed
275
+ */
276
+ rebuildPayPalButton: function () {
277
+
278
+ // Check to see if the DOM element has been removed?
279
+ if ($('paypal-container') == null) {
280
+ this.updatePayPalButton();
281
+ }
282
+
283
+ },
284
+
285
+ /**
286
+ * Handle saved PayPals being present on the page
287
+ */
288
+ initSavedPayPal: function () {
289
+
290
+ // If we have any saved accounts we'll need to do something jammy
291
+ if ($$('#paypal-saved-accounts input[type=radio]').first() !== undefined) {
292
+ $('paypal-saved-accounts').on('change', 'input[type=radio]', function (event) {
293
+
294
+ // Update the PayPal button accordingly
295
+ this.updatePayPalButton(false, 'gene_braintree_paypal');
296
+
297
+ }.bind(this));
298
+ }
299
+
300
+ },
301
+
302
+ /**
303
+ * Set the submit function to be used
304
+ *
305
+ * This should be overridden within each checkouts .phtml file
306
+ * vZeroIntegration.prototype.prepareSubmitObserver = function() {}
307
+ *
308
+ * @returns {boolean}
309
+ */
310
+ prepareSubmitObserver: function () {
311
+ return false;
312
+ },
313
+
314
+ /**
315
+ * Event to run before submit
316
+ * Should always return _beforeSubmit
317
+ *
318
+ * @returns {boolean}
319
+ */
320
+ beforeSubmit: function (callback) {
321
+ return this._beforeSubmit(callback);
322
+ },
323
+
324
+ /**
325
+ * Private before submit function
326
+ *
327
+ * @param callback
328
+ * @private
329
+ */
330
+ _beforeSubmit: function (callback) {
331
+ this.vzero.fireEvent(this, 'integration.onBeforeSubmit');
332
+
333
+ // Remove the save after payment to ensure validation fires correctly
334
+ if (this.submitAfterPayment && $('braintree-submit-after-payment')) {
335
+ $('braintree-submit-after-payment').remove();
336
+ }
337
+
338
+ callback();
339
+ },
340
+
341
+ /**
342
+ * Event to run after submit
343
+ *
344
+ * @returns {boolean}
345
+ */
346
+ afterSubmit: function () {
347
+ this.vzero.fireEvent(this, 'integration.onAfterSubmit');
348
+ return false;
349
+ },
350
+
351
+ /**
352
+ * Submit the integration to tokenize the card
353
+ *
354
+ * @param type
355
+ * @param successCallback
356
+ * @param failedCallback
357
+ * @param validateFailedCallback
358
+ */
359
+ submit: function (type, successCallback, failedCallback, validateFailedCallback) {
360
+
361
+ // Check we actually want to intercept this credit card transaction?
362
+ if (this.shouldInterceptSubmit(type)) {
363
+
364
+ // Validate the form before submission
365
+ if (this.validateAll()) {
366
+
367
+ // Show the loading information
368
+ this.setLoading();
369
+
370
+ // Call the before submit function
371
+ this.beforeSubmit(function () {
372
+
373
+ // Always attempt to update the card type on submission
374
+ if ($$('[data-genebraintree-name="number"]').first() != undefined) {
375
+ this.vzero.updateCardType($$('[data-genebraintree-name="number"]').first().value);
376
+ }
377
+
378
+ // Update the data within the vZero object
379
+ this.vzero.updateData(
380
+ function () {
381
+
382
+ // Update the billing details if they're present on the page
383
+ this.updateBilling();
384
+
385
+ // Process the data on the page
386
+ this.vzero.process({
387
+ onSuccess: function () {
388
+
389
+ // Make some modifications to the form
390
+ this.enableDeviceData();
391
+
392
+ // Unset the loading, as this can block success functions
393
+ this.resetLoading();
394
+ this.afterSubmit();
395
+
396
+ // Enable/disable the correct nonce input fields
397
+ this.enableDisableNonce();
398
+
399
+ this.vzero._hostedFieldsTokenGenerated = true;
400
+ this.hostedFieldsGenerated = true;
401
+
402
+ // Call the callback function
403
+ if (typeof successCallback === 'function') {
404
+ var response = successCallback();
405
+ }
406
+
407
+ // Enable loading again, as things are happening!
408
+ this.setLoading();
409
+
410
+ return response;
411
+
412
+ }.bind(this),
413
+ onFailure: function () {
414
+
415
+ this.vzero._hostedFieldsTokenGenerated = false;
416
+ this.hostedFieldsGenerated = false;
417
+
418
+ this.resetLoading();
419
+ this.afterSubmit();
420
+ if (typeof failedCallback === 'function') {
421
+ return failedCallback();
422
+ }
423
+ }.bind(this)
424
+ })
425
+ }.bind(this),
426
+ this.getUpdateDataParams()
427
+ );
428
+
429
+ }.bind(this));
430
+
431
+ } else {
432
+
433
+ this.vzero._hostedFieldsTokenGenerated = false;
434
+ this.hostedFieldsGenerated = false;
435
+
436
+ this.resetLoading();
437
+ if (typeof validateFailedCallback === 'function') {
438
+ validateFailedCallback();
439
+ }
440
+ }
441
+ }
442
+ },
443
+
444
+ /**
445
+ * Submit the entire checkout
446
+ */
447
+ submitCheckout: function () {
448
+ // Submit the checkout steps
449
+ window.review && review.save();
450
+ },
451
+
452
+ /**
453
+ * How to submit the payment section
454
+ */
455
+ submitPayment: function () {
456
+ payment.save && payment.save();
457
+ },
458
+
459
+ /**
460
+ * Enable/disable the correct nonce input fields
461
+ */
462
+ enableDisableNonce: function () {
463
+ // Make sure the nonce inputs aren't going to interfere
464
+ if (this.getPaymentMethod() == 'gene_braintree_creditcard') {
465
+ if ($('creditcard-payment-nonce') !== null) {
466
+ $('creditcard-payment-nonce').removeAttribute('disabled');
467
+ }
468
+ if ($('paypal-payment-nonce') !== null) {
469
+ $('paypal-payment-nonce').setAttribute('disabled', 'disabled');
470
+ }
471
+ } else if (this.getPaymentMethod() == 'gene_braintree_paypal') {
472
+ if ($('creditcard-payment-nonce') !== null) {
473
+ $('creditcard-payment-nonce').setAttribute('disabled', 'disabled');
474
+ }
475
+ if ($('paypal-payment-nonce') !== null) {
476
+ $('paypal-payment-nonce').removeAttribute('disabled');
477
+ }
478
+ }
479
+ },
480
+
481
+ /**
482
+ * Replace the PayPal button at the correct time
483
+ *
484
+ * This should be overridden within each checkouts .phtml file
485
+ * vZeroIntegration.prototype.preparePaymentMethodSwitchObserver = function() {}
486
+ */
487
+ preparePaymentMethodSwitchObserver: function () {
488
+ return this.defaultPaymentMethodSwitch();
489
+ },
490
+
491
+ /**
492
+ * If the checkout uses the Magento standard Payment.prototype.switchMethod we can utilise this function
493
+ */
494
+ defaultPaymentMethodSwitch: function () {
495
+
496
+ // Store a pointer to the vZero integration
497
+ var vzeroIntegration = this;
498
+
499
+ // Store the original payment method
500
+ var paymentSwitchOriginal = Payment.prototype.switchMethod;
501
+
502
+ // Intercept the save function
503
+ Payment.prototype.switchMethod = function (method) {
504
+
505
+ // Run our method switch function
506
+ vzeroIntegration.paymentMethodSwitch(method);
507
+
508
+ // Run the original function
509
+ return paymentSwitchOriginal.apply(this, arguments);
510
+ };
511
+
512
+ },
513
+
514
+ /**
515
+ * Function to run when the customer changes payment method
516
+ * @param method
517
+ */
518
+ paymentMethodSwitch: function (method) {
519
+
520
+ // Wait for 50ms to see if this function is called again, only ever run the last instance
521
+ clearTimeout(this._methodSwitchTimeout);
522
+ this._methodSwitchTimeout = setTimeout(function () {
523
+
524
+ // Should we add a PayPal button?
525
+ if (this.shouldAddPayPalButton(method)) {
526
+ this.updatePayPalButton('add', method);
527
+ } else {
528
+ this.updatePayPalButton('remove', method);
529
+ }
530
+
531
+ // Has the user enabled hosted fields?
532
+ if ((method ? method : this.getPaymentMethod()) == 'gene_braintree_creditcard') {
533
+ this.initHostedFields();
534
+ }
535
+
536
+ // Check to see if the other information should be displayed
537
+ this.checkSavedOther();
538
+
539
+ // Run the event once the payment method has switched
540
+ this.afterPaymentMethodSwitch();
541
+
542
+ this.vzero.fireEvent(this, 'integration.onPaymentMethodSwitch', {method: method});
543
+
544
+ }.bind(this), 50);
545
+
546
+ },
547
+
548
+ /**
549
+ * Complete a PayPal transaction
550
+ *
551
+ * @returns {boolean}
552
+ */
553
+ completePayPal: function (obj) {
554
+
555
+ // Make sure the nonces are the correct way around
556
+ this.enableDisableNonce();
557
+
558
+ // Enable the device data
559
+ this.enableDeviceData();
560
+
561
+ if (obj.nonce && $('paypal-payment-nonce') !== null) {
562
+ $('paypal-payment-nonce').value = obj.nonce;
563
+ $('paypal-payment-nonce').setAttribute('value', obj.nonce);
564
+ } else {
565
+ console.warn('Unable to update PayPal nonce, please verify that the nonce input field has the ID: paypal-payment-nonce');
566
+ }
567
+
568
+ // Check the callback type is a function
569
+ this.afterPayPalComplete();
570
+
571
+ return false;
572
+ },
573
+
574
+ /**
575
+ * Any operations that need to happen after the PayPal integration has completed
576
+ *
577
+ * @returns {boolean}
578
+ */
579
+ afterPayPalComplete: function () {
580
+ this.resetLoading();
581
+ return this.submitCheckout();
582
+ },
583
+
584
+ /**
585
+ * Return the mark up for the PayPal button
586
+ *
587
+ * @returns {string}
588
+ */
589
+ getPayPalMarkUp: function () {
590
+ return $('braintree-paypal-button').innerHTML;
591
+ },
592
+
593
+ /**
594
+ * Update the PayPal button on the page
595
+ *
596
+ * @param action
597
+ * @param method
598
+ * @returns {boolean}
599
+ */
600
+ updatePayPalButton: function (action, method) {
601
+
602
+ if (this.paypalWrapperMarkUp === false) {
603
+ return false;
604
+ }
605
+
606
+ // Refresh is deprecated
607
+ if (action == 'refresh') {
608
+ return true;
609
+ }
610
+
611
+ // Check to see if we should be adding a PayPal button?
612
+ if ((this.shouldAddPayPalButton(method) && action != 'remove') || action == 'add') {
613
+
614
+ // Hide the checkout button
615
+ if ($$(this.paypalButtonClass).first() !== undefined) {
616
+
617
+ // Hide the original checkout button
618
+ $$(this.paypalButtonClass).first().hide();
619
+
620
+ // Does a button already exist on the page and is visible?
621
+ if ($$('#paypal-complete').first() !== undefined) {
622
+ $$('#paypal-complete').first().show();
623
+ return true;
624
+ }
625
+
626
+ // Insert the wrapper mark up in prepation for adding the button
627
+ $$(this.paypalButtonClass).first().insert({after: this.paypalWrapperMarkUp});
628
+
629
+ // Add in the PayPal button
630
+ this.vzeroPaypal.addPayPalButton({
631
+ validate: this.validateAll.bind(this),
632
+ onSuccess: this.completePayPal.bind(this),
633
+ onReady: this.paypalOnReady.bind(this)
634
+ }, this.getPayPalMarkUp(), '#paypal-container');
635
+
636
+ } else {
637
+ console.warn('We\'re unable to find the element ' + this.paypalButtonClass + '. Please check your integration.');
638
+ }
639
+
640
+ } else {
641
+
642
+ // If not we need to remove it
643
+ // Revert our madness
644
+ if ($$(this.paypalButtonClass).first() !== undefined) {
645
+ $$(this.paypalButtonClass).first().show();
646
+ }
647
+
648
+ // Remove the PayPal element
649
+ if ($$('#paypal-complete').first() !== undefined) {
650
+ $('paypal-complete').hide();
651
+ }
652
+ }
653
+
654
+ },
655
+
656
+ /**
657
+ * When the review step is shown on non one step checkout solutions update the PayPal button
658
+ */
659
+ onReviewInit: function () {
660
+ if (!this.isOnepage) {
661
+ this.updatePayPalButton();
662
+ }
663
+ this.vzero.fireEvent(this, 'integration.onReviewInit');
664
+ },
665
+
666
+ /**
667
+ * Attach a click event handler to the button to validate the form
668
+ *
669
+ * @param integration
670
+ */
671
+ paypalOnReady: function (integration) {
672
+ return true;
673
+ },
674
+
675
+ /**
676
+ * Set the loading state
677
+ */
678
+ setLoading: function () {
679
+ checkout.setLoadWaiting('payment');
680
+ },
681
+
682
+ /**
683
+ * Reset the loading state
684
+ */
685
+ resetLoading: function () {
686
+ checkout.setLoadWaiting(false);
687
+ },
688
+
689
+ /**
690
+ * Make sure the device data field isn't disabled
691
+ */
692
+ enableDeviceData: function () {
693
+ if ($('device_data') !== null) {
694
+ $('device_data').removeAttribute('disabled');
695
+ }
696
+ },
697
+
698
+ /**
699
+ * Update the billing of the vZero object
700
+ *
701
+ * @returns {boolean}
702
+ */
703
+ updateBilling: function () {
704
+
705
+ // Verify we're not using a saved address
706
+ if (($('billing-address-select') !== null && $('billing-address-select').value == '') || $('billing-address-select') === null) {
707
+
708
+ // Grab these directly from the form and update
709
+ if ($('billing:firstname') !== null && $('billing:lastname') !== null) {
710
+ this.vzero.setBillingName($('billing:firstname').value + ' ' + $('billing:lastname').value);
711
+ }
712
+ if ($('billing:postcode') !== null) {
713
+ this.vzero.setBillingPostcode($('billing:postcode').value);
714
+ }
715
+ }
716
+ },
717
+
718
+ /**
719
+ * Any extra data we need to pass through to the updateData call
720
+ *
721
+ * @returns {{}}
722
+ */
723
+ getUpdateDataParams: function () {
724
+ var parameters = {};
725
+
726
+ // If the billing address is selected and we're wanting to ship to that address we need to pass the addressId
727
+ if ($('billing-address-select') !== null && $('billing-address-select').value != '') {
728
+ parameters.addressId = $('billing-address-select').value;
729
+ }
730
+
731
+ return parameters;
732
+ },
733
+
734
+ /**
735
+ * Return the current payment method
736
+ *
737
+ * @returns {*}
738
+ */
739
+ getPaymentMethod: function () {
740
+ return payment.currentMethod;
741
+ },
742
+
743
+ /**
744
+ * Should we intercept the save action of the checkout
745
+ *
746
+ * @param type
747
+ * @returns {*}
748
+ */
749
+ shouldInterceptSubmit: function (type) {
750
+ switch (type) {
751
+ case 'creditcard':
752
+ return (this.getPaymentMethod() == 'gene_braintree_creditcard' && this.vzero.shouldInterceptCreditCard());
753
+ break;
754
+ case 'paypal':
755
+ return (this.getPaymentMethod() == 'gene_braintree_paypal' && this.vzero.shouldInterceptCreditCard());
756
+ break;
757
+ }
758
+ return false;
759
+ },
760
+
761
+ /**
762
+ * Should we be adding a PayPal button?
763
+ * @returns {boolean}
764
+ */
765
+ shouldAddPayPalButton: function (method) {
766
+ return (((method ? method : this.getPaymentMethod()) == 'gene_braintree_paypal' && $('paypal-saved-accounts') === null) || ((method ? method : this.getPaymentMethod()) == 'gene_braintree_paypal' && ($$('#paypal-saved-accounts input:checked[type=radio]').first() !== undefined && $$('#paypal-saved-accounts input:checked[type=radio]').first().value == 'other')));
767
+ },
768
+
769
+ /**
770
+ * Function to run once 3D retokenization is complete
771
+ */
772
+ threeDTokenizationComplete: function () {
773
+ this.resetLoading();
774
+ },
775
+
776
+ /**
777
+ * Validate the entire form
778
+ *
779
+ * @returns {boolean}
780
+ */
781
+ validateAll: function () {
782
+ return true;
783
+ },
784
+
785
+ /**
786
+ * @deprecated
787
+ */
788
+ disableCreditCardForm: function () {
789
+
790
+ },
791
+
792
+ /**
793
+ * @deprecated
794
+ */
795
+ enableCreditCardForm: function () {
796
+
797
+ }
798
+ };
js/gene/braintree/source/vzero-paypal.js ADDED
@@ -0,0 +1,261 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Separate class to handle functionality around the vZero PayPal button
3
+ *
4
+ * @class vZeroPayPalButton
5
+ * @author Dave Macaulay <dave@gene.co.uk>
6
+ */
7
+ var vZeroPayPalButton = Class.create();
8
+ vZeroPayPalButton.prototype = {
9
+
10
+ /**
11
+ * Initialize the PayPal button class
12
+ *
13
+ * @param clientToken Client token generated from server
14
+ * @param storeFrontName The store name to show within the PayPal modal window
15
+ * @param singleUse Should the system attempt to open in single payment mode?
16
+ * @param locale The locale for the payment
17
+ * @param futureSingleUse When using future payments should we process the transaction as a single payment?
18
+ */
19
+ initialize: function (clientToken, storeFrontName, singleUse, locale, futureSingleUse) {
20
+ this.clientToken = clientToken;
21
+ this.storeFrontName = storeFrontName;
22
+ this.singleUse = singleUse;
23
+ this.locale = locale;
24
+
25
+ // Set these to default values on initialization
26
+ this.amount = 0.00;
27
+ this.currency = false;
28
+
29
+ this.client = false;
30
+ },
31
+
32
+ /**
33
+ * Retrieve the client from the class, or initialize the client if not already present
34
+ *
35
+ * @param callbackFn
36
+ */
37
+ getClient: function (callbackFn) {
38
+ if (this.client !== false) {
39
+ if (typeof callbackFn === 'function') {
40
+ callbackFn(this.client);
41
+ }
42
+ } else {
43
+ // Create a new braintree client instance
44
+ braintree.client.create({
45
+ authorization: this.clientToken
46
+ }, function (clientErr, clientInstance) {
47
+ if (clientErr) {
48
+ // Handle error in client creation
49
+ console.log(clientErr);
50
+ return;
51
+ }
52
+
53
+ this.client = clientInstance;
54
+ callbackFn(this.client);
55
+ }.bind(this));
56
+ }
57
+ },
58
+
59
+ /**
60
+ * Update the pricing information for the PayPal button
61
+ * If the PayPalClient has already been created we also update the _clientOptions
62
+ * so the PayPal modal window displays the correct values
63
+ *
64
+ * @param amount The amount formatted to two decimal places
65
+ * @param currency The currency code
66
+ */
67
+ setPricing: function (amount, currency) {
68
+ // Set them into the class
69
+ this.amount = parseFloat(amount);
70
+ this.currency = currency;
71
+ },
72
+
73
+ /**
74
+ * Rebuild the button
75
+ *
76
+ * @deprecated due to JavaScript v3
77
+ * @returns {boolean}
78
+ */
79
+ rebuildButton: function () {
80
+ return false;
81
+ },
82
+
83
+ /**
84
+ * Inject the PayPal button into the document
85
+ *
86
+ * @param options Object containing onSuccess method
87
+ * @param buttonHtml
88
+ * @param containerQuery
89
+ * @param append
90
+ */
91
+ addPayPalButton: function (options, buttonHtml, containerQuery, append) {
92
+ var container;
93
+ buttonHtml = buttonHtml || $('braintree-paypal-button').innerHTML;
94
+ containerQuery = containerQuery || '#paypal-container';
95
+ append = append || false;
96
+
97
+ // Get the container element
98
+ if (typeof containerQuery === 'string') {
99
+ container = $$(containerQuery).first();
100
+ } else {
101
+ container = containerQuery;
102
+ }
103
+
104
+ // Verify the container is present on the page
105
+ if (!container) {
106
+ console.warn('Unable to locate container ' + containerQuery + ' for PayPal button.');
107
+ return false;
108
+ }
109
+
110
+ // Insert the button element
111
+ if (append) {
112
+ container.insert(buttonHtml);
113
+ } else {
114
+ container.update(buttonHtml);
115
+ }
116
+
117
+ // Check the container contains a valid button element
118
+ if (!container.select('>button').length) {
119
+ console.warn('Unable to find valid <button /> element within container.');
120
+ return false;
121
+ }
122
+
123
+ // Grab the button and add a loading class
124
+ var button = container.select('>button').first();
125
+ button.addClassName('braintree-paypal-loading');
126
+ button.setAttribute('disabled', 'disabled');
127
+
128
+ // Attach our PayPal button event to our injected button
129
+ this.attachPayPalButtonEvent(button, options);
130
+ },
131
+
132
+ /**
133
+ * Attach the PayPal button event
134
+ *
135
+ * @param buttons
136
+ * @param options
137
+ */
138
+ attachPayPalButtonEvent: function (buttons, options) {
139
+ // Grab an instance of the Braintree client
140
+ this.getClient(function (clientInstance) {
141
+ // Create a new instance of PayPal
142
+ braintree.paypal.create({
143
+ client: clientInstance
144
+ }, function (paypalErr, paypalInstance) {
145
+ if (paypalErr) {
146
+ console.error('Error creating PayPal:', paypalErr);
147
+ return;
148
+ }
149
+
150
+ // Run the onReady callback
151
+ if (typeof options.onReady === 'function') {
152
+ options.onReady(paypalInstance);
153
+ }
154
+
155
+ // Attach the PayPal button event
156
+ return this._attachPayPalButtonEvent(buttons, paypalInstance, options);
157
+ }.bind(this));
158
+ }.bind(this));
159
+ },
160
+
161
+ /**
162
+ * Attach the click event to the paypal button
163
+ *
164
+ * @param buttons
165
+ * @param paypalInstance
166
+ * @param options
167
+ *
168
+ * @private
169
+ */
170
+ _attachPayPalButtonEvent: function (buttons, paypalInstance, options) {
171
+ if (buttons && paypalInstance) {
172
+
173
+ // Convert the buttons to an array and handle them all at once
174
+ if (!Array.isArray(buttons)) {
175
+ buttons = [buttons];
176
+ }
177
+
178
+ // Handle each button
179
+ buttons.each(function (button) {
180
+ button.removeClassName('braintree-paypal-loading');
181
+ button.removeAttribute('disabled');
182
+
183
+ // Remove any events currently assigned to the button
184
+ Event.stopObserving(button, 'click');
185
+
186
+ // Observe the click event to fire the tokenization of PayPal (ie open the window)
187
+ Event.observe(button, 'click', function (event) {
188
+ Event.stop(event);
189
+ if (typeof options.validate === 'function') {
190
+ if (options.validate()) {
191
+ // Fire the integration
192
+ return this._tokenizePayPal(paypalInstance, options);
193
+ }
194
+ } else {
195
+ // Fire the integration
196
+ return this._tokenizePayPal(paypalInstance, options);
197
+ }
198
+
199
+ }.bind(this));
200
+ }.bind(this));
201
+ }
202
+ },
203
+
204
+ /**
205
+ * Tokenize PayPal
206
+ *
207
+ * @param paypalInstance
208
+ * @param options
209
+ *
210
+ * @private
211
+ */
212
+ _tokenizePayPal: function (paypalInstance, options) {
213
+
214
+ // Because tokenization opens a popup, this has to be called as a result of
215
+ // customer action, like clicking a button—you cannot call this at any time.
216
+ paypalInstance.tokenize(this._buildOptions(), function (tokenizeErr, payload) {
217
+ // Stop if there was an error.
218
+ if (tokenizeErr) {
219
+ if (tokenizeErr.type !== 'CUSTOMER') {
220
+ console.error('Error tokenizing:', tokenizeErr);
221
+ }
222
+ return;
223
+ }
224
+
225
+ // If we have a success callback we're most likely using a non-default checkout
226
+ if (typeof options.onSuccess === 'function') {
227
+ options.onSuccess(payload);
228
+ }
229
+
230
+ }.bind(this));
231
+
232
+ },
233
+
234
+ /**
235
+ * Build the options for our tokenization
236
+ *
237
+ * @returns {{displayName: *, amount: *, currency: *}}
238
+ * @private
239
+ */
240
+ _buildOptions: function () {
241
+ var options = {
242
+ displayName: this.storeFrontName,
243
+ amount: this.amount,
244
+ currency: this.currency
245
+ };
246
+
247
+ // Pass over the locale
248
+ if (this.locale) {
249
+ options.locale = this.locale;
250
+ }
251
+
252
+ // Determine the flow based on the singleUse parameter
253
+ if (this.singleUse === true) {
254
+ options.flow = 'checkout';
255
+ } else {
256
+ options.flow = 'vault';
257
+ }
258
+
259
+ return options;
260
+ }
261
+ };
js/gene/braintree/source/vzero.js ADDED
@@ -0,0 +1,1139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Magento Braintree class to bridge the v.zero JS SDK and Magento
3
+ *
4
+ * @class vZero
5
+ * @author Dave Macaulay <dave@gene.co.uk>
6
+ */
7
+ var vZero = Class.create();
8
+ vZero.prototype = {
9
+
10
+ /**
11
+ * Initialize all our required variables that we'll need later on
12
+ *
13
+ * @param code The payment methods code
14
+ * @param clientToken The client token provided by the server
15
+ * @param threeDSecure Flag to determine whether 3D secure is active, this is verified server side
16
+ * @param hostedFields Flag to determine whether we're using hosted fields
17
+ * @param billingName Billing name used in verification of the card
18
+ * @param billingPostcode Billing postcode also needed to verify the card
19
+ * @param quoteUrl The URL to update the quote totals
20
+ * @param tokenizeUrl The URL to re-tokenize 3D secure cards
21
+ * @param vaultToNonceUrl The end point to vault a nonce then return a new nonce - deprecated
22
+ */
23
+ initialize: function (code, clientToken, threeDSecure, hostedFields, billingName, billingPostcode, quoteUrl, tokenizeUrl, vaultToNonceUrl) {
24
+ this.code = code;
25
+ this.clientToken = clientToken;
26
+ this.threeDSecure = threeDSecure;
27
+ this.hostedFields = hostedFields;
28
+
29
+ if (billingName) {
30
+ this.billingName = billingName;
31
+ }
32
+ if (billingPostcode) {
33
+ this.billingPostcode = billingPostcode;
34
+ }
35
+ if (quoteUrl) {
36
+ this.quoteUrl = quoteUrl;
37
+ }
38
+ if (tokenizeUrl) {
39
+ this.tokenizeUrl = tokenizeUrl;
40
+ }
41
+
42
+ this._hostedFieldsTokenGenerated = false;
43
+
44
+ this.acceptedCards = false;
45
+
46
+ // Store whether hosted fields is running or not
47
+ this._hostedFieldsTimeout = false;
48
+
49
+ // Store the Ajax request for the updateData
50
+ this._updateDataXhr = false;
51
+ this._updateDataCallbacks = [];
52
+ this._updateDataParams = {};
53
+
54
+ this.client = false;
55
+
56
+ this.initEvents();
57
+ },
58
+
59
+ /**
60
+ * Create our events object, with the various events we support
61
+ */
62
+ initEvents: function () {
63
+ this.events = {
64
+ onBeforeUpdateData: [],
65
+ onAfterUpdateData: [],
66
+ onHandleAjaxRequest: [],
67
+ integration: {
68
+ onInit: [],
69
+ onInitDefaultMethod: [],
70
+ onShowHideOtherMethod: [],
71
+ onCheckSavedOther: [],
72
+ onPaymentMethodSwitch: [],
73
+ onReviewInit: [],
74
+ onBeforeSubmit: [],
75
+ onAfterSubmit: [],
76
+ onObserveAjaxRequests: []
77
+ }
78
+ };
79
+ },
80
+
81
+ /**
82
+ * Add an event into the system
83
+ *
84
+ * @param path
85
+ * @param eventFn
86
+ * @param params
87
+ */
88
+ observeEvent: function (path, eventFn, params) {
89
+ var event = this._resolveEvent(path);
90
+ if (event === undefined) {
91
+ console.warn('Event for ' + path + ' does not exist.');
92
+ } else {
93
+ event.push({fn: eventFn, params: params});
94
+ }
95
+ },
96
+
97
+ /**
98
+ * Fire an event
99
+ *
100
+ * @param caller
101
+ * @param path
102
+ * @param params
103
+ */
104
+ fireEvent: function (caller, path, params) {
105
+ var events = this._resolveEvent(path);
106
+ if (events !== undefined) {
107
+ if (events.length > 0) {
108
+ events.each(function (item) {
109
+ if (typeof item.fn === 'function') {
110
+ var arguments = [params];
111
+ if (typeof item.params === 'object') {
112
+ arguments.push(item.params);
113
+ }
114
+ item.fn.apply(caller, arguments);
115
+ }
116
+ });
117
+ }
118
+ }
119
+ },
120
+
121
+ /**
122
+ * Resolve an event by a path
123
+ *
124
+ * @param path
125
+ * @returns {*}
126
+ * @private
127
+ */
128
+ _resolveEvent: function (path) {
129
+ return path.split('.').reduce(function(prev, curr) {
130
+ return prev ? prev[curr] : undefined
131
+ }, this.events)
132
+ },
133
+
134
+ /**
135
+ * Retrieve the client from the class, or initialize the client if not already present
136
+ *
137
+ * @param callbackFn
138
+ */
139
+ getClient: function (callbackFn) {
140
+ if (this.client !== false) {
141
+ if (typeof callbackFn === 'function') {
142
+ callbackFn(this.client);
143
+ }
144
+ } else {
145
+ // Create a new braintree client instance
146
+ braintree.client.create({
147
+ authorization: this.clientToken
148
+ }, function (clientErr, clientInstance) {
149
+ if (clientErr) {
150
+ // Handle error in client creation
151
+ console.log(clientErr);
152
+ return;
153
+ }
154
+
155
+ this.client = clientInstance;
156
+ callbackFn(this.client);
157
+ }.bind(this));
158
+ }
159
+ },
160
+
161
+ /**
162
+ * Init the hosted fields system
163
+ *
164
+ * @param integration
165
+ */
166
+ initHostedFields: function (integration) {
167
+
168
+ // If the hosted field number element exists hosted fields is on the page and working!
169
+ if ($$('iframe[name^="braintree-"]').length > 0) {
170
+ return false;
171
+ }
172
+
173
+ // If it's already running there's no need to start another instance
174
+ // Also block the function if braintree-hosted-submit isn't yet on the page
175
+ if ($('braintree-hosted-submit') === null) {
176
+ return false;
177
+ }
178
+
179
+ // Pass the integration through to hosted fields
180
+ this.integration = integration;
181
+
182
+ this._hostedFieldsTokenGenerated = false;
183
+
184
+ // Utilise a 50ms timeout to ensure the last call of HF is ran
185
+ clearTimeout(this._hostedFieldsTimeout);
186
+ this._hostedFieldsTimeout = setTimeout(function () {
187
+
188
+ if (this._hostedIntegration !== false) {
189
+ try {
190
+ this._hostedIntegration.teardown(function () {
191
+ this._hostedIntegration = false;
192
+ // Setup the hosted fields client
193
+ this.setupHostedFieldsClient();
194
+ }.bind(this));
195
+ } catch (e) {
196
+ this.setupHostedFieldsClient();
197
+ }
198
+ } else {
199
+ // Setup the hosted fields client
200
+ this.setupHostedFieldsClient();
201
+ }
202
+
203
+ }.bind(this), 50);
204
+ },
205
+
206
+ /**
207
+ * Tear down hosted fields
208
+ *
209
+ * @param callbackFn
210
+ */
211
+ teardownHostedFields: function (callbackFn) {
212
+ if (typeof this._hostedIntegration !== 'undefined' && this._hostedIntegration !== false) {
213
+ this._hostedIntegration.teardown(function () {
214
+ this._hostedIntegration = false;
215
+
216
+ if (typeof callbackFn === 'function') {
217
+ callbackFn();
218
+ }
219
+ }.bind(this));
220
+ } else {
221
+ if (typeof callbackFn === 'function') {
222
+ callbackFn();
223
+ }
224
+ }
225
+ },
226
+
227
+ /**
228
+ * Setup the hosted fields client utilising the Braintree JS SDK
229
+ */
230
+ setupHostedFieldsClient: function () {
231
+
232
+ // If there are iframes within the fields already, don't run again!
233
+ // This function has a delay from the original call so we need to verify everything is still good to go!
234
+ if ($$('iframe[name^="braintree-"]').length > 0) {
235
+ return false;
236
+ }
237
+
238
+ this._hostedIntegration = false;
239
+
240
+ // Retrieve the client from the class
241
+ this.getClient(function (clientInstance) {
242
+ // Build our hosted fields options
243
+ var options = {
244
+ client: clientInstance,
245
+ styles: this.getHostedFieldsStyles(),
246
+ fields: {
247
+ number: {
248
+ selector: "#card-number",
249
+ placeholder: "0000 0000 0000 0000"
250
+ },
251
+ expirationMonth: {
252
+ selector: "#expiration-month",
253
+ placeholder: "MM"
254
+ },
255
+ expirationYear: {
256
+ selector: "#expiration-year",
257
+ placeholder: "YY"
258
+ }
259
+ }
260
+ };
261
+
262
+ // Include the CVV field with the request
263
+ if ($('cvv') !== null) {
264
+ options.fields.cvv = {
265
+ selector: "#cvv"
266
+ };
267
+ }
268
+
269
+ // Create a new instance of hosted fields
270
+ braintree.hostedFields.create(options, function (hostedFieldsErr, hostedFieldsInstance) {
271
+ // Handle hosted fields errors
272
+ if (hostedFieldsErr) {
273
+ // Handle error in Hosted Fields creation
274
+ console.log(hostedFieldsErr);
275
+ return;
276
+ }
277
+
278
+ // Run on ready function
279
+ return this.hostedFieldsOnReady(hostedFieldsInstance);
280
+ }.bind(this));
281
+ }.bind(this));
282
+ },
283
+
284
+ /**
285
+ * Called when Hosted Fields integration is ready
286
+ *
287
+ * @param integration
288
+ */
289
+ hostedFieldsOnReady: function (integration) {
290
+ this._hostedIntegration = integration;
291
+
292
+ // Unset the loading state if it's present
293
+ if ($$('#credit-card-form.loading').length) {
294
+ $$('#credit-card-form.loading').first().removeClassName('loading');
295
+ }
296
+
297
+ // Will this checkout submit the payment after the "payment" step. This is typically used in non one step checkouts
298
+ // which contains a review step.
299
+ if (this.integration.submitAfterPayment) {
300
+ var input = new Element('input', {type: 'hidden', name: 'payment[submit_after_payment]', value: 1, id: 'braintree-submit-after-payment'});
301
+ $('payment_form_gene_braintree_creditcard').insert(input);
302
+ } else {
303
+ if ($('braintree-submit-after-payment')) {
304
+ $('braintree-submit-after-payment').remove();
305
+ }
306
+ }
307
+
308
+ // Handle card type changes
309
+ integration.on('cardTypeChange', this.hostedFieldsCardTypeChange.bind(this));
310
+ },
311
+
312
+ /**
313
+ * Return the hosted field styles
314
+ * See: https://developers.braintreepayments.com/guides/hosted-fields/styling/javascript/v2
315
+ *
316
+ * @returns {*}
317
+ */
318
+ getHostedFieldsStyles: function () {
319
+
320
+ // Does the integration provide it's own styling options for hosted fields?
321
+ if (typeof this.integration.getHostedFieldsStyles === 'function') {
322
+ return this.integration.getHostedFieldsStyles();
323
+ }
324
+
325
+ // Return some default styles if all else fails
326
+ return {
327
+ // Style all elements
328
+ "input": {
329
+ "font-size": "14pt",
330
+ "color": "#3A3A3A"
331
+ },
332
+
333
+ // Styling element state
334
+ ":focus": {
335
+ "color": "black"
336
+ },
337
+ ".valid": {
338
+ "color": "green"
339
+ },
340
+ ".invalid": {
341
+ "color": "red"
342
+ }
343
+ };
344
+ },
345
+
346
+ /**
347
+ * Update the card type on field event
348
+ *
349
+ * @param event
350
+ */
351
+ hostedFieldsCardTypeChange: function (event) {
352
+ if (typeof event.cards !== 'undefined') {
353
+ var cardMapping = {
354
+ 'visa': 'VI',
355
+ 'american-express': 'AE',
356
+ 'master-card': 'MC',
357
+ 'discover': 'DI',
358
+ 'jcb': 'JCB',
359
+ 'maestro': 'ME'
360
+ };
361
+ if (typeof cardMapping[event.cards[0].type] !== undefined) {
362
+ this.updateCardType(false, cardMapping[event.cards[0].type]);
363
+ } else {
364
+ this.updateCardType(false, 'card');
365
+ }
366
+ }
367
+ },
368
+
369
+ /**
370
+ * Once the nonce has been received update the field
371
+ *
372
+ * @param nonce
373
+ * @param options
374
+ */
375
+ hostedFieldsNonceReceived: function (nonce, options) {
376
+
377
+ if (this.threeDSecure) {
378
+ // Show the loading state
379
+ if (typeof this.integration.setLoading === 'function') {
380
+ this.integration.setLoading();
381
+ }
382
+
383
+ // Update the quote totals first
384
+ this.updateData(function () {
385
+ // Verify the nonce through 3Ds
386
+ this.verify3dSecureNonce(nonce, {
387
+ onSuccess: function (response) {
388
+ this.updateNonce(response.nonce);
389
+
390
+ if (typeof options.onSuccess === 'function') {
391
+ options.onSuccess();
392
+ }
393
+ }.bind(this),
394
+ onFailure: function () {
395
+ if (typeof options.onFailure === 'function') {
396
+ options.onFailure();
397
+ }
398
+ }.bind(this)
399
+ });
400
+ }.bind(this));
401
+ } else {
402
+ this.updateNonce(nonce);
403
+
404
+ if (typeof options.onSuccess === 'function') {
405
+ options.onSuccess();
406
+ }
407
+ }
408
+ },
409
+
410
+ /**
411
+ * Update the nonce in the form
412
+ *
413
+ * @param nonce
414
+ */
415
+ updateNonce: function (nonce) {
416
+ $('creditcard-payment-nonce').value = nonce;
417
+ $('creditcard-payment-nonce').setAttribute('value', nonce);
418
+
419
+ if (typeof this.integration.resetLoading === 'function') {
420
+ this.integration.resetLoading();
421
+ }
422
+
423
+ this._hostedFieldsTokenGenerated = true;
424
+ },
425
+
426
+ /**
427
+ * Handle hosted fields throwing an error
428
+ *
429
+ * @param response
430
+ * @returns {boolean}
431
+ */
432
+ hostedFieldsError: function (response) {
433
+
434
+ if (typeof this.integration.resetLoading === 'function') {
435
+ this.integration.resetLoading();
436
+ }
437
+
438
+ // Stop any "Cannot place two elements in #xxx" messages being shown to the user
439
+ // These are non critical errors and the functionality will still work as expected
440
+ if (
441
+ typeof response.message !== 'undefined' &&
442
+ response.message.indexOf('Cannot place two elements in') == -1 &&
443
+ response.message.indexOf('Unable to find element with selector') == -1 &&
444
+ response.message.indexOf('User did not enter a payment method') == -1
445
+ ) {
446
+ // Let the user know what went wrong
447
+ alert(response.message);
448
+ }
449
+
450
+ this._hostedFieldsTokenGenerated = false;
451
+
452
+ if (typeof this.integration.afterHostedFieldsError === 'function') {
453
+ this.integration.afterHostedFieldsError(response.message);
454
+ }
455
+
456
+ return false;
457
+
458
+ },
459
+
460
+ /**
461
+ * Is the customer attempting to use a saved card?
462
+ *
463
+ * @returns {boolean}
464
+ */
465
+ usingSavedCard: function () {
466
+ return ($('creditcard-saved-accounts') != undefined
467
+ && $$('#creditcard-saved-accounts input:checked[type=radio]').first() != undefined
468
+ && $$('#creditcard-saved-accounts input:checked[type=radio]').first().value !== 'other');
469
+ },
470
+
471
+ /**
472
+ * Detect a saved card with 3Ds enabled
473
+ * @returns {*|boolean}
474
+ */
475
+ usingSavedThreeDCard: function () {
476
+ return this.usingSavedCard() && $$('#creditcard-saved-accounts input:checked[type=radio]').first().hasAttribute('data-threedsecure-nonce');
477
+ },
478
+
479
+ /**
480
+ * Set the 3Ds flag
481
+ *
482
+ * @param flag a boolean value
483
+ */
484
+ setThreeDSecure: function (flag) {
485
+ this.threeDSecure = flag;
486
+ },
487
+
488
+ /**
489
+ * Set the amount within the checkout, this is only used in the default integration
490
+ * For any other checkouts see the updateData method, this is used by 3D secure
491
+ *
492
+ * @param amount The grand total of the order
493
+ */
494
+ setAmount: function (amount) {
495
+ this.amount = parseFloat(amount);
496
+ },
497
+
498
+ /**
499
+ * We sometimes need to set the billing name later on in the process
500
+ *
501
+ * @param billingName
502
+ */
503
+ setBillingName: function (billingName) {
504
+ this.billingName = billingName;
505
+ },
506
+
507
+ /**
508
+ * Return the billing name
509
+ *
510
+ * @returns {*}
511
+ */
512
+ getBillingName: function () {
513
+
514
+ // If billingName is an object we're wanting to grab the data from elements
515
+ if (typeof this.billingName == 'object') {
516
+
517
+ // Combine them with a space
518
+ return this.combineElementsValues(this.billingName);
519
+
520
+ } else {
521
+
522
+ // Otherwise we can presume that the billing name is a string
523
+ return this.billingName;
524
+ }
525
+ },
526
+
527
+ /**
528
+ * Same for billing postcode
529
+ *
530
+ * @param billingPostcode
531
+ */
532
+ setBillingPostcode: function (billingPostcode) {
533
+ this.billingPostcode = billingPostcode;
534
+ },
535
+
536
+ /**
537
+ * Return the billing name
538
+ *
539
+ * @returns {*}
540
+ */
541
+ getBillingPostcode: function () {
542
+
543
+ // If billingName is an object we're wanting to grab the data from elements
544
+ if (typeof this.billingPostcode == 'object') {
545
+
546
+ // Combine them with a space
547
+ return this.combineElementsValues(this.billingPostcode);
548
+
549
+ } else {
550
+
551
+ // Otherwise we can presume that the billing name is a string
552
+ return this.billingPostcode;
553
+ }
554
+ },
555
+
556
+ /**
557
+ * Push through the selected accepted cards from the admin
558
+ *
559
+ * @param cards an array of accepted cards
560
+ */
561
+ setAcceptedCards: function (cards) {
562
+ this.acceptedCards = cards;
563
+ },
564
+
565
+ /**
566
+ * Return the full billing address, if we cannot just serialize the billing address serialize everything
567
+ *
568
+ * @returns {array}
569
+ */
570
+ getBillingAddress: function () {
571
+
572
+ // Is there a function in the integration for this action?
573
+ if (typeof this.integration.getBillingAddress === 'function') {
574
+ return this.integration.getBillingAddress();
575
+ }
576
+
577
+ var billingAddress = {};
578
+
579
+ // If not try something generic
580
+ if ($('co-billing-form') !== null) {
581
+ if ($('co-billing-form').tagName == 'FORM') {
582
+ billingAddress = $('co-billing-form').serialize(true);
583
+ } else {
584
+ billingAddress = this.extractBilling($('co-billing-form').up('form').serialize(true));
585
+ }
586
+ } else if ($('billing:firstname') !== null) {
587
+ billingAddress = this.extractBilling($('billing:firstname').up('form').serialize(true));
588
+ }
589
+
590
+ if (billingAddress) {
591
+ return billingAddress;
592
+ }
593
+ },
594
+
595
+ /**
596
+ * Extract only the serialized values that start with "billing"
597
+ *
598
+ * @param formData
599
+ * @returns {{}}
600
+ */
601
+ extractBilling: function (formData) {
602
+ var billing = {};
603
+ $H(formData).each(function (data) {
604
+ // Only include billing details, excluding passwords
605
+ if (data.key.indexOf('billing') == 0 && data.key.indexOf('password') == -1) {
606
+ billing[data.key] = data.value;
607
+ }
608
+ });
609
+ return billing;
610
+ },
611
+
612
+ /**
613
+ * Return the accepted cards
614
+ *
615
+ * @returns {boolean|*}
616
+ */
617
+ getAcceptedCards: function () {
618
+ return this.acceptedCards;
619
+ },
620
+
621
+
622
+ /**
623
+ * Combine elements values into a string
624
+ *
625
+ * @param elements
626
+ * @param seperator
627
+ * @returns {string}
628
+ */
629
+ combineElementsValues: function (elements, seperator) {
630
+
631
+ // If no seperator is set use a space
632
+ if (!seperator) {
633
+ seperator = ' ';
634
+ }
635
+
636
+ // Loop through the elements and build up an array
637
+ var response = [];
638
+ elements.each(function (element, index) {
639
+ if ($(element) !== undefined) {
640
+ response[index] = $(element).value;
641
+ }
642
+ });
643
+
644
+ // Join with a space
645
+ return response.join(seperator);
646
+
647
+ },
648
+
649
+ /**
650
+ * Update the card type from a card number
651
+ *
652
+ * @param cardNumber The card number that the user has entered
653
+ * @param cardType The card type, if already known
654
+ */
655
+ updateCardType: function (cardNumber, cardType) {
656
+
657
+ // Check the image exists on the page
658
+ if ($('card-type-image') != undefined) {
659
+
660
+ // Grab the skin image URL without the last part
661
+ var skinImageUrl = $('card-type-image').src.substring(0, $('card-type-image').src.lastIndexOf("/"));
662
+
663
+ // Rebuild the URL with the card type included, all card types are stored as PNG's
664
+ $('card-type-image').setAttribute('src', skinImageUrl + "/" + cardType + ".png");
665
+
666
+ }
667
+
668
+ },
669
+
670
+ /**
671
+ * Observe all Ajax requests, this is needed on certain checkouts
672
+ * where we're unable to easily inject into methods
673
+ *
674
+ * @param callback A defined callback function if needed
675
+ * @param ignore An array of indexOf paths to ignore
676
+ */
677
+ observeAjaxRequests: function (callback, ignore) {
678
+
679
+ // Only allow one initialization of this function
680
+ if (vZero.prototype.observingAjaxRequests) {
681
+ return false;
682
+ }
683
+ vZero.prototype.observingAjaxRequests = true;
684
+
685
+ // For every ajax request on complete update various Braintree things
686
+ Ajax.Responders.register({
687
+ onComplete: function (transport) {
688
+ return this.handleAjaxRequest(transport.url, callback, ignore);
689
+ }.bind(this)
690
+ });
691
+
692
+ // Is jQuery present on the page
693
+ if (window.jQuery) {
694
+ jQuery(document).ajaxComplete(function (event, xhr, settings) {
695
+ return this.handleAjaxRequest(settings.url, callback, ignore)
696
+ }.bind(this));
697
+ }
698
+
699
+ },
700
+
701
+ /**
702
+ * Handle the ajax request form the observer above
703
+ *
704
+ * @param url
705
+ * @param callback
706
+ * @param ignore
707
+ * @returns {boolean}
708
+ */
709
+ handleAjaxRequest: function (url, callback, ignore) {
710
+
711
+ // Let's check the ignore variable
712
+ if (typeof ignore !== 'undefined' && ignore instanceof Array && ignore.length > 0) {
713
+
714
+ // Determine whether we should ignore this request?
715
+ var shouldIgnore = false;
716
+ ignore.each(function (element) {
717
+ if (url && url.indexOf(element) != -1) {
718
+ shouldIgnore = true;
719
+ }
720
+ });
721
+
722
+ // If so, stop here!
723
+ if (shouldIgnore === true) {
724
+ return false;
725
+ }
726
+ }
727
+
728
+ // Check the transport object has a URL and that it wasn't to our own controller
729
+ if (url && url.indexOf('/braintree/') == -1) {
730
+
731
+ this.fireEvent(this, 'integration.onHandleAjaxRequest', {url: url});
732
+
733
+ // Some checkout implementations may require custom callbacks
734
+ if (callback) {
735
+ callback(url);
736
+ } else {
737
+ this.updateData();
738
+ }
739
+ }
740
+
741
+ },
742
+
743
+ /**
744
+ * Make an Ajax request to the server and request up to date information regarding the quote
745
+ *
746
+ * @param callback A defined callback function if needed
747
+ * @param params any extra data to be passed to the controller
748
+ */
749
+ updateData: function (callback, params) {
750
+
751
+ this.fireEvent(this, 'integration.onBeforeUpdateData', {params: params});
752
+
753
+ // Push the callbacks into our array
754
+ this._updateDataCallbacks.push(callback);
755
+ this._updateDataParams = params;
756
+
757
+ // If an updateData ajax request is running, cancel it
758
+ if (this._updateDataXhr !== false) {
759
+ this._updateDataXhr.transport.abort();
760
+ }
761
+
762
+ // Make a new ajax request to the server
763
+ this._updateDataXhr = new Ajax.Request(
764
+ this.quoteUrl,
765
+ {
766
+ method: 'post',
767
+ parameters: this._updateDataParams,
768
+ onSuccess: function (transport) {
769
+ // Verify we have some response text
770
+ if (transport && (transport.responseJSON || transport.responseText)) {
771
+
772
+ // Parse the response from the server
773
+ var response = this._parseTransportAsJson(transport);
774
+
775
+ if (response.billingName != undefined) {
776
+ this.billingName = response.billingName;
777
+ }
778
+ if (response.billingPostcode != undefined) {
779
+ this.billingPostcode = response.billingPostcode;
780
+ }
781
+ if (response.grandTotal != undefined) {
782
+ this.amount = response.grandTotal;
783
+ }
784
+ if (response.threeDSecure != undefined) {
785
+ this.setThreeDSecure(response.threeDSecure);
786
+ }
787
+
788
+ // If PayPal is active update it
789
+ if (typeof vzeroPaypal != "undefined") {
790
+
791
+ // Update the totals within the PayPal system
792
+ if (response.grandTotal != undefined && response.currencyCode != undefined) {
793
+ vzeroPaypal.setPricing(response.grandTotal, response.currencyCode);
794
+ }
795
+
796
+ }
797
+
798
+ // Reset the params
799
+ this._updateDataParams = {};
800
+
801
+ // Set the flag back
802
+ this._updateDataXhr = false;
803
+
804
+ // Run any callbacks that have been stored
805
+ if (this._updateDataCallbacks.length) {
806
+ this._updateDataCallbacks.each(function (callback) {
807
+ callback(response);
808
+ }.bind(this));
809
+ this._updateDataCallbacks = [];
810
+ }
811
+
812
+ this.fireEvent(this, 'onAfterUpdateData', {response: response});
813
+ }
814
+ }.bind(this),
815
+ onFailure: function () {
816
+
817
+ // Reset the params
818
+ this._updateDataParams = {};
819
+ this._updateDataXhr = false;
820
+ this._updateDataCallbacks = [];
821
+
822
+ }.bind(this)
823
+ }
824
+ );
825
+
826
+ },
827
+
828
+ /**
829
+ * If the user attempts to use a 3D secure vaulted card and then cancels the 3D
830
+ * window the nonce associated with that card will become invalid, due to this
831
+ * we have to tokenize all the 3D secure cards again
832
+ *
833
+ * @param callback A defined callback function if needed
834
+ */
835
+ tokenize3dSavedCards: function (callback) {
836
+
837
+ // Check 3D is enabled
838
+ if (this.threeDSecure) {
839
+
840
+ // Verify we have elements with data-token
841
+ if ($$('[data-token]').first() !== undefined) {
842
+
843
+ // Gather our tokens
844
+ var tokens = [];
845
+ $$('[data-token]').each(function (element, index) {
846
+ tokens[index] = element.getAttribute('data-token');
847
+ });
848
+
849
+ // Make a new ajax request to the server
850
+ new Ajax.Request(
851
+ this.tokenizeUrl,
852
+ {
853
+ method: 'post',
854
+ onSuccess: function (transport) {
855
+
856
+ // Verify we have some response text
857
+ if (transport && (transport.responseJSON || transport.responseText)) {
858
+
859
+ // Parse as an object
860
+ var response = this._parseTransportAsJson(transport);
861
+
862
+ // Check the response was successful
863
+ if (response.success) {
864
+
865
+ // Loop through the returned tokens
866
+ $H(response.tokens).each(function (element) {
867
+
868
+ // If the token exists update it's nonce
869
+ if ($$('[data-token="' + element.key + '"]').first() != undefined) {
870
+ $$('[data-token="' + element.key + '"]').first().setAttribute('data-threedsecure-nonce', element.value);
871
+ }
872
+ });
873
+ }
874
+
875
+ if (callback) {
876
+ callback(response);
877
+ }
878
+ }
879
+ }.bind(this),
880
+ parameters: {'tokens': Object.toJSON(tokens)}
881
+ }
882
+ );
883
+ } else {
884
+ callback();
885
+ }
886
+
887
+ } else {
888
+ callback();
889
+ }
890
+ },
891
+
892
+ /**
893
+ * Verify a nonce through 3ds
894
+ *
895
+ * @param nonce
896
+ * @param options
897
+ */
898
+ verify3dSecureNonce: function (nonce, options) {
899
+
900
+ // Create a new instance of the threeDSecure library
901
+ this.getClient(function (clientInstance) {
902
+ braintree.threeDSecure.create({
903
+ client: clientInstance
904
+ }, function (threeDSecureError, threeDSecureInstance) {
905
+ if (threeDSecureError) {
906
+ console.log(threeDSecureError);
907
+ return;
908
+ }
909
+
910
+ var verifyOptions = {
911
+ amount: this.amount,
912
+ nonce: nonce,
913
+ addFrame: function (err, iframe) {
914
+ $$('#three-d-modal .bt-modal-body').first().insert(iframe);
915
+ $('three-d-modal').removeClassName('hidden');
916
+ },
917
+ removeFrame: function () {
918
+ $$('#three-d-modal .bt-modal-body iframe').first().remove();
919
+ $('three-d-modal').addClassName('hidden');
920
+ }.bind(this)
921
+ };
922
+
923
+ // Verify the card by it's nonce
924
+ threeDSecureInstance.verifyCard(verifyOptions, function (verifyError, payload) {
925
+ if (!verifyError) {
926
+ if (payload.liabilityShifted) {
927
+ // Run any callback functions
928
+ if (options.onSuccess) {
929
+ options.onSuccess(payload);
930
+ }
931
+ } else if (payload.liabilityShiftPossible) {
932
+ // Liablity may still be shifted
933
+ // Decide if you want to submit the nonce
934
+ } else {
935
+ // Liablity has not shifted and will not shift
936
+ // Decide if you want to submit the nonce
937
+ }
938
+ } else {
939
+ if (options.onFailure) {
940
+ options.onFailure(payload, verifyError);
941
+ }
942
+ }
943
+ });
944
+ }.bind(this));
945
+ }.bind(this));
946
+
947
+ },
948
+
949
+ /**
950
+ * Verify a card stored in the vault
951
+ *
952
+ * @param options Contains any callback functions which have been set
953
+ */
954
+ verify3dSecureVault: function (options) {
955
+
956
+ // Get the payment nonce
957
+ var paymentNonce = $$('#creditcard-saved-accounts input:checked[type=radio]').first().getAttribute('data-threedsecure-nonce');
958
+
959
+ if (paymentNonce) {
960
+ // Verify the nonce via 3d secure
961
+ this.verify3dSecureNonce(paymentNonce, {
962
+ onSuccess: function (response) {
963
+ // Store threeDSecure token and nonce in form
964
+ $('creditcard-payment-nonce').removeAttribute('disabled');
965
+ $('creditcard-payment-nonce').value = response.nonce;
966
+ $('creditcard-payment-nonce').setAttribute('value', response.nonce);
967
+
968
+ // Run any callback functions
969
+ if (typeof options.onSuccess === 'function') {
970
+ options.onSuccess();
971
+ }
972
+ },
973
+ onFailure: function (response, error) {
974
+ // Show the error
975
+ alert(error);
976
+
977
+ if (typeof options.onFailure === 'function') {
978
+ options.onFailure();
979
+ } else {
980
+ checkout.setLoadWaiting(false);
981
+ }
982
+ }
983
+ });
984
+ } else {
985
+ alert('No payment nonce present.');
986
+
987
+ if (typeof options.onFailure === 'function') {
988
+ options.onFailure();
989
+ } else {
990
+ checkout.setLoadWaiting(false);
991
+ }
992
+ }
993
+ },
994
+
995
+ /**
996
+ * Process a standard card request
997
+ *
998
+ * @param options Contains any callback functions which have been set
999
+ */
1000
+ processCard: function (options) {
1001
+
1002
+ // Tokenize using hosted fields
1003
+ this._hostedIntegration.tokenize(function (tokenizeErr, payload) {
1004
+ if (tokenizeErr) {
1005
+
1006
+ if (typeof options.onFailure === 'function') {
1007
+ options.onFailure();
1008
+ } else {
1009
+ checkout.setLoadWaiting(false);
1010
+ }
1011
+
1012
+ // Return the message to the user
1013
+ if (typeof tokenizeErr.message === 'string') {
1014
+ alert(tokenizeErr.message);
1015
+ }
1016
+ return;
1017
+ }
1018
+
1019
+ return this.hostedFieldsNonceReceived(payload.nonce, options);
1020
+ }.bind(this));
1021
+ },
1022
+
1023
+ /**
1024
+ * Should our integrations intercept credit card payments based on the settings?
1025
+ *
1026
+ * @returns {boolean}
1027
+ */
1028
+ shouldInterceptCreditCard: function () {
1029
+ return (this.amount != '0.00');
1030
+ },
1031
+
1032
+ /**
1033
+ * Should our integrations intercept PayPal payments based on the settings?
1034
+ *
1035
+ * @returns {boolean}
1036
+ */
1037
+ shouldInterceptPayPal: function () {
1038
+ return true;
1039
+ },
1040
+
1041
+ /**
1042
+ * Wrapper function which defines which method should be called
1043
+ *
1044
+ * verify3dSecureVault - used for verifying any vaulted card when 3D secure is enabled
1045
+ * verify3dSecure - verify a normal card via 3D secure
1046
+ * processCard - verify a normal card
1047
+ *
1048
+ * If the customer has choosen a vaulted card and 3D is disabled no client side interaction is needed
1049
+ *
1050
+ * @param options Object containing onSuccess, onFailure functions
1051
+ */
1052
+ process: function (options) {
1053
+ options = options || {};
1054
+
1055
+ // Run success action if the hosted field token is generated, or the user is using a saved card without 3Ds
1056
+ if (this._hostedFieldsTokenGenerated || (this.usingSavedCard() && !this.usingSavedThreeDCard())) {
1057
+
1058
+ // No action required as we're using a saved card
1059
+ if (typeof options.onSuccess === 'function') {
1060
+ options.onSuccess()
1061
+ }
1062
+
1063
+ } else if (this.usingSavedThreeDCard()) {
1064
+
1065
+ // The user has selected a card stored via 3D secure
1066
+ return this.verify3dSecureVault(options);
1067
+
1068
+ } else {
1069
+
1070
+ // Otherwise process the card normally
1071
+ return this.processCard(options);
1072
+
1073
+ }
1074
+ },
1075
+
1076
+ /**
1077
+ * Called on Credit Card loading
1078
+ *
1079
+ * @returns {boolean}
1080
+ */
1081
+ creditCardLoaded: function () {
1082
+ return false;
1083
+ },
1084
+
1085
+ /**
1086
+ * Called on PayPal loading
1087
+ *
1088
+ * @returns {boolean}
1089
+ */
1090
+ paypalLoaded: function () {
1091
+ return false;
1092
+ },
1093
+
1094
+ /**
1095
+ * Parse a transports response into JSON
1096
+ *
1097
+ * @param transport
1098
+ * @returns {*}
1099
+ * @private
1100
+ */
1101
+ _parseTransportAsJson: function (transport) {
1102
+ if (transport.responseJSON && typeof transport.responseJSON === 'object') {
1103
+ return transport.responseJSON;
1104
+ } else if (transport.responseText) {
1105
+ if (typeof JSON === 'object' && typeof JSON.parse === 'function') {
1106
+ return JSON.parse(transport.responseText);
1107
+ } else {
1108
+ return eval('(' + transport.responseText + ')');
1109
+ }
1110
+ }
1111
+
1112
+ return {};
1113
+ }
1114
+
1115
+ };
1116
+
1117
+ // Avoid 'console' errors in browsers that lack a console.
1118
+ (function () {
1119
+ var method;
1120
+ var noop = function () {
1121
+ };
1122
+ var methods = [
1123
+ 'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
1124
+ 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
1125
+ 'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
1126
+ 'timeStamp', 'trace', 'warn'
1127
+ ];
1128
+ var length = methods.length;
1129
+ var console = (window.console = window.console || {});
1130
+
1131
+ while (length--) {
1132
+ method = methods[length];
1133
+
1134
+ // Only stub undefined methods.
1135
+ if (!console[method]) {
1136
+ console[method] = noop;
1137
+ }
1138
+ }
1139
+ }());
js/gene/braintree/vzero-0.7-min.js DELETED
@@ -1 +0,0 @@
1
- var vZero=Class.create();vZero.prototype={initialize:function(e,t,i,n,a,s,o,r,d){this.code=e,this.clientToken=t,this.threeDSecure=i,this.hostedFields=n,a&&(this.billingName=a),s&&(this.billingPostcode=s),o&&(this.quoteUrl=o),r&&(this.tokenizeUrl=r),d&&(this.vaultToNonceUrl=d),this._hostedFieldsTokenGenerated=!1,this.acceptedCards=!1,this.closeMethod=!1,this._hostedFieldsTimeout=!1,this._updateDataXhr=!1,this._updateDataCallbacks=[],this._updateDataParams={},this._vaultToNonceXhr=!1},init:function(){this.client=new braintree.api.Client({clientToken:this.clientToken})},initHostedFields:function(e){return $$('iframe[name^="braintree-"]').length>0?!1:null===$("braintree-hosted-submit")?!1:(this.integration=e,this._hostedFieldsTokenGenerated=!1,clearTimeout(this._hostedFieldsTimeout),void(this._hostedFieldsTimeout=setTimeout(function(){if(this._hostedIntegration!==!1)try{this._hostedIntegration.teardown(function(){this._hostedIntegration=!1,this.setupHostedFieldsClient()}.bind(this))}catch(e){this.setupHostedFieldsClient()}else this.setupHostedFieldsClient()}.bind(this),50)))},teardownHostedFields:function(e){"undefined"!=typeof this._hostedIntegration&&this._hostedIntegration!==!1?this._hostedIntegration.teardown(function(){this._hostedIntegration=!1,"function"==typeof e&&e()}.bind(this)):"function"==typeof e&&e()},setupHostedFieldsClient:function(){if($$('iframe[name^="braintree-"]').length>0)return!1;this._hostedIntegration=!1;var e={id:this.integration.form,hostedFields:{styles:this.getHostedFieldsStyles(),number:{selector:"#card-number",placeholder:"0000 0000 0000 0000"},expirationMonth:{selector:"#expiration-month",placeholder:"MM"},expirationYear:{selector:"#expiration-year",placeholder:"YY"},onFieldEvent:this.hostedFieldsOnFieldEvent.bind(this)},onReady:this.hostedFieldsOnReady.bind(this),onPaymentMethodReceived:this.hostedFieldsPaymentMethodReceived.bind(this),onError:this.hostedFieldsError.bind(this)};null!==$("cvv")&&(e.hostedFields.cvv={selector:"#cvv"}),braintree.setup(this.clientToken,"custom",e)},getHostedFieldsStyles:function(){return"function"==typeof this.integration.getHostedFieldsStyles?this.integration.getHostedFieldsStyles():{input:{"font-size":"14pt",color:"#3A3A3A"},":focus":{color:"black"},".valid":{color:"green"},".invalid":{color:"red"}}},hostedFieldsOnFieldEvent:function(e){if("fieldStateChange"===e.type&&e.card){var t={visa:"VI","american-express":"AE","master-card":"MC",discover:"DI",jcb:"JCB",maestro:"ME"};void 0!==typeof t[e.card.type]?this.updateCardType(!1,t[e.card.type]):this.updateCardType(!1,"card")}},vaultToNonce:function(e,t){var i=this.getBillingAddress();i.nonce=e,new Ajax.Request(this.vaultToNonceUrl,{method:"post",parameters:i,onSuccess:function(e){if(e&&(e.responseJSON||e.responseText)){var i=this._parseTransportAsJson(e);i.success&&i.nonce?t(i.nonce):("function"==typeof this.integration.resetLoading&&this.integration.resetLoading(),i.error?alert(i.error):alert("Something wen't wrong and we're currently unable to take your payment."))}}.bind(this),onFailure:function(){"function"==typeof this.integration.resetLoading&&this.integration.resetLoading(),alert("Something wen't wrong and we're currently unable to take your payment.")}.bind(this)})},hostedFieldsOnReady:function(e){if(this._hostedIntegration=e,$$("#credit-card-form.loading").length&&$$("#credit-card-form.loading").first().removeClassName("loading"),this.integration.submitAfterPayment){var t=new Element("input",{type:"hidden",name:"payment[submit_after_payment]",value:1,id:"braintree-submit-after-payment"});$("payment_form_gene_braintree_creditcard").insert(t)}else $("braintree-submit-after-payment")&&$("braintree-submit-after-payment").remove()},hostedFieldsPaymentMethodReceived:function(e){this.threeDSecure?("function"==typeof this.integration.setLoading&&this.integration.setLoading(),this.updateData(function(){this.vaultToNonce(e.nonce,function(e){"function"==typeof this.integration.resetLoading&&this.integration.resetLoading(),this.verify3dSecureNonce(e,{onSuccess:function(e){this.hostedFieldsNonceReceived(e.nonce)}.bind(this),onFailure:function(e,t){alert(t)}.bind(this)})}.bind(this))}.bind(this))):this.hostedFieldsNonceReceived(e.nonce)},hostedFieldsNonceReceived:function(e){$("creditcard-payment-nonce").value=e,$("creditcard-payment-nonce").setAttribute("value",e),"function"==typeof this.integration.resetLoading&&this.integration.resetLoading(),this._hostedFieldsTokenGenerated=!0,"function"==typeof this.integration.afterHostedFieldsNonceReceived&&this.integration.afterHostedFieldsNonceReceived(e)},hostedFieldsError:function(e){return"function"==typeof this.integration.resetLoading&&this.integration.resetLoading(),"undefined"!=typeof e.message&&-1==e.message.indexOf("Cannot place two elements in")&&-1==e.message.indexOf("Unable to find element with selector")&&-1==e.message.indexOf("User did not enter a payment method")&&alert(e.message),this._hostedFieldsTokenGenerated=!1,"function"==typeof this.integration.afterHostedFieldsError&&this.integration.afterHostedFieldsError(e.message),!1},usingSavedCard:function(){return void 0!=$("creditcard-saved-accounts")&&void 0!=$$("#creditcard-saved-accounts input:checked[type=radio]").first()&&"other"!==$$("#creditcard-saved-accounts input:checked[type=radio]").first().value},setThreeDSecure:function(e){this.threeDSecure=e},setAmount:function(e){this.amount=parseFloat(e)},setBillingName:function(e){this.billingName=e},getBillingName:function(){return"object"==typeof this.billingName?this.combineElementsValues(this.billingName):this.billingName},setBillingPostcode:function(e){this.billingPostcode=e},getBillingPostcode:function(){return"object"==typeof this.billingPostcode?this.combineElementsValues(this.billingPostcode):this.billingPostcode},setAcceptedCards:function(e){this.acceptedCards=e},getBillingAddress:function(){if("function"==typeof this.integration.getBillingAddress)return this.integration.getBillingAddress();var e={};return null!==$("co-billing-form")?e="FORM"==$("co-billing-form").tagName?$("co-billing-form").serialize(!0):this.extractBilling($("co-billing-form").up("form").serialize(!0)):null!==$("billing:firstname")&&(e=this.extractBilling($("billing:firstname").up("form").serialize(!0))),e?e:void 0},extractBilling:function(e){var t={};return $H(e).each(function(e){0==e.key.indexOf("billing")&&-1==e.key.indexOf("password")&&(t[e.key]=e.value)}),t},getAcceptedCards:function(){return this.acceptedCards},combineElementsValues:function(e,t){t||(t=" ");var i=[];return e.each(function(e,t){void 0!==$(e)&&(i[t]=$(e).value)}),i.join(t)},updateCardType:function(e,t){if(t||(t=this.getCardType(e)),void 0!=$("gene_braintree_creditcard_cc_type")&&("card"==t?$("gene_braintree_creditcard_cc_type").value="":$("gene_braintree_creditcard_cc_type").value=t),void 0!=$("card-type-image")){var i=$("card-type-image").src.substring(0,$("card-type-image").src.lastIndexOf("/"));$("card-type-image").setAttribute("src",i+"/"+t+".png")}},observeCardType:function(){void 0!==$$('[data-genebraintree-name="number"]').first()&&(Element.observe($$('[data-genebraintree-name="number"]').first(),"keyup",function(){vzero.updateCardType(this.value)}),$$('[data-genebraintree-name="number"]').first().oninput=function(){var e=this.value.split(" ").join("");e.length>0&&(e=e.match(new RegExp(".{1,4}","g")).join(" ")),this.value=e})},observeAjaxRequests:function(e,t){return vZero.prototype.observingAjaxRequests?!1:(vZero.prototype.observingAjaxRequests=!0,Ajax.Responders.register({onComplete:function(i){return this.handleAjaxRequest(i.url,e,t)}.bind(this)}),void(window.jQuery&&jQuery(document).ajaxComplete(function(i,n,a){return this.handleAjaxRequest(a.url,e,t)}.bind(this))))},handleAjaxRequest:function(e,t,i){if("undefined"!=typeof i&&i instanceof Array&&i.length>0){var n=!1;if(i.each(function(t){e&&-1!=e.indexOf(t)&&(n=!0)}),n===!0)return!1}e&&-1==e.indexOf("/braintree/")&&(t?t(e):this.updateData())},updateData:function(e,t){this._updateDataCallbacks.push(e),this._updateDataParams=t,this._updateDataXhr!==!1&&this._updateDataXhr.transport.abort(),this._updateDataXhr=new Ajax.Request(this.quoteUrl,{method:"post",parameters:this._updateDataParams,onSuccess:function(e){if(e&&(e.responseJSON||e.responseText)){var t=this._parseTransportAsJson(e);void 0!=t.billingName&&(this.billingName=t.billingName),void 0!=t.billingPostcode&&(this.billingPostcode=t.billingPostcode),void 0!=t.grandTotal&&(this.amount=t.grandTotal),void 0!=t.threeDSecure&&this.setThreeDSecure(t.threeDSecure),"undefined"!=typeof vzeroPaypal&&void 0!=t.grandTotal&&void 0!=t.currencyCode&&vzeroPaypal.setPricing(t.grandTotal,t.currencyCode),this._updateDataParams={},this._updateDataXhr=!1,this._updateDataCallbacks.length&&(this._updateDataCallbacks.each(function(e){e(t)}.bind(this)),this._updateDataCallbacks=[])}}.bind(this),onFailure:function(){this._updateDataParams={},this._updateDataXhr=!1,this._updateDataCallbacks=[]}.bind(this)})},close3dSecureMethod:function(e){this.closeMethod=e},tokenize3dSavedCards:function(e){if(this.threeDSecure)if(void 0!==$$("[data-token]").first()){var t=[];$$("[data-token]").each(function(e,i){t[i]=e.getAttribute("data-token")}),new Ajax.Request(this.tokenizeUrl,{method:"post",onSuccess:function(t){if(t&&(t.responseJSON||t.responseText)){var i=this._parseTransportAsJson(t);i.success&&$H(i.tokens).each(function(e){void 0!=$$('[data-token="'+e.key+'"]').first()&&$$('[data-token="'+e.key+'"]').first().setAttribute("data-threedsecure-nonce",e.value)}),e&&e(i)}}.bind(this),parameters:{tokens:Object.toJSON(t)}})}else e();else e()},onUserClose3ds:function(){this._hostedFieldsTokenGenerated=!1,this.closeMethod?this.closeMethod():checkout.setLoadWaiting(!1)},verify3dSecureNonce:function(e,t){var i={amount:this.amount,creditCard:e,onUserClose:this.onUserClose3ds.bind(this)};this.client.verify3DS(i,function(e,i){e?t.onFailure&&t.onFailure(i,e.message):t.onSuccess&&t.onSuccess(i)})},verify3dSecure:function(e){var t={amount:this.amount,creditCard:{number:$$('[data-genebraintree-name="number"]').first().value,expirationMonth:$$('[data-genebraintree-name="expiration_month"]').first().value,expirationYear:$$('[data-genebraintree-name="expiration_year"]').first().value,cardholderName:this.getBillingName()},onUserClose:this.onUserClose3ds.bind(this)};void 0!=$$('[data-genebraintree-name="cvv"]').first()&&(t.creditCard.cvv=$$('[data-genebraintree-name="cvv"]').first().value),""!=this.getBillingPostcode()&&(t.creditCard.billingAddress={postalCode:this.getBillingPostcode()}),this.client.verify3DS(t,function(t,i){t?(alert(t.message),e.onFailure?e.onFailure():checkout.setLoadWaiting(!1)):($("creditcard-payment-nonce").value=i.nonce,$("creditcard-payment-nonce").setAttribute("value",i.nonce),e.onSuccess&&e.onSuccess())})},verify3dSecureVault:function(e){var t=$$("#creditcard-saved-accounts input:checked[type=radio]").first().getAttribute("data-threedsecure-nonce");t?this.client.verify3DS({amount:this.amount,creditCard:t},function(t,i){t?(alert(t.message),e.onFailure?e.onFailure():checkout.setLoadWaiting(!1)):($("creditcard-payment-nonce").removeAttribute("disabled"),$("creditcard-payment-nonce").value=i.nonce,$("creditcard-payment-nonce").setAttribute("value",i.nonce),e.onSuccess&&e.onSuccess())}):(alert("No payment nonce present."),e.onFailure?e.onFailure():checkout.setLoadWaiting(!1))},processCard:function(e){var t={number:$$('[data-genebraintree-name="number"]').first().value,cardholderName:this.getBillingName(),expirationMonth:$$('[data-genebraintree-name="expiration_month"]').first().value,expirationYear:$$('[data-genebraintree-name="expiration_year"]').first().value};void 0!=$$('[data-genebraintree-name="cvv"]').first()&&(t.cvv=$$('[data-genebraintree-name="cvv"]').first().value),""!=this.getBillingPostcode()&&(t.billingAddress={postalCode:this.getBillingPostcode()}),this.client.tokenizeCard(t,function(t,i){if(t){for(var n=0;n<t.length;n++)alert(t[n].code+" "+t[n].message);e.onFailure?e.onFailure():checkout.setLoadWaiting(!1)}else $("creditcard-payment-nonce").value=i,$("creditcard-payment-nonce").setAttribute("value",i),e.onSuccess&&e.onSuccess()})},shouldInterceptCreditCard:function(){return"0.00"!=this.amount},shouldInterceptPayPal:function(){return!0},getCardType:function(e){if(e){if(null!=e.match(/^4/))return"VI";if(null!=e.match(/^(34|37)/))return"AE";if(null!=e.match(/^5[1-5]/))return"MC";if(null!=e.match(/^6011/))return"DI";if(null!=e.match(/^(?:2131|1800|35)/))return"JCB";if(null!=e.match(/^(5018|5020|5038|6304|67[0-9]{2})/))return"ME"}return"card"},process:function(e){e=e||{},this._hostedFieldsTokenGenerated?e.onSuccess&&e.onSuccess():this.usingSavedCard()&&$$("#creditcard-saved-accounts input:checked[type=radio]").first().hasAttribute("data-threedsecure-nonce")?this.verify3dSecureVault(e):this.usingSavedCard()?e.onSuccess&&e.onSuccess():1==this.threeDSecure?this.verify3dSecure(e):this.processCard(e)},creditCardLoaded:function(){return!1},paypalLoaded:function(){return!1},_parseTransportAsJson:function(transport){return transport.responseJSON&&"object"==typeof transport.responseJSON?transport.responseJSON:transport.responseText?"object"==typeof JSON&&"function"==typeof JSON.parse?JSON.parse(transport.responseText):eval("("+transport.responseText+")"):{}}};var vZeroPayPalButton=Class.create();vZeroPayPalButton.prototype={initialize:function(e,t,i,n,a){this.clientToken=e,this.storeFrontName=t,this.singleUse=i,this.locale=n,this.futureSingleUse=a,this._paypalOptions={},this._paypalIntegration=!1,this._paypalButton=!1,this._rebuildTimer=!1,this._rebuildCount=0,this.integration=!1},setPricing:function(e,t){this.amount=parseFloat(e),this.currency=t,null==$("paypal-payment-nonce")||$("paypal-payment-nonce").value||this.rebuildButton()},rebuildButton:function(){if(clearTimeout(this._rebuildTimer),this._paypalIntegration!==!1)try{this._paypalIntegration.teardown(function(){this._paypalIntegration=!1,this.addPayPalButton(this._paypalOptions)}.bind(this))}catch(e){if("Cannot teardown integration more than once"==e.message)this._paypalIntegration=!1,this.addPayPalButton(this._paypalOptions);else{if(this._rebuildCount>=10)return!1;this._rebuildTimer=setTimeout(function(){++this._rebuildCount,this.rebuildButton()}.bind(this),200)}}},addPayPalButton:function(e,t){if(this.integration||"object"!=typeof t||(this.integration=t),null===$("paypal-container")||null===$("braintree-paypal-button"))return!1;var i=$("braintree-paypal-button").innerHTML;if($("paypal-container").update(""),$("paypal-container").insert(i),!$("paypal-container").select(">button").length)return!1;this._paypalButton=$("paypal-container").select(">button").first(),this._paypalButton.addClassName("braintree-paypal-loading"),this._paypalButton.setAttribute("disabled","disabled"),this._paypalOptions=e,this._paypalIntegration=!1;var n={paymentMethodNonceInputField:"paypal-payment-nonce",displayName:this.storeFrontName,onPaymentMethodReceived:function(t){"function"==typeof e.onSuccess?e.onSuccess(t):(payment.switchMethod("gene_braintree_paypal"),$("paypal-payment-nonce").removeAttribute("disabled"),$("paypal-complete").remove(),window.review&&review.save())},onUnsupported:function(){alert("You need to link your PayPal account with your Braintree account in your Braintree control panel to utilise the PayPal functionality of this extension.")},onReady:function(t){this._paypalIntegration=t,this._attachPayPalButtonEvent(),"function"==typeof e.onReady&&e.onReady(t)}.bind(this),paypal:{headless:!0}};this.locale&&(n.locale=this.locale),1==this.singleUse?(n.singleUse=!0,n.amount=this.amount,n.currency=this.currency):1==this.futureSingleUse?n.singleUse=!0:n.singleUse=!1,braintree.setup(this.clientToken,"paypal",n)},_attachPayPalButtonEvent:function(e){this._paypalIntegration&&this._paypalButton&&(this._paypalButton.removeClassName("braintree-paypal-loading"),this._paypalButton.removeAttribute("disabled"),Event.stopObserving(this._paypalButton,"click"),Event.observe(this._paypalButton,"click",function(e){Event.stop(e),"object"==typeof this.integration&&"function"==typeof this.integration.validateAll?this.integration.validateAll()&&this._paypalIntegration.paypal.initAuthFlow():this._paypalIntegration.paypal.initAuthFlow()}.bind(this)))},closePayPalWindow:function(e){}};var vZeroIntegration=Class.create();vZeroIntegration.prototype={initialize:function(e,t,i,n,a,s,o){return vZeroIntegration.prototype.loaded?(console.error("Your checkout is including the Braintree resources multiple times, please resolve this."),!1):(vZeroIntegration.prototype.loaded=!0,this.vzero=e||!1,this.vzeroPaypal=t||!1,this.vzero===!1&&this.vzeroPaypal===!1?(console.warn("The vzero and vzeroPaypal objects are not initiated."),!1):(this.paypalMarkUp=i||!1,this.paypalButtonClass=n||!1,this.isOnepage=a||!1,this.config=s||{},this.submitAfterPayment=o||!1,this._methodSwitchTimeout=!1,this._hostedFieldsInit=!1,document.observe("dom:loaded",function(){this.prepareSubmitObserver(),this.preparePaymentMethodSwitchObserver()}.bind(this)),this.hostedFieldsGenerated=!1,this.vzero.close3dSecureMethod(function(){this.vzero._hostedFieldsValidationRunning=!1,this.vzero.tokenize3dSavedCards(function(){this.threeDTokenizationComplete()}.bind(this))}.bind(this)),this.isOnepage&&(this.vzero.observeCardType(),this.observeAjaxRequests(),document.observe("dom:loaded",function(){this.initSavedPayPal(),this.initDefaultMethod(),null!==$("braintree-hosted-submit")&&this.initHostedFields()}.bind(this))),void document.observe("dom:loaded",function(){this.initSavedMethods(),null!==$("braintree-hosted-submit")&&this.initHostedFields()}.bind(this))))},initSavedMethods:function(){$$('#creditcard-saved-accounts input[type="radio"], #paypal-saved-accounts input[type="radio"]').each(function(e){var t="",i="";void 0!==e.up("#creditcard-saved-accounts")?(t="#creditcard-saved-accounts",i="#credit-card-form"):void 0!==e.up("#paypal-saved-accounts")&&(t="#paypal-saved-accounts",i=".paypal-info"),$(e).stopObserving("change").observe("change",function(e){return this.showHideOtherMethod(t,i)}.bind(this))}.bind(this))},showHideOtherMethod:function(e,t){void 0!==$$(e+" input:checked[type=radio]").first()&&"other"==$$(e+" input:checked[type=radio]").first().value?void 0!==$$(t).first()&&($$(t).first().show(),$$(t+" input, "+t+" select").each(function(e){e.removeAttribute("disabled")})):void 0!==$$(e+" input:checked[type=radio]").first()&&void 0!==$$(t).first()&&($$(t).first().hide(),$$(t+" input, "+t+" select").each(function(e){e.setAttribute("disabled","disabled")}))},checkSavedOther:function(){var e="",t="";"gene_braintree_creditcard"==this.getPaymentMethod()?(e="#creditcard-saved-accounts",t="#credit-card-form"):"gene_braintree_paypal"==this.getPaymentMethod()&&(e="#paypal-saved-accounts",t=".paypal-info"),void 0!==$$(e).first()&&this.showHideOtherMethod(e,t)},initHostedFields:function(){this.vzero.hostedFields&&null!==$("braintree-hosted-submit")&&(void 0!==$("braintree-hosted-submit").up("form")?(this._hostedFieldsInit=!0,this.form=$("braintree-hosted-submit").up("form"),this.vzero.initHostedFields(this)):console.error("Hosted Fields cannot be initialized as we're unable to locate the parent form."))},afterHostedFieldsNonceReceived:function(e){return this.resetLoading(),this.vzero._hostedFieldsTokenGenerated=!0,this.hostedFieldsGenerated=!0,this.isOnepage||this.submitAfterPayment?this.submitCheckout():this.submitPayment()},afterHostedFieldsError:function(e){return this.vzero._hostedFieldsTokenGenerated=!1,this.hostedFieldsGenerated=!1,!1},initDefaultMethod:function(){this.shouldAddPayPalButton(!1)&&(this.setLoading(),this.vzero.updateData(function(){this.resetLoading(),this.updatePayPalButton("add")}.bind(this)))},observeAjaxRequests:function(){this.vzero.observeAjaxRequests(function(){this.vzero.updateData(function(){this.isOnepage&&(this.initSavedPayPal(),this.rebuildPayPalButton(),this.checkSavedOther(),this.vzero.hostedFields&&this.initHostedFields()),this.initSavedMethods()}.bind(this))}.bind(this),"undefined"!=typeof this.config.ignoreAjax?this.config.ignoreAjax:!1)},rebuildPayPalButton:function(){null==$("paypal-container")&&this.updatePayPalButton()},initSavedPayPal:function(){void 0!==$$("#paypal-saved-accounts input[type=radio]").first()&&$("paypal-saved-accounts").on("change","input[type=radio]",function(e){this.updatePayPalButton(!1,"gene_braintree_paypal")}.bind(this))},prepareSubmitObserver:function(){return!1},beforeSubmit:function(e){return this._beforeSubmit(e)},_beforeSubmit:function(e){if(this.hostedFieldsGenerated===!1&&this.vzero.hostedFields&&(void 0===$$("#creditcard-saved-accounts input:checked[type=radio]").first()||void 0!==$$("#creditcard-saved-accounts input:checked[type=radio]").first()&&"other"==$$("#creditcard-saved-accounts input:checked[type=radio]").first().value)){var t=$("braintree-hosted-submit").down("button");t.removeAttribute("disabled"),t.click()}else e();this.submitAfterPayment&&$("braintree-submit-after-payment")&&$("braintree-submit-after-payment").remove()},afterSubmit:function(){return!1},submit:function(e,t,i,n){this.shouldInterceptSubmit(e)&&(this.validateAll()?(this.setLoading(),this.beforeSubmit(function(){void 0!=$$('[data-genebraintree-name="number"]').first()&&this.vzero.updateCardType($$('[data-genebraintree-name="number"]').first().value),this.vzero.updateData(function(){this.updateBilling(),this.vzero.process({onSuccess:function(){if(this.enableDeviceData(),this.disableCreditCardForm(),this.resetLoading(),this.afterSubmit(),this.enableDisableNonce(),this.vzero._hostedFieldsTokenGenerated=!1,this.hostedFieldsGenerated=!1,"function"==typeof t)var e=t();return this.setLoading(),this.enableCreditCardForm(),e}.bind(this),onFailure:function(){return this.vzero._hostedFieldsTokenGenerated=!1,this.hostedFieldsGenerated=!1,this.resetLoading(),this.afterSubmit(),"function"==typeof i?i():void 0}.bind(this)})}.bind(this),this.getUpdateDataParams())}.bind(this))):(this.vzero._hostedFieldsTokenGenerated=!1,this.hostedFieldsGenerated=!1,this.resetLoading(),"function"==typeof n&&n()))},submitCheckout:function(){window.review&&review.save()},submitPayment:function(){payment.save&&payment.save()},enableDisableNonce:function(){"gene_braintree_creditcard"==this.getPaymentMethod()?(null!==$("creditcard-payment-nonce")&&$("creditcard-payment-nonce").removeAttribute("disabled"),null!==$("paypal-payment-nonce")&&$("paypal-payment-nonce").setAttribute("disabled","disabled")):"gene_braintree_paypal"==this.getPaymentMethod()&&(null!==$("creditcard-payment-nonce")&&$("creditcard-payment-nonce").setAttribute("disabled","disabled"),null!==$("paypal-payment-nonce")&&$("paypal-payment-nonce").removeAttribute("disabled"))},preparePaymentMethodSwitchObserver:function(){return this.defaultPaymentMethodSwitch()},defaultPaymentMethodSwitch:function(){var e=this,t=Payment.prototype.switchMethod;Payment.prototype.switchMethod=function(i){return e.paymentMethodSwitch(i),t.apply(this,arguments)}},paymentMethodSwitch:function(e){clearTimeout(this._methodSwitchTimeout),this._methodSwitchTimeout=setTimeout(function(){this.shouldAddPayPalButton(e)?this.updatePayPalButton("add",e):this.updatePayPalButton("remove",e),"gene_braintree_creditcard"==(e?e:this.getPaymentMethod())&&this.initHostedFields(),this.checkSavedOther()}.bind(this),50)},completePayPal:function(e){return this.enableDisableNonce(),this.enableDeviceData(),e.nonce&&null!==$("paypal-payment-nonce")?($("paypal-payment-nonce").value=e.nonce,$("paypal-payment-nonce").setAttribute("value",e.nonce)):console.warn("Unable to update PayPal nonce, please verify that the nonce input field has the ID: paypal-payment-nonce"),this.afterPayPalComplete(),!1},afterPayPalComplete:function(){return this.resetLoading(),this.submitCheckout()},updatePayPalButton:function(e,t){if(this.paypalMarkUp===!1)return!1;if("refresh"==e)return this.updatePayPalButton("remove"),this.updatePayPalButton("add"),!0;if(this.shouldAddPayPalButton(t)&&"remove"!=e||"add"==e)if(void 0!==$$(this.paypalButtonClass).first()){if(void 0!==$$("#paypal-complete").first()&&$$("#paypal-complete").first().visible())return!0;$$(this.paypalButtonClass).first().hide(),$$(this.paypalButtonClass).first().insert({after:this.paypalMarkUp});var i={onSuccess:this.completePayPal.bind(this),onReady:this.paypalOnReady.bind(this)};this.vzeroPaypal.addPayPalButton(i,this)}else console.warn("We're unable to find the element "+this.paypalButtonClass+". Please check your integration.");else void 0!==$$(this.paypalButtonClass).first()&&$$(this.paypalButtonClass).first().show(),void 0!==$$("#paypal-complete").first()&&$("paypal-complete").remove()},paypalOnReady:function(e){return!0},setLoading:function(){checkout.setLoadWaiting("payment")},resetLoading:function(){checkout.setLoadWaiting(!1)},enableDeviceData:function(){null!==$("device_data")&&$("device_data").removeAttribute("disabled")},disableCreditCardForm:function(){$$("#credit-card-form input, #credit-card-form select").each(function(e){"creditcard-payment-nonce"!=e.id&&"gene_braintree_creditcard_store_in_vault"!=e.id&&e.setAttribute("disabled","disabled")})},enableCreditCardForm:function(){$$("#credit-card-form input, #credit-card-form select").each(function(e){e.removeAttribute("disabled")})},updateBilling:function(){(null!==$("billing-address-select")&&""==$("billing-address-select").value||null===$("billing-address-select"))&&(null!==$("billing:firstname")&&null!==$("billing:lastname")&&this.vzero.setBillingName($("billing:firstname").value+" "+$("billing:lastname").value),null!==$("billing:postcode")&&this.vzero.setBillingPostcode($("billing:postcode").value))},getUpdateDataParams:function(){var e={};return null!==$("billing-address-select")&&""!=$("billing-address-select").value&&(e.addressId=$("billing-address-select").value),e},getPaymentMethod:function(){return payment.currentMethod},shouldInterceptSubmit:function(e){switch(e){case"creditcard":return"gene_braintree_creditcard"==this.getPaymentMethod()&&this.vzero.shouldInterceptCreditCard();break;case"paypal":return"gene_braintree_paypal"==this.getPaymentMethod()&&this.vzero.shouldInterceptCreditCard()}return!1},shouldAddPayPalButton:function(e){return"gene_braintree_paypal"==(e?e:this.getPaymentMethod())&&null===$("paypal-saved-accounts")||"gene_braintree_paypal"==(e?e:this.getPaymentMethod())&&void 0!==$$("#paypal-saved-accounts input:checked[type=radio]").first()&&"other"==$$("#paypal-saved-accounts input:checked[type=radio]").first().value},threeDTokenizationComplete:function(){this.resetLoading()},validateAll:function(){return!0}},function(){for(var e,t=function(){},i=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","markTimeline","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],n=i.length,a=window.console=window.console||{};n--;)e=i[n],a[e]||(a[e]=t)}();
 
js/gene/braintree/vzero-0.7-min.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["vzero-0.7.js"],"names":["vZero","Class","create","prototype","initialize","code","clientToken","threeDSecure","hostedFields","billingName","billingPostcode","quoteUrl","tokenizeUrl","vaultToNonceUrl","this","_hostedFieldsTokenGenerated","acceptedCards","closeMethod","_hostedFieldsTimeout","_updateDataXhr","_updateDataCallbacks","_updateDataParams","_vaultToNonceXhr","init","client","braintree","api","Client","initHostedFields","integration","$$","length","$","clearTimeout","setTimeout","_hostedIntegration","teardown","setupHostedFieldsClient","bind","e","hostedFieldsConfiguration","id","form","styles","input","font-size","color",":focus",".valid",".invalid","number","selector","placeholder","expirationMonth","expirationYear","onFieldEvent","hostedFieldsOnFieldEvent","onReady","onPaymentMethodReceived","hostedFieldsPaymentMethodReceived","onError","hostedFieldsError","cvv","setup","event","type","card","cardMapping","visa","american-express","master-card","discovery","jcb","maestro","undefined","updateCardType","vaultToNonce","nonce","callback","parameters","getBillingAddress","Ajax","Request","method","onSuccess","transport","responseText","response","eval","success","resetLoading","error","alert","onFailure","setLoading","updateData","verify3dSecureNonce","hostedFieldsNonceReceived","value","setAttribute","afterHostedFieldsNonceReceived","message","indexOf","afterHostedFieldsError","usingSavedCard","first","setThreeDSecure","flag","setAmount","amount","parseFloat","setBillingName","getBillingName","combineElementsValues","setBillingPostcode","getBillingPostcode","setAcceptedCards","cards","billingAddress","tagName","serialize","extractBilling","up","formData","billing","$H","each","data","key","getAcceptedCards","elements","seperator","element","index","join","cardNumber","cardType","getCardType","skinImageUrl","src","substring","lastIndexOf","observeCardType","Element","observe","vzero","oninput","split","match","RegExp","observeAjaxRequests","ignore","Responders","register","onComplete","handleAjaxRequest","url","window","jQuery","document","ajaxComplete","xhr","settings","Array","shouldIgnore","params","push","abort","grandTotal","vzeroPaypal","currencyCode","setPricing","close3dSecureMethod","tokenize3dSavedCards","tokens","getAttribute","Object","toJSON","onUserClose3ds","checkout","setLoadWaiting","options","threeDSecureRequest","creditCard","onUserClose","verify3DS","verify3dSecure","cardholderName","postalCode","verify3dSecureVault","paymentNonce","removeAttribute","processCard","tokenizeRequest","tokenizeCard","errors","i","shouldInterceptCreditCard","shouldInterceptPayPal","process","hasAttribute","creditCardLoaded","paypalLoaded","vZeroPayPalButton","storeFrontName","singleUse","locale","futureSingleUse","_paypalOptions","_paypalIntegration","_rebuildTimer","_rebuildCount","currency","rebuildButton","addPayPalButton","setupConfiguration","container","paymentMethodNonceInputField","displayName","obj","payment","switchMethod","remove","review","save","onUnsupported","closePayPalWindow","vZeroIntegration","paypalMarkUp","paypalButtonClass","isOnepage","config","loaded","console","warn","_methodSwitchTimeout","_hostedFieldsInit","prepareSubmitObserver","preparePaymentMethodSwitchObserver","hostedFieldsGenerated","_hostedFieldsValidationRunning","threeDTokenizationComplete","initSavedPayPal","initDefaultMethod","initSavedMethods","parentElement","targetElement","stopObserving","showHideOtherMethod","show","formElement","hide","checkSavedOther","getPaymentMethod","submitCheckout","submitPayment","shouldAddPayPalButton","updatePayPalButton","rebuildPayPalButton","ignoreAjax","on","beforeSubmit","_beforeSubmit","button","down","click","afterSubmit","submit","successCallback","failedCallback","validateFailedCallback","shouldInterceptSubmit","validateAll","updateBilling","enableDeviceData","disableCreditCardForm","enableDisableNonce","enableCreditCardForm","getUpdateDataParams","defaultPaymentMethodSwitch","vzeroIntegration","paymentSwitchOriginal","Payment","paymentMethodSwitch","apply","arguments","completePayPal","afterPayPalComplete","action","visible","insert","after","buttonParams","paypalOnReady","Event","stop","addressId","currentMethod","noop","methods"],"mappings":"AAOA,GAAIA,OAAQC,MAAMC,QAClBF,OAAMG,WAeFC,WAAY,SAAUC,EAAMC,EAAaC,EAAcC,EAAcC,EAAaC,EAAiBC,EAAUC,EAAaC,GACtHC,KAAKT,KAAOA,EACZS,KAAKR,YAAcA,EACnBQ,KAAKP,aAAeA,EACpBO,KAAKN,aAAeA,EAEhBC,IACAK,KAAKL,YAAcA,GAEnBC,IACAI,KAAKJ,gBAAkBA,GAEvBC,IACAG,KAAKH,SAAWA,GAEhBC,IACAE,KAAKF,YAAcA,GAEpBC,IACCC,KAAKD,gBAAkBA,GAG3BC,KAAKC,6BAA8B,EAEnCD,KAAKE,eAAgB,EAErBF,KAAKG,aAAc,EAGnBH,KAAKI,sBAAuB,EAG5BJ,KAAKK,gBAAiB,EACtBL,KAAKM,wBACLN,KAAKO,qBAELP,KAAKQ,kBAAmB,GAO5BC,KAAM,WACFT,KAAKU,OAAS,GAAIC,WAAUC,IAAIC,QAAQrB,YAAaQ,KAAKR,eAQ9DsB,iBAAkB,SAASC,GAGvB,MAAIC,IAAG,8BAA8BC,OAAS,GACnC,EAK0B,OAAjCC,EAAE,4BACK,GAIXlB,KAAKe,YAAcA,EAEnBf,KAAKC,6BAA8B,EAGnCkB,aAAanB,KAAKI,2BAClBJ,KAAKI,qBAAuBgB,WAAW,WAEnC,GAAIpB,KAAKqB,sBAAuB,EAC5B,IACIrB,KAAKqB,mBAAmBC,SAAS,WAC7BtB,KAAKqB,oBAAqB,EAE1BrB,KAAKuB,2BACPC,KAAKxB,OACT,MAAOyB,GACLzB,KAAKuB,8BAITvB,MAAKuB,2BAGXC,KAAKxB,MAAO,OAMlBuB,wBAAyB,WAIrB,GAAIP,GAAG,8BAA8BC,OAAS,EAC1C,OAAO,CAGXjB,MAAKqB,oBAAqB,CAE1B,IAAIK,IACAC,GAAI3B,KAAKe,YAAYa,KACrBlC,cACImC,QAEIC,OACIC,YAAa,OACbC,MAAS,WAIbC,UACID,MAAS,SAEbE,UACIF,MAAS,SAEbG,YACIH,MAAS,QAGjBI,QACIC,SAAU,eACVC,YAAa,uBAEjBC,iBACIF,SAAU,oBACVC,YAAa,MAEjBE,gBACIH,SAAU,mBACVC,YAAa,MAEjBG,aAAczC,KAAK0C,yBAAyBlB,KAAKxB,OAErD2C,QAAS,SAAS5B,GACdf,KAAKqB,mBAAqBN,GAC5BS,KAAKxB,MACP4C,wBAAyB5C,KAAK6C,kCAAkCrB,KAAKxB,MACrE8C,QAAS9C,KAAK+C,kBAAkBvB,KAAKxB,MAIzB,QAAbkB,EAAE,SACDQ,EAA0BhC,aAAasD,KACnCX,SAAU,SAIlB1B,UAAUsC,MAAMjD,KAAKR,YAAa,SAAUkC,IAQhDgB,yBAA0B,SAASQ,GAC/B,GAAmB,qBAAfA,EAAMC,MACFD,EAAME,KAAM,CACZ,GAAIC,IACAC,KAAQ,KACRC,mBAAoB,KACpBC,cAAe,KACfC,UAAa,KACbC,IAAO,MACPC,QAAW,KAE6BC,gBAAjCP,GAAYH,EAAME,KAAKD,MAC9BnD,KAAK6D,gBAAe,EAAOR,EAAYH,EAAME,KAAKD,OAElDnD,KAAK6D,gBAAe,EAAO,UAY3CC,aAAc,SAASC,MAAOC,UAG1B,GAAIC,YAAajE,KAAKkE,mBACtBD,YAAkB,MAAIF,MAGtB,GAAII,MAAKC,QACLpE,KAAKD,iBAEDsE,OAAQ,OACRJ,WAAYA,WACZK,UAAW,SAAUC,WAEjB,GAAIA,WAAaA,UAAUC,aAAc,CAGrC,IACIC,SAAWC,KAAK,IAAMH,UAAUC,aAAe,KAEnD,MAAO/C,GACHgD,YAGDA,SAASE,SAAWF,SAASV,MAC5BC,SAASS,SAASV,QAI2B,kBAAlC/D,MAAKe,YAAY6D,cACxB5E,KAAKe,YAAY6D,eAGlBH,SAASI,MACRC,MAAML,SAASI,OAEfC,MAAM,6EAIpBtD,KAAKxB,MACP+E,UAAW,WAGsC,kBAAlC/E,MAAKe,YAAY6D,cACxB5E,KAAKe,YAAY6D,eAGrBE,MAAM,2EAERtD,KAAKxB,SAUnB6C,kCAAmC,SAAS4B,GAGpCzE,KAAKP,cAGsC,kBAAhCO,MAAKe,YAAYiE,YACxBhF,KAAKe,YAAYiE,aAIrBhF,KAAKiF,WAAW,WACZjF,KAAK8D,aAAaW,EAASV,MAAO,SAASA,GAGM,kBAAlC/D,MAAKe,YAAY6D,cACxB5E,KAAKe,YAAY6D,eAIrB5E,KAAKkF,oBAAoBnB,GACrBO,UAAW,SAAUG,GACjBzE,KAAKmF,0BAA0BV,EAASV,QAC1CvC,KAAKxB,MACP+E,UAAW,SAAUN,EAAUI,GAC3BC,MAAMD,IACRrD,KAAKxB,SAGbwB,KAAKxB,QACTwB,KAAKxB,QAGPA,KAAKmF,0BAA0BV,EAASV,QAUhDoB,0BAA2B,SAASpB,GAEhC7C,EAAE,4BAA4BkE,MAAQrB,EACtC7C,EAAE,4BAA4BmE,aAAa,QAAStB,GAEP,kBAAlC/D,MAAKe,YAAY6D,cACxB5E,KAAKe,YAAY6D,eAGrB5E,KAAKC,6BAA8B,EAG4B,kBAApDD,MAAKe,YAAYuE,gCACxBtF,KAAKe,YAAYuE,+BAA+BvB,IAUxDhB,kBAAmB,SAAS0B,GAmBxB,MAjB6C,kBAAlCzE,MAAKe,YAAY6D,cACxB5E,KAAKe,YAAY6D,eAKU,mBAArBH,GAASc,SAAuF,IAA5Dd,EAASc,QAAQC,QAAQ,iCAEnEV,MAAML,EAASc,SAGnBvF,KAAKC,6BAA8B,EAEoB,kBAA5CD,MAAKe,YAAY0E,wBACxBzF,KAAKe,YAAY0E,uBAAuBhB,EAASc,UAG9C,GASXG,eAAgB,WACZ,MAA0C9B,SAAlC1C,EAAE,8BAC+D0C,QAAtE5C,GAAG,wDAAwD2E,SACkB,UAA7E3E,GAAG,wDAAwD2E,QAAQP,OAS1EQ,gBAAiB,SAASC,GACtB7F,KAAKP,aAAeoG,GASxBC,UAAW,SAASC,GAChB/F,KAAK+F,OAASC,WAAWD,IAQ7BE,eAAgB,SAAStG,GACrBK,KAAKL,YAAcA,GAQvBuG,eAAgB,WAGZ,MAA+B,gBAApBlG,MAAKL,YAGLK,KAAKmG,sBAAsBnG,KAAKL,aAKhCK,KAAKL,aASpByG,mBAAoB,SAASxG,GACzBI,KAAKJ,gBAAkBA,GAQ3ByG,mBAAoB,WAGhB,MAAmC,gBAAxBrG,MAAKJ,gBAGLI,KAAKmG,sBAAsBnG,KAAKJ,iBAKhCI,KAAKJ,iBASpB0G,iBAAkB,SAASC,GACvBvG,KAAKE,cAAgBqG,GAQzBrC,kBAAmB,WAGf,GAAkD,kBAAvClE,MAAKe,YAAYmD,kBACxB,MAAOlE,MAAKe,YAAYmD,mBAG5B,IAAIsC,KAaJ,OAV4B,QAAzBtF,EAAE,mBAEGsF,EAD+B,QAAhCtF,EAAE,mBAAmBuF,QACHvF,EAAE,mBAAmBwF,WAAU,GAE/B1G,KAAK2G,eAAezF,EAAE,mBAAmB0F,GAAG,QAAQF,WAAU,IAElD,OAA3BxF,EAAE,uBACRsF,EAAkBxG,KAAK2G,eAAezF,EAAE,qBAAqB0F,GAAG,QAAQF,WAAU,KAGnFF,EACQA,EADX,QAWJG,eAAgB,SAASE,GACrB,GAAIC,KAOJ,OANAC,IAAGF,GAAUG,KAAK,SAASC,GAEW,GAA/BA,EAAKC,IAAI1B,QAAQ,YAAmD,IAAhCyB,EAAKC,IAAI1B,QAAQ,cACpDsB,EAAQG,EAAKC,KAAOD,EAAK7B,SAG1B0B,GAQXK,iBAAkB,WACd,MAAOnH,MAAKE,eAWhBiG,sBAAuB,SAASiB,EAAUC,GAGjCA,IACDA,EAAY,IAIhB,IAAI5C,KAQJ,OAPA2C,GAASJ,KAAK,SAASM,EAASC,GACT3D,SAAf1C,EAAEoG,KACF7C,EAAS8C,GAASrG,EAAEoG,GAASlC,SAK9BX,EAAS+C,KAAKH,IAUzBxD,eAAgB,SAAS4D,EAAYC,GAkBjC,GAhBKA,IAEDA,EAAW1H,KAAK2H,YAAYF,IAGc7D,QAA1C1C,EAAE,uCACc,QAAZwG,EAEAxG,EAAE,qCAAqCkE,MAAQ,GAG/ClE,EAAE,qCAAqCkE,MAAQsC,GAK3B9D,QAAxB1C,EAAE,mBAAiC,CAGnC,GAAI0G,GAAe1G,EAAE,mBAAmB2G,IAAIC,UAAU,EAAG5G,EAAE,mBAAmB2G,IAAIE,YAAY,KAG9F7G,GAAE,mBAAmBmE,aAAa,MAAOuC,EAAe,IAAMF,EAAW,UASjFM,gBAAiB,WAE4CpE,SAArD5C,GAAG,sCAAsC2E,UAGzCsC,QAAQC,QAAQlH,GAAG,sCAAsC2E,QAAS,QAAS,WAGvEwC,MAAMtE,eAAe7D,KAAKoF,SAI9BpE,GAAG,sCAAsC2E,QAAQyC,QAAU,WAEvD,GAAIhG,GAASpC,KAAKoF,MAAMiD,MAAM,KAAKb,KAAK,GACpCpF,GAAOnB,OAAS,IAChBmB,EAASA,EAAOkG,MAAM,GAAIC,QAAO,SAAU,MAAMf,KAAK,MAE1DxH,KAAKoF,MAAQhD,KAczBoG,oBAAqB,SAASxE,EAAUyE,GAGpCtE,KAAKuE,WAAWC,UACZC,WAAY,SAASrE,GACjB,MAAOvE,MAAK6I,kBAAkBtE,EAAUuE,IAAK9E,EAAUyE,IACzDjH,KAAKxB,QAIP+I,OAAOC,QACPA,OAAOC,UAAUC,aAAa,SAAShG,EAAOiG,EAAKC,GAC/C,MAAOpJ,MAAK6I,kBAAkBO,EAASN,IAAK9E,EAAUyE,IACxDjH,KAAKxB,QAaf6I,kBAAmB,SAASC,EAAK9E,EAAUyE,GAGvC,GAAsB,mBAAXA,IAA0BA,YAAkBY,QAASZ,EAAOxH,OAAS,EAAG,CAG/E,GAAIqI,IAAe,CAQnB,IAPAb,EAAOzB,KAAK,SAAUM,GACdwB,GAA+B,IAAxBA,EAAItD,QAAQ8B,KACnBgC,GAAe,KAKnBA,KAAiB,EACjB,OAAO,EAKXR,GAAmC,IAA5BA,EAAItD,QAAQ,eAGfxB,EACAA,EAAS8E,GAET9I,KAAKiF,eAYjBA,WAAY,SAASjB,SAAUuF,QAG3BvJ,KAAKM,qBAAqBkJ,KAAKxF,UAC/BhE,KAAKO,kBAAoBgJ,OAGtBvJ,KAAKK,kBAAmB,GACvBL,KAAKK,eAAekE,UAAUkF,QAIlCzJ,KAAKK,eAAiB,GAAI8D,MAAKC,QAC3BpE,KAAKH,UAEDwE,OAAO,OACPJ,WAAYjE,KAAKO,kBACjB+D,UAAW,SAASC,WAEhB,GAAIA,WAAaA,UAAUC,aAAc,CAGrC,IACIC,SAAWC,KAAK,IAAMH,UAAUC,aAAe,KAEnD,MAAO/C,GACHgD,YAGwBb,QAAxBa,SAAS9E,cACTK,KAAKL,YAAc8E,SAAS9E,aAEAiE,QAA5Ba,SAAS7E,kBACTI,KAAKJ,gBAAkB6E,SAAS7E,iBAETgE,QAAvBa,SAASiF,aACT1J,KAAK+F,OAAStB,SAASiF,YAEE9F,QAAzBa,SAAShF,cACTO,KAAK4F,gBAAgBnB,SAAShF,cAIR,mBAAfkK,cAGoB/F,QAAvBa,SAASiF,YAAoD9F,QAAzBa,SAASmF,cAC7CD,YAAYE,WAAWpF,SAASiF,WAAYjF,SAASmF,cAM7D5J,KAAKO,qBAGLP,KAAKK,gBAAiB,EAGnBL,KAAKM,qBAAqBW,SACzBjB,KAAKM,qBAAqB0G,KAAK,SAAUhD,GACrCA,EAASS,WACXjD,KAAKxB,OACPA,KAAKM,2BAGfkB,KAAKxB,MACP+E,UAAW,WAGP/E,KAAKO,qBACLP,KAAKK,gBAAiB,EACtBL,KAAKM,yBAEPkB,KAAKxB,SAWnB8J,oBAAqB,SAAS9F,GAC1BhE,KAAKG,YAAc6D,GAUvB+F,qBAAsB,SAAS/F,UAG3B,GAAIhE,KAAKP,aAGL,GAAmCmE,SAA/B5C,GAAG,gBAAgB2E,QAAuB,CAG1C,GAAIqE,UACJhJ,IAAG,gBAAgBgG,KAAK,SAAUM,EAASC,GACvCyC,OAAOzC,GAASD,EAAQ2C,aAAa,gBAIzC,GAAI9F,MAAKC,QACLpE,KAAKF,aAEDuE,OAAO,OACPC,UAAW,SAASC,WAGhB,GAAIA,WAAaA,UAAUC,aAAc,CAGrC,IACIC,SAAWC,KAAK,IAAMH,UAAUC,aAAe,KAEnD,MAAO/C,GACHgD,YAIAA,SAASE,SAGToC,GAAGtC,SAASuF,QAAQhD,KAAK,SAAUM,GAGyB1D,QAApD5C,GAAG,gBAAkBsG,EAAQJ,IAAM,MAAMvB,SACzC3E,GAAG,gBAAkBsG,EAAQJ,IAAM,MAAMvB,QAAQN,aAAa,0BAA2BiC,EAAQlC,SAKzGpB,UACAA,SAASS,YAGnBjD,KAAKxB,MACPiE,YAAa+F,OAAUE,OAAOC,OAAOH,eAI7ChG,gBAIJA,aAIRoG,eAAgB,WACZpK,KAAKC,6BAA8B,EAE/BD,KAAKG,YACLH,KAAKG,cAELkK,SAASC,gBAAe,IAUhCpF,oBAAqB,SAASnB,EAAOwG,GAEjC,GAAIC,IACAzE,OAAQ/F,KAAK+F,OACb0E,WAAY1G,EACZ2G,YAAa1K,KAAKoK,eAAe5I,KAAKxB,MAI1CA,MAAKU,OAAOiK,UAAUH,EAAqB,SAAU3F,EAAOJ,GAEnDI,EAMG0F,EAAQxF,WACRwF,EAAQxF,UAAUN,EAAUI,EAAMU,SALlCgF,EAAQjG,WACRiG,EAAQjG,UAAUG,MAgBlCmG,eAAgB,SAASL,GAErB,GAAIC,IACAzE,OAAQ/F,KAAK+F,OACb0E,YACIrI,OAAQpB,GAAG,sCAAsC2E,QAAQP,MACzD7C,gBAAiBvB,GAAG,gDAAgD2E,QAAQP,MAC5E5C,eAAgBxB,GAAG,+CAA+C2E,QAAQP,MAC1EyF,eAAgB7K,KAAKkG,kBAEzBwE,YAAa1K,KAAKoK,eAAe5I,KAAKxB,MAIW4D,SAAjD5C,GAAG,mCAAmC2E,UACtC6E,EAAoBC,WAAWzH,IAAMhC,GAAG,mCAAmC2E,QAAQP,OAItD,IAA7BpF,KAAKqG,uBACLmE,EAAoBC,WAAWjE,gBAC3BsE,WAAY9K,KAAKqG,uBAKzBrG,KAAKU,OAAOiK,UAAUH,EAAqB,SAAU3F,EAAOJ,GAEnDI,GAaDC,MAAMD,EAAMU,SAERgF,EAAQxF,UACRwF,EAAQxF,YAERsF,SAASC,gBAAe,KAf5BpJ,EAAE,4BAA4BkE,MAAQX,EAASV,MAC/C7C,EAAE,4BAA4BmE,aAAa,QAASZ,EAASV,OAGzDwG,EAAQjG,WACRiG,EAAQjG,gBAsBxByG,oBAAqB,SAASR,GAG1B,GAAIS,GAAehK,GAAG,wDAAwD2E,QAAQsE,aAAa,0BAE/Fe,GAEAhL,KAAKU,OAAOiK,WACR5E,OAAQ/F,KAAK+F,OACb0E,WAAYO,GACb,SAAUnG,EAAOJ,GACXI,GAcDC,MAAMD,EAAMU,SAERgF,EAAQxF,UACRwF,EAAQxF,YAERsF,SAASC,gBAAe,KAhB5BpJ,EAAE,4BAA4B+J,gBAAgB,YAC9C/J,EAAE,4BAA4BkE,MAAQX,EAASV,MAC/C7C,EAAE,4BAA4BmE,aAAa,QAASZ,EAASV,OAGzDwG,EAAQjG,WACRiG,EAAQjG,gBAepBQ,MAAM,6BAEFyF,EAAQxF,UACRwF,EAAQxF,YAERsF,SAASC,gBAAe,KAWpCY,YAAa,SAASX,GAElB,GAAIY,IACA/I,OAAQpB,GAAG,sCAAsC2E,QAAQP,MACzDyF,eAAgB7K,KAAKkG,iBACrB3D,gBAAiBvB,GAAG,gDAAgD2E,QAAQP,MAC5E5C,eAAgBxB,GAAG,+CAA+C2E,QAAQP,MAIzBxB,SAAjD5C,GAAG,mCAAmC2E,UACtCwF,EAAgBnI,IAAMhC,GAAG,mCAAmC2E,QAAQP,OAIvC,IAA7BpF,KAAKqG,uBACL8E,EAAgB3E,gBACZsE,WAAY9K,KAAKqG,uBAKzBrG,KAAKU,OAAO0K,aAAaD,EAAiB,SAAUE,EAAQtH,GAExD,GAAKsH,EASE,CAEH,IAAK,GAAIC,GAAI,EAAGA,EAAID,EAAOpK,OAAQqK,IAC/BxG,MAAMuG,EAAOC,GAAG/L,KAAO,IAAM8L,EAAOC,GAAG/F,QAGvCgF,GAAQxF,UACRwF,EAAQxF,YAERsF,SAASC,gBAAe,OAhB5BpJ,GAAE,4BAA4BkE,MAAQrB,EACtC7C,EAAE,4BAA4BmE,aAAa,QAAStB,GAGhDwG,EAAQjG,WACRiG,EAAQjG,eAuBxBiH,0BAA2B,WACvB,OAAO,GAQXC,sBAAuB,WACnB,OAAO,GASX7D,YAAa,SAASvF,GAElB,GAAGA,EAAQ,CAEP,GAA0B,MAAtBA,EAAOkG,MAAM,MACb,MAAO,IAEX,IAAgC,MAA5BlG,EAAOkG,MAAM,YACb,MAAO,IAEX,IAA+B,MAA3BlG,EAAOkG,MAAM,WACb,MAAO,IAEX,IAA6B,MAAzBlG,EAAOkG,MAAM,SACb,MAAO,IAEX,IAAyC,MAArClG,EAAOkG,MAAM,qBACb,MAAO,KAEX,IAAyD,MAArDlG,EAAOkG,MAAM,qCACb,MAAO,KAKf,MAAO,QAcXmD,QAAS,SAASlB,GAGdA,EAAUA,MAGPvK,KAAKC,4BAGAsK,EAAQjG,WACRiG,EAAQjG,YAGLtE,KAAK0F,kBAAoB1E,GAAG,wDAAwD2E,QAAQ+F,aAAa,2BAGhH1L,KAAK+K,oBAAoBR,GAElBvK,KAAK0F,iBAGR6E,EAAQjG,WACRiG,EAAQjG,YAGgB,GAArBtE,KAAKP,aAGZO,KAAK4K,eAAeL,GAKpBvK,KAAKkL,YAAYX,IAIzBoB,iBAAkB,WACd,OAAO,GAGXC,aAAc,WACV,OAAO,GAWf,IAAIC,mBAAoB1M,MAAMC,QAC9ByM,mBAAkBxM,WAWdC,WAAY,SAAUE,EAAasM,EAAgBC,EAAWC,EAAQC,GAClEjM,KAAKR,YAAcA,EACnBQ,KAAK8L,eAAiBA,EACtB9L,KAAK+L,UAAYA,EACjB/L,KAAKgM,OAASA,EACdhM,KAAKiM,gBAAkBA,EAEvBjM,KAAKkM,kBACLlM,KAAKmM,oBAAqB,EAE1BnM,KAAKoM,eAAgB,EACrBpM,KAAKqM,cAAgB,GAWzBxC,WAAY,SAAS9D,EAAQuG,GAGzBtM,KAAK+F,OAASC,WAAWD,GACzB/F,KAAKsM,SAAWA,EAGhBtM,KAAKuM,iBAOTA,cAAe,WAGX,GADApL,aAAanB,KAAKoM,eACdpM,KAAKmM,sBAAuB,EAC5B,IAEInM,KAAKmM,mBAAmB7K,SAAS,WAC7BtB,KAAKmM,oBAAqB,EAE1BnM,KAAKwM,gBAAgBxM,KAAKkM,iBAC5B1K,KAAKxB,OACT,MAAOyB,GAEL,GAAgB,8CAAbA,EAAE8D,QACDvF,KAAKmM,oBAAqB,EAC1BnM,KAAKwM,gBAAgBxM,KAAKkM,oBACvB,CAAA,GAAGlM,KAAKqM,eAAiB,GAE5B,OAAO,CAGPrM,MAAKoM,cAAgBhL,WAAW,aAC1BpB,KAAKqM,cACPrM,KAAKuM,iBACP/K,KAAKxB,MAAO,QAW9BwM,gBAAiB,SAASjC,GAGtB,GAA6B,OAA1BrJ,EAAE,oBACD,OAAO,CAIXlB,MAAKkM,eAAiB3B,EACtBvK,KAAKmM,oBAAqB,CAG1B,IAAIM,IACAC,UAAW,mBACXC,6BAA8B,uBAC9BC,YAAa5M,KAAK8L,eAClBlJ,wBAAyB,SAASiK,GAGG,kBAAtBtC,GAAQjG,UACfiG,EAAQjG,UAAUuI,IAGlBC,QAAQC,aAAa,yBAGrB7L,EAAE,wBAAwB+J,gBAAgB,YAG1C/J,EAAE,mBAAmB8L,SAGrBjE,OAAOkE,QAAUA,OAAOC,SAIhCC,cAAe,WACXrI,MAAM,4JAEVnC,QAAS,SAAS5B,GACdf,KAAKmM,mBAAqBpL,EACK,kBAApBwJ,GAAQ5H,SACf4H,EAAQ5H,QAAQ5B,IAEtBS,KAAKxB,MAIRA,MAAKgM,SACJS,EAAmBT,OAAShM,KAAKgM,QAIf,GAAlBhM,KAAK+L,WAELU,EAAmBV,WAAY,EAC/BU,EAAmB1G,OAAS/F,KAAK+F,OACjC0G,EAAmBH,SAAWtM,KAAKsM,UAEJ,GAAxBtM,KAAKiM,gBAEZQ,EAAmBV,WAAY,EAI/BU,EAAmBV,WAAY,EAKnCpL,UAAUsC,MAAMjD,KAAKR,YAAa,SAAUiN,IAShDW,kBAAmB,SAASpJ,KAYhC,IAAIqJ,kBAAmBlO,MAAMC,QAC7BiO,kBAAiBhO,WAabC,WAAY,SAAS6I,EAAOwB,EAAa2D,EAAcC,EAAmBC,EAAWC,EAAQ9K,GAGzF,MAAI0K,kBAAiBhO,UAAUqO,QAC3BC,QAAQ9I,MAAM,4FACP,IAEXwI,iBAAiBhO,UAAUqO,QAAS,EAEpC1N,KAAKmI,MAAQA,IAAS,EACtBnI,KAAK2J,YAAcA,IAAe,EAG/B3J,KAAKmI,SAAU,GAASnI,KAAK2J,eAAgB,GAC5CgE,QAAQC,KAAK,yDACN,IAGX5N,KAAKsN,aAAeA,IAAgB,EACpCtN,KAAKuN,kBAAoBA,IAAqB,EAE9CvN,KAAKwN,UAAYA,IAAa,EAE9BxN,KAAKyN,OAASA,MAEdzN,KAAK6N,sBAAuB,EAG5B7N,KAAK8N,mBAAoB,EAGzB7E,SAASf,QAAQ,aAAc,WAG3BlI,KAAK+N,wBACL/N,KAAKgO,sCAEPxM,KAAKxB,OAGPA,KAAKiO,uBAAwB,EAG7BjO,KAAKmI,MAAM2B,oBAAoB,WAG3B9J,KAAKmI,MAAM+F,gCAAiC,EAG5ClO,KAAKmI,MAAM4B,qBAAqB,WAC5B/J,KAAKmO,8BACP3M,KAAKxB,QAETwB,KAAKxB,OAGHA,KAAKwN,YACLxN,KAAKmI,MAAMH,kBACXhI,KAAKwI,sBAELS,SAASf,QAAQ,aAAc,WAC3BlI,KAAKoO,kBACLpO,KAAKqO,oBAEgC,OAAjCnN,EAAE,4BACFlB,KAAKc,oBAEXU,KAAKxB,YAGXiJ,UAASf,QAAQ,aAAc,WAE3BlI,KAAKsO,oBACP9M,KAAKxB,UAOXsO,iBAAkB,WAGdtN,GAAG,8FAA8FgG,KAAK,SAAUM,GAG5G,GAAIiH,GAAgB,GAChBC,EAAgB,EAC6B5K,UAA7C0D,EAAQV,GAAG,+BACX2H,EAAgB,6BAChBC,EAAgB,qBACgC5K,SAAzC0D,EAAQV,GAAG,4BAClB2H,EAAgB,yBAChBC,EAAgB,gBAIpBtN,EAAEoG,GAASmH,cAAc,UAAUvG,QAAQ,SAAU,SAAUhF,GAC3D,MAAOlD,MAAK0O,oBAAoBH,EAAeC,IACjDhN,KAAKxB,QAETwB,KAAKxB,QAUX0O,oBAAqB,SAASH,EAAeC,GAGwB5K,SAA7D5C,GAAGuN,EAAgB,8BAA8B5I,SAA2F,SAAlE3E,GAAGuN,EAAgB,8BAA8B5I,QAAQP,MAEjGxB,SAA9B5C,GAAGwN,GAAe7I,UAGlB3E,GAAGwN,GAAe7I,QAAQgJ,OAG1B3N,GAAGwN,EAAgB,WAAaA,EAAgB,WAAWxH,KAAK,SAAU4H,GACtEA,EAAY3D,gBAAgB,eAKgCrH,SAA7D5C,GAAGuN,EAAgB,8BAA8B5I,SAEtB/B,SAA9B5C,GAAGwN,GAAe7I,UAGlB3E,GAAGwN,GAAe7I,QAAQkJ,OAG1B7N,GAAGwN,EAAgB,WAAaA,EAAgB,WAAWxH,KAAK,SAAU4H,GACtEA,EAAYvJ,aAAa,WAAY,gBAWrDyJ,gBAAiB,WACb,GAAIP,GAAgB,GAChBC,EAAgB,EAEW,8BAA3BxO,KAAK+O,oBACLR,EAAgB,6BAChBC,EAAgB,qBACkB,yBAA3BxO,KAAK+O,qBACZR,EAAgB,yBAChBC,EAAgB,gBAIc5K,SAA9B5C,GAAGuN,GAAe5I,SAClB3F,KAAK0O,oBAAoBH,EAAeC,IAOhD1N,iBAAkB,WAGVd,KAAKmI,MAAMzI,cAG0B,OAAjCwB,EAAE,6BAG8C0C,SAA5C1C,EAAE,2BAA2B0F,GAAG,SAGhC5G,KAAK8N,mBAAoB,EAGzB9N,KAAK4B,KAAOV,EAAE,2BAA2B0F,GAAG,QAG5C5G,KAAKmI,MAAMrH,iBAAiBd,OAG5B2N,QAAQ9I,MAAM,oFAY9BS,+BAAgC,SAASvB,GAIrC,MAHA/D,MAAK4E,eACL5E,KAAKmI,MAAMlI,6BAA8B,EACzCD,KAAKiO,uBAAwB,EACzBjO,KAAKwN,UACExN,KAAKgP,iBAELhP,KAAKiP,iBAUpBxJ,uBAAwB,SAASF,GAG7B,MAFAvF,MAAKmI,MAAMlI,6BAA8B,EACzCD,KAAKiO,uBAAwB,GACtB,GAMXI,kBAAmB,WACXrO,KAAKkP,uBAAsB,KAC3BlP,KAAKgF,aACLhF,KAAKmI,MAAMlD,WAAW,WAClBjF,KAAK4E,eACL5E,KAAKmP,mBAAmB,QAC1B3N,KAAKxB,SAOfwI,oBAAqB,WACjBxI,KAAKmI,MAAMK,oBAAoB,WAC3BxI,KAAKmI,MAAMlD,WAAW,WAGdjF,KAAKwN,YACLxN,KAAKoO,kBACLpO,KAAKoP,sBACLpP,KAAK8O,kBAGD9O,KAAKmI,MAAMzI,cACXM,KAAKc,oBAKbd,KAAKsO,oBAEP9M,KAAKxB,QACTwB,KAAKxB,MAA0C,mBAA3BA,MAAKyN,OAAO4B,WAA6BrP,KAAKyN,OAAO4B,YAAa,IAM5FD,oBAAqB,WAGY,MAAzBlO,EAAE,qBACFlB,KAAKmP,sBAQbf,gBAAiB,WAGkDxK,SAA3D5C,GAAG,4CAA4C2E,SAC/CzE,EAAE,yBAAyBoO,GAAG,SAAU,oBAAqB,SAASpM,GAGlElD,KAAKmP,oBAAmB,EAAO,0BAEjC3N,KAAKxB,QAaf+N,sBAAuB,WACnB,OAAO,GASXwB,aAAc,SAASvL,GACnB,MAAOhE,MAAKwP,cAAcxL,IAS9BwL,cAAe,SAASxL,GAEpB,GAAGhE,KAAKiO,yBAA0B,GAASjO,KAAKmI,MAAMzI,eAAwFkE,SAAvE5C,GAAG,wDAAwD2E,SAAiG/B,SAAvE5C,GAAG,wDAAwD2E,SAAqG,SAA5E3E,GAAG,wDAAwD2E,QAAQP,OAAoB,CAEnU,GAAIqK,GAASvO,EAAE,2BAA2BwO,KAAK,SAC/CD,GAAOxE,gBAAgB,YACvBwE,EAAOE,YAEP3L,MASR4L,YAAa,WACT,OAAO,GAWXC,OAAQ,SAAS1M,EAAM2M,EAAiBC,EAAgBC,GAGhDhQ,KAAKiQ,sBAAsB9M,KAGvBnD,KAAKkQ,eAGLlQ,KAAKgF,aAGLhF,KAAKuP,aAAa,WAG0C3L,QAApD5C,GAAG,sCAAsC2E,SACzC3F,KAAKmI,MAAMtE,eAAe7C,GAAG,sCAAsC2E,QAAQP,OAI/EpF,KAAKmI,MAAMlD,WACP,WAGIjF,KAAKmQ,gBAGLnQ,KAAKmI,MAAMsD,SACPnH,UAAW,WAiBP,GAdAtE,KAAKoQ,mBACLpQ,KAAKqQ,wBAGLrQ,KAAK4E,eACL5E,KAAK4P,cAGL5P,KAAKsQ,qBAELtQ,KAAKmI,MAAMlI,6BAA8B,EACzCD,KAAKiO,uBAAwB,EAGE,kBAApB6B,GACP,GAAIrL,GAAWqL,GAOnB,OAHA9P,MAAKgF,aAELhF,KAAKuQ,uBACE9L,GAETjD,KAAKxB,MACP+E,UAAW,WAOP,MALA/E,MAAKmI,MAAMlI,6BAA8B,EACzCD,KAAKiO,uBAAwB,EAE7BjO,KAAK4E,eACL5E,KAAK4P,cACyB,kBAAnBG,GACAA,IADX,QAGFvO,KAAKxB,SAEbwB,KAAKxB,MACPA,KAAKwQ,wBAGXhP,KAAKxB,SAIPA,KAAKmI,MAAMlI,6BAA8B,EACzCD,KAAKiO,uBAAwB,EAE7BjO,KAAK4E,eACiC,kBAA3BoL,IACPA,OAShBhB,eAAgB,WAEZjG,OAAOkE,QAAUA,OAAOC,QAM5B+B,cAAe,WACXnC,QAAQI,MAAQJ,QAAQI,QAM5BoD,mBAAoB,WAEe,6BAA3BtQ,KAAK+O,oBACiC,OAAlC7N,EAAE,6BACFA,EAAE,4BAA4B+J,gBAAgB,YAEhB,OAA9B/J,EAAE,yBACFA,EAAE,wBAAwBmE,aAAa,WAAY,aAErB,yBAA3BrF,KAAK+O,qBAC0B,OAAlC7N,EAAE,6BACFA,EAAE,4BAA4BmE,aAAa,WAAY,YAEzB,OAA9BnE,EAAE,yBACFA,EAAE,wBAAwB+J,gBAAgB,cAWtD+C,mCAAoC,WAChC,MAAOhO,MAAKyQ,8BAMhBA,2BAA4B,WAGxB,GAAIC,GAAmB1Q,KAGnB2Q,EAAwBC,QAAQvR,UAAU0N,YAG9C6D,SAAQvR,UAAU0N,aAAe,SAAU1I,GAMvC,MAHAqM,GAAiBG,oBAAoBxM,GAG9BsM,EAAsBG,MAAM9Q,KAAM+Q,aASjDF,oBAAqB,SAASxM,GAG1BlD,aAAanB,KAAK6N,sBAClB7N,KAAK6N,qBAAuBzM,WAAW,WAG/BpB,KAAKkP,sBAAsB7K,GAC3BrE,KAAKmP,mBAAmB,MAAO9K,GAE/BrE,KAAKmP,mBAAmB,SAAU9K,GAIa,8BAA9CA,EAASA,EAASrE,KAAK+O,qBACxB/O,KAAKc,mBAITd,KAAK8O,mBAEPtN,KAAKxB,MAAO,KASlBgR,eAAgB,SAASnE,GAkBrB,MAfA7M,MAAKsQ,qBAGLtQ,KAAKoQ,mBAEDvD,EAAI9I,OAAuC,OAA9B7C,EAAE,yBACfA,EAAE,wBAAwBkE,MAAQyH,EAAI9I,MACtC7C,EAAE,wBAAwBmE,aAAa,QAASwH,EAAI9I,QAEpD4J,QAAQC,KAAK,4GAIjB5N,KAAKiR,uBAEE,GAQXA,oBAAqB,WAEjB,MADAjR,MAAK4E,eACE5E,KAAKgP,kBAMhBG,mBAAoB,SAAS+B,EAAQ7M,GAEjC,GAAGrE,KAAKsN,gBAAiB,EACrB,OAAO,CAGX,IAAc,WAAV4D,EAGA,MAFAlR,MAAKmP,mBAAmB,UACxBnP,KAAKmP,mBAAmB,QACjB,CAIX,IAAKnP,KAAKkP,sBAAsB7K,IAAqB,UAAV6M,GAAiC,OAAVA,EAG9D,GAA2CtN,SAAvC5C,GAAGhB,KAAKuN,mBAAmB5H,QAAuB,CAGlD,GAAuC/B,SAAnC5C,GAAG,oBAAoB2E,SAAyB3E,GAAG,oBAAoB2E,QAAQwL,UAC/E,OAAO,CAGXnQ,IAAGhB,KAAKuN,mBAAmB5H,QAAQkJ,OAGnC7N,GAAGhB,KAAKuN,mBAAmB5H,QAAQyL,QAAQC,MAAOrR,KAAKsN,cAEvD,IAAIgE,IACAhN,UAAWtE,KAAKgR,eAAexP,KAAKxB,MACpC2C,QAAS3C,KAAKuR,cAAc/P,KAAKxB,MAIrCA,MAAK2J,YAAY6C,gBAAgB8E,OAGjC3D,SAAQC,KAAK,oCAAuC5N,KAAKuN,kBAAoB,wCAOtC3J,UAAvC5C,GAAGhB,KAAKuN,mBAAmB5H,SAC3B3E,GAAGhB,KAAKuN,mBAAmB5H,QAAQgJ,OAIA/K,SAAnC5C,GAAG,oBAAoB2E,SACvBzE,EAAE,mBAAmB8L,UAWjCuE,cAAe,SAASxQ,GAEe,MAAhCG,EAAE,4BAGDA,EAAE,2BAA2BuN,cAAc,SAASa,GAAG,QAAS,SAAUpM,GAGtE,MAAKlD,MAAKkQ,cAAV,QAGIsB,MAAMC,KAAKvO,IACJ,IAGb1B,KAAKxB,QASfgF,WAAY,WACRqF,SAASC,eAAe,YAM5B1F,aAAc,WACVyF,SAASC,gBAAe,IAM5B8F,iBAAkB,WACW,OAArBlP,EAAE,gBACFA,EAAE,eAAe+J,gBAAgB,aAOzCoF,sBAAuB,WACnBrP,GAAG,qDAAqDgG,KAAK,SAAS4H,GAC5C,4BAAlBA,EAAYjN,IAAsD,4CAAlBiN,EAAYjN,IAC5DiN,EAAYvJ,aAAa,WAAY,eAQjDkL,qBAAsB,WAClBvP,GAAG,qDAAqDgG,KAAK,SAAU4H,GACnEA,EAAY3D,gBAAgB,eASpCkF,cAAe,YAG0B,OAAhCjP,EAAE,2BAA2E,IAArCA,EAAE,0BAA0BkE,OAAgD,OAAhClE,EAAE,6BAGxD,OAA3BA,EAAE,sBAA2D,OAA1BA,EAAE,qBACrClB,KAAKmI,MAAMlC,eAAe/E,EAAE,qBAAqBkE,MAAQ,IAAMlE,EAAE,oBAAoBkE,OAE3D,OAA1BlE,EAAE,qBACFlB,KAAKmI,MAAM/B,mBAAmBlF,EAAE,oBAAoBkE,SAUhEoL,oBAAqB,WACjB,GAAIvM,KAOJ,OAJoC,QAAhC/C,EAAE,2BAA2E,IAArCA,EAAE,0BAA0BkE,QACpEnB,EAAWyN,UAAYxQ,EAAE,0BAA0BkE,OAGhDnB,GAQX8K,iBAAkB,WACd,MAAOjC,SAAQ6E,eASnB1B,sBAAuB,SAAS9M,GAC5B,OAAOA,GACH,IAAK,aACD,MAAmC,6BAA3BnD,KAAK+O,oBAAqD/O,KAAKmI,MAAMoD,2BAC7E,MACJ,KAAK,SACD,MAAmC,yBAA3BvL,KAAK+O,oBAAiD/O,KAAKmI,MAAMoD,4BAGjF,OAAO,GAOX2D,sBAAuB,SAAS7K,GAC5B,MAAwD,0BAA9CA,EAASA,EAASrE,KAAK+O,qBAAiF,OAA/B7N,EAAE,0BAAsF,0BAA9CmD,EAASA,EAASrE,KAAK+O,qBAAsHnL,SAAnE5C,GAAG,oDAAoD2E,SAAiG,SAAxE3E,GAAG,oDAAoD2E,QAAQP,OAM1V+I,2BAA4B,WACxBnO,KAAK4E,gBAQTsL,YAAa,WACT,OAAO,IAMd,WAYG,IAXA,GAAI7L,GACAuN,EAAO,aACPC,GACA,SAAU,QAAS,QAAS,QAAS,MAAO,SAAU,QACtD,YAAa,QAAS,iBAAkB,WAAY,OAAQ,MAC5D,eAAgB,UAAW,aAAc,QAAS,OAAQ,UAC1D,YAAa,QAAS,QAEtB5Q,EAAS4Q,EAAQ5Q,OACjB0M,EAAW5E,OAAO4E,QAAU5E,OAAO4E,YAEhC1M,KACHoD,EAASwN,EAAQ5Q,GAGZ0M,EAAQtJ,KACTsJ,EAAQtJ,GAAUuN","file":"vzero-0.7-min.js"}
 
js/gene/braintree/vzero-0.7.js DELETED
@@ -1,2293 +0,0 @@
1
- /**
2
- * Magento Braintree class to bridge the v.zero JS SDK and Magento
3
- *
4
- * @class vZero
5
- * @author Dave Macaulay <dave@gene.co.uk>
6
- */
7
- var vZero = Class.create();
8
- vZero.prototype = {
9
-
10
- /**
11
- * Initialize all our required variables that we'll need later on
12
- *
13
- * @param code The payment methods code
14
- * @param clientToken The client token provided by the server
15
- * @param threeDSecure Flag to determine whether 3D secure is active, this is verified server side
16
- * @param hostedFields Flag to determine whether we're using hosted fields
17
- * @param billingName Billing name used in verification of the card
18
- * @param billingPostcode Billing postcode also needed to verify the card
19
- * @param quoteUrl The URL to update the quote totals
20
- * @param tokenizeUrl The URL to re-tokenize 3D secure cards
21
- * @param vaultToNonceUrl The end point to vault a nonce then return a new nonce
22
- */
23
- initialize: function (code, clientToken, threeDSecure, hostedFields, billingName, billingPostcode, quoteUrl, tokenizeUrl, vaultToNonceUrl) {
24
- this.code = code;
25
- this.clientToken = clientToken;
26
- this.threeDSecure = threeDSecure;
27
- this.hostedFields = hostedFields;
28
-
29
- if (billingName) {
30
- this.billingName = billingName;
31
- }
32
- if (billingPostcode) {
33
- this.billingPostcode = billingPostcode;
34
- }
35
- if (quoteUrl) {
36
- this.quoteUrl = quoteUrl;
37
- }
38
- if (tokenizeUrl) {
39
- this.tokenizeUrl = tokenizeUrl;
40
- }
41
- if (vaultToNonceUrl) {
42
- this.vaultToNonceUrl = vaultToNonceUrl;
43
- }
44
-
45
- this._hostedFieldsTokenGenerated = false;
46
-
47
- this.acceptedCards = false;
48
-
49
- this.closeMethod = false;
50
-
51
- // Store whether hosted fields is running or not
52
- this._hostedFieldsTimeout = false;
53
-
54
- // Store the Ajax request for the updateData
55
- this._updateDataXhr = false;
56
- this._updateDataCallbacks = [];
57
- this._updateDataParams = {};
58
-
59
- this._vaultToNonceXhr = false;
60
- },
61
-
62
- /**
63
- * Init the vZero integration by starting a new version of the client
64
- * If 3D secure is enabled we also listen out for window messages
65
- */
66
- init: function () {
67
- this.client = new braintree.api.Client({clientToken: this.clientToken});
68
- },
69
-
70
- /**
71
- * Init the hosted fields system
72
- *
73
- * @param integration
74
- */
75
- initHostedFields: function (integration) {
76
-
77
- // If the hosted field number element exists hosted fields is on the page and working!
78
- if ($$('iframe[name^="braintree-"]').length > 0) {
79
- return false;
80
- }
81
-
82
- // If it's already running there's no need to start another instance
83
- // Also block the function if braintree-hosted-submit isn't yet on the page
84
- if ($('braintree-hosted-submit') === null) {
85
- return false;
86
- }
87
-
88
- // Pass the integration through to hosted fields
89
- this.integration = integration;
90
-
91
- this._hostedFieldsTokenGenerated = false;
92
-
93
- // Utilise a 50ms timeout to ensure the last call of HF is ran
94
- clearTimeout(this._hostedFieldsTimeout);
95
- this._hostedFieldsTimeout = setTimeout(function () {
96
-
97
- if (this._hostedIntegration !== false) {
98
- try {
99
- this._hostedIntegration.teardown(function () {
100
- this._hostedIntegration = false;
101
- // Setup the hosted fields client
102
- this.setupHostedFieldsClient();
103
- }.bind(this));
104
- } catch (e) {
105
- this.setupHostedFieldsClient();
106
- }
107
- } else {
108
- // Setup the hosted fields client
109
- this.setupHostedFieldsClient();
110
- }
111
-
112
- }.bind(this), 50);
113
- },
114
-
115
- /**
116
- * Tear down hosted fields
117
- *
118
- * @param callbackFn
119
- */
120
- teardownHostedFields: function (callbackFn) {
121
- if (typeof this._hostedIntegration !== 'undefined' && this._hostedIntegration !== false) {
122
- this._hostedIntegration.teardown(function () {
123
- this._hostedIntegration = false;
124
-
125
- if (typeof callbackFn === 'function') {
126
- callbackFn();
127
- }
128
- }.bind(this));
129
- } else {
130
- if (typeof callbackFn === 'function') {
131
- callbackFn();
132
- }
133
- }
134
- },
135
-
136
- /**
137
- * Setup the hosted fields client utilising the Braintree JS SDK
138
- */
139
- setupHostedFieldsClient: function () {
140
-
141
- // If there are iframes within the fields already, don't run again!
142
- // This function has a delay from the original call so we need to verify everything is still good to go!
143
- if ($$('iframe[name^="braintree-"]').length > 0) {
144
- return false;
145
- }
146
-
147
- this._hostedIntegration = false;
148
-
149
- var hostedFieldsConfiguration = {
150
- id: this.integration.form,
151
- hostedFields: {
152
- styles: this.getHostedFieldsStyles(),
153
- number: {
154
- selector: "#card-number",
155
- placeholder: "0000 0000 0000 0000"
156
- },
157
- expirationMonth: {
158
- selector: "#expiration-month",
159
- placeholder: "MM"
160
- },
161
- expirationYear: {
162
- selector: "#expiration-year",
163
- placeholder: "YY"
164
- },
165
- onFieldEvent: this.hostedFieldsOnFieldEvent.bind(this)
166
- },
167
- onReady: this.hostedFieldsOnReady.bind(this),
168
- onPaymentMethodReceived: this.hostedFieldsPaymentMethodReceived.bind(this),
169
- onError: this.hostedFieldsError.bind(this)
170
- };
171
-
172
- // Include the CVV field with the request
173
- if ($('cvv') !== null) {
174
- hostedFieldsConfiguration.hostedFields.cvv = {
175
- selector: "#cvv"
176
- };
177
- }
178
-
179
- braintree.setup(this.clientToken, "custom", hostedFieldsConfiguration);
180
- },
181
-
182
- /**
183
- * Return the hosted field styles
184
- * See: https://developers.braintreepayments.com/guides/hosted-fields/styling/javascript/v2
185
- *
186
- * @returns {*}
187
- */
188
- getHostedFieldsStyles: function () {
189
-
190
- // Does the integration provide it's own styling options for hosted fields?
191
- if (typeof this.integration.getHostedFieldsStyles === 'function') {
192
- return this.integration.getHostedFieldsStyles();
193
- }
194
-
195
- // Return some default styles if all else fails
196
- return {
197
- // Style all elements
198
- "input": {
199
- "font-size": "14pt",
200
- "color": "#3A3A3A"
201
- },
202
-
203
- // Styling element state
204
- ":focus": {
205
- "color": "black"
206
- },
207
- ".valid": {
208
- "color": "green"
209
- },
210
- ".invalid": {
211
- "color": "red"
212
- }
213
- };
214
- },
215
-
216
- /**
217
- * Update the card type on field event
218
- *
219
- * @param event
220
- */
221
- hostedFieldsOnFieldEvent: function (event) {
222
- if (event.type === "fieldStateChange") {
223
- if (event.card) {
224
- var cardMapping = {
225
- 'visa': 'VI',
226
- 'american-express': 'AE',
227
- 'master-card': 'MC',
228
- 'discover': 'DI',
229
- 'jcb': 'JCB',
230
- 'maestro': 'ME'
231
- };
232
- if (typeof cardMapping[event.card.type] !== undefined) {
233
- this.updateCardType(false, cardMapping[event.card.type]);
234
- } else {
235
- this.updateCardType(false, 'card');
236
- }
237
- }
238
- }
239
- },
240
-
241
- /**
242
- * Vault the nonce with the associated billing data
243
- *
244
- * @param nonce
245
- * @param callback
246
- */
247
- vaultToNonce: function (nonce, callback) {
248
-
249
- // Craft the parameters
250
- var parameters = this.getBillingAddress();
251
- parameters['nonce'] = nonce;
252
-
253
- // Start an Ajax request to retrieve a nonce from the vault
254
- new Ajax.Request(
255
- this.vaultToNonceUrl,
256
- {
257
- method: 'post',
258
- parameters: parameters,
259
- onSuccess: function (transport) {
260
- // Verify we have some response text
261
- if (transport && (transport.responseJSON || transport.responseText)) {
262
-
263
- // Parse as an object
264
- var response = this._parseTransportAsJson(transport);
265
-
266
- if (response.success && response.nonce) {
267
- callback(response.nonce);
268
- } else {
269
-
270
- // Hide the loading state
271
- if (typeof this.integration.resetLoading === 'function') {
272
- this.integration.resetLoading();
273
- }
274
-
275
- if (response.error) {
276
- alert(response.error);
277
- } else {
278
- alert('Something wen\'t wrong and we\'re currently unable to take your payment.');
279
- }
280
- }
281
- }
282
- }.bind(this),
283
- onFailure: function () {
284
-
285
- // Hide the loading state
286
- if (typeof this.integration.resetLoading === 'function') {
287
- this.integration.resetLoading();
288
- }
289
-
290
- alert('Something wen\'t wrong and we\'re currently unable to take your payment.');
291
-
292
- }.bind(this)
293
- }
294
- );
295
- },
296
-
297
- /**
298
- * Called when Hosted Fields integration is ready
299
- *
300
- * @param integration
301
- */
302
- hostedFieldsOnReady: function (integration) {
303
- this._hostedIntegration = integration;
304
-
305
- // Unset the loading state if it's present
306
- if ($$('#credit-card-form.loading').length) {
307
- $$('#credit-card-form.loading').first().removeClassName('loading');
308
- }
309
-
310
- // Will this checkout submit the payment after the "payment" step. This is typically used in non one step checkouts
311
- // which contains a review step.
312
- if (this.integration.submitAfterPayment) {
313
- var input = new Element('input', {type: 'hidden', name: 'payment[submit_after_payment]', value: 1, id: 'braintree-submit-after-payment'});
314
- $('payment_form_gene_braintree_creditcard').insert(input);
315
- } else {
316
- if ($('braintree-submit-after-payment')) {
317
- $('braintree-submit-after-payment').remove();
318
- }
319
- }
320
- },
321
-
322
- /**
323
- * Action to call after receiving the payment method
324
- *
325
- * @param response
326
- */
327
- hostedFieldsPaymentMethodReceived: function (response) {
328
-
329
- // Check if validation failed or not?
330
- if (this.threeDSecure) {
331
-
332
- // Show the loading state
333
- if (typeof this.integration.setLoading === 'function') {
334
- this.integration.setLoading();
335
- }
336
-
337
- // Update the quote totals first
338
- this.updateData(function () {
339
- this.vaultToNonce(response.nonce, function (nonce) {
340
-
341
- // Hide the loading state
342
- if (typeof this.integration.resetLoading === 'function') {
343
- this.integration.resetLoading();
344
- }
345
-
346
- // Verify the nonce through 3Ds
347
- this.verify3dSecureNonce(nonce, {
348
- onSuccess: function (response) {
349
- this.hostedFieldsNonceReceived(response.nonce);
350
- }.bind(this),
351
- onFailure: function (response, error) {
352
- alert(error);
353
- }.bind(this)
354
- });
355
-
356
- }.bind(this));
357
- }.bind(this));
358
-
359
- } else {
360
- this.hostedFieldsNonceReceived(response.nonce);
361
- }
362
-
363
- },
364
-
365
- /**
366
- * Once the nonce has been received update the field
367
- *
368
- * @param nonce
369
- */
370
- hostedFieldsNonceReceived: function (nonce) {
371
-
372
- $('creditcard-payment-nonce').value = nonce;
373
- $('creditcard-payment-nonce').setAttribute('value', nonce);
374
-
375
- if (typeof this.integration.resetLoading === 'function') {
376
- this.integration.resetLoading();
377
- }
378
-
379
- this._hostedFieldsTokenGenerated = true;
380
-
381
- // Is there a success function we're wanting to run?
382
- if (typeof this.integration.afterHostedFieldsNonceReceived === 'function') {
383
- this.integration.afterHostedFieldsNonceReceived(nonce);
384
- }
385
- },
386
-
387
- /**
388
- * Handle hosted fields throwing an error
389
- *
390
- * @param response
391
- * @returns {boolean}
392
- */
393
- hostedFieldsError: function (response) {
394
-
395
- if (typeof this.integration.resetLoading === 'function') {
396
- this.integration.resetLoading();
397
- }
398
-
399
- // Stop any "Cannot place two elements in #xxx" messages being shown to the user
400
- // These are non critical errors and the functionality will still work as expected
401
- if (
402
- typeof response.message !== 'undefined' &&
403
- response.message.indexOf('Cannot place two elements in') == -1 &&
404
- response.message.indexOf('Unable to find element with selector') == -1 &&
405
- response.message.indexOf('User did not enter a payment method') == -1
406
- ) {
407
- // Let the user know what went wrong
408
- alert(response.message);
409
- }
410
-
411
- this._hostedFieldsTokenGenerated = false;
412
-
413
- if (typeof this.integration.afterHostedFieldsError === 'function') {
414
- this.integration.afterHostedFieldsError(response.message);
415
- }
416
-
417
- return false;
418
-
419
- },
420
-
421
- /**
422
- * Is the customer attempting to use a saved card?
423
- *
424
- * @returns {boolean}
425
- */
426
- usingSavedCard: function () {
427
- return ($('creditcard-saved-accounts') != undefined
428
- && $$('#creditcard-saved-accounts input:checked[type=radio]').first() != undefined
429
- && $$('#creditcard-saved-accounts input:checked[type=radio]').first().value !== 'other');
430
- },
431
-
432
-
433
- /**
434
- * Set the 3Ds flag
435
- *
436
- * @param flag a boolean value
437
- */
438
- setThreeDSecure: function (flag) {
439
- this.threeDSecure = flag;
440
- },
441
-
442
- /**
443
- * Set the amount within the checkout, this is only used in the default integration
444
- * For any other checkouts see the updateData method, this is used by 3D secure
445
- *
446
- * @param amount The grand total of the order
447
- */
448
- setAmount: function (amount) {
449
- this.amount = parseFloat(amount);
450
- },
451
-
452
- /**
453
- * We sometimes need to set the billing name later on in the process
454
- *
455
- * @param billingName
456
- */
457
- setBillingName: function (billingName) {
458
- this.billingName = billingName;
459
- },
460
-
461
- /**
462
- * Return the billing name
463
- *
464
- * @returns {*}
465
- */
466
- getBillingName: function () {
467
-
468
- // If billingName is an object we're wanting to grab the data from elements
469
- if (typeof this.billingName == 'object') {
470
-
471
- // Combine them with a space
472
- return this.combineElementsValues(this.billingName);
473
-
474
- } else {
475
-
476
- // Otherwise we can presume that the billing name is a string
477
- return this.billingName;
478
- }
479
- },
480
-
481
- /**
482
- * Same for billing postcode
483
- *
484
- * @param billingPostcode
485
- */
486
- setBillingPostcode: function (billingPostcode) {
487
- this.billingPostcode = billingPostcode;
488
- },
489
-
490
- /**
491
- * Return the billing name
492
- *
493
- * @returns {*}
494
- */
495
- getBillingPostcode: function () {
496
-
497
- // If billingName is an object we're wanting to grab the data from elements
498
- if (typeof this.billingPostcode == 'object') {
499
-
500
- // Combine them with a space
501
- return this.combineElementsValues(this.billingPostcode);
502
-
503
- } else {
504
-
505
- // Otherwise we can presume that the billing name is a string
506
- return this.billingPostcode;
507
- }
508
- },
509
-
510
- /**
511
- * Push through the selected accepted cards from the admin
512
- *
513
- * @param cards an array of accepted cards
514
- */
515
- setAcceptedCards: function (cards) {
516
- this.acceptedCards = cards;
517
- },
518
-
519
- /**
520
- * Return the full billing address, if we cannot just serialize the billing address serialize everything
521
- *
522
- * @returns {array}
523
- */
524
- getBillingAddress: function () {
525
-
526
- // Is there a function in the integration for this action?
527
- if (typeof this.integration.getBillingAddress === 'function') {
528
- return this.integration.getBillingAddress();
529
- }
530
-
531
- var billingAddress = {};
532
-
533
- // If not try something generic
534
- if ($('co-billing-form') !== null) {
535
- if ($('co-billing-form').tagName == 'FORM') {
536
- billingAddress = $('co-billing-form').serialize(true);
537
- } else {
538
- billingAddress = this.extractBilling($('co-billing-form').up('form').serialize(true));
539
- }
540
- } else if ($('billing:firstname') !== null) {
541
- billingAddress = this.extractBilling($('billing:firstname').up('form').serialize(true));
542
- }
543
-
544
- if (billingAddress) {
545
- return billingAddress;
546
- }
547
- },
548
-
549
- /**
550
- * Extract only the serialized values that start with "billing"
551
- *
552
- * @param formData
553
- * @returns {{}}
554
- */
555
- extractBilling: function (formData) {
556
- var billing = {};
557
- $H(formData).each(function (data) {
558
- // Only include billing details, excluding passwords
559
- if (data.key.indexOf('billing') == 0 && data.key.indexOf('password') == -1) {
560
- billing[data.key] = data.value;
561
- }
562
- });
563
- return billing;
564
- },
565
-
566
- /**
567
- * Return the accepted cards
568
- *
569
- * @returns {boolean|*}
570
- */
571
- getAcceptedCards: function () {
572
- return this.acceptedCards;
573
- },
574
-
575
-
576
- /**
577
- * Combine elements values into a string
578
- *
579
- * @param elements
580
- * @param seperator
581
- * @returns {string}
582
- */
583
- combineElementsValues: function (elements, seperator) {
584
-
585
- // If no seperator is set use a space
586
- if (!seperator) {
587
- seperator = ' ';
588
- }
589
-
590
- // Loop through the elements and build up an array
591
- var response = [];
592
- elements.each(function (element, index) {
593
- if ($(element) !== undefined) {
594
- response[index] = $(element).value;
595
- }
596
- });
597
-
598
- // Join with a space
599
- return response.join(seperator);
600
-
601
- },
602
-
603
- /**
604
- * Update the card type from a card number
605
- *
606
- * @param cardNumber The card number that the user has entered
607
- * @param cardType The card type, if already known
608
- */
609
- updateCardType: function (cardNumber, cardType) {
610
-
611
- if (!cardType) {
612
- // Retrieve the card type
613
- cardType = this.getCardType(cardNumber);
614
- }
615
-
616
- if ($('gene_braintree_creditcard_cc_type') != undefined) {
617
- if (cardType == 'card') {
618
- // If we cannot detect which kind of card they're using remove the value from the select
619
- $('gene_braintree_creditcard_cc_type').value = '';
620
- } else {
621
- // Update the validation field
622
- $('gene_braintree_creditcard_cc_type').value = cardType;
623
- }
624
- }
625
-
626
- // Check the image exists on the page
627
- if ($('card-type-image') != undefined) {
628
-
629
- // Grab the skin image URL without the last part
630
- var skinImageUrl = $('card-type-image').src.substring(0, $('card-type-image').src.lastIndexOf("/"));
631
-
632
- // Rebuild the URL with the card type included, all card types are stored as PNG's
633
- $('card-type-image').setAttribute('src', skinImageUrl + "/" + cardType + ".png");
634
-
635
- }
636
-
637
- },
638
-
639
- /**
640
- * Create a new event upon the card number field
641
- */
642
- observeCardType: function () {
643
-
644
- if ($$('[data-genebraintree-name="number"]').first() !== undefined) {
645
-
646
- // Observe any blurring on the form
647
- Element.observe($$('[data-genebraintree-name="number"]').first(), 'keyup', function () {
648
-
649
- // Update the card type
650
- vzero.updateCardType(this.value);
651
- });
652
-
653
- // Add a space every 4 characters
654
- $$('[data-genebraintree-name="number"]').first().oninput = function () {
655
- // Add a space every 4 characters
656
- var number = this.value.split(" ").join("");
657
- if (number.length > 0) {
658
- number = number.match(new RegExp('.{1,4}', 'g')).join(" ");
659
- }
660
- this.value = number;
661
- };
662
-
663
- }
664
-
665
- },
666
-
667
- /**
668
- * Observe all Ajax requests, this is needed on certain checkouts
669
- * where we're unable to easily inject into methods
670
- *
671
- * @param callback A defined callback function if needed
672
- * @param ignore An array of indexOf paths to ignore
673
- */
674
- observeAjaxRequests: function (callback, ignore) {
675
-
676
- // Only allow one initialization of this function
677
- if (vZero.prototype.observingAjaxRequests) {
678
- return false;
679
- }
680
- vZero.prototype.observingAjaxRequests = true;
681
-
682
- // For every ajax request on complete update various Braintree things
683
- Ajax.Responders.register({
684
- onComplete: function (transport) {
685
- return this.handleAjaxRequest(transport.url, callback, ignore);
686
- }.bind(this)
687
- });
688
-
689
- // Is jQuery present on the page
690
- if (window.jQuery) {
691
- jQuery(document).ajaxComplete(function (event, xhr, settings) {
692
- return this.handleAjaxRequest(settings.url, callback, ignore)
693
- }.bind(this));
694
- }
695
-
696
- },
697
-
698
- /**
699
- * Handle the ajax request form the observer above
700
- *
701
- * @param url
702
- * @param callback
703
- * @param ignore
704
- * @returns {boolean}
705
- */
706
- handleAjaxRequest: function (url, callback, ignore) {
707
-
708
- // Let's check the ignore variable
709
- if (typeof ignore !== 'undefined' && ignore instanceof Array && ignore.length > 0) {
710
-
711
- // Determine whether we should ignore this request?
712
- var shouldIgnore = false;
713
- ignore.each(function (element) {
714
- if (url && url.indexOf(element) != -1) {
715
- shouldIgnore = true;
716
- }
717
- });
718
-
719
- // If so, stop here!
720
- if (shouldIgnore === true) {
721
- return false;
722
- }
723
- }
724
-
725
- // Check the transport object has a URL and that it wasn't to our own controller
726
- if (url && url.indexOf('/braintree/') == -1) {
727
-
728
- // Some checkout implementations may require custom callbacks
729
- if (callback) {
730
- callback(url);
731
- } else {
732
- this.updateData();
733
- }
734
- }
735
-
736
- },
737
-
738
- /**
739
- * Make an Ajax request to the server and request up to date information regarding the quote
740
- *
741
- * @param callback A defined callback function if needed
742
- * @param params any extra data to be passed to the controller
743
- */
744
- updateData: function (callback, params) {
745
-
746
- // Push the callbacks into our array
747
- this._updateDataCallbacks.push(callback);
748
- this._updateDataParams = params;
749
-
750
- // If an updateData ajax request is running, cancel it
751
- if (this._updateDataXhr !== false) {
752
- this._updateDataXhr.transport.abort();
753
- }
754
-
755
- // Make a new ajax request to the server
756
- this._updateDataXhr = new Ajax.Request(
757
- this.quoteUrl,
758
- {
759
- method: 'post',
760
- parameters: this._updateDataParams,
761
- onSuccess: function (transport) {
762
- // Verify we have some response text
763
- if (transport && (transport.responseJSON || transport.responseText)) {
764
-
765
- // Parse the response from the server
766
- var response = this._parseTransportAsJson(transport);
767
-
768
- if (response.billingName != undefined) {
769
- this.billingName = response.billingName;
770
- }
771
- if (response.billingPostcode != undefined) {
772
- this.billingPostcode = response.billingPostcode;
773
- }
774
- if (response.grandTotal != undefined) {
775
- this.amount = response.grandTotal;
776
- }
777
- if (response.threeDSecure != undefined) {
778
- this.setThreeDSecure(response.threeDSecure);
779
- }
780
-
781
- // If PayPal is active update it
782
- if (typeof vzeroPaypal != "undefined") {
783
-
784
- // Update the totals within the PayPal system
785
- if (response.grandTotal != undefined && response.currencyCode != undefined) {
786
- vzeroPaypal.setPricing(response.grandTotal, response.currencyCode);
787
- }
788
-
789
- }
790
-
791
- // Reset the params
792
- this._updateDataParams = {};
793
-
794
- // Set the flag back
795
- this._updateDataXhr = false;
796
-
797
- // Run any callbacks that have been stored
798
- if (this._updateDataCallbacks.length) {
799
- this._updateDataCallbacks.each(function (callback) {
800
- callback(response);
801
- }.bind(this));
802
- this._updateDataCallbacks = [];
803
- }
804
- }
805
- }.bind(this),
806
- onFailure: function () {
807
-
808
- // Reset the params
809
- this._updateDataParams = {};
810
- this._updateDataXhr = false;
811
- this._updateDataCallbacks = [];
812
-
813
- }.bind(this)
814
- }
815
- );
816
-
817
- },
818
-
819
- /**
820
- * Allow custom checkouts to set a custom method for closing 3D secure
821
- *
822
- * @param callback A defined callback function if needed
823
- */
824
- close3dSecureMethod: function (callback) {
825
- this.closeMethod = callback;
826
- },
827
-
828
- /**
829
- * If the user attempts to use a 3D secure vaulted card and then cancels the 3D
830
- * window the nonce associated with that card will become invalid, due to this
831
- * we have to tokenize all the 3D secure cards again
832
- *
833
- * @param callback A defined callback function if needed
834
- */
835
- tokenize3dSavedCards: function (callback) {
836
-
837
- // Check 3D is enabled
838
- if (this.threeDSecure) {
839
-
840
- // Verify we have elements with data-token
841
- if ($$('[data-token]').first() !== undefined) {
842
-
843
- // Gather our tokens
844
- var tokens = [];
845
- $$('[data-token]').each(function (element, index) {
846
- tokens[index] = element.getAttribute('data-token');
847
- });
848
-
849
- // Make a new ajax request to the server
850
- new Ajax.Request(
851
- this.tokenizeUrl,
852
- {
853
- method: 'post',
854
- onSuccess: function (transport) {
855
-
856
- // Verify we have some response text
857
- if (transport && (transport.responseJSON || transport.responseText)) {
858
-
859
- // Parse as an object
860
- var response = this._parseTransportAsJson(transport);
861
-
862
- // Check the response was successful
863
- if (response.success) {
864
-
865
- // Loop through the returned tokens
866
- $H(response.tokens).each(function (element) {
867
-
868
- // If the token exists update it's nonce
869
- if ($$('[data-token="' + element.key + '"]').first() != undefined) {
870
- $$('[data-token="' + element.key + '"]').first().setAttribute('data-threedsecure-nonce', element.value);
871
- }
872
- });
873
- }
874
-
875
- if (callback) {
876
- callback(response);
877
- }
878
- }
879
- }.bind(this),
880
- parameters: {'tokens': Object.toJSON(tokens)}
881
- }
882
- );
883
- } else {
884
- callback();
885
- }
886
-
887
- } else {
888
- callback();
889
- }
890
- },
891
-
892
- onUserClose3ds: function () {
893
- this._hostedFieldsTokenGenerated = false;
894
- // Is there a close method defined?
895
- if (this.closeMethod) {
896
- this.closeMethod();
897
- } else {
898
- checkout.setLoadWaiting(false);
899
- }
900
- },
901
-
902
- /**
903
- * Verify a nonce through 3ds
904
- *
905
- * @param nonce
906
- * @param options
907
- */
908
- verify3dSecureNonce: function (nonce, options) {
909
-
910
- var threeDSecureRequest = {
911
- amount: this.amount,
912
- creditCard: nonce,
913
- onUserClose: this.onUserClose3ds.bind(this)
914
- };
915
-
916
- // Run the verify function on the braintree client
917
- this.client.verify3DS(threeDSecureRequest, function (error, response) {
918
-
919
- if (!error) {
920
- // Run any callback functions
921
- if (options.onSuccess) {
922
- options.onSuccess(response);
923
- }
924
- } else {
925
- if (options.onFailure) {
926
- options.onFailure(response, error.message);
927
- }
928
- }
929
- });
930
-
931
- },
932
-
933
- /**
934
- * Make a request to Braintree for 3D secure information
935
- *
936
- * @param options Contains any callback functions which have been set
937
- */
938
- verify3dSecure: function (options) {
939
-
940
- var threeDSecureRequest = {
941
- amount: this.amount,
942
- creditCard: {
943
- number: $$('[data-genebraintree-name="number"]').first().value,
944
- expirationMonth: $$('[data-genebraintree-name="expiration_month"]').first().value,
945
- expirationYear: $$('[data-genebraintree-name="expiration_year"]').first().value,
946
- cardholderName: this.getBillingName()
947
- },
948
- onUserClose: this.onUserClose3ds.bind(this)
949
- };
950
-
951
- // If the CVV field exists include it
952
- if ($$('[data-genebraintree-name="cvv"]').first() != undefined) {
953
- threeDSecureRequest.creditCard.cvv = $$('[data-genebraintree-name="cvv"]').first().value;
954
- }
955
-
956
- // If we have the billing postcode add it into the request
957
- if (this.getBillingPostcode() != "") {
958
- threeDSecureRequest.creditCard.billingAddress = {
959
- postalCode: this.getBillingPostcode()
960
- };
961
- }
962
-
963
- // Run the verify function on the braintree client
964
- this.client.verify3DS(threeDSecureRequest, function (error, response) {
965
-
966
- if (!error) {
967
-
968
- // Store threeDSecure token and nonce in form
969
- $('creditcard-payment-nonce').value = response.nonce;
970
- $('creditcard-payment-nonce').setAttribute('value', response.nonce);
971
-
972
- // Run any callback functions
973
- if (options.onSuccess) {
974
- options.onSuccess();
975
- }
976
- } else {
977
-
978
- // Show the error
979
- alert(error.message);
980
-
981
- if (options.onFailure) {
982
- options.onFailure();
983
- } else {
984
- checkout.setLoadWaiting(false);
985
- }
986
- }
987
- });
988
-
989
- },
990
-
991
- /**
992
- * Verify a card stored in the vault
993
- *
994
- * @param options Contains any callback functions which have been set
995
- */
996
- verify3dSecureVault: function (options) {
997
-
998
- // Get the payment nonce
999
- var paymentNonce = $$('#creditcard-saved-accounts input:checked[type=radio]').first().getAttribute('data-threedsecure-nonce');
1000
-
1001
- if (paymentNonce) {
1002
- // Run the verify function on the braintree client
1003
- this.client.verify3DS({
1004
- amount: this.amount,
1005
- creditCard: paymentNonce
1006
- }, function (error, response) {
1007
- if (!error) {
1008
-
1009
- // Store threeDSecure token and nonce in form
1010
- $('creditcard-payment-nonce').removeAttribute('disabled');
1011
- $('creditcard-payment-nonce').value = response.nonce;
1012
- $('creditcard-payment-nonce').setAttribute('value', response.nonce);
1013
-
1014
- // Run any callback functions
1015
- if (options.onSuccess) {
1016
- options.onSuccess();
1017
- }
1018
- } else {
1019
-
1020
- // Show the error
1021
- alert(error.message);
1022
-
1023
- if (options.onFailure) {
1024
- options.onFailure();
1025
- } else {
1026
- checkout.setLoadWaiting(false);
1027
- }
1028
- }
1029
- });
1030
- } else {
1031
- alert('No payment nonce present.');
1032
-
1033
- if (options.onFailure) {
1034
- options.onFailure();
1035
- } else {
1036
- checkout.setLoadWaiting(false);
1037
- }
1038
- }
1039
-
1040
- },
1041
-
1042
- /**
1043
- * Process a standard card request
1044
- *
1045
- * @param options Contains any callback functions which have been set
1046
- */
1047
- processCard: function (options) {
1048
-
1049
- var tokenizeRequest = {
1050
- number: $$('[data-genebraintree-name="number"]').first().value,
1051
- cardholderName: this.getBillingName(),
1052
- expirationMonth: $$('[data-genebraintree-name="expiration_month"]').first().value,
1053
- expirationYear: $$('[data-genebraintree-name="expiration_year"]').first().value
1054
- };
1055
-
1056
- // If the CVV field exists include it
1057
- if ($$('[data-genebraintree-name="cvv"]').first() != undefined) {
1058
- tokenizeRequest.cvv = $$('[data-genebraintree-name="cvv"]').first().value;
1059
- }
1060
-
1061
- // If we have the billing postcode add it into the request
1062
- if (this.getBillingPostcode() != "") {
1063
- tokenizeRequest.billingAddress = {
1064
- postalCode: this.getBillingPostcode()
1065
- };
1066
- }
1067
-
1068
- // Attempt to tokenize the card
1069
- this.client.tokenizeCard(tokenizeRequest, function (errors, nonce) {
1070
-
1071
- if (!errors) {
1072
- // Update the nonce in the form
1073
- $('creditcard-payment-nonce').value = nonce;
1074
- $('creditcard-payment-nonce').setAttribute('value', nonce);
1075
-
1076
- // Run any callback functions
1077
- if (options.onSuccess) {
1078
- options.onSuccess();
1079
- }
1080
- } else {
1081
- // Handle errors
1082
- for (var i = 0; i < errors.length; i++) {
1083
- alert(errors[i].code + " " + errors[i].message);
1084
- }
1085
-
1086
- if (options.onFailure) {
1087
- options.onFailure();
1088
- } else {
1089
- checkout.setLoadWaiting(false);
1090
- }
1091
- }
1092
- });
1093
-
1094
- },
1095
-
1096
- /**
1097
- * Should our integrations intercept credit card payments based on the settings?
1098
- *
1099
- * @returns {boolean}
1100
- */
1101
- shouldInterceptCreditCard: function () {
1102
- return (this.amount != '0.00');
1103
- },
1104
-
1105
- /**
1106
- * Should our integrations intercept PayPal payments based on the settings?
1107
- *
1108
- * @returns {boolean}
1109
- */
1110
- shouldInterceptPayPal: function () {
1111
- return true;
1112
- },
1113
-
1114
- /**
1115
- * Conduct a regular expression check to determine card type automatically
1116
- *
1117
- * @param number
1118
- * @returns {string}
1119
- */
1120
- getCardType: function (number) {
1121
-
1122
- if (number) {
1123
-
1124
- if (number.match(/^4/) != null)
1125
- return "VI";
1126
-
1127
- if (number.match(/^(34|37)/) != null)
1128
- return "AE";
1129
-
1130
- if (number.match(/^5[1-5]/) != null)
1131
- return "MC";
1132
-
1133
- if (number.match(/^6011/) != null)
1134
- return "DI";
1135
-
1136
- if (number.match(/^(?:2131|1800|35)/) != null)
1137
- return "JCB";
1138
-
1139
- if (number.match(/^(5018|5020|5038|6304|67[0-9]{2})/) != null)
1140
- return "ME";
1141
-
1142
- }
1143
-
1144
- // Otherwise return the standard card
1145
- return "card";
1146
- },
1147
-
1148
- /**
1149
- * Wrapper function which defines which method should be called
1150
- *
1151
- * verify3dSecureVault - used for verifying any vaulted card when 3D secure is enabled
1152
- * verify3dSecure - verify a normal card via 3D secure
1153
- * processCard - verify a normal card
1154
- *
1155
- * If the customer has choosen a vaulted card and 3D is disabled no client side interaction is needed
1156
- *
1157
- * @param options Object containing onSuccess, onFailure functions
1158
- */
1159
- process: function (options) {
1160
-
1161
- // If options isn't set, use an empty object
1162
- options = options || {};
1163
-
1164
- // If the hosted fields token has been generated just glide through
1165
- if (this._hostedFieldsTokenGenerated) {
1166
-
1167
- // No action required as we're using a saved card
1168
- if (options.onSuccess) {
1169
- options.onSuccess()
1170
- }
1171
-
1172
- } else if (this.usingSavedCard() && $$('#creditcard-saved-accounts input:checked[type=radio]').first().hasAttribute('data-threedsecure-nonce')) {
1173
-
1174
- // The user has selected a card stored via 3D secure
1175
- this.verify3dSecureVault(options);
1176
-
1177
- } else if (this.usingSavedCard()) {
1178
-
1179
- // No action required as we're using a saved card
1180
- if (options.onSuccess) {
1181
- options.onSuccess()
1182
- }
1183
-
1184
- } else if (this.threeDSecure == true) {
1185
-
1186
- // Standard 3D secure callback
1187
- this.verify3dSecure(options);
1188
-
1189
- } else {
1190
-
1191
- // Otherwise process the card normally
1192
- this.processCard(options);
1193
- }
1194
- },
1195
-
1196
- /**
1197
- * Called on Credit Card loading
1198
- *
1199
- * @returns {boolean}
1200
- */
1201
- creditCardLoaded: function () {
1202
- return false;
1203
- },
1204
-
1205
- /**
1206
- * Called on PayPal loading
1207
- *
1208
- * @returns {boolean}
1209
- */
1210
- paypalLoaded: function () {
1211
- return false;
1212
- },
1213
-
1214
- /**
1215
- * Parse a transports response into JSON
1216
- *
1217
- * @param transport
1218
- * @returns {*}
1219
- * @private
1220
- */
1221
- _parseTransportAsJson: function (transport) {
1222
- if (transport.responseJSON && typeof transport.responseJSON === 'object') {
1223
- return transport.responseJSON;
1224
- } else if (transport.responseText) {
1225
- if (typeof JSON === 'object' && typeof JSON.parse === 'function') {
1226
- return JSON.parse(transport.responseText);
1227
- } else {
1228
- return eval('(' + transport.responseText + ')');
1229
- }
1230
- }
1231
-
1232
- return {};
1233
- }
1234
-
1235
- };
1236
-
1237
- /**
1238
- * Separate class to handle functionality around the vZero PayPal button
1239
- *
1240
- * @class vZeroPayPalButton
1241
- * @author Dave Macaulay <dave@gene.co.uk>
1242
- */
1243
- var vZeroPayPalButton = Class.create();
1244
- vZeroPayPalButton.prototype = {
1245
-
1246
- /**
1247
- * Initialize the PayPal button class
1248
- *
1249
- * @param clientToken Client token generated from server
1250
- * @param storeFrontName The store name to show within the PayPal modal window
1251
- * @param singleUse Should the system attempt to open in single payment mode?
1252
- * @param locale The locale for the payment
1253
- * @param futureSingleUse When using future payments should we process the transaction as a single payment?
1254
- */
1255
- initialize: function (clientToken, storeFrontName, singleUse, locale, futureSingleUse) {
1256
- this.clientToken = clientToken;
1257
- this.storeFrontName = storeFrontName;
1258
- this.singleUse = singleUse;
1259
- this.locale = locale;
1260
- this.futureSingleUse = futureSingleUse;
1261
-
1262
- this._paypalOptions = {};
1263
- this._paypalIntegration = false;
1264
- this._paypalButton = false;
1265
-
1266
- this._rebuildTimer = false;
1267
- this._rebuildCount = 0;
1268
-
1269
- this.integration = false;
1270
- },
1271
-
1272
- /**
1273
- * Update the pricing information for the PayPal button
1274
- * If the PayPalClient has already been created we also update the _clientOptions
1275
- * so the PayPal modal window displays the correct values
1276
- *
1277
- * @param amount The amount formatted to two decimal places
1278
- * @param currency The currency code
1279
- */
1280
- setPricing: function (amount, currency) {
1281
-
1282
- // Set them into the class
1283
- this.amount = parseFloat(amount);
1284
- this.currency = currency;
1285
-
1286
- if ($('paypal-payment-nonce') != null && !$('paypal-payment-nonce').value) {
1287
- // As the amounts and currency has been updated let's update the button by rebuilding it
1288
- // But only if we don't have a nonce
1289
- this.rebuildButton();
1290
- }
1291
-
1292
- },
1293
-
1294
- /**
1295
- * Rebuild the PayPal button
1296
- */
1297
- rebuildButton: function () {
1298
-
1299
- clearTimeout(this._rebuildTimer);
1300
- if (this._paypalIntegration !== false) {
1301
- try {
1302
- // Wait 100ms to rebuild the button
1303
- this._paypalIntegration.teardown(function () {
1304
- this._paypalIntegration = false;
1305
- // Re-add the button with the same options
1306
- this.addPayPalButton(this._paypalOptions);
1307
- }.bind(this));
1308
- } catch (e) {
1309
- // This error means the integration has already been torn down
1310
- if (e.message == 'Cannot teardown integration more than once') {
1311
- this._paypalIntegration = false;
1312
- this.addPayPalButton(this._paypalOptions);
1313
- } else if (this._rebuildCount >= 10) {
1314
- // Infinite loops are bad kids
1315
- return false;
1316
- } else {
1317
- // Check to see if the teardown function will work once the integration is built fully
1318
- this._rebuildTimer = setTimeout(function () {
1319
- ++this._rebuildCount;
1320
- this.rebuildButton();
1321
- }.bind(this), 200);
1322
- }
1323
- }
1324
- }
1325
- },
1326
-
1327
- /**
1328
- * Inject the PayPal button into the document
1329
- *
1330
- * @param options Object containing onSuccess method
1331
- * @param checkoutIntegration Object the integration class
1332
- */
1333
- addPayPalButton: function (options, checkoutIntegration) {
1334
-
1335
- // Store the integration in the class
1336
- if (!this.integration && typeof checkoutIntegration === 'object') {
1337
- this.integration = checkoutIntegration;
1338
- }
1339
-
1340
- // If the container isn't present on the page we can't add the button
1341
- if ($('paypal-container') === null || $('braintree-paypal-button') === null) {
1342
- return false;
1343
- }
1344
-
1345
- // Add our custom button into the view
1346
- var buttonHtml = $('braintree-paypal-button').innerHTML;
1347
- $('paypal-container').update('');
1348
- $('paypal-container').insert(buttonHtml);
1349
-
1350
- // Assign the new button
1351
- if (!$('paypal-container').select('>button').length) {
1352
- return false;
1353
- }
1354
- this._paypalButton = $('paypal-container').select('>button').first();
1355
- this._paypalButton.addClassName('braintree-paypal-loading');
1356
- this._paypalButton.setAttribute('disabled', 'disabled');
1357
-
1358
- // Store the options as we may need to rebuild the button
1359
- this._paypalOptions = options;
1360
- this._paypalIntegration = false;
1361
-
1362
- // Build up our setup configuration
1363
- var setupConfiguration = {
1364
- paymentMethodNonceInputField: "paypal-payment-nonce",
1365
- displayName: this.storeFrontName,
1366
- onPaymentMethodReceived: function (obj) {
1367
-
1368
- // If we have a success callback we're most likely using a non-default checkout
1369
- if (typeof options.onSuccess === 'function') {
1370
- options.onSuccess(obj);
1371
- } else {
1372
- // Otherwise we're using the default checkout
1373
- payment.switchMethod('gene_braintree_paypal');
1374
-
1375
- // Re-enable the form
1376
- $('paypal-payment-nonce').removeAttribute('disabled');
1377
-
1378
- // Remove the PayPal button
1379
- $('paypal-complete').remove();
1380
-
1381
- // Submit the checkout steps
1382
- window.review && review.save();
1383
- }
1384
-
1385
- },
1386
- onUnsupported: function () {
1387
- alert('You need to link your PayPal account with your Braintree account in your Braintree control panel to utilise the PayPal functionality of this extension.');
1388
- },
1389
- onReady: function (integration) {
1390
- this._paypalIntegration = integration;
1391
- this._attachPayPalButtonEvent();
1392
- if (typeof options.onReady === 'function') {
1393
- options.onReady(integration);
1394
- }
1395
- }.bind(this),
1396
- paypal: {
1397
- headless: true
1398
- }
1399
- };
1400
-
1401
- // Pass the locale over to the PayPal instance
1402
- if (this.locale) {
1403
- setupConfiguration.locale = this.locale;
1404
- }
1405
-
1406
- // Single use requires some extra data to be sent through, this is so the PayPal window can display the correct total etc
1407
- if (this.singleUse == true) {
1408
-
1409
- setupConfiguration.singleUse = true;
1410
- setupConfiguration.amount = this.amount;
1411
- setupConfiguration.currency = this.currency;
1412
-
1413
- } else if (this.futureSingleUse == true) {
1414
-
1415
- setupConfiguration.singleUse = true;
1416
-
1417
- } else {
1418
-
1419
- setupConfiguration.singleUse = false;
1420
-
1421
- }
1422
-
1423
- // Start a new version of the client and assign for later modifications
1424
- braintree.setup(this.clientToken, "paypal", setupConfiguration);
1425
- },
1426
-
1427
- /**
1428
- * Attach the click event to the paypal button
1429
- *
1430
- * @param checkoutIntegration
1431
- *
1432
- * @private
1433
- */
1434
- _attachPayPalButtonEvent: function (checkoutIntegration) {
1435
- if (this._paypalIntegration && this._paypalButton) {
1436
- this._paypalButton.removeClassName('braintree-paypal-loading');
1437
- this._paypalButton.removeAttribute('disabled');
1438
-
1439
- Event.stopObserving(this._paypalButton, 'click');
1440
- Event.observe(this._paypalButton, 'click', function (event) {
1441
- Event.stop(event);
1442
- if (typeof this.integration == 'object' && typeof this.integration.validateAll === 'function') {
1443
- if (this.integration.validateAll()) {
1444
- // Fire the integration
1445
- this._paypalIntegration.paypal.initAuthFlow();
1446
- }
1447
- } else {
1448
- // Fire the integration
1449
- this._paypalIntegration.paypal.initAuthFlow();
1450
- }
1451
-
1452
- }.bind(this));
1453
- }
1454
- },
1455
-
1456
- /**
1457
- * Allow closing of the PayPal window
1458
- *
1459
- * @param callback A defined callback function if needed
1460
- * @deprecated since version 1.0.4.1
1461
- */
1462
- closePayPalWindow: function (callback) {
1463
- // Function deprecated in favour of using event propagation
1464
- }
1465
-
1466
- };
1467
-
1468
- /**
1469
- * The integration class for the Default checkout
1470
- *
1471
- * @class vZeroIntegration
1472
- * @author Dave Macaulay <dave@gene.co.uk>
1473
- */
1474
- var vZeroIntegration = Class.create();
1475
- vZeroIntegration.prototype = {
1476
-
1477
- /**
1478
- * Create an instance of the integration
1479
- *
1480
- * @param vzero The vZero class that's being used by the checkout
1481
- * @param vzeroPaypal The vZero PayPal object
1482
- * @param paypalMarkUp The markup used for the PayPal button
1483
- * @param paypalButtonClass The class of the button we need to replace with the above mark up
1484
- * @param isOnepage Is the integration a onepage checkout?
1485
- * @param config Any further config the integration wants to push into the class
1486
- * @param submitAfterPayment Is the checkout going to submit the actual payment after the payment step? For instance a checkout with a review step
1487
- */
1488
- initialize: function (vzero, vzeroPaypal, paypalMarkUp, paypalButtonClass, isOnepage, config, submitAfterPayment) {
1489
-
1490
- // Only allow the system to be initialized twice
1491
- if (vZeroIntegration.prototype.loaded) {
1492
- console.error('Your checkout is including the Braintree resources multiple times, please resolve this.');
1493
- return false;
1494
- }
1495
- vZeroIntegration.prototype.loaded = true;
1496
-
1497
- this.vzero = vzero || false;
1498
- this.vzeroPaypal = vzeroPaypal || false;
1499
-
1500
- // If both methods aren't present don't run the integration
1501
- if (this.vzero === false && this.vzeroPaypal === false) {
1502
- console.warn('The vzero and vzeroPaypal objects are not initiated.');
1503
- return false;
1504
- }
1505
-
1506
- this.paypalMarkUp = paypalMarkUp || false;
1507
- this.paypalButtonClass = paypalButtonClass || false;
1508
-
1509
- this.isOnepage = isOnepage || false;
1510
-
1511
- this.config = config || {};
1512
-
1513
- this.submitAfterPayment = submitAfterPayment || false;
1514
-
1515
- this._methodSwitchTimeout = false;
1516
-
1517
- // Hosted fields hasn't been initialized yet
1518
- this._hostedFieldsInit = false;
1519
-
1520
- // Wait for the DOM to finish loading before creating observers
1521
- document.observe("dom:loaded", function () {
1522
-
1523
- // Call the function which is going to intercept the submit event
1524
- this.prepareSubmitObserver();
1525
- this.preparePaymentMethodSwitchObserver();
1526
-
1527
- }.bind(this));
1528
-
1529
- // Has the hosted fields method been generated successfully?
1530
- this.hostedFieldsGenerated = false;
1531
-
1532
- // Attach events for when the 3Ds window is closed
1533
- this.vzero.close3dSecureMethod(function () {
1534
-
1535
- // As hosted fields validation can still be true when a customer closes the modal clear it
1536
- this.vzero._hostedFieldsValidationRunning = false;
1537
-
1538
- // Re-tokenize all the saved cards
1539
- this.vzero.tokenize3dSavedCards(function () {
1540
- this.threeDTokenizationComplete();
1541
- }.bind(this));
1542
-
1543
- }.bind(this));
1544
-
1545
- // On onepage checkouts we need to do some other magic
1546
- if (this.isOnepage) {
1547
- this.vzero.observeCardType();
1548
- this.observeAjaxRequests();
1549
-
1550
- document.observe("dom:loaded", function () {
1551
- this.initSavedPayPal();
1552
- this.initDefaultMethod();
1553
-
1554
- if ($('braintree-hosted-submit') !== null) {
1555
- this.initHostedFields();
1556
- }
1557
- }.bind(this));
1558
- }
1559
-
1560
- document.observe("dom:loaded", function () {
1561
- // Saved methods need events to!
1562
- this.initSavedMethods();
1563
-
1564
- if ($('braintree-hosted-submit') !== null) {
1565
- this.initHostedFields();
1566
- }
1567
- }.bind(this));
1568
-
1569
- },
1570
-
1571
- /**
1572
- * Init the saved method events
1573
- */
1574
- initSavedMethods: function () {
1575
-
1576
- // Loop through each saved card being selected
1577
- $$('#creditcard-saved-accounts input[type="radio"], #paypal-saved-accounts input[type="radio"]').each(function (element) {
1578
-
1579
- // Determine which method we're observing
1580
- var parentElement = '';
1581
- var targetElement = '';
1582
- if (element.up('#creditcard-saved-accounts') !== undefined) {
1583
- parentElement = '#creditcard-saved-accounts';
1584
- targetElement = '#credit-card-form';
1585
- } else if (element.up('#paypal-saved-accounts') !== undefined) {
1586
- parentElement = '#paypal-saved-accounts';
1587
- targetElement = '.paypal-info';
1588
- }
1589
-
1590
- // Observe the elements changing
1591
- $(element).stopObserving('change').observe('change', function (event) {
1592
- return this.showHideOtherMethod(parentElement, targetElement);
1593
- }.bind(this));
1594
-
1595
- }.bind(this));
1596
-
1597
- },
1598
-
1599
- /**
1600
- * Hide or show the "other" method for both PayPal & Credit Card
1601
- *
1602
- * @param parentElement
1603
- * @param targetElement
1604
- */
1605
- showHideOtherMethod: function (parentElement, targetElement) {
1606
-
1607
- // Has the user selected other?
1608
- if ($$(parentElement + ' input:checked[type=radio]').first() !== undefined && $$(parentElement + ' input:checked[type=radio]').first().value == 'other') {
1609
-
1610
- if ($$(targetElement).first() !== undefined) {
1611
-
1612
- // Show the credit card form
1613
- $$(targetElement).first().show();
1614
-
1615
- // Enable the credit card form all the elements in the credit card form
1616
- $$(targetElement + ' input, ' + targetElement + ' select').each(function (formElement) {
1617
- formElement.removeAttribute('disabled');
1618
- });
1619
-
1620
- }
1621
-
1622
- } else if ($$(parentElement + ' input:checked[type=radio]').first() !== undefined) {
1623
-
1624
- if ($$(targetElement).first() !== undefined) {
1625
-
1626
- // Hide the new credit card form
1627
- $$(targetElement).first().hide();
1628
-
1629
- // Disable all the elements in the credit card form
1630
- $$(targetElement + ' input, ' + targetElement + ' select').each(function (formElement) {
1631
- formElement.setAttribute('disabled', 'disabled');
1632
- });
1633
-
1634
- }
1635
-
1636
- }
1637
- },
1638
-
1639
- /**
1640
- * Check to see if the "Other" option is selected and show the div correctly
1641
- */
1642
- checkSavedOther: function () {
1643
- var parentElement = '';
1644
- var targetElement = '';
1645
-
1646
- if (this.getPaymentMethod() == 'gene_braintree_creditcard') {
1647
- parentElement = '#creditcard-saved-accounts';
1648
- targetElement = '#credit-card-form';
1649
- } else if (this.getPaymentMethod() == 'gene_braintree_paypal') {
1650
- parentElement = '#paypal-saved-accounts';
1651
- targetElement = '.paypal-info';
1652
- }
1653
-
1654
- // Only run this action if the parent element exists on the page
1655
- if ($$(parentElement).first() !== undefined) {
1656
- this.showHideOtherMethod(parentElement, targetElement);
1657
- }
1658
- },
1659
-
1660
- /**
1661
- * Init hosted fields
1662
- */
1663
- initHostedFields: function () {
1664
-
1665
- // Only init hosted fields if it's enabled
1666
- if (this.vzero.hostedFields) {
1667
-
1668
- // Verify the form is on the page
1669
- if ($('braintree-hosted-submit') !== null) {
1670
-
1671
- // Verify this checkout has a form (would be weird to have a formless checkout, but you never know!)
1672
- if ($('braintree-hosted-submit').up('form') !== undefined) {
1673
-
1674
- // Flag hosted fields being init
1675
- this._hostedFieldsInit = true;
1676
-
1677
- // Store the form in the integration class
1678
- this.form = $('braintree-hosted-submit').up('form');
1679
-
1680
- // Init hosted fields upon the form
1681
- this.vzero.initHostedFields(this);
1682
-
1683
- } else {
1684
- console.error('Hosted Fields cannot be initialized as we\'re unable to locate the parent form.');
1685
- }
1686
- }
1687
- }
1688
- },
1689
-
1690
- /**
1691
- * After a successful hosted fields call
1692
- *
1693
- * @param nonce
1694
- * @returns {*}
1695
- */
1696
- afterHostedFieldsNonceReceived: function (nonce) {
1697
- this.resetLoading();
1698
- this.vzero._hostedFieldsTokenGenerated = true;
1699
- this.hostedFieldsGenerated = true;
1700
- if (this.isOnepage || this.submitAfterPayment) {
1701
- return this.submitCheckout();
1702
- } else {
1703
- return this.submitPayment();
1704
- }
1705
- },
1706
-
1707
- /**
1708
- * Handle hosted fields throwing an error
1709
- *
1710
- * @param message
1711
- * @returns {boolean}
1712
- */
1713
- afterHostedFieldsError: function (message) {
1714
- this.vzero._hostedFieldsTokenGenerated = false;
1715
- this.hostedFieldsGenerated = false;
1716
- return false;
1717
- },
1718
-
1719
- /**
1720
- * Init the default payment methods
1721
- */
1722
- initDefaultMethod: function () {
1723
- if (this.shouldAddPayPalButton(false)) {
1724
- this.setLoading();
1725
- this.vzero.updateData(function () {
1726
- this.resetLoading();
1727
- this.updatePayPalButton('add');
1728
- }.bind(this));
1729
- }
1730
- },
1731
-
1732
- /**
1733
- * Observe any Ajax requests and refresh the PayPal button or update the checkouts data
1734
- */
1735
- observeAjaxRequests: function () {
1736
- this.vzero.observeAjaxRequests(function () {
1737
- this.vzero.updateData(function () {
1738
-
1739
- // The Ajax request might kill our events
1740
- if (this.isOnepage) {
1741
- this.initSavedPayPal();
1742
- this.rebuildPayPalButton();
1743
- this.checkSavedOther();
1744
-
1745
- // If hosted fields is enabled init the environment
1746
- if (this.vzero.hostedFields) {
1747
- this.initHostedFields();
1748
- }
1749
- }
1750
-
1751
- // Make sure we're observing the saved methods correctly
1752
- this.initSavedMethods();
1753
-
1754
- }.bind(this));
1755
- }.bind(this), (typeof this.config.ignoreAjax !== 'undefined' ? this.config.ignoreAjax : false))
1756
- },
1757
-
1758
- /**
1759
- * Rebuild the PayPal button if it's been removed
1760
- */
1761
- rebuildPayPalButton: function () {
1762
-
1763
- // Check to see if the DOM element has been removed?
1764
- if ($('paypal-container') == null) {
1765
- this.updatePayPalButton();
1766
- }
1767
-
1768
- },
1769
-
1770
- /**
1771
- * Handle saved PayPals being present on the page
1772
- */
1773
- initSavedPayPal: function () {
1774
-
1775
- // If we have any saved accounts we'll need to do something jammy
1776
- if ($$('#paypal-saved-accounts input[type=radio]').first() !== undefined) {
1777
- $('paypal-saved-accounts').on('change', 'input[type=radio]', function (event) {
1778
-
1779
- // Update the PayPal button accordingly
1780
- this.updatePayPalButton(false, 'gene_braintree_paypal');
1781
-
1782
- }.bind(this));
1783
- }
1784
-
1785
- },
1786
-
1787
- /**
1788
- * Set the submit function to be used
1789
- *
1790
- * This should be overridden within each checkouts .phtml file
1791
- * vZeroIntegration.prototype.prepareSubmitObserver = function() {}
1792
- *
1793
- * @returns {boolean}
1794
- */
1795
- prepareSubmitObserver: function () {
1796
- return false;
1797
- },
1798
-
1799
- /**
1800
- * Event to run before submit
1801
- * Should always return _beforeSubmit
1802
- *
1803
- * @returns {boolean}
1804
- */
1805
- beforeSubmit: function (callback) {
1806
- return this._beforeSubmit(callback);
1807
- },
1808
-
1809
- /**
1810
- * Private before submit function
1811
- *
1812
- * @param callback
1813
- * @private
1814
- */
1815
- _beforeSubmit: function (callback) {
1816
- // If hosted fields is activated, and we're 100% not using a saved card
1817
- if (this.hostedFieldsGenerated === false && this.vzero.hostedFields && ($$('#creditcard-saved-accounts input:checked[type=radio]').first() === undefined || ($$('#creditcard-saved-accounts input:checked[type=radio]').first() !== undefined && $$('#creditcard-saved-accounts input:checked[type=radio]').first().value == 'other'))) {
1818
- // Fake the form being submitted
1819
- var button = $('braintree-hosted-submit').down('button');
1820
- button.removeAttribute('disabled');
1821
- button.click();
1822
- } else {
1823
- callback();
1824
- }
1825
-
1826
- // Remove the save after payment to ensure validation fires correctly
1827
- if (this.submitAfterPayment && $('braintree-submit-after-payment')) {
1828
- $('braintree-submit-after-payment').remove();
1829
- }
1830
- },
1831
-
1832
- /**
1833
- * Event to run after submit
1834
- *
1835
- * @returns {boolean}
1836
- */
1837
- afterSubmit: function () {
1838
- return false;
1839
- },
1840
-
1841
- /**
1842
- * Submit the integration to tokenize the card
1843
- *
1844
- * @param type
1845
- * @param successCallback
1846
- * @param failedCallback
1847
- * @param validateFailedCallback
1848
- */
1849
- submit: function (type, successCallback, failedCallback, validateFailedCallback) {
1850
-
1851
- // Check we actually want to intercept this credit card transaction?
1852
- if (this.shouldInterceptSubmit(type)) {
1853
-
1854
- // Validate the form before submission
1855
- if (this.validateAll()) {
1856
-
1857
- // Show the loading information
1858
- this.setLoading();
1859
-
1860
- // Call the before submit function
1861
- this.beforeSubmit(function () {
1862
-
1863
- // Always attempt to update the card type on submission
1864
- if ($$('[data-genebraintree-name="number"]').first() != undefined) {
1865
- this.vzero.updateCardType($$('[data-genebraintree-name="number"]').first().value);
1866
- }
1867
-
1868
- // Update the data within the vZero object
1869
- this.vzero.updateData(
1870
- function () {
1871
-
1872
- // Update the billing details if they're present on the page
1873
- this.updateBilling();
1874
-
1875
- // Process the data on the page
1876
- this.vzero.process({
1877
- onSuccess: function () {
1878
-
1879
- // Make some modifications to the form
1880
- this.enableDeviceData();
1881
- this.disableCreditCardForm();
1882
-
1883
- // Unset the loading, as this can block success functions
1884
- this.resetLoading();
1885
- this.afterSubmit();
1886
-
1887
- // Enable/disable the correct nonce input fields
1888
- this.enableDisableNonce();
1889
-
1890
- this.vzero._hostedFieldsTokenGenerated = false;
1891
- this.hostedFieldsGenerated = false;
1892
-
1893
- // Call the callback function
1894
- if (typeof successCallback === 'function') {
1895
- var response = successCallback();
1896
- }
1897
-
1898
- // Enable loading again, as things are happening!
1899
- this.setLoading();
1900
-
1901
- this.enableCreditCardForm();
1902
- return response;
1903
-
1904
- }.bind(this),
1905
- onFailure: function () {
1906
-
1907
- this.vzero._hostedFieldsTokenGenerated = false;
1908
- this.hostedFieldsGenerated = false;
1909
-
1910
- this.resetLoading();
1911
- this.afterSubmit();
1912
- if (typeof failedCallback === 'function') {
1913
- return failedCallback();
1914
- }
1915
- }.bind(this)
1916
- })
1917
- }.bind(this),
1918
- this.getUpdateDataParams()
1919
- );
1920
-
1921
- }.bind(this));
1922
-
1923
- } else {
1924
-
1925
- this.vzero._hostedFieldsTokenGenerated = false;
1926
- this.hostedFieldsGenerated = false;
1927
-
1928
- this.resetLoading();
1929
- if (typeof validateFailedCallback === 'function') {
1930
- validateFailedCallback();
1931
- }
1932
- }
1933
- }
1934
- },
1935
-
1936
- /**
1937
- * Submit the entire checkout
1938
- */
1939
- submitCheckout: function () {
1940
- // Submit the checkout steps
1941
- window.review && review.save();
1942
- },
1943
-
1944
- /**
1945
- * How to submit the payment section
1946
- */
1947
- submitPayment: function () {
1948
- payment.save && payment.save();
1949
- },
1950
-
1951
- /**
1952
- * Enable/disable the correct nonce input fields
1953
- */
1954
- enableDisableNonce: function () {
1955
- // Make sure the nonce inputs aren't going to interfere
1956
- if (this.getPaymentMethod() == 'gene_braintree_creditcard') {
1957
- if ($('creditcard-payment-nonce') !== null) {
1958
- $('creditcard-payment-nonce').removeAttribute('disabled');
1959
- }
1960
- if ($('paypal-payment-nonce') !== null) {
1961
- $('paypal-payment-nonce').setAttribute('disabled', 'disabled');
1962
- }
1963
- } else if (this.getPaymentMethod() == 'gene_braintree_paypal') {
1964
- if ($('creditcard-payment-nonce') !== null) {
1965
- $('creditcard-payment-nonce').setAttribute('disabled', 'disabled');
1966
- }
1967
- if ($('paypal-payment-nonce') !== null) {
1968
- $('paypal-payment-nonce').removeAttribute('disabled');
1969
- }
1970
- }
1971
- },
1972
-
1973
- /**
1974
- * Replace the PayPal button at the correct time
1975
- *
1976
- * This should be overridden within each checkouts .phtml file
1977
- * vZeroIntegration.prototype.preparePaymentMethodSwitchObserver = function() {}
1978
- */
1979
- preparePaymentMethodSwitchObserver: function () {
1980
- return this.defaultPaymentMethodSwitch();
1981
- },
1982
-
1983
- /**
1984
- * If the checkout uses the Magento standard Payment.prototype.switchMethod we can utilise this function
1985
- */
1986
- defaultPaymentMethodSwitch: function () {
1987
-
1988
- // Store a pointer to the vZero integration
1989
- var vzeroIntegration = this;
1990
-
1991
- // Store the original payment method
1992
- var paymentSwitchOriginal = Payment.prototype.switchMethod;
1993
-
1994
- // Intercept the save function
1995
- Payment.prototype.switchMethod = function (method) {
1996
-
1997
- // Run our method switch function
1998
- vzeroIntegration.paymentMethodSwitch(method);
1999
-
2000
- // Run the original function
2001
- return paymentSwitchOriginal.apply(this, arguments);
2002
- };
2003
-
2004
- },
2005
-
2006
- /**
2007
- * Function to run when the customer changes payment method
2008
- * @param method
2009
- */
2010
- paymentMethodSwitch: function (method) {
2011
-
2012
- // Wait for 50ms to see if this function is called again, only ever run the last instance
2013
- clearTimeout(this._methodSwitchTimeout);
2014
- this._methodSwitchTimeout = setTimeout(function () {
2015
-
2016
- // Should we add a PayPal button?
2017
- if (this.shouldAddPayPalButton(method)) {
2018
- this.updatePayPalButton('add', method);
2019
- } else {
2020
- this.updatePayPalButton('remove', method);
2021
- }
2022
-
2023
- // Has the user enabled hosted fields?
2024
- if ((method ? method : this.getPaymentMethod()) == 'gene_braintree_creditcard') {
2025
- this.initHostedFields();
2026
- }
2027
-
2028
- // Check to see if the other information should be displayed
2029
- this.checkSavedOther();
2030
-
2031
- }.bind(this), 50);
2032
-
2033
- },
2034
-
2035
- /**
2036
- * Complete a PayPal transaction
2037
- *
2038
- * @returns {boolean}
2039
- */
2040
- completePayPal: function (obj) {
2041
-
2042
- // Make sure the nonces are the correct way around
2043
- this.enableDisableNonce();
2044
-
2045
- // Enable the device data
2046
- this.enableDeviceData();
2047
-
2048
- if (obj.nonce && $('paypal-payment-nonce') !== null) {
2049
- $('paypal-payment-nonce').value = obj.nonce;
2050
- $('paypal-payment-nonce').setAttribute('value', obj.nonce);
2051
- } else {
2052
- console.warn('Unable to update PayPal nonce, please verify that the nonce input field has the ID: paypal-payment-nonce');
2053
- }
2054
-
2055
- // Check the callback type is a function
2056
- this.afterPayPalComplete();
2057
-
2058
- return false;
2059
- },
2060
-
2061
- /**
2062
- * Any operations that need to happen after the PayPal integration has completed
2063
- *
2064
- * @returns {boolean}
2065
- */
2066
- afterPayPalComplete: function () {
2067
- this.resetLoading();
2068
- return this.submitCheckout();
2069
- },
2070
-
2071
- /**
2072
- * Update the PayPal button, if we should add the button do so, otherwise remove it if it exists
2073
- */
2074
- updatePayPalButton: function (action, method) {
2075
-
2076
- if (this.paypalMarkUp === false) {
2077
- return false;
2078
- }
2079
-
2080
- if (action == 'refresh') {
2081
- this.updatePayPalButton('remove');
2082
- this.updatePayPalButton('add');
2083
- return true;
2084
- }
2085
-
2086
- // Check to see if we should be adding a PayPal button?
2087
- if ((this.shouldAddPayPalButton(method) && action != 'remove') || action == 'add') {
2088
-
2089
- // Hide the checkout button
2090
- if ($$(this.paypalButtonClass).first() !== undefined) {
2091
-
2092
- // Does a button already exist on the page and is visible?
2093
- if ($$('#paypal-complete').first() !== undefined && $$('#paypal-complete').first().visible()) {
2094
- return true;
2095
- }
2096
-
2097
- $$(this.paypalButtonClass).first().hide();
2098
-
2099
- // Insert out PayPal button
2100
- $$(this.paypalButtonClass).first().insert({after: this.paypalMarkUp});
2101
-
2102
- var buttonParams = {
2103
- onSuccess: this.completePayPal.bind(this),
2104
- onReady: this.paypalOnReady.bind(this)
2105
- };
2106
-
2107
- // Add in the PayPal button
2108
- this.vzeroPaypal.addPayPalButton(buttonParams, this);
2109
-
2110
- } else {
2111
- console.warn('We\'re unable to find the element ' + this.paypalButtonClass + '. Please check your integration.');
2112
- }
2113
-
2114
- } else {
2115
-
2116
- // If not we need to remove it
2117
- // Revert our madness
2118
- if ($$(this.paypalButtonClass).first() !== undefined) {
2119
- $$(this.paypalButtonClass).first().show();
2120
- }
2121
-
2122
- // Remove the PayPal element
2123
- if ($$('#paypal-complete').first() !== undefined) {
2124
- $('paypal-complete').remove();
2125
- }
2126
- }
2127
-
2128
- },
2129
-
2130
- /**
2131
- * Attach a click event handler to the button to validate the form
2132
- *
2133
- * @param integration
2134
- */
2135
- paypalOnReady: function (integration) {
2136
- return true;
2137
- },
2138
-
2139
- /**
2140
- * Set the loading state
2141
- */
2142
- setLoading: function () {
2143
- checkout.setLoadWaiting('payment');
2144
- },
2145
-
2146
- /**
2147
- * Reset the loading state
2148
- */
2149
- resetLoading: function () {
2150
- checkout.setLoadWaiting(false);
2151
- },
2152
-
2153
- /**
2154
- * Make sure the device data field isn't disabled
2155
- */
2156
- enableDeviceData: function () {
2157
- if ($('device_data') !== null) {
2158
- $('device_data').removeAttribute('disabled');
2159
- }
2160
- },
2161
-
2162
- /**
2163
- * Disable all fields in the credit card form so they don't end up going server side
2164
- */
2165
- disableCreditCardForm: function () {
2166
- $$('#credit-card-form input, #credit-card-form select').each(function (formElement) {
2167
- if (formElement.id != 'creditcard-payment-nonce' && formElement.id != 'gene_braintree_creditcard_store_in_vault') {
2168
- formElement.setAttribute('disabled', 'disabled');
2169
- }
2170
- });
2171
- },
2172
-
2173
- /**
2174
- * Re-enable the credit card form, just in case there was an error etc
2175
- */
2176
- enableCreditCardForm: function () {
2177
- $$('#credit-card-form input, #credit-card-form select').each(function (formElement) {
2178
- formElement.removeAttribute('disabled');
2179
- });
2180
- },
2181
-
2182
- /**
2183
- * Update the billing of the vZero object
2184
- *
2185
- * @returns {boolean}
2186
- */
2187
- updateBilling: function () {
2188
-
2189
- // Verify we're not using a saved address
2190
- if (($('billing-address-select') !== null && $('billing-address-select').value == '') || $('billing-address-select') === null) {
2191
-
2192
- // Grab these directly from the form and update
2193
- if ($('billing:firstname') !== null && $('billing:lastname') !== null) {
2194
- this.vzero.setBillingName($('billing:firstname').value + ' ' + $('billing:lastname').value);
2195
- }
2196
- if ($('billing:postcode') !== null) {
2197
- this.vzero.setBillingPostcode($('billing:postcode').value);
2198
- }
2199
- }
2200
- },
2201
-
2202
- /**
2203
- * Any extra data we need to pass through to the updateData call
2204
- *
2205
- * @returns {{}}
2206
- */
2207
- getUpdateDataParams: function () {
2208
- var parameters = {};
2209
-
2210
- // If the billing address is selected and we're wanting to ship to that address we need to pass the addressId
2211
- if ($('billing-address-select') !== null && $('billing-address-select').value != '') {
2212
- parameters.addressId = $('billing-address-select').value;
2213
- }
2214
-
2215
- return parameters;
2216
- },
2217
-
2218
- /**
2219
- * Return the current payment method
2220
- *
2221
- * @returns {*}
2222
- */
2223
- getPaymentMethod: function () {
2224
- return payment.currentMethod;
2225
- },
2226
-
2227
- /**
2228
- * Should we intercept the save action of the checkout
2229
- *
2230
- * @param type
2231
- * @returns {*}
2232
- */
2233
- shouldInterceptSubmit: function (type) {
2234
- switch (type) {
2235
- case 'creditcard':
2236
- return (this.getPaymentMethod() == 'gene_braintree_creditcard' && this.vzero.shouldInterceptCreditCard());
2237
- break;
2238
- case 'paypal':
2239
- return (this.getPaymentMethod() == 'gene_braintree_paypal' && this.vzero.shouldInterceptCreditCard());
2240
- break;
2241
- }
2242
- return false;
2243
- },
2244
-
2245
- /**
2246
- * Should we be adding a PayPal button?
2247
- * @returns {boolean}
2248
- */
2249
- shouldAddPayPalButton: function (method) {
2250
- return (((method ? method : this.getPaymentMethod()) == 'gene_braintree_paypal' && $('paypal-saved-accounts') === null) || ((method ? method : this.getPaymentMethod()) == 'gene_braintree_paypal' && ($$('#paypal-saved-accounts input:checked[type=radio]').first() !== undefined && $$('#paypal-saved-accounts input:checked[type=radio]').first().value == 'other')));
2251
- },
2252
-
2253
- /**
2254
- * Function to run once 3D retokenization is complete
2255
- */
2256
- threeDTokenizationComplete: function () {
2257
- this.resetLoading();
2258
- },
2259
-
2260
- /**
2261
- * Validate the entire form
2262
- *
2263
- * @returns {boolean}
2264
- */
2265
- validateAll: function () {
2266
- return true;
2267
- }
2268
-
2269
- };
2270
-
2271
- // Avoid 'console' errors in browsers that lack a console.
2272
- (function () {
2273
- var method;
2274
- var noop = function () {
2275
- };
2276
- var methods = [
2277
- 'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
2278
- 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
2279
- 'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
2280
- 'timeStamp', 'trace', 'warn'
2281
- ];
2282
- var length = methods.length;
2283
- var console = (window.console = window.console || {});
2284
-
2285
- while (length--) {
2286
- method = methods[length];
2287
-
2288
- // Only stub undefined methods.
2289
- if (!console[method]) {
2290
- console[method] = noop;
2291
- }
2292
- }
2293
- }());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/gene/braintree/vzero-integration-min.js ADDED
@@ -0,0 +1 @@
 
1
+ var vZeroIntegration=Class.create();vZeroIntegration.prototype={initialize:function(t,e,i,n,a,s,o){return vZeroIntegration.prototype.loaded?(console.error("Your checkout is including the Braintree resources multiple times, please resolve this."),!1):(vZeroIntegration.prototype.loaded=!0,this.vzero=t||!1,this.vzeroPaypal=e||!1,this.vzero===!1&&this.vzeroPaypal===!1?(console.warn("The vzero and vzeroPaypal objects are not initiated."),!1):(this.paypalWrapperMarkUp=i||!1,this.paypalButtonClass=n||!1,this.submitButtonClass=this.paypalButtonClass,this.isOnepage=a||!1,this.config=s||{},this.submitAfterPayment=o||!1,this._methodSwitchTimeout=!1,this._hostedFieldsInit=!1,document.observe("dom:loaded",function(){this.prepareSubmitObserver(),this.preparePaymentMethodSwitchObserver()}.bind(this)),this.hostedFieldsGenerated=!1,this.isOnepage&&(this.observeAjaxRequests(),document.observe("dom:loaded",function(){this.initSavedPayPal(),this.initDefaultMethod(),null!==$("braintree-hosted-submit")&&this.initHostedFields()}.bind(this))),document.observe("dom:loaded",function(){this.initSavedMethods(),null!==$("braintree-hosted-submit")&&this.initHostedFields()}.bind(this)),void this.vzero.fireEvent(this,"integration.onInit",{integration:this})))},initSavedMethods:function(){$$('#creditcard-saved-accounts input[type="radio"], #paypal-saved-accounts input[type="radio"]').each(function(t){var e="",i="";void 0!==t.up("#creditcard-saved-accounts")?(e="#creditcard-saved-accounts",i="#credit-card-form"):void 0!==t.up("#paypal-saved-accounts")&&(e="#paypal-saved-accounts",i=".paypal-info"),$(t).stopObserving("change").observe("change",function(t){return this.showHideOtherMethod(e,i)}.bind(this))}.bind(this))},showHideOtherMethod:function(t,e){void 0!==$$(t+" input:checked[type=radio]").first()&&"other"==$$(t+" input:checked[type=radio]").first().value?void 0!==$$(e).first()&&($$(e).first().show(),$$(e+" input, "+e+" select").each(function(t){t.removeAttribute("disabled")})):void 0!==$$(t+" input:checked[type=radio]").first()&&void 0!==$$(e).first()&&($$(e).first().hide(),$$(e+" input, "+e+" select").each(function(t){t.setAttribute("disabled","disabled")})),this.vzero.fireEvent(this,"integration.onShowHideOtherMethod",{parentElement:t,targetElement:e})},checkSavedOther:function(){var t="",e="";"gene_braintree_creditcard"==this.getPaymentMethod()?(t="#creditcard-saved-accounts",e="#credit-card-form"):"gene_braintree_paypal"==this.getPaymentMethod()&&(t="#paypal-saved-accounts",e=".paypal-info"),void 0!==$$(t).first()&&this.showHideOtherMethod(t,e),this.vzero.fireEvent(this,"integration.checkSavedOther")},afterPaymentMethodSwitch:function(){return!0},initHostedFields:function(){this.vzero.hostedFields&&null!==$("braintree-hosted-submit")&&(void 0!==$("braintree-hosted-submit").up("form")?(this._hostedFieldsInit=!0,this.form=$("braintree-hosted-submit").up("form"),this.vzero.initHostedFields(this)):console.error("Hosted Fields cannot be initialized as we're unable to locate the parent form."))},initDefaultMethod:function(){this.shouldAddPayPalButton(!1)&&(this.setLoading(),this.vzero.updateData(function(){this.resetLoading(),this.updatePayPalButton("add")}.bind(this))),this.afterPaymentMethodSwitch(),this.vzero.fireEvent(this,"integration.onInitDefaultMethod")},observeAjaxRequests:function(){this.vzero.observeAjaxRequests(function(){this.vzero.updateData(function(){this.isOnepage&&(this.initSavedPayPal(),this.rebuildPayPalButton(),this.checkSavedOther(),this.vzero.hostedFields&&this.initHostedFields()),this.initSavedMethods(),this.afterPaymentMethodSwitch(),this.vzero.fireEvent(this,"integration.onObserveAjaxRequests")}.bind(this))}.bind(this),"undefined"!=typeof this.config.ignoreAjax?this.config.ignoreAjax:!1)},rebuildPayPalButton:function(){null==$("paypal-container")&&this.updatePayPalButton()},initSavedPayPal:function(){void 0!==$$("#paypal-saved-accounts input[type=radio]").first()&&$("paypal-saved-accounts").on("change","input[type=radio]",function(t){this.updatePayPalButton(!1,"gene_braintree_paypal")}.bind(this))},prepareSubmitObserver:function(){return!1},beforeSubmit:function(t){return this._beforeSubmit(t)},_beforeSubmit:function(t){this.vzero.fireEvent(this,"integration.onBeforeSubmit"),this.submitAfterPayment&&$("braintree-submit-after-payment")&&$("braintree-submit-after-payment").remove(),t()},afterSubmit:function(){return this.vzero.fireEvent(this,"integration.onAfterSubmit"),!1},submit:function(t,e,i,n){this.shouldInterceptSubmit(t)&&(this.validateAll()?(this.setLoading(),this.beforeSubmit(function(){void 0!=$$('[data-genebraintree-name="number"]').first()&&this.vzero.updateCardType($$('[data-genebraintree-name="number"]').first().value),this.vzero.updateData(function(){this.updateBilling(),this.vzero.process({onSuccess:function(){if(this.enableDeviceData(),this.resetLoading(),this.afterSubmit(),this.enableDisableNonce(),this.vzero._hostedFieldsTokenGenerated=!0,this.hostedFieldsGenerated=!0,"function"==typeof e)var t=e();return this.setLoading(),t}.bind(this),onFailure:function(){return this.vzero._hostedFieldsTokenGenerated=!1,this.hostedFieldsGenerated=!1,this.resetLoading(),this.afterSubmit(),"function"==typeof i?i():void 0}.bind(this)})}.bind(this),this.getUpdateDataParams())}.bind(this))):(this.vzero._hostedFieldsTokenGenerated=!1,this.hostedFieldsGenerated=!1,this.resetLoading(),"function"==typeof n&&n()))},submitCheckout:function(){window.review&&review.save()},submitPayment:function(){payment.save&&payment.save()},enableDisableNonce:function(){"gene_braintree_creditcard"==this.getPaymentMethod()?(null!==$("creditcard-payment-nonce")&&$("creditcard-payment-nonce").removeAttribute("disabled"),null!==$("paypal-payment-nonce")&&$("paypal-payment-nonce").setAttribute("disabled","disabled")):"gene_braintree_paypal"==this.getPaymentMethod()&&(null!==$("creditcard-payment-nonce")&&$("creditcard-payment-nonce").setAttribute("disabled","disabled"),null!==$("paypal-payment-nonce")&&$("paypal-payment-nonce").removeAttribute("disabled"))},preparePaymentMethodSwitchObserver:function(){return this.defaultPaymentMethodSwitch()},defaultPaymentMethodSwitch:function(){var t=this,e=Payment.prototype.switchMethod;Payment.prototype.switchMethod=function(i){return t.paymentMethodSwitch(i),e.apply(this,arguments)}},paymentMethodSwitch:function(t){clearTimeout(this._methodSwitchTimeout),this._methodSwitchTimeout=setTimeout(function(){this.shouldAddPayPalButton(t)?this.updatePayPalButton("add",t):this.updatePayPalButton("remove",t),"gene_braintree_creditcard"==(t?t:this.getPaymentMethod())&&this.initHostedFields(),this.checkSavedOther(),this.afterPaymentMethodSwitch(),this.vzero.fireEvent(this,"integration.onPaymentMethodSwitch",{method:t})}.bind(this),50)},completePayPal:function(t){return this.enableDisableNonce(),this.enableDeviceData(),t.nonce&&null!==$("paypal-payment-nonce")?($("paypal-payment-nonce").value=t.nonce,$("paypal-payment-nonce").setAttribute("value",t.nonce)):console.warn("Unable to update PayPal nonce, please verify that the nonce input field has the ID: paypal-payment-nonce"),this.afterPayPalComplete(),!1},afterPayPalComplete:function(){return this.resetLoading(),this.submitCheckout()},getPayPalMarkUp:function(){return $("braintree-paypal-button").innerHTML},updatePayPalButton:function(t,e){if(this.paypalWrapperMarkUp===!1)return!1;if("refresh"==t)return!0;if(this.shouldAddPayPalButton(e)&&"remove"!=t||"add"==t)if(void 0!==$$(this.paypalButtonClass).first()){if($$(this.paypalButtonClass).first().hide(),void 0!==$$("#paypal-complete").first())return $$("#paypal-complete").first().show(),!0;$$(this.paypalButtonClass).first().insert({after:this.paypalWrapperMarkUp}),this.vzeroPaypal.addPayPalButton({validate:this.validateAll.bind(this),onSuccess:this.completePayPal.bind(this),onReady:this.paypalOnReady.bind(this)},this.getPayPalMarkUp(),"#paypal-container")}else console.warn("We're unable to find the element "+this.paypalButtonClass+". Please check your integration.");else void 0!==$$(this.paypalButtonClass).first()&&$$(this.paypalButtonClass).first().show(),void 0!==$$("#paypal-complete").first()&&$("paypal-complete").hide()},onReviewInit:function(){this.isOnepage||this.updatePayPalButton(),this.vzero.fireEvent(this,"integration.onReviewInit")},paypalOnReady:function(t){return!0},setLoading:function(){checkout.setLoadWaiting("payment")},resetLoading:function(){checkout.setLoadWaiting(!1)},enableDeviceData:function(){null!==$("device_data")&&$("device_data").removeAttribute("disabled")},updateBilling:function(){(null!==$("billing-address-select")&&""==$("billing-address-select").value||null===$("billing-address-select"))&&(null!==$("billing:firstname")&&null!==$("billing:lastname")&&this.vzero.setBillingName($("billing:firstname").value+" "+$("billing:lastname").value),null!==$("billing:postcode")&&this.vzero.setBillingPostcode($("billing:postcode").value))},getUpdateDataParams:function(){var t={};return null!==$("billing-address-select")&&""!=$("billing-address-select").value&&(t.addressId=$("billing-address-select").value),t},getPaymentMethod:function(){return payment.currentMethod},shouldInterceptSubmit:function(t){switch(t){case"creditcard":return"gene_braintree_creditcard"==this.getPaymentMethod()&&this.vzero.shouldInterceptCreditCard();break;case"paypal":return"gene_braintree_paypal"==this.getPaymentMethod()&&this.vzero.shouldInterceptCreditCard()}return!1},shouldAddPayPalButton:function(t){return"gene_braintree_paypal"==(t?t:this.getPaymentMethod())&&null===$("paypal-saved-accounts")||"gene_braintree_paypal"==(t?t:this.getPaymentMethod())&&void 0!==$$("#paypal-saved-accounts input:checked[type=radio]").first()&&"other"==$$("#paypal-saved-accounts input:checked[type=radio]").first().value},threeDTokenizationComplete:function(){this.resetLoading()},validateAll:function(){return!0},disableCreditCardForm:function(){},enableCreditCardForm:function(){}};
js/gene/braintree/vzero-min.js ADDED
@@ -0,0 +1 @@
 
1
+ var vZero=Class.create();vZero.prototype={initialize:function(e,t,i,n,o,s,a,r,d){this.code=e,this.clientToken=t,this.threeDSecure=i,this.hostedFields=n,o&&(this.billingName=o),s&&(this.billingPostcode=s),a&&(this.quoteUrl=a),r&&(this.tokenizeUrl=r),this._hostedFieldsTokenGenerated=!1,this.acceptedCards=!1,this._hostedFieldsTimeout=!1,this._updateDataXhr=!1,this._updateDataCallbacks=[],this._updateDataParams={},this.client=!1,this.initEvents()},initEvents:function(){this.events={onBeforeUpdateData:[],onAfterUpdateData:[],onHandleAjaxRequest:[],integration:{onInit:[],onInitDefaultMethod:[],onShowHideOtherMethod:[],onCheckSavedOther:[],onPaymentMethodSwitch:[],onReviewInit:[],onBeforeSubmit:[],onAfterSubmit:[],onObserveAjaxRequests:[]}}},observeEvent:function(e,t,i){var n=this._resolveEvent(e);void 0===n?console.warn("Event for "+e+" does not exist."):n.push({fn:t,params:i})},fireEvent:function(e,t,i){var n=this._resolveEvent(t);void 0!==n&&n.length>0&&n.each(function(t){if("function"==typeof t.fn){var arguments=[i];"object"==typeof t.params&&arguments.push(t.params),t.fn.apply(e,arguments)}})},_resolveEvent:function(e){return e.split(".").reduce(function(e,t){return e?e[t]:void 0},this.events)},getClient:function(e){this.client!==!1?"function"==typeof e&&e(this.client):braintree.client.create({authorization:this.clientToken},function(t,i){return t?void console.log(t):(this.client=i,void e(this.client))}.bind(this))},initHostedFields:function(e){return $$('iframe[name^="braintree-"]').length>0?!1:null===$("braintree-hosted-submit")?!1:(this.integration=e,this._hostedFieldsTokenGenerated=!1,clearTimeout(this._hostedFieldsTimeout),void(this._hostedFieldsTimeout=setTimeout(function(){if(this._hostedIntegration!==!1)try{this._hostedIntegration.teardown(function(){this._hostedIntegration=!1,this.setupHostedFieldsClient()}.bind(this))}catch(e){this.setupHostedFieldsClient()}else this.setupHostedFieldsClient()}.bind(this),50)))},teardownHostedFields:function(e){"undefined"!=typeof this._hostedIntegration&&this._hostedIntegration!==!1?this._hostedIntegration.teardown(function(){this._hostedIntegration=!1,"function"==typeof e&&e()}.bind(this)):"function"==typeof e&&e()},setupHostedFieldsClient:function(){return $$('iframe[name^="braintree-"]').length>0?!1:(this._hostedIntegration=!1,void this.getClient(function(e){var t={client:e,styles:this.getHostedFieldsStyles(),fields:{number:{selector:"#card-number",placeholder:"0000 0000 0000 0000"},expirationMonth:{selector:"#expiration-month",placeholder:"MM"},expirationYear:{selector:"#expiration-year",placeholder:"YY"}}};null!==$("cvv")&&(t.fields.cvv={selector:"#cvv"}),braintree.hostedFields.create(t,function(e,t){return e?void console.log(e):this.hostedFieldsOnReady(t)}.bind(this))}.bind(this)))},hostedFieldsOnReady:function(e){if(this._hostedIntegration=e,$$("#credit-card-form.loading").length&&$$("#credit-card-form.loading").first().removeClassName("loading"),this.integration.submitAfterPayment){var t=new Element("input",{type:"hidden",name:"payment[submit_after_payment]",value:1,id:"braintree-submit-after-payment"});$("payment_form_gene_braintree_creditcard").insert(t)}else $("braintree-submit-after-payment")&&$("braintree-submit-after-payment").remove();e.on("cardTypeChange",this.hostedFieldsCardTypeChange.bind(this))},getHostedFieldsStyles:function(){return"function"==typeof this.integration.getHostedFieldsStyles?this.integration.getHostedFieldsStyles():{input:{"font-size":"14pt",color:"#3A3A3A"},":focus":{color:"black"},".valid":{color:"green"},".invalid":{color:"red"}}},hostedFieldsCardTypeChange:function(e){if("undefined"!=typeof e.cards){var t={visa:"VI","american-express":"AE","master-card":"MC",discover:"DI",jcb:"JCB",maestro:"ME"};void 0!==typeof t[e.cards[0].type]?this.updateCardType(!1,t[e.cards[0].type]):this.updateCardType(!1,"card")}},hostedFieldsNonceReceived:function(e,t){this.threeDSecure?("function"==typeof this.integration.setLoading&&this.integration.setLoading(),this.updateData(function(){this.verify3dSecureNonce(e,{onSuccess:function(e){this.updateNonce(e.nonce),"function"==typeof t.onSuccess&&t.onSuccess()}.bind(this),onFailure:function(){"function"==typeof t.onFailure&&t.onFailure()}.bind(this)})}.bind(this))):(this.updateNonce(e),"function"==typeof t.onSuccess&&t.onSuccess())},updateNonce:function(e){$("creditcard-payment-nonce").value=e,$("creditcard-payment-nonce").setAttribute("value",e),"function"==typeof this.integration.resetLoading&&this.integration.resetLoading(),this._hostedFieldsTokenGenerated=!0},hostedFieldsError:function(e){return"function"==typeof this.integration.resetLoading&&this.integration.resetLoading(),"undefined"!=typeof e.message&&-1==e.message.indexOf("Cannot place two elements in")&&-1==e.message.indexOf("Unable to find element with selector")&&-1==e.message.indexOf("User did not enter a payment method")&&alert(e.message),this._hostedFieldsTokenGenerated=!1,"function"==typeof this.integration.afterHostedFieldsError&&this.integration.afterHostedFieldsError(e.message),!1},usingSavedCard:function(){return void 0!=$("creditcard-saved-accounts")&&void 0!=$$("#creditcard-saved-accounts input:checked[type=radio]").first()&&"other"!==$$("#creditcard-saved-accounts input:checked[type=radio]").first().value},usingSavedThreeDCard:function(){return this.usingSavedCard()&&$$("#creditcard-saved-accounts input:checked[type=radio]").first().hasAttribute("data-threedsecure-nonce")},setThreeDSecure:function(e){this.threeDSecure=e},setAmount:function(e){this.amount=parseFloat(e)},setBillingName:function(e){this.billingName=e},getBillingName:function(){return"object"==typeof this.billingName?this.combineElementsValues(this.billingName):this.billingName},setBillingPostcode:function(e){this.billingPostcode=e},getBillingPostcode:function(){return"object"==typeof this.billingPostcode?this.combineElementsValues(this.billingPostcode):this.billingPostcode},setAcceptedCards:function(e){this.acceptedCards=e},getBillingAddress:function(){if("function"==typeof this.integration.getBillingAddress)return this.integration.getBillingAddress();var e={};return null!==$("co-billing-form")?e="FORM"==$("co-billing-form").tagName?$("co-billing-form").serialize(!0):this.extractBilling($("co-billing-form").up("form").serialize(!0)):null!==$("billing:firstname")&&(e=this.extractBilling($("billing:firstname").up("form").serialize(!0))),e?e:void 0},extractBilling:function(e){var t={};return $H(e).each(function(e){0==e.key.indexOf("billing")&&-1==e.key.indexOf("password")&&(t[e.key]=e.value)}),t},getAcceptedCards:function(){return this.acceptedCards},combineElementsValues:function(e,t){t||(t=" ");var i=[];return e.each(function(e,t){void 0!==$(e)&&(i[t]=$(e).value)}),i.join(t)},updateCardType:function(e,t){if(void 0!=$("card-type-image")){var i=$("card-type-image").src.substring(0,$("card-type-image").src.lastIndexOf("/"));$("card-type-image").setAttribute("src",i+"/"+t+".png")}},observeAjaxRequests:function(e,t){return vZero.prototype.observingAjaxRequests?!1:(vZero.prototype.observingAjaxRequests=!0,Ajax.Responders.register({onComplete:function(i){return this.handleAjaxRequest(i.url,e,t)}.bind(this)}),void(window.jQuery&&jQuery(document).ajaxComplete(function(i,n,o){return this.handleAjaxRequest(o.url,e,t)}.bind(this))))},handleAjaxRequest:function(e,t,i){if("undefined"!=typeof i&&i instanceof Array&&i.length>0){var n=!1;if(i.each(function(t){e&&-1!=e.indexOf(t)&&(n=!0)}),n===!0)return!1}e&&-1==e.indexOf("/braintree/")&&(this.fireEvent(this,"integration.onHandleAjaxRequest",{url:e}),t?t(e):this.updateData())},updateData:function(e,t){this.fireEvent(this,"integration.onBeforeUpdateData",{params:t}),this._updateDataCallbacks.push(e),this._updateDataParams=t,this._updateDataXhr!==!1&&this._updateDataXhr.transport.abort(),this._updateDataXhr=new Ajax.Request(this.quoteUrl,{method:"post",parameters:this._updateDataParams,onSuccess:function(e){if(e&&(e.responseJSON||e.responseText)){var t=this._parseTransportAsJson(e);void 0!=t.billingName&&(this.billingName=t.billingName),void 0!=t.billingPostcode&&(this.billingPostcode=t.billingPostcode),void 0!=t.grandTotal&&(this.amount=t.grandTotal),void 0!=t.threeDSecure&&this.setThreeDSecure(t.threeDSecure),"undefined"!=typeof vzeroPaypal&&void 0!=t.grandTotal&&void 0!=t.currencyCode&&vzeroPaypal.setPricing(t.grandTotal,t.currencyCode),this._updateDataParams={},this._updateDataXhr=!1,this._updateDataCallbacks.length&&(this._updateDataCallbacks.each(function(e){e(t)}.bind(this)),this._updateDataCallbacks=[]),this.fireEvent(this,"onAfterUpdateData",{response:t})}}.bind(this),onFailure:function(){this._updateDataParams={},this._updateDataXhr=!1,this._updateDataCallbacks=[]}.bind(this)})},tokenize3dSavedCards:function(e){if(this.threeDSecure)if(void 0!==$$("[data-token]").first()){var t=[];$$("[data-token]").each(function(e,i){t[i]=e.getAttribute("data-token")}),new Ajax.Request(this.tokenizeUrl,{method:"post",onSuccess:function(t){if(t&&(t.responseJSON||t.responseText)){var i=this._parseTransportAsJson(t);i.success&&$H(i.tokens).each(function(e){void 0!=$$('[data-token="'+e.key+'"]').first()&&$$('[data-token="'+e.key+'"]').first().setAttribute("data-threedsecure-nonce",e.value)}),e&&e(i)}}.bind(this),parameters:{tokens:Object.toJSON(t)}})}else e();else e()},verify3dSecureNonce:function(e,t){this.getClient(function(i){braintree.threeDSecure.create({client:i},function(i,n){if(i)return void console.log(i);var o={amount:this.amount,nonce:e,addFrame:function(e,t){$$("#three-d-modal .bt-modal-body").first().insert(t),$("three-d-modal").removeClassName("hidden")},removeFrame:function(){$$("#three-d-modal .bt-modal-body iframe").first().remove(),$("three-d-modal").addClassName("hidden")}.bind(this)};n.verifyCard(o,function(e,i){e?t.onFailure&&t.onFailure(i,e):i.liabilityShifted?t.onSuccess&&t.onSuccess(i):i.liabilityShiftPossible})}.bind(this))}.bind(this))},verify3dSecureVault:function(e){var t=$$("#creditcard-saved-accounts input:checked[type=radio]").first().getAttribute("data-threedsecure-nonce");t?this.verify3dSecureNonce(t,{onSuccess:function(t){$("creditcard-payment-nonce").removeAttribute("disabled"),$("creditcard-payment-nonce").value=t.nonce,$("creditcard-payment-nonce").setAttribute("value",t.nonce),"function"==typeof e.onSuccess&&e.onSuccess()},onFailure:function(t,i){alert(i),"function"==typeof e.onFailure?e.onFailure():checkout.setLoadWaiting(!1)}}):(alert("No payment nonce present."),"function"==typeof e.onFailure?e.onFailure():checkout.setLoadWaiting(!1))},processCard:function(e){this._hostedIntegration.tokenize(function(t,i){return t?("function"==typeof e.onFailure?e.onFailure():checkout.setLoadWaiting(!1),void("string"==typeof t.message&&alert(t.message))):this.hostedFieldsNonceReceived(i.nonce,e)}.bind(this))},shouldInterceptCreditCard:function(){return"0.00"!=this.amount},shouldInterceptPayPal:function(){return!0},process:function(e){return e=e||{},this._hostedFieldsTokenGenerated||this.usingSavedCard()&&!this.usingSavedThreeDCard()?void("function"==typeof e.onSuccess&&e.onSuccess()):this.usingSavedThreeDCard()?this.verify3dSecureVault(e):this.processCard(e)},creditCardLoaded:function(){return!1},paypalLoaded:function(){return!1},_parseTransportAsJson:function(transport){return transport.responseJSON&&"object"==typeof transport.responseJSON?transport.responseJSON:transport.responseText?"object"==typeof JSON&&"function"==typeof JSON.parse?JSON.parse(transport.responseText):eval("("+transport.responseText+")"):{}}},function(){for(var e,t=function(){},i=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","markTimeline","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],n=i.length,o=window.console=window.console||{};n--;)e=i[n],o[e]||(o[e]=t)}();
js/gene/braintree/vzero-paypal-min.js ADDED
@@ -0,0 +1 @@
 
1
+ var vZeroPayPalButton=Class.create();vZeroPayPalButton.prototype={initialize:function(t,n,e,i,o){this.clientToken=t,this.storeFrontName=n,this.singleUse=e,this.locale=i,this.amount=0,this.currency=!1,this.client=!1},getClient:function(t){this.client!==!1?"function"==typeof t&&t(this.client):braintree.client.create({authorization:this.clientToken},function(n,e){return n?void console.log(n):(this.client=e,void t(this.client))}.bind(this))},setPricing:function(t,n){this.amount=parseFloat(t),this.currency=n},rebuildButton:function(){return!1},addPayPalButton:function(t,n,e,i){var o;if(n=n||$("braintree-paypal-button").innerHTML,e=e||"#paypal-container",i=i||!1,o="string"==typeof e?$$(e).first():e,!o)return console.warn("Unable to locate container "+e+" for PayPal button."),!1;if(i?o.insert(n):o.update(n),!o.select(">button").length)return console.warn("Unable to find valid <button /> element within container."),!1;var a=o.select(">button").first();a.addClassName("braintree-paypal-loading"),a.setAttribute("disabled","disabled"),this.attachPayPalButtonEvent(a,t)},attachPayPalButtonEvent:function(t,n){this.getClient(function(e){braintree.paypal.create({client:e},function(e,i){return e?void console.error("Error creating PayPal:",e):("function"==typeof n.onReady&&n.onReady(i),this._attachPayPalButtonEvent(t,i,n))}.bind(this))}.bind(this))},_attachPayPalButtonEvent:function(t,n,e){t&&n&&(Array.isArray(t)||(t=[t]),t.each(function(t){t.removeClassName("braintree-paypal-loading"),t.removeAttribute("disabled"),Event.stopObserving(t,"click"),Event.observe(t,"click",function(t){return Event.stop(t),"function"!=typeof e.validate?this._tokenizePayPal(n,e):e.validate()?this._tokenizePayPal(n,e):void 0}.bind(this))}.bind(this)))},_tokenizePayPal:function(t,n){t.tokenize(this._buildOptions(),function(t,e){return t?void("CUSTOMER"!==t.type&&console.error("Error tokenizing:",t)):void("function"==typeof n.onSuccess&&n.onSuccess(e))}.bind(this))},_buildOptions:function(){var t={displayName:this.storeFrontName,amount:this.amount,currency:this.currency};return this.locale&&(t.locale=this.locale),this.singleUse===!0?t.flow="checkout":t.flow="vault",t}};
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Gene_Braintree</name>
4
- <version>2.0.4</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/mit-license.php">MIT License</license>
7
  <channel>community</channel>
@@ -36,9 +36,9 @@
36
  &lt;/ul&gt;</description>
37
  <notes>Connect your Magento store to Braintree to accept Credit Cards &amp;amp; PayPal using V.Zero SDK</notes>
38
  <authors><author><name>Dave Macaulay</name><user>dave</user><email>support@gene.co.uk</email></author></authors>
39
- <date>2016-08-19</date>
40
- <time>08:44:57</time>
41
- <contents><target name="magecommunity"><dir name="Gene"><dir name="Braintree"><dir name="Block"><dir name="Adminhtml"><dir name="Report"><dir name="Transactions"><file name="Grid.php" hash="32b32086548f62ae4aca4baf456b9ed2"/><file name="Search.php" hash="81d57c3744530f36c37782ce9d0f3a70"/></dir><file name="Transactions.php" hash="7afe45b49353e52b432aa0392d76a08e"/></dir><dir name="System"><dir name="Config"><dir name="Braintree"><file name="Config.php" hash="9a7b4dac33799961712b98094e4fd6ff"/><file name="Currency.php" hash="5855bb4e1eff5c095b07666baaa9e0e0"/><dir name="Kount"><file name="Ens.php" hash="56ef3f1e4da9d09b6bc8d0814a882358"/></dir><file name="Migration.php" hash="e967c3a0e07d510c6aac12c88a27a098"/><file name="Moduleversion.php" hash="b74179be6853486ad2801c29c0ea830d"/><file name="Version.php" hash="9b12af242a8e96018554b35cd3a51a4d"/></dir><file name="Migration.php" hash="e3c31756ea93ed40322583b5afb10cc1"/></dir></dir></dir><dir name="Cart"><file name="Totals.php" hash="55d1ce06bc84c9229f4f245e5aee8edd"/></dir><dir name="Creditcard"><file name="Info.php" hash="1d069fc769a1478532634978ce550aa6"/><file name="Saved.php" hash="2d0a3c3543d8eecc7c94a50cea7810d9"/><file name="Threedsecure.php" hash="7848d4ecac743be985f328fa969318bf"/></dir><file name="Creditcard.php" hash="7871f210f4009cfe53ecfaf5164e43ca"/><dir name="Express"><file name="Button.php" hash="a2bad201e114d02164c21c726ca93d7e"/><file name="Checkout.php" hash="d0c9bc6f656e93031189e7d6bb1c8533"/></dir><file name="Info.php" hash="8891038708e60a3e1974e007c2a32de1"/><file name="Js.php" hash="35e604171e4a5d1250732c4a5ad33d9b"/><dir name="Paypal"><file name="Info.php" hash="be437bd72ca057fc641ce8ce79f475cc"/><file name="Saved.php" hash="6a99ef8a384d7ab8f4537e995867ec85"/></dir><file name="Paypal.php" hash="10cbb40f8801153ac0c04725843f4eee"/><dir name="Saved"><file name="Edit.php" hash="ae2d80ecab7cdda39b18054b057f2dc5"/></dir><file name="Saved.php" hash="782f17589219da087e57035a1c0b9a4a"/></dir><dir name="Helper"><file name="Data.php" hash="afd45e51f380acb08e2027348c3a2375"/></dir><dir name="Model"><file name="Debug.php" hash="f3360f71e2346881f93424792ed9f209"/><dir name="Entity"><file name="Setup.php" hash="c580e73ec53ac455698ee6b0ff005e39"/></dir><dir name="Kount"><file name="Ens.php" hash="3f672b000d43363406b1df7e2b52f620"/><file name="Rest.php" hash="5dfb5265a431da0210cb87dba023b7b6"/></dir><file name="Migration.php" hash="595f2f2d03b78ab057436609c8a73261"/><file name="Observer.php" hash="e1ac13f65517ef889cc41fc8b421cafb"/><dir name="Paymentmethod"><file name="Abstract.php" hash="d6c2a980770c401b5f311329198e2050"/><file name="Creditcard.php" hash="7d3f7f9660fd34453bbafeeb32918839"/><dir name="Legacy"><file name="Creditcard.php" hash="d31335cd41e72c54eccbe608e7257e02"/><file name="Paypal.php" hash="f929b4917e09007b226e6387bf4e1a22"/></dir><file name="Paypal.php" hash="08662de034dea524c2bb08a2493627b9"/></dir><file name="Saved.php" hash="3c9318122fbe56bdb915c837d834f392"/><dir name="Source"><file name="Cctype.php" hash="d76aa6c3a4bd798e3a47695f579d21d4"/><dir name="Creditcard"><file name="CaptureAction.php" hash="d39ff81be4b54620410ceeda7f960f0f"/><file name="FormIntegration.php" hash="9788f349430e0d48c9e13c262da3fe06"/><file name="PaymentAction.php" hash="d6e997ae4f6ed57129bf4d5da06a0a82"/></dir><file name="Environment.php" hash="5c2f5ce4d6d9f6f178102b90ec15aa2c"/><dir name="Paypal"><file name="CaptureAction.php" hash="0dd0c6da578aee4b7508f78cab982176"/><file name="Locale.php" hash="adc0ab30619eb3a34d8f5fe1087b07b0"/><file name="PaymentAction.php" hash="ab430eaf7ced39e9d6fd80ad0a7f6b3c"/><file name="Paymenttype.php" hash="48225fa7b3f5e54d81711397dd5bd96b"/></dir></dir><dir name="System"><dir name="Config"><dir name="Backend"><file name="Currency.php" hash="73cb15b1de303e88c487db4c585ef94e"/></dir></dir></dir><dir name="Wrapper"><file name="Braintree.php" hash="34aa7eaa4f3c26dbafae27679e7349ad"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Braintree"><file name="MigrationController.php" hash="84323fa4665ece605f6b8e906d0edd40"/></dir><file name="BraintreeController.php" hash="d7ece21342a7b4b37ee41ea0e7ff20ad"/></dir><file name="CheckoutController.php" hash="223de3639574a686a68e9210f39c1fad"/><file name="ExpressController.php" hash="89aaef3ec80d0793e918a3674139b4f6"/><dir name="Kount"><file name="EnsController.php" hash="1db795afa1df901c37bbe48a3f01db2f"/></dir><file name="SavedController.php" hash="083777b1536e8dda604107af9f0081a9"/></dir><dir name="etc"><file name="adminhtml.xml" hash="c9c940beffa0ec19e4a1499a66f7fd12"/><file name="config.xml" hash="7e86e8f0f9d1c02bf791fa4745d1d0be"/><file name="system.xml" hash="736a1ab8d3ab8f462fe9d93ed3dee386"/></dir><dir name="sql"><dir name="gene_braintree_setup"><file name="install-0.1.0.php" hash="503f428384f687d3f55a19ea57450212"/><file name="upgrade-1.0.5.4-2.0.0.php" hash="62d37c35ba39a77ea14cad842f143393"/><file name="upgrade-2.0.0-2.0.1.php" hash="a08927707bb43a5c22b3b6ce3dd7a3c7"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="gene"><file name="braintree.xml" hash="97cf1ff702b5fe0697bcb0d725f37e6b"/></dir></dir><dir name="template"><dir name="gene"><dir name="braintree"><dir name="creditcard"><file name="hostedfields.phtml" hash="bfa98d63527cba0990c5cd793325a013"/><file name="info.phtml" hash="2ae1e397b3a633dd305bc26c7b9c1065"/><file name="saved.phtml" hash="579ec8ca726de3b5bea8600663d1e61f"/><file name="threedsecure.phtml" hash="ee8ad689afde041c39dd92ffa5274883"/></dir><file name="creditcard.phtml" hash="2cf07e28ebd141ea73e6e9082096304e"/><dir name="customer"><file name="edit.phtml" hash="ed8a9533f07fbfa36ec78623afd1a04d"/><file name="methods.phtml" hash="794ad8cb20314d1657a746b365c82540"/><file name="saved.phtml" hash="0457b0fa38f9db788133e54f359baa63"/></dir><dir name="express"><file name="cart.phtml" hash="dc6546baaa5c0c37fe3a6221ed978e87"/><file name="catalog.phtml" hash="e24ee8a37661e4cc82c19aaae3b669c3"/><file name="error.phtml" hash="0ec2ea2f9b909d9f0543e5df83eea055"/><file name="shipping_details.phtml" hash="0bb6ceafaac0ba522278df310d6136e2"/></dir><dir name="js"><file name="aheadworks.phtml" hash="533ba9aebbba6768649668386a74a1c2"/><file name="amasty.phtml" hash="2bfc5623dd9a98721b53a4d8cd13c0c3"/><file name="awesomecheckout.phtml" hash="ee42abb3b9211a31b3d4454ba1e92fe9"/><file name="data.phtml" hash="f8b04e3d0d7154cc75332eb5bec3e54e"/><file name="default.phtml" hash="fdcfb27a06ebab20268ef4ed820625c1"/><file name="fancycheckout.phtml" hash="f603bcd50dea98dbb45c1ec8b692314c"/><file name="firecheckout.phtml" hash="6186cba208f62227be17bb9ade5fa8f5"/><file name="fme.phtml" hash="263fb201b77696cf21cc677696c53fdd"/><file name="idev.phtml" hash="89d7effae80ca1a02f15b4326fd7e433"/><file name="iwd.phtml" hash="d7e12c84b629306529d3d8beb0c4814d"/><file name="magestore.phtml" hash="ff6a622a4048b8e533f3e672a40e6296"/><file name="multishipping.phtml" hash="a1e777e99df26d81f7c4b9e7b4a7c109"/><file name="oye.phtml" hash="51ef48f818e79acb6d1e8b9eb7889cc9"/><file name="setup.phtml" hash="804d63a30f8d6c985644b545a768da97"/><file name="unicode.phtml" hash="dd07e924a01b0a28ef46c9a62f22e3b5"/></dir><dir name="paypal"><file name="info.phtml" hash="5149b273730121e4dec3c3179820f747"/><file name="saved.phtml" hash="3dd56f96bcdd14be594d355ae8fff329"/></dir><file name="paypal.phtml" hash="d12c20e5fb76f31270a5d47061e42715"/></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="gene"><file name="braintree.xml" hash="7f7616030d3c67f20fccd618a1459d56"/></dir></dir><dir name="template"><dir name="gene"><dir name="braintree"><dir name="creditcard"><file name="hostedfields.phtml" hash="152e09ed938c47ffc056a7c11247375a"/><file name="info.phtml" hash="958d514582e3de1f91f5e0f7a7169b47"/><file name="saved.phtml" hash="ca27adb601aebf97cd25a892082a8663"/></dir><file name="creditcard.phtml" hash="2d77487c6b7e9e6c77b2ddb25597bd8b"/><file name="js.phtml" hash="7253799710792ed1f8611e21c2b100bf"/><dir name="paypal"><file name="info.phtml" hash="0485ea82dc9cc8ebea092b378672f1cd"/><file name="saved.phtml" hash="779ca8e907d7d463eafce58dfaf94f0c"/></dir><file name="paypal.phtml" hash="f81578f64c8a30560299bd993d8e996d"/><dir name="system"><dir name="config"><file name="migration.phtml" hash="8ef2a5e5561d7909d065c987ded5e592"/></dir></dir><dir name="transactions"><file name="index.phtml" hash="1791b6393f319616dd79c0b46e391847"/><file name="search.phtml" hash="1682ce6200681681f0ce3c848e2e6694"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Gene_Braintree.xml" hash="8c0ffda8566dca2f0b98a999921e3e55"/></dir></target><target name="mageweb"><dir name="js"><dir name="gene"><dir name="braintree"><file name="braintree-0.1.js" hash="a72cc4545d0d01dd0947dae1474516dd"/><file name="config.codekit" hash="8c25da6033637f712e9b84926ce496a6"/><file name="express.js" hash="a32735940fb8313c150e6567a59a1f0e"/><file name="vzero-0.7-min.js" hash="67f02f3f52819c5af8db913d7780dc33"/><file name="vzero-0.7-min.js.map" hash="1fc5d50c5cdcb138131930ac92362053"/><file name="vzero-0.7.js" hash="9df7e368f0ba3d900940cec112f56dc1"/></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="gene"><dir name="braintree"><file name="AE.png" hash="6b6f405105413b0723a62ee498f88bf6"/><file name="DI.png" hash="d8e3c3022dda9e723f466b8976ae428f"/><file name="JCB.png" hash="3aa9a71ed8a1d6610bbe0dfe2040e29e"/><file name="MC.png" hash="1fcd14928245139962b72f9368bdbe32"/><file name="ME.png" hash="b9389913c47b9546a67f907fcca73706"/><file name="PP.png" hash="b4946bccba574e86c9716a4986e21c36"/><file name="VI.png" hash="c9f74d1d54e61ab2c748f45a4bdface0"/><file name="card.png" hash="66e16f8c573fad93bb0d62258dce28bb"/><file name="paypal-loading.gif" hash="078a2daf55245b227c09a7bed86750c6"/><file name="paypal.png" hash="40d5f74305e565bd14aef19bcf696541"/></dir><file name="loader.gif" hash="f48ee069890b16455c3ddcacee9b5f75"/><file name="loader-white.gif" hash="1fc0e911558e8dfe77cfdfafa0d38f88"/></dir></dir><dir name="css"><dir name="gene"><dir name="braintree"><dir name="account"><file name="account.less" hash="ddf6bf208f290316300ab20682f34473"/></dir><file name="account.css" hash="73bb46f85320b2f2b4de9beb6c0e0bd6"/><file name="aheadworks.css" hash="f5a06971e4dbac94df48fb0ff1912f98"/><file name="amasty.css" hash="5a4a845ea4a16cca2195cb836e25571e"/><file name="awesomecheckout.css" hash="5f858ec9549f6b04b0c2885fbf193e7b"/><file name="config.codekit" hash="84437b4cfe51c10615b8f58c083e36dd"/><dir name="core"><file name="_general.less" hash="5848708373d8ed5eda5e5b23c3e4e05c"/><file name="_hostedfields.less" hash="555bd4655d78a3b379c4b86a3e2d86e5"/><file name="_paypal.less" hash="e7e55d959247956253a0af1df0c9e899"/><file name="_saved.less" hash="66ec8d894e336f9934a1e54972c4b220"/></dir><file name="default.css" hash="229df9c1e39496d64a96c1b17e7a1823"/><file name="express.css" hash="23fdeca7804baa026615f4e54eeaf66b"/><file name="express.less" hash="0d752abca5f300beadc5a2948b5565ae"/><file name="fancycheckout.css" hash="69b7d8ce592bffde444edf77234109bd"/><file name="firecheckout.css" hash="6605fd097c6b509fd8ef758a5a2ea236"/><file name="fme.css" hash="5809c809abc0cc6dde9ff2accebe4f38"/><file name="idev.css" hash="89104fad2a084ec8ed229d119d9c276c"/><dir name="integrations"><file name="aheadworks.less" hash="09b0304383e198885f030119c15641f7"/><file name="amasty.less" hash="4cdf236e1d44112205750cefa11448b4"/><file name="awesomecheckout.less" hash="e774da637a5c6bbdb2e5decc998afae1"/><file name="default.less" hash="d366d4560ed1ce3e9e120309e56bec2f"/><file name="fancycheckout.less" hash="18281c460bb32da164964abe585b092b"/><file name="firecheckout.less" hash="459704b8b6efca52fcee7c335b3ad625"/><file name="fme.less" hash="580ed66608560fcd1195246c22e3559c"/><file name="idev.less" hash="47485cc963e16d12e673c06cd9efe4b1"/><file name="iwd.less" hash="5081477c7946e0f5cf8cc4198895ca11"/><file name="magestore.less" hash="0af5cd105be3995dc2044d33f990bbb5"/><file name="oye.less" hash="06a0f79190b16dfbce3aec6d14f07461"/><file name="unicode.less" hash="1416abe9a38965d9aead022b238f7d4f"/></dir><file name="iwd.css" hash="651ba890cc76d1f9fdaa7d6137b2a106"/><file name="magestore.css" hash="fdeca676628bd2e1c732a15640a42ff3"/><file name="oye.css" hash="ec24b4a2541dd3d01540d1f065025d7b"/><file name="unicode.css" hash="82acd70dca47bb484a17296c2ca11e81"/><file name=".DS_Store" hash="1405352d803d5c88cf3ec19a82f173d0"/></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><dir name="gene"><dir name="braintree"><file name="adminhtml.css" hash="affb40183f3620e4ee157daf613dc2a9"/><file name="adminhtml.less" hash="b3a4d504055c85d872c5b9544d192840"/><file name="config.codekit" hash="ddde6e8364c5adb1b88c7104c873eb01"/><file name="migration.css" hash="158e143a99028313d6ad6f6612112dd4"/><file name="migration.less" hash="bbf09530cf530f78f4a7c3229194c5ff"/><file name=".DS_Store" hash="63617e9dd9988a3d3773937a3f7e2f9a"/></dir></dir></dir><dir name="images"><dir name="gene"><dir name="braintree"><file name="AE.png" hash="6b6f405105413b0723a62ee498f88bf6"/><file name="DI.png" hash="d8e3c3022dda9e723f466b8976ae428f"/><file name="JCB.png" hash="3aa9a71ed8a1d6610bbe0dfe2040e29e"/><file name="MC.png" hash="1fcd14928245139962b72f9368bdbe32"/><file name="ME.png" hash="b9389913c47b9546a67f907fcca73706"/><file name="PP.png" hash="b4946bccba574e86c9716a4986e21c36"/><file name="VI.png" hash="c9f74d1d54e61ab2c748f45a4bdface0"/><file name="card.png" hash="66e16f8c573fad93bb0d62258dce28bb"/><dir name="migration"><file name="braintree.png" hash="396d721824a86b169ce0055090ce9766"/><file name="gene-logo.png" hash="16efb1b148acc59c46c84a21d726b6e9"/><file name="loader.gif" hash="66b9100930b8e58d46acf2e13d41f7ea"/></dir></dir><file name="loader.gif" hash="f48ee069890b16455c3ddcacee9b5f75"/></dir></dir></dir></dir></dir></target><target name="magelib"><dir name="Gene"><dir name="Braintree"><file name="AddOn.php" hash="e8bbb6db343ba99192346b1dcbf45677"/><file name="AddOnGateway.php" hash="d8698ffe89c01fba78a8a06a2fc68122"/><file name="Address.php" hash="004d3d36d39fc6fcc3d510f4b15b1fca"/><file name="AddressGateway.php" hash="41b5a3be7bdb2fe326a49a1554e1b0c3"/><file name="AndroidPayCard.php" hash="bb4a81807fefc76db286e615128c5d8c"/><file name="ApplePayCard.php" hash="b895256bcb867854bcaaffc1ce833fbd"/><file name="Base.php" hash="60d52fd1bef5655bcb607fba45bb4c1c"/><file name="ClientToken.php" hash="358c0a1dba687baf635db818cb7d1dac"/><file name="ClientTokenGateway.php" hash="9c24bb9de2c419c7e377c046da2a1ffa"/><file name="CoinbaseAccount.php" hash="ee5cb6963f675a9a71293c453b128866"/><file name="Collection.php" hash="0e7d31ffcbd9780fb554186bd2c194b0"/><file name="Configuration.php" hash="2a416a1eae0c22329d9bef88b25039b2"/><file name="CredentialsParser.php" hash="c4bb2248a33129d8523a6120ce44108b"/><file name="CreditCard.php" hash="d32b8d8e64b2d046d3d9e4f00c67f1ed"/><file name="CreditCardGateway.php" hash="0d120ed06f06fd614468d6e3f0ad22d2"/><file name="CreditCardVerification.php" hash="48d6ea546914278f4bea2fefb75e7836"/><file name="CreditCardVerificationGateway.php" hash="6a07430c9437f6e6c1516d5b4572a749"/><file name="CreditCardVerificationSearch.php" hash="18efe7d508c2bd5fea1c0e68fc26182f"/><file name="Customer.php" hash="62d0937de86f7a14a512ad66edba7569"/><file name="CustomerGateway.php" hash="5367d9d8a878572106e3a94c60132b1b"/><file name="CustomerSearch.php" hash="8aacc83dac341cd9afec5a3deab17593"/><file name="Descriptor.php" hash="3f5db5e817280ce7f2fa18a205281ad9"/><file name="Digest.php" hash="9d12d067770f55b123b8498fce4478fa"/><file name="Disbursement.php" hash="ad122f0f33b27dfd98bcdd38ea138ae4"/><file name="DisbursementDetails.php" hash="ae632207d0982e288a83aed401c880d9"/><file name="Discount.php" hash="763b3f9cde0ff3af3e8795cac4097595"/><file name="DiscountGateway.php" hash="47796edb8ac2fa68e9af8fb8a13aacb1"/><dir name="Dispute"><file name="TransactionDetails.php" hash="7fdea673a1295055508f42286ad57f4e"/></dir><file name="Dispute.php" hash="c3a4e93fa2b3b0e20ddcb593dcdc7b2b"/><file name="EqualityNode.php" hash="cfd6aa184186233b8d6d1ec0f0e79298"/><dir name="Error"><file name="Codes.php" hash="a7f98ff690e725b7fcd198b4b22d0637"/><file name="ErrorCollection.php" hash="e28d638db56524f5bf3609fa725e6d55"/><file name="Validation.php" hash="bf4e2198300019c52ba56f16269d66ce"/><file name="ValidationErrorCollection.php" hash="9ef25d0126a0b4f6951da5334ae6f0dc"/></dir><file name="EuropeBankAccount.php" hash="82ae4f4d1c45ce2c421305bf9397c866"/><dir name="Exception"><file name="Authentication.php" hash="f9e13654988452cca2ac5228a80adae4"/><file name="Authorization.php" hash="5f8c017c6e9fd79a556dade8e15a72e8"/><file name="Configuration.php" hash="b50f67e8ea36cff0d9f6ad718126c6fc"/><file name="DownForMaintenance.php" hash="7fd30b1f8976ed7e38b7e9fae5c20f03"/><file name="ForgedQueryString.php" hash="6884dbae1e86767834b77c821df2db62"/><file name="InvalidChallenge.php" hash="1c283a1c9dac65feb137594d0dcf0e35"/><file name="InvalidSignature.php" hash="b83f5b16735cb3a8e0a8111c4f32711e"/><file name="NotFound.php" hash="f832f771d20b381c2780eb2a572b9f44"/><file name="SSLCaFileNotFound.php" hash="e927c7307bf1761814dc8a755238070d"/><file name="SSLCertificate.php" hash="d509b6a6206bd7c5563ac142dfe3801f"/><file name="ServerError.php" hash="b4645290229ab228a257047d08ef63d7"/><file name="TestOperationPerformedInProduction.php" hash="fde4c6a8b708420b26785fb67a2548ef"/><file name="Unexpected.php" hash="01ea2800fb91995ec2a15aee5024611e"/><file name="UpgradeRequired.php" hash="7f40b174df891cc3b3e206d1be884a58"/><file name="ValidationsFailed.php" hash="cd2d30c69911f81b55279c3d6bf88c61"/></dir><file name="Exception.php" hash="f14c94bf67206184eb3e4e7aeb4a608a"/><file name="Gateway.php" hash="d2fac69479243ef4cea7d7a8add798f7"/><file name="Http.php" hash="1baa32e0efcae13c4d6294d1233512a1"/><file name="Instance.php" hash="f0603b3f9213b53687e079c5621ac8f3"/><file name="IsNode.php" hash="e4b1f7bbfcbd24b1d08b97f94df592be"/><file name="KeyValueNode.php" hash="255595ec01a16906dd0c49faf67d9efb"/><file name="Merchant.php" hash="5053ebe889c854d11f2686bffdeb58be"/><dir name="MerchantAccount"><file name="AddressDetails.php" hash="1d265d864a884ebcf2504f55207cc0dd"/><file name="BusinessDetails.php" hash="3e80148bac9fda676844aa19d5b2dc28"/><file name="FundingDetails.php" hash="7368f653fcbcc3d87924447b1763e616"/><file name="IndividualDetails.php" hash="777b6f28f643e78616c7ed753a39c0cd"/></dir><file name="MerchantAccount.php" hash="496c93182d824bb2967cc9366dec1ac3"/><file name="MerchantAccountGateway.php" hash="e2073aff6f8b3c5f2e64b23b210c44f7"/><file name="MerchantGateway.php" hash="e0a2e3a28c68dac8bd082973b269ed1b"/><file name="Modification.php" hash="0abe992d4f821327f617ca883c4eb2d1"/><file name="MultipleValueNode.php" hash="92700fa03011eaa9561010b3a160449c"/><file name="MultipleValueOrTextNode.php" hash="ef06bac18e2bc40974bdc0bcb854890f"/><file name="OAuthCredentials.php" hash="e992dca9dfedb27e3d050af55971a968"/><file name="OAuthGateway.php" hash="9a0b2b692eaf8fb5f337922044b20cc1"/><file name="PartialMatchNode.php" hash="370c7e0ab8a445cfeef6b19ef1755f4d"/><file name="PartnerMerchant.php" hash="bdb69ebdc75d67009710be9703a47e80"/><file name="PayPalAccount.php" hash="672a7d424f94e590c5e66a21e62d7bc2"/><file name="PayPalAccountGateway.php" hash="d73f5744ebaca6cc882c42d0e9c1a05e"/><file name="PaymentInstrumentType.php" hash="be97a30c7d8fbbb180864dc4efea71f2"/><file name="PaymentMethod.php" hash="5bc31d3e97610e7218c95aba2422cc9a"/><file name="PaymentMethodGateway.php" hash="4c93b070cb79c86ec9384e069fbae777"/><file name="PaymentMethodNonce.php" hash="e99302e2468f55c8fb4b2ceeb1bce68e"/><file name="PaymentMethodNonceGateway.php" hash="22a0d89eee071a28b530c6be477dcc6e"/><file name="Plan.php" hash="22ab0117d462352aecb9531d4a26619e"/><file name="PlanGateway.php" hash="95e093b55ad20f8b652ee5f2fc2a0fcf"/><file name="RangeNode.php" hash="4ad9a92547423b3d54d69097114c3daf"/><file name="ResourceCollection.php" hash="8f437cb5014148c0e2f6049347ae795c"/><dir name="Result"><file name="CreditCardVerification.php" hash="7c41787025ec7cffb269f53e3ce479e2"/><file name="Error.php" hash="0e0460f1eea017bc7591e05351f51eb0"/><file name="Successful.php" hash="03f1c379fcedaef499296ab7778d1e36"/></dir><file name="RiskData.php" hash="8bef1074f9f1c50c841a7c7cf627c9cf"/><file name="SettlementBatchSummary.php" hash="388d88e8cea7bec61ee78f388fb78c2c"/><file name="SettlementBatchSummaryGateway.php" hash="bc54658b75fa0505e072331799c2d9ad"/><file name="SignatureService.php" hash="4b78d3e5897e715dcc877c5f65b3cfae"/><dir name="Subscription"><file name="StatusDetails.php" hash="29e375f02150bfd7147591f0eb27cb4f"/></dir><file name="Subscription.php" hash="cde05aa61192d5b930b57330db308835"/><file name="SubscriptionGateway.php" hash="bd1b2aa2d4d41a595463bead64ed34e0"/><file name="SubscriptionSearch.php" hash="1874ebe5cb42d7d2836617810cced1af"/><dir name="Test"><file name="CreditCardNumbers.php" hash="676a9100354eb679e7ca1e0f0d67293f"/><file name="MerchantAccount.php" hash="612e7e30cca364c0d14cbff3b54ebf3f"/><file name="Nonces.php" hash="d39c75e07c12c005c837c33003cb9ec2"/><file name="Transaction.php" hash="f7ef8730ede38eda778679c7056ae7c7"/><file name="TransactionAmounts.php" hash="ed9bf1f57d871542c32d11de9e031f05"/><file name="VenmoSdk.php" hash="6ce94deccd1f968596011487c7e69cc7"/></dir><file name="TestingGateway.php" hash="ccb1126142799ac3dc9f8d6f1a1f48d4"/><file name="TextNode.php" hash="94c95ec9645de57acace2179fef7fb43"/><file name="ThreeDSecureInfo.php" hash="542550c4e03a24551d00e8aad5493035"/><dir name="Transaction"><file name="AddressDetails.php" hash="ff52a4a48248085b7ea92e992160e413"/><file name="AndroidPayCardDetails.php" hash="0d7716a3c992dfb0833e7ecd437ef346"/><file name="ApplePayCardDetails.php" hash="23f7ba70521889585fa40f4f0388524d"/><file name="CoinbaseDetails.php" hash="d19a625f8de98698b8277c25660358f0"/><file name="CreditCardDetails.php" hash="aac5eb1f5804d4f979b9c71f7b98cb36"/><file name="CustomerDetails.php" hash="e137895c646127312be44292c84a2d81"/><file name="EuropeBankAccountDetails.php" hash="afe4fdc3ab3714ef2995f514ce2be2a6"/><file name="PayPalDetails.php" hash="06903d1ee21879f7329b920138df9ac6"/><file name="StatusDetails.php" hash="7c6e719c51bf13bdfd07615030100ac6"/><file name="SubscriptionDetails.php" hash="1cf1f511d1545a2e27b8d3f4bee800ca"/></dir><file name="Transaction.php" hash="afe5d8ef7fc73633424d26b942c4e5a1"/><file name="TransactionGateway.php" hash="39684956db79fe58891876e5c7845413"/><file name="TransactionSearch.php" hash="aa58846182b909fb8747e165ec7e9b92"/><file name="TransparentRedirect.php" hash="154c9850be5175a5cd1b35bdf78ae939"/><file name="TransparentRedirectGateway.php" hash="5ead181bf0d5484db5eb305efa13bec4"/><file name="UnknownPaymentMethod.php" hash="9107498774ab5bc2b25de98838736b47"/><file name="Util.php" hash="9832a44da18b97a55248cadc4bb9a4ad"/><file name="Version.php" hash="43e074bc53780cb92af4a9ef4887c63e"/><file name="WebhookNotification.php" hash="4097fb57d46368d903c42bb20fbd49ca"/><file name="WebhookTesting.php" hash="c40311458bb64e37b4c08eb88df37805"/><dir name="Xml"><file name="Generator.php" hash="19f9c9b9b61d4f97f65775f527ac408d"/><file name="Parser.php" hash="c06b1ae155ac7687eaa856fac472656d"/></dir><file name="Xml.php" hash="dc69e05bea21e3d1185d45d53e4747db"/></dir><file name="Braintree.php" hash="2c75cf27b3c9a6e1bc557e6b239d2594"/><dir name="ssl"><file name="api_braintreegateway_com.ca.crt" hash="04beb23c767547e980c76eb68c7eab15"/><file name="sandbox_braintreegateway_com.ca.crt" hash="f1b529883c7c2cbb4251658f5da7b4c9"/></dir></dir></target><target name="magelocale"><dir><dir name="en_US"><file name="Gene_Braintree.csv" hash="b0c520cbdf0f42b11c8c6dfafbe999bd"/></dir></dir></target></contents>
42
  <compatible/>
43
  <dependencies><required><php><min>5.4.0</min><max>6.0.0</max></php><package><name></name><channel>connect.magentocommerce.com/core</channel><min></min><max></max></package></required></dependencies>
44
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Gene_Braintree</name>
4
+ <version>2.1.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/mit-license.php">MIT License</license>
7
  <channel>community</channel>
36
  &lt;/ul&gt;</description>
37
  <notes>Connect your Magento store to Braintree to accept Credit Cards &amp;amp; PayPal using V.Zero SDK</notes>
38
  <authors><author><name>Dave Macaulay</name><user>dave</user><email>support@gene.co.uk</email></author></authors>
39
+ <date>2016-10-20</date>
40
+ <time>14:51:00</time>
41
+ <contents><target name="magecommunity"><dir name="Gene"><dir name="Braintree"><dir name="Block"><dir name="Adminhtml"><dir name="Report"><dir name="Transactions"><file name="Grid.php" hash="32b32086548f62ae4aca4baf456b9ed2"/><file name="Search.php" hash="81d57c3744530f36c37782ce9d0f3a70"/></dir><file name="Transactions.php" hash="7afe45b49353e52b432aa0392d76a08e"/></dir><dir name="System"><dir name="Config"><dir name="Braintree"><file name="Config.php" hash="9a7b4dac33799961712b98094e4fd6ff"/><file name="Currency.php" hash="5855bb4e1eff5c095b07666baaa9e0e0"/><dir name="Kount"><file name="Ens.php" hash="56ef3f1e4da9d09b6bc8d0814a882358"/></dir><file name="Migration.php" hash="e967c3a0e07d510c6aac12c88a27a098"/><file name="Moduleversion.php" hash="b74179be6853486ad2801c29c0ea830d"/><file name="Version.php" hash="9b12af242a8e96018554b35cd3a51a4d"/></dir><file name="Migration.php" hash="e3c31756ea93ed40322583b5afb10cc1"/></dir></dir></dir><dir name="Cart"><file name="Totals.php" hash="55d1ce06bc84c9229f4f245e5aee8edd"/></dir><dir name="Creditcard"><file name="Info.php" hash="1d069fc769a1478532634978ce550aa6"/><file name="Saved.php" hash="2d0a3c3543d8eecc7c94a50cea7810d9"/><file name="Threedsecure.php" hash="7848d4ecac743be985f328fa969318bf"/></dir><file name="Creditcard.php" hash="7871f210f4009cfe53ecfaf5164e43ca"/><dir name="Express"><file name="Button.php" hash="c4ef78dd3a7b383cc8585e00467dbeac"/><file name="Checkout.php" hash="d0c9bc6f656e93031189e7d6bb1c8533"/><file name="Setup.php" hash="4c839a5e563f8f11c39c53378021d92e"/></dir><file name="Info.php" hash="8891038708e60a3e1974e007c2a32de1"/><file name="Js.php" hash="35e604171e4a5d1250732c4a5ad33d9b"/><dir name="Paypal"><file name="Info.php" hash="be437bd72ca057fc641ce8ce79f475cc"/><file name="Saved.php" hash="6a99ef8a384d7ab8f4537e995867ec85"/></dir><file name="Paypal.php" hash="10cbb40f8801153ac0c04725843f4eee"/><dir name="Saved"><file name="Edit.php" hash="ae2d80ecab7cdda39b18054b057f2dc5"/></dir><file name="Saved.php" hash="782f17589219da087e57035a1c0b9a4a"/></dir><dir name="Helper"><file name="Data.php" hash="afd45e51f380acb08e2027348c3a2375"/></dir><dir name="Model"><file name="Debug.php" hash="f3360f71e2346881f93424792ed9f209"/><dir name="Entity"><file name="Setup.php" hash="c580e73ec53ac455698ee6b0ff005e39"/></dir><dir name="Kount"><file name="Ens.php" hash="3f672b000d43363406b1df7e2b52f620"/><file name="Rest.php" hash="5dfb5265a431da0210cb87dba023b7b6"/></dir><file name="Migration.php" hash="595f2f2d03b78ab057436609c8a73261"/><file name="Observer.php" hash="3a12ef11e54a34fe5edb8bebdfcc2dba"/><dir name="Paymentmethod"><file name="Abstract.php" hash="d6c2a980770c401b5f311329198e2050"/><file name="Creditcard.php" hash="b072cdb40d3bc58d283b664ce7632fd6"/><dir name="Legacy"><file name="Creditcard.php" hash="d31335cd41e72c54eccbe608e7257e02"/><file name="Paypal.php" hash="f929b4917e09007b226e6387bf4e1a22"/></dir><file name="Paypal.php" hash="08662de034dea524c2bb08a2493627b9"/></dir><file name="Saved.php" hash="3c9318122fbe56bdb915c837d834f392"/><dir name="Source"><file name="Cctype.php" hash="d76aa6c3a4bd798e3a47695f579d21d4"/><dir name="Creditcard"><file name="CaptureAction.php" hash="d39ff81be4b54620410ceeda7f960f0f"/><file name="FormIntegration.php" hash="9788f349430e0d48c9e13c262da3fe06"/><file name="PaymentAction.php" hash="d6e997ae4f6ed57129bf4d5da06a0a82"/></dir><file name="Environment.php" hash="5c2f5ce4d6d9f6f178102b90ec15aa2c"/><dir name="Paypal"><file name="CaptureAction.php" hash="0dd0c6da578aee4b7508f78cab982176"/><file name="Locale.php" hash="adc0ab30619eb3a34d8f5fe1087b07b0"/><file name="PaymentAction.php" hash="ab430eaf7ced39e9d6fd80ad0a7f6b3c"/><file name="Paymenttype.php" hash="48225fa7b3f5e54d81711397dd5bd96b"/></dir></dir><dir name="System"><dir name="Config"><dir name="Backend"><file name="Currency.php" hash="73cb15b1de303e88c487db4c585ef94e"/></dir></dir></dir><dir name="Wrapper"><file name="Braintree.php" hash="2e418dbcbfca1df0c536e826839dddbb"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Braintree"><file name="MigrationController.php" hash="84323fa4665ece605f6b8e906d0edd40"/></dir><file name="BraintreeController.php" hash="d7ece21342a7b4b37ee41ea0e7ff20ad"/></dir><file name="CheckoutController.php" hash="223de3639574a686a68e9210f39c1fad"/><file name="ExpressController.php" hash="9b5d7e744dc970093f576d9eb93954bc"/><dir name="Kount"><file name="EnsController.php" hash="1db795afa1df901c37bbe48a3f01db2f"/></dir><file name="SavedController.php" hash="083777b1536e8dda604107af9f0081a9"/></dir><dir name="etc"><file name="adminhtml.xml" hash="c9c940beffa0ec19e4a1499a66f7fd12"/><file name="config.xml" hash="8eb932a624079bd21084e39bda01680e"/><file name="system.xml" hash="029380b769c8ed94860b46f17f9beb79"/></dir><dir name="sql"><dir name="gene_braintree_setup"><file name="install-0.1.0.php" hash="503f428384f687d3f55a19ea57450212"/><file name="upgrade-1.0.5.4-2.0.0.php" hash="62d37c35ba39a77ea14cad842f143393"/><file name="upgrade-2.0.0-2.0.1.php" hash="a08927707bb43a5c22b3b6ce3dd7a3c7"/><file name="upgrade-2.0.4-2.1.0.php" hash="e1b31c2459ea0aaebb679e456bab3ec1"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="gene"><file name="braintree.xml" hash="4036c0921b63c755254bf768afcfd9df"/></dir></dir><dir name="template"><dir name="gene"><dir name="braintree"><dir name="creditcard"><file name="hostedfields.phtml" hash="4edf6db7f931248a2882be8d6d1e756c"/><file name="info.phtml" hash="2ae1e397b3a633dd305bc26c7b9c1065"/><file name="saved.phtml" hash="579ec8ca726de3b5bea8600663d1e61f"/><file name="threedsecure.phtml" hash="ee8ad689afde041c39dd92ffa5274883"/></dir><file name="creditcard.phtml" hash="2cf07e28ebd141ea73e6e9082096304e"/><dir name="customer"><file name="edit.phtml" hash="ed8a9533f07fbfa36ec78623afd1a04d"/><file name="methods.phtml" hash="794ad8cb20314d1657a746b365c82540"/><file name="saved.phtml" hash="0457b0fa38f9db788133e54f359baa63"/></dir><dir name="express"><file name="button.phtml" hash="035171a572f38e92ac1ca0746c0aabf0"/><file name="cart.phtml" hash="39eb92f4953d009dad245acec8af4677"/><file name="catalog.phtml" hash="a63c0ce1c932e70bcdcaf92307df1f5a"/><file name="error.phtml" hash="0ec2ea2f9b909d9f0543e5df83eea055"/><file name="shipping_details.phtml" hash="0bb6ceafaac0ba522278df310d6136e2"/></dir><dir name="js"><file name="aheadworks.phtml" hash="533ba9aebbba6768649668386a74a1c2"/><file name="amasty.phtml" hash="2bfc5623dd9a98721b53a4d8cd13c0c3"/><file name="awesomecheckout.phtml" hash="136efc89e8a471c93d0f030d8f94c58c"/><file name="data.phtml" hash="f8b04e3d0d7154cc75332eb5bec3e54e"/><file name="default.phtml" hash="a833dcbaeae071b5bd0b1c47bc2d23d4"/><file name="fancycheckout.phtml" hash="f603bcd50dea98dbb45c1ec8b692314c"/><file name="firecheckout.phtml" hash="6186cba208f62227be17bb9ade5fa8f5"/><file name="fme.phtml" hash="263fb201b77696cf21cc677696c53fdd"/><file name="idev.phtml" hash="eaccda49f56ed09bebf74556ceff1bfd"/><file name="iwd.phtml" hash="d7e12c84b629306529d3d8beb0c4814d"/><file name="magestore.phtml" hash="ff6a622a4048b8e533f3e672a40e6296"/><file name="multishipping.phtml" hash="a1e777e99df26d81f7c4b9e7b4a7c109"/><file name="oye.phtml" hash="51ef48f818e79acb6d1e8b9eb7889cc9"/><file name="setup.phtml" hash="3f437fba1601ca1710bdb96d0d23278c"/><file name="unicode.phtml" hash="dd07e924a01b0a28ef46c9a62f22e3b5"/></dir><dir name="paypal"><file name="info.phtml" hash="5149b273730121e4dec3c3179820f747"/><file name="saved.phtml" hash="3dd56f96bcdd14be594d355ae8fff329"/></dir><file name="paypal.phtml" hash="d12c20e5fb76f31270a5d47061e42715"/></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="gene"><file name="braintree.xml" hash="731b5d7736cb4caf6ceb5ced7caca88e"/></dir></dir><dir name="template"><dir name="gene"><dir name="braintree"><dir name="creditcard"><file name="hostedfields.phtml" hash="152e09ed938c47ffc056a7c11247375a"/><file name="info.phtml" hash="958d514582e3de1f91f5e0f7a7169b47"/><file name="saved.phtml" hash="ca27adb601aebf97cd25a892082a8663"/></dir><file name="creditcard.phtml" hash="2d77487c6b7e9e6c77b2ddb25597bd8b"/><file name="js.phtml" hash="019f38d755685f9b11e38bb5f42f57a0"/><dir name="paypal"><file name="info.phtml" hash="0485ea82dc9cc8ebea092b378672f1cd"/><file name="saved.phtml" hash="779ca8e907d7d463eafce58dfaf94f0c"/></dir><file name="paypal.phtml" hash="f81578f64c8a30560299bd993d8e996d"/><dir name="system"><dir name="config"><file name="migration.phtml" hash="8ef2a5e5561d7909d065c987ded5e592"/></dir></dir><dir name="transactions"><file name="index.phtml" hash="1791b6393f319616dd79c0b46e391847"/><file name="search.phtml" hash="1682ce6200681681f0ce3c848e2e6694"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Gene_Braintree.xml" hash="8c0ffda8566dca2f0b98a999921e3e55"/></dir></target><target name="mageweb"><dir name="js"><dir name="gene"><dir name="braintree"><file name="config.codekit" hash="df813a1bb2c5a52ac9d48f391435fc0b"/><dir name="express"><file name="abstract-min.js" hash="dae4b68ed5b1bfe09b65de08276c2abc"/><file name="paypal-min.js" hash="22908cb3ce7c4d22c5ff65f973cee8a0"/></dir><file name="express.js" hash="7a9b83b6453ebd55e25e767648f5bc6f"/><dir name="source"><dir name="express"><file name="abstract.js" hash="f057fd97081c785c43751cd1b07c4d42"/><file name="paypal.js" hash="81d515ce830648b17765d592e22a9388"/></dir><file name="vzero-integration.js" hash="43cab7bb0208b6bb0a0a71b1ed9e6761"/><file name="vzero-paypal.js" hash="0b11e2c28bde0932c3fa02cd59ec3eb8"/><file name="vzero.js" hash="31426e471c691dda96d7539bb0411aae"/></dir><file name="vzero-integration-min.js" hash="ceab9f1b0cb2e2f9eb87b3a0d8315e07"/><file name="vzero-min.js" hash="29b461297fce94d17acff066a4551e19"/><file name="vzero-paypal-min.js" hash="4d5454101b86a1781239e541fc9395de"/></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="gene"><dir name="braintree"><file name="AE.png" hash="6b6f405105413b0723a62ee498f88bf6"/><file name="DI.png" hash="d8e3c3022dda9e723f466b8976ae428f"/><file name="JCB.png" hash="3aa9a71ed8a1d6610bbe0dfe2040e29e"/><file name="MC.png" hash="1fcd14928245139962b72f9368bdbe32"/><file name="ME.png" hash="b9389913c47b9546a67f907fcca73706"/><file name="PP.png" hash="b4946bccba574e86c9716a4986e21c36"/><file name="VI.png" hash="c9f74d1d54e61ab2c748f45a4bdface0"/><file name="card.png" hash="66e16f8c573fad93bb0d62258dce28bb"/><file name="paypal-loading.gif" hash="078a2daf55245b227c09a7bed86750c6"/><file name="paypal.png" hash="40d5f74305e565bd14aef19bcf696541"/></dir><file name="loader.gif" hash="f48ee069890b16455c3ddcacee9b5f75"/><file name="loader-white.gif" hash="1fc0e911558e8dfe77cfdfafa0d38f88"/></dir></dir><dir name="css"><dir name="gene"><dir name="braintree"><dir name="account"><file name="account.less" hash="ddf6bf208f290316300ab20682f34473"/></dir><file name="account.css" hash="73bb46f85320b2f2b4de9beb6c0e0bd6"/><file name="aheadworks.css" hash="213006228b4441db7b58f1b3ae9748e8"/><file name="amasty.css" hash="e59eba0c3fbd14df941d7492a0e478e4"/><file name="awesomecheckout.css" hash="569f3675ae5dbf09d069c4553c61a26d"/><file name="config.codekit" hash="84437b4cfe51c10615b8f58c083e36dd"/><dir name="core"><file name="_general.less" hash="5848708373d8ed5eda5e5b23c3e4e05c"/><file name="_hostedfields.less" hash="43b3a8c9c102c6babbe7eada4a0bcd3d"/><file name="_paypal.less" hash="df0239894dfef5c905bea44938ee4658"/><file name="_saved.less" hash="66ec8d894e336f9934a1e54972c4b220"/></dir><file name="default.css" hash="b5a9c005aad60217cb4455f21ce04856"/><file name="express.css" hash="1c9eb3b9abb7e798b65701b2815d2e07"/><file name="express.less" hash="29acfc18e38f300972f27cfd44ca41c2"/><file name="fancycheckout.css" hash="45d1129b4d8a660e574f0bb8cb069cfe"/><file name="firecheckout.css" hash="5d211881940d75fc8b50cd5c4ec96236"/><file name="fme.css" hash="988e97aaaf2565908504a62114d6c6bb"/><file name="idev.css" hash="3c90d7d93fc4d61a3bf1c75e9bb15c82"/><dir name="integrations"><file name="aheadworks.less" hash="09b0304383e198885f030119c15641f7"/><file name="amasty.less" hash="4cdf236e1d44112205750cefa11448b4"/><file name="awesomecheckout.less" hash="e774da637a5c6bbdb2e5decc998afae1"/><file name="default.less" hash="d366d4560ed1ce3e9e120309e56bec2f"/><file name="fancycheckout.less" hash="18281c460bb32da164964abe585b092b"/><file name="firecheckout.less" hash="459704b8b6efca52fcee7c335b3ad625"/><file name="fme.less" hash="580ed66608560fcd1195246c22e3559c"/><file name="idev.less" hash="47485cc963e16d12e673c06cd9efe4b1"/><file name="iwd.less" hash="5081477c7946e0f5cf8cc4198895ca11"/><file name="magestore.less" hash="0af5cd105be3995dc2044d33f990bbb5"/><file name="oye.less" hash="06a0f79190b16dfbce3aec6d14f07461"/><file name="unicode.less" hash="1416abe9a38965d9aead022b238f7d4f"/></dir><file name="iwd.css" hash="b0010f4c529babedcebbd1cdad6b7f13"/><file name="magestore.css" hash="25899483163212c97418097d2c6b6209"/><file name="oye.css" hash="56746e9955d428fa57d3c728cd9ed671"/><file name="unicode.css" hash="3d1878035493ceddf88b94a5b6d2a4be"/><file name=".DS_Store" hash="1405352d803d5c88cf3ec19a82f173d0"/></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><dir name="gene"><dir name="braintree"><file name="adminhtml.css" hash="affb40183f3620e4ee157daf613dc2a9"/><file name="adminhtml.less" hash="b3a4d504055c85d872c5b9544d192840"/><file name="config.codekit" hash="ddde6e8364c5adb1b88c7104c873eb01"/><file name="migration.css" hash="158e143a99028313d6ad6f6612112dd4"/><file name="migration.less" hash="bbf09530cf530f78f4a7c3229194c5ff"/><file name=".DS_Store" hash="63617e9dd9988a3d3773937a3f7e2f9a"/></dir></dir></dir><dir name="images"><dir name="gene"><dir name="braintree"><file name="AE.png" hash="6b6f405105413b0723a62ee498f88bf6"/><file name="DI.png" hash="d8e3c3022dda9e723f466b8976ae428f"/><file name="JCB.png" hash="3aa9a71ed8a1d6610bbe0dfe2040e29e"/><file name="MC.png" hash="1fcd14928245139962b72f9368bdbe32"/><file name="ME.png" hash="b9389913c47b9546a67f907fcca73706"/><file name="PP.png" hash="b4946bccba574e86c9716a4986e21c36"/><file name="VI.png" hash="c9f74d1d54e61ab2c748f45a4bdface0"/><file name="card.png" hash="66e16f8c573fad93bb0d62258dce28bb"/><dir name="migration"><file name="braintree.png" hash="396d721824a86b169ce0055090ce9766"/><file name="gene-logo.png" hash="16efb1b148acc59c46c84a21d726b6e9"/><file name="loader.gif" hash="66b9100930b8e58d46acf2e13d41f7ea"/></dir></dir><file name="loader.gif" hash="f48ee069890b16455c3ddcacee9b5f75"/></dir></dir></dir></dir></dir></target><target name="magelib"><dir name="Gene"><dir name="Braintree"><file name="AddOn.php" hash="e8bbb6db343ba99192346b1dcbf45677"/><file name="AddOnGateway.php" hash="d8698ffe89c01fba78a8a06a2fc68122"/><file name="Address.php" hash="004d3d36d39fc6fcc3d510f4b15b1fca"/><file name="AddressGateway.php" hash="41b5a3be7bdb2fe326a49a1554e1b0c3"/><file name="AndroidPayCard.php" hash="bb4a81807fefc76db286e615128c5d8c"/><file name="ApplePayCard.php" hash="b895256bcb867854bcaaffc1ce833fbd"/><file name="Base.php" hash="60d52fd1bef5655bcb607fba45bb4c1c"/><file name="ClientToken.php" hash="358c0a1dba687baf635db818cb7d1dac"/><file name="ClientTokenGateway.php" hash="9c24bb9de2c419c7e377c046da2a1ffa"/><file name="CoinbaseAccount.php" hash="ee5cb6963f675a9a71293c453b128866"/><file name="Collection.php" hash="0e7d31ffcbd9780fb554186bd2c194b0"/><file name="Configuration.php" hash="2a416a1eae0c22329d9bef88b25039b2"/><file name="CredentialsParser.php" hash="c4bb2248a33129d8523a6120ce44108b"/><file name="CreditCard.php" hash="d32b8d8e64b2d046d3d9e4f00c67f1ed"/><file name="CreditCardGateway.php" hash="0d120ed06f06fd614468d6e3f0ad22d2"/><file name="CreditCardVerification.php" hash="48d6ea546914278f4bea2fefb75e7836"/><file name="CreditCardVerificationGateway.php" hash="6a07430c9437f6e6c1516d5b4572a749"/><file name="CreditCardVerificationSearch.php" hash="18efe7d508c2bd5fea1c0e68fc26182f"/><file name="Customer.php" hash="62d0937de86f7a14a512ad66edba7569"/><file name="CustomerGateway.php" hash="5367d9d8a878572106e3a94c60132b1b"/><file name="CustomerSearch.php" hash="8aacc83dac341cd9afec5a3deab17593"/><file name="Descriptor.php" hash="3f5db5e817280ce7f2fa18a205281ad9"/><file name="Digest.php" hash="9d12d067770f55b123b8498fce4478fa"/><file name="Disbursement.php" hash="ad122f0f33b27dfd98bcdd38ea138ae4"/><file name="DisbursementDetails.php" hash="ae632207d0982e288a83aed401c880d9"/><file name="Discount.php" hash="763b3f9cde0ff3af3e8795cac4097595"/><file name="DiscountGateway.php" hash="47796edb8ac2fa68e9af8fb8a13aacb1"/><dir name="Dispute"><file name="TransactionDetails.php" hash="7fdea673a1295055508f42286ad57f4e"/></dir><file name="Dispute.php" hash="c3a4e93fa2b3b0e20ddcb593dcdc7b2b"/><file name="EqualityNode.php" hash="cfd6aa184186233b8d6d1ec0f0e79298"/><dir name="Error"><file name="Codes.php" hash="a7f98ff690e725b7fcd198b4b22d0637"/><file name="ErrorCollection.php" hash="e28d638db56524f5bf3609fa725e6d55"/><file name="Validation.php" hash="bf4e2198300019c52ba56f16269d66ce"/><file name="ValidationErrorCollection.php" hash="9ef25d0126a0b4f6951da5334ae6f0dc"/></dir><file name="EuropeBankAccount.php" hash="82ae4f4d1c45ce2c421305bf9397c866"/><dir name="Exception"><file name="Authentication.php" hash="f9e13654988452cca2ac5228a80adae4"/><file name="Authorization.php" hash="5f8c017c6e9fd79a556dade8e15a72e8"/><file name="Configuration.php" hash="b50f67e8ea36cff0d9f6ad718126c6fc"/><file name="DownForMaintenance.php" hash="7fd30b1f8976ed7e38b7e9fae5c20f03"/><file name="ForgedQueryString.php" hash="6884dbae1e86767834b77c821df2db62"/><file name="InvalidChallenge.php" hash="1c283a1c9dac65feb137594d0dcf0e35"/><file name="InvalidSignature.php" hash="b83f5b16735cb3a8e0a8111c4f32711e"/><file name="NotFound.php" hash="f832f771d20b381c2780eb2a572b9f44"/><file name="SSLCaFileNotFound.php" hash="e927c7307bf1761814dc8a755238070d"/><file name="SSLCertificate.php" hash="d509b6a6206bd7c5563ac142dfe3801f"/><file name="ServerError.php" hash="b4645290229ab228a257047d08ef63d7"/><file name="TestOperationPerformedInProduction.php" hash="fde4c6a8b708420b26785fb67a2548ef"/><file name="Unexpected.php" hash="01ea2800fb91995ec2a15aee5024611e"/><file name="UpgradeRequired.php" hash="7f40b174df891cc3b3e206d1be884a58"/><file name="ValidationsFailed.php" hash="cd2d30c69911f81b55279c3d6bf88c61"/></dir><file name="Exception.php" hash="f14c94bf67206184eb3e4e7aeb4a608a"/><file name="Gateway.php" hash="d2fac69479243ef4cea7d7a8add798f7"/><file name="Http.php" hash="1baa32e0efcae13c4d6294d1233512a1"/><file name="Instance.php" hash="f0603b3f9213b53687e079c5621ac8f3"/><file name="IsNode.php" hash="e4b1f7bbfcbd24b1d08b97f94df592be"/><file name="KeyValueNode.php" hash="255595ec01a16906dd0c49faf67d9efb"/><file name="Merchant.php" hash="5053ebe889c854d11f2686bffdeb58be"/><dir name="MerchantAccount"><file name="AddressDetails.php" hash="1d265d864a884ebcf2504f55207cc0dd"/><file name="BusinessDetails.php" hash="3e80148bac9fda676844aa19d5b2dc28"/><file name="FundingDetails.php" hash="7368f653fcbcc3d87924447b1763e616"/><file name="IndividualDetails.php" hash="777b6f28f643e78616c7ed753a39c0cd"/></dir><file name="MerchantAccount.php" hash="496c93182d824bb2967cc9366dec1ac3"/><file name="MerchantAccountGateway.php" hash="e2073aff6f8b3c5f2e64b23b210c44f7"/><file name="MerchantGateway.php" hash="e0a2e3a28c68dac8bd082973b269ed1b"/><file name="Modification.php" hash="0abe992d4f821327f617ca883c4eb2d1"/><file name="MultipleValueNode.php" hash="92700fa03011eaa9561010b3a160449c"/><file name="MultipleValueOrTextNode.php" hash="ef06bac18e2bc40974bdc0bcb854890f"/><file name="OAuthCredentials.php" hash="e992dca9dfedb27e3d050af55971a968"/><file name="OAuthGateway.php" hash="9a0b2b692eaf8fb5f337922044b20cc1"/><file name="PartialMatchNode.php" hash="370c7e0ab8a445cfeef6b19ef1755f4d"/><file name="PartnerMerchant.php" hash="bdb69ebdc75d67009710be9703a47e80"/><file name="PayPalAccount.php" hash="672a7d424f94e590c5e66a21e62d7bc2"/><file name="PayPalAccountGateway.php" hash="d73f5744ebaca6cc882c42d0e9c1a05e"/><file name="PaymentInstrumentType.php" hash="be97a30c7d8fbbb180864dc4efea71f2"/><file name="PaymentMethod.php" hash="5bc31d3e97610e7218c95aba2422cc9a"/><file name="PaymentMethodGateway.php" hash="4c93b070cb79c86ec9384e069fbae777"/><file name="PaymentMethodNonce.php" hash="e99302e2468f55c8fb4b2ceeb1bce68e"/><file name="PaymentMethodNonceGateway.php" hash="22a0d89eee071a28b530c6be477dcc6e"/><file name="Plan.php" hash="22ab0117d462352aecb9531d4a26619e"/><file name="PlanGateway.php" hash="95e093b55ad20f8b652ee5f2fc2a0fcf"/><file name="RangeNode.php" hash="4ad9a92547423b3d54d69097114c3daf"/><file name="ResourceCollection.php" hash="8f437cb5014148c0e2f6049347ae795c"/><dir name="Result"><file name="CreditCardVerification.php" hash="7c41787025ec7cffb269f53e3ce479e2"/><file name="Error.php" hash="0e0460f1eea017bc7591e05351f51eb0"/><file name="Successful.php" hash="03f1c379fcedaef499296ab7778d1e36"/></dir><file name="RiskData.php" hash="8bef1074f9f1c50c841a7c7cf627c9cf"/><file name="SettlementBatchSummary.php" hash="388d88e8cea7bec61ee78f388fb78c2c"/><file name="SettlementBatchSummaryGateway.php" hash="bc54658b75fa0505e072331799c2d9ad"/><file name="SignatureService.php" hash="4b78d3e5897e715dcc877c5f65b3cfae"/><dir name="Subscription"><file name="StatusDetails.php" hash="29e375f02150bfd7147591f0eb27cb4f"/></dir><file name="Subscription.php" hash="cde05aa61192d5b930b57330db308835"/><file name="SubscriptionGateway.php" hash="bd1b2aa2d4d41a595463bead64ed34e0"/><file name="SubscriptionSearch.php" hash="1874ebe5cb42d7d2836617810cced1af"/><dir name="Test"><file name="CreditCardNumbers.php" hash="676a9100354eb679e7ca1e0f0d67293f"/><file name="MerchantAccount.php" hash="612e7e30cca364c0d14cbff3b54ebf3f"/><file name="Nonces.php" hash="d39c75e07c12c005c837c33003cb9ec2"/><file name="Transaction.php" hash="f7ef8730ede38eda778679c7056ae7c7"/><file name="TransactionAmounts.php" hash="ed9bf1f57d871542c32d11de9e031f05"/><file name="VenmoSdk.php" hash="6ce94deccd1f968596011487c7e69cc7"/></dir><file name="TestingGateway.php" hash="ccb1126142799ac3dc9f8d6f1a1f48d4"/><file name="TextNode.php" hash="94c95ec9645de57acace2179fef7fb43"/><file name="ThreeDSecureInfo.php" hash="542550c4e03a24551d00e8aad5493035"/><dir name="Transaction"><file name="AddressDetails.php" hash="ff52a4a48248085b7ea92e992160e413"/><file name="AndroidPayCardDetails.php" hash="0d7716a3c992dfb0833e7ecd437ef346"/><file name="ApplePayCardDetails.php" hash="23f7ba70521889585fa40f4f0388524d"/><file name="CoinbaseDetails.php" hash="d19a625f8de98698b8277c25660358f0"/><file name="CreditCardDetails.php" hash="aac5eb1f5804d4f979b9c71f7b98cb36"/><file name="CustomerDetails.php" hash="e137895c646127312be44292c84a2d81"/><file name="EuropeBankAccountDetails.php" hash="afe4fdc3ab3714ef2995f514ce2be2a6"/><file name="PayPalDetails.php" hash="06903d1ee21879f7329b920138df9ac6"/><file name="StatusDetails.php" hash="7c6e719c51bf13bdfd07615030100ac6"/><file name="SubscriptionDetails.php" hash="1cf1f511d1545a2e27b8d3f4bee800ca"/></dir><file name="Transaction.php" hash="afe5d8ef7fc73633424d26b942c4e5a1"/><file name="TransactionGateway.php" hash="39684956db79fe58891876e5c7845413"/><file name="TransactionSearch.php" hash="aa58846182b909fb8747e165ec7e9b92"/><file name="TransparentRedirect.php" hash="154c9850be5175a5cd1b35bdf78ae939"/><file name="TransparentRedirectGateway.php" hash="5ead181bf0d5484db5eb305efa13bec4"/><file name="UnknownPaymentMethod.php" hash="9107498774ab5bc2b25de98838736b47"/><file name="Util.php" hash="9832a44da18b97a55248cadc4bb9a4ad"/><file name="Version.php" hash="43e074bc53780cb92af4a9ef4887c63e"/><file name="WebhookNotification.php" hash="4097fb57d46368d903c42bb20fbd49ca"/><file name="WebhookTesting.php" hash="c40311458bb64e37b4c08eb88df37805"/><dir name="Xml"><file name="Generator.php" hash="19f9c9b9b61d4f97f65775f527ac408d"/><file name="Parser.php" hash="c06b1ae155ac7687eaa856fac472656d"/></dir><file name="Xml.php" hash="dc69e05bea21e3d1185d45d53e4747db"/></dir><file name="Braintree.php" hash="2c75cf27b3c9a6e1bc557e6b239d2594"/><dir name="ssl"><file name="api_braintreegateway_com.ca.crt" hash="04beb23c767547e980c76eb68c7eab15"/><file name="sandbox_braintreegateway_com.ca.crt" hash="f1b529883c7c2cbb4251658f5da7b4c9"/></dir></dir></target><target name="magelocale"><dir><dir name="en_US"><file name="Gene_Braintree.csv" hash="b0c520cbdf0f42b11c8c6dfafbe999bd"/></dir></dir></target></contents>
42
  <compatible/>
43
  <dependencies><required><php><min>5.4.0</min><max>6.0.0</max></php><package><name></name><channel>connect.magentocommerce.com/core</channel><min></min><max></max></package></required></dependencies>
44
  </package>
skin/frontend/base/default/css/gene/braintree/aheadworks.css CHANGED
@@ -92,6 +92,58 @@
92
  .braintree-hostedfield .cvv-what-is-this {
93
  margin-left: 0;
94
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  #paypal-container iframe {
96
  display: none;
97
  }
@@ -118,6 +170,7 @@ button.braintree-paypal-button.braintree-paypal-loading > span {
118
  }
119
  button.braintree-paypal-button.braintree-paypal-loading:hover {
120
  background: #014c6b url('../../../images/gene/braintree/paypal-loading.gif') center center no-repeat;
 
121
  }
122
  button.braintree-paypal-button:hover {
123
  background: #0175a6;
92
  .braintree-hostedfield .cvv-what-is-this {
93
  margin-left: 0;
94
  }
95
+ #three-d-modal {
96
+ position: fixed;
97
+ top: 0;
98
+ left: 0;
99
+ display: flex;
100
+ align-items: center;
101
+ height: 100vh;
102
+ width: 100vw;
103
+ z-index: 100000;
104
+ visibility: visible;
105
+ transition: 0.4s;
106
+ opacity: 1;
107
+ }
108
+ #three-d-modal.hidden {
109
+ visibility: hidden;
110
+ transition: 0.4s;
111
+ opacity: 0;
112
+ }
113
+ #three-d-modal.hidden .bt-modal-frame {
114
+ transition: 0.4s;
115
+ transform: translateY(80px);
116
+ }
117
+ #three-d-modal .bt-modal-frame {
118
+ height: 450px;
119
+ width: 440px;
120
+ margin: auto;
121
+ background-color: #ffffff;
122
+ z-index: 2;
123
+ border-radius: 6px;
124
+ transition: 0.4s;
125
+ transform: translateY(0);
126
+ }
127
+ #three-d-modal .bt-modal-body {
128
+ height: 380px;
129
+ margin: 0 20px;
130
+ background-color: white;
131
+ border: 1px solid lightgray;
132
+ }
133
+ #three-d-modal .bt-modal-header {
134
+ height: 40px;
135
+ text-align: center;
136
+ line-height: 40px;
137
+ }
138
+ #three-d-modal .bt-mask {
139
+ position: absolute;
140
+ top: 0;
141
+ left: 0;
142
+ height: 100%;
143
+ width: 100%;
144
+ background-color: black;
145
+ opacity: 0.75;
146
+ }
147
  #paypal-container iframe {
148
  display: none;
149
  }
170
  }
171
  button.braintree-paypal-button.braintree-paypal-loading:hover {
172
  background: #014c6b url('../../../images/gene/braintree/paypal-loading.gif') center center no-repeat;
173
+ background-size: 32px;
174
  }
175
  button.braintree-paypal-button:hover {
176
  background: #0175a6;
skin/frontend/base/default/css/gene/braintree/amasty.css CHANGED
@@ -92,6 +92,58 @@
92
  .braintree-hostedfield .cvv-what-is-this {
93
  margin-left: 0;
94
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  #paypal-container iframe {
96
  display: none;
97
  }
@@ -118,6 +170,7 @@ button.braintree-paypal-button.braintree-paypal-loading > span {
118
  }
119
  button.braintree-paypal-button.braintree-paypal-loading:hover {
120
  background: #014c6b url('../../../images/gene/braintree/paypal-loading.gif') center center no-repeat;
 
121
  }
122
  button.braintree-paypal-button:hover {
123
  background: #0175a6;
92
  .braintree-hostedfield .cvv-what-is-this {
93
  margin-left: 0;
94
  }
95
+ #three-d-modal {
96
+ position: fixed;
97
+ top: 0;
98
+ left: 0;
99
+ display: flex;
100
+ align-items: center;
101
+ height: 100vh;
102
+ width: 100vw;
103
+ z-index: 100000;
104
+ visibility: visible;
105
+ transition: 0.4s;
106
+ opacity: 1;
107
+ }
108
+ #three-d-modal.hidden {
109
+ visibility: hidden;
110
+ transition: 0.4s;
111
+ opacity: 0;
112
+ }
113
+ #three-d-modal.hidden .bt-modal-frame {
114
+ transition: 0.4s;
115
+ transform: translateY(80px);
116
+ }
117
+ #three-d-modal .bt-modal-frame {
118
+ height: 450px;
119
+ width: 440px;
120
+ margin: auto;
121
+ background-color: #ffffff;
122
+ z-index: 2;
123
+ border-radius: 6px;
124
+ transition: 0.4s;
125
+ transform: translateY(0);
126
+ }
127
+ #three-d-modal .bt-modal-body {
128
+ height: 380px;
129
+ margin: 0 20px;
130
+ background-color: white;
131
+ border: 1px solid lightgray;
132
+ }
133
+ #three-d-modal .bt-modal-header {
134
+ height: 40px;
135
+ text-align: center;
136
+ line-height: 40px;
137
+ }
138
+ #three-d-modal .bt-mask {
139
+ position: absolute;
140
+ top: 0;
141
+ left: 0;
142
+ height: 100%;
143
+ width: 100%;
144
+ background-color: black;
145
+ opacity: 0.75;
146
+ }
147
  #paypal-container iframe {
148
  display: none;
149
  }
170
  }
171
  button.braintree-paypal-button.braintree-paypal-loading:hover {
172
  background: #014c6b url('../../../images/gene/braintree/paypal-loading.gif') center center no-repeat;
173
+ background-size: 32px;
174
  }
175
  button.braintree-paypal-button:hover {
176
  background: #0175a6;
skin/frontend/base/default/css/gene/braintree/awesomecheckout.css CHANGED
@@ -92,6 +92,58 @@
92
  .braintree-hostedfield .cvv-what-is-this {
93
  margin-left: 0;
94
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  #paypal-container iframe {
96
  display: none;
97
  }
@@ -118,6 +170,7 @@ button.braintree-paypal-button.braintree-paypal-loading > span {
118
  }
119
  button.braintree-paypal-button.braintree-paypal-loading:hover {
120
  background: #014c6b url('../../../images/gene/braintree/paypal-loading.gif') center center no-repeat;
 
121
  }
122
  button.braintree-paypal-button:hover {
123
  background: #0175a6;
92
  .braintree-hostedfield .cvv-what-is-this {
93
  margin-left: 0;
94
  }
95
+ #three-d-modal {
96
+ position: fixed;
97
+ top: 0;
98
+ left: 0;
99
+ display: flex;
100
+ align-items: center;
101
+ height: 100vh;
102
+ width: 100vw;
103
+ z-index: 100000;
104
+ visibility: visible;
105
+ transition: 0.4s;
106
+ opacity: 1;
107
+ }
108
+ #three-d-modal.hidden {
109
+ visibility: hidden;
110
+ transition: 0.4s;
111
+ opacity: 0;
112
+ }
113
+ #three-d-modal.hidden .bt-modal-frame {
114
+ transition: 0.4s;
115
+ transform: translateY(80px);
116
+ }
117
+ #three-d-modal .bt-modal-frame {
118
+ height: 450px;
119
+ width: 440px;
120
+ margin: auto;
121
+ background-color: #ffffff;
122
+ z-index: 2;
123
+ border-radius: 6px;
124
+ transition: 0.4s;
125
+ transform: translateY(0);
126
+ }
127
+ #three-d-modal .bt-modal-body {
128
+ height: 380px;
129
+ margin: 0 20px;
130
+ background-color: white;
131
+ border: 1px solid lightgray;
132
+ }
133
+ #three-d-modal .bt-modal-header {
134
+ height: 40px;
135
+ text-align: center;
136
+ line-height: 40px;
137
+ }
138
+ #three-d-modal .bt-mask {
139
+ position: absolute;
140
+ top: 0;
141
+ left: 0;
142
+ height: 100%;
143
+ width: 100%;
144
+ background-color: black;
145
+ opacity: 0.75;
146
+ }
147
  #paypal-container iframe {
148
  display: none;
149
  }
170
  }
171
  button.braintree-paypal-button.braintree-paypal-loading:hover {
172
  background: #014c6b url('../../../images/gene/braintree/paypal-loading.gif') center center no-repeat;
173
+ background-size: 32px;
174
  }
175
  button.braintree-paypal-button:hover {
176
  background: #0175a6;
skin/frontend/base/default/css/gene/braintree/core/_hostedfields.less CHANGED
@@ -87,4 +87,65 @@
87
  }
88
  .braintree-hostedfield .cvv-what-is-this {
89
  margin-left: 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  }
87
  }
88
  .braintree-hostedfield .cvv-what-is-this {
89
  margin-left: 0;
90
+ }
91
+
92
+
93
+ #three-d-modal {
94
+ position: fixed;
95
+ top: 0;
96
+ left: 0;
97
+ display: flex;
98
+ align-items: center;
99
+ height: 100vh;
100
+ width: 100vw;
101
+ z-index: 100000;
102
+ visibility: visible;
103
+ transition: 0.4s;
104
+ opacity: 1;
105
+
106
+ &.hidden {
107
+ visibility: hidden;
108
+ transition: 0.4s;
109
+ opacity: 0;
110
+
111
+ .bt-modal-frame {
112
+ transition: 0.4s;
113
+ transform: translateY(80px);
114
+ }
115
+ }
116
+
117
+ .bt-modal-frame {
118
+ height: 450px;
119
+ width: 440px;
120
+ margin: auto;
121
+ background-color: #ffffff;
122
+ z-index: 2;
123
+ border-radius: 6px;
124
+
125
+ transition: 0.4s;
126
+ transform: translateY(0);
127
+ }
128
+
129
+ .bt-modal-body {
130
+ height: 380px;
131
+ margin: 0 20px;
132
+ background-color: white;
133
+ border: 1px solid lightgray;
134
+ }
135
+
136
+ .bt-modal-header {
137
+ height: 40px;
138
+ text-align: center;
139
+ line-height: 40px;
140
+ }
141
+
142
+ .bt-mask {
143
+ position: absolute;
144
+ top: 0;
145
+ left: 0;
146
+ height: 100%;
147
+ width: 100%;
148
+ background-color: black;
149
+ opacity: 0.75;
150
+ }
151
  }
skin/frontend/base/default/css/gene/braintree/core/_paypal.less CHANGED
@@ -25,6 +25,7 @@ button.braintree-paypal-button.braintree-paypal-loading > span {
25
  }
26
  button.braintree-paypal-button.braintree-paypal-loading:hover {
27
  background: #014c6b url('../../../images/gene/braintree/paypal-loading.gif') center center no-repeat;
 
28
  }
29
  button.braintree-paypal-button:hover {
30
  background: #0175a6;
25
  }
26
  button.braintree-paypal-button.braintree-paypal-loading:hover {
27
  background: #014c6b url('../../../images/gene/braintree/paypal-loading.gif') center center no-repeat;
28
+ background-size: 32px;
29
  }
30
  button.braintree-paypal-button:hover {
31
  background: #0175a6;
skin/frontend/base/default/css/gene/braintree/default.css CHANGED
@@ -92,6 +92,58 @@
92
  .braintree-hostedfield .cvv-what-is-this {
93
  margin-left: 0;
94
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  #paypal-container iframe {
96
  display: none;
97
  }
@@ -118,6 +170,7 @@ button.braintree-paypal-button.braintree-paypal-loading > span {
118
  }
119
  button.braintree-paypal-button.braintree-paypal-loading:hover {
120
  background: #014c6b url('../../../images/gene/braintree/paypal-loading.gif') center center no-repeat;
 
121
  }
122
  button.braintree-paypal-button:hover {
123
  background: #0175a6;
92
  .braintree-hostedfield .cvv-what-is-this {
93
  margin-left: 0;
94
  }
95
+ #three-d-modal {
96
+ position: fixed;
97
+ top: 0;
98
+ left: 0;
99
+ display: flex;
100
+ align-items: center;
101
+ height: 100vh;
102
+ width: 100vw;
103
+ z-index: 100000;
104
+ visibility: visible;
105
+ transition: 0.4s;
106
+ opacity: 1;
107
+ }
108
+ #three-d-modal.hidden {
109
+ visibility: hidden;
110
+ transition: 0.4s;
111
+ opacity: 0;
112
+ }
113
+ #three-d-modal.hidden .bt-modal-frame {
114
+ transition: 0.4s;
115
+ transform: translateY(80px);
116
+ }
117
+ #three-d-modal .bt-modal-frame {
118
+ height: 450px;
119
+ width: 440px;
120
+ margin: auto;
121
+ background-color: #ffffff;
122
+ z-index: 2;
123
+ border-radius: 6px;
124
+ transition: 0.4s;
125
+ transform: translateY(0);
126
+ }
127
+ #three-d-modal .bt-modal-body {
128
+ height: 380px;
129
+ margin: 0 20px;
130
+ background-color: white;
131
+ border: 1px solid lightgray;
132
+ }
133
+ #three-d-modal .bt-modal-header {
134
+ height: 40px;
135
+ text-align: center;
136
+ line-height: 40px;
137
+ }
138
+ #three-d-modal .bt-mask {
139
+ position: absolute;
140
+ top: 0;
141
+ left: 0;
142
+ height: 100%;
143
+ width: 100%;
144
+ background-color: black;
145
+ opacity: 0.75;
146
+ }
147
  #paypal-container iframe {
148
  display: none;
149
  }
170
  }
171
  button.braintree-paypal-button.braintree-paypal-loading:hover {
172
  background: #014c6b url('../../../images/gene/braintree/paypal-loading.gif') center center no-repeat;
173
+ background-size: 32px;
174
  }
175
  button.braintree-paypal-button:hover {
176
  background: #0175a6;
skin/frontend/base/default/css/gene/braintree/express.css CHANGED
@@ -129,3 +129,15 @@
129
  padding: 25px;
130
  }
131
  }
 
 
 
 
 
 
 
 
 
 
 
 
129
  padding: 25px;
130
  }
131
  }
132
+ /* If the element contains a PayPal express button don't force the buttons to width 100% */
133
+ .product-view .add-to-cart-buttons.braintree-paypal-express-container .button {
134
+ width: auto;
135
+ }
136
+ @media (max-width: 450px) {
137
+ .product-view .add-to-cart-buttons.braintree-paypal-express-container {
138
+ width: 100%;
139
+ }
140
+ .product-view .add-to-cart-buttons.braintree-paypal-express-container .button {
141
+ width: 100%;
142
+ }
143
+ }
skin/frontend/base/default/css/gene/braintree/express.less CHANGED
@@ -134,3 +134,23 @@
134
  padding: 25px;
135
  }
136
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  padding: 25px;
135
  }
136
  }
137
+
138
+ /* If the element contains a PayPal express button don't force the buttons to width 100% */
139
+ .product-view {
140
+ .add-to-cart-buttons.braintree-paypal-express-container {
141
+ .button {
142
+ width: auto;
143
+ }
144
+ }
145
+ }
146
+
147
+ @media (max-width: 450px) {
148
+ .product-view {
149
+ .add-to-cart-buttons.braintree-paypal-express-container {
150
+ width: 100%;
151
+ .button {
152
+ width: 100%;
153
+ }
154
+ }
155
+ }
156
+ }
skin/frontend/base/default/css/gene/braintree/fancycheckout.css CHANGED
@@ -92,6 +92,58 @@
92
  .braintree-hostedfield .cvv-what-is-this {
93
  margin-left: 0;
94
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  #paypal-container iframe {
96
  display: none;
97
  }
@@ -118,6 +170,7 @@ button.braintree-paypal-button.braintree-paypal-loading > span {
118
  }
119
  button.braintree-paypal-button.braintree-paypal-loading:hover {
120
  background: #014c6b url('../../../images/gene/braintree/paypal-loading.gif') center center no-repeat;
 
121
  }
122
  button.braintree-paypal-button:hover {
123
  background: #0175a6;
92
  .braintree-hostedfield .cvv-what-is-this {
93
  margin-left: 0;
94
  }
95
+ #three-d-modal {
96
+ position: fixed;
97
+ top: 0;
98
+ left: 0;
99
+ display: flex;
100
+ align-items: center;
101
+ height: 100vh;
102
+ width: 100vw;
103
+ z-index: 100000;
104
+ visibility: visible;
105
+ transition: 0.4s;
106
+ opacity: 1;
107
+ }
108
+ #three-d-modal.hidden {
109
+ visibility: hidden;
110
+ transition: 0.4s;
111
+ opacity: 0;
112
+ }
113
+ #three-d-modal.hidden .bt-modal-frame {
114
+ transition: 0.4s;
115
+ transform: translateY(80px);
116
+ }
117
+ #three-d-modal .bt-modal-frame {
118
+ height: 450px;
119
+ width: 440px;
120
+ margin: auto;
121
+ background-color: #ffffff;
122
+ z-index: 2;
123
+ border-radius: 6px;
124
+ transition: 0.4s;
125
+ transform: translateY(0);
126
+ }
127
+ #three-d-modal .bt-modal-body {
128
+ height: 380px;
129
+ margin: 0 20px;
130
+ background-color: white;
131
+ border: 1px solid lightgray;
132
+ }
133
+ #three-d-modal .bt-modal-header {
134
+ height: 40px;
135
+ text-align: center;
136
+ line-height: 40px;
137
+ }
138
+ #three-d-modal .bt-mask {
139
+ position: absolute;
140
+ top: 0;
141
+ left: 0;
142
+ height: 100%;
143
+ width: 100%;
144
+ background-color: black;
145
+ opacity: 0.75;
146
+ }
147
  #paypal-container iframe {
148
  display: none;
149
  }
170
  }
171
  button.braintree-paypal-button.braintree-paypal-loading:hover {
172
  background: #014c6b url('../../../images/gene/braintree/paypal-loading.gif') center center no-repeat;
173
+ background-size: 32px;
174
  }
175
  button.braintree-paypal-button:hover {
176
  background: #0175a6;
skin/frontend/base/default/css/gene/braintree/firecheckout.css CHANGED
@@ -92,6 +92,58 @@
92
  .braintree-hostedfield .cvv-what-is-this {
93
  margin-left: 0;
94
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  #paypal-container iframe {
96
  display: none;
97
  }
@@ -118,6 +170,7 @@ button.braintree-paypal-button.braintree-paypal-loading > span {
118
  }
119
  button.braintree-paypal-button.braintree-paypal-loading:hover {
120
  background: #014c6b url('../../../images/gene/braintree/paypal-loading.gif') center center no-repeat;
 
121
  }
122
  button.braintree-paypal-button:hover {
123
  background: #0175a6;
92
  .braintree-hostedfield .cvv-what-is-this {
93
  margin-left: 0;
94
  }
95
+ #three-d-modal {
96
+ position: fixed;
97
+ top: 0;
98
+ left: 0;
99
+ display: flex;
100
+ align-items: center;
101
+ height: 100vh;
102
+ width: 100vw;
103
+ z-index: 100000;
104
+ visibility: visible;
105
+ transition: 0.4s;
106
+ opacity: 1;
107
+ }
108
+ #three-d-modal.hidden {
109
+ visibility: hidden;
110
+ transition: 0.4s;
111
+ opacity: 0;
112
+ }
113
+ #three-d-modal.hidden .bt-modal-frame {
114
+ transition: 0.4s;
115
+ transform: translateY(80px);
116
+ }
117
+ #three-d-modal .bt-modal-frame {
118
+ height: 450px;
119
+ width: 440px;
120
+ margin: auto;
121
+ background-color: #ffffff;
122
+ z-index: 2;
123
+ border-radius: 6px;
124
+ transition: 0.4s;
125
+ transform: translateY(0);
126
+ }
127
+ #three-d-modal .bt-modal-body {
128
+ height: 380px;
129
+ margin: 0 20px;
130
+ background-color: white;
131
+ border: 1px solid lightgray;
132
+ }
133
+ #three-d-modal .bt-modal-header {
134
+ height: 40px;
135
+ text-align: center;
136
+ line-height: 40px;
137
+ }
138
+ #three-d-modal .bt-mask {
139
+ position: absolute;
140
+ top: 0;
141
+ left: 0;
142
+ height: 100%;
143
+ width: 100%;
144
+ background-color: black;
145
+ opacity: 0.75;
146
+ }
147
  #paypal-container iframe {
148
  display: none;
149
  }
170
  }
171
  button.braintree-paypal-button.braintree-paypal-loading:hover {
172
  background: #014c6b url('../../../images/gene/braintree/paypal-loading.gif') center center no-repeat;
173
+ background-size: 32px;
174
  }
175
  button.braintree-paypal-button:hover {
176
  background: #0175a6;
skin/frontend/base/default/css/gene/braintree/fme.css CHANGED
@@ -92,6 +92,58 @@
92
  .braintree-hostedfield .cvv-what-is-this {
93
  margin-left: 0;
94
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  #paypal-container iframe {
96
  display: none;
97
  }
@@ -118,6 +170,7 @@ button.braintree-paypal-button.braintree-paypal-loading > span {
118
  }
119
  button.braintree-paypal-button.braintree-paypal-loading:hover {
120
  background: #014c6b url('../../../images/gene/braintree/paypal-loading.gif') center center no-repeat;
 
121
  }
122
  button.braintree-paypal-button:hover {
123
  background: #0175a6;
92
  .braintree-hostedfield .cvv-what-is-this {
93
  margin-left: 0;
94
  }
95
+ #three-d-modal {
96
+ position: fixed;
97
+ top: 0;
98
+ left: 0;
99
+ display: flex;
100
+ align-items: center;
101
+ height: 100vh;
102
+ width: 100vw;
103
+ z-index: 100000;
104
+ visibility: visible;
105
+ transition: 0.4s;
106
+ opacity: 1;
107
+ }
108
+ #three-d-modal.hidden {
109
+ visibility: hidden;
110
+ transition: 0.4s;
111
+ opacity: 0;
112
+ }
113
+ #three-d-modal.hidden .bt-modal-frame {
114
+ transition: 0.4s;
115
+ transform: translateY(80px);
116
+ }
117
+ #three-d-modal .bt-modal-frame {
118
+ height: 450px;
119
+ width: 440px;
120
+ margin: auto;
121
+ background-color: #ffffff;
122
+ z-index: 2;
123
+ border-radius: 6px;
124
+ transition: 0.4s;
125
+ transform: translateY(0);
126
+ }
127
+ #three-d-modal .bt-modal-body {
128
+ height: 380px;
129
+ margin: 0 20px;
130
+ background-color: white;
131
+ border: 1px solid lightgray;
132
+ }
133
+ #three-d-modal .bt-modal-header {
134
+ height: 40px;
135
+ text-align: center;
136
+ line-height: 40px;
137
+ }
138
+ #three-d-modal .bt-mask {
139
+ position: absolute;
140
+ top: 0;
141
+ left: 0;
142
+ height: 100%;
143
+ width: 100%;
144
+ background-color: black;
145
+ opacity: 0.75;
146
+ }
147
  #paypal-container iframe {
148
  display: none;
149
  }
170
  }
171
  button.braintree-paypal-button.braintree-paypal-loading:hover {
172
  background: #014c6b url('../../../images/gene/braintree/paypal-loading.gif') center center no-repeat;
173
+ background-size: 32px;
174
  }
175
  button.braintree-paypal-button:hover {
176
  background: #0175a6;
skin/frontend/base/default/css/gene/braintree/idev.css CHANGED
@@ -92,6 +92,58 @@
92
  .braintree-hostedfield .cvv-what-is-this {
93
  margin-left: 0;
94
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  #paypal-container iframe {
96
  display: none;
97
  }
@@ -118,6 +170,7 @@ button.braintree-paypal-button.braintree-paypal-loading > span {
118
  }
119
  button.braintree-paypal-button.braintree-paypal-loading:hover {
120
  background: #014c6b url('../../../images/gene/braintree/paypal-loading.gif') center center no-repeat;
 
121
  }
122
  button.braintree-paypal-button:hover {
123
  background: #0175a6;
92
  .braintree-hostedfield .cvv-what-is-this {
93
  margin-left: 0;
94
  }
95
+ #three-d-modal {
96
+ position: fixed;
97
+ top: 0;
98
+ left: 0;
99
+ display: flex;
100
+ align-items: center;
101
+ height: 100vh;
102
+ width: 100vw;
103
+ z-index: 100000;
104
+ visibility: visible;
105
+ transition: 0.4s;
106
+ opacity: 1;
107
+ }
108
+ #three-d-modal.hidden {
109
+ visibility: hidden;
110
+ transition: 0.4s;
111
+ opacity: 0;
112
+ }
113
+ #three-d-modal.hidden .bt-modal-frame {
114
+ transition: 0.4s;
115
+ transform: translateY(80px);
116
+ }
117
+ #three-d-modal .bt-modal-frame {
118
+ height: 450px;
119
+ width: 440px;
120
+ margin: auto;
121
+ background-color: #ffffff;
122
+ z-index: 2;
123
+ border-radius: 6px;
124
+ transition: 0.4s;
125
+ transform: translateY(0);
126
+ }
127
+ #three-d-modal .bt-modal-body {
128
+ height: 380px;
129
+ margin: 0 20px;
130
+ background-color: white;
131
+ border: 1px solid lightgray;
132
+ }
133
+ #three-d-modal .bt-modal-header {
134
+ height: 40px;
135
+ text-align: center;
136
+ line-height: 40px;
137
+ }
138
+ #three-d-modal .bt-mask {
139
+ position: absolute;
140
+ top: 0;
141
+ left: 0;
142
+ height: 100%;
143
+ width: 100%;
144
+ background-color: black;
145
+ opacity: 0.75;
146
+ }
147
  #paypal-container iframe {
148
  display: none;
149
  }
170
  }
171
  button.braintree-paypal-button.braintree-paypal-loading:hover {
172
  background: #014c6b url('../../../images/gene/braintree/paypal-loading.gif') center center no-repeat;
173
+ background-size: 32px;
174
  }
175
  button.braintree-paypal-button:hover {
176
  background: #0175a6;
skin/frontend/base/default/css/gene/braintree/iwd.css CHANGED
@@ -92,6 +92,58 @@
92
  .braintree-hostedfield .cvv-what-is-this {
93
  margin-left: 0;
94
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  #paypal-container iframe {
96
  display: none;
97
  }
@@ -118,6 +170,7 @@ button.braintree-paypal-button.braintree-paypal-loading > span {
118
  }
119
  button.braintree-paypal-button.braintree-paypal-loading:hover {
120
  background: #014c6b url('../../../images/gene/braintree/paypal-loading.gif') center center no-repeat;
 
121
  }
122
  button.braintree-paypal-button:hover {
123
  background: #0175a6;
92
  .braintree-hostedfield .cvv-what-is-this {
93
  margin-left: 0;
94
  }
95
+ #three-d-modal {
96
+ position: fixed;
97
+ top: 0;
98
+ left: 0;
99
+ display: flex;
100
+ align-items: center;
101
+ height: 100vh;
102
+ width: 100vw;
103
+ z-index: 100000;
104
+ visibility: visible;
105
+ transition: 0.4s;
106
+ opacity: 1;
107
+ }
108
+ #three-d-modal.hidden {
109
+ visibility: hidden;
110
+ transition: 0.4s;
111
+ opacity: 0;
112
+ }
113
+ #three-d-modal.hidden .bt-modal-frame {
114
+ transition: 0.4s;
115
+ transform: translateY(80px);
116
+ }
117
+ #three-d-modal .bt-modal-frame {
118
+ height: 450px;
119
+ width: 440px;
120
+ margin: auto;
121
+ background-color: #ffffff;
122
+ z-index: 2;
123
+ border-radius: 6px;
124
+ transition: 0.4s;
125
+ transform: translateY(0);
126
+ }
127
+ #three-d-modal .bt-modal-body {
128
+ height: 380px;
129
+ margin: 0 20px;
130
+ background-color: white;
131
+ border: 1px solid lightgray;
132
+ }
133
+ #three-d-modal .bt-modal-header {
134
+ height: 40px;
135
+ text-align: center;
136
+ line-height: 40px;
137
+ }
138
+ #three-d-modal .bt-mask {
139
+ position: absolute;
140
+ top: 0;
141
+ left: 0;
142
+ height: 100%;
143
+ width: 100%;
144
+ background-color: black;
145
+ opacity: 0.75;
146
+ }
147
  #paypal-container iframe {
148
  display: none;
149
  }
170
  }
171
  button.braintree-paypal-button.braintree-paypal-loading:hover {
172
  background: #014c6b url('../../../images/gene/braintree/paypal-loading.gif') center center no-repeat;
173
+ background-size: 32px;
174
  }
175
  button.braintree-paypal-button:hover {
176
  background: #0175a6;
skin/frontend/base/default/css/gene/braintree/magestore.css CHANGED
@@ -92,6 +92,58 @@
92
  .braintree-hostedfield .cvv-what-is-this {
93
  margin-left: 0;
94
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  #paypal-container iframe {
96
  display: none;
97
  }
@@ -118,6 +170,7 @@ button.braintree-paypal-button.braintree-paypal-loading > span {
118
  }
119
  button.braintree-paypal-button.braintree-paypal-loading:hover {
120
  background: #014c6b url('../../../images/gene/braintree/paypal-loading.gif') center center no-repeat;
 
121
  }
122
  button.braintree-paypal-button:hover {
123
  background: #0175a6;
92
  .braintree-hostedfield .cvv-what-is-this {
93
  margin-left: 0;
94
  }
95
+ #three-d-modal {
96
+ position: fixed;
97
+ top: 0;
98
+ left: 0;
99
+ display: flex;
100
+ align-items: center;
101
+ height: 100vh;
102
+ width: 100vw;
103
+ z-index: 100000;
104
+ visibility: visible;
105
+ transition: 0.4s;
106
+ opacity: 1;
107
+ }
108
+ #three-d-modal.hidden {
109
+ visibility: hidden;
110
+ transition: 0.4s;
111
+ opacity: 0;
112
+ }
113
+ #three-d-modal.hidden .bt-modal-frame {
114
+ transition: 0.4s;
115
+ transform: translateY(80px);
116
+ }
117
+ #three-d-modal .bt-modal-frame {
118
+ height: 450px;
119
+ width: 440px;
120
+ margin: auto;
121
+ background-color: #ffffff;
122
+ z-index: 2;
123
+ border-radius: 6px;
124
+ transition: 0.4s;
125
+ transform: translateY(0);
126
+ }
127
+ #three-d-modal .bt-modal-body {
128
+ height: 380px;
129
+ margin: 0 20px;
130
+ background-color: white;
131
+ border: 1px solid lightgray;
132
+ }
133
+ #three-d-modal .bt-modal-header {
134
+ height: 40px;
135
+ text-align: center;
136
+ line-height: 40px;
137
+ }
138
+ #three-d-modal .bt-mask {
139
+ position: absolute;
140
+ top: 0;
141
+ left: 0;
142
+ height: 100%;
143
+ width: 100%;
144
+ background-color: black;
145
+ opacity: 0.75;
146
+ }
147
  #paypal-container iframe {
148
  display: none;
149
  }
170
  }
171
  button.braintree-paypal-button.braintree-paypal-loading:hover {
172
  background: #014c6b url('../../../images/gene/braintree/paypal-loading.gif') center center no-repeat;
173
+ background-size: 32px;
174
  }
175
  button.braintree-paypal-button:hover {
176
  background: #0175a6;
skin/frontend/base/default/css/gene/braintree/oye.css CHANGED
@@ -92,6 +92,58 @@
92
  .braintree-hostedfield .cvv-what-is-this {
93
  margin-left: 0;
94
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  #paypal-container iframe {
96
  display: none;
97
  }
@@ -118,6 +170,7 @@ button.braintree-paypal-button.braintree-paypal-loading > span {
118
  }
119
  button.braintree-paypal-button.braintree-paypal-loading:hover {
120
  background: #014c6b url('../../../images/gene/braintree/paypal-loading.gif') center center no-repeat;
 
121
  }
122
  button.braintree-paypal-button:hover {
123
  background: #0175a6;
92
  .braintree-hostedfield .cvv-what-is-this {
93
  margin-left: 0;
94
  }
95
+ #three-d-modal {
96
+ position: fixed;
97
+ top: 0;
98
+ left: 0;
99
+ display: flex;
100
+ align-items: center;
101
+ height: 100vh;
102
+ width: 100vw;
103
+ z-index: 100000;
104
+ visibility: visible;
105
+ transition: 0.4s;
106
+ opacity: 1;
107
+ }
108
+ #three-d-modal.hidden {
109
+ visibility: hidden;
110
+ transition: 0.4s;
111
+ opacity: 0;
112
+ }
113
+ #three-d-modal.hidden .bt-modal-frame {
114
+ transition: 0.4s;
115
+ transform: translateY(80px);
116
+ }
117
+ #three-d-modal .bt-modal-frame {
118
+ height: 450px;
119
+ width: 440px;
120
+ margin: auto;
121
+ background-color: #ffffff;
122
+ z-index: 2;
123
+ border-radius: 6px;
124
+ transition: 0.4s;
125
+ transform: translateY(0);
126
+ }
127
+ #three-d-modal .bt-modal-body {
128
+ height: 380px;
129
+ margin: 0 20px;
130
+ background-color: white;
131
+ border: 1px solid lightgray;
132
+ }
133
+ #three-d-modal .bt-modal-header {
134
+ height: 40px;
135
+ text-align: center;
136
+ line-height: 40px;
137
+ }
138
+ #three-d-modal .bt-mask {
139
+ position: absolute;
140
+ top: 0;
141
+ left: 0;
142
+ height: 100%;
143
+ width: 100%;
144
+ background-color: black;
145
+ opacity: 0.75;
146
+ }
147
  #paypal-container iframe {
148
  display: none;
149
  }
170
  }
171
  button.braintree-paypal-button.braintree-paypal-loading:hover {
172
  background: #014c6b url('../../../images/gene/braintree/paypal-loading.gif') center center no-repeat;
173
+ background-size: 32px;
174
  }
175
  button.braintree-paypal-button:hover {
176
  background: #0175a6;
skin/frontend/base/default/css/gene/braintree/unicode.css CHANGED
@@ -92,6 +92,58 @@
92
  .braintree-hostedfield .cvv-what-is-this {
93
  margin-left: 0;
94
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  #paypal-container iframe {
96
  display: none;
97
  }
@@ -118,6 +170,7 @@ button.braintree-paypal-button.braintree-paypal-loading > span {
118
  }
119
  button.braintree-paypal-button.braintree-paypal-loading:hover {
120
  background: #014c6b url('../../../images/gene/braintree/paypal-loading.gif') center center no-repeat;
 
121
  }
122
  button.braintree-paypal-button:hover {
123
  background: #0175a6;
92
  .braintree-hostedfield .cvv-what-is-this {
93
  margin-left: 0;
94
  }
95
+ #three-d-modal {
96
+ position: fixed;
97
+ top: 0;
98
+ left: 0;
99
+ display: flex;
100
+ align-items: center;
101
+ height: 100vh;
102
+ width: 100vw;
103
+ z-index: 100000;
104
+ visibility: visible;
105
+ transition: 0.4s;
106
+ opacity: 1;
107
+ }
108
+ #three-d-modal.hidden {
109
+ visibility: hidden;
110
+ transition: 0.4s;
111
+ opacity: 0;
112
+ }
113
+ #three-d-modal.hidden .bt-modal-frame {
114
+ transition: 0.4s;
115
+ transform: translateY(80px);
116
+ }
117
+ #three-d-modal .bt-modal-frame {
118
+ height: 450px;
119
+ width: 440px;
120
+ margin: auto;
121
+ background-color: #ffffff;
122
+ z-index: 2;
123
+ border-radius: 6px;
124
+ transition: 0.4s;
125
+ transform: translateY(0);
126
+ }
127
+ #three-d-modal .bt-modal-body {
128
+ height: 380px;
129
+ margin: 0 20px;
130
+ background-color: white;
131
+ border: 1px solid lightgray;
132
+ }
133
+ #three-d-modal .bt-modal-header {
134
+ height: 40px;
135
+ text-align: center;
136
+ line-height: 40px;
137
+ }
138
+ #three-d-modal .bt-mask {
139
+ position: absolute;
140
+ top: 0;
141
+ left: 0;
142
+ height: 100%;
143
+ width: 100%;
144
+ background-color: black;
145
+ opacity: 0.75;
146
+ }
147
  #paypal-container iframe {
148
  display: none;
149
  }
170
  }
171
  button.braintree-paypal-button.braintree-paypal-loading:hover {
172
  background: #014c6b url('../../../images/gene/braintree/paypal-loading.gif') center center no-repeat;
173
+ background-size: 32px;
174
  }
175
  button.braintree-paypal-button:hover {
176
  background: #0175a6;