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 | 1.0.5 |
Comparing to | |
See all releases |
Code changes from version 1.0.4.1 to 1.0.5
- app/code/community/Gene/Braintree/Block/Creditcard.php +26 -1
- app/code/community/Gene/Braintree/Block/Creditcard/Info.php +1 -1
- app/code/community/Gene/Braintree/Block/Info.php +6 -0
- app/code/community/Gene/Braintree/Block/Js.php +13 -2
- app/code/community/Gene/Braintree/Block/Saved.php +10 -0
- app/code/community/Gene/Braintree/Model/Observer.php +42 -17
- app/code/community/Gene/Braintree/Model/Paymentmethod/Abstract.php +3 -2
- app/code/community/Gene/Braintree/Model/Paymentmethod/Creditcard.php +34 -38
- app/code/community/Gene/Braintree/Model/Paymentmethod/Paypal.php +0 -3
- app/code/community/Gene/Braintree/Model/Source/Creditcard/FormIntegration.php +34 -0
- app/code/community/Gene/Braintree/Model/Wrapper/Braintree.php +309 -50
- app/code/community/Gene/Braintree/controllers/CheckoutController.php +112 -5
- app/code/community/Gene/Braintree/etc/config.xml +13 -1
- app/code/community/Gene/Braintree/etc/system.xml +23 -0
- app/design/adminhtml/default/default/layout/gene/braintree.xml +2 -2
- app/design/adminhtml/default/default/template/gene/braintree/creditcard.phtml +0 -31
- app/design/adminhtml/default/default/template/gene/braintree/creditcard/hostedfields.phtml +124 -0
- app/design/adminhtml/default/default/template/gene/braintree/js.phtml +109 -37
- app/design/frontend/base/default/layout/gene/braintree.xml +36 -12
- app/design/frontend/base/default/template/gene/braintree/creditcard.phtml +36 -62
- app/design/frontend/base/default/template/gene/braintree/creditcard/hostedfields.phtml +96 -0
- app/design/frontend/base/default/template/gene/braintree/js/aheadworks.phtml +103 -308
- app/design/frontend/base/default/template/gene/braintree/js/amasty.phtml +78 -356
- app/design/frontend/base/default/template/gene/braintree/js/default.phtml +91 -162
- app/design/frontend/base/default/template/gene/braintree/js/firecheckout.phtml +50 -331
- app/design/frontend/base/default/template/gene/braintree/js/idev.phtml +59 -389
- app/design/frontend/base/default/template/gene/braintree/js/iwd.phtml +133 -349
- app/design/frontend/base/default/template/gene/braintree/js/magestore.phtml +91 -337
- app/design/frontend/base/default/template/gene/braintree/js/setup.phtml +18 -2
- app/design/frontend/base/default/template/gene/braintree/js/unicode.phtml +85 -0
- app/design/frontend/base/default/template/gene/braintree/paypal.phtml +25 -41
- js/gene/braintree/braintree-0.1.js +7 -0
- js/gene/braintree/braintree.js +0 -5
- js/gene/braintree/config.codekit +841 -0
- js/gene/braintree/vzero-0.5.js +2074 -0
- js/gene/braintree/vzero-0.5.min.js +1 -0
- js/gene/braintree/vzero.js +0 -775
- package.xml +4 -4
- skin/frontend/base/default/css/gene/braintree/aheadworks.css +118 -0
- skin/frontend/base/default/css/gene/braintree/amasty.css +126 -3
- skin/frontend/base/default/css/gene/braintree/default.css +124 -0
- skin/frontend/base/default/css/gene/braintree/firecheckout.css +120 -8
- skin/frontend/base/default/css/gene/braintree/idev.css +106 -0
- skin/frontend/base/default/css/gene/braintree/iwd.css +119 -0
- skin/frontend/base/default/css/gene/braintree/magestore.css +124 -12
- skin/frontend/base/default/css/gene/braintree/unicode.css +136 -0
app/code/community/Gene/Braintree/Block/Creditcard.php
CHANGED
@@ -12,13 +12,25 @@ class Gene_Braintree_Block_Creditcard extends Mage_Payment_Block_Form_Cc
|
|
12 |
*/
|
13 |
private $_savedDetails = false;
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
/**
|
16 |
* Set the template
|
17 |
*/
|
18 |
protected function _construct()
|
19 |
{
|
20 |
parent::_construct();
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
}
|
23 |
|
24 |
/**
|
@@ -140,4 +152,17 @@ class Gene_Braintree_Block_Creditcard extends Mage_Payment_Block_Form_Cc
|
|
140 |
return 'card.png';
|
141 |
}
|
142 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
}
|
12 |
*/
|
13 |
private $_savedDetails = false;
|
14 |
|
15 |
+
/**
|
16 |
+
* We can use the same token twice
|
17 |
+
* @var bool
|
18 |
+
*/
|
19 |
+
private $token = false;
|
20 |
+
|
21 |
/**
|
22 |
* Set the template
|
23 |
*/
|
24 |
protected function _construct()
|
25 |
{
|
26 |
parent::_construct();
|
27 |
+
|
28 |
+
// Utilise a differente template if we're using Hosted Fields
|
29 |
+
if(Mage::getModel('gene_braintree/paymentmethod_creditcard')->getConfigData('form_integration') == Gene_Braintree_Model_Source_Creditcard_FormIntegration::INTEGRATION_HOSTED) {
|
30 |
+
$this->setTemplate('gene/braintree/creditcard/hostedfields.phtml');
|
31 |
+
} else {
|
32 |
+
$this->setTemplate('gene/braintree/creditcard.phtml');
|
33 |
+
}
|
34 |
}
|
35 |
|
36 |
/**
|
152 |
return 'card.png';
|
153 |
}
|
154 |
|
155 |
+
/**
|
156 |
+
* Generate and return a token
|
157 |
+
*
|
158 |
+
* @return mixed
|
159 |
+
*/
|
160 |
+
protected function getClientToken()
|
161 |
+
{
|
162 |
+
if(!$this->token) {
|
163 |
+
$this->token = Mage::getSingleton('gene_braintree/wrapper_braintree')->init()->generateToken();
|
164 |
+
}
|
165 |
+
return $this->token;
|
166 |
+
}
|
167 |
+
|
168 |
}
|
app/code/community/Gene/Braintree/Block/Creditcard/Info.php
CHANGED
@@ -30,7 +30,7 @@ class Gene_Braintree_Block_Creditcard_Info extends Gene_Braintree_Block_Info
|
|
30 |
$transport = parent::_prepareSpecificInformation($transport);
|
31 |
|
32 |
// Only display this information if it's a single invoice
|
33 |
-
if($this->isSingleInvoice()) {
|
34 |
|
35 |
// Build up the data we wish to pass through
|
36 |
$data = array(
|
30 |
$transport = parent::_prepareSpecificInformation($transport);
|
31 |
|
32 |
// Only display this information if it's a single invoice
|
33 |
+
if($this->isSingleInvoice() || ($this->getInfo()->getCcLast4() && $this->getInfo()->getCcType())) {
|
34 |
|
35 |
// Build up the data we wish to pass through
|
36 |
$data = array(
|
app/code/community/Gene/Braintree/Block/Info.php
CHANGED
@@ -161,6 +161,12 @@ class Gene_Braintree_Block_Info extends Mage_Payment_Block_Info
|
|
161 |
}
|
162 |
|
163 |
return $this->_getWrapper()->getCleanTransactionId($this->getViewedObject()->getTransactionId());
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
}
|
165 |
|
166 |
return false;
|
161 |
}
|
162 |
|
163 |
return $this->_getWrapper()->getCleanTransactionId($this->getViewedObject()->getTransactionId());
|
164 |
+
} else if(!$this->getViewedObject()) {
|
165 |
+
// If we don't have a viewed object just utilise the information in the model
|
166 |
+
$info = $this->getData('info');
|
167 |
+
if ($info instanceof Mage_Payment_Model_Info && $this->getInfo()->getLastTransId()) {
|
168 |
+
return $this->_getWrapper()->getCleanTransactionId($this->getInfo()->getLastTransId());
|
169 |
+
}
|
170 |
}
|
171 |
|
172 |
return false;
|
app/code/community/Gene/Braintree/Block/Js.php
CHANGED
@@ -59,6 +59,16 @@ class Gene_Braintree_Block_Js extends Mage_Core_Block_Template
|
|
59 |
return var_export(Mage::getModel('gene_braintree/paymentmethod_creditcard')->is3DEnabled(), true);
|
60 |
}
|
61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
/**
|
63 |
* Generate and return a token
|
64 |
*
|
@@ -122,8 +132,9 @@ class Gene_Braintree_Block_Js extends Mage_Core_Block_Template
|
|
122 |
*/
|
123 |
protected function _toHtml()
|
124 |
{
|
125 |
-
// Check the payment method is active
|
126 |
-
if($this->isCreditCardActive() || $this->isPayPalActive()) {
|
|
|
127 |
return parent::_toHtml();
|
128 |
}
|
129 |
|
59 |
return var_export(Mage::getModel('gene_braintree/paymentmethod_creditcard')->is3DEnabled(), true);
|
60 |
}
|
61 |
|
62 |
+
/**
|
63 |
+
* Is the system set to use hosted fields for credit card processing?
|
64 |
+
*
|
65 |
+
* @return bool
|
66 |
+
*/
|
67 |
+
protected function isHostedFields()
|
68 |
+
{
|
69 |
+
return var_export(Mage::getModel('gene_braintree/paymentmethod_creditcard')->getConfigData('form_integration') == Gene_Braintree_Model_Source_Creditcard_FormIntegration::INTEGRATION_HOSTED, true);
|
70 |
+
}
|
71 |
+
|
72 |
/**
|
73 |
* Generate and return a token
|
74 |
*
|
132 |
*/
|
133 |
protected function _toHtml()
|
134 |
{
|
135 |
+
// Check the payment method is active, block duplicate rendering of this block
|
136 |
+
if(($this->isCreditCardActive() || $this->isPayPalActive()) && !Mage::registry('gene_js_loaded_' . $this->getTemplate())) {
|
137 |
+
Mage::register('gene_js_loaded_' . $this->getTemplate(), true);
|
138 |
return parent::_toHtml();
|
139 |
}
|
140 |
|
app/code/community/Gene/Braintree/Block/Saved.php
CHANGED
@@ -31,4 +31,14 @@ class Gene_Braintree_Block_Saved extends Mage_Core_Block_Template
|
|
31 |
return Mage::getSingleton('gene_braintree/saved')->getSavedMethodsByType($type);
|
32 |
}
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
}
|
31 |
return Mage::getSingleton('gene_braintree/saved')->getSavedMethodsByType($type);
|
32 |
}
|
33 |
|
34 |
+
/**
|
35 |
+
* Don't cache this block as it updates whenever the customers adds a new card
|
36 |
+
*
|
37 |
+
* @return int
|
38 |
+
*/
|
39 |
+
public function getCacheLifetime()
|
40 |
+
{
|
41 |
+
return false;
|
42 |
+
}
|
43 |
+
|
44 |
}
|
app/code/community/Gene/Braintree/Model/Observer.php
CHANGED
@@ -31,6 +31,11 @@ class Gene_Braintree_Model_Observer
|
|
31 |
$layout->getUpdate()->addHandle('amasty_onestep_checkout');
|
32 |
}
|
33 |
|
|
|
|
|
|
|
|
|
|
|
34 |
}
|
35 |
|
36 |
// As some 3rd party checkouts use the same handles, and URL we have to dynamically add new handles
|
@@ -44,7 +49,6 @@ class Gene_Braintree_Model_Observer
|
|
44 |
}
|
45 |
|
46 |
// Attempt to detect Idev_OneStepCheckout
|
47 |
-
// @todo add new handle for idev
|
48 |
if (Mage::helper('core')->isModuleEnabled('Idev_OneStepCheckout')) {
|
49 |
$layout->getUpdate()->addHandle('idev_onestepcheckout_index');
|
50 |
}
|
@@ -55,9 +59,11 @@ class Gene_Braintree_Model_Observer
|
|
55 |
}
|
56 |
|
57 |
/**
|
58 |
-
* Store the customer ID if
|
59 |
*
|
60 |
-
* @param Varien_Event_Observer $observer
|
|
|
|
|
61 |
*/
|
62 |
public function completeCheckout(Varien_Event_Observer $observer)
|
63 |
{
|
@@ -72,6 +78,9 @@ class Gene_Braintree_Model_Observer
|
|
72 |
$customer->setBraintreeCustomerId(Mage::getSingleton('checkout/session')->getBraintreeCustomerId())->save();
|
73 |
}
|
74 |
|
|
|
|
|
|
|
75 |
// Unset the ID from the session
|
76 |
Mage::getSingleton('checkout/session')->unsetData('braintree_customer_id');
|
77 |
|
@@ -128,23 +137,10 @@ class Gene_Braintree_Model_Observer
|
|
128 |
return $this;
|
129 |
}
|
130 |
|
131 |
-
/**
|
132 |
-
* Store the currency mapping as a JSON string
|
133 |
-
*
|
134 |
-
* @param \Varien_Event_Observer $observer
|
135 |
-
*
|
136 |
-
* @return $this
|
137 |
-
*/
|
138 |
-
public function modifyCurrencyMapping(Varien_Event_Observer $observer)
|
139 |
-
{
|
140 |
-
|
141 |
-
return $this;
|
142 |
-
}
|
143 |
-
|
144 |
/**
|
145 |
* Should we capture the payment?
|
146 |
*
|
147 |
-
* @param $order
|
148 |
*
|
149 |
* @return bool
|
150 |
*/
|
@@ -158,4 +154,33 @@ class Gene_Braintree_Model_Observer
|
|
158 |
}
|
159 |
return false;
|
160 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
}
|
31 |
$layout->getUpdate()->addHandle('amasty_onestep_checkout');
|
32 |
}
|
33 |
|
34 |
+
// Attempt to detect Unicode OP Checkout
|
35 |
+
if (Mage::helper('core')->isModuleEnabled('Uni_Opcheckout') && Mage::helper('opcheckout')->isActive()) {
|
36 |
+
$layout->getUpdate()->addHandle('unicode_onestep_checkout');
|
37 |
+
}
|
38 |
+
|
39 |
}
|
40 |
|
41 |
// As some 3rd party checkouts use the same handles, and URL we have to dynamically add new handles
|
49 |
}
|
50 |
|
51 |
// Attempt to detect Idev_OneStepCheckout
|
|
|
52 |
if (Mage::helper('core')->isModuleEnabled('Idev_OneStepCheckout')) {
|
53 |
$layout->getUpdate()->addHandle('idev_onestepcheckout_index');
|
54 |
}
|
59 |
}
|
60 |
|
61 |
/**
|
62 |
+
* Store the generated customer ID if it's present in the session
|
63 |
*
|
64 |
+
* @param \Varien_Event_Observer $observer
|
65 |
+
*
|
66 |
+
* @return $this
|
67 |
*/
|
68 |
public function completeCheckout(Varien_Event_Observer $observer)
|
69 |
{
|
78 |
$customer->setBraintreeCustomerId(Mage::getSingleton('checkout/session')->getBraintreeCustomerId())->save();
|
79 |
}
|
80 |
|
81 |
+
// Perform any cleaning up required
|
82 |
+
Gene_Braintree_Model_Wrapper_Braintree::cleanUp();
|
83 |
+
|
84 |
// Unset the ID from the session
|
85 |
Mage::getSingleton('checkout/session')->unsetData('braintree_customer_id');
|
86 |
|
137 |
return $this;
|
138 |
}
|
139 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
/**
|
141 |
* Should we capture the payment?
|
142 |
*
|
143 |
+
* @param \Mage_Sales_Model_Order $order
|
144 |
*
|
145 |
* @return bool
|
146 |
*/
|
154 |
}
|
155 |
return false;
|
156 |
}
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Check if compilation is enabled, if so copy over the certificates
|
160 |
+
*
|
161 |
+
* @return $this
|
162 |
+
*/
|
163 |
+
public function checkCompilation()
|
164 |
+
{
|
165 |
+
// Determine whether the compiler has been enabled
|
166 |
+
if(defined('COMPILER_INCLUDE_PATH')) {
|
167 |
+
$certificates = array('api_braintreegateway_com.ca.crt', 'sandbox_braintreegateway_com.ca.crt');
|
168 |
+
$compilerPath = COMPILER_INCLUDE_PATH;
|
169 |
+
$directory = '/ssl/';
|
170 |
+
|
171 |
+
// Verify the SSL folder exists
|
172 |
+
if(!is_dir($compilerPath . '/..' . $directory)) {
|
173 |
+
mkdir($compilerPath . '/..' . $directory);
|
174 |
+
}
|
175 |
+
|
176 |
+
// Loop through each certificate and check whether it's in the includes directory, if not copy it!
|
177 |
+
foreach($certificates as $file) {
|
178 |
+
if(!file_exists($compilerPath . '/..' . $directory . $file)) {
|
179 |
+
copy(Mage::getBaseDir('lib') . $directory . $file, $compilerPath . '/..' . $directory . $file);
|
180 |
+
}
|
181 |
+
}
|
182 |
+
}
|
183 |
+
|
184 |
+
return $this;
|
185 |
+
}
|
186 |
}
|
app/code/community/Gene/Braintree/Model/Paymentmethod/Abstract.php
CHANGED
@@ -58,7 +58,7 @@ abstract class Gene_Braintree_Model_Paymentmethod_Abstract extends Mage_Payment_
|
|
58 |
/**
|
59 |
* Return configuration values
|
60 |
*
|
61 |
-
* @param $
|
62 |
*
|
63 |
* @return mixed
|
64 |
*/
|
@@ -147,7 +147,7 @@ abstract class Gene_Braintree_Model_Paymentmethod_Abstract extends Mage_Payment_
|
|
147 |
}
|
148 |
|
149 |
// Swap between refund and void
|
150 |
-
$result = ($transaction->status === Braintree_Transaction::SETTLED || (isset($transaction->paypal) && isset($transaction->paypal['paymentId']) && !empty($transaction->paypal['paymentId'])))
|
151 |
? Braintree_Transaction::refund($transactionId, $refundAmount)
|
152 |
: Braintree_Transaction::void($transactionId);
|
153 |
|
@@ -183,6 +183,7 @@ abstract class Gene_Braintree_Model_Paymentmethod_Abstract extends Mage_Payment_
|
|
183 |
|
184 |
/**
|
185 |
* Set transaction ID into creditmemo for informational purposes
|
|
|
186 |
* @param Mage_Sales_Model_Order_Creditmemo $creditmemo
|
187 |
* @param Mage_Sales_Model_Order_Payment $payment
|
188 |
* @return Mage_Payment_Model_Method_Abstract
|
58 |
/**
|
59 |
* Return configuration values
|
60 |
*
|
61 |
+
* @param $key
|
62 |
*
|
63 |
* @return mixed
|
64 |
*/
|
147 |
}
|
148 |
|
149 |
// Swap between refund and void
|
150 |
+
$result = ($transaction->status === Braintree_Transaction::SETTLED || $transaction->status == Braintree_Transaction::SETTLING || (isset($transaction->paypal) && isset($transaction->paypal['paymentId']) && !empty($transaction->paypal['paymentId'])))
|
151 |
? Braintree_Transaction::refund($transactionId, $refundAmount)
|
152 |
: Braintree_Transaction::void($transactionId);
|
153 |
|
183 |
|
184 |
/**
|
185 |
* Set transaction ID into creditmemo for informational purposes
|
186 |
+
*
|
187 |
* @param Mage_Sales_Model_Order_Creditmemo $creditmemo
|
188 |
* @param Mage_Sales_Model_Order_Payment $payment
|
189 |
* @return Mage_Payment_Model_Method_Abstract
|
app/code/community/Gene/Braintree/Model/Paymentmethod/Creditcard.php
CHANGED
@@ -88,19 +88,6 @@ class Gene_Braintree_Model_Paymentmethod_Creditcard extends Gene_Braintree_Model
|
|
88 |
return false;
|
89 |
}
|
90 |
|
91 |
-
/**
|
92 |
-
* Do we need to send the CCV, which Braintree calls a CVV?
|
93 |
-
*
|
94 |
-
* @return mixed
|
95 |
-
*/
|
96 |
-
public function requireCcv()
|
97 |
-
{
|
98 |
-
if($this->_getConfig('useccv')) {
|
99 |
-
return true;
|
100 |
-
}
|
101 |
-
return false;
|
102 |
-
}
|
103 |
-
|
104 |
/**
|
105 |
* Validate payment method information object
|
106 |
*
|
@@ -120,6 +107,9 @@ class Gene_Braintree_Model_Paymentmethod_Creditcard extends Gene_Braintree_Model
|
|
120 |
|
121 |
Gene_Braintree_Model_Debug::log('Card payment has failed, missing token/nonce');
|
122 |
|
|
|
|
|
|
|
123 |
Mage::throwException(
|
124 |
$this->_getHelper()->__('Your card payment has failed, please try again.')
|
125 |
);
|
@@ -128,35 +118,27 @@ class Gene_Braintree_Model_Paymentmethod_Creditcard extends Gene_Braintree_Model
|
|
128 |
|
129 |
Gene_Braintree_Model_Debug::log('No saved card token present');
|
130 |
|
131 |
-
|
132 |
-
|
133 |
-
);
|
134 |
-
}
|
135 |
-
|
136 |
-
// If the CVV is required and it's not been sent in the request throw an error
|
137 |
-
if ($this->requireCcv() && (!isset($paymentPost['cc_cid']) || empty($paymentPost['cc_cid'])) && empty($paymentPost['card_payment_method_token'])) {
|
138 |
|
139 |
-
// Log it
|
140 |
-
Gene_Braintree_Model_Debug::log('CVV required but not present in request');
|
141 |
-
|
142 |
-
// Politely inform the user
|
143 |
Mage::throwException(
|
144 |
-
$this->_getHelper()->__('
|
145 |
);
|
146 |
-
|
147 |
}
|
148 |
|
149 |
-
|
150 |
return $this;
|
151 |
}
|
152 |
|
153 |
/**
|
154 |
* Psuedo _authorize function so we can pass in extra data
|
155 |
-
* @param Varien_Object $payment
|
156 |
-
* @param $amount
|
157 |
-
* @param bool $shouldCapture
|
158 |
*
|
159 |
-
* @
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
*/
|
161 |
protected function _authorize(Varien_Object $payment, $amount, $shouldCapture = false, $token = false)
|
162 |
{
|
@@ -172,11 +154,6 @@ class Gene_Braintree_Model_Paymentmethod_Creditcard extends Gene_Braintree_Model
|
|
172 |
// Attempt to create the sale
|
173 |
try {
|
174 |
|
175 |
-
// Pass over the CVV/CCV
|
176 |
-
if ($this->requireCcv() && isset($paymentPost['cc_cid'])) {
|
177 |
-
$paymentArray['cvv'] = $paymentPost['cc_cid'];
|
178 |
-
}
|
179 |
-
|
180 |
// Check to see whether we're using a payment method token?
|
181 |
if(isset($paymentPost['card_payment_method_token']) && !empty($paymentPost['card_payment_method_token']) && !in_array($paymentPost['card_payment_method_token'], array('other', 'threedsecure'))) {
|
182 |
|
@@ -264,6 +241,9 @@ class Gene_Braintree_Model_Paymentmethod_Creditcard extends Gene_Braintree_Model
|
|
264 |
// If there's an error
|
265 |
Gene_Braintree_Model_Debug::log($e);
|
266 |
|
|
|
|
|
|
|
267 |
Mage::throwException(
|
268 |
$this->_getHelper()->__('There was an issue whilst trying to process your card payment, please try again or another method.')
|
269 |
);
|
@@ -275,6 +255,9 @@ class Gene_Braintree_Model_Paymentmethod_Creditcard extends Gene_Braintree_Model
|
|
275 |
// If the transaction was 3Ds but doesn't contain a 3Ds response
|
276 |
if(($this->is3DEnabled() && isset($saleArray['options']['three_d_secure']['required']) && $saleArray['options']['three_d_secure']['required'] == true) && (!isset($result->transaction->threeDSecureInfo) || (isset($result->transaction->threeDSecureInfo) && is_null($result->transaction->threeDSecureInfo)))) {
|
277 |
|
|
|
|
|
|
|
278 |
// Inform the user that their payment didn't go through 3Ds and thus failed
|
279 |
Mage::throwException($this->_getHelper()->__('This transaction must be passed through 3D secure, please try again or consider using an alternate payment method.'));
|
280 |
}
|
@@ -282,6 +265,9 @@ class Gene_Braintree_Model_Paymentmethod_Creditcard extends Gene_Braintree_Model
|
|
282 |
// If the sale has failed
|
283 |
if ($result->success != true) {
|
284 |
|
|
|
|
|
|
|
285 |
// Dispatch an event for when a payment fails
|
286 |
Mage::dispatchEvent('gene_braintree_creditcard_failed', array('payment' => $payment, 'result' => $result));
|
287 |
|
@@ -309,7 +295,7 @@ class Gene_Braintree_Model_Paymentmethod_Creditcard extends Gene_Braintree_Model
|
|
309 |
}
|
310 |
}
|
311 |
|
312 |
-
Mage::throwException($this->_getHelper()->__('%s. Please try again or attempt refreshing the page.', $result->message));
|
313 |
}
|
314 |
|
315 |
$this->_processSuccessResult($payment, $result, $amount);
|
@@ -319,6 +305,7 @@ class Gene_Braintree_Model_Paymentmethod_Creditcard extends Gene_Braintree_Model
|
|
319 |
|
320 |
/**
|
321 |
* Authorize the requested amount
|
|
|
322 |
* @param Varien_Object $payment
|
323 |
* @param float $amount
|
324 |
*
|
@@ -332,6 +319,7 @@ class Gene_Braintree_Model_Paymentmethod_Creditcard extends Gene_Braintree_Model
|
|
332 |
|
333 |
/**
|
334 |
* Process capturing of a payment
|
|
|
335 |
* @param Varien_Object $payment
|
336 |
* @param float $amount
|
337 |
*
|
@@ -396,8 +384,16 @@ class Gene_Braintree_Model_Paymentmethod_Creditcard extends Gene_Braintree_Model
|
|
396 |
if($result->success) {
|
397 |
$this->_processSuccessResult($payment, $result, $amount);
|
398 |
} else if($result->errors->deepSize() > 0) {
|
|
|
|
|
|
|
|
|
399 |
Mage::throwException($this->_getWrapper()->parseErrors($result->errors->deepAll()));
|
400 |
} else {
|
|
|
|
|
|
|
|
|
401 |
Mage::throwException($result->transaction->processorSettlementResponseCode.': '.$result->transaction->processorSettlementResponseText);
|
402 |
}
|
403 |
|
@@ -476,7 +472,7 @@ class Gene_Braintree_Model_Paymentmethod_Creditcard extends Gene_Braintree_Model
|
|
476 |
*
|
477 |
* @param Varien_Object $payment
|
478 |
* @param Braintree_Result_Successful $result
|
479 |
-
* @param
|
480 |
* @return Varien_Object
|
481 |
*/
|
482 |
protected function _processSuccessResult(Varien_Object $payment, $result, $amount)
|
88 |
return false;
|
89 |
}
|
90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
/**
|
92 |
* Validate payment method information object
|
93 |
*
|
107 |
|
108 |
Gene_Braintree_Model_Debug::log('Card payment has failed, missing token/nonce');
|
109 |
|
110 |
+
// Clean up
|
111 |
+
Gene_Braintree_Model_Wrapper_Braintree::cleanUp();
|
112 |
+
|
113 |
Mage::throwException(
|
114 |
$this->_getHelper()->__('Your card payment has failed, please try again.')
|
115 |
);
|
118 |
|
119 |
Gene_Braintree_Model_Debug::log('No saved card token present');
|
120 |
|
121 |
+
// Clean up
|
122 |
+
Gene_Braintree_Model_Wrapper_Braintree::cleanUp();
|
|
|
|
|
|
|
|
|
|
|
123 |
|
|
|
|
|
|
|
|
|
124 |
Mage::throwException(
|
125 |
+
$this->_getHelper()->__('Your card payment has failed, please try again.')
|
126 |
);
|
|
|
127 |
}
|
128 |
|
|
|
129 |
return $this;
|
130 |
}
|
131 |
|
132 |
/**
|
133 |
* Psuedo _authorize function so we can pass in extra data
|
|
|
|
|
|
|
134 |
*
|
135 |
+
* @param \Varien_Object $payment
|
136 |
+
* @param $amount
|
137 |
+
* @param bool|false $shouldCapture
|
138 |
+
* @param bool|false $token
|
139 |
+
*
|
140 |
+
* @return $this
|
141 |
+
* @throws \Mage_Core_Exception
|
142 |
*/
|
143 |
protected function _authorize(Varien_Object $payment, $amount, $shouldCapture = false, $token = false)
|
144 |
{
|
154 |
// Attempt to create the sale
|
155 |
try {
|
156 |
|
|
|
|
|
|
|
|
|
|
|
157 |
// Check to see whether we're using a payment method token?
|
158 |
if(isset($paymentPost['card_payment_method_token']) && !empty($paymentPost['card_payment_method_token']) && !in_array($paymentPost['card_payment_method_token'], array('other', 'threedsecure'))) {
|
159 |
|
241 |
// If there's an error
|
242 |
Gene_Braintree_Model_Debug::log($e);
|
243 |
|
244 |
+
// Clean up
|
245 |
+
Gene_Braintree_Model_Wrapper_Braintree::cleanUp();
|
246 |
+
|
247 |
Mage::throwException(
|
248 |
$this->_getHelper()->__('There was an issue whilst trying to process your card payment, please try again or another method.')
|
249 |
);
|
255 |
// If the transaction was 3Ds but doesn't contain a 3Ds response
|
256 |
if(($this->is3DEnabled() && isset($saleArray['options']['three_d_secure']['required']) && $saleArray['options']['three_d_secure']['required'] == true) && (!isset($result->transaction->threeDSecureInfo) || (isset($result->transaction->threeDSecureInfo) && is_null($result->transaction->threeDSecureInfo)))) {
|
257 |
|
258 |
+
// Clean up
|
259 |
+
Gene_Braintree_Model_Wrapper_Braintree::cleanUp();
|
260 |
+
|
261 |
// Inform the user that their payment didn't go through 3Ds and thus failed
|
262 |
Mage::throwException($this->_getHelper()->__('This transaction must be passed through 3D secure, please try again or consider using an alternate payment method.'));
|
263 |
}
|
265 |
// If the sale has failed
|
266 |
if ($result->success != true) {
|
267 |
|
268 |
+
// Clean up
|
269 |
+
Gene_Braintree_Model_Wrapper_Braintree::cleanUp();
|
270 |
+
|
271 |
// Dispatch an event for when a payment fails
|
272 |
Mage::dispatchEvent('gene_braintree_creditcard_failed', array('payment' => $payment, 'result' => $result));
|
273 |
|
295 |
}
|
296 |
}
|
297 |
|
298 |
+
Mage::throwException($this->_getHelper()->__('%s. Please try again or attempt refreshing the page.', $this->_getWrapper()->parseMessage($result->message)));
|
299 |
}
|
300 |
|
301 |
$this->_processSuccessResult($payment, $result, $amount);
|
305 |
|
306 |
/**
|
307 |
* Authorize the requested amount
|
308 |
+
*
|
309 |
* @param Varien_Object $payment
|
310 |
* @param float $amount
|
311 |
*
|
319 |
|
320 |
/**
|
321 |
* Process capturing of a payment
|
322 |
+
*
|
323 |
* @param Varien_Object $payment
|
324 |
* @param float $amount
|
325 |
*
|
384 |
if($result->success) {
|
385 |
$this->_processSuccessResult($payment, $result, $amount);
|
386 |
} else if($result->errors->deepSize() > 0) {
|
387 |
+
|
388 |
+
// Clean up
|
389 |
+
Gene_Braintree_Model_Wrapper_Braintree::cleanUp();
|
390 |
+
|
391 |
Mage::throwException($this->_getWrapper()->parseErrors($result->errors->deepAll()));
|
392 |
} else {
|
393 |
+
|
394 |
+
// Clean up
|
395 |
+
Gene_Braintree_Model_Wrapper_Braintree::cleanUp();
|
396 |
+
|
397 |
Mage::throwException($result->transaction->processorSettlementResponseCode.': '.$result->transaction->processorSettlementResponseText);
|
398 |
}
|
399 |
|
472 |
*
|
473 |
* @param Varien_Object $payment
|
474 |
* @param Braintree_Result_Successful $result
|
475 |
+
* @param float $amount
|
476 |
* @return Varien_Object
|
477 |
*/
|
478 |
protected function _processSuccessResult(Varien_Object $payment, $result, $amount)
|
app/code/community/Gene/Braintree/Model/Paymentmethod/Paypal.php
CHANGED
@@ -205,9 +205,6 @@ class Gene_Braintree_Model_Paymentmethod_Paypal extends Gene_Braintree_Model_Pay
|
|
205 |
$payment->setAdditionalInformation('token', $result->transaction->paypal['token']);
|
206 |
}
|
207 |
|
208 |
-
// Save the payment data
|
209 |
-
$payment->save();
|
210 |
-
|
211 |
return $payment;
|
212 |
}
|
213 |
|
205 |
$payment->setAdditionalInformation('token', $result->transaction->paypal['token']);
|
206 |
}
|
207 |
|
|
|
|
|
|
|
208 |
return $payment;
|
209 |
}
|
210 |
|
app/code/community/Gene/Braintree/Model/Source/Creditcard/FormIntegration.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class Gene_Braintree_Model_Source_Creditcard_FormIntegration
|
5 |
+
*
|
6 |
+
* @author Dave Macaulay <dave@gene.co.uk>
|
7 |
+
*/
|
8 |
+
class Gene_Braintree_Model_Source_Creditcard_FormIntegration
|
9 |
+
{
|
10 |
+
|
11 |
+
const INTEGRATION_ACTION_XML_PATH = 'payment/gene_braintree_creditcard/form_integration';
|
12 |
+
|
13 |
+
const INTEGRATION_DEFAULT = 'default';
|
14 |
+
const INTEGRATION_HOSTED = 'hosted';
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Possible actions on order place
|
18 |
+
*
|
19 |
+
* @return array
|
20 |
+
*/
|
21 |
+
public function toOptionArray()
|
22 |
+
{
|
23 |
+
return array(
|
24 |
+
array(
|
25 |
+
'value' => self::INTEGRATION_DEFAULT,
|
26 |
+
'label' => Mage::helper('gene_braintree')->__('Default')
|
27 |
+
),
|
28 |
+
array(
|
29 |
+
'value' => self::INTEGRATION_HOSTED,
|
30 |
+
'label' => Mage::helper('gene_braintree')->__('Hosted Fields')
|
31 |
+
),
|
32 |
+
);
|
33 |
+
}
|
34 |
+
}
|
app/code/community/Gene/Braintree/Model/Wrapper/Braintree.php
CHANGED
@@ -75,11 +75,11 @@ class Gene_Braintree_Model_Wrapper_Braintree extends Mage_Core_Model_Abstract
|
|
75 |
}
|
76 |
|
77 |
/**
|
78 |
-
* Find a transaction
|
79 |
*
|
80 |
* @param $transactionId
|
81 |
*
|
82 |
-
* @
|
83 |
*/
|
84 |
public function findTransaction($transactionId)
|
85 |
{
|
@@ -249,8 +249,12 @@ class Gene_Braintree_Model_Wrapper_Braintree extends Mage_Core_Model_Abstract
|
|
249 |
}
|
250 |
|
251 |
/**
|
252 |
-
* Return
|
253 |
-
|
|
|
|
|
|
|
|
|
254 |
protected function getAdminConfigValue($path)
|
255 |
{
|
256 |
// If we have the getConfigDataValue use that
|
@@ -275,9 +279,15 @@ class Gene_Braintree_Model_Wrapper_Braintree extends Mage_Core_Model_Abstract
|
|
275 |
}
|
276 |
|
277 |
/**
|
278 |
-
* Validate the credentials
|
279 |
*
|
280 |
-
* @
|
|
|
|
|
|
|
|
|
|
|
|
|
281 |
*/
|
282 |
public function validateCredentials($prettyResponse = false, $alreadyInit = false, $merchantAccountId = false, $throwException = false)
|
283 |
{
|
@@ -351,6 +361,7 @@ class Gene_Braintree_Model_Wrapper_Braintree extends Mage_Core_Model_Abstract
|
|
351 |
|
352 |
/**
|
353 |
* Validate the credentials once, this is used during the payment methods available check
|
|
|
354 |
* @return bool
|
355 |
*/
|
356 |
public function validateCredentialsOnce()
|
@@ -407,6 +418,130 @@ class Gene_Braintree_Model_Wrapper_Braintree extends Mage_Core_Model_Abstract
|
|
407 |
return $this->validated;
|
408 |
}
|
409 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
410 |
/**
|
411 |
* Build up the sale request
|
412 |
*
|
@@ -444,43 +579,76 @@ class Gene_Braintree_Model_Wrapper_Braintree extends Mage_Core_Model_Abstract
|
|
444 |
// If the user is already a customer and wants to store in the vault we've gotta do something a bit special
|
445 |
if($storeInVault && $this->checkIsCustomer() && isset($paymentDataArray['paymentMethodNonce'])) {
|
446 |
|
447 |
-
//
|
448 |
-
$
|
449 |
-
'customerId' => $this->getBraintreeId(),
|
450 |
-
'paymentMethodNonce' => $paymentDataArray['paymentMethodNonce'],
|
451 |
-
'billingAddress' => $this->buildAddress($order->getBillingAddress())
|
452 |
-
);
|
453 |
-
|
454 |
-
// Log the create array
|
455 |
-
Gene_Braintree_Model_Debug::log(array('Braintree_PaymentMethod' => $paymentMethodCreate));
|
456 |
|
457 |
-
|
458 |
-
$result = Braintree_PaymentMethod::create($paymentMethodCreate);
|
459 |
|
460 |
-
|
461 |
-
|
|
|
462 |
|
463 |
-
|
464 |
-
|
465 |
|
466 |
-
|
467 |
-
|
468 |
|
469 |
-
|
470 |
-
|
471 |
|
472 |
-
|
473 |
-
|
474 |
|
475 |
-
|
476 |
-
$paymentDataArray['paymentMethodToken'] = $paymentMethod->token;
|
477 |
|
478 |
-
|
479 |
-
|
|
|
|
|
480 |
}
|
481 |
|
482 |
} else {
|
483 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
484 |
}
|
485 |
}
|
486 |
|
@@ -548,7 +716,7 @@ class Gene_Braintree_Model_Wrapper_Braintree extends Mage_Core_Model_Abstract
|
|
548 |
}
|
549 |
|
550 |
/**
|
551 |
-
* Attempt to make the
|
552 |
*
|
553 |
* @param $saleArray
|
554 |
*
|
@@ -563,12 +731,12 @@ class Gene_Braintree_Model_Wrapper_Braintree extends Mage_Core_Model_Abstract
|
|
563 |
}
|
564 |
|
565 |
/**
|
566 |
-
* Submit a payment for settlement
|
567 |
*
|
568 |
* @param $transactionId
|
569 |
* @param $amount
|
570 |
*
|
571 |
-
* @
|
572 |
*/
|
573 |
public function submitForSettlement($transactionId, $amount)
|
574 |
{
|
@@ -579,26 +747,65 @@ class Gene_Braintree_Model_Wrapper_Braintree extends Mage_Core_Model_Abstract
|
|
579 |
}
|
580 |
|
581 |
/**
|
582 |
-
* Build the
|
583 |
-
*
|
584 |
-
* @param Mage_Sales_Model_Order $order
|
585 |
*
|
586 |
* @return string
|
587 |
-
* @throws Mage_Core_Exception
|
588 |
*/
|
589 |
private function buildCustomerId()
|
590 |
{
|
591 |
return md5(uniqid('braintree_',true));
|
592 |
}
|
593 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
594 |
/**
|
595 |
* Build a Magento address model into a Braintree array
|
596 |
*
|
597 |
-
* @param Mage_Sales_Model_Order_Address $address
|
598 |
*
|
599 |
* @return array
|
600 |
*/
|
601 |
-
private function buildAddress(
|
602 |
{
|
603 |
// Build up the initial array
|
604 |
$return = array(
|
@@ -629,9 +836,11 @@ class Gene_Braintree_Model_Wrapper_Braintree extends Mage_Core_Model_Abstract
|
|
629 |
}
|
630 |
|
631 |
/**
|
632 |
-
* Return the correct merchant account ID
|
633 |
*
|
634 |
-
* @
|
|
|
|
|
635 |
*/
|
636 |
public function getMerchantAccountId(Mage_Sales_Model_Order $order = null)
|
637 |
{
|
@@ -647,9 +856,11 @@ class Gene_Braintree_Model_Wrapper_Braintree extends Mage_Core_Model_Abstract
|
|
647 |
}
|
648 |
|
649 |
/**
|
650 |
-
*
|
651 |
*
|
652 |
-
* @
|
|
|
|
|
653 |
*/
|
654 |
public function hasMappedCurrencyCode(Mage_Sales_Model_Order $order = null)
|
655 |
{
|
@@ -678,16 +889,16 @@ class Gene_Braintree_Model_Wrapper_Braintree extends Mage_Core_Model_Abstract
|
|
678 |
}
|
679 |
|
680 |
/**
|
681 |
-
*
|
|
|
|
|
682 |
*
|
683 |
* @return bool
|
684 |
*/
|
685 |
public function currencyMappingEnabled(Mage_Sales_Model_Order $order = null)
|
686 |
{
|
687 |
return Mage::getStoreConfigFlag(self::BRAINTREE_MULTI_CURRENCY)
|
688 |
-
&& Mage::getStoreConfig(self::BRAINTREE_MULTI_CURRENCY_MAPPING)
|
689 |
-
&& ((!$order ? $this->getQuote()->getQuoteCurrencyCode() : $order->getOrderCurrencyCode())
|
690 |
-
!= (!$order ? $this->getQuote()->getBaseCurrencyCode() : $order->getBaseCurrencyCode()));
|
691 |
}
|
692 |
|
693 |
/**
|
@@ -787,6 +998,42 @@ class Gene_Braintree_Model_Wrapper_Braintree extends Mage_Core_Model_Abstract
|
|
787 |
return $customer;
|
788 |
}
|
789 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
790 |
/**
|
791 |
* Clone a transaction
|
792 |
*
|
@@ -828,10 +1075,22 @@ class Gene_Braintree_Model_Wrapper_Braintree extends Mage_Core_Model_Abstract
|
|
828 |
{
|
829 |
$errors = array();
|
830 |
foreach($braintreeErrors as $error) {
|
831 |
-
$errors[] = $error->code . ': ' . $error->message;
|
832 |
}
|
833 |
|
834 |
return implode(', ', $errors);
|
835 |
}
|
836 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
837 |
}
|
75 |
}
|
76 |
|
77 |
/**
|
78 |
+
* Find a transaction within Braintree
|
79 |
*
|
80 |
* @param $transactionId
|
81 |
*
|
82 |
+
* @return object
|
83 |
*/
|
84 |
public function findTransaction($transactionId)
|
85 |
{
|
249 |
}
|
250 |
|
251 |
/**
|
252 |
+
* Return an admin configuration value, older versions of Magento don't implement getConfigDataValue
|
253 |
+
*
|
254 |
+
* @param $path
|
255 |
+
*
|
256 |
+
* @return mixed|\Varien_Simplexml_Element
|
257 |
+
*/
|
258 |
protected function getAdminConfigValue($path)
|
259 |
{
|
260 |
// If we have the getConfigDataValue use that
|
279 |
}
|
280 |
|
281 |
/**
|
282 |
+
* Validate the credentials inputted into the admin area
|
283 |
*
|
284 |
+
* @param bool|false $prettyResponse
|
285 |
+
* @param bool|false $alreadyInit
|
286 |
+
* @param bool|false $merchantAccountId
|
287 |
+
* @param bool|false $throwException
|
288 |
+
*
|
289 |
+
* @return bool|string
|
290 |
+
* @throws \Exception
|
291 |
*/
|
292 |
public function validateCredentials($prettyResponse = false, $alreadyInit = false, $merchantAccountId = false, $throwException = false)
|
293 |
{
|
361 |
|
362 |
/**
|
363 |
* Validate the credentials once, this is used during the payment methods available check
|
364 |
+
*
|
365 |
* @return bool
|
366 |
*/
|
367 |
public function validateCredentialsOnce()
|
418 |
return $this->validated;
|
419 |
}
|
420 |
|
421 |
+
/**
|
422 |
+
* Store a payment method nonce in the vault
|
423 |
+
*
|
424 |
+
* @param $nonce
|
425 |
+
* @param $billingAddress
|
426 |
+
*
|
427 |
+
* @return bool
|
428 |
+
*/
|
429 |
+
public function storeInVault($nonce, $billingAddress = false)
|
430 |
+
{
|
431 |
+
// Create the payment method with this data
|
432 |
+
$paymentMethodCreate = array(
|
433 |
+
'customerId' => $this->getBraintreeId(),
|
434 |
+
'paymentMethodNonce' => $nonce,
|
435 |
+
'options' => array(
|
436 |
+
'verifyCard' => true,
|
437 |
+
'verificationMerchantAccountId' => $this->getMerchantAccountId()
|
438 |
+
)
|
439 |
+
);
|
440 |
+
|
441 |
+
if($customerId = $this->getBraintreeId()) {
|
442 |
+
$paymentMethodCreate['customerId'] = $this->getBraintreeId();
|
443 |
+
}
|
444 |
+
|
445 |
+
// Include billing address information into the payment method
|
446 |
+
if($billingAddress) {
|
447 |
+
|
448 |
+
// Add in the billing address
|
449 |
+
$paymentMethodCreate['billingAddress'] = $billingAddress;
|
450 |
+
|
451 |
+
// Pass over some extra details from the billing address
|
452 |
+
$paymentMethodCreate['cardholderName'] = $billingAddress['firstName'] . ' ' . $billingAddress['lastName'];
|
453 |
+
|
454 |
+
}
|
455 |
+
|
456 |
+
// Dispatch an event to allow modification of the store in vault
|
457 |
+
$object = new Varien_Object();
|
458 |
+
$object->setAttributes($paymentMethodCreate);
|
459 |
+
Mage::dispatchEvent('gene_braintree_store_in_vault', array('object' => $object));
|
460 |
+
$paymentMethodCreate = $object->getAttributes();
|
461 |
+
|
462 |
+
// Create a new billing method
|
463 |
+
return Braintree_PaymentMethod::create($paymentMethodCreate);
|
464 |
+
}
|
465 |
+
|
466 |
+
/**
|
467 |
+
* If the customer is not logged in, but we still need to vault, we're going to create a fake customer
|
468 |
+
*
|
469 |
+
* @param $nonce
|
470 |
+
* @param $billingAddress
|
471 |
+
*
|
472 |
+
* @return \Braintree_Customer
|
473 |
+
*/
|
474 |
+
public function storeInGuestVault($nonce, $billingAddress = false)
|
475 |
+
{
|
476 |
+
$guestCustomerCreate = array(
|
477 |
+
'creditCard' => array(
|
478 |
+
'paymentMethodNonce' => $nonce,
|
479 |
+
'options' => array(
|
480 |
+
'verifyCard' => true,
|
481 |
+
'verificationMerchantAccountId' => $this->getMerchantAccountId()
|
482 |
+
)
|
483 |
+
)
|
484 |
+
);
|
485 |
+
|
486 |
+
// Include billing address information into the customer
|
487 |
+
if($billingAddress) {
|
488 |
+
|
489 |
+
// Add in the billing address
|
490 |
+
$guestCustomerCreate['creditCard']['cardholderName'] = $billingAddress['firstName'] . ' ' . $billingAddress['lastName'];
|
491 |
+
$guestCustomerCreate['creditCard']['billingAddress'] = $billingAddress;
|
492 |
+
|
493 |
+
// Make sure the customer is created with a first name and last name
|
494 |
+
$guestCustomerCreate['firstName'] = $billingAddress['firstName'];
|
495 |
+
$guestCustomerCreate['lastName'] = $billingAddress['lastName'];
|
496 |
+
|
497 |
+
// Conditionally copy over these fields
|
498 |
+
if(isset($billingAddress['email']) && !empty($billingAddress['email'])) {
|
499 |
+
$guestCustomerCreate['email'] = $billingAddress['email'];
|
500 |
+
}
|
501 |
+
if(isset($billingAddress['company']) && !empty($billingAddress['company'])) {
|
502 |
+
$guestCustomerCreate['company'] = $billingAddress['company'];
|
503 |
+
}
|
504 |
+
if(isset($billingAddress['phone']) && !empty($billingAddress['phone'])) {
|
505 |
+
$guestCustomerCreate['phone'] = $billingAddress['phone'];
|
506 |
+
}
|
507 |
+
|
508 |
+
}
|
509 |
+
|
510 |
+
// Dispatch an event to allow modification of the store in vault
|
511 |
+
$object = new Varien_Object();
|
512 |
+
$object->setAttributes($guestCustomerCreate);
|
513 |
+
Mage::dispatchEvent('gene_braintree_store_in_guest_vault', array('object' => $object));
|
514 |
+
$guestCustomerCreate = $object->getAttributes();
|
515 |
+
|
516 |
+
return Braintree_Customer::create($guestCustomerCreate);
|
517 |
+
}
|
518 |
+
|
519 |
+
/**
|
520 |
+
* Clean up any accounts or payment methods that were created temporarily
|
521 |
+
*
|
522 |
+
* @return boolean
|
523 |
+
*/
|
524 |
+
public static function cleanUp()
|
525 |
+
{
|
526 |
+
Mage::dispatchEvent('gene_braintree_cleanup');
|
527 |
+
|
528 |
+
// If a guest customer was created during the checkout we can remove them now
|
529 |
+
if($guestCustomerId = Mage::getSingleton('checkout/session')->getGuestBraintreeCustomerId()) {
|
530 |
+
$wrapper = Mage::getSingleton('gene_braintree/wrapper_braintree');
|
531 |
+
$wrapper->init()->deleteCustomer($guestCustomerId);
|
532 |
+
Mage::getSingleton('checkout/session')->unsGuestBraintreeCustomerId();
|
533 |
+
}
|
534 |
+
|
535 |
+
// Remove the temporary payment method
|
536 |
+
if($token = Mage::getSingleton('checkout/session')->getTemporaryPaymentToken()) {
|
537 |
+
$wrapper = Mage::getSingleton('gene_braintree/wrapper_braintree');
|
538 |
+
$wrapper->init()->deletePaymentMethod($token);
|
539 |
+
Mage::getSingleton('checkout/session')->unsTemporaryPaymentToken();
|
540 |
+
}
|
541 |
+
|
542 |
+
return false;
|
543 |
+
}
|
544 |
+
|
545 |
/**
|
546 |
* Build up the sale request
|
547 |
*
|
579 |
// If the user is already a customer and wants to store in the vault we've gotta do something a bit special
|
580 |
if($storeInVault && $this->checkIsCustomer() && isset($paymentDataArray['paymentMethodNonce'])) {
|
581 |
|
582 |
+
// Do we already have a saved token in the session?
|
583 |
+
if($token = Mage::getSingleton('checkout/session')->getTemporaryPaymentToken()) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
584 |
|
585 |
+
try {
|
|
|
586 |
|
587 |
+
// Attempt to load the temporary payment method
|
588 |
+
$paymentMethod = Braintree_PaymentMethod::find($token);
|
589 |
+
if(isset($paymentMethod->token)) {
|
590 |
|
591 |
+
// Remove this from the session so it doesn't get deleted at the end of checkout
|
592 |
+
Mage::getSingleton('checkout/session')->unsTemporaryPaymentToken();
|
593 |
|
594 |
+
// We no longer need this nonce
|
595 |
+
unset($paymentDataArray['paymentMethodNonce']);
|
596 |
|
597 |
+
// Instead use the token
|
598 |
+
$paymentDataArray['paymentMethodToken'] = $paymentMethod->token;
|
599 |
|
600 |
+
// Create a flag for other methods
|
601 |
+
$createdMethod = true;
|
602 |
|
603 |
+
}
|
|
|
604 |
|
605 |
+
} catch (Exception $e) {
|
606 |
+
// If the method doesn't exist, clear the token and re-build the sale
|
607 |
+
Mage::getSingleton('checkout/session')->unsTemporaryPaymentToken();
|
608 |
+
return $this->buildSale($amount, $paymentDataArray, $order, $submitForSettlement, $deviceData, $storeInVault, $threeDSecure, $extra);
|
609 |
}
|
610 |
|
611 |
} else {
|
612 |
+
|
613 |
+
// Create the payment method with this data
|
614 |
+
$paymentMethodCreate = array(
|
615 |
+
'customerId' => $this->getBraintreeId(),
|
616 |
+
'paymentMethodNonce' => $paymentDataArray['paymentMethodNonce'],
|
617 |
+
'billingAddress' => $this->buildAddress($order->getBillingAddress())
|
618 |
+
);
|
619 |
+
|
620 |
+
// Log the create array
|
621 |
+
Gene_Braintree_Model_Debug::log(array('Braintree_PaymentMethod' => $paymentMethodCreate));
|
622 |
+
|
623 |
+
// Create a new billing method
|
624 |
+
$result = Braintree_PaymentMethod::create($paymentMethodCreate);
|
625 |
+
|
626 |
+
// Log the response from Braintree
|
627 |
+
Gene_Braintree_Model_Debug::log(array('Braintree_PaymentMethod:result' => $result));
|
628 |
+
|
629 |
+
// Verify the storing of the card was a success
|
630 |
+
if (isset($result->success) && $result->success == true) {
|
631 |
+
|
632 |
+
/* @var $paymentMethod Braintree_CreditCard */
|
633 |
+
$paymentMethod = $result->paymentMethod;
|
634 |
+
|
635 |
+
// Check to see if the token is set
|
636 |
+
if (isset($paymentMethod->token) && !empty($paymentMethod->token)) {
|
637 |
+
|
638 |
+
// We no longer need this nonce
|
639 |
+
unset($paymentDataArray['paymentMethodNonce']);
|
640 |
+
|
641 |
+
// Instead use the token
|
642 |
+
$paymentDataArray['paymentMethodToken'] = $paymentMethod->token;
|
643 |
+
|
644 |
+
// Create a flag for other methods
|
645 |
+
$createdMethod = true;
|
646 |
+
}
|
647 |
+
|
648 |
+
} else {
|
649 |
+
Mage::throwException($result->message . Mage::helper('gene_braintree')->__(' Please try again or attempt refreshing the page.'));
|
650 |
+
}
|
651 |
+
|
652 |
}
|
653 |
}
|
654 |
|
716 |
}
|
717 |
|
718 |
/**
|
719 |
+
* Attempt to make a sale using the Braintree PHP SDK
|
720 |
*
|
721 |
* @param $saleArray
|
722 |
*
|
731 |
}
|
732 |
|
733 |
/**
|
734 |
+
* Submit a payment for settlement using the Braintree PHP SDK
|
735 |
*
|
736 |
* @param $transactionId
|
737 |
* @param $amount
|
738 |
*
|
739 |
+
* @return object
|
740 |
*/
|
741 |
public function submitForSettlement($transactionId, $amount)
|
742 |
{
|
747 |
}
|
748 |
|
749 |
/**
|
750 |
+
* Build up the customer ID, a unique MD5 hash
|
|
|
|
|
751 |
*
|
752 |
* @return string
|
|
|
753 |
*/
|
754 |
private function buildCustomerId()
|
755 |
{
|
756 |
return md5(uniqid('braintree_',true));
|
757 |
}
|
758 |
|
759 |
+
/**
|
760 |
+
* Convert the billing address into something Braintree can understand
|
761 |
+
*
|
762 |
+
* @param $address
|
763 |
+
*
|
764 |
+
* @return array
|
765 |
+
*/
|
766 |
+
public function convertBillingAddress($address)
|
767 |
+
{
|
768 |
+
if($address instanceof Mage_Sales_Model_Order_Address || $address instanceof Mage_Sales_Model_Quote_Address || $address instanceof Mage_Customer_Model_Address) {
|
769 |
+
return $this->buildAddress($address);
|
770 |
+
}
|
771 |
+
|
772 |
+
// Otherwise we're most likely dealing with a raw request
|
773 |
+
if(is_array($address)) {
|
774 |
+
|
775 |
+
// Is the user using a saved address?
|
776 |
+
if($addressId = Mage::app()->getRequest()->getParam('billing_address_id', false)) {
|
777 |
+
$savedAddress = Mage::getModel('customer/address')->load($addressId);
|
778 |
+
if($savedAddress->getId()) {
|
779 |
+
return $this->buildAddress($savedAddress);
|
780 |
+
}
|
781 |
+
}
|
782 |
+
|
783 |
+
// Utilise built in functionality to
|
784 |
+
$addressObject = Mage::getModel('sales/quote_address');
|
785 |
+
$addressForm = Mage::getModel('customer/form');
|
786 |
+
$addressForm->setFormCode('customer_address_edit')
|
787 |
+
->setEntityType('customer_address')
|
788 |
+
->setIsAjaxRequest(Mage::app()->getRequest()->isAjax());
|
789 |
+
$addressForm->setEntity($addressObject);
|
790 |
+
|
791 |
+
// Emulate request object
|
792 |
+
$addressData = $addressForm->extractData($addressForm->prepareRequest($address));
|
793 |
+
$addressObject->addData($addressData);
|
794 |
+
|
795 |
+
return $this->buildAddress($addressObject);
|
796 |
+
}
|
797 |
+
|
798 |
+
return array();
|
799 |
+
}
|
800 |
+
|
801 |
/**
|
802 |
* Build a Magento address model into a Braintree array
|
803 |
*
|
804 |
+
* @param Mage_Sales_Model_Order_Address|Mage_Sales_Model_Quote_Address|Mage_Customer_Model_Address $address
|
805 |
*
|
806 |
* @return array
|
807 |
*/
|
808 |
+
private function buildAddress($address)
|
809 |
{
|
810 |
// Build up the initial array
|
811 |
$return = array(
|
836 |
}
|
837 |
|
838 |
/**
|
839 |
+
* Return the correct merchant account ID for the order
|
840 |
*
|
841 |
+
* @param \Mage_Sales_Model_Order|null $order
|
842 |
+
*
|
843 |
+
* @return bool|mixed
|
844 |
*/
|
845 |
public function getMerchantAccountId(Mage_Sales_Model_Order $order = null)
|
846 |
{
|
856 |
}
|
857 |
|
858 |
/**
|
859 |
+
* Does the order have a mapped currency code?
|
860 |
*
|
861 |
+
* @param \Mage_Sales_Model_Order|null $order
|
862 |
+
*
|
863 |
+
* @return bool|string
|
864 |
*/
|
865 |
public function hasMappedCurrencyCode(Mage_Sales_Model_Order $order = null)
|
866 |
{
|
889 |
}
|
890 |
|
891 |
/**
|
892 |
+
* Determine whether ot not currency mapping is enabled
|
893 |
+
*
|
894 |
+
* @param \Mage_Sales_Model_Order|null $order
|
895 |
*
|
896 |
* @return bool
|
897 |
*/
|
898 |
public function currencyMappingEnabled(Mage_Sales_Model_Order $order = null)
|
899 |
{
|
900 |
return Mage::getStoreConfigFlag(self::BRAINTREE_MULTI_CURRENCY)
|
901 |
+
&& Mage::getStoreConfig(self::BRAINTREE_MULTI_CURRENCY_MAPPING);
|
|
|
|
|
902 |
}
|
903 |
|
904 |
/**
|
998 |
return $customer;
|
999 |
}
|
1000 |
|
1001 |
+
/**
|
1002 |
+
* Delete a customer within Braintree
|
1003 |
+
*
|
1004 |
+
* @param $customerId
|
1005 |
+
*
|
1006 |
+
* @return \Braintree_Result_Successful
|
1007 |
+
*/
|
1008 |
+
public function deleteCustomer($customerId)
|
1009 |
+
{
|
1010 |
+
try {
|
1011 |
+
return Braintree_Customer::delete($customerId);
|
1012 |
+
} catch (Exception $e) {
|
1013 |
+
Gene_Braintree_Model_Debug::log($e);
|
1014 |
+
}
|
1015 |
+
|
1016 |
+
return false;
|
1017 |
+
}
|
1018 |
+
|
1019 |
+
/**
|
1020 |
+
* Delete a payment method within Braintree
|
1021 |
+
*
|
1022 |
+
* @param $token
|
1023 |
+
*
|
1024 |
+
* @return bool|\Braintree_Result_Successful
|
1025 |
+
*/
|
1026 |
+
public function deletePaymentMethod($token)
|
1027 |
+
{
|
1028 |
+
try {
|
1029 |
+
return Braintree_PaymentMethod::delete($token);
|
1030 |
+
} catch (Exception $e) {
|
1031 |
+
Gene_Braintree_Model_Debug::log($e);
|
1032 |
+
}
|
1033 |
+
|
1034 |
+
return false;
|
1035 |
+
}
|
1036 |
+
|
1037 |
/**
|
1038 |
* Clone a transaction
|
1039 |
*
|
1075 |
{
|
1076 |
$errors = array();
|
1077 |
foreach($braintreeErrors as $error) {
|
1078 |
+
$errors[] = $error->code . ': ' . $this->parseMessage($error->message);
|
1079 |
}
|
1080 |
|
1081 |
return implode(', ', $errors);
|
1082 |
}
|
1083 |
|
1084 |
+
/**
|
1085 |
+
* Replace the word nonce with token as it could offend some of us british people
|
1086 |
+
*
|
1087 |
+
* @param $string
|
1088 |
+
*
|
1089 |
+
* @return mixed
|
1090 |
+
*/
|
1091 |
+
public function parseMessage($string)
|
1092 |
+
{
|
1093 |
+
return str_replace('nonce', 'token', $string);
|
1094 |
+
}
|
1095 |
+
|
1096 |
}
|
app/code/community/Gene/Braintree/controllers/CheckoutController.php
CHANGED
@@ -45,9 +45,7 @@ class Gene_Braintree_CheckoutController extends Mage_Core_Controller_Front_Actio
|
|
45 |
'threeDSecure' => Mage::getSingleton('gene_braintree/paymentmethod_creditcard')->is3DEnabled()
|
46 |
);
|
47 |
|
48 |
-
|
49 |
-
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($jsonResponse));
|
50 |
-
return false;
|
51 |
}
|
52 |
|
53 |
/**
|
@@ -76,10 +74,119 @@ class Gene_Braintree_CheckoutController extends Mage_Core_Controller_Front_Actio
|
|
76 |
}
|
77 |
|
78 |
// Set the response
|
79 |
-
$this->
|
80 |
-
return false;
|
81 |
}
|
82 |
}
|
83 |
}
|
84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
}
|
45 |
'threeDSecure' => Mage::getSingleton('gene_braintree/paymentmethod_creditcard')->is3DEnabled()
|
46 |
);
|
47 |
|
48 |
+
return $this->_returnJson($jsonResponse);
|
|
|
|
|
49 |
}
|
50 |
|
51 |
/**
|
74 |
}
|
75 |
|
76 |
// Set the response
|
77 |
+
return $this->_returnJson($jsonResponse);
|
|
|
78 |
}
|
79 |
}
|
80 |
}
|
81 |
|
82 |
+
/**
|
83 |
+
* Vault the nonce with it's billing details, then convert it back into a nonce
|
84 |
+
*
|
85 |
+
* @return bool
|
86 |
+
*/
|
87 |
+
public function vaultToNonceAction()
|
88 |
+
{
|
89 |
+
// Check we have a nonce in the request
|
90 |
+
if($nonce = $this->getRequest()->getParam('nonce')) {
|
91 |
+
|
92 |
+
// Retrieve the billing address
|
93 |
+
if(!$this->getRequest()->getParam('billing')) {
|
94 |
+
return $this->_returnJson(array(
|
95 |
+
'success' => false,
|
96 |
+
'error' => 'Billing address is not present'
|
97 |
+
));
|
98 |
+
}
|
99 |
+
|
100 |
+
// Create a new payment method in the vault
|
101 |
+
$wrapper = Mage::getSingleton('gene_braintree/wrapper_braintree');
|
102 |
+
$wrapper->init();
|
103 |
+
|
104 |
+
// Retrieve and convert the billing address
|
105 |
+
$billingAddress = $wrapper->convertBillingAddress($this->getRequest()->getParam('billing'));
|
106 |
+
|
107 |
+
$token = false;
|
108 |
+
|
109 |
+
try {
|
110 |
+
if ($wrapper->checkIsCustomer()) {
|
111 |
+
$response = $wrapper->storeInVault($nonce, $billingAddress);
|
112 |
+
if (isset($response->success) && $response->success == true && isset($response->paymentMethod->token)) {
|
113 |
+
$token = $response->paymentMethod->token;
|
114 |
+
Mage::getSingleton('checkout/session')->setTemporaryPaymentToken($token);
|
115 |
+
}
|
116 |
+
} else {
|
117 |
+
$response = $wrapper->storeInGuestVault($nonce, $billingAddress);
|
118 |
+
if (isset($response->success) && $response->success == true && isset($response->customer->creditCards) && count($response->customer->creditCards) >= 1) {
|
119 |
+
|
120 |
+
// Store this customers ID in the session so we can remove the customer at the end of the checkout
|
121 |
+
if (isset($response->customer->id)) {
|
122 |
+
Mage::getSingleton('checkout/session')->setGuestBraintreeCustomerId($response->customer->id);
|
123 |
+
}
|
124 |
+
|
125 |
+
$method = $response->customer->creditCards[0];
|
126 |
+
if (isset($method->token)) {
|
127 |
+
$token = $method->token;
|
128 |
+
}
|
129 |
+
|
130 |
+
}
|
131 |
+
}
|
132 |
+
} catch (Exception $e) {
|
133 |
+
return $this->_returnJson(array(
|
134 |
+
'success' => false,
|
135 |
+
'error' => $e->getMessage()
|
136 |
+
));
|
137 |
+
}
|
138 |
+
|
139 |
+
// Was the request to store this in the vault a success?
|
140 |
+
if($token) {
|
141 |
+
|
142 |
+
// Build up our response
|
143 |
+
$response = array(
|
144 |
+
'success' => true,
|
145 |
+
'nonce' => $wrapper->getThreeDSecureVaultNonce($token)
|
146 |
+
);
|
147 |
+
|
148 |
+
} else {
|
149 |
+
|
150 |
+
// Return a different message for declined cards
|
151 |
+
if(isset($response->transaction->status)) {
|
152 |
+
|
153 |
+
// Return a custom response for processor declined messages
|
154 |
+
if($response->transaction->status == Braintree_Transaction::PROCESSOR_DECLINED) {
|
155 |
+
|
156 |
+
return $this->_returnJson(array(
|
157 |
+
'success' => false,
|
158 |
+
'error' => Mage::helper('gene_braintree')->__('Your transaction has been declined, please try another payment method or contacting your issuing bank.')
|
159 |
+
));
|
160 |
+
|
161 |
+
}
|
162 |
+
}
|
163 |
+
|
164 |
+
return $this->_returnJson(array(
|
165 |
+
'success' => false,
|
166 |
+
'error' => Mage::helper('gene_braintree')->__('%s. Please try again or attempt refreshing the page.', $wrapper->parseMessage($response->message))
|
167 |
+
));
|
168 |
+
|
169 |
+
}
|
170 |
+
|
171 |
+
return $this->_returnJson($response);
|
172 |
+
}
|
173 |
+
|
174 |
+
return $this->_returnJson(array('success' => false));
|
175 |
+
}
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Return JSON to the browser
|
179 |
+
*
|
180 |
+
* @param $array
|
181 |
+
*
|
182 |
+
* @return $this
|
183 |
+
*/
|
184 |
+
protected function _returnJson($array)
|
185 |
+
{
|
186 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($array));
|
187 |
+
$this->getResponse()->setHeader('Content-type', 'application/json');
|
188 |
+
|
189 |
+
return $this;
|
190 |
+
}
|
191 |
+
|
192 |
}
|
app/code/community/Gene/Braintree/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Gene_Braintree>
|
5 |
-
<version>1.0.
|
6 |
</Gene_Braintree>
|
7 |
</modules>
|
8 |
<global>
|
@@ -86,6 +86,7 @@
|
|
86 |
<title>Credit Card (Braintree)</title>
|
87 |
<environment>sandbox</environment>
|
88 |
<allowspecific>0</allowspecific>
|
|
|
89 |
<use_vault>0</use_vault>
|
90 |
<threedsecure>0</threedsecure>
|
91 |
<threedsecure_threshold>0</threedsecure_threshold>
|
@@ -167,6 +168,7 @@
|
|
167 |
</translate>
|
168 |
|
169 |
<events>
|
|
|
170 |
<sales_order_shipment_save_after>
|
171 |
<observers>
|
172 |
<capture_braintree_payment>
|
@@ -175,6 +177,16 @@
|
|
175 |
</capture_braintree_payment>
|
176 |
</observers>
|
177 |
</sales_order_shipment_save_after>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
</events>
|
179 |
</adminhtml>
|
180 |
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Gene_Braintree>
|
5 |
+
<version>1.0.5</version>
|
6 |
</Gene_Braintree>
|
7 |
</modules>
|
8 |
<global>
|
86 |
<title>Credit Card (Braintree)</title>
|
87 |
<environment>sandbox</environment>
|
88 |
<allowspecific>0</allowspecific>
|
89 |
+
<form_integration>default</form_integration>
|
90 |
<use_vault>0</use_vault>
|
91 |
<threedsecure>0</threedsecure>
|
92 |
<threedsecure_threshold>0</threedsecure_threshold>
|
168 |
</translate>
|
169 |
|
170 |
<events>
|
171 |
+
<!-- Check whether we should capture the payment on shipment -->
|
172 |
<sales_order_shipment_save_after>
|
173 |
<observers>
|
174 |
<capture_braintree_payment>
|
177 |
</capture_braintree_payment>
|
178 |
</observers>
|
179 |
</sales_order_shipment_save_after>
|
180 |
+
|
181 |
+
<!-- If the compilation mode is enabled copy over the SSL certificates -->
|
182 |
+
<controller_action_postdispatch>
|
183 |
+
<observers>
|
184 |
+
<check_compilation>
|
185 |
+
<class>gene_braintree/observer</class>
|
186 |
+
<method>checkCompilation</method>
|
187 |
+
</check_compilation>
|
188 |
+
</observers>
|
189 |
+
</controller_action_postdispatch>
|
190 |
</events>
|
191 |
</adminhtml>
|
192 |
|
app/code/community/Gene/Braintree/etc/system.xml
CHANGED
@@ -369,6 +369,29 @@
|
|
369 |
<show_in_store>1</show_in_store>
|
370 |
</order_status>
|
371 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
372 |
<features_heading translate="label">
|
373 |
<label>Features</label>
|
374 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
369 |
<show_in_store>1</show_in_store>
|
370 |
</order_status>
|
371 |
|
372 |
+
<integration_heading translate="label">
|
373 |
+
<label>Integration Type</label>
|
374 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
375 |
+
<sort_order>30</sort_order>
|
376 |
+
<show_in_default>1</show_in_default>
|
377 |
+
<show_in_website>1</show_in_website>
|
378 |
+
<show_in_store>1</show_in_store>
|
379 |
+
</integration_heading>
|
380 |
+
|
381 |
+
<form_integration translate="label comment">
|
382 |
+
<label>Form Integration</label>
|
383 |
+
<frontend_type>select</frontend_type>
|
384 |
+
<source_model>gene_braintree/source_creditcard_formIntegration</source_model>
|
385 |
+
<sort_order>40</sort_order>
|
386 |
+
<show_in_default>1</show_in_default>
|
387 |
+
<show_in_website>1</show_in_website>
|
388 |
+
<show_in_store>1</show_in_store>
|
389 |
+
<comment><![CDATA[
|
390 |
+
<strong>Default</strong> - Our standard integration utilising Braintree's custom integration solution. Allows clever card type detection alongside full styling capabilities.<br />
|
391 |
+
<strong>Hosted Fields</strong> - Hosted Fields are small, transparent iframes that replace the sensitive credit card inputs in your checkout flow - helping you meet the latest data security requirements while ensuring your customization doesn't suffer. <a href="https://www.braintreepayments.com/features/hosted-fields">Find out more</a>
|
392 |
+
]]></comment>
|
393 |
+
</form_integration>
|
394 |
+
|
395 |
<features_heading translate="label">
|
396 |
<label>Features</label>
|
397 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
app/design/adminhtml/default/default/layout/gene/braintree.xml
CHANGED
@@ -14,8 +14,8 @@
|
|
14 |
|
15 |
<adminhtml_sales_order_create_index>
|
16 |
<reference name="head">
|
17 |
-
<action method="addJs"><file>gene/braintree/braintree.js</file></action>
|
18 |
-
<action method="addJs"><file>gene/braintree/vzero.js</file></action>
|
19 |
</reference>
|
20 |
<reference name="before_body_end">
|
21 |
<block type="gene_braintree/js" name="gene_braintree_js" template="gene/braintree/js.phtml" />
|
14 |
|
15 |
<adminhtml_sales_order_create_index>
|
16 |
<reference name="head">
|
17 |
+
<action method="addJs"><file>gene/braintree/braintree-0.1.js</file></action>
|
18 |
+
<action method="addJs"><file>gene/braintree/vzero-0.5.min.js</file></action>
|
19 |
</reference>
|
20 |
<reference name="before_body_end">
|
21 |
<block type="gene_braintree/js" name="gene_braintree_js" template="gene/braintree/js.phtml" />
|
app/design/adminhtml/default/default/template/gene/braintree/creditcard.phtml
CHANGED
@@ -101,35 +101,4 @@ $_code = $this->getMethodCode()
|
|
101 |
vzero.setAmount('<?php echo Mage::getSingleton('checkout/cart')->getQuote()->collectTotals()->getGrandTotal(); ?>');
|
102 |
}
|
103 |
|
104 |
-
// Loop through each saved card being selected
|
105 |
-
$$('#creditcard-saved-accounts input[type="radio"]').each(function(elm) {
|
106 |
-
|
107 |
-
// Observe the elements changing
|
108 |
-
Element.observe(elm, 'change', function(event) {
|
109 |
-
|
110 |
-
// Has the user selected other?
|
111 |
-
if($$('#creditcard-saved-accounts input:checked[type=radio]').first().value == 'other') {
|
112 |
-
|
113 |
-
// Show the credit card form
|
114 |
-
$('credit-card-form').show();
|
115 |
-
|
116 |
-
// Enable the credit card form all the elements in the credit card form
|
117 |
-
$$('#credit-card-form input, #credit-card-form select').each(function(formElement) {
|
118 |
-
formElement.removeAttribute('disabled');
|
119 |
-
});
|
120 |
-
|
121 |
-
} else {
|
122 |
-
|
123 |
-
// Hide the new credit card form
|
124 |
-
$('credit-card-form').hide();
|
125 |
-
|
126 |
-
// Disable all the elements in the credit card form
|
127 |
-
$$('#credit-card-form input, #credit-card-form select').each(function(formElement) {
|
128 |
-
formElement.setAttribute('disabled', 'disabled');
|
129 |
-
});
|
130 |
-
|
131 |
-
}
|
132 |
-
});
|
133 |
-
});
|
134 |
-
|
135 |
</script>
|
101 |
vzero.setAmount('<?php echo Mage::getSingleton('checkout/cart')->getQuote()->collectTotals()->getGrandTotal(); ?>');
|
102 |
}
|
103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
</script>
|
app/design/adminhtml/default/default/template/gene/braintree/creditcard/hostedfields.phtml
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* @var $this Gene_Braintree_Block_Creditcard */
|
3 |
+
$_code = $this->getMethodCode()
|
4 |
+
?>
|
5 |
+
<div id="payment_form_<?php echo $_code ?>" style="display:none;" class="form-list">
|
6 |
+
|
7 |
+
<div id="credit-card-form"<?php echo ($this->hasSavedDetails() && $this->getMethod()->isVaultEnabled() ? ' style="display: none;"' : ''); ?>>
|
8 |
+
<ul class="form-list braintree-hostedfield">
|
9 |
+
<li>
|
10 |
+
<label for="card-number"><?php echo $this->__('Card Number'); ?></label>
|
11 |
+
<div class="card-input braintree-card-input-field">
|
12 |
+
<div class="card-type"><img src="<?php echo $this->getSkinUrl('images/gene/braintree/card.png', array('_area' => 'frontend', '_package' => 'base', '_theme' => 'default')) ?>" id="card-type-image" /></div>
|
13 |
+
<div id="card-number"></div>
|
14 |
+
</div>
|
15 |
+
</li>
|
16 |
+
<li>
|
17 |
+
<label for="expiration-month"><?php echo $this->__('Expiration Date'); ?></label>
|
18 |
+
<div id="braintree-expiration-container">
|
19 |
+
<div id="expiration-month" class="braintree-input-field braintree-expiration"></div>
|
20 |
+
<div class="braintree-expiration-seperator">/</div>
|
21 |
+
<div id="expiration-year" class="braintree-input-field braintree-expiration"></div>
|
22 |
+
</div>
|
23 |
+
</li>
|
24 |
+
<li>
|
25 |
+
<label for="cvv"><?php echo $this->__('CVV'); ?></label>
|
26 |
+
<div id="cvv" class="braintree-input-field braintree-cvv"></div>
|
27 |
+
</li>
|
28 |
+
</ul>
|
29 |
+
</div>
|
30 |
+
|
31 |
+
<?php /* Do not remove or modify this code, the div is hidden and used to fire the hosted fields tokenization */ ?>
|
32 |
+
<div id="braintree-hosted-submit">
|
33 |
+
<button type="submit" data-blockCapture="true"></button>
|
34 |
+
|
35 |
+
<!-- Fields for the payment method -->
|
36 |
+
<input type="text" name="payment[payment_method_nonce]" value="" id="creditcard-payment-nonce" class="validate-fire-hosted" />
|
37 |
+
</div>
|
38 |
+
</div>
|
39 |
+
|
40 |
+
<script type="text/javascript">
|
41 |
+
if(typeof vzero !== 'undefined') {
|
42 |
+
vzero.creditCardLoaded();
|
43 |
+
}
|
44 |
+
</script>
|
45 |
+
|
46 |
+
<style type="text/css">
|
47 |
+
.order-billing_method .fieldset {
|
48 |
+
float: left;
|
49 |
+
width: 100%;
|
50 |
+
}
|
51 |
+
/* Hosted Fields */
|
52 |
+
#braintree-hosted-submit {
|
53 |
+
display: none;
|
54 |
+
}
|
55 |
+
.braintree-hostedfield {
|
56 |
+
padding: 4px 0;
|
57 |
+
}
|
58 |
+
.braintree-hostedfield li {
|
59 |
+
padding: 3px 0;
|
60 |
+
}
|
61 |
+
.braintree-hostedfield label {
|
62 |
+
margin-bottom: 4px;
|
63 |
+
display: block;
|
64 |
+
width: 100%;
|
65 |
+
}
|
66 |
+
.braintree-input-field {
|
67 |
+
height: 42px;
|
68 |
+
max-width: 340px;
|
69 |
+
padding: 0 10px;
|
70 |
+
border: 1px solid lightgrey;
|
71 |
+
background: white;
|
72 |
+
}
|
73 |
+
.braintree-card-input-field {
|
74 |
+
height: 50px;
|
75 |
+
width: 100%;
|
76 |
+
max-width: 372px;
|
77 |
+
border: 1px solid lightgrey;
|
78 |
+
position: relative;
|
79 |
+
background: white;
|
80 |
+
}
|
81 |
+
.braintree-card-input-field .card-type {
|
82 |
+
position: absolute;
|
83 |
+
top: 0;
|
84 |
+
left: 0;
|
85 |
+
bottom: 0;
|
86 |
+
padding: 0 10px 0 8px;
|
87 |
+
}
|
88 |
+
.braintree-card-input-field .card-type img {
|
89 |
+
height: 48px;
|
90 |
+
}
|
91 |
+
.braintree-card-input-field #card-number {
|
92 |
+
float: left;
|
93 |
+
height: 48px;
|
94 |
+
width: 100%;
|
95 |
+
padding-left: 66px;
|
96 |
+
box-sizing: border-box;
|
97 |
+
}
|
98 |
+
#braintree-expiration-container {
|
99 |
+
display: inline-block;
|
100 |
+
*zoom: 1;
|
101 |
+
*display: inline;
|
102 |
+
width: 100%;
|
103 |
+
vertical-align: middle;
|
104 |
+
font-size: 0;
|
105 |
+
}
|
106 |
+
.braintree-expiration {
|
107 |
+
width: 70px;
|
108 |
+
display: inline-block;
|
109 |
+
*zoom: 1;
|
110 |
+
*display: inline;
|
111 |
+
}
|
112 |
+
.braintree-expiration-seperator {
|
113 |
+
vertical-align: top;
|
114 |
+
display: inline-block;
|
115 |
+
*zoom: 1;
|
116 |
+
*display: inline;
|
117 |
+
line-height: 44px;
|
118 |
+
font-size: 30px;
|
119 |
+
padding: 0 8px;
|
120 |
+
}
|
121 |
+
.braintree-cvv {
|
122 |
+
width: 80px;
|
123 |
+
}
|
124 |
+
</style>
|
app/design/adminhtml/default/default/template/gene/braintree/js.phtml
CHANGED
@@ -5,6 +5,7 @@
|
|
5 |
'gene_braintree_creditcard',
|
6 |
'<?php echo $this->getClientToken(); ?>',
|
7 |
false,
|
|
|
8 |
['order-billing_address_firstname', 'order-billing_address_lastname'],
|
9 |
['order-billing_address_postcode']
|
10 |
);
|
@@ -12,57 +13,128 @@
|
|
12 |
// Init the environment
|
13 |
vzero.init();
|
14 |
|
15 |
-
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
-
|
19 |
-
|
|
|
20 |
|
21 |
-
|
22 |
-
|
|
|
|
|
23 |
|
24 |
-
|
25 |
-
|
|
|
26 |
|
27 |
-
|
28 |
-
var adminThis = this;
|
29 |
-
var adminArgs = arguments;
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
}
|
40 |
-
});
|
41 |
|
42 |
-
|
43 |
-
if($('device_data')) {
|
44 |
-
$('device_data').removeAttribute('disabled');
|
45 |
-
}
|
46 |
|
47 |
-
|
48 |
-
|
|
|
|
|
49 |
|
50 |
-
|
51 |
-
|
52 |
-
formElement.removeAttribute('disabled');
|
53 |
-
});
|
54 |
|
55 |
-
|
56 |
-
|
57 |
|
58 |
-
|
59 |
-
|
60 |
-
}
|
61 |
|
62 |
-
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
}
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
};
|
67 |
//]]>
|
68 |
</script>
|
5 |
'gene_braintree_creditcard',
|
6 |
'<?php echo $this->getClientToken(); ?>',
|
7 |
false,
|
8 |
+
<?php echo $this->isHostedFields(); ?>,
|
9 |
['order-billing_address_firstname', 'order-billing_address_lastname'],
|
10 |
['order-billing_address_postcode']
|
11 |
);
|
13 |
// Init the environment
|
14 |
vzero.init();
|
15 |
|
16 |
+
vZero.addMethods({
|
17 |
+
/**
|
18 |
+
* Update data has no value in the admin
|
19 |
+
*/
|
20 |
+
updateData: function(callback, params) {
|
21 |
+
callback();
|
22 |
+
}
|
23 |
+
});
|
24 |
+
|
25 |
+
vZeroIntegration.addMethods({
|
26 |
+
|
27 |
+
/**
|
28 |
+
* The loading instance is to just disable the save button within the admin
|
29 |
+
*/
|
30 |
+
setLoading: function () {
|
31 |
+
disableElements('save');
|
32 |
+
},
|
33 |
+
resetLoading: function () {
|
34 |
+
enableElements('save');
|
35 |
+
},
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Attach observer events for the submission of the page
|
39 |
+
*/
|
40 |
+
prepareSubmitObserver: function () {
|
41 |
+
|
42 |
+
// Store a pointer to the vZero integration
|
43 |
+
var vzeroIntegration = this;
|
44 |
+
|
45 |
+
// Store the original payment method
|
46 |
+
var _originalAdminOrderSubmit = AdminOrder.prototype.submit;
|
47 |
+
|
48 |
+
// Intercept the save function
|
49 |
+
AdminOrder.prototype.submit = function() {
|
50 |
+
|
51 |
+
// Should we intercept?
|
52 |
+
if (vzeroIntegration.shouldInterceptSubmit('creditcard')) {
|
53 |
|
54 |
+
// Store a pointer to the payment class
|
55 |
+
var paymentThis = this;
|
56 |
+
var paymentArguments = arguments;
|
57 |
|
58 |
+
// If everything was a success on the checkout end, let's submit the vZero integration
|
59 |
+
vzeroIntegration.submit('creditcard', function () {
|
60 |
+
return _originalAdminOrderSubmit.apply(paymentThis, paymentArguments);
|
61 |
+
});
|
62 |
|
63 |
+
} else {
|
64 |
+
return _originalAdminOrderSubmit.apply(this, arguments);
|
65 |
+
}
|
66 |
|
67 |
+
};
|
|
|
|
|
68 |
|
69 |
+
// On dom load init hosted fields if it's enabled
|
70 |
+
document.observe("dom:loaded", function () {
|
71 |
+
vzeroIntegration.paymentMethodSwitch();
|
72 |
+
}.bind(this));
|
73 |
|
74 |
+
// Intercept any area of the checkout being updated
|
75 |
+
this.vzero.observeAjaxRequests(function() {
|
76 |
+
vzeroIntegration.paymentMethodSwitch();
|
77 |
+
});
|
|
|
|
|
78 |
|
79 |
+
},
|
|
|
|
|
|
|
80 |
|
81 |
+
/**
|
82 |
+
* Observe the payment method switch
|
83 |
+
*/
|
84 |
+
preparePaymentMethodSwitchObserver: function() {
|
85 |
|
86 |
+
// Store a pointer to the vZero integration
|
87 |
+
var vzeroIntegration = this;
|
|
|
|
|
88 |
|
89 |
+
// Store the original payment method
|
90 |
+
var paymentSwitchOriginal = AdminOrder.prototype.switchPaymentMethod;
|
91 |
|
92 |
+
// Intercept the save function
|
93 |
+
AdminOrder.prototype.switchPaymentMethod = function (method) {
|
|
|
94 |
|
95 |
+
// Run our method switch function
|
96 |
+
vzeroIntegration.paymentMethodSwitch(method);
|
97 |
+
|
98 |
+
// Run the original function
|
99 |
+
return paymentSwitchOriginal.apply(this, arguments);
|
100 |
+
};
|
101 |
+
|
102 |
+
// Re-assign payment switch method
|
103 |
+
payment.switchMethod = order.switchPaymentMethod.bind(order);
|
104 |
+
|
105 |
+
},
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Return the current payment method
|
109 |
+
*
|
110 |
+
* @returns {*}
|
111 |
+
*/
|
112 |
+
getPaymentMethod: function() {
|
113 |
+
return order.paymentMethod;
|
114 |
+
},
|
115 |
+
|
116 |
+
/**
|
117 |
+
* The action to run after the payment processing is completed
|
118 |
+
* As we aren't using a onepage checkout, we have to use the submitPayment action
|
119 |
+
*/
|
120 |
+
submitPayment: function() {
|
121 |
+
// Run the original checkouts submit action
|
122 |
+
return order.submit();
|
123 |
}
|
124 |
|
125 |
+
});
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Start a new instance of our integration
|
129 |
+
*
|
130 |
+
* @type {vZeroIntegration}
|
131 |
+
*/
|
132 |
+
var AdminVzero = new vZeroIntegration(vzero);
|
133 |
+
|
134 |
+
// stop Magento's card_validation ajax from running
|
135 |
+
AdminOrder.prototype._getPaymentDataOriginal = AdminOrder.prototype.getPaymentData;
|
136 |
+
AdminOrder.prototype.getPaymentData = function(currentMethod) {
|
137 |
+
return (currentMethod == 'gene_braintree_creditcard') ? false : this._getPaymentDataOriginal(currentMethod);
|
138 |
};
|
139 |
//]]>
|
140 |
</script>
|
app/design/frontend/base/default/layout/gene/braintree.xml
CHANGED
@@ -3,8 +3,9 @@
|
|
3 |
|
4 |
<checkout_onepage_index>
|
5 |
<reference name="head">
|
6 |
-
<action method="addJs"><file>gene/braintree/braintree.js</file></action>
|
7 |
-
<action method="addJs"><file>gene/braintree/vzero.js</file></action>
|
|
|
8 |
</reference>
|
9 |
<reference name="before_body_end">
|
10 |
<block type="gene_braintree/js" name="gene_braintree_setup" template="gene/braintree/js/setup.phtml" />
|
@@ -23,6 +24,7 @@
|
|
23 |
<!-- We have to use a customized version of the js.phtml file for Amasty's checkout solution -->
|
24 |
<amasty_onestep_checkout>
|
25 |
<reference name="head">
|
|
|
26 |
<action method="addCss"><file>css/gene/braintree/amasty.css</file></action>
|
27 |
</reference>
|
28 |
<reference name="before_body_end">
|
@@ -42,8 +44,8 @@
|
|
42 |
<!-- Need to include the standard resources for the onestepcheckout.com solution -->
|
43 |
<idev_onestepcheckout_index>
|
44 |
<reference name="head">
|
45 |
-
<action method="addJs"><file>gene/braintree/braintree.js</file></action>
|
46 |
-
<action method="addJs"><file>gene/braintree/vzero.js</file></action>
|
47 |
<action method="addCss"><file>css/gene/braintree/idev.css</file></action>
|
48 |
</reference>
|
49 |
<reference name="before_body_end">
|
@@ -63,8 +65,8 @@
|
|
63 |
<!-- Add in support for Magestores's one step checkout solution -->
|
64 |
<magestore_onestepcheckout_index>
|
65 |
<reference name="head">
|
66 |
-
<action method="addJs"><file>gene/braintree/braintree.js</file></action>
|
67 |
-
<action method="addJs"><file>gene/braintree/vzero.js</file></action>
|
68 |
<action method="addCss"><file>css/gene/braintree/magestore.css</file></action>
|
69 |
</reference>
|
70 |
<reference name="before_body_end">
|
@@ -84,8 +86,8 @@
|
|
84 |
<!-- Add in support for the Aheadworks one step checkout solution -->
|
85 |
<aw_onestepcheckout_index_index>
|
86 |
<reference name="head">
|
87 |
-
<action method="addJs"><file>gene/braintree/braintree.js</file></action>
|
88 |
-
<action method="addJs"><file>gene/braintree/vzero.js</file></action>
|
89 |
<action method="addCss"><file>css/gene/braintree/aheadworks.css</file></action>
|
90 |
</reference>
|
91 |
<reference name="before_body_end">
|
@@ -105,8 +107,8 @@
|
|
105 |
<!-- Add in support for IWD's one step checkout solution -->
|
106 |
<opc_index_index>
|
107 |
<reference name="head">
|
108 |
-
<action method="addJs"><file>gene/braintree/braintree.js</file></action>
|
109 |
-
<action method="addJs"><file>gene/braintree/vzero.js</file></action>
|
110 |
<action method="addCss"><file>css/gene/braintree/iwd.css</file></action>
|
111 |
</reference>
|
112 |
<reference name="before_body_end">
|
@@ -126,8 +128,8 @@
|
|
126 |
<!-- Add in support for Fire Checkouts solution -->
|
127 |
<firecheckout_index_index>
|
128 |
<reference name="head">
|
129 |
-
<action method="addJs"><file>gene/braintree/braintree.js</file></action>
|
130 |
-
<action method="addJs"><file>gene/braintree/vzero.js</file></action>
|
131 |
<action method="addCss"><file>css/gene/braintree/firecheckout.css</file></action>
|
132 |
</reference>
|
133 |
<reference name="before_body_end">
|
@@ -144,6 +146,28 @@
|
|
144 |
</reference>
|
145 |
</firecheckout_index_index>
|
146 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
<checkout_onepage_paymentmethod>
|
148 |
<reference name="root">
|
149 |
<block type="core/text_list" name="additional" as="additional">
|
3 |
|
4 |
<checkout_onepage_index>
|
5 |
<reference name="head">
|
6 |
+
<action method="addJs"><file>gene/braintree/braintree-0.1.js</file></action>
|
7 |
+
<action method="addJs"><file>gene/braintree/vzero-0.5.min.js</file></action>
|
8 |
+
<action method="addCss"><file>css/gene/braintree/default.css</file></action>
|
9 |
</reference>
|
10 |
<reference name="before_body_end">
|
11 |
<block type="gene_braintree/js" name="gene_braintree_setup" template="gene/braintree/js/setup.phtml" />
|
24 |
<!-- We have to use a customized version of the js.phtml file for Amasty's checkout solution -->
|
25 |
<amasty_onestep_checkout>
|
26 |
<reference name="head">
|
27 |
+
<action method="removeItem"><type>skin_css</type><name>css/gene/braintree/default.css</name></action>
|
28 |
<action method="addCss"><file>css/gene/braintree/amasty.css</file></action>
|
29 |
</reference>
|
30 |
<reference name="before_body_end">
|
44 |
<!-- Need to include the standard resources for the onestepcheckout.com solution -->
|
45 |
<idev_onestepcheckout_index>
|
46 |
<reference name="head">
|
47 |
+
<action method="addJs"><file>gene/braintree/braintree-0.1.js</file></action>
|
48 |
+
<action method="addJs"><file>gene/braintree/vzero-0.5.min.js</file></action>
|
49 |
<action method="addCss"><file>css/gene/braintree/idev.css</file></action>
|
50 |
</reference>
|
51 |
<reference name="before_body_end">
|
65 |
<!-- Add in support for Magestores's one step checkout solution -->
|
66 |
<magestore_onestepcheckout_index>
|
67 |
<reference name="head">
|
68 |
+
<action method="addJs"><file>gene/braintree/braintree-0.1.js</file></action>
|
69 |
+
<action method="addJs"><file>gene/braintree/vzero-0.5.min.js</file></action>
|
70 |
<action method="addCss"><file>css/gene/braintree/magestore.css</file></action>
|
71 |
</reference>
|
72 |
<reference name="before_body_end">
|
86 |
<!-- Add in support for the Aheadworks one step checkout solution -->
|
87 |
<aw_onestepcheckout_index_index>
|
88 |
<reference name="head">
|
89 |
+
<action method="addJs"><file>gene/braintree/braintree-0.1.js</file></action>
|
90 |
+
<action method="addJs"><file>gene/braintree/vzero-0.5.min.js</file></action>
|
91 |
<action method="addCss"><file>css/gene/braintree/aheadworks.css</file></action>
|
92 |
</reference>
|
93 |
<reference name="before_body_end">
|
107 |
<!-- Add in support for IWD's one step checkout solution -->
|
108 |
<opc_index_index>
|
109 |
<reference name="head">
|
110 |
+
<action method="addJs"><file>gene/braintree/braintree-0.1.js</file></action>
|
111 |
+
<action method="addJs"><file>gene/braintree/vzero-0.5.min.js</file></action>
|
112 |
<action method="addCss"><file>css/gene/braintree/iwd.css</file></action>
|
113 |
</reference>
|
114 |
<reference name="before_body_end">
|
128 |
<!-- Add in support for Fire Checkouts solution -->
|
129 |
<firecheckout_index_index>
|
130 |
<reference name="head">
|
131 |
+
<action method="addJs"><file>gene/braintree/braintree-0.1.js</file></action>
|
132 |
+
<action method="addJs"><file>gene/braintree/vzero-0.5.min.js</file></action>
|
133 |
<action method="addCss"><file>css/gene/braintree/firecheckout.css</file></action>
|
134 |
</reference>
|
135 |
<reference name="before_body_end">
|
146 |
</reference>
|
147 |
</firecheckout_index_index>
|
148 |
|
149 |
+
<!-- Add in support for Unicodes OP solution -->
|
150 |
+
<unicode_onestep_checkout>
|
151 |
+
<reference name="head">
|
152 |
+
<action method="removeItem"><type>skin_css</type><name>css/gene/braintree/default.css</name></action>
|
153 |
+
<action method="addJs"><file>gene/braintree/braintree-0.1.js</file></action>
|
154 |
+
<action method="addJs"><file>gene/braintree/vzero-0.5.min.js</file></action>
|
155 |
+
<action method="addCss"><file>css/gene/braintree/unicode.css</file></action>
|
156 |
+
</reference>
|
157 |
+
<reference name="before_body_end">
|
158 |
+
<block type="gene_braintree/js" name="gene_braintree_setup" template="gene/braintree/js/setup.phtml" />
|
159 |
+
<block type="gene_braintree/js" name="gene_braintree_js" template="gene/braintree/js/unicode.phtml" />
|
160 |
+
|
161 |
+
<!-- We include device data at the end of the larger form -->
|
162 |
+
<block type="gene_braintree/js" name="gene_braintree_data" template="gene/braintree/js/data.phtml">
|
163 |
+
<action method="setData">
|
164 |
+
<key>payment_form_id</key>
|
165 |
+
<value>co-payment-form</value>
|
166 |
+
</action>
|
167 |
+
</block>
|
168 |
+
</reference>
|
169 |
+
</unicode_onestep_checkout>
|
170 |
+
|
171 |
<checkout_onepage_paymentmethod>
|
172 |
<reference name="root">
|
173 |
<block type="core/text_list" name="additional" as="additional">
|
app/design/frontend/base/default/template/gene/braintree/creditcard.phtml
CHANGED
@@ -6,35 +6,39 @@ $_code = $this->getMethodCode()
|
|
6 |
|
7 |
<?php if($this->hasSavedDetails() && $this->getMethod()->isVaultEnabled()): ?>
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
</tr>
|
30 |
-
|
31 |
-
++$count;
|
32 |
-
endforeach; ?>
|
33 |
-
<tr>
|
34 |
-
<td width="20"><input type="radio" name="payment[card_payment_method_token]" id="other-creditcard" value="other" /></td>
|
35 |
-
<td><label for="other-creditcard"><?php echo $this->__('New Credit Card'); ?></label></td>
|
36 |
-
</tr>
|
37 |
-
</table>
|
38 |
|
39 |
<?php endif; ?>
|
40 |
|
@@ -43,7 +47,7 @@ $_code = $this->getMethodCode()
|
|
43 |
<li>
|
44 |
<label for="<?php echo $_code ?>_cc_number" class="required"><em>*</em><?php echo $this->__('Credit Card Number') ?></label>
|
45 |
<div class="input-box card-number">
|
46 |
-
<input type="
|
47 |
|
48 |
<div class="card-type"><img src="<?php echo $this->getSkinUrl('images/gene/braintree/card.png') ?>" id="card-type-image" /></div>
|
49 |
</div>
|
@@ -75,7 +79,7 @@ $_code = $this->getMethodCode()
|
|
75 |
<label for="<?php echo $_code ?>_cc_cid" class="required"><em>*</em><?php echo $this->__('Card Verification Number') ?></label>
|
76 |
<div class="input-box">
|
77 |
<div class="v-fix">
|
78 |
-
<input type="text" title="<?php echo $this->__('Card Verification Number') ?>" class="input-text cvv required-entry validate-cc-cvn" id="<?php echo $_code ?>_cc_cid" name="payment[cc_cid]" data-genebraintree-name="cvv"
|
79 |
</div>
|
80 |
<a href="#" class="cvv-what-is-this"><?php echo $this->__('What is this?') ?></a>
|
81 |
</div>
|
@@ -98,7 +102,7 @@ $_code = $this->getMethodCode()
|
|
98 |
<!-- Fields for the payment method -->
|
99 |
<input type="hidden" name="payment[payment_method_nonce]" id="creditcard-payment-nonce" />
|
100 |
|
101 |
-
<input type="hidden" id="<?php echo $_code ?>_cc_type"
|
102 |
</div>
|
103 |
|
104 |
</div>
|
@@ -168,40 +172,10 @@ $_code = $this->getMethodCode()
|
|
168 |
<?php endif; ?>
|
169 |
}
|
170 |
|
171 |
-
// Loop through each saved card being selected
|
172 |
-
$$('#creditcard-saved-accounts input[type="radio"]').each(function (elm) {
|
173 |
-
|
174 |
-
// Observe the elements changing
|
175 |
-
Element.observe(elm, 'change', function (event) {
|
176 |
-
|
177 |
-
// Has the user selected other?
|
178 |
-
if ($$('#creditcard-saved-accounts input:checked[type=radio]').first().value == 'other') {
|
179 |
-
|
180 |
-
// Show the credit card form
|
181 |
-
$('credit-card-form').show();
|
182 |
-
|
183 |
-
// Enable the credit card form all the elements in the credit card form
|
184 |
-
$$('#credit-card-form input, #credit-card-form select').each(function (formElement) {
|
185 |
-
formElement.removeAttribute('disabled');
|
186 |
-
});
|
187 |
-
|
188 |
-
} else {
|
189 |
-
|
190 |
-
// Hide the new credit card form
|
191 |
-
$('credit-card-form').hide();
|
192 |
-
|
193 |
-
// Disable all the elements in the credit card form
|
194 |
-
$$('#credit-card-form input, #credit-card-form select').each(function (formElement) {
|
195 |
-
formElement.setAttribute('disabled', 'disabled');
|
196 |
-
});
|
197 |
-
|
198 |
-
}
|
199 |
-
});
|
200 |
-
});
|
201 |
-
|
202 |
// Observe the card type
|
203 |
if(typeof vzero !== "undefined") {
|
204 |
vzero.observeCardType();
|
|
|
205 |
}
|
206 |
|
207 |
};
|
6 |
|
7 |
<?php if($this->hasSavedDetails() && $this->getMethod()->isVaultEnabled()): ?>
|
8 |
|
9 |
+
<label><?php echo $this->__('Saved Cards'); ?></label><br />
|
10 |
+
<p style="padding-left: 0;" class="saved-cards-intro"><?php echo $this->__('The following credit cards accounts are currently linked with your account.'); ?></p>
|
11 |
+
<table cellspacing="0" cellpadding="0" id="creditcard-saved-accounts">
|
12 |
+
<?php
|
13 |
+
$count = 0;
|
14 |
+
foreach($this->getSavedDetails() as $savedDetail):
|
15 |
+
?>
|
16 |
+
<tr valign="middle">
|
17 |
+
<td width="20">
|
18 |
+
<?php if($this->getMethod()->is3DEnabled()): ?>
|
19 |
+
<input type="radio" name="payment[card_payment_method_token]" id="<?php echo $savedDetail->token; ?>" data-token="<?php echo $savedDetail->token; ?>" data-threedsecure-nonce="<?php echo $this->getMethod()->getThreeDSecureVaultNonce($savedDetail->token); ?>" value="threedsecure"<?php echo ($count == 0 ? ' checked="checked"' : ''); ?>/>
|
20 |
+
<?php else: ?>
|
21 |
+
<input type="radio" name="payment[card_payment_method_token]" id="<?php echo $savedDetail->token; ?>" value="<?php echo $savedDetail->token; ?>"<?php echo ($count == 0 ? ' checked="checked"' : ''); ?>/>
|
22 |
+
<?php endif; ?>
|
23 |
+
</td>
|
24 |
+
<td>
|
25 |
+
<label for="<?php echo $savedDetail->token; ?>">
|
26 |
+
<img src="<?php echo $this->getSkinUrl('images/gene/braintree/' . $this->getCardIcon($savedDetail->cardType)) ?>" align="left" />
|
27 |
+
<span class="saved-card-info">
|
28 |
+
<span class="saved-card-number"> xxxx - xxxx - xxxx - <?php echo $savedDetail->last4; ?></span>
|
29 |
+
<span class="saved-expiry-date"><em><?php echo $this->__('Expires:'); ?></em> <?php echo $savedDetail->expirationMonth; ?>/<?php echo $savedDetail->expirationYear; ?></span>
|
30 |
+
</span>
|
31 |
+
</label>
|
32 |
+
</td>
|
33 |
+
</tr>
|
34 |
+
<?php
|
35 |
+
++$count;
|
36 |
+
endforeach; ?>
|
37 |
+
<tr valign="middle" class="other-row">
|
38 |
+
<td width="20"><input type="radio" name="payment[card_payment_method_token]" id="other-creditcard" value="other" /></td>
|
39 |
+
<td><label for="other-creditcard"><?php echo $this->__('New Credit Card'); ?></label></td>
|
40 |
</tr>
|
41 |
+
</table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
<?php endif; ?>
|
44 |
|
47 |
<li>
|
48 |
<label for="<?php echo $_code ?>_cc_number" class="required"><em>*</em><?php echo $this->__('Credit Card Number') ?></label>
|
49 |
<div class="input-box card-number">
|
50 |
+
<input type="tel" data-genebraintree-name="number" name="payment[cc_number]" id="<?php echo $_code ?>_cc_number" title="<?php echo $this->__('Credit Card Number') ?>" class="input-text validate-cc-number validate-cc-type validate-accepted-type" autocomplete="cc-number" />
|
51 |
|
52 |
<div class="card-type"><img src="<?php echo $this->getSkinUrl('images/gene/braintree/card.png') ?>" id="card-type-image" /></div>
|
53 |
</div>
|
79 |
<label for="<?php echo $_code ?>_cc_cid" class="required"><em>*</em><?php echo $this->__('Card Verification Number') ?></label>
|
80 |
<div class="input-box">
|
81 |
<div class="v-fix">
|
82 |
+
<input type="text" title="<?php echo $this->__('Card Verification Number') ?>" class="input-text cvv required-entry validate-cc-cvn" id="<?php echo $_code ?>_cc_cid" name="payment[cc_cid]" data-genebraintree-name="cvv" autocomplete="off" />
|
83 |
</div>
|
84 |
<a href="#" class="cvv-what-is-this"><?php echo $this->__('What is this?') ?></a>
|
85 |
</div>
|
102 |
<!-- Fields for the payment method -->
|
103 |
<input type="hidden" name="payment[payment_method_nonce]" id="creditcard-payment-nonce" />
|
104 |
|
105 |
+
<input type="hidden" id="<?php echo $_code ?>_cc_type" />
|
106 |
</div>
|
107 |
|
108 |
</div>
|
172 |
<?php endif; ?>
|
173 |
}
|
174 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
// Observe the card type
|
176 |
if(typeof vzero !== "undefined") {
|
177 |
vzero.observeCardType();
|
178 |
+
vzero.creditCardLoaded();
|
179 |
}
|
180 |
|
181 |
};
|
app/design/frontend/base/default/template/gene/braintree/creditcard/hostedfields.phtml
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* @var $this Gene_Braintree_Block_Creditcard */
|
3 |
+
$_code = $this->getMethodCode()
|
4 |
+
?>
|
5 |
+
<div id="payment_form_<?php echo $_code ?>" style="display:none;" class="form-list">
|
6 |
+
|
7 |
+
<?php if($this->hasSavedDetails() && $this->getMethod()->isVaultEnabled()): ?>
|
8 |
+
|
9 |
+
<label><?php echo $this->__('Saved Cards'); ?></label><br />
|
10 |
+
<p style="padding-left: 0;" class="saved-cards-intro"><?php echo $this->__('The following credit cards accounts are currently linked with your account.'); ?></p>
|
11 |
+
<table cellspacing="0" cellpadding="0" id="creditcard-saved-accounts">
|
12 |
+
<?php
|
13 |
+
$count = 0;
|
14 |
+
foreach($this->getSavedDetails() as $savedDetail):
|
15 |
+
?>
|
16 |
+
<tr valign="middle">
|
17 |
+
<td width="20">
|
18 |
+
<?php if($this->getMethod()->is3DEnabled()): ?>
|
19 |
+
<input type="radio" name="payment[card_payment_method_token]" id="<?php echo $savedDetail->token; ?>" data-token="<?php echo $savedDetail->token; ?>" data-threedsecure-nonce="<?php echo $this->getMethod()->getThreeDSecureVaultNonce($savedDetail->token); ?>" value="threedsecure"<?php echo ($count == 0 ? ' checked="checked"' : ''); ?>/>
|
20 |
+
<?php else: ?>
|
21 |
+
<input type="radio" name="payment[card_payment_method_token]" id="<?php echo $savedDetail->token; ?>" value="<?php echo $savedDetail->token; ?>"<?php echo ($count == 0 ? ' checked="checked"' : ''); ?>/>
|
22 |
+
<?php endif; ?>
|
23 |
+
</td>
|
24 |
+
<td>
|
25 |
+
<label for="<?php echo $savedDetail->token; ?>">
|
26 |
+
<img src="<?php echo $this->getSkinUrl('images/gene/braintree/' . $this->getCardIcon($savedDetail->cardType)) ?>" align="left" />
|
27 |
+
<span class="saved-card-info">
|
28 |
+
<span class="saved-card-number">xxxx - xxxx - xxxx - <?php echo $savedDetail->last4; ?></span>
|
29 |
+
<span class="saved-expiry-date"><em><?php echo $this->__('Expires:'); ?></em> <?php echo $savedDetail->expirationMonth; ?>/<?php echo $savedDetail->expirationYear; ?></span>
|
30 |
+
</span>
|
31 |
+
</label>
|
32 |
+
</td>
|
33 |
+
</tr>
|
34 |
+
<?php
|
35 |
+
++$count;
|
36 |
+
endforeach; ?>
|
37 |
+
<tr valign="middle" class="other-row">
|
38 |
+
<td width="20"><input type="radio" name="payment[card_payment_method_token]" id="other-creditcard" value="other" /></td>
|
39 |
+
<td><label for="other-creditcard"><?php echo $this->__('New Credit Card'); ?></label></td>
|
40 |
+
</tr>
|
41 |
+
</table>
|
42 |
+
|
43 |
+
<?php endif; ?>
|
44 |
+
|
45 |
+
<div id="credit-card-form"<?php echo ($this->hasSavedDetails() && $this->getMethod()->isVaultEnabled() ? ' style="display: none;"' : ''); ?>>
|
46 |
+
<ul class="form-list braintree-hostedfield">
|
47 |
+
<li>
|
48 |
+
<label for="card-number"><?php echo $this->__('Card Number'); ?></label>
|
49 |
+
<div class="card-input braintree-card-input-field">
|
50 |
+
<div class="card-type"><img src="<?php echo $this->getSkinUrl('images/gene/braintree/card.png') ?>" id="card-type-image" /></div>
|
51 |
+
<div id="card-number"></div>
|
52 |
+
</div>
|
53 |
+
</li>
|
54 |
+
<li>
|
55 |
+
<label for="expiration-month"><?php echo $this->__('Expiration Date'); ?></label>
|
56 |
+
<div id="braintree-expiration-container">
|
57 |
+
<div id="expiration-month" class="braintree-input-field braintree-expiration"></div>
|
58 |
+
<div class="braintree-expiration-seperator">/</div>
|
59 |
+
<div id="expiration-year" class="braintree-input-field braintree-expiration"></div>
|
60 |
+
</div>
|
61 |
+
</li>
|
62 |
+
<?php echo $this->getChildHtml() ?>
|
63 |
+
<?php if($this->hasVerification()): ?>
|
64 |
+
<li>
|
65 |
+
<label for="cvv"><?php echo $this->__('CVV'); ?></label>
|
66 |
+
<div id="cvv" class="braintree-input-field braintree-cvv"></div>
|
67 |
+
<a href="#" class="cvv-what-is-this"><?php echo $this->__('What is this?') ?></a>
|
68 |
+
</li>
|
69 |
+
<?php endif; ?>
|
70 |
+
<?php if ($this->canSaveCard()): ?>
|
71 |
+
<li id="<?php echo $_code ?>_store_in_vault_div">
|
72 |
+
<input type="checkbox" title="<?php echo $this->__('Save this card for future use') ?>"
|
73 |
+
class="input-checkbox" id="<?php echo $_code ?>_store_in_vault" name="payment[save_card]"
|
74 |
+
value="1"/>
|
75 |
+
<label for="<?php echo $_code ?>_store_in_vault" style="float:none;"><?php echo $this->__(
|
76 |
+
'Save this card for future use'
|
77 |
+
) ?></label>
|
78 |
+
</li>
|
79 |
+
<?php endif; ?>
|
80 |
+
</ul>
|
81 |
+
</div>
|
82 |
+
|
83 |
+
<?php /* Do not remove or modify this code, the div is hidden and used to fire the hosted fields tokenization */ ?>
|
84 |
+
<div id="braintree-hosted-submit">
|
85 |
+
<button type="submit" data-blockCapture="true"></button>
|
86 |
+
|
87 |
+
<!-- Fields for the payment method -->
|
88 |
+
<input type="text" name="payment[payment_method_nonce]" value="" id="creditcard-payment-nonce" class="validate-fire-hosted" />
|
89 |
+
</div>
|
90 |
+
</div>
|
91 |
+
|
92 |
+
<script type="text/javascript">
|
93 |
+
if(typeof vzero !== 'undefined') {
|
94 |
+
vzero.creditCardLoaded();
|
95 |
+
}
|
96 |
+
</script>
|
app/design/frontend/base/default/template/gene/braintree/js/aheadworks.phtml
CHANGED
@@ -2,352 +2,147 @@
|
|
2 |
/**
|
3 |
* Add in support for Aheadworks One Step Checkout
|
4 |
* http://ecommerce.aheadworks.com/magento-extensions/one-step-checkout.html
|
|
|
5 |
*/
|
6 |
?>
|
7 |
<!-- AHEADWORKS BRAINTREE SUPPORT -->
|
8 |
<script type="text/javascript">
|
9 |
|
10 |
-
|
11 |
-
if(awPlaceOrderOriginal === undefined) {
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
if ($('device_data')) {
|
20 |
-
// Device data should never be disabled
|
21 |
-
$('device_data').removeAttribute('disabled');
|
22 |
-
}
|
23 |
-
|
24 |
-
// Always attempt to update the card type on submission
|
25 |
-
if ($$('[data-genebraintree-name="number"]').first() != undefined) {
|
26 |
-
vzero.updateCardType($$('[data-genebraintree-name="number"]').first().value);
|
27 |
-
}
|
28 |
-
|
29 |
-
// Are we dealing with the credit card method?
|
30 |
-
if (awOSCPayment.currentMethod == 'gene_braintree_creditcard') {
|
31 |
-
|
32 |
-
// Do we want to pass any extra paramters into the updateData request
|
33 |
-
var parameters = {};
|
34 |
-
|
35 |
-
// If the billing address is selected and we're wanting to ship to that address we need to pass the addressId
|
36 |
-
if ($('billing-address-select') != undefined && $('billing-address-select').value != '') {
|
37 |
-
parameters.addressId = $('billing-address-select').value;
|
38 |
-
}
|
39 |
-
|
40 |
-
// Update the data as we're in a one step
|
41 |
-
vzero.updateData(
|
42 |
-
function () {
|
43 |
-
|
44 |
-
// Verify we're not using a saved address
|
45 |
-
if ($('billing-address-select') != undefined && $('billing-address-select').value == '' || $('billing-address-select') == undefined) {
|
46 |
-
|
47 |
-
// Grab these directly from the form and update
|
48 |
-
if ($('billing:firstname') != undefined && $('billing:lastname') != undefined) {
|
49 |
-
vzero.setBillingName($('billing:firstname').value + ' ' + $('billing:lastname').value);
|
50 |
-
}
|
51 |
-
if ($('billing:postcode') != undefined) {
|
52 |
-
vzero.setBillingPostcode($('billing:postcode').value);
|
53 |
-
}
|
54 |
-
}
|
55 |
-
|
56 |
-
// Process the card
|
57 |
-
vzero.process({
|
58 |
-
onSuccess: function () {
|
59 |
-
|
60 |
-
// Disable the standard credit card form so the values don't get passed through to the checkout
|
61 |
-
$$('#credit-card-form input, #credit-card-form select').each(function (formElement) {
|
62 |
-
if (formElement.id != 'creditcard-payment-nonce' && formElement.getAttribute('data-genebraintree-name') != 'cvv' && formElement.id != 'gene_braintree_creditcard_store_in_vault') {
|
63 |
-
formElement.setAttribute('disabled', 'disabled');
|
64 |
-
}
|
65 |
-
});
|
66 |
-
|
67 |
-
if ($('device_data')) {
|
68 |
-
// Always make sure device data is sent with the request
|
69 |
-
$('device_data').removeAttribute('disabled');
|
70 |
-
}
|
71 |
-
|
72 |
-
// Fire the original event and return the response
|
73 |
-
completeCheckoutResponse = awPlaceOrderOriginal.apply(this, arguments);
|
74 |
-
|
75 |
-
// Re-enable any form elements which were disabled
|
76 |
-
$$('#credit-card-form input, #credit-card-form select').each(function (formElement) {
|
77 |
-
formElement.removeAttribute('disabled');
|
78 |
-
});
|
79 |
-
|
80 |
-
// Run the original function
|
81 |
-
return completeCheckoutResponse;
|
82 |
-
}.bind(this),
|
83 |
-
onFailure: function () {
|
84 |
-
|
85 |
-
// Reset the waiting for the parent function
|
86 |
-
this.enablePlaceOrderButton();
|
87 |
-
this.hidePleaseWaitNotice();
|
88 |
-
this.hideOverlay();
|
89 |
-
|
90 |
-
}.bind(this)
|
91 |
-
});
|
92 |
-
|
93 |
-
}.bind(this),
|
94 |
-
parameters
|
95 |
-
);
|
96 |
-
|
97 |
-
// We're updating data don't do anything else for now
|
98 |
-
return false;
|
99 |
-
|
100 |
-
}
|
101 |
-
|
102 |
-
// Stop further processing
|
103 |
-
return awPlaceOrderOriginal.apply(this, arguments);
|
104 |
|
105 |
-
|
|
|
|
|
|
|
|
|
|
|
106 |
|
107 |
-
|
108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
|
110 |
/**
|
111 |
-
*
|
112 |
*/
|
113 |
-
|
|
|
|
|
|
|
|
|
|
|
114 |
|
115 |
-
|
116 |
-
|
|
|
|
|
117 |
|
118 |
-
|
119 |
-
|
120 |
|
121 |
-
|
122 |
-
|
123 |
|
124 |
-
|
125 |
-
|
126 |
-
$('paypal-payment-nonce').value = obj.nonce;
|
127 |
|
128 |
-
|
129 |
-
hidePayPalButton();
|
130 |
|
131 |
-
|
132 |
-
|
|
|
133 |
|
134 |
-
|
135 |
-
|
|
|
|
|
136 |
|
137 |
-
|
138 |
-
//
|
139 |
-
|
140 |
}
|
141 |
|
142 |
-
|
143 |
-
return awOSCForm.placeOrder();
|
144 |
-
|
145 |
-
}
|
146 |
|
147 |
-
}
|
148 |
-
|
149 |
-
// Flag to check if the PayPal button is already loading
|
150 |
-
var PayPalButtonLoading = false;
|
151 |
|
152 |
/**
|
153 |
-
*
|
154 |
*/
|
155 |
-
|
156 |
-
|
157 |
-
// Check we can locate the submit button
|
158 |
-
if ($('aw-onestepcheckout-place-order-button') != undefined && $('paypal-complete') == undefined && PayPalButtonLoading == false) {
|
159 |
-
|
160 |
-
// The button is loading
|
161 |
-
PayPalButtonLoading = true;
|
162 |
-
|
163 |
-
// As the PayPal button has to request data from the server show the loader
|
164 |
-
awOSCForm.disablePlaceOrderButton();
|
165 |
-
|
166 |
-
// Update the data contained within the classes
|
167 |
-
vzero.updateData(function () {
|
168 |
-
|
169 |
-
// The button is no longer loading
|
170 |
-
PayPalButtonLoading = false;
|
171 |
-
|
172 |
-
// Hide it once we're done
|
173 |
-
awOSCForm.enablePlaceOrderButton();
|
174 |
-
|
175 |
-
// Validate the payment method is still correct
|
176 |
-
if (awOSCPayment.currentMethod == 'gene_braintree_paypal' && $('paypal-complete') == undefined) {
|
177 |
-
|
178 |
-
// Set the flag to false as we've created a new button
|
179 |
-
PayPalCompleteRan = false;
|
180 |
-
|
181 |
-
// Hide the submit button
|
182 |
-
$('aw-onestepcheckout-place-order-button').hide();
|
183 |
-
|
184 |
-
// Add in our PayPal button
|
185 |
-
$('aw-onestepcheckout-place-order-button').insert({after: '<div id="paypal-complete"><label id="paypal-label"><?php echo $this->__('Complete checkout with'); ?> </label><div id="paypal-container"></div></div>'});
|
186 |
-
|
187 |
-
// Always stop the window from opening
|
188 |
-
$('paypal-complete').observe('click', function (event) {
|
189 |
-
|
190 |
-
// Validate the form before we open the PayPal modal window
|
191 |
-
if (!awOSCForm.validate()) {
|
192 |
|
193 |
-
|
194 |
-
|
195 |
-
}
|
196 |
-
});
|
197 |
|
198 |
-
|
199 |
-
|
200 |
-
onSuccess: completePayPal
|
201 |
-
});
|
202 |
|
203 |
-
|
204 |
-
|
205 |
-
});
|
206 |
-
|
207 |
-
} else if ($('paypal-complete') != undefined) {
|
208 |
-
|
209 |
-
// The button is loading
|
210 |
-
PayPalButtonLoading = true;
|
211 |
-
|
212 |
-
// As the PayPal button has to request data from the server show the loader
|
213 |
-
awOSCForm.disablePlaceOrderButton();
|
214 |
-
|
215 |
-
// Update the data contained within the classes
|
216 |
-
vzero.updateData(function () {
|
217 |
-
|
218 |
-
// The button is no longer loading
|
219 |
-
PayPalButtonLoading = false;
|
220 |
-
|
221 |
-
// Hide it once we're done
|
222 |
-
awOSCForm.enablePlaceOrderButton();
|
223 |
-
|
224 |
-
// Validate the payment method is still correct
|
225 |
-
if (awOSCPayment.currentMethod == 'gene_braintree_paypal') {
|
226 |
-
|
227 |
-
// Set the flag to false as we've created a new button
|
228 |
-
PayPalCompleteRan = false;
|
229 |
|
230 |
-
|
231 |
-
|
232 |
|
233 |
-
|
234 |
-
|
|
|
235 |
|
|
|
|
|
|
|
|
|
|
|
236 |
}
|
237 |
-
|
238 |
});
|
|
|
239 |
|
240 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
|
242 |
-
}
|
243 |
|
244 |
/**
|
245 |
-
*
|
246 |
*/
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
if ($('aw-onestepcheckout-place-order-button') != undefined) {
|
251 |
-
$('aw-onestepcheckout-place-order-button').show();
|
252 |
-
}
|
253 |
-
|
254 |
-
// Remove the PayPal element
|
255 |
-
if ($('paypal-complete') != undefined) {
|
256 |
-
$('paypal-complete').hide();
|
257 |
-
}
|
258 |
-
|
259 |
-
};
|
260 |
-
|
261 |
-
// Check if the payment method is the default
|
262 |
-
if (awOSCPayment !== undefined) {
|
263 |
-
if ((awOSCPayment.currentMethod == 'gene_braintree_paypal' && $('paypal-saved-accounts') == undefined) || ($$('#paypal-saved-accounts input:checked[type=radio]').first() != undefined && $$('#paypal-saved-accounts input:checked[type=radio]').first().value == 'other')) {
|
264 |
-
|
265 |
-
// Verify that vzero is defined before attempting to use it
|
266 |
-
if (typeof vzeroPaypal !== 'undefined') {
|
267 |
-
|
268 |
-
// Always set the amount as it's needed within 3D secure requests
|
269 |
-
vzeroPaypal.setPricing('<?php echo Mage::getSingleton('checkout/cart')->getQuote()->collectTotals()->getGrandTotal(); ?>', '<?php echo Mage::getSingleton('checkout/cart')->getQuote()->getBaseCurrencyCode(); ?>');
|
270 |
-
}
|
271 |
-
|
272 |
-
addPayPalButton();
|
273 |
-
}
|
274 |
}
|
275 |
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
hidePayPalButton();
|
294 |
-
}
|
295 |
-
|
296 |
-
} else if(typeof skipOverride === 'undefined') {
|
297 |
-
hidePayPalButton();
|
298 |
-
}
|
299 |
-
}
|
300 |
-
|
301 |
-
|
302 |
-
// Run the original function
|
303 |
-
return aWPaymentOriginal.apply(this, arguments);
|
304 |
-
|
305 |
-
};
|
306 |
-
|
307 |
-
// What should happen if the user closes the 3D secure window?
|
308 |
-
vzero.close3dSecureMethod(function () {
|
309 |
-
|
310 |
-
// Re-tokenize all the saved cards
|
311 |
-
vzero.tokenize3dSavedCards(function () {
|
312 |
-
|
313 |
-
// Hide the loading
|
314 |
-
awOSCForm.enablePlaceOrderButton();
|
315 |
-
awOSCForm.hidePleaseWaitNotice();
|
316 |
-
awOSCForm.hideOverlay();
|
317 |
-
|
318 |
-
});
|
319 |
-
|
320 |
-
});
|
321 |
-
|
322 |
-
// Observe the card type here as it'll fail within creditCard.phtml
|
323 |
-
vzero.observeCardType();
|
324 |
-
|
325 |
-
// Observe all Ajax requests for changes
|
326 |
-
vzero.observeAjaxRequests(function () {
|
327 |
-
|
328 |
-
// If the method is PayPal remove and re-add the PayPal button
|
329 |
-
if (awOSCPayment.currentMethod == 'gene_braintree_paypal') {
|
330 |
-
hidePayPalButton();
|
331 |
-
addPayPalButton();
|
332 |
-
} else {
|
333 |
-
vzero.updateData();
|
334 |
-
}
|
335 |
-
|
336 |
-
});
|
337 |
-
|
338 |
-
}
|
339 |
|
340 |
-
</script>
|
341 |
-
<style type="text/css">
|
342 |
-
#braintree-paypal-button {
|
343 |
-
line-height: unset;
|
344 |
-
padding: 0;
|
345 |
-
float: left;
|
346 |
-
}
|
347 |
-
#braintree-paypal-loggedin {
|
348 |
-
display: none!important;
|
349 |
-
}
|
350 |
-
#braintree-paypal-loggedout {
|
351 |
-
display: block!important;
|
352 |
-
}
|
353 |
-
</style>
|
2 |
/**
|
3 |
* Add in support for Aheadworks One Step Checkout
|
4 |
* http://ecommerce.aheadworks.com/magento-extensions/one-step-checkout.html
|
5 |
+
* @author Dave Macaulay <dave@gene.co.uk>
|
6 |
*/
|
7 |
?>
|
8 |
<!-- AHEADWORKS BRAINTREE SUPPORT -->
|
9 |
<script type="text/javascript">
|
10 |
|
11 |
+
vZeroIntegration.addMethods({
|
|
|
12 |
|
13 |
+
/**
|
14 |
+
* Validate the entire checkout
|
15 |
+
*/
|
16 |
+
validateAll: function() {
|
17 |
+
return awOSCForm.validate();
|
18 |
+
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
+
/**
|
21 |
+
* Return the payment method from the checkouts methods
|
22 |
+
*/
|
23 |
+
getPaymentMethod: function() {
|
24 |
+
return awOSCPayment.currentMethod;
|
25 |
+
},
|
26 |
|
27 |
+
/**
|
28 |
+
* Activate the loading state of this checkout
|
29 |
+
*/
|
30 |
+
setLoading: function() {
|
31 |
+
awOSCForm.disablePlaceOrderButton();
|
32 |
+
awOSCForm.showPleaseWaitNotice();
|
33 |
+
awOSCForm.showOverlay();
|
34 |
+
checkoutRunning = true;
|
35 |
+
},
|
36 |
|
37 |
/**
|
38 |
+
* Reset the loading state of the checkout
|
39 |
*/
|
40 |
+
resetLoading: function() {
|
41 |
+
awOSCForm.enablePlaceOrderButton();
|
42 |
+
awOSCForm.hidePleaseWaitNotice();
|
43 |
+
awOSCForm.hideOverlay();
|
44 |
+
checkoutRunning = false;
|
45 |
+
},
|
46 |
|
47 |
+
/**
|
48 |
+
* Attach an observer to the submit action of the checkout to tokenize the card details
|
49 |
+
*/
|
50 |
+
prepareSubmitObserver: function() {
|
51 |
|
52 |
+
// Store a pointer to the vZero integration
|
53 |
+
var vzeroIntegration = this;
|
54 |
|
55 |
+
// Store the original payment method
|
56 |
+
var _originalSendPlaceOrderRequest = AWOnestepcheckoutForm.prototype._sendPlaceOrderRequest;
|
57 |
|
58 |
+
// Intercept the save function
|
59 |
+
AWOnestepcheckoutForm.prototype._sendPlaceOrderRequest = function () {
|
|
|
60 |
|
61 |
+
if (vzeroIntegration.shouldInterceptSubmit('creditcard')) {
|
|
|
62 |
|
63 |
+
// Store a pointer to the payment class
|
64 |
+
var paymentThis = this;
|
65 |
+
var paymentArguments = arguments;
|
66 |
|
67 |
+
// If everything was a success on the checkout end, let's submit the vZero integration
|
68 |
+
vzeroIntegration.submit('creditcard', function () {
|
69 |
+
return _originalSendPlaceOrderRequest.apply(paymentThis, paymentArguments);
|
70 |
+
});
|
71 |
|
72 |
+
} else {
|
73 |
+
// If not run the original code
|
74 |
+
return _originalSendPlaceOrderRequest.apply(this, arguments);
|
75 |
}
|
76 |
|
77 |
+
};
|
|
|
|
|
|
|
78 |
|
79 |
+
},
|
|
|
|
|
|
|
80 |
|
81 |
/**
|
82 |
+
* Prepare an event to insert the PayPal button in place of the complete checkout button
|
83 |
*/
|
84 |
+
preparePaymentMethodSwitchObserver: function() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
|
86 |
+
// Store a pointer to the vZero integration
|
87 |
+
var vzeroIntegration = this;
|
|
|
|
|
88 |
|
89 |
+
// Store the original payment method
|
90 |
+
var _originalSwitchToMethod = AWOnestepcheckoutPayment.prototype.switchToMethod;
|
|
|
|
|
91 |
|
92 |
+
// Intercept the save function
|
93 |
+
AWOnestepcheckoutPayment.prototype.switchToMethod = function (method) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
|
95 |
+
// Run our method switch function
|
96 |
+
vzeroIntegration.paymentMethodSwitch(method);
|
97 |
|
98 |
+
// Run the original function
|
99 |
+
return _originalSwitchToMethod.apply(this, arguments);
|
100 |
+
};
|
101 |
|
102 |
+
Event.observe(window, 'load', function(e) {
|
103 |
+
// Block the change events fired by Aheadworks
|
104 |
+
$$('#payment_form_gene_braintree_paypal input, #payment_form_gene_braintree_creditcard input').each(function (element) {
|
105 |
+
if (element.identify() != 'other-creditcard' && element.identify() != 'other-paypal') {
|
106 |
+
element.stopObserving('change');
|
107 |
}
|
|
|
108 |
});
|
109 |
+
});
|
110 |
|
111 |
+
// Stop the checkout from validating the form when the customer switches to credit card
|
112 |
+
// This would cause Hosted Fields to automatically submit
|
113 |
+
var _originalSavePayment = AWOnestepcheckoutPayment.prototype.savePayment;
|
114 |
+
AWOnestepcheckoutPayment.prototype.savePayment = function() {
|
115 |
+
if (this.currentMethod != 'gene_braintree_creditcard' || (this.currentMethod == 'gene_braintree_creditcard' && !vzeroIntegration.vzero.hostedFields)) {
|
116 |
+
return _originalSavePayment.apply(this, arguments);
|
117 |
+
}
|
118 |
+
};
|
119 |
|
120 |
+
},
|
121 |
|
122 |
/**
|
123 |
+
* The action to run after the PayPal action has been completed
|
124 |
*/
|
125 |
+
submitCheckout: function() {
|
126 |
+
this.updatePayPalButton('remove');
|
127 |
+
return awOSCForm.placeOrder();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
}
|
129 |
|
130 |
+
});
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Start a new instance of our integration
|
134 |
+
*
|
135 |
+
* @type {vZeroIntegration}
|
136 |
+
*/
|
137 |
+
new vZeroIntegration(
|
138 |
+
(window.vzero || false),
|
139 |
+
(window.vzeroPaypal || false),
|
140 |
+
'<div id="paypal-complete"><label id="paypal-label"><?php echo $this->__('Complete checkout with'); ?> </label><div id="paypal-container"></div></div>',
|
141 |
+
'#aw-onestepcheckout-place-order-button',
|
142 |
+
true,
|
143 |
+
{
|
144 |
+
ignoreAjax: ['onestepcheckout/ajax/saveOrder']
|
145 |
+
}
|
146 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
|
148 |
+
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/gene/braintree/js/amasty.phtml
CHANGED
@@ -2,398 +2,120 @@
|
|
2 |
/**
|
3 |
* Add in support for Amasty One Step Checkout
|
4 |
* https://amasty.com/single-step-checkout.html
|
|
|
5 |
*/
|
6 |
?>
|
7 |
<!-- AMASTY BRAINTREE SUPPORT -->
|
8 |
<script type="text/javascript">
|
9 |
|
10 |
// Older versions of the checkout don't contain this variable
|
11 |
-
|
12 |
-
var checkoutRunning = false;
|
13 |
-
}
|
14 |
|
15 |
-
|
16 |
-
if(originalCompleteCheckout === undefined && completeCheckout !== undefined) {
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
if($('device_data')) {
|
25 |
-
// Device data should never be disabled
|
26 |
-
$('device_data').removeAttribute('disabled');
|
27 |
-
}
|
28 |
-
|
29 |
-
// Always attempt to update the card type on submission
|
30 |
-
if($$('[data-genebraintree-name="number"]').first() != undefined) {
|
31 |
-
vzero.updateCardType($$('[data-genebraintree-name="number"]').first().value);
|
32 |
-
}
|
33 |
-
|
34 |
-
// Run the original validation functions
|
35 |
-
if (amscheckoutForm.validator.validate() && !checkoutRunning) {
|
36 |
-
|
37 |
-
// Are we dealing with the credit card method?
|
38 |
-
if (payment.currentMethod == 'gene_braintree_creditcard') {
|
39 |
-
|
40 |
-
// Do we want to pass any extra paramters into the updateData request
|
41 |
-
var parameters = {};
|
42 |
-
|
43 |
-
// If the billing address is selected and we're wanting to ship to that address we need to pass the addressId
|
44 |
-
if($('billing-address-select') != undefined && $('billing-address-select').value != '')
|
45 |
-
{
|
46 |
-
parameters.addressId = $('billing-address-select').value;
|
47 |
-
}
|
48 |
-
|
49 |
-
// Update the data as we're in a one step
|
50 |
-
vzero.updateData(
|
51 |
-
function() {
|
52 |
-
|
53 |
-
// Verify we're not using a saved address
|
54 |
-
if($('billing-address-select') != undefined && $('billing-address-select').value == '' || $('billing-address-select') == undefined) {
|
55 |
-
|
56 |
-
// Grab these directly from the form and update
|
57 |
-
if ($('billing:firstname') != undefined && $('billing:lastname') != undefined) {
|
58 |
-
vzero.setBillingName($('billing:firstname').value + ' ' + $('billing:lastname').value);
|
59 |
-
}
|
60 |
-
if ($('billing:postcode') != undefined) {
|
61 |
-
vzero.setBillingPostcode($('billing:postcode').value);
|
62 |
-
}
|
63 |
-
}
|
64 |
-
|
65 |
-
// Check is running
|
66 |
-
checkoutRunning = true;
|
67 |
-
|
68 |
-
// Show the loading
|
69 |
-
showLoading();
|
70 |
-
|
71 |
-
// Process the card
|
72 |
-
vzero.process({
|
73 |
-
onSuccess: function () {
|
74 |
-
|
75 |
-
// Disable the standard credit card form so the values don't get passed through to the checkout
|
76 |
-
$$('#credit-card-form input, #credit-card-form select').each(function (formElement) {
|
77 |
-
if (formElement.id != 'creditcard-payment-nonce' && formElement.getAttribute('data-genebraintree-name') != 'cvv' && formElement.id != 'gene_braintree_creditcard_store_in_vault') {
|
78 |
-
formElement.setAttribute('disabled', 'disabled');
|
79 |
-
}
|
80 |
-
});
|
81 |
-
|
82 |
-
if($('device_data')) {
|
83 |
-
// Always make sure device data is sent with the request
|
84 |
-
$('device_data').removeAttribute('disabled');
|
85 |
-
}
|
86 |
-
|
87 |
-
// No longer running
|
88 |
-
checkoutRunning = false;
|
89 |
-
|
90 |
-
// Fire the original event and return the response
|
91 |
-
completeCheckoutResponse = originalCompleteCheckout.apply(this, arguments);
|
92 |
-
|
93 |
-
// Re-enable any form elements which were disabled
|
94 |
-
$$('#credit-card-form input, #credit-card-form select').each(function (formElement) {
|
95 |
-
formElement.removeAttribute('disabled');
|
96 |
-
});
|
97 |
-
|
98 |
-
// Run the original function
|
99 |
-
return completeCheckoutResponse;
|
100 |
-
},
|
101 |
-
onFailure: function() {
|
102 |
-
|
103 |
-
// Reset the waiting for the parent function
|
104 |
-
hideLoading();
|
105 |
-
|
106 |
-
// No longer running
|
107 |
-
checkoutRunning = false;
|
108 |
-
|
109 |
-
}
|
110 |
-
});
|
111 |
-
|
112 |
-
},
|
113 |
-
parameters
|
114 |
-
);
|
115 |
-
|
116 |
-
// We're updating data don't do anything else for now
|
117 |
-
return false;
|
118 |
-
|
119 |
-
}
|
120 |
-
|
121 |
-
}
|
122 |
-
|
123 |
-
// Stop further processing
|
124 |
-
return originalCompleteCheckout.apply(this, arguments);
|
125 |
-
};
|
126 |
-
}
|
127 |
-
|
128 |
-
// Only intercept the payment method once
|
129 |
-
if(paymentOriginal == undefined) {
|
130 |
|
131 |
-
|
132 |
-
|
|
|
|
|
|
|
|
|
|
|
133 |
|
134 |
/**
|
135 |
-
*
|
136 |
*/
|
137 |
-
|
|
|
|
|
|
|
138 |
|
139 |
-
|
140 |
-
|
|
|
|
|
141 |
|
142 |
-
|
143 |
-
|
144 |
|
145 |
-
|
146 |
-
|
147 |
|
148 |
-
|
149 |
-
|
150 |
-
$('paypal-payment-nonce').value = obj.nonce;
|
151 |
|
152 |
-
|
153 |
-
hidePayPalButton();
|
154 |
|
155 |
-
|
156 |
-
|
|
|
157 |
|
158 |
-
|
159 |
-
|
|
|
|
|
160 |
|
161 |
-
|
162 |
-
//
|
163 |
-
|
164 |
}
|
165 |
|
166 |
-
|
167 |
-
return completeCheckout();
|
168 |
-
|
169 |
-
}
|
170 |
|
171 |
-
}
|
172 |
-
|
173 |
-
// Flag to check if the PayPal button is already loading
|
174 |
-
var PayPalButtonLoading = false;
|
175 |
|
176 |
/**
|
177 |
-
*
|
178 |
*/
|
179 |
-
|
180 |
-
|
181 |
-
// Check we can locate the submit button
|
182 |
-
if($$('.amscheckout-submit').first() != undefined && $('paypal-complete') == undefined && PayPalButtonLoading == false) {
|
183 |
-
|
184 |
-
// The button is loading
|
185 |
-
PayPalButtonLoading = true;
|
186 |
-
|
187 |
-
// As the PayPal button has to request data from the server show the loader
|
188 |
-
showLoading();
|
189 |
-
|
190 |
-
// Update the data contained within the classes
|
191 |
-
vzero.updateData(function () {
|
192 |
-
|
193 |
-
// The button is no longer loading
|
194 |
-
PayPalButtonLoading = false;
|
195 |
-
|
196 |
-
// Hide it once we're done
|
197 |
-
hideLoading();
|
198 |
-
|
199 |
-
// Validate the payment method is still correct
|
200 |
-
if(payment.currentMethod == 'gene_braintree_paypal' && $('paypal-complete') == undefined) {
|
201 |
-
|
202 |
-
// Set the flag to false as we've created a new button
|
203 |
-
PayPalCompleteRan = false;
|
204 |
-
|
205 |
-
// Hide the submit button
|
206 |
-
$$('.amscheckout-submit').first().hide();
|
207 |
-
|
208 |
-
// Add in our PayPal button
|
209 |
-
$$('.amscheckout-submit').first().up().insert('<div id="paypal-complete"><label id="paypal-label"><?php echo $this->__('Complete checkout with'); ?> </label><div id="paypal-container"></div></div>');
|
210 |
|
211 |
-
|
212 |
-
|
213 |
|
214 |
-
|
215 |
-
if (!amscheckoutForm.validator.validate() || checkoutRunning) {
|
216 |
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
});
|
221 |
|
222 |
-
|
223 |
-
|
224 |
-
onSuccess: completePayPal
|
225 |
-
});
|
226 |
|
227 |
-
|
|
|
|
|
228 |
|
229 |
-
|
230 |
-
|
231 |
-
} else if($('paypal-complete') != undefined) {
|
232 |
-
|
233 |
-
// The button is loading
|
234 |
-
PayPalButtonLoading = true;
|
235 |
-
|
236 |
-
// As the PayPal button has to request data from the server show the loader
|
237 |
-
showLoading();
|
238 |
-
|
239 |
-
// Update the data contained within the classes
|
240 |
-
vzero.updateData(function () {
|
241 |
-
|
242 |
-
// The button is no longer loading
|
243 |
-
PayPalButtonLoading = false;
|
244 |
-
|
245 |
-
// Hide it once we're done
|
246 |
-
hideLoading();
|
247 |
-
|
248 |
-
// Validate the payment method is still correct
|
249 |
-
if(payment.currentMethod == 'gene_braintree_paypal') {
|
250 |
-
|
251 |
-
// Set the flag to false as we've created a new button
|
252 |
-
PayPalCompleteRan = false;
|
253 |
-
|
254 |
-
// Hide the submit button
|
255 |
-
$$('.amscheckout-submit').first().hide();
|
256 |
-
|
257 |
-
// Add in the PayPal button
|
258 |
-
$('paypal-complete').show();
|
259 |
-
|
260 |
-
}
|
261 |
-
|
262 |
-
});
|
263 |
-
|
264 |
-
}
|
265 |
-
|
266 |
-
};
|
267 |
|
268 |
/**
|
269 |
-
*
|
270 |
*/
|
271 |
-
|
272 |
-
|
273 |
-
// If the user has selected a different payment method make some modifications
|
274 |
-
if($$('.amscheckout-submit').first() != undefined) {
|
275 |
-
$$('.amscheckout-submit').first().show();
|
276 |
-
}
|
277 |
-
|
278 |
-
// Remove the PayPal element
|
279 |
-
if($('paypal-complete') != undefined) {
|
280 |
-
$('paypal-complete').hide();
|
281 |
-
}
|
282 |
-
|
283 |
-
};
|
284 |
-
|
285 |
-
// Check if the payment method is the default
|
286 |
-
if(payment !== undefined) {
|
287 |
-
if((payment.currentMethod == 'gene_braintree_paypal' && $('paypal-saved-accounts') == undefined) || ($$('#paypal-saved-accounts input:checked[type=radio]').first() != undefined && $$('#paypal-saved-accounts input:checked[type=radio]').first().value == 'other')) {
|
288 |
-
|
289 |
-
// Verify that vzero is defined before attempting to use it
|
290 |
-
if(typeof vzeroPaypal !== 'undefined') {
|
291 |
-
|
292 |
-
// Always set the amount as it's needed within 3D secure requests
|
293 |
-
vzeroPaypal.setPricing('<?php echo Mage::getSingleton('checkout/cart')->getQuote()->collectTotals()->getGrandTotal(); ?>', '<?php echo Mage::getSingleton('checkout/cart')->getQuote()->getBaseCurrencyCode(); ?>');
|
294 |
-
}
|
295 |
-
|
296 |
-
addPayPalButton();
|
297 |
-
}
|
298 |
}
|
299 |
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
addPayPalButton();
|
316 |
-
} else {
|
317 |
-
hidePayPalButton();
|
318 |
-
}
|
319 |
-
|
320 |
-
} else if(typeof skipOverride === 'undefined') {
|
321 |
-
hidePayPalButton();
|
322 |
-
}
|
323 |
-
}
|
324 |
-
|
325 |
-
|
326 |
-
// Run the original function
|
327 |
-
return paymentOriginal.apply(this, arguments);
|
328 |
-
|
329 |
-
};
|
330 |
-
|
331 |
-
// If we have any saved accounts we'll need to do something jammy
|
332 |
-
if($$('#paypal-saved-accounts input[type=radio]').first() != undefined) {
|
333 |
-
|
334 |
-
// Loop through each radio button
|
335 |
-
$$('#paypal-saved-accounts input[type=radio]').each(function (savedAccount) {
|
336 |
-
|
337 |
-
// Observe them changing
|
338 |
-
Event.observe(savedAccount, 'click', function (ele) {
|
339 |
-
if(savedAccount.value == 'other') {
|
340 |
-
addPayPalButton();
|
341 |
-
} else {
|
342 |
-
hidePayPalButton();
|
343 |
-
}
|
344 |
-
});
|
345 |
-
});
|
346 |
}
|
|
|
347 |
|
348 |
-
|
349 |
-
updateCheckout = function() {
|
350 |
-
|
351 |
-
// If we're updating the checkout remove the PayPal button
|
352 |
-
hidePayPalButton();
|
353 |
-
|
354 |
-
// Run the original function
|
355 |
-
return updateCheckoutOriginal.apply(this, arguments);
|
356 |
-
};
|
357 |
-
|
358 |
-
// What should happen if the user closes the 3D secure window?
|
359 |
-
vzero.close3dSecureMethod(function() {
|
360 |
-
|
361 |
-
// Re-tokenize all the saved cards
|
362 |
-
vzero.tokenize3dSavedCards(function() {
|
363 |
-
|
364 |
-
// Hide the loading
|
365 |
-
hideLoading();
|
366 |
-
|
367 |
-
// Check is running
|
368 |
-
checkoutRunning = false;
|
369 |
-
|
370 |
-
});
|
371 |
-
|
372 |
-
});
|
373 |
-
|
374 |
-
// Observe the card type here as it'll fail within creditCard.phtml
|
375 |
-
vzero.observeCardType();
|
376 |
-
|
377 |
-
// Observe all Ajax requests for changes
|
378 |
-
vzero.observeAjaxRequests(function() {
|
379 |
-
|
380 |
-
// If the method is PayPal remove and re-add the PayPal button
|
381 |
-
if(payment.currentMethod == 'gene_braintree_paypal') {
|
382 |
-
hidePayPalButton();
|
383 |
-
addPayPalButton();
|
384 |
-
} else {
|
385 |
-
vzero.updateData();
|
386 |
-
}
|
387 |
-
|
388 |
-
});
|
389 |
-
|
390 |
-
}
|
391 |
-
</script>
|
392 |
-
<style type="text/css">
|
393 |
-
#braintree-paypal-loggedin {
|
394 |
-
display: none!important;
|
395 |
-
}
|
396 |
-
#braintree-paypal-loggedout {
|
397 |
-
display: block!important;
|
398 |
-
}
|
399 |
-
</style>
|
2 |
/**
|
3 |
* Add in support for Amasty One Step Checkout
|
4 |
* https://amasty.com/single-step-checkout.html
|
5 |
+
* @author Dave Macaulay <dave@gene.co.uk>
|
6 |
*/
|
7 |
?>
|
8 |
<!-- AMASTY BRAINTREE SUPPORT -->
|
9 |
<script type="text/javascript">
|
10 |
|
11 |
// Older versions of the checkout don't contain this variable
|
12 |
+
checkoutRunning = window.checkoutRunning || false;
|
|
|
|
|
13 |
|
14 |
+
vZeroIntegration.addMethods({
|
|
|
15 |
|
16 |
+
/**
|
17 |
+
* Validate the entire checkout
|
18 |
+
*/
|
19 |
+
validateAll: function() {
|
20 |
+
return amscheckoutForm.validator.validate();
|
21 |
+
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
+
/**
|
24 |
+
* Activate the loading state of this checkout
|
25 |
+
*/
|
26 |
+
setLoading: function() {
|
27 |
+
showLoading();
|
28 |
+
checkoutRunning = true;
|
29 |
+
},
|
30 |
|
31 |
/**
|
32 |
+
* Reset the loading state of the checkout
|
33 |
*/
|
34 |
+
resetLoading: function() {
|
35 |
+
hideLoading();
|
36 |
+
checkoutRunning = false;
|
37 |
+
},
|
38 |
|
39 |
+
/**
|
40 |
+
* Attach an observer to the submit action of the checkout to tokenize the card details
|
41 |
+
*/
|
42 |
+
prepareSubmitObserver: function() {
|
43 |
|
44 |
+
// Store a pointer to the vZero integration
|
45 |
+
var vzeroIntegration = this;
|
46 |
|
47 |
+
// Store the old complete checkout function
|
48 |
+
var _originalCompleteCheckout = completeCheckout;
|
49 |
|
50 |
+
// Re-define the original method so we can do some jazz with it
|
51 |
+
completeCheckout = function () {
|
|
|
52 |
|
53 |
+
if (vzeroIntegration.shouldInterceptSubmit('creditcard')) {
|
|
|
54 |
|
55 |
+
// Store a pointer to the payment class
|
56 |
+
var paymentThis = this;
|
57 |
+
var paymentArguments = arguments;
|
58 |
|
59 |
+
// If everything was a success on the checkout end, let's submit the vZero integration
|
60 |
+
vzeroIntegration.submit('creditcard', function () {
|
61 |
+
return _originalCompleteCheckout.apply(paymentThis, paymentArguments);
|
62 |
+
});
|
63 |
|
64 |
+
} else {
|
65 |
+
// If not run the original code
|
66 |
+
return _originalCompleteCheckout.apply(this, arguments);
|
67 |
}
|
68 |
|
69 |
+
};
|
|
|
|
|
|
|
70 |
|
71 |
+
},
|
|
|
|
|
|
|
72 |
|
73 |
/**
|
74 |
+
* Prepare an event to insert the PayPal button in place of the complete checkout button
|
75 |
*/
|
76 |
+
preparePaymentMethodSwitchObserver: function() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
|
78 |
+
// Run the default method switch
|
79 |
+
this.defaultPaymentMethodSwitch();
|
80 |
|
81 |
+
var vzeroIntegration = this;
|
|
|
82 |
|
83 |
+
// When this checkout updates we may need to remove the PayPal button
|
84 |
+
var _originalUpdateCheckout = updateCheckout;
|
85 |
+
updateCheckout = function() {
|
|
|
86 |
|
87 |
+
// Run our method switch function
|
88 |
+
vzeroIntegration.paymentMethodSwitch();
|
|
|
|
|
89 |
|
90 |
+
// Run the original function
|
91 |
+
return _originalUpdateCheckout.apply(this, arguments);
|
92 |
+
};
|
93 |
|
94 |
+
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
|
96 |
/**
|
97 |
+
* The action to run after the PayPal action has been completed
|
98 |
*/
|
99 |
+
submitCheckout: function() {
|
100 |
+
completeCheckout();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
}
|
102 |
|
103 |
+
});
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Start a new instance of our integration
|
107 |
+
*
|
108 |
+
* @type {vZeroIntegration}
|
109 |
+
*/
|
110 |
+
new vZeroIntegration(
|
111 |
+
(window.vzero || false),
|
112 |
+
(window.vzeroPaypal || false),
|
113 |
+
'<div id="paypal-complete"><label id="paypal-label"><?php echo $this->__('Complete checkout with'); ?></label><div id="paypal-container"></div></div>',
|
114 |
+
'.amscheckout-submit',
|
115 |
+
true,
|
116 |
+
{
|
117 |
+
ignoreAjax: ['amscheckoutfront/onepage/checkout']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
}
|
119 |
+
);
|
120 |
|
121 |
+
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/gene/braintree/js/default.phtml
CHANGED
@@ -1,203 +1,132 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Intercept various functions for the default checkout flow
|
|
|
4 |
*/
|
5 |
?>
|
6 |
<!-- DEFAULT BRAINTREE SUPPORT -->
|
7 |
<script type="text/javascript">
|
8 |
|
9 |
-
|
10 |
-
var paymentMethod = false;
|
11 |
|
12 |
-
|
13 |
-
|
|
|
|
|
14 |
|
15 |
-
|
16 |
-
|
17 |
|
18 |
-
|
|
|
|
|
19 |
|
20 |
-
|
21 |
-
|
|
|
22 |
|
23 |
-
|
24 |
-
|
|
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
var validator = new Validation(this.form);
|
36 |
-
if (this.validate() && validator.validate()) {
|
37 |
-
|
38 |
-
// Store these to be used later on
|
39 |
-
var paymentThis = this;
|
40 |
-
var paymentArgs = arguments;
|
41 |
-
|
42 |
-
// Process the card
|
43 |
-
vzero.process({
|
44 |
-
onSuccess: function () {
|
45 |
-
|
46 |
-
// Reset the waiting for the parent function
|
47 |
-
checkout.setLoadWaiting(false);
|
48 |
-
|
49 |
-
// Disable the standard credit card form so the values don't get passed through to the checkout
|
50 |
-
$$('#credit-card-form input, #credit-card-form select').each(function (formElement) {
|
51 |
-
if (formElement.id != 'creditcard-payment-nonce' && formElement.getAttribute('data-genebraintree-name') != 'cvv' && formElement.id != 'gene_braintree_creditcard_store_in_vault') {
|
52 |
-
formElement.setAttribute('disabled', 'disabled');
|
53 |
-
}
|
54 |
-
});
|
55 |
-
|
56 |
-
if($('device_data')) {
|
57 |
-
// Always make sure device data is sent with the request
|
58 |
-
$('device_data').removeAttribute('disabled');
|
59 |
-
}
|
60 |
-
|
61 |
-
// Fire the original event and return the response
|
62 |
-
paymentResponse = paymentOriginal.apply(paymentThis, paymentArgs);
|
63 |
-
|
64 |
-
// Re-enable any form elements which were disabled
|
65 |
-
$$('#credit-card-form input, #credit-card-form select').each(function (formElement) {
|
66 |
-
formElement.removeAttribute('disabled');
|
67 |
-
});
|
68 |
-
|
69 |
-
// Run the original function
|
70 |
-
return paymentResponse;
|
71 |
-
},
|
72 |
-
onFailure: function() {
|
73 |
-
checkout.setLoadWaiting(false);
|
74 |
-
}
|
75 |
-
});
|
76 |
-
} else {
|
77 |
-
checkout.setLoadWaiting(false);
|
78 |
-
}
|
79 |
-
|
80 |
-
} else {
|
81 |
-
// Proxy the function through
|
82 |
-
return paymentOriginal.apply(this, arguments);
|
83 |
-
}
|
84 |
-
};
|
85 |
-
|
86 |
-
// Store the original payment method
|
87 |
-
var reviewInitOriginal = Review.prototype.initialize;
|
88 |
-
|
89 |
-
// Intercept the save function
|
90 |
-
Review.prototype.initialize = function(saveUrl, successUrl, agreementsForm) {
|
91 |
-
|
92 |
-
// Do the original action
|
93 |
-
var reviewResponse = reviewInitOriginal.apply(this, arguments);
|
94 |
-
|
95 |
-
// Swap out the buttons
|
96 |
-
if((paymentMethod == 'gene_braintree_paypal' && $('paypal-saved-accounts') == undefined) || ($$('#paypal-saved-accounts input:checked[type=radio]').first() != undefined && $$('#paypal-saved-accounts input:checked[type=radio]').first().value == 'other')) {
|
97 |
-
|
98 |
-
// Hide the checkout button
|
99 |
-
if ($$('#review-buttons-container button').first() != undefined) {
|
100 |
-
$$('#review-buttons-container button').first().hide();
|
101 |
-
}
|
102 |
-
|
103 |
-
// Insert out PayPal button
|
104 |
-
$('review-buttons-container').insert('<div id="paypal-complete"><label id="paypal-label"><?php echo $this->__('Complete checkout with'); ?> </label><div id="paypal-container"></div></div>');
|
105 |
-
|
106 |
-
// Add in the PayPal button
|
107 |
-
vzeroPaypal.addPayPalButton();
|
108 |
-
|
109 |
-
// Style the label nicely
|
110 |
-
$('paypal-label').setStyle({
|
111 |
-
'lineHeight': '44px',
|
112 |
-
'float': 'left',
|
113 |
-
'marginRight': '12px'
|
114 |
-
});
|
115 |
|
116 |
-
|
117 |
-
if($('braintree-paypal-button') != undefined) {
|
118 |
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
'padding': '0',
|
123 |
-
'float': 'left'
|
124 |
-
});
|
125 |
-
}
|
126 |
|
127 |
-
|
|
|
128 |
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
|
134 |
-
|
135 |
-
|
136 |
-
$('paypal-complete').remove();
|
137 |
-
}
|
138 |
-
}
|
139 |
|
140 |
-
|
141 |
-
|
|
|
|
|
142 |
|
143 |
-
|
144 |
-
|
145 |
-
formElement.removeAttribute('disabled');
|
146 |
-
});
|
147 |
-
}
|
148 |
|
149 |
-
|
150 |
-
return reviewResponse;
|
151 |
|
152 |
-
|
|
|
|
|
|
|
153 |
|
154 |
-
|
155 |
-
|
156 |
|
157 |
-
|
158 |
-
|
159 |
|
160 |
-
|
161 |
-
|
162 |
|
163 |
-
|
164 |
-
|
165 |
-
if(formElement.id != 'creditcard-payment-nonce' && formElement.getAttribute('data-genebraintree-name') != 'cvv' && formElement.id != 'gene_braintree_creditcard_store_in_vault') {
|
166 |
-
formElement.setAttribute('disabled', 'disabled');
|
167 |
-
}
|
168 |
-
});
|
169 |
-
}
|
170 |
|
171 |
-
|
172 |
-
|
173 |
-
$('device_data').removeAttribute('disabled');
|
174 |
-
}
|
175 |
|
176 |
-
|
177 |
-
|
178 |
|
179 |
-
|
180 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
|
182 |
-
// Re-enable the form elements just in case something went wrong
|
183 |
-
$$('#credit-card-form input, #credit-card-form select').each(function(formElement) {
|
184 |
-
formElement.removeAttribute('disabled');
|
185 |
-
});
|
186 |
}
|
187 |
|
188 |
-
|
189 |
-
};
|
190 |
-
|
191 |
-
vzero.close3dSecureMethod(function() {
|
192 |
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
|
198 |
-
});
|
199 |
</script>
|
200 |
<style type="text/css">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
#braintree-paypal-loggedin {
|
202 |
display: none!important;
|
203 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
* Intercept various functions for the default checkout flow
|
4 |
+
* @author Dave Macaulay <dave@gene.co.uk>
|
5 |
*/
|
6 |
?>
|
7 |
<!-- DEFAULT BRAINTREE SUPPORT -->
|
8 |
<script type="text/javascript">
|
9 |
|
10 |
+
vZeroIntegration.addMethods({
|
|
|
11 |
|
12 |
+
/**
|
13 |
+
* Attach observer events for saving the payment step, alongside the review step
|
14 |
+
*/
|
15 |
+
prepareSubmitObserver: function() {
|
16 |
|
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;
|
30 |
+
var paymentArguments = arguments;
|
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 |
+
},
|
|
|
68 |
|
69 |
+
/**
|
70 |
+
* Attach an event to insert the PayPal button on the review step of the checkout
|
71 |
+
*/
|
72 |
+
preparePaymentMethodSwitchObserver: function() {
|
73 |
|
74 |
+
// Store a pointer to the vZero integration
|
75 |
+
var vzeroIntegration = this;
|
76 |
|
77 |
+
// Store a pointer to the original review step
|
78 |
+
var _originalReviewInitialize = Review.prototype.initialize;
|
79 |
|
80 |
+
// Intercept the save function
|
81 |
+
Review.prototype.initialize = function(saveUrl, successUrl, agreementsForm) {
|
82 |
|
83 |
+
// Do the original action
|
84 |
+
var reviewResponse = _originalReviewInitialize.apply(this, arguments);
|
|
|
|
|
|
|
|
|
|
|
85 |
|
86 |
+
// Run our magical function
|
87 |
+
vzeroIntegration.updatePayPalButton();
|
|
|
|
|
88 |
|
89 |
+
return reviewResponse;
|
90 |
+
};
|
91 |
|
92 |
+
// When the credit card payment methods is loaded init the hosted fields if enabled
|
93 |
+
vZero.prototype.creditCardLoaded = function() {
|
94 |
+
// When the credit card is loaded call the init hosted fields function
|
95 |
+
vzeroIntegration.initHostedFields();
|
96 |
+
vzeroIntegration.initSavedMethods();
|
97 |
+
};
|
98 |
+
vZero.prototype.paypalLoaded = function() {
|
99 |
+
vzeroIntegration.initSavedMethods();
|
100 |
+
};
|
101 |
|
|
|
|
|
|
|
|
|
102 |
}
|
103 |
|
104 |
+
});
|
|
|
|
|
|
|
105 |
|
106 |
+
/**
|
107 |
+
* Start a new instance of our integration
|
108 |
+
*
|
109 |
+
* @type {vZeroIntegration}
|
110 |
+
*/
|
111 |
+
new vZeroIntegration(
|
112 |
+
(window.vzero || false),
|
113 |
+
(window.vzeroPaypal || false),
|
114 |
+
'<div id="paypal-complete"><label id="paypal-label"><?php echo $this->__('Complete checkout with'); ?> </label><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 |
}
|
app/design/frontend/base/default/template/gene/braintree/js/firecheckout.phtml
CHANGED
@@ -2,361 +2,80 @@
|
|
2 |
/**
|
3 |
* Add in support for Fire Checkout
|
4 |
* http://templates-master.com/magento-one-page-checkout.html
|
|
|
5 |
*/
|
6 |
?>
|
7 |
<!-- FIRECHECKOUT BRAINTREE SUPPORT -->
|
8 |
<script type="text/javascript">
|
9 |
|
10 |
-
|
11 |
-
if(fireCheckoutSaveCheckout === undefined) {
|
12 |
-
|
13 |
-
// Store the old complete checkout function
|
14 |
-
var fireCheckoutSaveCheckout = FireCheckout.prototype.save;
|
15 |
-
|
16 |
-
// Re-define the original method so we can do some jazz with it
|
17 |
-
FireCheckout.prototype.save = function () {
|
18 |
-
|
19 |
-
if($('device_data')) {
|
20 |
-
// Device data should never be disabled
|
21 |
-
$('device_data').removeAttribute('disabled');
|
22 |
-
}
|
23 |
-
|
24 |
-
// Always attempt to update the card type on submission
|
25 |
-
if($$('[data-genebraintree-name="number"]').first() != undefined) {
|
26 |
-
vzero.updateCardType($$('[data-genebraintree-name="number"]').first().value);
|
27 |
-
}
|
28 |
-
|
29 |
-
// Run the original validation functions
|
30 |
-
if (this.validate() && this.loadWaiting == false) {
|
31 |
-
|
32 |
-
// Are we dealing with the credit card method?
|
33 |
-
if (payment.currentMethod == 'gene_braintree_creditcard') {
|
34 |
-
|
35 |
-
// Do we want to pass any extra paramters into the updateData request
|
36 |
-
var parameters = {};
|
37 |
-
|
38 |
-
// If the billing address is selected and we're wanting to ship to that address we need to pass the addressId
|
39 |
-
if($('billing-address-select') != undefined && $('billing-address-select').value != '')
|
40 |
-
{
|
41 |
-
parameters.addressId = $('billing-address-select').value;
|
42 |
-
}
|
43 |
-
|
44 |
-
// Update the data as we're in a one step
|
45 |
-
vzero.updateData(
|
46 |
-
function() {
|
47 |
-
|
48 |
-
// Verify we're not using a saved address
|
49 |
-
if($('billing-address-select') != undefined && $('billing-address-select').value == '' || $('billing-address-select') == undefined) {
|
50 |
-
|
51 |
-
// Grab these directly from the form and update
|
52 |
-
if ($('billing:firstname') != undefined && $('billing:lastname') != undefined) {
|
53 |
-
vzero.setBillingName($('billing:firstname').value + ' ' + $('billing:lastname').value);
|
54 |
-
}
|
55 |
-
if ($('billing:postcode') != undefined) {
|
56 |
-
vzero.setBillingPostcode($('billing:postcode').value);
|
57 |
-
}
|
58 |
-
}
|
59 |
-
|
60 |
-
// Show the loading
|
61 |
-
this.setLoadWaiting(true);
|
62 |
-
|
63 |
-
// Process the card
|
64 |
-
vzero.process({
|
65 |
-
onSuccess: function () {
|
66 |
-
|
67 |
-
// Disable the standard credit card form so the values don't get passed through to the checkout
|
68 |
-
$$('#credit-card-form input, #credit-card-form select').each(function (formElement) {
|
69 |
-
if (formElement.id != 'creditcard-payment-nonce' && formElement.getAttribute('data-genebraintree-name') != 'cvv' && formElement.id != 'gene_braintree_creditcard_store_in_vault') {
|
70 |
-
formElement.setAttribute('disabled', 'disabled');
|
71 |
-
}
|
72 |
-
});
|
73 |
-
|
74 |
-
if($('device_data')) {
|
75 |
-
// Always make sure device data is sent with the request
|
76 |
-
$('device_data').removeAttribute('disabled');
|
77 |
-
}
|
78 |
-
|
79 |
-
// We're no longer loading
|
80 |
-
this.setLoadWaiting(false);
|
81 |
-
|
82 |
-
// Fire the original event and return the response
|
83 |
-
completeCheckoutResponse = fireCheckoutSaveCheckout.apply(this, arguments);
|
84 |
-
|
85 |
-
// Re-enable any form elements which were disabled
|
86 |
-
$$('#credit-card-form input, #credit-card-form select').each(function (formElement) {
|
87 |
-
formElement.removeAttribute('disabled');
|
88 |
-
});
|
89 |
-
|
90 |
-
// Run the original function
|
91 |
-
return completeCheckoutResponse;
|
92 |
-
}.bind(this),
|
93 |
-
onFailure: function() {
|
94 |
-
|
95 |
-
// Reset the waiting for the parent function
|
96 |
-
this.setLoadWaiting(false);
|
97 |
-
|
98 |
-
}.bind(this)
|
99 |
-
});
|
100 |
-
|
101 |
-
}.bind(this),
|
102 |
-
parameters
|
103 |
-
);
|
104 |
-
|
105 |
-
// We're updating data don't do anything else for now
|
106 |
-
return false;
|
107 |
-
|
108 |
-
}
|
109 |
-
|
110 |
-
}
|
111 |
-
|
112 |
-
// Stop further processing
|
113 |
-
return fireCheckoutSaveCheckout.apply(this, arguments);
|
114 |
-
};
|
115 |
-
|
116 |
-
|
117 |
-
// It's not been ran so set it to false
|
118 |
-
var PayPalCompleteRan = false;
|
119 |
|
120 |
/**
|
121 |
-
*
|
|
|
122 |
*/
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
if (!PayPalCompleteRan) {
|
127 |
-
|
128 |
-
// Mark the flag as true
|
129 |
-
PayPalCompleteRan = true;
|
130 |
-
|
131 |
-
// Force check
|
132 |
-
payment.switchMethod('gene_braintree_paypal', true);
|
133 |
-
|
134 |
-
// Re-enable the form
|
135 |
-
$('paypal-payment-nonce').removeAttribute('disabled');
|
136 |
-
$('paypal-payment-nonce').value = obj.nonce;
|
137 |
-
|
138 |
-
if($('creditcard-payment-nonce') != null) {
|
139 |
-
// We have to disable the credit card one
|
140 |
-
$('creditcard-payment-nonce').setAttribute('disabled', 'disabled');
|
141 |
-
}
|
142 |
-
|
143 |
-
// Hide the button
|
144 |
-
hidePayPalButton();
|
145 |
-
|
146 |
-
// Always make sure device data is sent with the request
|
147 |
-
if ($('device_data') != undefined) {
|
148 |
-
$('device_data').removeAttribute('disabled');
|
149 |
-
}
|
150 |
-
|
151 |
-
// Submit the checkout
|
152 |
-
checkout.save();
|
153 |
-
return false;
|
154 |
-
|
155 |
-
}
|
156 |
-
|
157 |
-
};
|
158 |
-
|
159 |
-
// Flag to check if the PayPal button is already loading
|
160 |
-
var PayPalButtonLoading = false;
|
161 |
|
162 |
/**
|
163 |
-
*
|
164 |
*/
|
165 |
-
|
166 |
-
|
167 |
-
// Check we can locate the submit button
|
168 |
-
if ($$('#review-buttons-container .btn-checkout').first() != undefined && $('paypal-complete') == undefined && PayPalButtonLoading == false) {
|
169 |
-
|
170 |
-
// The button is loading
|
171 |
-
PayPalButtonLoading = true;
|
172 |
-
|
173 |
-
// Start the loading process
|
174 |
-
checkout.setLoadWaiting(true);
|
175 |
|
176 |
-
|
177 |
-
|
178 |
|
179 |
-
|
180 |
-
|
181 |
|
182 |
-
|
183 |
-
|
184 |
|
185 |
-
|
186 |
-
if (payment.currentMethod == 'gene_braintree_paypal' && $('paypal-complete') == undefined) {
|
187 |
|
188 |
-
|
189 |
-
|
|
|
190 |
|
191 |
-
|
192 |
-
|
|
|
|
|
193 |
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
$('paypal-complete').observe('click', function (event) {
|
199 |
-
|
200 |
-
// Validate the form like the parent method
|
201 |
-
if (!checkout.validate()) {
|
202 |
-
|
203 |
-
// Sadly we're unable to intercept the PayPal window in any other way then just hard closing it
|
204 |
-
vzeroPaypal.closePayPalWindow();
|
205 |
-
}
|
206 |
-
});
|
207 |
-
|
208 |
-
// Add in the PayPal button
|
209 |
-
vzeroPaypal.addPayPalButton({
|
210 |
-
onSuccess: completePayPal
|
211 |
-
});
|
212 |
-
}
|
213 |
-
|
214 |
-
});
|
215 |
-
|
216 |
-
} else if ($('paypal-complete') != undefined && PayPalButtonLoading == false) {
|
217 |
-
|
218 |
-
// The button is loading
|
219 |
-
PayPalButtonLoading = true;
|
220 |
-
|
221 |
-
// Start the loading process
|
222 |
-
checkout.setLoadWaiting(true);
|
223 |
-
|
224 |
-
// Update the data contained within the classes
|
225 |
-
vzero.updateData(function () {
|
226 |
-
|
227 |
-
// The button is no longer loading
|
228 |
-
PayPalButtonLoading = false;
|
229 |
-
|
230 |
-
// Cancel said loading process
|
231 |
-
checkout.setLoadWaiting(false);
|
232 |
-
|
233 |
-
// Validate the payment method is still correct
|
234 |
-
if (payment.currentMethod == 'gene_braintree_paypal') {
|
235 |
-
|
236 |
-
// Set the flag to false as we've created a new button
|
237 |
-
PayPalCompleteRan = false;
|
238 |
-
|
239 |
-
// Hide the submit button
|
240 |
-
$$('#review-buttons-container .btn-checkout').first().hide();
|
241 |
-
|
242 |
-
// Add in our PayPal button
|
243 |
-
$('paypal-complete').show();
|
244 |
-
}
|
245 |
-
|
246 |
-
});
|
247 |
|
248 |
-
}
|
249 |
|
250 |
-
}
|
251 |
|
252 |
/**
|
253 |
-
*
|
254 |
*/
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
checkout.setLoadWaiting(false);
|
259 |
-
|
260 |
-
// If the user has selected a different payment method make some modifications
|
261 |
-
if ($$('#review-buttons-container .btn-checkout').first() != undefined) {
|
262 |
-
$$('#review-buttons-container .btn-checkout').first().show();
|
263 |
-
}
|
264 |
-
|
265 |
-
// Remove the PayPal element
|
266 |
-
if ($('paypal-complete') != undefined) {
|
267 |
-
$('paypal-complete').hide();
|
268 |
-
}
|
269 |
-
|
270 |
-
};
|
271 |
-
|
272 |
-
// Check if the payment method is the default
|
273 |
-
if (payment != undefined) {
|
274 |
-
if ((payment.currentMethod == 'gene_braintree_paypal' && $('paypal-saved-accounts') == undefined) || ($$('#paypal-saved-accounts input:checked[type=radio]').first() != undefined && $$('#paypal-saved-accounts input:checked[type=radio]').first().value == 'other')) {
|
275 |
-
|
276 |
-
// Verify that vzero is defined before attempting to use it
|
277 |
-
if (typeof vzeroPaypal !== 'undefined') {
|
278 |
-
|
279 |
-
// Set the amount for the PayPal modal window
|
280 |
-
vzeroPaypal.setPricing('<?php echo Mage::getSingleton('checkout/cart')->getQuote()->collectTotals()->getGrandTotal(); ?>', '<?php echo Mage::getSingleton('checkout/cart')->getQuote()->getBaseCurrencyCode(); ?>');
|
281 |
-
}
|
282 |
-
|
283 |
-
addPayPalButton();
|
284 |
-
}
|
285 |
}
|
286 |
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
}
|
303 |
-
|
304 |
-
} else if(typeof skipOverride === 'undefined') {
|
305 |
-
hidePayPalButton();
|
306 |
-
}
|
307 |
-
|
308 |
-
|
309 |
-
// Run the original function
|
310 |
-
return paymentOriginal.apply(this, arguments);
|
311 |
-
|
312 |
-
};
|
313 |
-
|
314 |
-
// If we have any saved accounts we'll need to do something jammy
|
315 |
-
if ($$('#paypal-saved-accounts input[type=radio]').first() != undefined) {
|
316 |
-
|
317 |
-
// Loop through each radio button
|
318 |
-
$$('#paypal-saved-accounts input[type=radio]').each(function (savedAccount) {
|
319 |
-
|
320 |
-
// Observe them changing
|
321 |
-
Event.observe(savedAccount, 'click', function (ele) {
|
322 |
-
if (savedAccount.value == 'other') {
|
323 |
-
addPayPalButton();
|
324 |
-
} else {
|
325 |
-
hidePayPalButton();
|
326 |
-
}
|
327 |
-
});
|
328 |
-
});
|
329 |
}
|
|
|
330 |
|
331 |
-
|
332 |
-
vzero.close3dSecureMethod(function () {
|
333 |
-
|
334 |
-
// Re-tokenize all the saved cards
|
335 |
-
vzero.tokenize3dSavedCards(function () {
|
336 |
-
checkout.setLoadWaiting(false);
|
337 |
-
});
|
338 |
-
|
339 |
-
});
|
340 |
-
|
341 |
-
// Observe all Ajax requests for changes
|
342 |
-
vzero.observeAjaxRequests(function () {
|
343 |
-
|
344 |
-
// If the method is PayPal remove and re-add the PayPal button
|
345 |
-
if (payment.currentMethod == 'gene_braintree_paypal') {
|
346 |
-
hidePayPalButton();
|
347 |
-
addPayPalButton();
|
348 |
-
} else {
|
349 |
-
vzero.updateData();
|
350 |
-
}
|
351 |
-
|
352 |
-
});
|
353 |
-
}
|
354 |
-
</script>
|
355 |
-
<style type="text/css">
|
356 |
-
#braintree-paypal-loggedin {
|
357 |
-
display: none!important;
|
358 |
-
}
|
359 |
-
#braintree-paypal-loggedout {
|
360 |
-
display: block!important;
|
361 |
-
}
|
362 |
-
</style>
|
2 |
/**
|
3 |
* Add in support for Fire Checkout
|
4 |
* http://templates-master.com/magento-one-page-checkout.html
|
5 |
+
* @author Dave Macaulay <dave@gene.co.uk>
|
6 |
*/
|
7 |
?>
|
8 |
<!-- FIRECHECKOUT BRAINTREE SUPPORT -->
|
9 |
<script type="text/javascript">
|
10 |
|
11 |
+
vZeroIntegration.addMethods({
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
/**
|
14 |
+
* Validate the entire checkout
|
15 |
+
* Annoyingly IWD hasn't already wrapped this in a function
|
16 |
*/
|
17 |
+
validateAll: function() {
|
18 |
+
return checkout.validate();
|
19 |
+
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
/**
|
22 |
+
* Attach an observer to the submit action of the checkout to tokenize the card details
|
23 |
*/
|
24 |
+
prepareSubmitObserver: function() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
+
// Store a pointer to the vZero integration
|
27 |
+
var vzeroIntegration = this;
|
28 |
|
29 |
+
// Store the old complete checkout function
|
30 |
+
var _originalSave = FireCheckout.prototype.save;
|
31 |
|
32 |
+
// Re-define the original method so we can do some jazz with it
|
33 |
+
FireCheckout.prototype.save = function () {
|
34 |
|
35 |
+
if (vzeroIntegration.shouldInterceptSubmit('creditcard')) {
|
|
|
36 |
|
37 |
+
// Store a pointer to the payment class
|
38 |
+
var paymentThis = this;
|
39 |
+
var paymentArguments = arguments;
|
40 |
|
41 |
+
// If everything was a success on the checkout end, let's submit the vZero integration
|
42 |
+
vzeroIntegration.submit('creditcard', function () {
|
43 |
+
return _originalSave.apply(paymentThis, paymentArguments);
|
44 |
+
});
|
45 |
|
46 |
+
} else {
|
47 |
+
// If not run the original code
|
48 |
+
return _originalSave.apply(this, arguments);
|
49 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
+
};
|
52 |
|
53 |
+
},
|
54 |
|
55 |
/**
|
56 |
+
* The action to run after the PayPal action has been completed
|
57 |
*/
|
58 |
+
submitCheckout: function() {
|
59 |
+
// Run the original checkouts submit action
|
60 |
+
return checkout.save();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
}
|
62 |
|
63 |
+
});
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Start a new instance of our integration
|
67 |
+
*
|
68 |
+
* @type {vZeroIntegration}
|
69 |
+
*/
|
70 |
+
new vZeroIntegration(
|
71 |
+
(window.vzero || false),
|
72 |
+
(window.vzeroPaypal || false),
|
73 |
+
'<div id="paypal-complete"><div id="paypal-container"></div><label id="paypal-label"><?php echo $this->__('Complete checkout with'); ?> </label></div>',
|
74 |
+
'#review-buttons-container .btn-checkout',
|
75 |
+
true,
|
76 |
+
{
|
77 |
+
ignoreAjax: ['firecheckout/index/saveOrder']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
}
|
79 |
+
);
|
80 |
|
81 |
+
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/gene/braintree/js/idev.phtml
CHANGED
@@ -7,143 +7,22 @@
|
|
7 |
<!-- IDEV BRAINTREE SUPPORT -->
|
8 |
<script type="text/javascript">
|
9 |
|
10 |
-
|
11 |
-
if(iDevInit === undefined) {
|
12 |
-
|
13 |
-
// Set our flag that we've ran the init for this checkout
|
14 |
-
var iDevInit = true;
|
15 |
-
|
16 |
-
// Flag to skip over our interception if needed
|
17 |
-
var processedVZero = false;
|
18 |
-
|
19 |
-
// Hook onto the event that submits the entire form
|
20 |
-
// Apparently there may be more than one of these buttons
|
21 |
-
$$('.onestepcheckout-place-order').each(function (elem) {
|
22 |
-
|
23 |
-
// Observe the click event
|
24 |
-
elem.observe('click', function (e) {
|
25 |
-
|
26 |
-
// Device data should never be disabled
|
27 |
-
if ($('device_data') != undefined) {
|
28 |
-
$('device_data').removeAttribute('disabled');
|
29 |
-
}
|
30 |
-
|
31 |
-
// Check to see if we've already processed the form?
|
32 |
-
if (!processedVZero) {
|
33 |
-
|
34 |
-
// Always attempt to update the card type on submission
|
35 |
-
if ($$('[data-genebraintree-name="number"]').first() != undefined) {
|
36 |
-
vzero.updateCardType($$('[data-genebraintree-name="number"]').first().value);
|
37 |
-
}
|
38 |
-
|
39 |
-
// First validate the form
|
40 |
-
var form = new VarienForm('onestepcheckout-form');
|
41 |
-
|
42 |
-
// Validate the form like the parent method
|
43 |
-
if (!form.validator.validate()) {
|
44 |
-
|
45 |
-
// We want to stop any further events
|
46 |
-
Event.stop(e);
|
47 |
-
|
48 |
-
} else {
|
49 |
-
|
50 |
-
// Are we dealing with the credit card method?
|
51 |
-
if (payment.currentMethod == 'gene_braintree_creditcard') {
|
52 |
-
|
53 |
-
// Set this flag to stop the other function from firing
|
54 |
-
already_placing_order = true;
|
55 |
-
|
56 |
-
startLoading();
|
57 |
-
|
58 |
-
// Do we want to pass any extra paramters into the updateData request
|
59 |
-
var parameters = {};
|
60 |
-
|
61 |
-
// If the billing address is selected and we're wanting to ship to that address we need to pass the addressId
|
62 |
-
if ($('billing-address-select') != undefined && $('billing-address-select').value != '') {
|
63 |
-
parameters.addressId = $('billing-address-select').value;
|
64 |
-
}
|
65 |
-
|
66 |
-
// Update the data as we're in a one step
|
67 |
-
vzero.updateData(
|
68 |
-
function () {
|
69 |
-
|
70 |
-
// Verify we're not using a saved address
|
71 |
-
if ($('billing-address-select') != undefined && $('billing-address-select').value == '' || $('billing-address-select') == undefined) {
|
72 |
-
|
73 |
-
// Grab these directly from the form and update
|
74 |
-
if ($('billing:firstname') != undefined && $('billing:lastname') != undefined) {
|
75 |
-
vzero.setBillingName($('billing:firstname').value + ' ' + $('billing:lastname').value);
|
76 |
-
}
|
77 |
-
if ($('billing:postcode') != undefined) {
|
78 |
-
vzero.setBillingPostcode($('billing:postcode').value);
|
79 |
-
}
|
80 |
-
|
81 |
-
}
|
82 |
-
|
83 |
-
// Process the card
|
84 |
-
vzero.process({
|
85 |
-
onSuccess: function () {
|
86 |
-
|
87 |
-
// Disable the standard credit card form so the values don't get passed through to the checkout
|
88 |
-
$$('#credit-card-form input, #credit-card-form select').each(function (formElement) {
|
89 |
-
if (formElement.id != 'creditcard-payment-nonce' && formElement.getAttribute('data-genebraintree-name') != 'cvv' && formElement.id != 'gene_braintree_creditcard_store_in_vault') {
|
90 |
-
formElement.setAttribute('disabled', 'disabled');
|
91 |
-
}
|
92 |
-
});
|
93 |
-
|
94 |
-
stopLoading();
|
95 |
-
|
96 |
-
// Always make sure device data is sent with the request
|
97 |
-
if ($('device_data') != undefined) {
|
98 |
-
$('device_data').removeAttribute('disabled');
|
99 |
-
}
|
100 |
-
|
101 |
-
// As onestepcheckout.com doesn't disable other payment forms (yeah I know, annoying) disable our PayPal nonce if it exists
|
102 |
-
if($('paypal-payment-nonce') != undefined) {
|
103 |
-
$('paypal-payment-nonce').setAttribute('disabled', 'disabled');
|
104 |
-
}
|
105 |
-
|
106 |
-
// Set the flag to true
|
107 |
-
processedVZero = true;
|
108 |
-
|
109 |
-
// We're no longer stopping the events
|
110 |
-
already_placing_order = false;
|
111 |
-
|
112 |
-
// Fire the same event over again
|
113 |
-
$(elem).click();
|
114 |
-
},
|
115 |
-
onFailure: function () {
|
116 |
-
|
117 |
-
// Set the flag to true
|
118 |
-
processedVZero = false;
|
119 |
-
|
120 |
-
stopLoading();
|
121 |
-
|
122 |
-
// We're no longer stopping the events
|
123 |
-
already_placing_order = false;
|
124 |
-
|
125 |
-
}
|
126 |
-
});
|
127 |
-
},
|
128 |
-
parameters
|
129 |
-
);
|
130 |
-
|
131 |
-
}
|
132 |
-
}
|
133 |
-
|
134 |
-
}
|
135 |
-
|
136 |
-
});
|
137 |
-
});
|
138 |
-
|
139 |
-
// It's not been ran so set it to false
|
140 |
-
var PayPalCompleteRan = false;
|
141 |
|
142 |
/**
|
143 |
-
*
|
144 |
-
|
145 |
-
|
|
|
|
|
|
|
|
|
|
|
146 |
|
|
|
|
|
|
|
|
|
147 |
var submitElement = $('onestepcheckout-place-order');
|
148 |
|
149 |
/* Disable button to avoid multiple clicks */
|
@@ -151,23 +30,15 @@
|
|
151 |
submitElement.disabled = true;
|
152 |
|
153 |
// Add in our loader event
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
if (noMessage != true) {
|
158 |
-
loaderElement.update('<?php echo $this->__('Please wait, processing your order...'); ?>');
|
159 |
}
|
160 |
-
|
161 |
-
// Append it into the correct area
|
162 |
-
submitElement.parentNode.appendChild(loaderElement);
|
163 |
-
|
164 |
-
};
|
165 |
|
166 |
/**
|
167 |
-
*
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
// Grab the submit button
|
172 |
submitElement = $('onestepcheckout-place-order');
|
173 |
|
@@ -176,263 +47,62 @@
|
|
176 |
submitElement.removeAttribute('disabled');
|
177 |
|
178 |
// Remove the loader element
|
179 |
-
if (
|
180 |
-
|
181 |
}
|
182 |
-
|
183 |
-
};
|
184 |
|
185 |
/**
|
186 |
-
*
|
187 |
*/
|
188 |
-
|
189 |
|
190 |
-
//
|
191 |
-
|
192 |
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
// Force check
|
197 |
-
payment.switchMethod('gene_braintree_paypal', true);
|
198 |
-
|
199 |
-
// Re-enable the form
|
200 |
-
$('paypal-payment-nonce').removeAttribute('disabled');
|
201 |
-
$('paypal-payment-nonce').value = obj.nonce;
|
202 |
|
203 |
-
if(
|
204 |
-
// We have to disable the credit card one
|
205 |
-
$('creditcard-payment-nonce').setAttribute('disabled', 'disabled');
|
206 |
-
}
|
207 |
|
208 |
-
|
209 |
-
|
|
|
|
|
210 |
|
211 |
-
|
212 |
-
|
213 |
-
$('device_data').removeAttribute('disabled');
|
214 |
}
|
215 |
|
216 |
-
|
217 |
-
$$('.onestepcheckout-place-order').first().click();
|
218 |
-
|
219 |
-
}
|
220 |
-
|
221 |
-
};
|
222 |
|
223 |
-
|
224 |
-
var PayPalButtonLoading = false;
|
225 |
|
226 |
/**
|
227 |
-
*
|
228 |
*/
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
if ($('onestepcheckout-place-order') != undefined && $('paypal-complete') == undefined && PayPalButtonLoading == false) {
|
233 |
-
|
234 |
-
// The button is loading
|
235 |
-
PayPalButtonLoading = true;
|
236 |
-
|
237 |
-
// Start the loading process
|
238 |
-
startLoading(true);
|
239 |
-
|
240 |
-
// Update the data contained within the classes
|
241 |
-
vzero.updateData(function () {
|
242 |
-
|
243 |
-
// Cancel said loading process
|
244 |
-
stopLoading();
|
245 |
-
|
246 |
-
// The button is no longer loading
|
247 |
-
PayPalButtonLoading = false;
|
248 |
-
|
249 |
-
// Validate the payment method is still correct
|
250 |
-
if (payment.currentMethod == 'gene_braintree_paypal' && $('paypal-complete') == undefined) {
|
251 |
-
|
252 |
-
// Set the flag to false as we've created a new button
|
253 |
-
PayPalCompleteRan = false;
|
254 |
-
|
255 |
-
// Hide the submit button
|
256 |
-
$('onestepcheckout-place-order').hide();
|
257 |
-
|
258 |
-
// Add in our PayPal button
|
259 |
-
$('onestepcheckout-place-order').up().insert('<div id="paypal-complete"><div id="paypal-container"></div><label id="paypal-label"><?php echo $this->__('Complete checkout with'); ?> </label></div>');
|
260 |
-
|
261 |
-
// Always stop the window from opening
|
262 |
-
$('paypal-complete').observe('click', function (event) {
|
263 |
-
|
264 |
-
// First validate the form
|
265 |
-
var form = new VarienForm('onestepcheckout-form');
|
266 |
-
|
267 |
-
// Validate the form like the parent method
|
268 |
-
if (!form.validator.validate()) {
|
269 |
-
|
270 |
-
// Sadly we're unable to intercept the PayPal window in any other way then just hard closing it
|
271 |
-
vzeroPaypal.closePayPalWindow();
|
272 |
-
}
|
273 |
-
});
|
274 |
-
|
275 |
-
// Add in the PayPal button
|
276 |
-
vzeroPaypal.addPayPalButton({
|
277 |
-
onSuccess: completePayPal
|
278 |
-
});
|
279 |
-
}
|
280 |
-
|
281 |
-
});
|
282 |
-
|
283 |
-
} else if ($('paypal-complete') != undefined && PayPalButtonLoading == false) {
|
284 |
-
|
285 |
-
// The button is loading
|
286 |
-
PayPalButtonLoading = true;
|
287 |
-
|
288 |
-
// Start the loading process
|
289 |
-
startLoading(true);
|
290 |
-
|
291 |
-
// Update the data contained within the classes
|
292 |
-
vzero.updateData(function () {
|
293 |
-
|
294 |
-
// The button is no longer loading
|
295 |
-
PayPalButtonLoading = false;
|
296 |
-
|
297 |
-
// Cancel said loading process
|
298 |
-
stopLoading();
|
299 |
-
|
300 |
-
// Validate the payment method is still correct
|
301 |
-
if (payment.currentMethod == 'gene_braintree_paypal') {
|
302 |
-
|
303 |
-
// Set the flag to false as we've created a new button
|
304 |
-
PayPalCompleteRan = false;
|
305 |
-
|
306 |
-
// Hide the submit button
|
307 |
-
$('onestepcheckout-place-order').hide();
|
308 |
-
|
309 |
-
// Add in our PayPal button
|
310 |
-
$('paypal-complete').show();
|
311 |
-
}
|
312 |
-
|
313 |
-
});
|
314 |
-
|
315 |
-
}
|
316 |
-
|
317 |
-
};
|
318 |
-
|
319 |
-
/**
|
320 |
-
* As we need to remove the PayPal button in multiple places
|
321 |
-
*/
|
322 |
-
hidePayPalButton = function () {
|
323 |
-
|
324 |
-
// Just in case things are still loading
|
325 |
-
stopLoading();
|
326 |
-
|
327 |
-
// If the user has selected a different payment method make some modifications
|
328 |
-
if ($('onestepcheckout-place-order') != undefined) {
|
329 |
-
$('onestepcheckout-place-order').show();
|
330 |
-
}
|
331 |
-
|
332 |
-
// Remove the PayPal element
|
333 |
-
if ($('paypal-complete') != undefined) {
|
334 |
-
$('paypal-complete').hide();
|
335 |
-
}
|
336 |
-
|
337 |
-
};
|
338 |
-
|
339 |
-
// Check if the payment method is the default
|
340 |
-
if (payment != undefined) {
|
341 |
-
if ((payment.currentMethod == 'gene_braintree_paypal' && $('paypal-saved-accounts') == undefined) || ($$('#paypal-saved-accounts input:checked[type=radio]').first() != undefined && $$('#paypal-saved-accounts input:checked[type=radio]').first().value == 'other')) {
|
342 |
-
|
343 |
-
// Verify that vzero is defined before attempting to use it
|
344 |
-
if (typeof vzeroPaypal !== 'undefined') {
|
345 |
-
|
346 |
-
// Set the amount for the PayPal modal window
|
347 |
-
vzeroPaypal.setPricing('<?php echo Mage::getSingleton('checkout/cart')->getQuote()->collectTotals()->getGrandTotal(); ?>', '<?php echo Mage::getSingleton('checkout/cart')->getQuote()->getBaseCurrencyCode(); ?>');
|
348 |
-
}
|
349 |
-
|
350 |
-
addPayPalButton();
|
351 |
-
}
|
352 |
}
|
353 |
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
}
|
370 |
-
|
371 |
-
} else if(typeof skipOverride === 'undefined') {
|
372 |
-
hidePayPalButton();
|
373 |
-
}
|
374 |
-
|
375 |
-
|
376 |
-
// Run the original function
|
377 |
-
return paymentOriginal.apply(this, arguments);
|
378 |
-
|
379 |
-
};
|
380 |
-
|
381 |
-
// If we have any saved accounts we'll need to do something jammy
|
382 |
-
if ($$('#paypal-saved-accounts input[type=radio]').first() != undefined) {
|
383 |
-
|
384 |
-
// Loop through each radio button
|
385 |
-
$$('#paypal-saved-accounts input[type=radio]').each(function (savedAccount) {
|
386 |
-
|
387 |
-
// Observe them changing
|
388 |
-
Event.observe(savedAccount, 'click', function (ele) {
|
389 |
-
if (savedAccount.value == 'other') {
|
390 |
-
addPayPalButton();
|
391 |
-
} else {
|
392 |
-
hidePayPalButton();
|
393 |
-
}
|
394 |
-
});
|
395 |
-
});
|
396 |
}
|
|
|
397 |
|
398 |
-
|
399 |
-
vzero.close3dSecureMethod(function () {
|
400 |
-
|
401 |
-
// Re-tokenize all the saved cards
|
402 |
-
vzero.tokenize3dSavedCards(function () {
|
403 |
-
stopLoading();
|
404 |
-
});
|
405 |
-
|
406 |
-
});
|
407 |
-
|
408 |
-
// Observe all Ajax requests for changes
|
409 |
-
vzero.observeAjaxRequests(function () {
|
410 |
-
|
411 |
-
// The iDev checkout has a check_email option which can break our system
|
412 |
-
if(transport.url && transport.url.indexOf('check_email') == -1) {
|
413 |
-
|
414 |
-
// If the method is PayPal remove and re-add the PayPal button
|
415 |
-
if (payment.currentMethod == 'gene_braintree_paypal') {
|
416 |
-
hidePayPalButton();
|
417 |
-
addPayPalButton();
|
418 |
-
} else {
|
419 |
-
vzero.updateData();
|
420 |
-
}
|
421 |
-
|
422 |
-
}
|
423 |
-
|
424 |
-
});
|
425 |
-
|
426 |
-
}
|
427 |
-
|
428 |
-
</script>
|
429 |
-
|
430 |
-
<!-- Fix some minor styling issues with our nested form-list -->
|
431 |
-
<style type="text/css">
|
432 |
-
#braintree-paypal-loggedin {
|
433 |
-
display: none!important;
|
434 |
-
}
|
435 |
-
#braintree-paypal-loggedout {
|
436 |
-
display: block!important;
|
437 |
-
}
|
438 |
-
</style>
|
7 |
<!-- IDEV BRAINTREE SUPPORT -->
|
8 |
<script type="text/javascript">
|
9 |
|
10 |
+
vZeroIntegration.addMethods({
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
/**
|
13 |
+
* Validate the entire checkout
|
14 |
+
* Annoyingly IWD hasn't already wrapped this in a function
|
15 |
+
*/
|
16 |
+
validateAll: function() {
|
17 |
+
// First validate the form
|
18 |
+
var form = new VarienForm('onestepcheckout-form');
|
19 |
+
return form.validator.validate();
|
20 |
+
},
|
21 |
|
22 |
+
/**
|
23 |
+
* Activate the loading state of this checkout
|
24 |
+
*/
|
25 |
+
setLoading: function() {
|
26 |
var submitElement = $('onestepcheckout-place-order');
|
27 |
|
28 |
/* Disable button to avoid multiple clicks */
|
30 |
submitElement.disabled = true;
|
31 |
|
32 |
// Add in our loader event
|
33 |
+
if ($$('.onestepcheckout-place-order-loading').first() !== undefined) {
|
34 |
+
$$('.onestepcheckout-place-order-loading').first().show();
|
|
|
|
|
|
|
35 |
}
|
36 |
+
},
|
|
|
|
|
|
|
|
|
37 |
|
38 |
/**
|
39 |
+
* Reset the loading state of the checkout
|
40 |
+
*/
|
41 |
+
resetLoading: function() {
|
|
|
42 |
// Grab the submit button
|
43 |
submitElement = $('onestepcheckout-place-order');
|
44 |
|
47 |
submitElement.removeAttribute('disabled');
|
48 |
|
49 |
// Remove the loader element
|
50 |
+
if ($$('.onestepcheckout-place-order-loading').first() !== undefined) {
|
51 |
+
$$('.onestepcheckout-place-order-loading').first().hide();
|
52 |
}
|
53 |
+
},
|
|
|
54 |
|
55 |
/**
|
56 |
+
* Attach an observer to the submit action of the checkout to tokenize the card details
|
57 |
*/
|
58 |
+
prepareSubmitObserver: function() {
|
59 |
|
60 |
+
// Store a pointer to the vZero integration
|
61 |
+
var vzeroIntegration = this;
|
62 |
|
63 |
+
// Observe the click event
|
64 |
+
var _originalSubmitEvent = $('onestepcheckout-form').submit;
|
65 |
+
$('onestepcheckout-form').submit = function() {
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
|
67 |
+
if (vzeroIntegration.shouldInterceptSubmit('creditcard')) {
|
|
|
|
|
|
|
68 |
|
69 |
+
// If everything was a success on the checkout end, let's submit the vZero integration
|
70 |
+
vzeroIntegration.submit('creditcard', function () {
|
71 |
+
return _originalSubmitEvent.call($('onestepcheckout-form'), arguments);
|
72 |
+
});
|
73 |
|
74 |
+
} else {
|
75 |
+
return _originalSubmitEvent.call($('onestepcheckout-form'), arguments);
|
|
|
76 |
}
|
77 |
|
78 |
+
};
|
|
|
|
|
|
|
|
|
|
|
79 |
|
80 |
+
},
|
|
|
81 |
|
82 |
/**
|
83 |
+
* The action to run after the PayPal action has been completed
|
84 |
*/
|
85 |
+
submitCheckout: function() {
|
86 |
+
// Submit the checkout
|
87 |
+
$$('#onestepcheckout-place-order').first().click();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
}
|
89 |
|
90 |
+
});
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Start a new instance of our integration
|
94 |
+
*
|
95 |
+
* @type {vZeroIntegration}
|
96 |
+
*/
|
97 |
+
new vZeroIntegration(
|
98 |
+
(window.vzero || false),
|
99 |
+
(window.vzeroPaypal || false),
|
100 |
+
'<div id="paypal-complete"><div id="paypal-container"></div><label id="paypal-label"><?php echo $this->__('Complete checkout with'); ?> </label></div>',
|
101 |
+
'#onestepcheckout-place-order',
|
102 |
+
true,
|
103 |
+
{
|
104 |
+
ignoreAjax: ['check_email']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
}
|
106 |
+
);
|
107 |
|
108 |
+
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/gene/braintree/js/iwd.phtml
CHANGED
@@ -2,406 +2,190 @@
|
|
2 |
/**
|
3 |
* Add in support for IWD One Step Checkout
|
4 |
* https://www.iwdagency.com/extensions/one-step-page-checkout.html
|
|
|
5 |
*/
|
6 |
?>
|
7 |
<!-- IWD BRAINTREE SUPPORT -->
|
8 |
<script type="text/javascript">
|
9 |
|
10 |
-
//
|
11 |
-
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
// Are we actually trying to save the order?
|
21 |
-
if (IWD.OPC.saveOrderStatus === true){
|
22 |
-
|
23 |
-
// The original IWD checkout runs these various functions in the payment response
|
24 |
-
IWD.OPC.Checkout.xhr = null;
|
25 |
-
IWD.OPC.agreements = $j('#checkout-agreements').serializeArray();
|
26 |
-
IWD.OPC.getSubscribe();
|
27 |
-
|
28 |
-
// Save the order
|
29 |
-
IWD.OPC.saveOrder();
|
30 |
-
}
|
31 |
-
|
32 |
-
return false;
|
33 |
-
}
|
34 |
-
|
35 |
-
// Run the original method
|
36 |
-
return iwdOriginalSavePayment.apply(this, arguments);
|
37 |
-
|
38 |
-
};
|
39 |
-
|
40 |
-
// Intercept the save order to process the credit card
|
41 |
-
var iwdOriginalSaveOrder = IWD.OPC.saveOrder;
|
42 |
-
IWD.OPC.saveOrder = function() {
|
43 |
-
|
44 |
-
if ($('device_data')) {
|
45 |
-
// Device data should never be disabled
|
46 |
-
$('device_data').removeAttribute('disabled');
|
47 |
-
}
|
48 |
|
49 |
-
|
50 |
-
|
51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
}
|
|
|
|
|
53 |
|
54 |
-
|
55 |
-
if (payment.currentMethod == 'gene_braintree_creditcard') {
|
56 |
-
|
57 |
-
// Do we want to pass any extra paramters into the updateData request
|
58 |
-
var parameters = {};
|
59 |
-
|
60 |
-
// If the billing address is selected and we're wanting to ship to that address we need to pass the addressId
|
61 |
-
if ($('billing-address-select') != undefined && $('billing-address-select').value != '') {
|
62 |
-
parameters.addressId = $('billing-address-select').value;
|
63 |
-
}
|
64 |
-
|
65 |
-
// Update the data as we're in a one step
|
66 |
-
vzero.updateData(
|
67 |
-
function () {
|
68 |
-
|
69 |
-
// Verify we're not using a saved address
|
70 |
-
if ($('billing-address-select') != undefined && $('billing-address-select').value == '' || $('billing-address-select') == undefined) {
|
71 |
-
|
72 |
-
// Grab these directly from the form and update
|
73 |
-
if ($('billing:firstname') != undefined && $('billing:lastname') != undefined) {
|
74 |
-
vzero.setBillingName($('billing:firstname').value + ' ' + $('billing:lastname').value);
|
75 |
-
}
|
76 |
-
if ($('billing:postcode') != undefined) {
|
77 |
-
vzero.setBillingPostcode($('billing:postcode').value);
|
78 |
-
}
|
79 |
-
}
|
80 |
-
|
81 |
-
// Check is running
|
82 |
-
checkoutRunning = true;
|
83 |
-
|
84 |
-
// Show the loading
|
85 |
-
IWD.OPC.Checkout.showLoader();
|
86 |
-
|
87 |
-
// Process the card
|
88 |
-
vzero.process({
|
89 |
-
onSuccess: function () {
|
90 |
-
|
91 |
-
// Disable the standard credit card form so the values don't get passed through to the checkout
|
92 |
-
$$('#credit-card-form input, #credit-card-form select').each(function (formElement) {
|
93 |
-
if (formElement.id != 'creditcard-payment-nonce' && formElement.getAttribute('data-genebraintree-name') != 'cvv' && formElement.id != 'gene_braintree_creditcard_store_in_vault') {
|
94 |
-
formElement.setAttribute('disabled', 'disabled');
|
95 |
-
}
|
96 |
-
});
|
97 |
-
|
98 |
-
if ($('device_data')) {
|
99 |
-
// Always make sure device data is sent with the request
|
100 |
-
$('device_data').removeAttribute('disabled');
|
101 |
-
}
|
102 |
-
|
103 |
-
// Fire the original event and return the response
|
104 |
-
completeCheckoutResponse = iwdOriginalSaveOrder.apply(this, arguments);
|
105 |
-
|
106 |
-
// Re-enable any form elements which were disabled
|
107 |
-
$$('#credit-card-form input, #credit-card-form select').each(function (formElement) {
|
108 |
-
formElement.removeAttribute('disabled');
|
109 |
-
});
|
110 |
-
|
111 |
-
return completeCheckoutResponse;
|
112 |
-
|
113 |
-
}.bind(this),
|
114 |
-
onFailure: function () {
|
115 |
-
IWD.OPC.Checkout.hideLoader();
|
116 |
-
IWD.OPC.Checkout.unlockPlaceOrder();
|
117 |
-
}
|
118 |
-
});
|
119 |
-
|
120 |
-
}.bind(this),
|
121 |
-
parameters
|
122 |
-
);
|
123 |
-
|
124 |
-
// We're updating data don't do anything else for now
|
125 |
-
return false;
|
126 |
-
}
|
127 |
-
|
128 |
-
return iwdOriginalSaveOrder.apply(this, arguments);
|
129 |
-
};
|
130 |
-
|
131 |
-
// For some annoying reason IWD doesn't provide a function to validate the entirity of the form
|
132 |
-
IWD.OPC.validateAll = function() {
|
133 |
|
|
|
|
|
|
|
|
|
|
|
134 |
var addressForm = new VarienForm('opc-address-form-billing');
|
135 |
if (!addressForm.validator.validate()){
|
136 |
return false;
|
137 |
}
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
if (!addressForm.validator.validate()){
|
142 |
return false;
|
143 |
}
|
144 |
}
|
145 |
-
|
|
|
|
|
|
|
|
|
|
|
146 |
return true;
|
147 |
-
}
|
148 |
-
|
149 |
-
// It's not been ran so set it to false
|
150 |
-
var PayPalCompleteRan = false;
|
151 |
|
152 |
/**
|
153 |
-
*
|
154 |
*/
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
// Mark the flag as true
|
161 |
-
PayPalCompleteRan = true;
|
162 |
-
|
163 |
-
// Force check
|
164 |
-
payment.switchMethod('gene_braintree_paypal', true);
|
165 |
-
|
166 |
-
// Re-enable the form
|
167 |
-
$('paypal-payment-nonce').removeAttribute('disabled');
|
168 |
-
$('paypal-payment-nonce').value = obj.nonce;
|
169 |
-
|
170 |
-
// Show the button again
|
171 |
-
hidePayPalButton();
|
172 |
-
|
173 |
-
// No longer running
|
174 |
-
checkoutRunning = false;
|
175 |
-
|
176 |
-
// Show the loading thing
|
177 |
-
IWD.OPC.Checkout.showLoader();
|
178 |
-
|
179 |
-
if ($('device_data')) {
|
180 |
-
// Always make sure device data is sent with the request
|
181 |
-
$('device_data').removeAttribute('disabled');
|
182 |
-
}
|
183 |
-
|
184 |
-
// Run the complete checkout method
|
185 |
-
$j_opc('.opc-btn-checkout').click();
|
186 |
-
|
187 |
-
}
|
188 |
-
|
189 |
-
};
|
190 |
-
|
191 |
-
// Flag to check if the PayPal button is already loading
|
192 |
-
var PayPalButtonLoading = false;
|
193 |
|
194 |
/**
|
195 |
-
*
|
196 |
*/
|
197 |
-
|
198 |
-
|
199 |
-
//
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
PayPalButtonLoading = true;
|
204 |
-
|
205 |
-
// As the PayPal button has to request data from the server show the loader
|
206 |
-
IWD.OPC.Checkout.showLoader();
|
207 |
-
|
208 |
-
// Update the data contained within the classes
|
209 |
-
vzero.updateData(function () {
|
210 |
-
|
211 |
-
// The button is no longer loading
|
212 |
-
PayPalButtonLoading = false;
|
213 |
-
|
214 |
-
// Hide it once we're done
|
215 |
-
IWD.OPC.Checkout.hideLoader();
|
216 |
-
IWD.OPC.Checkout.unlockPlaceOrder();
|
217 |
-
|
218 |
-
// Validate the payment method is still correct
|
219 |
-
if (payment.currentMethod == 'gene_braintree_paypal' && $('paypal-complete') == undefined) {
|
220 |
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
$$('.opc-btn-checkout').first().hide();
|
226 |
|
227 |
-
|
228 |
-
|
229 |
|
230 |
-
|
231 |
-
|
232 |
|
233 |
-
|
234 |
-
|
235 |
|
236 |
-
|
237 |
-
|
238 |
-
}
|
239 |
-
});
|
240 |
|
241 |
-
//
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
|
|
|
|
|
246 |
}
|
247 |
|
248 |
-
|
|
|
249 |
|
250 |
-
|
|
|
|
|
|
|
251 |
|
252 |
-
//
|
253 |
-
|
254 |
|
255 |
-
|
256 |
-
IWD.OPC.Checkout.showLoader();
|
257 |
|
258 |
-
|
259 |
-
|
|
|
260 |
|
261 |
-
|
262 |
-
PayPalButtonLoading = false;
|
263 |
|
264 |
-
//
|
265 |
-
|
266 |
-
|
267 |
|
268 |
-
//
|
269 |
-
|
|
|
|
|
270 |
|
271 |
-
|
272 |
-
|
|
|
|
|
273 |
|
274 |
-
|
275 |
-
$$('.opc-btn-checkout').first().hide();
|
276 |
|
277 |
-
|
278 |
-
|
|
|
279 |
|
280 |
-
|
281 |
|
282 |
-
|
|
|
283 |
|
284 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
285 |
|
286 |
-
}
|
287 |
|
288 |
/**
|
289 |
-
*
|
290 |
*/
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
if ($$('.opc-btn-checkout').first() != undefined) {
|
295 |
-
$$('.opc-btn-checkout').first().show();
|
296 |
-
}
|
297 |
-
|
298 |
-
// Remove the PayPal element
|
299 |
-
if ($('paypal-complete') != undefined) {
|
300 |
-
$('paypal-complete').hide();
|
301 |
-
}
|
302 |
-
|
303 |
-
};
|
304 |
-
|
305 |
-
// Check if the payment method is the default
|
306 |
-
if (payment !== undefined) {
|
307 |
-
if ((payment.currentMethod == 'gene_braintree_paypal' && $('paypal-saved-accounts') == undefined) || ($$('#paypal-saved-accounts input:checked[type=radio]').first() != undefined && $$('#paypal-saved-accounts input:checked[type=radio]').first().value == 'other')) {
|
308 |
-
|
309 |
-
// Verify that vzero is defined before attempting to use it
|
310 |
-
if (typeof vzeroPaypal !== 'undefined') {
|
311 |
-
|
312 |
-
// Always set the amount as it's needed within 3D secure requests
|
313 |
-
vzeroPaypal.setPricing('<?php echo Mage::getSingleton('checkout/cart')->getQuote()->collectTotals()->getGrandTotal(); ?>', '<?php echo Mage::getSingleton('checkout/cart')->getQuote()->getBaseCurrencyCode(); ?>');
|
314 |
-
}
|
315 |
-
|
316 |
-
addPayPalButton();
|
317 |
-
}
|
318 |
}
|
319 |
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
} else if(typeof skipOverride === 'undefined') {
|
341 |
-
hidePayPalButton();
|
342 |
-
}
|
343 |
-
}
|
344 |
-
|
345 |
-
|
346 |
-
// Run the original function
|
347 |
-
return paymentOriginal.apply(this, arguments);
|
348 |
-
|
349 |
-
};
|
350 |
-
|
351 |
-
// If we have any saved accounts we'll need to do something jammy
|
352 |
-
if ($$('#paypal-saved-accounts input[type=radio]').first() != undefined) {
|
353 |
-
|
354 |
-
// Loop through each radio button
|
355 |
-
$$('#paypal-saved-accounts input[type=radio]').each(function (savedAccount) {
|
356 |
-
|
357 |
-
// Observe them changing
|
358 |
-
Event.observe(savedAccount, 'click', function (ele) {
|
359 |
-
if (savedAccount.value == 'other') {
|
360 |
-
addPayPalButton();
|
361 |
-
} else {
|
362 |
-
hidePayPalButton();
|
363 |
-
}
|
364 |
-
});
|
365 |
-
});
|
366 |
}
|
|
|
367 |
|
368 |
-
|
369 |
-
vzero.close3dSecureMethod(function () {
|
370 |
-
|
371 |
-
// Re-tokenize all the saved cards
|
372 |
-
vzero.tokenize3dSavedCards(function () {
|
373 |
-
|
374 |
-
// Hide the loading
|
375 |
-
IWD.OPC.Checkout.hideLoader();
|
376 |
-
IWD.OPC.Checkout.unlockPlaceOrder();
|
377 |
-
|
378 |
-
});
|
379 |
-
|
380 |
-
});
|
381 |
-
|
382 |
-
// Observe the card type here as it'll fail within creditCard.phtml
|
383 |
-
vzero.observeCardType();
|
384 |
-
|
385 |
-
// Observe all Ajax requests for changes
|
386 |
-
vzero.observeAjaxRequests(function () {
|
387 |
-
|
388 |
-
// If the method is PayPal remove and re-add the PayPal button
|
389 |
-
if (payment.currentMethod == 'gene_braintree_paypal') {
|
390 |
-
hidePayPalButton();
|
391 |
-
addPayPalButton();
|
392 |
-
} else {
|
393 |
-
vzero.updateData();
|
394 |
-
}
|
395 |
-
|
396 |
-
});
|
397 |
-
|
398 |
-
}
|
399 |
-
</script>
|
400 |
-
<style type="text/css">
|
401 |
-
#braintree-paypal-loggedin {
|
402 |
-
display: none!important;
|
403 |
-
}
|
404 |
-
#braintree-paypal-loggedout {
|
405 |
-
display: block!important;
|
406 |
-
}
|
407 |
-
</style>
|
2 |
/**
|
3 |
* Add in support for IWD One Step Checkout
|
4 |
* https://www.iwdagency.com/extensions/one-step-page-checkout.html
|
5 |
+
* @author Dave Macaulay <dave@gene.co.uk>
|
6 |
*/
|
7 |
?>
|
8 |
<!-- IWD BRAINTREE SUPPORT -->
|
9 |
<script type="text/javascript">
|
10 |
|
11 |
+
// Make sure the checkout running variable is always available
|
12 |
+
checkoutRunning = window.checkoutRunning || false;
|
13 |
|
14 |
+
// Some versions of IWD seem to use the $j variable
|
15 |
+
$iwdjQuery = false;
|
16 |
+
if(typeof $j_opc !== 'undefined') {
|
17 |
+
$iwdjQuery = $j_opc
|
18 |
+
} else if(typeof $j_opc === 'undefined' && typeof $j !== 'undefined') {
|
19 |
+
$iwdjQuery = $j;
|
20 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
+
/**
|
23 |
+
* Override the observeAjaxRequest to add in observing the $j_opc variable
|
24 |
+
*/
|
25 |
+
vZero.addMethods({
|
26 |
+
observeAjaxRequests: function(callback, ignore) {
|
27 |
+
// Is jQuery present on the page
|
28 |
+
if (window.$iwdjQuery) {
|
29 |
+
$iwdjQuery(document).ajaxComplete(function(event, xhr, settings) {
|
30 |
+
return this.handleAjaxRequest(settings.url, callback, ignore)
|
31 |
+
}.bind(this));
|
32 |
}
|
33 |
+
}
|
34 |
+
});
|
35 |
|
36 |
+
vZeroIntegration.addMethods({
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
+
/**
|
39 |
+
* Validate the entire checkout
|
40 |
+
* Annoyingly IWD hasn't already wrapped this in a function
|
41 |
+
*/
|
42 |
+
validateAll: function() {
|
43 |
var addressForm = new VarienForm('opc-address-form-billing');
|
44 |
if (!addressForm.validator.validate()){
|
45 |
return false;
|
46 |
}
|
47 |
+
if (!$iwdjQuery('input[name="billing[use_for_shipping]"]').prop('checked')){
|
48 |
+
var shippingAddressForm = new VarienForm('opc-address-form-shipping');
|
49 |
+
if (!shippingAddressForm.validator.validate()){
|
|
|
50 |
return false;
|
51 |
}
|
52 |
}
|
53 |
+
if (IWD.OPC.Shipping.validateShippingMethod() === false) {
|
54 |
+
$iwdjQuery('.opc-message-container').html($iwdjQuery('#pssm_msg').html());
|
55 |
+
$iwdjQuery('.opc-message-wrapper').show();
|
56 |
+
IWD.OPC.Checkout.hideLoader();
|
57 |
+
return false;
|
58 |
+
}
|
59 |
return true;
|
60 |
+
},
|
|
|
|
|
|
|
61 |
|
62 |
/**
|
63 |
+
* Activate the loading state of this checkout
|
64 |
*/
|
65 |
+
setLoading: function() {
|
66 |
+
checkoutRunning = true;
|
67 |
+
$iwdjQuery('.opc-ajax-loader').show();
|
68 |
+
IWD.OPC.Checkout.lockPlaceOrder();
|
69 |
+
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
/**
|
72 |
+
* Reset the loading state of the checkout
|
73 |
*/
|
74 |
+
resetLoading: function() {
|
75 |
+
checkoutRunning = false;
|
76 |
+
// Manually hide this, as otherwise it has a timeout
|
77 |
+
$iwdjQuery('.opc-ajax-loader').hide();
|
78 |
+
IWD.OPC.Checkout.unlockPlaceOrder();
|
79 |
+
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
|
81 |
+
/**
|
82 |
+
* Attach an observer to the submit action of the checkout to tokenize the card details
|
83 |
+
*/
|
84 |
+
prepareSubmitObserver: function() {
|
|
|
85 |
|
86 |
+
// Store a pointer to the vZero integration
|
87 |
+
var vzeroIntegration = this;
|
88 |
|
89 |
+
var _originalSavePayment = IWD.OPC.savePayment;
|
90 |
+
IWD.OPC.savePayment = function () {
|
91 |
|
92 |
+
// Never call this bizarre function for our method
|
93 |
+
if (vzeroIntegration.shouldInterceptSubmit('creditcard')) {
|
94 |
|
95 |
+
// Are we actually trying to save the order?
|
96 |
+
if (IWD.OPC.saveOrderStatus === true){
|
|
|
|
|
97 |
|
98 |
+
// The original IWD checkout runs these various functions in the payment response
|
99 |
+
IWD.OPC.Checkout.xhr = null;
|
100 |
+
IWD.OPC.agreements = $iwdjQuery('#checkout-agreements').serializeArray();
|
101 |
+
IWD.OPC.getSubscribe();
|
102 |
|
103 |
+
// Save the order
|
104 |
+
IWD.OPC.saveOrder();
|
105 |
}
|
106 |
|
107 |
+
return false;
|
108 |
+
}
|
109 |
|
110 |
+
// Don't run this function with our method
|
111 |
+
if (IWD.OPC.saveOrderStatus !== true && (vzeroIntegration.getPaymentMethod() == 'gene_braintree_paypal' || vzeroIntegration.getPaymentMethod() == 'gene_braintree_creditcard')) {
|
112 |
+
return false;
|
113 |
+
}
|
114 |
|
115 |
+
// Run the original method
|
116 |
+
return _originalSavePayment.apply(this, arguments);
|
117 |
|
118 |
+
};
|
|
|
119 |
|
120 |
+
// Intercept the save order to process the credit card
|
121 |
+
var _originalSaveOrder = IWD.OPC.saveOrder;
|
122 |
+
IWD.OPC.saveOrder = function() {
|
123 |
|
124 |
+
if (vzeroIntegration.shouldInterceptSubmit('creditcard')) {
|
|
|
125 |
|
126 |
+
// Store a pointer to the payment class
|
127 |
+
var paymentThis = this;
|
128 |
+
var paymentArguments = arguments;
|
129 |
|
130 |
+
// If everything was a success on the checkout end, let's submit the vZero integration
|
131 |
+
vzeroIntegration.submit('creditcard', function () {
|
132 |
+
return _originalSaveOrder.apply(paymentThis, paymentArguments);
|
133 |
+
});
|
134 |
|
135 |
+
} else {
|
136 |
+
// If not run the original code
|
137 |
+
return _originalSaveOrder.apply(this, arguments);
|
138 |
+
}
|
139 |
|
140 |
+
};
|
|
|
141 |
|
142 |
+
// When IWD binds payment fields we wanna init
|
143 |
+
var _originalBindChangePaymentFields = IWD.OPC.bindChangePaymentFields;
|
144 |
+
IWD.OPC.bindChangePaymentFields = function() {
|
145 |
|
146 |
+
vzeroIntegration.paymentMethodSwitch();
|
147 |
|
148 |
+
return _originalBindChangePaymentFields.apply(this, arguments);
|
149 |
+
};
|
150 |
|
151 |
+
// Stop the system from validating the credit card hosted fields form for hosted fields
|
152 |
+
var _originalValidatePayment = IWD.OPC.validatePayment;
|
153 |
+
IWD.OPC.validatePayment = function() {
|
154 |
+
if (IWD.OPC.saveOrderStatus === true || vzeroIntegration.getPaymentMethod() != 'gene_braintree_creditcard' || (vzeroIntegration.getPaymentMethod() == 'gene_braintree_creditcard' && !vzeroIntegration.vzero.hostedFields)) {
|
155 |
+
return _originalValidatePayment.apply(this, arguments);
|
156 |
+
}
|
157 |
+
};
|
158 |
|
159 |
+
},
|
160 |
|
161 |
/**
|
162 |
+
* The action to run after the PayPal action has been completed
|
163 |
*/
|
164 |
+
submitCheckout: function() {
|
165 |
+
// Run the original checkouts submit action
|
166 |
+
$iwdjQuery('.opc-btn-checkout').click();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
}
|
168 |
|
169 |
+
});
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Start a new instance of our integration
|
173 |
+
*
|
174 |
+
* @type {vZeroIntegration}
|
175 |
+
*/
|
176 |
+
new vZeroIntegration(
|
177 |
+
(window.vzero || false),
|
178 |
+
(window.vzeroPaypal || false),
|
179 |
+
'<div id="paypal-complete"><label id="paypal-label"><?php echo $this->__('Complete checkout with'); ?> </label><div id="paypal-container"></div></div>',
|
180 |
+
'.opc-btn-checkout',
|
181 |
+
true,
|
182 |
+
{
|
183 |
+
/* This checkout performs a number of Ajax requests that shouldn't cause Braintree to need a new quote total */
|
184 |
+
ignoreAjax: [
|
185 |
+
'onepage/json/saveOrder',
|
186 |
+
'onepage/json/review'
|
187 |
+
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
}
|
189 |
+
);
|
190 |
|
191 |
+
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/gene/braintree/js/magestore.phtml
CHANGED
@@ -2,376 +2,130 @@
|
|
2 |
/**
|
3 |
* Add in support for Magestore One Step Checkout
|
4 |
* http://ecommerce.aheadworks.com/magento-extensions/one-step-checkout.html
|
|
|
5 |
*/
|
6 |
?>
|
7 |
<!-- MAGESTORE BRAINTREE SUPPORT -->
|
8 |
<script type="text/javascript">
|
9 |
|
10 |
-
|
11 |
-
if(mageStoreOriginalPlaceOrder === undefined) {
|
12 |
|
13 |
/**
|
14 |
-
*
|
15 |
*/
|
16 |
-
|
17 |
-
$('onestepcheckout-place-order-loading').show();
|
18 |
-
$('onestepcheckout-button-place-order').removeClassName('onestepcheckout-btn-checkout');
|
19 |
-
$('onestepcheckout-button-place-order').addClassName('place-order-loader');
|
20 |
-
};
|
21 |
-
hideCheckoutLoading = function () {
|
22 |
-
$('onestepcheckout-place-order-loading').hide();
|
23 |
-
$('onestepcheckout-button-place-order').addClassName('onestepcheckout-btn-checkout');
|
24 |
-
$('onestepcheckout-button-place-order').removeClassName('place-order-loader');
|
25 |
-
};
|
26 |
-
getCheckoutPaymentMethod = function () {
|
27 |
-
return $RF($('one-step-checkout-form'), 'payment[method]');
|
28 |
-
};
|
29 |
-
|
30 |
-
// Store the old complete checkout function
|
31 |
-
var mageStoreOriginalPlaceOrder = oscPlaceOrder;
|
32 |
-
|
33 |
-
// Re-define the original method so we can do some jazz with it
|
34 |
-
oscPlaceOrder = function (element) {
|
35 |
-
|
36 |
-
// Store the arguments
|
37 |
-
var originalArguments = arguments;
|
38 |
-
|
39 |
-
if ($('device_data')) {
|
40 |
-
// Device data should never be disabled
|
41 |
-
$('device_data').removeAttribute('disabled');
|
42 |
-
}
|
43 |
-
|
44 |
-
// Always attempt to update the card type on submission
|
45 |
-
if ($$('[data-genebraintree-name="number"]').first() != undefined) {
|
46 |
-
vzero.updateCardType($$('[data-genebraintree-name="number"]').first().value);
|
47 |
-
}
|
48 |
-
|
49 |
-
// Run the original validation functions
|
50 |
var validator = new Validation('one-step-checkout-form');
|
51 |
-
|
52 |
-
|
53 |
-
// Are we dealing with the credit card method?
|
54 |
-
if (getCheckoutPaymentMethod() == 'gene_braintree_creditcard') {
|
55 |
-
|
56 |
-
// Do we want to pass any extra paramters into the updateData request
|
57 |
-
var parameters = {};
|
58 |
-
|
59 |
-
// If the billing address is selected and we're wanting to ship to that address we need to pass the addressId
|
60 |
-
if ($('billing-address-select') != undefined && $('billing-address-select').value != '') {
|
61 |
-
parameters.addressId = $('billing-address-select').value;
|
62 |
-
}
|
63 |
-
|
64 |
-
// Update the data as we're in a one step
|
65 |
-
vzero.updateData(
|
66 |
-
function () {
|
67 |
-
|
68 |
-
// Verify we're not using a saved address
|
69 |
-
if ($('billing-address-select') != undefined && $('billing-address-select').value == '' || $('billing-address-select') == undefined) {
|
70 |
-
|
71 |
-
// Grab these directly from the form and update
|
72 |
-
if ($('billing:firstname') != undefined && $('billing:lastname') != undefined) {
|
73 |
-
vzero.setBillingName($('billing:firstname').value + ' ' + $('billing:lastname').value);
|
74 |
-
}
|
75 |
-
if ($('billing:postcode') != undefined) {
|
76 |
-
vzero.setBillingPostcode($('billing:postcode').value);
|
77 |
-
}
|
78 |
-
}
|
79 |
-
|
80 |
-
// Check is running
|
81 |
-
already_placing_order = true;
|
82 |
-
|
83 |
-
// Show the loading
|
84 |
-
showCheckoutLoading();
|
85 |
-
|
86 |
-
// Process the card
|
87 |
-
vzero.process({
|
88 |
-
onSuccess: function () {
|
89 |
-
|
90 |
-
// Disable the standard credit card form so the values don't get passed through to the checkout
|
91 |
-
$$('#credit-card-form input, #credit-card-form select').each(function (formElement) {
|
92 |
-
if (formElement.id != 'creditcard-payment-nonce' && formElement.getAttribute('data-genebraintree-name') != 'cvv' && formElement.id != 'gene_braintree_creditcard_store_in_vault') {
|
93 |
-
formElement.setAttribute('disabled', 'disabled');
|
94 |
-
}
|
95 |
-
});
|
96 |
-
|
97 |
-
if ($('device_data')) {
|
98 |
-
// Always make sure device data is sent with the request
|
99 |
-
$('device_data').removeAttribute('disabled');
|
100 |
-
}
|
101 |
-
|
102 |
-
// No longer running
|
103 |
-
already_placing_order = false;
|
104 |
-
|
105 |
-
// Fire the original event and return the response
|
106 |
-
completeCheckoutResponse = mageStoreOriginalPlaceOrder.apply(this, originalArguments);
|
107 |
-
|
108 |
-
// Re-enable any form elements which were disabled
|
109 |
-
$$('#credit-card-form input, #credit-card-form select').each(function (formElement) {
|
110 |
-
formElement.removeAttribute('disabled');
|
111 |
-
});
|
112 |
-
|
113 |
-
// Run the original function
|
114 |
-
return completeCheckoutResponse;
|
115 |
-
},
|
116 |
-
onFailure: function () {
|
117 |
-
|
118 |
-
// Reset the waiting for the parent function
|
119 |
-
hideCheckoutLoading();
|
120 |
-
|
121 |
-
// No longer running
|
122 |
-
already_placing_order = false;
|
123 |
-
|
124 |
-
}
|
125 |
-
});
|
126 |
-
|
127 |
-
},
|
128 |
-
parameters
|
129 |
-
);
|
130 |
-
|
131 |
-
// We're updating data don't do anything else for now
|
132 |
-
return false;
|
133 |
-
|
134 |
-
}
|
135 |
-
|
136 |
-
}
|
137 |
-
|
138 |
-
// Stop further processing
|
139 |
-
return mageStoreOriginalPlaceOrder.apply(this, arguments);
|
140 |
-
};
|
141 |
-
|
142 |
-
|
143 |
-
// It's not been ran so set it to false
|
144 |
-
var PayPalCompleteRan = false;
|
145 |
|
146 |
/**
|
147 |
-
*
|
148 |
*/
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
if (!PayPalCompleteRan) {
|
153 |
-
|
154 |
-
// Mark the flag as true
|
155 |
-
PayPalCompleteRan = true;
|
156 |
-
|
157 |
-
// Force check
|
158 |
-
$('p_method_gene_braintree_paypal').checked = true;
|
159 |
-
|
160 |
-
// Re-enable the form
|
161 |
-
$('paypal-payment-nonce').removeAttribute('disabled');
|
162 |
-
$('paypal-payment-nonce').value = obj.nonce;
|
163 |
-
|
164 |
-
// Show the button again
|
165 |
-
hidePayPalButton();
|
166 |
-
|
167 |
-
showCheckoutLoading();
|
168 |
-
|
169 |
-
if ($('device_data')) {
|
170 |
-
// Always make sure device data is sent with the request
|
171 |
-
$('device_data').removeAttribute('disabled');
|
172 |
-
}
|
173 |
-
|
174 |
-
// Run the complete checkout method
|
175 |
-
return oscPlaceOrder($('onestepcheckout-button-place-order'));
|
176 |
-
|
177 |
-
}
|
178 |
-
|
179 |
-
};
|
180 |
-
|
181 |
-
// Flag to check if the PayPal button is already loading
|
182 |
-
var PayPalButtonLoading = false;
|
183 |
|
184 |
/**
|
185 |
-
*
|
186 |
*/
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
// The button is loading
|
193 |
-
PayPalButtonLoading = true;
|
194 |
-
|
195 |
-
// As the PayPal button has to request data from the server show the loader
|
196 |
-
showCheckoutLoading();
|
197 |
-
|
198 |
-
// Update the data contained within the classes
|
199 |
-
vzero.updateData(function () {
|
200 |
-
|
201 |
-
// The button is no longer loading
|
202 |
-
PayPalButtonLoading = false;
|
203 |
-
|
204 |
-
// Hide it once we're done
|
205 |
-
hideCheckoutLoading();
|
206 |
-
|
207 |
-
// Validate the payment method is still correct
|
208 |
-
if (getCheckoutPaymentMethod() == 'gene_braintree_paypal' && $('paypal-complete') == undefined) {
|
209 |
-
|
210 |
-
// Set the flag to false as we've created a new button
|
211 |
-
PayPalCompleteRan = false;
|
212 |
-
|
213 |
-
// Hide the submit button
|
214 |
-
$('onestepcheckout-button-place-order').hide();
|
215 |
-
|
216 |
-
// Add in our PayPal button
|
217 |
-
$('onestepcheckout-button-place-order').insert({after: '<div id="paypal-complete"><label id="paypal-label"><?php echo $this->__('Complete checkout with'); ?> </label><div id="paypal-container"></div></div>'});
|
218 |
-
|
219 |
-
// Always stop the window from opening
|
220 |
-
$('paypal-complete').observe('click', function (event) {
|
221 |
-
|
222 |
-
// Validate the form before we open the PayPal modal window
|
223 |
-
var validator = new Validation('one-step-checkout-form');
|
224 |
-
if (!validator.validate()) {
|
225 |
-
|
226 |
-
// Sadly we're unable to intercept the PayPal window in any other way then just hard closing it
|
227 |
-
vzeroPaypal.closePayPalWindow();
|
228 |
-
}
|
229 |
-
});
|
230 |
-
|
231 |
-
// Add in the PayPal button
|
232 |
-
vzeroPaypal.addPayPalButton({
|
233 |
-
onSuccess: completePayPal
|
234 |
-
});
|
235 |
-
|
236 |
-
}
|
237 |
-
|
238 |
-
});
|
239 |
-
|
240 |
-
} else if ($('paypal-complete') != undefined) {
|
241 |
-
|
242 |
-
// The button is loading
|
243 |
-
PayPalButtonLoading = true;
|
244 |
-
|
245 |
-
// As the PayPal button has to request data from the server show the loader
|
246 |
-
showCheckoutLoading();
|
247 |
-
|
248 |
-
// Update the data contained within the classes
|
249 |
-
vzero.updateData(function () {
|
250 |
-
|
251 |
-
// The button is no longer loading
|
252 |
-
PayPalButtonLoading = false;
|
253 |
-
|
254 |
-
// Hide it once we're done
|
255 |
-
hideCheckoutLoading();
|
256 |
-
|
257 |
-
// Validate the payment method is still correct
|
258 |
-
if (getCheckoutPaymentMethod() == 'gene_braintree_paypal') {
|
259 |
-
|
260 |
-
// Set the flag to false as we've created a new button
|
261 |
-
PayPalCompleteRan = false;
|
262 |
-
|
263 |
-
// Hide the submit button
|
264 |
-
$('onestepcheckout-button-place-order').hide();
|
265 |
-
|
266 |
-
// Add in the PayPal button
|
267 |
-
$('paypal-complete').show();
|
268 |
-
|
269 |
-
}
|
270 |
-
|
271 |
-
});
|
272 |
-
|
273 |
-
}
|
274 |
-
|
275 |
-
};
|
276 |
|
277 |
/**
|
278 |
-
*
|
279 |
*/
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
}
|
286 |
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
291 |
|
292 |
-
|
|
|
|
|
|
|
293 |
|
294 |
-
|
295 |
-
|
296 |
-
if ((getCheckoutPaymentMethod() == 'gene_braintree_paypal' && $('paypal-saved-accounts') == undefined) || ($$('#paypal-saved-accounts input:checked[type=radio]').first() != undefined && $$('#paypal-saved-accounts input:checked[type=radio]').first().value == 'other')) {
|
297 |
|
298 |
-
|
299 |
-
|
300 |
|
301 |
-
|
302 |
-
|
303 |
-
}
|
304 |
|
305 |
-
|
306 |
-
}
|
307 |
-
}
|
308 |
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
if (getCheckoutPaymentMethod() == 'gene_braintree_paypal') {
|
318 |
-
|
319 |
-
if ($('paypal-saved-accounts') == undefined) {
|
320 |
-
addPayPalButton();
|
321 |
-
} else if ($('paypal-saved-accounts') != undefined && $$('#paypal-saved-accounts input:checked[type=radio]').first() != undefined && $$('#paypal-saved-accounts input:checked[type=radio]').first().value == 'other') {
|
322 |
-
addPayPalButton();
|
323 |
-
} else {
|
324 |
-
hidePayPalButton();
|
325 |
-
}
|
326 |
|
327 |
} else {
|
328 |
-
|
|
|
329 |
}
|
330 |
-
}
|
331 |
-
|
332 |
-
return originalSaveShippingMethod.apply(this, arguments);
|
333 |
-
};
|
334 |
-
|
335 |
-
// What should happen if the user closes the 3D secure window?
|
336 |
-
vzero.close3dSecureMethod(function () {
|
337 |
-
|
338 |
-
// Re-tokenize all the saved cards
|
339 |
-
vzero.tokenize3dSavedCards(function () {
|
340 |
-
|
341 |
-
// Reset the waiting for the parent function
|
342 |
-
hideCheckoutLoading();
|
343 |
-
|
344 |
-
// No longer running
|
345 |
-
already_placing_order = false;
|
346 |
|
347 |
-
}
|
|
|
348 |
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
|
|
|
|
353 |
|
354 |
-
|
355 |
-
|
|
|
356 |
|
357 |
-
|
358 |
-
|
359 |
-
hidePayPalButton();
|
360 |
-
addPayPalButton();
|
361 |
-
} else {
|
362 |
-
vzero.updateData();
|
363 |
-
}
|
364 |
|
365 |
-
|
|
|
|
|
|
|
366 |
|
367 |
-
|
|
|
|
|
|
|
|
|
|
|
368 |
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
/**
|
3 |
* Add in support for Magestore One Step Checkout
|
4 |
* http://ecommerce.aheadworks.com/magento-extensions/one-step-checkout.html
|
5 |
+
* @author Dave Macaulay <dave@gene.co.uk>
|
6 |
*/
|
7 |
?>
|
8 |
<!-- MAGESTORE BRAINTREE SUPPORT -->
|
9 |
<script type="text/javascript">
|
10 |
|
11 |
+
vZeroIntegration.addMethods({
|
|
|
12 |
|
13 |
/**
|
14 |
+
* Validate the entire checkout
|
15 |
*/
|
16 |
+
validateAll: function() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
var validator = new Validation('one-step-checkout-form');
|
18 |
+
return validator.validate();
|
19 |
+
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
/**
|
22 |
+
* Return the payment method from the checkouts methods
|
23 |
*/
|
24 |
+
getPaymentMethod: function() {
|
25 |
+
return $RF($('one-step-checkout-form'), 'payment[method]');
|
26 |
+
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
/**
|
29 |
+
* Activate the loading state of this checkout
|
30 |
*/
|
31 |
+
setLoading: function() {
|
32 |
+
$('onestepcheckout-button-place-order').removeClassName('onestepcheckout-btn-checkout');
|
33 |
+
$('onestepcheckout-button-place-order').addClassName('place-order-loader');
|
34 |
+
already_placing_order = true;
|
35 |
+
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
/**
|
38 |
+
* Reset the loading state of the checkout
|
39 |
*/
|
40 |
+
resetLoading: function() {
|
41 |
+
$('onestepcheckout-button-place-order').addClassName('onestepcheckout-btn-checkout');
|
42 |
+
$('onestepcheckout-button-place-order').removeClassName('place-order-loader');
|
43 |
+
already_placing_order = false;
|
44 |
+
},
|
|
|
45 |
|
46 |
+
/**
|
47 |
+
* Show the placing order div before the submit
|
48 |
+
*/
|
49 |
+
beforeSubmit: function(callback) {
|
50 |
+
$('onestepcheckout-place-order-loading').show();
|
51 |
+
return this._beforeSubmit(callback);
|
52 |
+
},
|
53 |
+
afterSubmit: function() {
|
54 |
+
$('onestepcheckout-place-order-loading').hide();
|
55 |
+
},
|
56 |
|
57 |
+
/**
|
58 |
+
* Attach an observer to the submit action of the checkout to tokenize the card details
|
59 |
+
*/
|
60 |
+
prepareSubmitObserver: function() {
|
61 |
|
62 |
+
// Store a pointer to the vZero integration
|
63 |
+
var vzeroIntegration = this;
|
|
|
64 |
|
65 |
+
// Store the old complete checkout function
|
66 |
+
var _originalOscPlaceOrder = oscPlaceOrder;
|
67 |
|
68 |
+
// Re-define the original method so we can do some jazz with it
|
69 |
+
oscPlaceOrder = function (element) {
|
|
|
70 |
|
71 |
+
if (vzeroIntegration.shouldInterceptSubmit('creditcard')) {
|
|
|
|
|
72 |
|
73 |
+
// Store a pointer to the payment class
|
74 |
+
var paymentThis = this;
|
75 |
+
var paymentArguments = arguments;
|
76 |
|
77 |
+
// If everything was a success on the checkout end, let's submit the vZero integration
|
78 |
+
vzeroIntegration.submit('creditcard', function () {
|
79 |
+
return _originalOscPlaceOrder.apply(paymentThis, paymentArguments);
|
80 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
|
82 |
} else {
|
83 |
+
// If not run the original code
|
84 |
+
return _originalOscPlaceOrder.apply(this, arguments);
|
85 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
|
87 |
+
};
|
88 |
+
},
|
89 |
|
90 |
+
/**
|
91 |
+
* Prepare an event to insert the PayPal button in place of the complete checkout button
|
92 |
+
*/
|
93 |
+
preparePaymentMethodSwitchObserver: function() {
|
94 |
+
// Store a pointer to the vZero integration
|
95 |
+
var vzeroIntegration = this;
|
96 |
|
97 |
+
// Intercept people swapping methods
|
98 |
+
var _originalSaveShippingMethod = save_shipping_method;
|
99 |
+
save_shipping_method = function (shipping_method_url, update_shipping_payment, update_shipping_review) {
|
100 |
|
101 |
+
// Run our method switch function
|
102 |
+
vzeroIntegration.paymentMethodSwitch();
|
|
|
|
|
|
|
|
|
|
|
103 |
|
104 |
+
// Run the original function
|
105 |
+
return _originalSaveShippingMethod.apply(this, arguments);
|
106 |
+
};
|
107 |
+
},
|
108 |
|
109 |
+
/**
|
110 |
+
* The action to run after the PayPal action has been completed
|
111 |
+
*/
|
112 |
+
submitCheckout: function() {
|
113 |
+
return oscPlaceOrder($('onestepcheckout-button-place-order'));
|
114 |
+
}
|
115 |
|
116 |
+
});
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Start a new instance of our integration
|
120 |
+
*
|
121 |
+
* @type {vZeroIntegration}
|
122 |
+
*/
|
123 |
+
new vZeroIntegration(
|
124 |
+
(window.vzero || false),
|
125 |
+
(window.vzeroPaypal || false),
|
126 |
+
'<div id="paypal-complete"><label id="paypal-label"><?php echo $this->__('Complete checkout with'); ?> </label><div id="paypal-container"></div></div>',
|
127 |
+
'#onestepcheckout-button-place-order',
|
128 |
+
true
|
129 |
+
);
|
130 |
+
|
131 |
+
</script>
|
app/design/frontend/base/default/template/gene/braintree/js/setup.phtml
CHANGED
@@ -14,10 +14,12 @@
|
|
14 |
'gene_braintree_creditcard',
|
15 |
'<?php echo $this->getClientToken(); ?>',
|
16 |
<?php echo $this->is3DEnabled(); ?>,
|
|
|
17 |
false,
|
18 |
false,
|
19 |
'<?php echo Mage::getUrl('braintree/checkout/quoteTotal', array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure())); ?>',
|
20 |
-
'<?php echo Mage::getUrl('braintree/checkout/tokenizeCard', array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure())); ?>'
|
|
|
21 |
);
|
22 |
|
23 |
<?php if($this->isPayPalActive()): ?>
|
@@ -36,4 +38,18 @@
|
|
36 |
|
37 |
}
|
38 |
|
39 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
'gene_braintree_creditcard',
|
15 |
'<?php echo $this->getClientToken(); ?>',
|
16 |
<?php echo $this->is3DEnabled(); ?>,
|
17 |
+
<?php echo $this->isHostedFields(); ?>,
|
18 |
false,
|
19 |
false,
|
20 |
'<?php echo Mage::getUrl('braintree/checkout/quoteTotal', array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure())); ?>',
|
21 |
+
'<?php echo Mage::getUrl('braintree/checkout/tokenizeCard', array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure())); ?>',
|
22 |
+
'<?php echo Mage::getUrl('braintree/checkout/vaultToNonce', array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure())); ?>'
|
23 |
);
|
24 |
|
25 |
<?php if($this->isPayPalActive()): ?>
|
38 |
|
39 |
}
|
40 |
|
41 |
+
</script>
|
42 |
+
|
43 |
+
<?php
|
44 |
+
/**
|
45 |
+
* We always want to hide the logged in aspect of the PayPal button, only ever display the button
|
46 |
+
*/
|
47 |
+
?>
|
48 |
+
<style type="text/css">
|
49 |
+
#braintree-paypal-loggedin {
|
50 |
+
display: none!important;
|
51 |
+
}
|
52 |
+
#braintree-paypal-loggedout {
|
53 |
+
display: block!important;
|
54 |
+
}
|
55 |
+
</style>
|
app/design/frontend/base/default/template/gene/braintree/js/unicode.phtml
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Add in support for Unicode OP Checkout
|
4 |
+
* http://store.unicodesystems.in/extensions/op-checkout-extension.html
|
5 |
+
* @author Dave Macaulay <dave@gene.co.uk>
|
6 |
+
*/
|
7 |
+
?>
|
8 |
+
<!-- UNICODE BRAINTREE SUPPORT -->
|
9 |
+
<script type="text/javascript">
|
10 |
+
|
11 |
+
vZeroIntegration.addMethods({
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Validate the entire checkout
|
15 |
+
* Annoyingly IWD hasn't already wrapped this in a function
|
16 |
+
*/
|
17 |
+
validateAll: function() {
|
18 |
+
var validators = [];
|
19 |
+
for (var i = 0; i < checkout.allForms.length; i++) {
|
20 |
+
validators[i] = new Validation(checkout.allForms[i]);
|
21 |
+
}
|
22 |
+
return (validators[0].validate() && validators[1].validate() && checkout.shippingMethodValidate() && checkout.paymentMethodValidate() && (validators[3] ? validators[3].validate() : true));
|
23 |
+
},
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Attach an observer to the submit action of the checkout to tokenize the card details
|
27 |
+
*/
|
28 |
+
prepareSubmitObserver: function() {
|
29 |
+
|
30 |
+
// Store a pointer to the vZero integration
|
31 |
+
var vzeroIntegration = this;
|
32 |
+
|
33 |
+
// Store the old complete checkout function
|
34 |
+
var _originalSave = CheckoutMain.prototype.save;
|
35 |
+
|
36 |
+
// Re-define the original method so we can do some jazz with it
|
37 |
+
CheckoutMain.prototype.save = function () {
|
38 |
+
|
39 |
+
if (vzeroIntegration.shouldInterceptSubmit('creditcard')) {
|
40 |
+
|
41 |
+
// Store a pointer to the payment class
|
42 |
+
var paymentThis = this;
|
43 |
+
var paymentArguments = arguments;
|
44 |
+
|
45 |
+
// If everything was a success on the checkout end, let's submit the vZero integration
|
46 |
+
vzeroIntegration.submit('creditcard', function () {
|
47 |
+
return _originalSave.apply(paymentThis, paymentArguments);
|
48 |
+
});
|
49 |
+
|
50 |
+
} else {
|
51 |
+
// If not run the original code
|
52 |
+
return _originalSave.apply(this, arguments);
|
53 |
+
}
|
54 |
+
|
55 |
+
};
|
56 |
+
|
57 |
+
},
|
58 |
+
|
59 |
+
/**
|
60 |
+
* The action to run after the PayPal action has been completed
|
61 |
+
*/
|
62 |
+
submitCheckout: function() {
|
63 |
+
// Run the original checkouts submit action
|
64 |
+
return checkout.save();
|
65 |
+
}
|
66 |
+
|
67 |
+
});
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Start a new instance of our integration
|
71 |
+
*
|
72 |
+
* @type {vZeroIntegration}
|
73 |
+
*/
|
74 |
+
new vZeroIntegration(
|
75 |
+
(window.vzero || false),
|
76 |
+
(window.vzeroPaypal || false),
|
77 |
+
'<div id="paypal-complete"><label id="paypal-label"><?php echo $this->__('Complete checkout with'); ?> </label><div id="paypal-container"></div></div>',
|
78 |
+
'#opcheckout-place-order-button',
|
79 |
+
true,
|
80 |
+
{
|
81 |
+
ignoreAjax: ['opcheckout/onepage/saveOrderCustom']
|
82 |
+
}
|
83 |
+
);
|
84 |
+
|
85 |
+
</script>
|
app/design/frontend/base/default/template/gene/braintree/paypal.phtml
CHANGED
@@ -8,21 +8,28 @@
|
|
8 |
<label><?php echo $this->__('Linked Accounts'); ?></label>
|
9 |
<p><?php echo $this->__('The following PayPal accounts are currently linked with your account.'); ?></p>
|
10 |
<table width="100%" cellspacing="0" cellpadding="0" id="paypal-saved-accounts">
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
</table>
|
27 |
|
28 |
<?php endif; ?>
|
@@ -64,32 +71,9 @@
|
|
64 |
vzeroPaypal.setPricing('<?php echo Mage::helper('gene_braintree')->formatPrice(Mage::getSingleton('checkout/cart')->getQuote()->collectTotals()->getGrandTotal()); ?>', '<?php echo Mage::getSingleton('checkout/cart')->getQuote()->getQuoteCurrencyCode(); ?>');
|
65 |
}
|
66 |
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
// Has the user selected other?
|
71 |
-
if($$('#paypal-saved-accounts input:checked[type=radio]').first().value == 'other') {
|
72 |
-
|
73 |
-
// Show the form
|
74 |
-
$$('.paypal-info').first().show();
|
75 |
-
|
76 |
-
// Enable the form
|
77 |
-
$$('.paypal-info input, .paypal-info select').each(function(formElement) {
|
78 |
-
formElement.removeAttribute('disabled');
|
79 |
-
});
|
80 |
-
|
81 |
-
} else {
|
82 |
-
|
83 |
-
// Hide the form
|
84 |
-
$$('.paypal-info').first().hide();
|
85 |
-
|
86 |
-
// Disable any form elements within the form
|
87 |
-
$$('.paypal-info input, .paypal-info select').each(function(formElement) {
|
88 |
-
formElement.setAttribute('disabled', 'disabled');
|
89 |
-
});
|
90 |
-
}
|
91 |
-
});
|
92 |
-
});
|
93 |
|
94 |
};
|
95 |
|
8 |
<label><?php echo $this->__('Linked Accounts'); ?></label>
|
9 |
<p><?php echo $this->__('The following PayPal accounts are currently linked with your account.'); ?></p>
|
10 |
<table width="100%" cellspacing="0" cellpadding="0" id="paypal-saved-accounts">
|
11 |
+
<tbody>
|
12 |
+
<?php
|
13 |
+
$count = 0;
|
14 |
+
foreach($this->getSavedDetails() as $savedDetail):
|
15 |
+
?>
|
16 |
+
<tr valign="middle">
|
17 |
+
<td width="20"><input type="radio" name="payment[paypal_payment_method_token]" id="<?php echo $savedDetail->token; ?>" value="<?php echo $savedDetail->token; ?>"<?php echo ($count == 0 ? ' checked="checked"' : ''); ?>/></td>
|
18 |
+
<td valign="middle">
|
19 |
+
<label for="<?php echo $savedDetail->token; ?>" style="line-height: 48px;">
|
20 |
+
<img src="<?php echo $this->getSkinUrl('images/gene/braintree/PP.png') ?>" align="left" />
|
21 |
+
<span class="saved-paypal-email"><?php echo $savedDetail->email; ?></span>
|
22 |
+
</label>
|
23 |
+
</td>
|
24 |
+
</tr>
|
25 |
+
<?php
|
26 |
+
++$count;
|
27 |
+
endforeach; ?>
|
28 |
+
<tr valign="middle" class="other-row">
|
29 |
+
<td width="20"><input type="radio" name="payment[paypal_payment_method_token]" id="other-paypal" value="other" /></td>
|
30 |
+
<td><label for="other-paypal"><?php echo $this->__('New PayPal Account'); ?></label></td>
|
31 |
+
</tr>
|
32 |
+
</tbody>
|
33 |
</table>
|
34 |
|
35 |
<?php endif; ?>
|
71 |
vzeroPaypal.setPricing('<?php echo Mage::helper('gene_braintree')->formatPrice(Mage::getSingleton('checkout/cart')->getQuote()->collectTotals()->getGrandTotal()); ?>', '<?php echo Mage::getSingleton('checkout/cart')->getQuote()->getQuoteCurrencyCode(); ?>');
|
72 |
}
|
73 |
|
74 |
+
if(typeof vzero !== 'undefined') {
|
75 |
+
vzero.paypalLoaded();
|
76 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
|
78 |
};
|
79 |
|
js/gene/braintree/braintree-0.1.js
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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,"&").replace(/</g,"<").replace(/>/g,">").replace(/\"/g,""").replace(/\'/g,"'")}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,"<").replace(/>/g,">"),"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/braintree.js
DELETED
@@ -1,5 +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 y(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t}function g(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 w(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 E(){return this.t<=0?0:this.DB*(this.t-1)+w(this[this.t-1]^this.s&this.DM)}function S(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 A(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 x(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 T(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 k(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 P(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 I(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-w(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,y=1<<this.F2,g=n.t,b=g-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[--g]==h?this.DM:Math.floor(n[g]*f+(n[g-1]+y)*m);if((n[g]+=a.am(0,_,n,b,0,p))<_)for(a.dlShiftTo(b,v),n.subTo(v,n);n[g]<--_;)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 O(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 U(t){this.m=t}function R(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function M(t){return t}function N(t){t.divRemTo(this.m,null,t)}function D(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 B(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 j(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 z(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 H(t,e){t.squareTo(e),this.reduce(e)}function W(t,e,n){t.multiplyTo(e,n),this.reduce(n)}function q(){return 0==(this.t>0?1&this[0]:this.s)}function Q(t,e){if(t>4294967295||1>t)return o.ONE;var n=s(),i=s(),r=e.convert(this),a=w(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 G(t,e){var n;return n=256>t||e.isEven()?new U(e):new B(e),this.exp(t,n)}function Y(t,e){return new o(t,e)}function J(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 Z(){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 K(t,e){if(!(null!=t&&null!=e&&t.length>0&&e.length>0))throw new Error("Invalid RSA public key");this.n=Y(t,16),this.e=parseInt(e,16)}function X(t){return t.modPowInt(this.e,this.n)}function $(t){var e=J(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;U.prototype.convert=R,U.prototype.revert=M,U.prototype.reduce=N,U.prototype.mulTo=D,U.prototype.sqrTo=F,B.prototype.convert=j,B.prototype.revert=z,B.prototype.reduce=V,B.prototype.mulTo=W,B.prototype.sqrTo=H,o.prototype.copyTo=h,o.prototype.fromInt=d,o.prototype.fromString=m,o.prototype.clamp=y,o.prototype.dlShiftTo=S,o.prototype.drShiftTo=C,o.prototype.lShiftTo=A,o.prototype.rShiftTo=x,o.prototype.subTo=T,o.prototype.multiplyTo=k,o.prototype.squareTo=P,o.prototype.divRemTo=I,o.prototype.invDigit=L,o.prototype.isEven=q,o.prototype.exp=Q,o.prototype.toString=g,o.prototype.negate=b,o.prototype.abs=v,o.prototype.compareTo=_,o.prototype.bitLength=E,o.prototype.mod=O,o.prototype.modPowInt=G,o.ZERO=f(0),o.ONE=f(1),Z.prototype.doPublic=X,Z.prototype.setPublic=K,Z.prototype.encrypt=$;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],y=f[1],g=f[2],b=f[3],v=f[4];for(o=0;p>o;o++)n=m[a>>>24]^y[u>>16&255]^g[c>>8&255]^b[255&l]^s[h],i=m[u>>>24]^y[c>>16&255]^g[l>>8&255]^b[255&a]^s[h+1],r=m[c>>>24]^y[l>>16&255]^g[a>>8&255]^b[255&u]^s[h+2],l=m[l>>>24]^y[a>>16&255]^g[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 Z,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 define,module,exports;return function t(e,n,i){function r(s,a){if(!n[s]){if(!e[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:{}};e[s][0].call(l.exports,function(t){var n=e[s][1][t];return r(n?n:t)},l,l.exports,t,e,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){"use strict";t("./src/rpc-dispatcher")(),e.exports=t("./src/setup.js")},{"./src/rpc-dispatcher":308,"./src/setup.js":309}],2:[function(t,e){(function(n){"use strict";function i(t,e){return t.status>=400?[t,null]:[null,e(t)]}function r(t){var e;this.attrs={},t.hasOwnProperty("sharedCustomerIdentifier")&&(this.attrs.sharedCustomerIdentifier=t.sharedCustomerIdentifier),e=c(t.clientToken),this.driver=t.driver||l,this.authUrl=e.authUrl,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||"";var n=u.create(this,{container:t.container,clientToken:e});this.verify3DS=a.bind(n.verify,n),this.attrs.authorizationFingerprint=e.authorizationFingerprint,this.attrs.sharedCustomerIdentifierType=t.sharedCustomerIdentifierType,e.merchantAccountId&&(this.attrs.merchantAccountId=e.merchantAccountId),this.timeoutWatchers=[],this.requestTimeout=t.hasOwnProperty("timeout")?t.timeout:6e4}function o(){}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}var a=t("braintree-utilities"),u=t("braintree-3ds"),c=t("./parse-client-token"),l=t("./jsonp-driver"),p=t("./util"),h=t("./sepa-mandate"),d=t("./sepa-bank-account"),f=t("./credit-card"),m=t("./coinbase-account"),y=t("./root-data"),g=t("./normalize-api-fields").normalizeCreditCardFields;r.prototype.requestWithTimeout=function(t,e,n,r,s){s=s||o;var a,u,c=this;y.get(function(o){u="braintree/web/"+o.sdkVersion,e.braintreeLibraryVersion=u,e.hasOwnProperty("analytics")&&e.hasOwnProperty("_meta")&&(e._meta.sdkVersion=u,e._meta.merchantAppId=o.merchantAppId),a=r(t,e,function(t,e){if(c.timeoutWatchers[e]){clearTimeout(c.timeoutWatchers[e]);var r=i(t,function(t){return n(t)});s.apply(null,r)}}),c.requestTimeout>0?this.timeoutWatchers[a]=setTimeout(function(){c.timeoutWatchers[a]=null,s.apply(null,[{errors:"Unknown error"},null])},c.requestTimeout):s.apply(null,[{errors:"Unknown error"},null])},this)},r.prototype.post=function(t,e,n,i){this.requestWithTimeout(t,e,n,this.driver.post,i)},r.prototype.get=function(t,e,n,i){this.requestWithTimeout(t,e,n,this.driver.get,i)},r.prototype.put=function(t,e,n,i){this.requestWithTimeout(t,e,n,this.driver.put,i)},r.prototype.getCreditCards=function(t){this.get(p.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 f(t.paymentMethods[e]));return i},t)},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.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=p.joinUrlFragments([this.clientApiUrl,"v1/payment_methods",t.nonce,"three_d_secure/lookup"]),i=s(this.attrs,{amount:t.amount});this.post(n,i,function(t){return t},e)},r.prototype.addSEPAMandate=function(t,e){var n=s(this.attrs,{sepaMandate:t});this.post(p.joinUrlFragments([this.clientApiUrl,"v1","sepa_mandates.json"]),n,function(t){return new h(t.sepaMandates[0])},e)},r.prototype.acceptSEPAMandate=function(t,e){this.put(p.joinUrlFragments([this.clientApiUrl,"v1","sepa_mandates",t,"accept"]),this.attrs,function(t){return new d(t.sepaBankAccounts[0])},e)},r.prototype.getSEPAMandate=function(t,e){var n;n=t.paymentMethodToken?s(this.attrs,{paymentMethodToken:t.paymentMethodToken}):this.attrs,this.get(p.joinUrlFragments([this.clientApiUrl,"v1","sepa_mandates",t.mandateReferenceNumber||""]),n,function(t){return new h(t.sepaMandates[0])},e)},r.prototype.addCoinbase=function(t,e){var n;delete t.share,n=s(this.attrs,{coinbaseAccount:t,_meta:{integration:this.integration||"custom",source:"coinbase"}}),this.post(p.joinUrlFragments([this.clientApiUrl,"v1","payment_methods/coinbase_accounts"]),n,function(t){return new m(t.coinbaseAccounts[0])},e)},r.prototype.addCreditCard=function(t,e){var n,i=t.share;delete t.share;var r=g(t);n=s(this.attrs,{share:i,creditCard:r,_meta:{integration:this.integration||"custom",source:"form"}}),this.post(p.joinUrlFragments([this.clientApiUrl,"v1","payment_methods/credit_cards"]),n,function(t){return new f(t.creditCards[0])},e)},r.prototype.unlockCreditCard=function(t,e,n){var i=s(this.attrs,{challengeResponses:e});this.put(p.joinUrlFragments([this.clientApiUrl,"v1","payment_methods/",t.nonce]),i,function(t){return new f(t.paymentMethods[0])},n)},r.prototype.sendAnalyticsEvents=function(t,e){var i,r=this.analyticsUrl,o=[];if(t=p.isArray(t)?t:[t],!r)return void(e&&e.apply(null,[null,{}]));for(var a in t)t.hasOwnProperty(a)&&o.push({kind:t[a]});i=s(this.attrs,{analytics:o,_meta:{platform:"web",platformVersion:n.navigator.userAgent,integrationType:this.integration}}),this.post(r,i,function(t){return t},e)},e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./coinbase-account":3,"./credit-card":4,"./jsonp-driver":5,"./normalize-api-fields":7,"./parse-client-token":8,"./root-data":10,"./sepa-bank-account":11,"./sepa-mandate":12,"./util":13,"braintree-3ds":22,"braintree-utilities":41}],3:[function(t,e){"use strict";function n(t){for(var e=0;e<i.length;e++){var n=i[e];this[n]=t[n]}}var i=["nonce","type","description","details"];e.exports=n},{}],4:[function(t,e){"use strict";function n(t){for(var e=0;e<i.length;e++){var 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},{}],5:[function(t,e){"use strict";function n(t,e,n){return o.get(t,e,n)}function i(t,e,n){return e._method="POST",o.get(t,e,n)}function r(t,e,n){return e._method="PUT",o.get(t,e,n)}var o=t("./jsonp");e.exports={get:n,post:i,put:r}},{"./jsonp":6}],6:[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||l.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))},a||(a=document.getElementsByTagName("head")[0]),a.appendChild(n)}function r(t,e){var n,i,o,s=[];for(var o in t)t.hasOwnProperty(o)&&(i=t[o],n=e?u.isArray(t)?e+"[]":e+"["+o+"]":o,s.push("object"==typeof i?r(i,n):encodeURIComponent(n)+"="+encodeURIComponent(i)));return s.join("&")}function o(t,e,n,o){var s=-1===(t||"").indexOf("?")?"?":"&";o=o||l.callbackName||"callback";var a=o+"_json"+u.generateUUID();return s+=r(e),c[a]=function(t){n(t,a);try{delete c[a]}catch(e){}c[a]=null},i(t+s+"&"+o+"="+a),a}function s(t){l=t}var a,u=t("./util"),c=n,l={};e.exports={get:o,init:s,stringify:r}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./util":13}],7:[function(t,e){"use strict";function n(t){var e={billingAddress:t.billingAddress||{}};for(var n in t)if(t.hasOwnProperty(n))switch(n.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":e.billingAddress[n]=t[n];break;default:e[n]=t[n]}return e}e.exports={normalizeCreditCardFields:n}},{}],8:[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(i){throw new Error("Braintree API Client Misconfigured: clientToken is invalid.")}}if(!e.hasOwnProperty("authUrl")||!e.hasOwnProperty("clientApiUrl"))throw new Error("Braintree API Client Misconfigured: clientToken is invalid.");return e}t("./polyfill"),e.exports=n},{"./polyfill":9}],9:[function(){(function(t){"use strict";t.atob=t.atob||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("Braintree API Client Misconfigured: clientToken is invalid.");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}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],10:[function(t,e){(function(n){"use strict";function i(){var t=n.braintree;return t&&t.hasOwnProperty("VERSION")?t.VERSION:void 0}function r(t,e){null==s?(h.push({callback:t,context:e}),p===!1&&(a=setTimeout(function(){o(d)},200),l.invoke("getExternalData",[],o),p=!0)):t.call(e,s)}function o(t){clearTimeout(a),s={sdkVersion:t.sdkVersion,merchantAppId:t.merchantAppId};for(var e=0;e<h.length;e++){var n=h[e];n.callback.call(n.context,s)}h=[]}var s,a,u=t("braintree-rpc"),c=new u.MessageBus(window),l=new u.RPCClient(c,window.parent),p=!1,h=[],d={sdkVersion:i(),merchantAppId:n.location.href};e.exports={get:r}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"braintree-rpc":30}],11:[function(t,e){"use strict";function n(t){for(var e=0;e<i.length;e++){var n=i[e];this[n]=t[n]}}var i=["bic","maskedIBAN","nonce","accountHolderName"];e.exports=n},{}],12:[function(t,e){"use strict";function n(t){for(var e=0;e<i.length;e++){var n=i[e];this[n]=t[n]}}var i=["accountHolderName","bic","longFormURL","mandateReferenceNumber","maskedIBAN","shortForm"];e.exports=n},{}],13:[function(t,e){"use strict";function n(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 i(t){return t&&"object"==typeof t&&"number"==typeof t.length&&"[object Array]"===Object.prototype.toString.call(t)||!1}function r(){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)})}e.exports={joinUrlFragments:n,isArray:i,generateUUID:r}},{}],14:[function(t,e){"use strict";function n(t){return new i(t)}var i=t("./lib/client"),r=t("./lib/jsonp"),o=t("./lib/jsonp-driver"),s=t("./lib/util"),a=t("./lib/parse-client-token");e.exports={Client:i,configure:n,util:s,JSONP:r,JSONPDriver:o,parseClientToken:a}},{"./lib/client":2,"./lib/jsonp":6,"./lib/jsonp-driver":5,"./lib/parse-client-token":8,"./lib/util":13}],15:[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}},{}],16:[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}},{}],17:[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}},{}],18:[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}},{}],19:[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":15,"./lib/events":16,"./lib/fn":17,"./lib/url":18}],20:[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.2.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":24,"braintree-utilities":19}],21:[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._boundHandleUserClose=r.bind(this._handleUserClose,this)}var r=t("braintree-utilities"),o=t("./authorization_service");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);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?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;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._handleUserClose=function(t){"user_closed=true"===t.data&&this._onUserClose()},i.prototype._onUserClose=n,e.exports=i},{"./authorization_service":20,"braintree-utilities":19}],22:[function(t,e){"use strict";var n=t("./client");t("./vendor/json2"),e.exports={create:function(t,e){var i=new n(t,e);return i}}},{"./client":21,"./vendor/json2":23}],23:[function(require,module,exports){"object"!=typeof JSON&&(JSON={}),function(){"use strict";function f(t){return 10>t?"0"+t:t}function quote(t){return escapable.lastIndex=0,escapable.test(t)?'"'+t.replace(escapable,function(t){var e=meta[t];return"string"==typeof e?e:"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+t+'"'}function str(t,e){var n,i,r,o,s,a=gap,u=e[t];switch(u&&"object"==typeof u&&"function"==typeof u.toJSON&&(u=u.toJSON(t)),"function"==typeof rep&&(u=rep.call(e,t,u)),typeof u){case"string":return quote(u);case"number":return isFinite(u)?String(u):"null";case"boolean":case"null":return String(u);case"object":if(!u)return"null";if(gap+=indent,s=[],"[object Array]"===Object.prototype.toString.apply(u)){for(o=u.length,n=0;o>n;n+=1)s[n]=str(n,u)||"null";return r=0===s.length?"[]":gap?"[\n"+gap+s.join(",\n"+gap)+"\n"+a+"]":"["+s.join(",")+"]",gap=a,r}if(rep&&"object"==typeof rep)for(o=rep.length,n=0;o>n;n+=1)"string"==typeof rep[n]&&(i=rep[n],r=str(i,u),r&&s.push(quote(i)+(gap?": ":":")+r));else for(i in u)Object.prototype.hasOwnProperty.call(u,i)&&(r=str(i,u),r&&s.push(quote(i)+(gap?": ":":")+r));return r=0===s.length?"{}":gap?"{\n"+gap+s.join(",\n"+gap)+"\n"+a+"}":"{"+s.join(",")+"}",gap=a,r}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()});var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;"function"!=typeof JSON.stringify&&(JSON.stringify=function(t,e,n){var i;if(gap="",indent="","number"==typeof n)for(i=0;n>i;i+=1)indent+=" ";else"string"==typeof n&&(indent=n);if(rep=e,e&&"function"!=typeof e&&("object"!=typeof e||"number"!=typeof e.length))throw new Error("JSON.stringify");return str("",{"":t})}),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){function walk(t,e){var n,i,r=t[e];if(r&&"object"==typeof r)for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(i=walk(r,n),void 0!==i?r[n]=i:delete r[n]);return reviver.call(t,e,r)}var j;if(text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(t){return"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}()},{}],24:[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":19}],25:[function(t,e){"use strict";function n(t){this.host=t||window,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:e,data:n}),"*")},n.prototype.register=function(t,e){this.handlers.push({type: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.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":35}],26:[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":35}],27:[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},{}],28:[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":35}],29:[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.define=function(t,e){this.methods[t]=e},e.exports=n},{"braintree-utilities":35}],30:[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":25,"./lib/pubsub-client":26,"./lib/pubsub-server":27,"./lib/rpc-client":28,"./lib/rpc-server":29}],31:[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&&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}},{}],32:[function(t,e){"use strict";function n(t,e,n){t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent&&t.attachEvent("on"+e,n)}function i(t,e,n){t.removeEventListener?t.removeEventListener(e,n,!1):t.detachEvent&&t.detachEvent("on"+e,n)}e.exports={removeEventListener:i,addEventListener:n}},{}],33:[function(t,e){"use strict";function n(t){return"[object Function]"===Object.prototype.toString.call(t)}function i(t,e){return function(){t.apply(e,arguments)}}e.exports={bind:i,isFunction:n}},{}],34:[function(t,e,n){arguments[4][18][0].apply(n,arguments)},{dup:18}],35:[function(t,e,n){arguments[4][19][0].apply(n,arguments)},{"./lib/dom":31,"./lib/events":32,"./lib/fn":33,"./lib/url":34,dup:19}],36:[function(t,e,n){arguments[4][15][0].apply(n,arguments)},{dup:15}],37:[function(t,e,n){arguments[4][16][0].apply(n,arguments)},{dup:16}],38:[function(t,e,n){arguments[4][17][0].apply(n,arguments)},{dup:17}],39:[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}},{}],40:[function(t,e,n){arguments[4][18][0].apply(n,arguments)},{dup:18}],41:[function(t,e){var n=t("./lib/dom"),i=t("./lib/url"),r=t("./lib/fn"),o=t("./lib/events"),s=t("./lib/string");e.exports={string:s,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":36,"./lib/events":37,"./lib/fn":38,"./lib/string":39,"./lib/url":40}],42:[function(t,e){"use strict";var n=t("framebus");n.events=t("./lib/events"),e.exports=n},{"./lib/events":43,framebus:44}],43:[function(t,e){"use strict";for(var n=["PAYMENT_METHOD_REQUEST","PAYMENT_METHOD_RECEIVED","PAYMENT_METHOD_GENERATED","PAYMENT_METHOD_CANCELLED","PAYMENT_METHOD_ERROR","CONFIGURATION_REQUEST","ERROR","WARNING"],i={},r=0;r<n.length;r++){var o=n[r];i[o]=o}e.exports=i},{}],44:[function(t,e,n){"use strict";!function(t,i){"function"==typeof define&&define.amd?define([],i):"object"==typeof n?e.exports=i():t.framebus=i()}(this,function(){function t(t,e,n){var r;return n=n||"*","string"!=typeof t?!1:"string"!=typeof n?!1:(r=i(t,e,n),c(h.top,r,n),!0)}function e(t,e,n){return n=n||"*",p(t,e,n)?!1:(d[n]=d[n]||{},d[n][t]=d[n][t]||[],d[n][t].push(e),!0)}function n(t,e,n){var i,r;if(n=n||"*",p(t,e,n))return!1;if(r=d[n]&&d[n][t],!r)return!1;for(i=0;i<r.length;i++)if(r[i]===e)return r.splice(i,1),!0;return!1}function i(t,e,n){var i={event:t};return"function"==typeof e?i.reply=l(e,n):i.data=e,JSON.stringify(i)}function r(t){var e;try{e=JSON.parse(t.data)}catch(n){return!1}return null==e.event?!1:(null!=e.reply&&(e.data=function(n){var r=i(e.reply,n,t.origin);t.source.postMessage(r,t.origin)}),e)}function o(t){h||(h=t,h.addEventListener?h.addEventListener("message",a,!1):h.attachEvent?h.attachEvent("onmessage",a):null===h.onmessage?h.onmessage=a:h=null)}function s(){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 a(t){var e;"string"==typeof t.data&&(e=r(t),e&&(u("*",e.event,e.data,t.origin),u(t.origin,e.event,e.data,t.origin)))}function u(t,e,n,i){var r;if(d[t]&&d[t][e])for(r=0;r<d[t][e].length;r++)d[t][e][r](n,i)}function c(t,e,n){var i;for(t.postMessage(e,n),i=0;i<t.frames.length;i++)c(t.frames[i],e,n)}function l(t,i){function r(e,s){t(e,s),n(o,r,i)}var o=s();return e(o,r,i),o}function p(t,e,n){return"string"!=typeof t?!0:"function"!=typeof e?!0:"string"!=typeof n?!0:!1}var h,d={};return o(window),{publish:t,pub:t,trigger:t,emit:t,subscribe:e,sub:e,on:e,unsubscribe:n,unsub:n,off:n}})},{}],45:[function(t,e){"use strict";function n(t,e){u.emit(u.events.ERROR,{type:e,message:t})}function i(){var t=a.isIE();return t&&8===t.version}function r(t){if(null==t.apiClient)return n("settings.apiClient is required for coinbase",c),!1;if(!t.configuration.coinbaseEnabled)return n("Coinbase is not enabled for your merchant account",c),!1;var e=t.coinbase;return e&&(e.container||e.button)?e.container&&e.button?(n("options.coinbase.container and options.coinbase.button are mutually exclusive",c),!1):(i()&&n("Coinbase is not supported by your browser. Please consider upgrading","UNSUPPORTED_BROWSER"),!0):(n("Either options.coinbase.container or options.coinbase.button is required for coinbase integrations",c),!1)}function o(t){return r(t)?new s(t):void 0}var s=t("./lib/coinbase"),a=t("./lib/browser"),u=t("braintree-bus"),c="CONFIGURATION";e.exports={create:o}},{"./lib/browser":46,"./lib/coinbase":48,"braintree-bus":56}],46:[function(t,e){(function(t){"use strict";function n(){var t=null,e="";try{new ActiveXObject("")}catch(n){e=n.name}try{t=!!new ActiveXObject("htmlfile")}catch(n){t=!1}return t="ReferenceError"!==e&&t===!1?!1:!0,!t}function i(){var e={version:null};return/Trident/.test(t.navigator.userAgent)&&(e.version=11),/MSIE 10/.test(t.navigator.userAgent)&&(e.version=10),/MSIE 9/.test(t.navigator.userAgent)&&(e.version=9),/MSIE 8/.test(t.navigator.userAgent)&&(e.version=8),e
|
3 |
-
}function r(){return/MSIE|Trident/.test(t.navigator.userAgent)?i():null}e.exports={isMetroBrowser:n,isIE:r}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],47:[function(t,e){"use strict";function n(t,e,n){return t?(i.emit(i.events.ERROR,t.error),void n.sendAnalyticsEvents("coinbase.web.error")):(i.emit(i.events.PAYMENT_METHOD_GENERATED,e),void n.sendAnalyticsEvents("coinbase.web.success"))}var i=t("braintree-bus");e.exports={tokenize:n}},{"braintree-bus":56}],48:[function(t,e){(function(n){"use strict";function i(){}function r(t){return{clientId:t.configuration.coinbase.clientId,redirectUrl:t.configuration.coinbase.redirectUrl,scopes:t.configuration.coinbase.scopes||l.SCOPES,meta:{authorizations_merchant_account:t.configuration.coinbase.merchantAccount||""}}}function o(t){var e;this.buttonId=t.coinbase.button||l.BUTTON_ID,this.apiClient=t.apiClient,this.assetsUrl=t.configuration.assetsUrl,this._onOAuthSuccess=s.bind(this._onOAuthSuccess,this),this._handleButtonClick=s.bind(this._handleButtonClick,this),this.popupParams=r(t),this.redirectDoneInterval=null,e=document.body,n.braintreeCoinbaseRedirectCallback=this._onOAuthSuccess,t.coinbase.container?(e=s.normalizeElement(t.coinbase.container),this._insertFrame(e)):s.addEventListener(e,"click",this._handleButtonClick),this._sendAnalyticsEvents("coinbase.web.initialized")}var s=t("braintree-utilities"),a=t("./dom/composer"),u=t("./url-composer"),c=t("./callbacks"),l=t("./constants"),p=t("braintree-bus"),h=t("./detector");o.prototype._sendAnalyticsEvents=function(t){this.apiClient.sendAnalyticsEvents(t)},o.prototype._insertFrame=function(t){var e=a.createFrame({src:this.assetsUrl+"/coinbase/"+l.VERSION+"/coinbase-frame.html"});t.appendChild(e)},o.prototype._onOAuthSuccess=function(t){t.code&&(p.emit("coinbase:view:navigate","loading"),this._clearPollForRedirectDone(),this.apiClient.tokenizeCoinbase({code:t.code,query:u.getQueryString()},s.bind(function(t,e){c.tokenize.apply(null,[t,e,this.apiClient])},this)))},o.prototype._clearPollForRedirectDone=function(){this.redirectDoneInterval&&(clearInterval(this.redirectDoneInterval),this.redirectDoneInterval=null)},o.prototype._pollForRedirectDone=function(t){this.redirectDoneInterval=setInterval(s.bind(function(){var e;if(null==t||t.closed)return void this._clearPollForRedirectDone();try{e=s.decodeQueryString(t.location.search.replace(/^\?/,"")).code}catch(n){return}e&&(this._onOAuthSuccess({code:e}),t.close())},this),100)},o.prototype._openPopup=function(){var t;this._sendAnalyticsEvents("coinbase.web.start.popup"),t=a.createPopup(u.compose(this.popupParams)),n.popup=t,t.focus(),h.shouldPoll()&&(this._pollForRedirectDone(t),n.braintreeCoinbaseRedirectCallback=i)},o.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()},e.exports=o}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./callbacks":47,"./constants":49,"./detector":50,"./dom/composer":52,"./url-composer":55,"braintree-bus":56,"braintree-utilities":64}],49:[function(t,e){"use strict";e.exports={BASE_URL:"https://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.0.3"}},{}],50:[function(t,e){"use strict";function n(){var t=r.isIE();return t&&t.version>9}function i(){return r.isIE()&&r.isMetroBrowser()}var r=t("./browser");e.exports={shouldPoll:n,shouldCloseFromParent:i}},{"./browser":46}],51:[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}},{}],52:[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":51,"./frame":53,"./popup":54}],53:[function(t,e){"use strict";function n(t){var e=document.createElement("iframe");return e.src=t.src,e.id=i.FRAME_NAME,e.name=i.FRAME_NAME,e.allowTransparency=!0,e.height="70px",e.width="100%",e.frameBorder=0,e.style.padding=0,e.style.margin=0,e.style.border=0,e.style.outline="none",e}var i=t("../constants");e.exports={create:n}},{"../constants":49}],54:[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":49}],55:[function(t,e){"use strict";function n(){return"version="+r.VERSION}function i(t){var e=r.BASE_URL+"/oauth/authorize?response_type=code",i=t.redirectUrl+"?"+n();if(e+="&redirect_uri="+encodeURIComponent(i),e+="&client_id="+t.clientId,t.scopes&&(e+="&scope="+encodeURIComponent(t.scopes)),t.meta)for(var o in t.meta)t.meta.hasOwnProperty(o)&&(e+="&meta["+encodeURIComponent(o)+"]="+encodeURIComponent(t.meta[o]));return e}var r=t("./constants");e.exports={compose:i,getQueryString:n}},{"./constants":49}],56:[function(t,e,n){arguments[4][42][0].apply(n,arguments)},{"./lib/events":57,dup:42,framebus:58}],57:[function(t,e,n){arguments[4][43][0].apply(n,arguments)},{dup:43}],58:[function(t,e,n){arguments[4][44][0].apply(n,arguments)},{dup:44}],59:[function(t,e,n){arguments[4][15][0].apply(n,arguments)},{dup:15}],60:[function(t,e,n){arguments[4][16][0].apply(n,arguments)},{dup:16}],61:[function(t,e,n){arguments[4][17][0].apply(n,arguments)},{dup:17}],62:[function(t,e,n){arguments[4][39][0].apply(n,arguments)},{dup:39}],63:[function(t,e,n){arguments[4][18][0].apply(n,arguments)},{dup:18}],64:[function(t,e,n){arguments[4][41][0].apply(n,arguments)},{"./lib/dom":59,"./lib/events":60,"./lib/fn":61,"./lib/string":62,"./lib/url":63,dup:41}],65:[function(t,e){(function(n){"use strict";function i(t,e){return t.status>=400?[t,null]:[null,e(t)]}function r(t){var e;this.attrs={},t.hasOwnProperty("sharedCustomerIdentifier")&&(this.attrs.sharedCustomerIdentifier=t.sharedCustomerIdentifier),e=c(t.clientToken),this.driver=t.driver||l,this.authUrl=e.authUrl,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||"";var n=u.create(this,{container:t.container,clientToken:e});this.verify3DS=a.bind(n.verify,n),this.attrs.authorizationFingerprint=e.authorizationFingerprint,this.attrs.sharedCustomerIdentifierType=t.sharedCustomerIdentifierType,e.merchantAccountId&&(this.attrs.merchantAccountId=e.merchantAccountId),this.timeoutWatchers=[],this.requestTimeout=t.hasOwnProperty("timeout")?t.timeout:6e4}function o(){}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}var a=t("braintree-utilities"),u=t("braintree-3ds"),c=t("./parse-client-token"),l=t("./jsonp-driver"),p=t("./util"),h=t("./sepa-mandate"),d=t("./sepa-bank-account"),f=t("./credit-card"),m=t("./coinbase-account"),y=t("./root-data"),g=t("./normalize-api-fields").normalizeCreditCardFields;r.prototype.requestWithTimeout=function(t,e,n,r,s){s=s||o;var a,u,c=this;y.get(function(o){u="braintree/web/"+o.sdkVersion,e.braintreeLibraryVersion=u,e.hasOwnProperty("analytics")&&e.hasOwnProperty("_meta")&&(e._meta.sdkVersion=u,e._meta.merchantAppId=o.merchantAppId),a=r(t,e,function(t,e){if(c.timeoutWatchers[e]){clearTimeout(c.timeoutWatchers[e]);var r=i(t,function(t){return n(t)});s.apply(null,r)}}),c.requestTimeout>0?this.timeoutWatchers[a]=setTimeout(function(){c.timeoutWatchers[a]=null,s.apply(null,[{errors:"Unknown error"},null])},c.requestTimeout):s.apply(null,[{errors:"Unknown error"},null])},this)},r.prototype.post=function(t,e,n,i){this.requestWithTimeout(t,e,n,this.driver.post,i)},r.prototype.get=function(t,e,n,i){this.requestWithTimeout(t,e,n,this.driver.get,i)},r.prototype.put=function(t,e,n,i){this.requestWithTimeout(t,e,n,this.driver.put,i)},r.prototype.getCreditCards=function(t){this.get(p.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 f(t.paymentMethods[e]));return i},t)},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.tokenizeCard=function(t,e){t.options={validate:!1},this.addCreditCard(t,function(t,n){n&&n.nonce?e(t,n.nonce,{type:n.type}):e("Unable to tokenize card.",null)})},r.prototype.lookup3DS=function(t,e){var n=p.joinUrlFragments([this.clientApiUrl,"v1/payment_methods",t.nonce,"three_d_secure/lookup"]),i=s(this.attrs,{amount:t.amount});this.post(n,i,function(t){return t},e)},r.prototype.addSEPAMandate=function(t,e){var n=s(this.attrs,{sepaMandate:t});this.post(p.joinUrlFragments([this.clientApiUrl,"v1","sepa_mandates.json"]),n,function(t){return new h(t.sepaMandates[0])},e)},r.prototype.acceptSEPAMandate=function(t,e){this.put(p.joinUrlFragments([this.clientApiUrl,"v1","sepa_mandates",t,"accept"]),this.attrs,function(t){return new d(t.sepaBankAccounts[0])},e)},r.prototype.getSEPAMandate=function(t,e){var n;n=t.paymentMethodToken?s(this.attrs,{paymentMethodToken:t.paymentMethodToken}):this.attrs,this.get(p.joinUrlFragments([this.clientApiUrl,"v1","sepa_mandates",t.mandateReferenceNumber||""]),n,function(t){return new h(t.sepaMandates[0])},e)},r.prototype.addCoinbase=function(t,e){var n;delete t.share,n=s(this.attrs,{coinbaseAccount:t,_meta:{integration:this.integration||"custom",source:"coinbase"}}),this.post(p.joinUrlFragments([this.clientApiUrl,"v1","payment_methods/coinbase_accounts"]),n,function(t){return new m(t.coinbaseAccounts[0])},e)},r.prototype.addCreditCard=function(t,e){var n,i=t.share;delete t.share;var r=g(t);n=s(this.attrs,{share:i,creditCard:r,_meta:{integration:this.integration||"custom",source:"form"}}),this.post(p.joinUrlFragments([this.clientApiUrl,"v1","payment_methods/credit_cards"]),n,function(t){return new f(t.creditCards[0])},e)},r.prototype.unlockCreditCard=function(t,e,n){var i=s(this.attrs,{challengeResponses:e});this.put(p.joinUrlFragments([this.clientApiUrl,"v1","payment_methods/",t.nonce]),i,function(t){return new f(t.paymentMethods[0])},n)},r.prototype.sendAnalyticsEvents=function(t,e){var i,r=this.analyticsUrl,o=[];if(t=p.isArray(t)?t:[t],!r)return void(e&&e.apply(null,[null,{}]));for(var a in t)t.hasOwnProperty(a)&&o.push({kind:t[a]});i=s(this.attrs,{analytics:o,_meta:{platform:"web",platformVersion:n.navigator.userAgent,integrationType:this.integration}}),this.post(r,i,function(t){return t},e)},e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./coinbase-account":66,"./credit-card":67,"./jsonp-driver":68,"./normalize-api-fields":70,"./parse-client-token":71,"./root-data":73,"./sepa-bank-account":74,"./sepa-mandate":75,"./util":76,"braintree-3ds":85,"braintree-utilities":104}],66:[function(t,e,n){arguments[4][3][0].apply(n,arguments)},{dup:3}],67:[function(t,e,n){arguments[4][4][0].apply(n,arguments)},{dup:4}],68:[function(t,e,n){arguments[4][5][0].apply(n,arguments)},{"./jsonp":69,dup:5}],69:[function(t,e,n){arguments[4][6][0].apply(n,arguments)},{"./util":76,dup:6}],70:[function(t,e,n){arguments[4][7][0].apply(n,arguments)},{dup:7}],71:[function(t,e,n){arguments[4][8][0].apply(n,arguments)},{"./polyfill":72,dup:8}],72:[function(t,e,n){arguments[4][9][0].apply(n,arguments)},{dup:9}],73:[function(t,e,n){arguments[4][10][0].apply(n,arguments)},{"braintree-rpc":93,dup:10}],74:[function(t,e,n){arguments[4][11][0].apply(n,arguments)},{dup:11}],75:[function(t,e,n){arguments[4][12][0].apply(n,arguments)},{dup:12}],76:[function(t,e,n){arguments[4][13][0].apply(n,arguments)},{dup:13}],77:[function(t,e,n){arguments[4][14][0].apply(n,arguments)},{"./lib/client":65,"./lib/jsonp":69,"./lib/jsonp-driver":68,"./lib/parse-client-token":71,"./lib/util":76,dup:14}],78:[function(t,e,n){arguments[4][15][0].apply(n,arguments)},{dup:15}],79:[function(t,e,n){arguments[4][16][0].apply(n,arguments)},{dup:16}],80:[function(t,e,n){arguments[4][17][0].apply(n,arguments)},{dup:17}],81:[function(t,e,n){arguments[4][18][0].apply(n,arguments)},{dup:18}],82:[function(t,e,n){arguments[4][19][0].apply(n,arguments)},{"./lib/dom":78,"./lib/events":79,"./lib/fn":80,"./lib/url":81,dup:19}],83:[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.1.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":87,"braintree-utilities":82}],84:[function(t,e){"use strict";function n(t,e){e=e||{},this.clientToken=e.clientToken,this.container=e.container,this.api=t,this.nonce=null}var i=t("braintree-utilities"),r=t("./authorization_service");n.prototype.verify=function(t,e){if(!i.isFunction(e))throw this.api.sendAnalyticsEvents("3ds.web.no_callback"),new Error("No suitable callback argument was given");var n={nonce:"",amount:t.amount},r=t.creditCard;if("string"==typeof r)n.nonce=r,this.api.sendAnalyticsEvents("3ds.web.verify.nonce"),this.startVerification(n,e);else{var o=this,s=function(t,i){return t?e(t):(n.nonce=i,void o.startVerification(n,e))};this.api.sendAnalyticsEvents("3ds.web.verify.credit_card"),this.api.tokenizeCard(r,s)}},n.prototype.startVerification=function(t,e){this.api.lookup3DS(t,i.bind(this.handleLookupResponse(e),this))},n.prototype.handleLookupResponse=function(t){var e=this;return function(n,o){var s;n?t(n.error):o.lookup&&o.lookup.acsUrl&&o.lookup.acsUrl.length>0?(e.nonce=o.paymentMethod.nonce,s=new r(this.clientToken.assetsUrl,this.container),s.get(o.lookup,i.bind(this.handleAuthenticationResponse(t),this))):(e.nonce=o.paymentMethod.nonce,t(null,{nonce:e.nonce,verificationDetails:o.threeDSecureInfo}))}},n.prototype.handleAuthenticationResponse=function(t){return function(e){var n,r=i.decodeQueryString(e);r.user_closed||(n=JSON.parse(r.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))}},e.exports=n},{"./authorization_service":83,"braintree-utilities":82}],85:[function(t,e,n){arguments[4][22][0].apply(n,arguments)},{"./client":84,"./vendor/json2":86,dup:22}],86:[function(t,e,n){arguments[4][23][0].apply(n,arguments)},{dup:23}],87:[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){t(n.data),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":82}],88:[function(t,e,n){arguments[4][25][0].apply(n,arguments)},{"braintree-utilities":98,dup:25}],89:[function(t,e,n){arguments[4][26][0].apply(n,arguments)},{"braintree-utilities":98,dup:26}],90:[function(t,e,n){arguments[4][27][0].apply(n,arguments)},{dup:27}],91:[function(t,e,n){arguments[4][28][0].apply(n,arguments)},{"braintree-utilities":98,dup:28}],92:[function(t,e,n){arguments[4][29][0].apply(n,arguments)},{"braintree-utilities":98,dup:29}],93:[function(t,e,n){arguments[4][30][0].apply(n,arguments)},{"./lib/message-bus":88,"./lib/pubsub-client":89,"./lib/pubsub-server":90,"./lib/rpc-client":91,"./lib/rpc-server":92,dup:30}],94:[function(t,e,n){arguments[4][31][0].apply(n,arguments)},{dup:31}],95:[function(t,e,n){arguments[4][32][0].apply(n,arguments)},{dup:32}],96:[function(t,e,n){arguments[4][33][0].apply(n,arguments)},{dup:33}],97:[function(t,e,n){arguments[4][18][0].apply(n,arguments)},{dup:18}],98:[function(t,e,n){arguments[4][19][0].apply(n,arguments)},{"./lib/dom":94,"./lib/events":95,"./lib/fn":96,"./lib/url":97,dup:19}],99:[function(t,e,n){arguments[4][15][0].apply(n,arguments)},{dup:15}],100:[function(t,e,n){arguments[4][16][0].apply(n,arguments)},{dup:16}],101:[function(t,e,n){arguments[4][17][0].apply(n,arguments)},{dup:17}],102:[function(t,e,n){arguments[4][39][0].apply(n,arguments)},{dup:39}],103:[function(t,e,n){arguments[4][18][0].apply(n,arguments)},{dup:18}],104:[function(t,e,n){arguments[4][41][0].apply(n,arguments)},{"./lib/dom":99,"./lib/events":100,"./lib/fn":101,"./lib/string":102,"./lib/url":103,dup:41}],105:[function(t,e,n){arguments[4][42][0].apply(n,arguments)},{"./lib/events":106,dup:42,framebus:107}],106:[function(t,e,n){arguments[4][43][0].apply(n,arguments)},{dup:43}],107:[function(t,e,n){arguments[4][44][0].apply(n,arguments)},{dup:44}],108:[function(t,e,n){arguments[4][2][0].apply(n,arguments)},{"./coinbase-account":109,"./credit-card":110,"./jsonp-driver":111,"./normalize-api-fields":113,"./parse-client-token":114,"./root-data":116,"./sepa-bank-account":117,"./sepa-mandate":118,"./util":119,"braintree-3ds":128,"braintree-utilities":147,dup:2}],109:[function(t,e,n){arguments[4][3][0].apply(n,arguments)},{dup:3}],110:[function(t,e,n){arguments[4][4][0].apply(n,arguments)},{dup:4}],111:[function(t,e,n){arguments[4][5][0].apply(n,arguments)},{"./jsonp":112,dup:5}],112:[function(t,e,n){arguments[4][6][0].apply(n,arguments)},{"./util":119,dup:6}],113:[function(t,e,n){arguments[4][7][0].apply(n,arguments)},{dup:7}],114:[function(t,e,n){arguments[4][8][0].apply(n,arguments)},{"./polyfill":115,dup:8}],115:[function(t,e,n){arguments[4][9][0].apply(n,arguments)},{dup:9}],116:[function(t,e,n){arguments[4][10][0].apply(n,arguments)},{"braintree-rpc":136,dup:10}],117:[function(t,e,n){arguments[4][11][0].apply(n,arguments)},{dup:11}],118:[function(t,e,n){arguments[4][12][0].apply(n,arguments)},{dup:12}],119:[function(t,e,n){arguments[4][13][0].apply(n,arguments)},{dup:13}],120:[function(t,e,n){arguments[4][14][0].apply(n,arguments)},{"./lib/client":108,"./lib/jsonp":112,"./lib/jsonp-driver":111,"./lib/parse-client-token":114,"./lib/util":119,dup:14}],121:[function(t,e,n){arguments[4][15][0].apply(n,arguments)},{dup:15}],122:[function(t,e,n){arguments[4][16][0].apply(n,arguments)},{dup:16}],123:[function(t,e,n){arguments[4][17][0].apply(n,arguments)},{dup:17}],124:[function(t,e,n){arguments[4][18][0].apply(n,arguments)},{dup:18}],125:[function(t,e,n){arguments[4][19][0].apply(n,arguments)},{"./lib/dom":121,"./lib/events":122,"./lib/fn":123,"./lib/url":124,dup:19}],126:[function(t,e,n){arguments[4][20][0].apply(n,arguments)},{"../shared/receiver":130,"braintree-utilities":125,dup:20}],127:[function(t,e,n){arguments[4][21][0].apply(n,arguments)},{"./authorization_service":126,"braintree-utilities":125,dup:21}],128:[function(t,e,n){arguments[4][22][0].apply(n,arguments)},{"./client":127,"./vendor/json2":129,dup:22}],129:[function(t,e,n){arguments[4][23][0].apply(n,arguments)},{dup:23}],130:[function(t,e,n){arguments[4][24][0].apply(n,arguments)},{"braintree-utilities":125,dup:24}],131:[function(t,e,n){arguments[4][25][0].apply(n,arguments)},{"braintree-utilities":141,dup:25}],132:[function(t,e,n){arguments[4][26][0].apply(n,arguments)},{"braintree-utilities":141,dup:26}],133:[function(t,e,n){arguments[4][27][0].apply(n,arguments)},{dup:27}],134:[function(t,e,n){arguments[4][28][0].apply(n,arguments)},{"braintree-utilities":141,dup:28}],135:[function(t,e,n){arguments[4][29][0].apply(n,arguments)},{"braintree-utilities":141,dup:29}],136:[function(t,e,n){arguments[4][30][0].apply(n,arguments)},{"./lib/message-bus":131,"./lib/pubsub-client":132,"./lib/pubsub-server":133,"./lib/rpc-client":134,"./lib/rpc-server":135,dup:30}],137:[function(t,e,n){arguments[4][31][0].apply(n,arguments)},{dup:31}],138:[function(t,e,n){arguments[4][32][0].apply(n,arguments)},{dup:32}],139:[function(t,e,n){arguments[4][33][0].apply(n,arguments)},{dup:33}],140:[function(t,e,n){arguments[4][18][0].apply(n,arguments)},{dup:18}],141:[function(t,e,n){arguments[4][19][0].apply(n,arguments)},{"./lib/dom":137,"./lib/events":138,"./lib/fn":139,"./lib/url":140,dup:19}],142:[function(t,e,n){arguments[4][15][0].apply(n,arguments)},{dup:15}],143:[function(t,e,n){arguments[4][16][0].apply(n,arguments)},{dup:16}],144:[function(t,e,n){arguments[4][17][0].apply(n,arguments)},{dup:17}],145:[function(t,e,n){arguments[4][39][0].apply(n,arguments)},{dup:39}],146:[function(t,e,n){arguments[4][18][0].apply(n,arguments)},{dup:18}],147:[function(t,e,n){arguments[4][41][0].apply(n,arguments)},{"./lib/dom":142,"./lib/events":143,"./lib/fn":144,"./lib/string":145,"./lib/url":146,dup:41}],148:[function(t,e,n){arguments[4][25][0].apply(n,arguments)},{"braintree-utilities":158,dup:25}],149:[function(t,e,n){arguments[4][26][0].apply(n,arguments)},{"braintree-utilities":158,dup:26}],150:[function(t,e,n){arguments[4][27][0].apply(n,arguments)},{dup:27}],151:[function(t,e,n){arguments[4][28][0].apply(n,arguments)},{"braintree-utilities":158,dup:28}],152:[function(t,e,n){arguments[4][29][0].apply(n,arguments)},{"braintree-utilities":158,dup:29}],153:[function(t,e,n){arguments[4][30][0].apply(n,arguments)},{"./lib/message-bus":148,"./lib/pubsub-client":149,"./lib/pubsub-server":150,"./lib/rpc-client":151,"./lib/rpc-server":152,dup:30}],154:[function(t,e,n){arguments[4][31][0].apply(n,arguments)},{dup:31}],155:[function(t,e,n){arguments[4][32][0].apply(n,arguments)},{dup:32}],156:[function(t,e,n){arguments[4][33][0].apply(n,arguments)},{dup:33}],157:[function(t,e,n){arguments[4][18][0].apply(n,arguments)},{dup:18}],158:[function(t,e,n){arguments[4][19][0].apply(n,arguments)},{"./lib/dom":154,"./lib/events":155,"./lib/fn":156,"./lib/url":157,dup:19}],159:[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}},{}],160:[function(t,e,n){arguments[4][15][0].apply(n,arguments)},{dup:15}],161:[function(t,e,n){arguments[4][16][0].apply(n,arguments)},{dup:16}],162:[function(t,e,n){arguments[4][17][0].apply(n,arguments)},{dup:17}],163:[function(t,e,n){arguments[4][39][0].apply(n,arguments)},{dup:39}],164:[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":159}],165:[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");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,bind:r.bind,isFunction:r.isFunction}},{"./lib/array":159,"./lib/dom":160,"./lib/events":161,"./lib/fn":162,"./lib/string":163,"./lib/url":164}],166:[function(t,e){function n(t){var e=window.getComputedStyle?getComputedStyle(t):t.currentStyle;return{overflow:e.overflow||"",height:t.style.height||""}}function i(){return{html:{node:document.documentElement,styles:n(document.documentElement)},body:{node:document.body,styles:n(document.body)}}}function r(t,e){if(!t)throw new Error('Parameter "clientToken" cannot be null');e=e||{},this._clientToken=o.parseClientToken(t),this._clientOptions=e,this.container=e.container,this.merchantPageDefaultStyles=null,this.paymentMethodNonceInputField=e.paymentMethodNonceInputField,this.frame=null,this.popup=null,this.insertFrameFunction=e.insertFrame,this.onSuccess=e.onSuccess,this.onCancelled=e.onCancelled,this.onUnsupported=e.onUnsupported,this.loggedInView=null,this.loggedOutView=null,this.insertUI=!0}var o=t("braintree-api"),s=t("braintree-rpc"),a=t("braintree-utilities"),u=t("./logged-in-view"),c=t("./logged-out-view"),l=t("./overlay-view"),p=t("../shared/util/browser"),h=t("../shared/util/dom"),d=t("../shared/constants"),f=t("../shared/util/util"),m=t("../shared/get-locale");r.prototype.getViewerUrl=function(){var t=this._clientToken.paypal.assetsUrl;return t+"/pwpp/"+d.VERSION+"/html/braintree-frame.html"},r.prototype.getProxyUrl=function(){var t=this._clientToken.paypal.assetsUrl;return t+"/pwpp/"+d.VERSION+"/html/proxy-frame.html"},r.prototype.initialize=function(){if(!this._clientToken.paypalEnabled)return void("function"==typeof this.onUnsupported&&this.onUnsupported(new Error("PayPal is not enabled")));if(!this._isBrowserSecure())return void("function"==typeof this.onUnsupported&&this.onUnsupported(new Error("unsupported protocol detected")));if(this._isAriesCapable()){if(!this._isAriesSupportedCurrency())return void("function"==typeof this.onUnsupported&&this.onUnsupported(new Error("This PayPal integration does not support this currency")));if(!this._isAriesSupportedCountries())return void("function"==typeof this.onUnsupported&&this.onUnsupported(new Error("This PayPal integration does not support this locale")))}return this._isMisconfiguredUnvettedMerchant()?void("function"==typeof this.onUnsupported&&this.onUnsupported(new Error("Unvetted merchant client token does not include a payee email"))):(this._overrideClientTokenProperties(),p.isProxyFrameRequired()&&this._insertProxyFrame(),this._setupDomElements(),this._setupPaymentMethodNonceInputField(),this._setupViews(),void this._createRpcServer())},r.prototype._isSupportedOption=function(t,e){for(var n=e.length,i=!1,r=0;n>r;r++)t.toLowerCase()===e[r].toLowerCase()&&(i=!0);return i},r.prototype._isAriesSupportedCurrency=function(){return this._isSupportedOption(this._clientOptions.currency,d.ARIES_SUPPORTED_CURRENCIES)},r.prototype._isAriesSupportedCountries=function(){return this._isSupportedOption(m(this._clientOptions.locale).split("_")[1],d.ARIES_SUPPORTED_COUNTRIES)},r.prototype._isMisconfiguredUnvettedMerchant=function(){return this._clientToken.paypal.unvettedMerchant&&(!this._isAriesCapable()||!this._clientToken.paypal.payeeEmail)},r.prototype._isBrowserSecure=function(){return a.isBrowserHttps()||p.isPopupSupported()||this._clientToken.paypal.allowHttp},r.prototype._overrideClientTokenProperties=function(){this._clientOptions.displayName&&(this._clientToken.paypal.displayName=this._clientOptions.displayName)},r.prototype._setupDomElements=function(){this.insertUI&&(this.container=a.normalizeElement(this.container))},r.prototype._setupPaymentMethodNonceInputField=function(){if(this.insertUI){var t=this.paymentMethodNonceInputField;a.isFunction(t)||(t=void 0!==t?a.normalizeElement(t):this._createPaymentMethodNonceInputField(),this.paymentMethodNonceInputField=t)}},r.prototype._setupViews=function(){var t=this._clientToken.paypal.assetsUrl;this.insertUI&&(this.loggedInView=new u({container:this.container,assetsUrl:t}),this.loggedOutView=new c({assetsUrl:t,container:this.container,isCheckout:this._isAriesCapable(),locale:this._clientOptions.locale,merchantId:"merchantId"}),a.addEventListener(this.loggedOutView.container,"click",a.bind(this._handleContainerClick,this)),a.addEventListener(this.loggedInView.logoutNode,"click",a.bind(this._handleLogout,this)))},r.prototype._createRpcServer=function(){var t=new s.MessageBus(window),e=new s.RPCServer(t,window);e.define("getClientToken",a.bind(this._handleGetClientToken,this)),e.define("getClientOptions",a.bind(this._handleGetClientOptions,this)),e.define("closePayPalModal",a.bind(this._handleCloseMessage,this)),e.define("receivePayPalData",a.bind(this._handleSuccessfulAuthentication,this))},r.prototype._createPaymentMethodNonceInputField=function(){var t=document.createElement("input");return t.name="payment_method_nonce",t.type="hidden",this.container.appendChild(t)},r.prototype._createFrame=function(){var t,e=document.createElement("iframe");return this._isAriesCapable()?(t=d.ARIES_FRAME_NAME,e.style.background="#FFFFFF"):t=d.FRAME_NAME,e.src=this.getViewerUrl(),e.id=t,e.name=t,e.allowTransparency=!0,e.height="100%",e.width="100%",e.frameBorder=0,e.style.position=p.isMobile()?"absolute":"fixed",e.style.top=0,e.style.left=0,e.style.bottom=0,e.style.zIndex=20001,e.style.padding=0,e.style.margin=0,e.style.border=0,e.style.outline="none",e
|
4 |
-
},r.prototype._removeFrame=function(t){t=t||document.body,this.frame&&t.contains(this.frame)&&(t.removeChild(this.frame),this._unlockMerchantWindowSize())},r.prototype._insertFrame=function(){this.insertFrameFunction?this.insertFrameFunction(this.getViewerUrl()):(this.frame=this._createFrame(),document.body.appendChild(this.frame)),this._lockMerchantWindowSize()},r.prototype._handleContainerClick=function(t){function e(t){return t.className.match(/paypal-button(?!-widget)/)||"braintree-paypal-button"===t.id}var n=t.target||t.srcElement;(e(n)||e(n.parentNode))&&(t.preventDefault?t.preventDefault():t.returnValue=!1,this._open())},r.prototype._setMerchantPageDefaultStyles=function(){this.merchantPageDefaultStyles=i()},r.prototype._open=function(){this._isAriesCapable()&&this._addCorrelationIdToClientToken(),p.isPopupSupported()?this._openPopup():this._openModal()},r.prototype._close=function(){p.isPopupSupported()?this._closePopup():this._closeModal()},r.prototype._openModal=function(){this._removeFrame(),this._insertFrame()},r.prototype._isAriesCapable=function(){return!(!this._clientOptions.singleUse||!this._clientOptions.amount||!this._clientOptions.currency||this._clientOptions.demo)},r.prototype._openPopup=function(){var t,e,n,i=[],r=window.outerWidth||document.documentElement.clientWidth,o=window.outerHeight||document.documentElement.clientHeight,s="undefined"==typeof window.screenY?window.screenTop:window.screenY,a="undefined"==typeof window.screenX?window.screenLeft:window.screenX;this._isAriesCapable()?(t=d.ARIES_POPUP_NAME,n=d.ARIES_POPUP_HEIGHT,e=d.ARIES_POPUP_WIDTH):(t=d.POPUP_NAME,n=d.POPUP_HEIGHT,e=d.POPUP_WIDTH);var u=(r-e)/2+a,c=(o-n)/2+s;return i.push("height="+n),i.push("width="+e),i.push("top="+c),i.push("left="+u),i.push(d.POPUP_OPTIONS),this.popup=window.open(this.getViewerUrl(),t,i.join(",")),p.isOverlaySupported()&&(this.overlayView=new l(this.popup,this._clientToken.paypal.assetsUrl),this.overlayView.render()),this.popup.focus(),this.popup},r.prototype._addCorrelationIdToClientToken=function(){this._clientToken.correlationId=f.generateUid()},r.prototype._createProxyFrame=function(){var t=document.createElement("iframe");return t.src=this.getProxyUrl(),t.id=d.BRIDGE_FRAME_NAME,t.name=d.BRIDGE_FRAME_NAME,t.allowTransparency=!0,t.height=0,t.width=0,t.frameBorder=0,t.style.position="static",t.style.padding=0,t.style.margin=0,t.style.border=0,t.style.outline="none",t},r.prototype._insertProxyFrame=function(){this.proxyFrame=this._createProxyFrame(),document.body.appendChild(this.proxyFrame)},r.prototype._closeModal=function(){this._removeFrame()},r.prototype._closePopup=function(){this.popup&&(this.popup.close(),this.popup=null),this.overlayView&&p.isOverlaySupported()&&this.overlayView.remove()},r.prototype._clientTokenData=function(){return{analyticsUrl:this._clientToken.analytics?this._clientToken.analytics.url:void 0,authorizationFingerprint:this._clientToken.authorizationFingerprint,authUrl:this._clientToken.authUrl,clientApiUrl:this._clientToken.clientApiUrl,displayName:this._clientToken.paypal.displayName,paypalBaseUrl:this._clientToken.paypal.assetsUrl,paypalClientId:this._clientToken.paypal.clientId,paypalPrivacyUrl:this._clientToken.paypal.privacyUrl,paypalUserAgreementUrl:this._clientToken.paypal.userAgreementUrl,unvettedMerchant:this._clientToken.paypal.unvettedMerchant,payeeEmail:this._clientToken.paypal.payeeEmail,correlationId:this._clientToken.correlationId,offline:this._clientOptions.offline||this._clientToken.paypal.environmentNoNetwork}},r.prototype._handleGetClientToken=function(t){t(this._clientTokenData())},r.prototype._clientOptionsData=function(){return{demo:this._clientOptions.demo||!1,locale:this._clientOptions.locale||"en_us",onetime:this._clientOptions.singleUse||!1,integration:this._clientOptions.integration||"paypal",enableShippingAddress:this._clientOptions.enableShippingAddress||!1,enableAries:this._isAriesCapable(),amount:this._clientOptions.amount||null,currency:this._clientOptions.currency||null,shippingAddressOverride:this._clientOptions.shippingAddressOverride||null}},r.prototype._handleGetClientOptions=function(t){t(this._clientOptionsData())},r.prototype._handleSuccessfulAuthentication=function(t){this._close(),t.type=d.NONCE_TYPE,a.isFunction(this.paymentMethodNonceInputField)?this.paymentMethodNonceInputField(t.nonce):(this._showLoggedInContent(t.details.email),this._setNonceInputValue(t.nonce)),a.isFunction(this.onSuccess)&&this.onSuccess(t)},r.prototype._lockMerchantWindowSize=function(){this._setMerchantPageDefaultStyles(),document.documentElement.style.height="100%",document.documentElement.style.overflow="hidden",document.body.style.height="100%",document.body.style.overflow="hidden"},r.prototype._unlockMerchantWindowSize=function(){this.merchantPageDefaultStyles&&(document.documentElement.style.height=this.merchantPageDefaultStyles.html.styles.height,document.documentElement.style.overflow=this.merchantPageDefaultStyles.html.styles.overflow,document.body.style.height=this.merchantPageDefaultStyles.body.styles.height,document.body.style.overflow=this.merchantPageDefaultStyles.body.styles.overflow)},r.prototype._handleCloseMessage=function(){this._removeFrame()},r.prototype._showLoggedInContent=function(t){this.loggedOutView.hide(),h.setTextContent(this.loggedInView.emailNode,t),this.loggedInView.show()},r.prototype._handleLogout=function(t){t.preventDefault?t.preventDefault():t.returnValue=!1,this.loggedInView.hide(),this.loggedOutView.show(),this._setNonceInputValue(""),a.isFunction(this.onCancelled)&&this.onCancelled()},r.prototype._setNonceInputValue=function(t){this.paymentMethodNonceInputField.value=t},e.exports=r},{"../shared/constants":170,"../shared/get-locale":172,"../shared/util/browser":177,"../shared/util/dom":178,"../shared/util/util":179,"./logged-in-view":167,"./logged-out-view":168,"./overlay-view":169,"braintree-api":120,"braintree-rpc":153,"braintree-utilities":165}],167:[function(t,e){function n(t){this.options=t,this.container=this.createViewContainer(),this.createPayPalName(),this.emailNode=this.createEmailNode(),this.logoutNode=this.createLogoutNode()}var i=t("../shared/constants");n.prototype.createViewContainer=function(){var t=document.createElement("div");t.id="braintree-paypal-loggedin";var e=["display: none","max-width: 500px","overflow: hidden","padding: 16px","background-image: url("+this.options.assetsUrl+"/pwpp/"+i.VERSION+"/images/paypal-small.png)","background-image: url("+this.options.assetsUrl+"/pwpp/"+i.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(";");return t.style.cssText=e,this.options.container.appendChild(t),t},n.prototype.createPayPalName=function(){var t=document.createElement("span");t.id="bt-pp-name",t.innerHTML="PayPal";var e=["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 t.style.cssText=e,this.container.appendChild(t)},n.prototype.createEmailNode=function(){var t=document.createElement("span");t.id="bt-pp-email";var e=["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(";");return t.style.cssText=e,this.container.appendChild(t)},n.prototype.createLogoutNode=function(){var t=document.createElement("button");t.id="bt-pp-cancel",t.innerHTML="Cancel";var e=["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(";");return t.style.cssText=e,this.container.appendChild(t)},n.prototype.show=function(){this.container.style.display="block"},n.prototype.hide=function(){this.container.style.display="none"},e.exports=n},{"../shared/constants":170}],168:[function(t,e){function n(t){this.options=t,this.assetsUrl=this.options.assetsUrl,this.container=this.createViewContainer(),this.options.isCheckout?this.createCheckoutWithPayPalButton():this.createPayWithPayPalButton()}var i=(t("braintree-utilities"),t("../shared/constants")),r=t("../shared/get-locale");n.prototype.createViewContainer=function(){var t=document.createElement("div");return t.id="braintree-paypal-loggedout",this.options.container.appendChild(t),t},n.prototype.createPayWithPayPalButton=function(){var t=document.createElement("a");t.id="braintree-paypal-button",t.href="#";var e=["display: block","width: 115px","height: 44px","overflow: hidden"].join(";");t.style.cssText=e;var n=new Image;n.src=this.assetsUrl+"/pwpp/"+i.VERSION+"/images/pay-with-paypal.png",n.setAttribute("alt","Pay with PayPal");var r=["max-width: 100%","display: block","width: 100%","height: 100%","outline: none","border: 0"].join(";");n.style.cssText=r,t.appendChild(n),this.container.appendChild(t)},n.prototype.createCheckoutWithPayPalButton=function(){var t=document.createElement("script");t.src="//www.paypalobjects.com/api/button.js",t.async=!0,t.setAttribute("data-merchant",this.options.merchantId),t.setAttribute("data-button","checkout"),t.setAttribute("data-type","button"),t.setAttribute("data-width","150"),t.setAttribute("data-height","44"),t.setAttribute("data-lc",r(this.options.locale)),this.container.appendChild(t)},n.prototype.show=function(){this.container.style.display="block"},n.prototype.hide=function(){this.container.style.display="none"},e.exports=n},{"../shared/constants":170,"../shared/get-locale":172,"braintree-utilities":165}],169:[function(t,e){function n(t,e){this.popup=t,this.assetsUrl=e,this.spriteSrc=this.assetsUrl+"/pwpp/"+r.VERSION+"/images/pp_overlay_sprite.png",this._create(),this._setupEvents(),this._pollForPopup()}var i=t("braintree-utilities"),r=t("../shared/constants");n.prototype.render=function(){document.body.contains(this.el)||document.body.appendChild(this.el)},n.prototype.remove=function(){document.body.contains(this.el)&&document.body.removeChild(this.el)},n.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())},n.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},n.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},n.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},n.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},n.prototype._createFocusLink=function(){return this.focusLink=document.createElement("a"),this._setStyles(this.focusLink,["color: #009be1","cursor: pointer"]),this.focusLink.innerHTML="Continue",this.focusLink},n.prototype._setStyles=function(t,e){var n=e.join(";");t.style.cssText=n},n.prototype._setupEvents=function(){i.addEventListener(this.closeIcon,"click",i.bind(this._handleClose,this)),i.addEventListener(this.focusLink,"click",i.bind(this._handleFocus,this))},n.prototype._handleClose=function(t){t.preventDefault(),this.remove(),this.popup.close()},n.prototype._handleFocus=function(t){t.preventDefault(),this.popup.focus()},n.prototype._pollForPopup=function(){var t=setInterval(i.bind(function(){this.popup&&this.popup.closed&&(clearInterval(t),this.remove())},this),100)},e.exports=n},{"../shared/constants":170,"braintree-utilities":165}],170:[function(t,e,n){var i="1.3.4";n.VERSION=i,n.POPUP_NAME="braintree_paypal_popup",n.ARIES_POPUP_NAME="PPFrameRedirect",n.FRAME_NAME="braintree-paypal-frame",n.ARIES_FRAME_NAME="PPFrameRedirect",n.POPUP_PATH="/pwpp/"+i+"/html/braintree-frame.html",n.POPUP_OPTIONS="resizable,scrollbars",n.POPUP_HEIGHT=470,n.POPUP_WIDTH=410,n.ARIES_POPUP_HEIGHT=535,n.ARIES_POPUP_WIDTH=450,n.BRIDGE_FRAME_NAME="bt-proxy-frame",n.ARIES_SUPPORTED_CURRENCIES=["USD","GBP","EUR","AUD","CAD"],n.ARIES_SUPPORTED_COUNTRIES=["US","GB","AU","CA","ES","FR","DE","IT"],n.NONCE_TYPE="PayPalAccount",n.ILLEGAL_XHR_ERROR="Illegal XHR request attempted"},{}],171:[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"}},{}],172:[function(t,e){"use strict";function n(t){return-1!==t.indexOf("_")&&5===t.length}function i(t){var e;for(var n in o)o.hasOwnProperty(n)&&(n===t?e=o[n]:o[n]===t&&(e=o[n]));return e}function r(t){var e;if(t=t?t.toLowerCase():"us",t=t.replace(/-/g,"_"),e=n(t)?t:i(t)){var r=e.split("_");return[r[0],r[1].toUpperCase()].join("_")}return"en_US"}var o=t("../shared/data/country-code-lookup");e.exports=r},{"../shared/data/country-code-lookup":171}],173:[function(t,e){function n(){return c.matchUserAgent("Android")&&!i()}function i(){return c.matchUserAgent("Chrome")||c.matchUserAgent("CriOS")}function r(){return c.matchUserAgent("Firefox")}function o(){return c.matchUserAgent("Trident")||c.matchUserAgent("MSIE")}function s(){return c.matchUserAgent("Opera")||c.matchUserAgent("OPR")}function a(){return s()&&"[object OperaMini]"===l.call(window.operamini)}function u(){return c.matchUserAgent("Safari")&&!i()&&!n()}var c=t("./useragent"),l=Object.prototype.toString;e.exports={isAndroid:n,isChrome:i,isFirefox:r,isIE:o,isOpera:s,isOperaMini:a,isSafari:u}},{"./useragent":176}],174:[function(t,e){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":175,"./useragent":176}],175:[function(t,e){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":176}],176:[function(t,e,n){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},{}],177:[function(t,e){function n(){return i()&&window.outerWidth<600}function i(){return f.test(d)}function r(){return!!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!0;if(p.isIos())return c.isSafari()&&h.matchUserAgent(/OS (?:8_1|8_0|8)(?!_\d)/i)||c.isChrome()?!1:!0}return!1}function s(){if(c.isIE()&&h.matchUserAgent(/MSIE 8\.0/))return!1;try{return window.self===window.top}catch(t){return!1}}function a(){return c.isIE()&&!u()}function u(){var t=null,e="";try{new ActiveXObject("")}catch(n){e=n.name}try{t=!!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,isProxyFrameRequired:a}},{"../useragent/browser":173,"../useragent/device":174,"../useragent/platform":175,"../useragent/useragent":176}],178:[function(t,e){function n(t,e){var n="innerText";document&&document.body&&"textContent"in document.body&&(n="textContent"),t[n]=e}e.exports={setTextContent:n}},{}],179:[function(t,e){function n(){for(var t="",e=0;32>e;e++){var n=Math.floor(16*Math.random());t+=n.toString(16)}return t}function i(t){return/^(true|1)$/i.test(t)}function r(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/\"/g,""").replace(/\'/g,"'")}function o(t){var e=t.indexOf("?"),n={};if(e>=0&&(t=t.substr(e+1)),0!==t.length){for(var i=t.split("&"),r=0,o=i.length;o>r;r++){var s=i[r],a=s.indexOf("="),u=s.substr(0,a),c=s.substr(a+1),l=decodeURIComponent(c);l=l.replace(/</g,"<").replace(/>/g,">"),"false"===l&&(l=!1),(void 0===l||"true"===l)&&(l=!0),n[u]=l}return n}}function s(t){return t&&"[object Function]"===Object.prototype.toString.call(t)}var a="function"==typeof String.prototype.trim?function(t){return t.trim()}:function(t){return t.replace(/^\s+|\s+$/,"")},u="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:a,btoa:u,generateUid:n,castToBoolean:i,htmlEscape:r,parseUrlParams:o,isFunction:s}},{}],180:[function(t,e,n){arguments[4][25][0].apply(n,arguments)},{"braintree-utilities":190,dup:25}],181:[function(t,e,n){arguments[4][26][0].apply(n,arguments)},{"braintree-utilities":190,dup:26}],182:[function(t,e,n){arguments[4][27][0].apply(n,arguments)},{dup:27}],183:[function(t,e,n){arguments[4][28][0].apply(n,arguments)},{"braintree-utilities":190,dup:28}],184:[function(t,e,n){arguments[4][29][0].apply(n,arguments)},{"braintree-utilities":190,dup:29}],185:[function(t,e,n){arguments[4][30][0].apply(n,arguments)},{"./lib/message-bus":180,"./lib/pubsub-client":181,"./lib/pubsub-server":182,"./lib/rpc-client":183,"./lib/rpc-server":184,dup:30}],186:[function(t,e,n){arguments[4][31][0].apply(n,arguments)},{dup:31}],187:[function(t,e,n){arguments[4][32][0].apply(n,arguments)},{dup:32}],188:[function(t,e,n){arguments[4][33][0].apply(n,arguments)},{dup:33}],189:[function(t,e,n){arguments[4][18][0].apply(n,arguments)},{dup:18}],190:[function(t,e,n){arguments[4][19][0].apply(n,arguments)},{"./lib/dom":186,"./lib/events":187,"./lib/fn":188,"./lib/url":189,dup:19}],191:[function(t,e,n){arguments[4][15][0].apply(n,arguments)},{dup:15}],192:[function(t,e,n){arguments[4][16][0].apply(n,arguments)},{dup:16}],193:[function(t,e,n){arguments[4][17][0].apply(n,arguments)},{dup:17}],194:[function(t,e,n){arguments[4][18][0].apply(n,arguments)},{dup:18}],195:[function(t,e,n){arguments[4][19][0].apply(n,arguments)},{"./lib/dom":191,"./lib/events":192,"./lib/fn":193,"./lib/url":194,dup:19}],196:[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},{}],197:[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:s.style.height||"",overflow:n(s,"overflow"),position:n(s,"position")},body:{height:a.style.height||"",overflow:n(a,"overflow")}}}function r(){var t=/Android|iPhone|iPod|iPad/i.test(window.navigator.userAgent);return t}function o(t){var e,n,i;this.encodedClientToken=t.clientToken,this.paypalOptions=t.paypal,this.container=null,this.merchantFormManager=null,this.root=t.root,this.configurationRequests=[],this.braintreeApiClient=u.configure({clientToken:t.clientToken,integration:"dropin"}),this.paymentMethodNonceReceivedCallback=t.paymentMethodNonceReceived,this.clientToken=u.parseClientToken(t.clientToken),this.bus=new l.MessageBus(this.root),this.rpcServer=new l.RPCServer(this.bus),this.apiProxyServer=new h(this.braintreeApiClient),this.apiProxyServer.attach(this.rpcServer),e=t.inlineFramePath||this.clientToken.assetsUrl+"/dropin/"+g+"/inline-frame.html",n=t.modalFramePath||this.clientToken.assetsUrl+"/dropin/"+g+"/modal-frame.html",s=document.documentElement,a=document.body,this.frames={inline:this._createFrame(e,"braintree-dropin-frame"),modal:this._createFrame(n,"braintree-dropin-modal-frame")},this.container=p.normalizeElement(t.container,"Unable to find valid container."),i=p.normalizeElement(t.form||this._findClosest(this.container,"form")),this.merchantFormManager=new d({form:i,frames:this.frames,onSubmit:this.paymentMethodNonceReceivedCallback,apiClient:this.braintreeApiClient}).initialize(),this.clientToken.paypalEnabled&&this.clientToken.paypal&&(p.isBrowserHttps()||this.clientToken.paypal.allowHttp)&&this._configurePayPal(),this.braintreeApiClient.sendAnalyticsEvents("dropin.web.initialized")}var s,a,u=t("braintree-api"),c=t("braintree-bus"),l=t("braintree-rpc"),p=t("braintree-utilities"),h=t("./api-proxy-server"),d=t("./merchant-form-manager"),f=t("./frame-container"),m=t("../shared/paypal-service"),y=t("braintree-paypal/src/shared/util/browser"),g="1.3.7";o.prototype.initialize=function(){var t=this;this._initializeModal(),this.container.appendChild(this.frames.inline.element),a.appendChild(this.frames.modal.element),this.rpcServer.define("receiveSharedCustomerIdentifier",function(e){t.braintreeApiClient.attrs.sharedCustomerIdentifier=e,t.braintreeApiClient.attrs.sharedCustomerIdentifierType="browser_session_cookie_store";for(var n=0;n<t.configurationRequests.length;n++)t.configurationRequests[n](t.encodedClientToken);t.configurationRequests=[]}),c.on(c.events.PAYMENT_METHOD_GENERATED,p.bind(this._handleAltPayData,this)),this.rpcServer.define("getConfiguration",function(e){e({clientToken:t.encodedClientToken,merchantHttps:p.isBrowserHttps()})}),this.rpcServer.define("getPayPalOptions",function(e){e(t.paypalOptions)}),this.rpcServer.define("selectPaymentMethod",function(e){t.frames.modal.rpcClient.invoke("selectPaymentMethod",[e]),t._showModal()}),this.rpcServer.define("sendAddedPaymentMethod",function(e){t.merchantFormManager.setNoncePayload(e),t.frames.inline.rpcClient.invoke("receiveNewPaymentMethod",[e])}),this.rpcServer.define("sendUsedPaymentMethod",function(e){t.frames.inline.rpcClient.invoke("selectPaymentMethod",[e])}),this.rpcServer.define("sendUnlockedNonce",function(e){t.merchantFormManager.setNoncePayload(e)}),this.rpcServer.define("clearNonce",function(){t.merchantFormManager.clearNoncePayload()}),this.rpcServer.define("closeDropInModal",function(){t._hideModal()}),this.rpcServer.define("setInlineFrameHeight",function(e){t.frames.inline.element.style.height=e+"px"}),this.bus.register("ready",function(e){e.source===t.frames.inline.element.contentWindow?t.frames.inline.rpcClient=new l.RPCClient(t.bus,e.source):e.source===t.frames.modal.element.contentWindow&&(t.frames.modal.rpcClient=new l.RPCClient(t.bus,e.source))})},o.prototype._createFrame=function(t,e){return new f(t,e)},o.prototype._initializeModal=function(){this.frames.modal.element.style.display="none",this.frames.modal.element.style.position=r()?"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%"},o.prototype._lockMerchantWindowSize=function(){setTimeout(function(){s.style.overflow="hidden",a.style.overflow="hidden",a.style.height="100%",r()&&(s.style.position="relative",s.style.height=window.innerHeight+"px")},160)},o.prototype._unlockMerchantWindowSize=function(){var t=this.merchantPageDefaultStyles;a.style.height=t.body.height,a.style.overflow=t.body.overflow,s.style.overflow=t.html.overflow,r()&&(s.style.height=t.html.height,s.style.position=t.html.position)},o.prototype._showModal=function(){var t=this,e=this.frames.modal.element;this.merchantPageDefaultStyles=i(),e.style.display="block",this.frames.modal.rpcClient.invoke("open",[],function(){setTimeout(function(){t._lockMerchantWindowSize(),e.contentWindow.focus()},200)})},o.prototype._hideModal=function(){this._unlockMerchantWindowSize(),this.frames.modal.element.style.display="none"},o.prototype._configurePayPal=function(){y.isPopupSupported()||(this.ppClient=new m({clientToken:this.clientToken,paypal:this.paypalOptions}),this.rpcServer.define("openPayPalModal",p.bind(this.ppClient._openModal,this.ppClient))),this.rpcServer.define("receivePayPalData",p.bind(this._handleAltPayData,this))},o.prototype._handleAltPayData=function(t){this.merchantFormManager.setNoncePayload(t),this.frames.inline.rpcClient.invoke("receiveNewPaymentMethod",[t]),this.frames.modal.rpcClient.invoke("modalViewClose")},o.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},e.exports=o},{"../shared/paypal-service":201,"./api-proxy-server":196,"./frame-container":199,"./merchant-form-manager":200,"braintree-api":77,"braintree-bus":105,"braintree-paypal/src/shared/util/browser":177,"braintree-rpc":185,"braintree-utilities":195}],198:[function(t,e){"use strict";function n(t,e){e.clientToken=t;var n=new i(e);return n.initialize(),n}var i=t("./client"),r="1.3.7";e.exports={create:n,VERSION:r}},{"./client":197}],199:[function(t,e){"use strict";function n(t,e){this.element=document.createElement("iframe"),this.element.setAttribute("name",e),this.element.setAttribute("allowtransparency","true"),this.element.setAttribute("width","100%"),this.element.setAttribute("height","68"),this.element.setAttribute("style","-webkit-transition: height 210ms cubic-bezier(0.390, 0.575, 0.565, 1.000); -moz-transition: height 210ms cubic-bezier(0.390, 0.575, 0.565, 1.000); -ms-transition: height 210ms cubic-bezier(0.390, 0.575, 0.565, 1.000); -o-transition: height 210ms cubic-bezier(0.390, 0.575, 0.565, 1.000); transition: height 210ms cubic-bezier(0.390, 0.575, 0.565, 1.000);"),this.element.src=t,this.element.setAttribute("frameborder","0"),this.element.setAttribute("allowtransparency","true"),this.element.style.border="0",this.element.style.zIndex="9999"}e.exports=n},{}],200:[function(t,e){"use strict";function n(t){this.form=t.form,this.frames=t.frames,this.onSubmit=t.onSubmit,this.apiClient=t.apiClient}var i=t("braintree-utilities");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(){if(!this.form.payment_method_nonce){var t=document.createElement("input");t.type="hidden",t.name="payment_method_nonce",this.form.appendChild(t)}this.nonceField=this.form.payment_method_nonce},n.prototype._setEvents=function(){var t=this;i.addEventListener(this.form,"submit",function(){t._handleFormSubmit.apply(t,arguments)})},n.prototype._handleFormSubmit=function(t){this._shouldSubmit()||(t&&t.preventDefault?t.preventDefault():t.returnValue=!1,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._shouldSubmit=function(){return this._isCallbackBased()?!1:this.nonceField.value.length>0},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(){this.frames.inline.rpcClient.invoke("clearLoadingState")},this),200)},this)):this._triggerFormSubmission()},n.prototype._triggerFormSubmission=function(){this.nonceField.value=this.noncePayload.nonce,this.apiClient.sendAnalyticsEvents("dropin.web.end.auto-submit",i.bind(function(){"function"==typeof this.form.submit?this.form.submit():this.form.querySelector('[type="submit"]').click()},this))},e.exports=n},{"braintree-utilities":195}],201:[function(t,e){"use strict";function n(t){var e=t.clientToken,n=t.paypal||{},r=new i(e,{container:document.createElement("div"),displayName:n.displayName,locale:n.locale,singleUse:n.singleUse,amount:n.amount,currency:n.currency,onSuccess:n.onSuccess,enableShippingAddress:n.enableShippingAddress,shippingAddressOverride:n.shippingAddressOverride});return r.initialize(),r}var i=t("braintree-paypal/src/external/client");e.exports=n},{"braintree-paypal/src/external/client":166}],202:[function(t,e){"use strict";function n(t,e,n){this.client=t,this.htmlForm=e,this.paymentMethodNonceInput=n,this.setNonce({}),this.hijackForm()}var i=t("braintree-utilities");n.prototype.hijackForm=function(){this.onSubmitHandler=i.bind(this.handleSubmit,this),i.addEventListener(this.htmlForm,"submit",this.onSubmitHandler)},n.prototype.handleSubmit=function(t){var e=this;return t.preventDefault?t.preventDefault():t.returnValue=!1,this.hasExternalNonce()?(this.scrubAllAttributes(),void this.onNonceReceived(null,this.getNonce())):void this.client.tokenizeCard(this.extractValues(),function(t,n,i){t||e.setNonce({nonce:n,type:i.type,details:i.details}),e.onNonceReceived(t,e.getNonce())})},n.prototype.setNonce=function(t){this.nonce=t},n.prototype.getNonce=function(){return this.nonce},n.prototype.writeNonceToDOM=function(){this.paymentMethodNonceInput.value=this.getNonce().nonce},n.prototype.isBraintreeNode=function(t){return 1===t.nodeType&&t.attributes["data-braintree-name"]},n.prototype.hasExternalNonce=function(){var t=this.getNonce(),e=t&&null!=t.type&&"CreditCard"!==t.type,n=this.htmlForm.querySelector('[data-braintree-name="number"]').value.length<1;return n&&t&&t.nonce&&e},n.prototype.onExternalNonceReceived=function(t){this.clearCardNumberInput(),this.setNonce(t)},n.prototype.onExternalNonceCancelled=function(){this.setNonce(null)},n.prototype.onNonceReceived=function(t){var e=this.htmlForm;if(t)throw new Error("Unable to process payments at this time.");i.removeEventListener(e,"submit",this.onSubmitHandler),this.writeNonceToDOM(),e.submit&&("function"==typeof e.submit||e.submit.call)?e.submit():setTimeout(function(){e.querySelector('[type="submit"]').click()},1)},n.prototype.scrubAllAttributes=function(){this.extractValues()},n.prototype.extractValues=function(t,e){e=e||{},t=t||this.htmlForm;var n,i,r=t.children;for(i=0;i<r.length;i++)if(n=r[i],this.isBraintreeNode(n)){var o=n.getAttribute("data-braintree-name");"postal_code"===o?e.billingAddress={postalCode:n.value}:e[o]=n.value,this.scrubAttributes(n)
|
5 |
-
}else n.children&&n.children.length>0&&this.extractValues(n,e);return e},n.prototype.scrubAttributes=function(t){try{t.attributes.removeNamedItem("name")}catch(e){}},n.prototype.clearCardNumberInput=function(){var t=this.htmlForm.querySelector('[data-braintree-name="number"]');t.value=""},e.exports=n},{"braintree-utilities":210}],203:[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}},{}],204:[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.')}}},{}],205:[function(t,e){"use strict";function n(t,e){var n,s,a=document.getElementById(e.id);if(!a)throw new Error('Unable to find form with id: "'+e.id+'"');return r(a),n=o(e.paymentMethodNonceInputField),a.appendChild(n),s=new i(t,a,n)}var i=t("./lib/form"),r=t("./lib/validate-annotations"),o=t("./lib/get-nonce-input");e.exports={setup:n}},{"./lib/form":202,"./lib/get-nonce-input":203,"./lib/validate-annotations":204}],206:[function(t,e,n){arguments[4][15][0].apply(n,arguments)},{dup:15}],207:[function(t,e,n){arguments[4][16][0].apply(n,arguments)},{dup:16}],208:[function(t,e,n){arguments[4][17][0].apply(n,arguments)},{dup:17}],209:[function(t,e,n){arguments[4][18][0].apply(n,arguments)},{dup:18}],210:[function(t,e,n){arguments[4][19][0].apply(n,arguments)},{"./lib/dom":206,"./lib/events":207,"./lib/fn":208,"./lib/url":209,dup:19}],211:[function(t,e,n){arguments[4][2][0].apply(n,arguments)},{"./coinbase-account":212,"./credit-card":213,"./jsonp-driver":214,"./normalize-api-fields":216,"./parse-client-token":217,"./root-data":219,"./sepa-bank-account":220,"./sepa-mandate":221,"./util":222,"braintree-3ds":231,"braintree-utilities":250,dup:2}],212:[function(t,e,n){arguments[4][3][0].apply(n,arguments)},{dup:3}],213:[function(t,e,n){arguments[4][4][0].apply(n,arguments)},{dup:4}],214:[function(t,e,n){arguments[4][5][0].apply(n,arguments)},{"./jsonp":215,dup:5}],215:[function(t,e,n){arguments[4][6][0].apply(n,arguments)},{"./util":222,dup:6}],216:[function(t,e,n){arguments[4][7][0].apply(n,arguments)},{dup:7}],217:[function(t,e,n){arguments[4][8][0].apply(n,arguments)},{"./polyfill":218,dup:8}],218:[function(t,e,n){arguments[4][9][0].apply(n,arguments)},{dup:9}],219:[function(t,e,n){arguments[4][10][0].apply(n,arguments)},{"braintree-rpc":239,dup:10}],220:[function(t,e,n){arguments[4][11][0].apply(n,arguments)},{dup:11}],221:[function(t,e,n){arguments[4][12][0].apply(n,arguments)},{dup:12}],222:[function(t,e,n){arguments[4][13][0].apply(n,arguments)},{dup:13}],223:[function(t,e,n){arguments[4][14][0].apply(n,arguments)},{"./lib/client":211,"./lib/jsonp":215,"./lib/jsonp-driver":214,"./lib/parse-client-token":217,"./lib/util":222,dup:14}],224:[function(t,e,n){arguments[4][15][0].apply(n,arguments)},{dup:15}],225:[function(t,e,n){arguments[4][16][0].apply(n,arguments)},{dup:16}],226:[function(t,e,n){arguments[4][17][0].apply(n,arguments)},{dup:17}],227:[function(t,e,n){arguments[4][18][0].apply(n,arguments)},{dup:18}],228:[function(t,e,n){arguments[4][19][0].apply(n,arguments)},{"./lib/dom":224,"./lib/events":225,"./lib/fn":226,"./lib/url":227,dup:19}],229:[function(t,e,n){arguments[4][20][0].apply(n,arguments)},{"../shared/receiver":233,"braintree-utilities":228,dup:20}],230:[function(t,e,n){arguments[4][21][0].apply(n,arguments)},{"./authorization_service":229,"braintree-utilities":228,dup:21}],231:[function(t,e,n){arguments[4][22][0].apply(n,arguments)},{"./client":230,"./vendor/json2":232,dup:22}],232:[function(t,e,n){arguments[4][23][0].apply(n,arguments)},{dup:23}],233:[function(t,e,n){arguments[4][24][0].apply(n,arguments)},{"braintree-utilities":228,dup:24}],234:[function(t,e,n){arguments[4][25][0].apply(n,arguments)},{"braintree-utilities":244,dup:25}],235:[function(t,e,n){arguments[4][26][0].apply(n,arguments)},{"braintree-utilities":244,dup:26}],236:[function(t,e,n){arguments[4][27][0].apply(n,arguments)},{dup:27}],237:[function(t,e,n){arguments[4][28][0].apply(n,arguments)},{"braintree-utilities":244,dup:28}],238:[function(t,e,n){arguments[4][29][0].apply(n,arguments)},{"braintree-utilities":244,dup:29}],239:[function(t,e,n){arguments[4][30][0].apply(n,arguments)},{"./lib/message-bus":234,"./lib/pubsub-client":235,"./lib/pubsub-server":236,"./lib/rpc-client":237,"./lib/rpc-server":238,dup:30}],240:[function(t,e,n){arguments[4][31][0].apply(n,arguments)},{dup:31}],241:[function(t,e,n){arguments[4][32][0].apply(n,arguments)},{dup:32}],242:[function(t,e,n){arguments[4][33][0].apply(n,arguments)},{dup:33}],243:[function(t,e,n){arguments[4][18][0].apply(n,arguments)},{dup:18}],244:[function(t,e,n){arguments[4][19][0].apply(n,arguments)},{"./lib/dom":240,"./lib/events":241,"./lib/fn":242,"./lib/url":243,dup:19}],245:[function(t,e,n){arguments[4][15][0].apply(n,arguments)},{dup:15}],246:[function(t,e,n){arguments[4][16][0].apply(n,arguments)},{dup:16}],247:[function(t,e,n){arguments[4][17][0].apply(n,arguments)},{dup:17}],248:[function(t,e,n){arguments[4][39][0].apply(n,arguments)},{dup:39}],249:[function(t,e,n){arguments[4][18][0].apply(n,arguments)},{dup:18}],250:[function(t,e,n){arguments[4][41][0].apply(n,arguments)},{"./lib/dom":245,"./lib/events":246,"./lib/fn":247,"./lib/string":248,"./lib/url":249,dup:41}],251:[function(t,e,n){arguments[4][25][0].apply(n,arguments)},{"braintree-utilities":261,dup:25}],252:[function(t,e,n){arguments[4][26][0].apply(n,arguments)},{"braintree-utilities":261,dup:26}],253:[function(t,e,n){arguments[4][27][0].apply(n,arguments)},{dup:27}],254:[function(t,e,n){arguments[4][28][0].apply(n,arguments)},{"braintree-utilities":261,dup:28}],255:[function(t,e,n){arguments[4][29][0].apply(n,arguments)},{"braintree-utilities":261,dup:29}],256:[function(t,e,n){arguments[4][30][0].apply(n,arguments)},{"./lib/message-bus":251,"./lib/pubsub-client":252,"./lib/pubsub-server":253,"./lib/rpc-client":254,"./lib/rpc-server":255,dup:30}],257:[function(t,e,n){arguments[4][31][0].apply(n,arguments)},{dup:31}],258:[function(t,e,n){arguments[4][32][0].apply(n,arguments)},{dup:32}],259:[function(t,e,n){arguments[4][33][0].apply(n,arguments)},{dup:33}],260:[function(t,e,n){arguments[4][18][0].apply(n,arguments)},{dup:18}],261:[function(t,e,n){arguments[4][19][0].apply(n,arguments)},{"./lib/dom":257,"./lib/events":258,"./lib/fn":259,"./lib/url":260,dup:19}],262:[function(t,e,n){arguments[4][159][0].apply(n,arguments)},{dup:159}],263:[function(t,e,n){arguments[4][15][0].apply(n,arguments)},{dup:15}],264:[function(t,e,n){arguments[4][16][0].apply(n,arguments)},{dup:16}],265:[function(t,e,n){arguments[4][17][0].apply(n,arguments)},{dup:17}],266:[function(t,e,n){arguments[4][39][0].apply(n,arguments)},{dup:39}],267:[function(t,e,n){arguments[4][164][0].apply(n,arguments)},{"./array":262,dup:164}],268:[function(t,e,n){arguments[4][165][0].apply(n,arguments)},{"./lib/array":262,"./lib/dom":263,"./lib/events":264,"./lib/fn":265,"./lib/string":266,"./lib/url":267,dup:165}],269:[function(t,e,n){arguments[4][166][0].apply(n,arguments)},{"../shared/constants":274,"../shared/get-locale":276,"../shared/util/browser":281,"../shared/util/dom":282,"../shared/util/util":283,"./logged-in-view":271,"./logged-out-view":272,"./overlay-view":273,"braintree-api":223,"braintree-rpc":256,"braintree-utilities":268,dup:166}],270:[function(t,e){function n(t,e){if(!r.detectedPostMessage())return void("function"==typeof e.onUnsupported&&e.onUnsupported(new Error("unsupported browser detected")));var n=new i(t,e);return n.initialize(),n}var i=t("./client"),r=t("../shared/util/browser"),o="1.3.4";e.exports={create:n,_browser:r,VERSION:o}},{"../shared/util/browser":281,"./client":269}],271:[function(t,e,n){arguments[4][167][0].apply(n,arguments)},{"../shared/constants":274,dup:167}],272:[function(t,e,n){arguments[4][168][0].apply(n,arguments)},{"../shared/constants":274,"../shared/get-locale":276,"braintree-utilities":268,dup:168}],273:[function(t,e,n){arguments[4][169][0].apply(n,arguments)},{"../shared/constants":274,"braintree-utilities":268,dup:169}],274:[function(t,e,n){arguments[4][170][0].apply(n,arguments)},{dup:170}],275:[function(t,e,n){arguments[4][171][0].apply(n,arguments)},{dup:171}],276:[function(t,e,n){arguments[4][172][0].apply(n,arguments)},{"../shared/data/country-code-lookup":275,dup:172}],277:[function(t,e,n){arguments[4][173][0].apply(n,arguments)},{"./useragent":280,dup:173}],278:[function(t,e,n){arguments[4][174][0].apply(n,arguments)},{"./platform":279,"./useragent":280,dup:174}],279:[function(t,e,n){arguments[4][175][0].apply(n,arguments)},{"./useragent":280,dup:175}],280:[function(t,e,n){arguments[4][176][0].apply(n,arguments)},{dup:176}],281:[function(t,e,n){arguments[4][177][0].apply(n,arguments)},{"../useragent/browser":277,"../useragent/device":278,"../useragent/platform":279,"../useragent/useragent":280,dup:177}],282:[function(t,e,n){arguments[4][178][0].apply(n,arguments)},{dup:178}],283:[function(t,e,n){arguments[4][179][0].apply(n,arguments)},{dup:179}],284:[function(t,e,n){arguments[4][25][0].apply(n,arguments)},{"braintree-utilities":294,dup:25}],285:[function(t,e,n){arguments[4][26][0].apply(n,arguments)},{"braintree-utilities":294,dup:26}],286:[function(t,e,n){arguments[4][27][0].apply(n,arguments)},{dup:27}],287:[function(t,e,n){arguments[4][28][0].apply(n,arguments)},{"braintree-utilities":294,dup:28}],288:[function(t,e,n){arguments[4][29][0].apply(n,arguments)},{"braintree-utilities":294,dup:29}],289:[function(t,e,n){arguments[4][30][0].apply(n,arguments)},{"./lib/message-bus":284,"./lib/pubsub-client":285,"./lib/pubsub-server":286,"./lib/rpc-client":287,"./lib/rpc-server":288,dup:30}],290:[function(t,e,n){arguments[4][31][0].apply(n,arguments)},{dup:31}],291:[function(t,e,n){arguments[4][32][0].apply(n,arguments)},{dup:32}],292:[function(t,e,n){arguments[4][33][0].apply(n,arguments)},{dup:33}],293:[function(t,e,n){arguments[4][18][0].apply(n,arguments)},{dup:18}],294:[function(t,e,n){arguments[4][19][0].apply(n,arguments)},{"./lib/dom":290,"./lib/events":291,"./lib/fn":292,"./lib/url":293,dup:19}],295:[function(t,e,n){arguments[4][15][0].apply(n,arguments)},{dup:15}],296:[function(t,e,n){arguments[4][16][0].apply(n,arguments)},{dup:16}],297:[function(t,e,n){arguments[4][17][0].apply(n,arguments)},{dup:17}],298:[function(t,e,n){arguments[4][18][0].apply(n,arguments)},{dup:18}],299:[function(t,e,n){arguments[4][19][0].apply(n,arguments)},{"./lib/dom":295,"./lib/events":296,"./lib/fn":297,"./lib/url":298,dup:19}],300:[function(t,e){function n(t){var e={};if(t){for(var n in t)t.hasOwnProperty(n)&&(e[i(n)]=t[n]);return e}}function i(t){return t.replace(/([A-Z])/g,function(t){return"_"+t.toLowerCase()})}e.exports={convertToLegacyShippingAddress:n}},{}],301:[function(t,e){"use strict";e.exports={ROOT_SUCCESS_CALLBACK:"onPaymentMethodReceived",ROOT_ERROR_CALLBACK:"onError"}},{}],302:[function(t,e){"use strict";function n(t,e){return o.on(o.events.PAYMENT_METHOD_GENERATED,function(t){o.emit(o.events.PAYMENT_METHOD_RECEIVED,t)}),e.coinbase=e.coinbase||{},e.apiClient=new i.Client({clientToken:t,integration:"coinbase"}),r.create(e)}{var i=t("braintree-api"),r=t("braintree-coinbase"),o=t("braintree-bus");t("braintree-utilities")}e.exports={initialize:n}},{"braintree-api":14,"braintree-bus":42,"braintree-coinbase":45,"braintree-utilities":299}],303:[function(t,e){"use strict";function n(t,e){return function(n){return e in t&&u.isFunction(t[e][n])?t[e][n]:function(){}}}function i(t,e){var i,d=n(e,"paypal"),f=d("onSuccess"),m=d("onCancelled"),y=new r.Client({clientToken:t,integration:"custom"});return i=o.setup(y,e),u.isFunction(e[c.ROOT_SUCCESS_CALLBACK])&&(i.onNonceReceived=function(t,n){e[c.ROOT_SUCCESS_CALLBACK](p(n))}),e.paypal&&(e.paypal.paymentMethodNonceInputField||(e.paypal.paymentMethodNonceInputField=i.paymentMethodNonceInput),e.paypal.onSuccess=function(t){i.onExternalNonceReceived(t),f.apply(null,[t.nonce,t.details.email,h(t.details.shippingAddress)])},e.paypal.onCancelled=function(){i.onExternalNonceCancelled(),m()},s.create(t,e.paypal)),e.coinbase&&(e.apiClient=y,e.paypal&&delete e.paypal,l.on(l.events.PAYMENT_METHOD_GENERATED,function(t){i.onExternalNonceReceived(t)}),a.create(e)),i}var r=t("braintree-api"),o=t("braintree-form"),s=t("braintree-paypal"),a=t("braintree-coinbase"),u=t("braintree-utilities"),c=t("../constants"),l=t("braintree-bus"),p=t("../lib/sanitize-payload"),h=t("../compatibility").convertToLegacyShippingAddress;e.exports={initialize:i}},{"../compatibility":300,"../constants":301,"../lib/sanitize-payload":307,"braintree-api":14,"braintree-bus":42,"braintree-coinbase":45,"braintree-form":205,"braintree-paypal":270,"braintree-utilities":299}],304:[function(t,e){"use strict";function n(t){return s.isFunction(t.paymentMethodNonceReceived)?t.paymentMethodNonceReceived:null}function i(t){return s.isFunction(t[u.ROOT_SUCCESS_CALLBACK])}function r(t,e){var r=n(e),s=i(e);return(r||s)&&(e.paymentMethodNonceReceived=function(t){r&&r.apply(null,[t.originalEvent,t.nonce]),delete t.originalEvent,a.emit(a.events.PAYMENT_METHOD_RECEIVED,c(t))}),o.create(t,e)}var o=t("braintree-dropin"),s=t("braintree-utilities"),a=t("braintree-bus"),u=t("../constants"),c=t("../lib/sanitize-payload");e.exports={initialize:r}},{"../constants":301,"../lib/sanitize-payload":307,"braintree-bus":42,"braintree-dropin":198,"braintree-utilities":299}],305:[function(t,e){"use strict";e.exports={custom:t("./custom"),dropin:t("./dropin"),paypal:t("./paypal"),coinbase:t("./coinbase")}},{"./coinbase":302,"./custom":303,"./dropin":304,"./paypal":306}],306:[function(t,e){"use strict";function n(t){return"onSuccess"in t&&s.isFunction(t.onSuccess)?t.onSuccess:"paypal"in t&&s.isFunction(t.paypal.onSuccess)?t.paypal.onSuccess:null}function i(t){return s.isFunction(t[a.ROOT_SUCCESS_CALLBACK])}function r(t,e){var r=n(e),s=i(e);return(r||s)&&(e.onSuccess=function(t){r&&r.apply(null,[t.nonce,t.details.email,c(t.details.shippingAddress)]),u.emit(u.events.PAYMENT_METHOD_RECEIVED,t)}),o.create(t,e)}var o=t("braintree-paypal"),s=t("braintree-utilities"),a=t("../constants"),u=t("braintree-bus"),c=t("../compatibility").convertToLegacyShippingAddress;e.exports={initialize:r}},{"../compatibility":300,"../constants":301,"braintree-bus":42,"braintree-paypal":270,"braintree-utilities":299}],307:[function(t,e){"use strict";e.exports=function(t){return{nonce:t.nonce,details:t.details,type:t.type}}},{}],308:[function(t,e){(function(n){"use strict";var i="2.6.3",r=t("braintree-rpc"),o=new r.MessageBus(n),s=new r.RPCServer(o);e.exports=function(){s.define("getExternalData",function(t){t({sdkVersion:i,merchantAppId:n.location.href})})}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"braintree-rpc":289}],309:[function(t,e){"use strict";function n(){}function i(t){if("CONFIGURATION"===t.type)throw new Error(t.message);try{console.error(t)}catch(e){console.log("ERROR: "+t.message)}}function r(t,e,n){if(!(e in p))throw new Error(e+" is an unsupported integration");return l.isFunction(n[d.ROOT_SUCCESS_CALLBACK])&&(m=function(t){n[d.ROOT_SUCCESS_CALLBACK](f(t))}),l.isFunction(n[d.ROOT_ERROR_CALLBACK])&&(y=n[d.ROOT_ERROR_CALLBACK]),n.configuration=s.parseClientToken(t),h.on(h.events.ERROR,y),h.on(h.events.PAYMENT_METHOD_RECEIVED,m),h.on(h.events.CONFIGURATION_REQUEST,function(t){t(n)}),h.on(h.events.WARNING,function(t){try{console.warn(t)}catch(e){}}),p[e].initialize(t,n)}var o="2.6.3",s=t("braintree-api"),a=t("braintree-paypal"),u=t("braintree-dropin"),c=t("braintree-form"),l=t("braintree-utilities"),p=t("./integrations"),h=t("braintree-bus"),d=t("./constants"),f=t("./lib/sanitize-payload"),m=n,y=i;e.exports={api:s,cse:Braintree,paypal:a,dropin:u,Form:c,setup:r,VERSION:o}},{"./constants":301,"./integrations":305,"./lib/sanitize-payload":307,"braintree-api":14,"braintree-bus":42,"braintree-dropin":198,"braintree-form":205,"braintree-paypal":270,"braintree-utilities":299}]},{},[1])(1)});
|
|
|
|
|
|
|
|
|
|
js/gene/braintree/config.codekit
ADDED
@@ -0,0 +1,841 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
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": "19051",
|
4 |
+
"files": {
|
5 |
+
"\/braintree-0.1.js": {
|
6 |
+
"fileType": 64,
|
7 |
+
"ignore": 1,
|
8 |
+
"ignoreWasSetByUser": 1,
|
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 |
+
"\/vzero-0.5.js": {
|
17 |
+
"fileType": 64,
|
18 |
+
"ignore": 0,
|
19 |
+
"ignoreWasSetByUser": 0,
|
20 |
+
"inputAbbreviatedPath": "\/vzero-0.5.js",
|
21 |
+
"outputAbbreviatedPath": "\/vzero-0.5.min.js",
|
22 |
+
"outputPathIsOutsideProject": 0,
|
23 |
+
"outputPathIsSetByUser": 1,
|
24 |
+
"outputStyle": 1,
|
25 |
+
"syntaxCheckerStyle": 0
|
26 |
+
},
|
27 |
+
"\/vzero-0.5.min.js": {
|
28 |
+
"fileType": 64,
|
29 |
+
"ignore": 1,
|
30 |
+
"ignoreWasSetByUser": 0,
|
31 |
+
"inputAbbreviatedPath": "\/vzero-0.5.min.js",
|
32 |
+
"outputAbbreviatedPath": "\/min\/vzero-0.5.min-min.js",
|
33 |
+
"outputPathIsOutsideProject": 0,
|
34 |
+
"outputPathIsSetByUser": 0,
|
35 |
+
"outputStyle": 1,
|
36 |
+
"syntaxCheckerStyle": 1
|
37 |
+
}
|
38 |
+
},
|
39 |
+
"hooks": [
|
40 |
+
],
|
41 |
+
"lastSavedByUser": "David Macaulay",
|
42 |
+
"manualImportLinks": {
|
43 |
+
},
|
44 |
+
"projectAttributes": {
|
45 |
+
"bowerAbbreviatedPath": "",
|
46 |
+
"displayValue": "braintree",
|
47 |
+
"displayValueWasSetByUser": 0,
|
48 |
+
"iconImageName": "compass_darkGray"
|
49 |
+
},
|
50 |
+
"projectSettings": {
|
51 |
+
"alwaysUseExternalServer": 0,
|
52 |
+
"animateCSSInjections": 1,
|
53 |
+
"autoApplyPSLanguageSettingsStyle": 0,
|
54 |
+
"autoprefixerBrowserString": "> 1%, last 2 versions, Firefox ESR, Opera 12.1",
|
55 |
+
"autoSyncProjectSettingsFile": 1,
|
56 |
+
"browserRefreshDelay": 0,
|
57 |
+
"coffeeAutoOutputPathEnabled": 1,
|
58 |
+
"coffeeAutoOutputPathFilenamePattern": "*.js",
|
59 |
+
"coffeeAutoOutputPathRelativePath": "",
|
60 |
+
"coffeeAutoOutputPathReplace1": "",
|
61 |
+
"coffeeAutoOutputPathReplace2": "",
|
62 |
+
"coffeeAutoOutputPathStyle": 0,
|
63 |
+
"coffeeCreateSourceMap": 0,
|
64 |
+
"coffeeLintFlags2": {
|
65 |
+
"arrow_spacing": {
|
66 |
+
"active": 0,
|
67 |
+
"flagValue": -1
|
68 |
+
},
|
69 |
+
"camel_case_classes": {
|
70 |
+
"active": 1,
|
71 |
+
"flagValue": -1
|
72 |
+
},
|
73 |
+
"colon_assignment_spacing": {
|
74 |
+
"active": 0,
|
75 |
+
"flagValue": 1
|
76 |
+
},
|
77 |
+
"cyclomatic_complexity": {
|
78 |
+
"active": 0,
|
79 |
+
"flagValue": 10
|
80 |
+
},
|
81 |
+
"duplicate_key": {
|
82 |
+
"active": 1,
|
83 |
+
"flagValue": -1
|
84 |
+
},
|
85 |
+
"empty_constructor_needs_parens": {
|
86 |
+
"active": 0,
|
87 |
+
"flagValue": -1
|
88 |
+
},
|
89 |
+
"ensure_comprehensions": {
|
90 |
+
"active": 1,
|
91 |
+
"flagValue": -1
|
92 |
+
},
|
93 |
+
"indentation": {
|
94 |
+
"active": 1,
|
95 |
+
"flagValue": 2
|
96 |
+
},
|
97 |
+
"line_endings": {
|
98 |
+
"active": 0,
|
99 |
+
"flagValue": 0
|
100 |
+
},
|
101 |
+
"max_line_length": {
|
102 |
+
"active": 0,
|
103 |
+
"flagValue": 150
|
104 |
+
},
|
105 |
+
"missing_fat_arrows": {
|
106 |
+
"active": 0,
|
107 |
+
"flagValue": -1
|
108 |
+
},
|
109 |
+
"newlines_after_classes": {
|
110 |
+
"active": 0,
|
111 |
+
"flagValue": 3
|
112 |
+
},
|
113 |
+
"no_backticks": {
|
114 |
+
"active": 1,
|
115 |
+
"flagValue": -1
|
116 |
+
},
|
117 |
+
"no_debugger": {
|
118 |
+
"active": 1,
|
119 |
+
"flagValue": -1
|
120 |
+
},
|
121 |
+
"no_empty_functions": {
|
122 |
+
"active": 0,
|
123 |
+
"flagValue": -1
|
124 |
+
},
|
125 |
+
"no_empty_param_list": {
|
126 |
+
"active": 0,
|
127 |
+
"flagValue": -1
|
128 |
+
},
|
129 |
+
"no_implicit_braces": {
|
130 |
+
"active": 1,
|
131 |
+
"flagValue": -1
|
132 |
+
},
|
133 |
+
"no_implicit_parens": {
|
134 |
+
"active": 0,
|
135 |
+
"flagValue": -1
|
136 |
+
},
|
137 |
+
"no_interpolation_in_single_quotes": {
|
138 |
+
"active": 0,
|
139 |
+
"flagValue": -1
|
140 |
+
},
|
141 |
+
"no_plusplus": {
|
142 |
+
"active": 0,
|
143 |
+
"flagValue": -1
|
144 |
+
},
|
145 |
+
"no_stand_alone_at": {
|
146 |
+
"active": 1,
|
147 |
+
"flagValue": -1
|
148 |
+
},
|
149 |
+
"no_tabs": {
|
150 |
+
"active": 1,
|
151 |
+
"flagValue": -1
|
152 |
+
},
|
153 |
+
"no_throwing_strings": {
|
154 |
+
"active": 1,
|
155 |
+
"flagValue": -1
|
156 |
+
},
|
157 |
+
"no_trailing_semicolons": {
|
158 |
+
"active": 1,
|
159 |
+
"flagValue": -1
|
160 |
+
},
|
161 |
+
"no_trailing_whitespace": {
|
162 |
+
"active": 1,
|
163 |
+
"flagValue": -1
|
164 |
+
},
|
165 |
+
"no_unnecessary_double_quotes": {
|
166 |
+
"active": 0,
|
167 |
+
"flagValue": -1
|
168 |
+
},
|
169 |
+
"no_unnecessary_fat_arrows": {
|
170 |
+
"active": 1,
|
171 |
+
"flagValue": -1
|
172 |
+
},
|
173 |
+
"non_empty_constructor_needs_parens": {
|
174 |
+
"active": 0,
|
175 |
+
"flagValue": -1
|
176 |
+
},
|
177 |
+
"prefer_english_operator": {
|
178 |
+
"active": 0,
|
179 |
+
"flagValue": -1
|
180 |
+
},
|
181 |
+
"space_operators": {
|
182 |
+
"active": 0,
|
183 |
+
"flagValue": -1
|
184 |
+
},
|
185 |
+
"spacing_after_comma": {
|
186 |
+
"active": 1,
|
187 |
+
"flagValue": -1
|
188 |
+
}
|
189 |
+
},
|
190 |
+
"coffeeMinifyOutput": 1,
|
191 |
+
"coffeeOutputStyle": 0,
|
192 |
+
"coffeeSyntaxCheckerStyle": 1,
|
193 |
+
"externalServerAddress": "http:\/\/localhost:8888",
|
194 |
+
"externalServerPreviewPathAddition": "",
|
195 |
+
"genericWebpageFileExtensionsString": "html, htm, shtml, shtm, xhtml, php, jsp, asp, aspx, erb, ctp",
|
196 |
+
"hamlAutoOutputPathEnabled": 1,
|
197 |
+
"hamlAutoOutputPathFilenamePattern": "*.html",
|
198 |
+
"hamlAutoOutputPathRelativePath": "",
|
199 |
+
"hamlAutoOutputPathReplace1": "",
|
200 |
+
"hamlAutoOutputPathReplace2": "",
|
201 |
+
"hamlAutoOutputPathStyle": 0,
|
202 |
+
"hamlEscapeHTMLCharacters": 0,
|
203 |
+
"hamlNoEscapeInAttributes": 0,
|
204 |
+
"hamlOutputFormat": 2,
|
205 |
+
"hamlOutputStyle": 0,
|
206 |
+
"hamlUseCDATA": 0,
|
207 |
+
"hamlUseDoubleQuotes": 0,
|
208 |
+
"hamlUseUnixNewlines": 0,
|
209 |
+
"jadeAutoOutputPathEnabled": 1,
|
210 |
+
"jadeAutoOutputPathFilenamePattern": "*.html",
|
211 |
+
"jadeAutoOutputPathRelativePath": "",
|
212 |
+
"jadeAutoOutputPathReplace1": "",
|
213 |
+
"jadeAutoOutputPathReplace2": "",
|
214 |
+
"jadeAutoOutputPathStyle": 0,
|
215 |
+
"jadeCompileDebug": 1,
|
216 |
+
"jadeOutputStyle": 0,
|
217 |
+
"javascriptAutoOutputPathEnabled": 1,
|
218 |
+
"javascriptAutoOutputPathFilenamePattern": "*-min.js",
|
219 |
+
"javascriptAutoOutputPathRelativePath": "\/min",
|
220 |
+
"javascriptAutoOutputPathReplace1": "",
|
221 |
+
"javascriptAutoOutputPathReplace2": "",
|
222 |
+
"javascriptAutoOutputPathStyle": 2,
|
223 |
+
"javascriptCreateSourceMap": 1,
|
224 |
+
"javascriptOutputStyle": 1,
|
225 |
+
"javascriptSyntaxCheckerStyle": 1,
|
226 |
+
"jsCheckerReservedNamesString": "",
|
227 |
+
"jsHintFlags2": {
|
228 |
+
"asi": {
|
229 |
+
"active": 0,
|
230 |
+
"flagValue": -1
|
231 |
+
},
|
232 |
+
"bitwise": {
|
233 |
+
"active": 1,
|
234 |
+
"flagValue": -1
|
235 |
+
},
|
236 |
+
"boss": {
|
237 |
+
"active": 0,
|
238 |
+
"flagValue": -1
|
239 |
+
},
|
240 |
+
"browser": {
|
241 |
+
"active": 1,
|
242 |
+
"flagValue": -1
|
243 |
+
},
|
244 |
+
"browserify": {
|
245 |
+
"active": 0,
|
246 |
+
"flagValue": -1
|
247 |
+
},
|
248 |
+
"camelcase": {
|
249 |
+
"active": 0,
|
250 |
+
"flagValue": -1
|
251 |
+
},
|
252 |
+
"couch": {
|
253 |
+
"active": 0,
|
254 |
+
"flagValue": -1
|
255 |
+
},
|
256 |
+
"curly": {
|
257 |
+
"active": 1,
|
258 |
+
"flagValue": -1
|
259 |
+
},
|
260 |
+
"debug": {
|
261 |
+
"active": 0,
|
262 |
+
"flagValue": -1
|
263 |
+
},
|
264 |
+
"devel": {
|
265 |
+
"active": 0,
|
266 |
+
"flagValue": -1
|
267 |
+
},
|
268 |
+
"dojo": {
|
269 |
+
"active": 0,
|
270 |
+
"flagValue": -1
|
271 |
+
},
|
272 |
+
"elision": {
|
273 |
+
"active": 1,
|
274 |
+
"flagValue": -1
|
275 |
+
},
|
276 |
+
"eqeqeq": {
|
277 |
+
"active": 1,
|
278 |
+
"flagValue": -1
|
279 |
+
},
|
280 |
+
"eqnull": {
|
281 |
+
"active": 0,
|
282 |
+
"flagValue": -1
|
283 |
+
},
|
284 |
+
"es3": {
|
285 |
+
"active": 0,
|
286 |
+
"flagValue": -1
|
287 |
+
},
|
288 |
+
"esnext": {
|
289 |
+
"active": 0,
|
290 |
+
"flagValue": -1
|
291 |
+
},
|
292 |
+
"evil": {
|
293 |
+
"active": 0,
|
294 |
+
"flagValue": -1
|
295 |
+
},
|
296 |
+
"expr": {
|
297 |
+
"active": 0,
|
298 |
+
"flagValue": -1
|
299 |
+
},
|
300 |
+
"forin": {
|
301 |
+
"active": 0,
|
302 |
+
"flagValue": -1
|
303 |
+
},
|
304 |
+
"freeze": {
|
305 |
+
"active": 1,
|
306 |
+
"flagValue": -1
|
307 |
+
},
|
308 |
+
"funcscope": {
|
309 |
+
"active": 0,
|
310 |
+
"flagValue": -1
|
311 |
+
},
|
312 |
+
"futurehostile": {
|
313 |
+
"active": 0,
|
314 |
+
"flagValue": -1
|
315 |
+
},
|
316 |
+
"globalstrict": {
|
317 |
+
"active": 0,
|
318 |
+
"flagValue": -1
|
319 |
+
},
|
320 |
+
"immed": {
|
321 |
+
"active": 0,
|
322 |
+
"flagValue": -1
|
323 |
+
},
|
324 |
+
"indent": {
|
325 |
+
"active": 0,
|
326 |
+
"flagValue": 4
|
327 |
+
},
|
328 |
+
"iterator": {
|
329 |
+
"active": 0,
|
330 |
+
"flagValue": -1
|
331 |
+
},
|
332 |
+
"jasmine": {
|
333 |
+
"active": 0,
|
334 |
+
"flagValue": -1
|
335 |
+
},
|
336 |
+
"jquery": {
|
337 |
+
"active": 1,
|
338 |
+
"flagValue": -1
|
339 |
+
},
|
340 |
+
"lastsemic": {
|
341 |
+
"active": 0,
|
342 |
+
"flagValue": -1
|
343 |
+
},
|
344 |
+
"latedef": {
|
345 |
+
"active": 1,
|
346 |
+
"flagValue": -1
|
347 |
+
},
|
348 |
+
"laxbreak": {
|
349 |
+
"active": 0,
|
350 |
+
"flagValue": -1
|
351 |
+
},
|
352 |
+
"laxcomma": {
|
353 |
+
"active": 0,
|
354 |
+
"flagValue": -1
|
355 |
+
},
|
356 |
+
"loopfunc": {
|
357 |
+
"active": 0,
|
358 |
+
"flagValue": -1
|
359 |
+
},
|
360 |
+
"maxcomplexity": {
|
361 |
+
"active": 0,
|
362 |
+
"flagValue": 10
|
363 |
+
},
|
364 |
+
"maxdepth": {
|
365 |
+
"active": 0,
|
366 |
+
"flagValue": 3
|
367 |
+
},
|
368 |
+
"maxlen": {
|
369 |
+
"active": 0,
|
370 |
+
"flagValue": 150
|
371 |
+
},
|
372 |
+
"maxparams": {
|
373 |
+
"active": 0,
|
374 |
+
"flagValue": 3
|
375 |
+
},
|
376 |
+
"maxstatements": {
|
377 |
+
"active": 0,
|
378 |
+
"flagValue": 4
|
379 |
+
},
|
380 |
+
"mocha": {
|
381 |
+
"active": 0,
|
382 |
+
"flagValue": -1
|
383 |
+
},
|
384 |
+
"mootools": {
|
385 |
+
"active": 0,
|
386 |
+
"flagValue": -1
|
387 |
+
},
|
388 |
+
"moz": {
|
389 |
+
"active": 0,
|
390 |
+
"flagValue": -1
|
391 |
+
},
|
392 |
+
"multistr": {
|
393 |
+
"active": 0,
|
394 |
+
"flagValue": -1
|
395 |
+
},
|
396 |
+
"newcap": {
|
397 |
+
"active": 1,
|
398 |
+
"flagValue": -1
|
399 |
+
},
|
400 |
+
"noarg": {
|
401 |
+
"active": 1,
|
402 |
+
"flagValue": -1
|
403 |
+
},
|
404 |
+
"nocomma": {
|
405 |
+
"active": 0,
|
406 |
+
"flagValue": -1
|
407 |
+
},
|
408 |
+
"node": {
|
409 |
+
"active": 0,
|
410 |
+
"flagValue": -1
|
411 |
+
},
|
412 |
+
"noempty": {
|
413 |
+
"active": 0,
|
414 |
+
"flagValue": -1
|
415 |
+
},
|
416 |
+
"nonbsp": {
|
417 |
+
"active": 0,
|
418 |
+
"flagValue": -1
|
419 |
+
},
|
420 |
+
"nonew": {
|
421 |
+
"active": 1,
|
422 |
+
"flagValue": -1
|
423 |
+
},
|
424 |
+
"nonstandard": {
|
425 |
+
"active": 0,
|
426 |
+
"flagValue": -1
|
427 |
+
},
|
428 |
+
"notypeof": {
|
429 |
+
"active": 1,
|
430 |
+
"flagValue": -1
|
431 |
+
},
|
432 |
+
"noyield": {
|
433 |
+
"active": 0,
|
434 |
+
"flagValue": -1
|
435 |
+
},
|
436 |
+
"onecase": {
|
437 |
+
"active": 0,
|
438 |
+
"flagValue": -1
|
439 |
+
},
|
440 |
+
"phantom": {
|
441 |
+
"active": 0,
|
442 |
+
"flagValue": -1
|
443 |
+
},
|
444 |
+
"plusplus": {
|
445 |
+
"active": 0,
|
446 |
+
"flagValue": -1
|
447 |
+
},
|
448 |
+
"proto": {
|
449 |
+
"active": 0,
|
450 |
+
"flagValue": -1
|
451 |
+
},
|
452 |
+
"prototypejs": {
|
453 |
+
"active": 0,
|
454 |
+
"flagValue": -1
|
455 |
+
},
|
456 |
+
"qunit": {
|
457 |
+
"active": 0,
|
458 |
+
"flagValue": -1
|
459 |
+
},
|
460 |
+
"regexp": {
|
461 |
+
"active": 1,
|
462 |
+
"flagValue": -1
|
463 |
+
},
|
464 |
+
"rhino": {
|
465 |
+
"active": 0,
|
466 |
+
"flagValue": -1
|
467 |
+
},
|
468 |
+
"scripturl": {
|
469 |
+
"active": 0,
|
470 |
+
"flagValue": -1
|
471 |
+
},
|
472 |
+
"shadow": {
|
473 |
+
"active": 0,
|
474 |
+
"flagValue": -1
|
475 |
+
},
|
476 |
+
"shelljs": {
|
477 |
+
"active": 0,
|
478 |
+
"flagValue": -1
|
479 |
+
},
|
480 |
+
"singleGroups": {
|
481 |
+
"active": 0,
|
482 |
+
"flagValue": -1
|
483 |
+
},
|
484 |
+
"strict": {
|
485 |
+
"active": 0,
|
486 |
+
"flagValue": -1
|
487 |
+
},
|
488 |
+
"sub": {
|
489 |
+
"active": 0,
|
490 |
+
"flagValue": -1
|
491 |
+
},
|
492 |
+
"supernew": {
|
493 |
+
"active": 0,
|
494 |
+
"flagValue": -1
|
495 |
+
},
|
496 |
+
"typed": {
|
497 |
+
"active": 0,
|
498 |
+
"flagValue": -1
|
499 |
+
},
|
500 |
+
"undef": {
|
501 |
+
"active": 1,
|
502 |
+
"flagValue": -1
|
503 |
+
},
|
504 |
+
"unused": {
|
505 |
+
"active": 1,
|
506 |
+
"flagValue": -1
|
507 |
+
},
|
508 |
+
"varstmt": {
|
509 |
+
"active": 0,
|
510 |
+
"flagValue": -1
|
511 |
+
},
|
512 |
+
"withstmt": {
|
513 |
+
"active": 0,
|
514 |
+
"flagValue": -1
|
515 |
+
},
|
516 |
+
"worker": {
|
517 |
+
"active": 0,
|
518 |
+
"flagValue": -1
|
519 |
+
},
|
520 |
+
"wsh": {
|
521 |
+
"active": 0,
|
522 |
+
"flagValue": -1
|
523 |
+
},
|
524 |
+
"yui": {
|
525 |
+
"active": 0,
|
526 |
+
"flagValue": -1
|
527 |
+
}
|
528 |
+
},
|
529 |
+
"jsLintFlags2": {
|
530 |
+
"bitwise": {
|
531 |
+
"active": 0,
|
532 |
+
"flagValue": -1
|
533 |
+
},
|
534 |
+
"browser": {
|
535 |
+
"active": 1,
|
536 |
+
"flagValue": -1
|
537 |
+
},
|
538 |
+
"couch": {
|
539 |
+
"active": 0,
|
540 |
+
"flagValue": -1
|
541 |
+
},
|
542 |
+
"devel": {
|
543 |
+
"active": 0,
|
544 |
+
"flagValue": -1
|
545 |
+
},
|
546 |
+
"es6": {
|
547 |
+
"active": 0,
|
548 |
+
"flagValue": -1
|
549 |
+
},
|
550 |
+
"eval": {
|
551 |
+
"active": 0,
|
552 |
+
"flagValue": -1
|
553 |
+
},
|
554 |
+
"for": {
|
555 |
+
"active": 0,
|
556 |
+
"flagValue": -1
|
557 |
+
},
|
558 |
+
"maxlen": {
|
559 |
+
"active": 0,
|
560 |
+
"flagValue": 150
|
561 |
+
},
|
562 |
+
"node": {
|
563 |
+
"active": 0,
|
564 |
+
"flagValue": -1
|
565 |
+
},
|
566 |
+
"this": {
|
567 |
+
"active": 0,
|
568 |
+
"flagValue": -1
|
569 |
+
},
|
570 |
+
"white": {
|
571 |
+
"active": 0,
|
572 |
+
"flagValue": -1
|
573 |
+
}
|
574 |
+
},
|
575 |
+
"jsonAutoOutputPathEnabled": 0,
|
576 |
+
"jsonAutoOutputPathFilenamePattern": "*-min.json",
|
577 |
+
"jsonAutoOutputPathRelativePath": "",
|
578 |
+
"jsonAutoOutputPathReplace1": "",
|
579 |
+
"jsonAutoOutputPathReplace2": "",
|
580 |
+
"jsonAutoOutputPathStyle": 0,
|
581 |
+
"jsonOrderOutput": 0,
|
582 |
+
"jsonOutputStyle": 1,
|
583 |
+
"kitAutoOutputPathEnabled": 1,
|
584 |
+
"kitAutoOutputPathFilenamePattern": "*.html",
|
585 |
+
"kitAutoOutputPathRelativePath": "",
|
586 |
+
"kitAutoOutputPathReplace1": "",
|
587 |
+
"kitAutoOutputPathReplace2": "",
|
588 |
+
"kitAutoOutputPathStyle": 0,
|
589 |
+
"lessAllowInsecureImports": 0,
|
590 |
+
"lessAutoOutputPathEnabled": 1,
|
591 |
+
"lessAutoOutputPathFilenamePattern": "*.css",
|
592 |
+
"lessAutoOutputPathRelativePath": "..\/css",
|
593 |
+
"lessAutoOutputPathReplace1": "less",
|
594 |
+
"lessAutoOutputPathReplace2": "css",
|
595 |
+
"lessAutoOutputPathStyle": 2,
|
596 |
+
"lessCreateSourceMap": 0,
|
597 |
+
"lessDisableJavascript": 0,
|
598 |
+
"lessIeCompatibility": 1,
|
599 |
+
"lessOutputStyle": 0,
|
600 |
+
"lessRelativeURLS": 0,
|
601 |
+
"lessStrictImports": 0,
|
602 |
+
"lessStrictMath": 0,
|
603 |
+
"lessStrictUnits": 0,
|
604 |
+
"markdownAutoOutputPathEnabled": 1,
|
605 |
+
"markdownAutoOutputPathFilenamePattern": "*.html",
|
606 |
+
"markdownAutoOutputPathRelativePath": "",
|
607 |
+
"markdownAutoOutputPathReplace1": "",
|
608 |
+
"markdownAutoOutputPathReplace2": "",
|
609 |
+
"markdownAutoOutputPathStyle": 0,
|
610 |
+
"markdownCriticStyle": 0,
|
611 |
+
"markdownEnableFootnotes": 1,
|
612 |
+
"markdownEnableLabels": 1,
|
613 |
+
"markdownEnableSmartQuotes": 1,
|
614 |
+
"markdownEscapeLineBreaks": 0,
|
615 |
+
"markdownMaskEmailAddresses": 1,
|
616 |
+
"markdownOutputFormat": 0,
|
617 |
+
"markdownOutputStyle": 0,
|
618 |
+
"markdownParseMetadata": 1,
|
619 |
+
"markdownProcessHTML": 0,
|
620 |
+
"markdownRandomFootnoteNumbers": 0,
|
621 |
+
"markdownUseCompatibilityMode": 0,
|
622 |
+
"reloadFileURLs": 0,
|
623 |
+
"sassAutoOutputPathEnabled": 1,
|
624 |
+
"sassAutoOutputPathFilenamePattern": "*.css",
|
625 |
+
"sassAutoOutputPathRelativePath": "..\/css",
|
626 |
+
"sassAutoOutputPathReplace1": "sass",
|
627 |
+
"sassAutoOutputPathReplace2": "css",
|
628 |
+
"sassAutoOutputPathStyle": 2,
|
629 |
+
"sassCreateSourceMap": 0,
|
630 |
+
"sassDebugStyle": 0,
|
631 |
+
"sassDecimalPrecision": 10,
|
632 |
+
"sassOutputStyle": 0,
|
633 |
+
"sassUseLibsass": 0,
|
634 |
+
"shouldRunAutoprefixer": 0,
|
635 |
+
"shouldRunBless": 0,
|
636 |
+
"skippedItemsString": ".svn, .git, .hg, log, _logs, _cache, cache, logs, node_modules",
|
637 |
+
"slimAutoOutputPathEnabled": 1,
|
638 |
+
"slimAutoOutputPathFilenamePattern": "*.html",
|
639 |
+
"slimAutoOutputPathRelativePath": "",
|
640 |
+
"slimAutoOutputPathReplace1": "",
|
641 |
+
"slimAutoOutputPathReplace2": "",
|
642 |
+
"slimAutoOutputPathStyle": 0,
|
643 |
+
"slimCompileOnly": 0,
|
644 |
+
"slimLogicless": 0,
|
645 |
+
"slimOutputFormat": 0,
|
646 |
+
"slimOutputStyle": 1,
|
647 |
+
"slimRailsCompatible": 0,
|
648 |
+
"stylusAutoOutputPathEnabled": 1,
|
649 |
+
"stylusAutoOutputPathFilenamePattern": "*.css",
|
650 |
+
"stylusAutoOutputPathRelativePath": "..\/css",
|
651 |
+
"stylusAutoOutputPathReplace1": "stylus",
|
652 |
+
"stylusAutoOutputPathReplace2": "css",
|
653 |
+
"stylusAutoOutputPathStyle": 2,
|
654 |
+
"stylusCreateSourceMap": 0,
|
655 |
+
"stylusDebugStyle": 0,
|
656 |
+
"stylusImportCSS": 0,
|
657 |
+
"stylusOutputStyle": 0,
|
658 |
+
"stylusResolveRelativeURLS": 0,
|
659 |
+
"typescriptAutoOutputPathEnabled": 1,
|
660 |
+
"typescriptAutoOutputPathFilenamePattern": "*.js",
|
661 |
+
"typescriptAutoOutputPathRelativePath": "\/js",
|
662 |
+
"typescriptAutoOutputPathReplace1": "",
|
663 |
+
"typescriptAutoOutputPathReplace2": "",
|
664 |
+
"typescriptAutoOutputPathStyle": 2,
|
665 |
+
"typescriptCreateDeclarationFile": 0,
|
666 |
+
"typescriptCreateSourceMap": 0,
|
667 |
+
"typescriptMinifyOutput": 0,
|
668 |
+
"typescriptModuleType": 0,
|
669 |
+
"typescriptNoImplicitAny": 0,
|
670 |
+
"typescriptPreserveConstEnums": 0,
|
671 |
+
"typescriptRemoveComments": 0,
|
672 |
+
"typescriptSuppressImplicitAnyIndexErrors": 0,
|
673 |
+
"typescriptTargetECMAVersion": 0,
|
674 |
+
"uglifyDefinesString": "",
|
675 |
+
"uglifyFlags2": {
|
676 |
+
"ascii-only": {
|
677 |
+
"active": 0,
|
678 |
+
"flagValue": -1
|
679 |
+
},
|
680 |
+
"bare-returns": {
|
681 |
+
"active": 0,
|
682 |
+
"flagValue": -1
|
683 |
+
},
|
684 |
+
"booleans": {
|
685 |
+
"active": 1,
|
686 |
+
"flagValue": -1
|
687 |
+
},
|
688 |
+
"bracketize": {
|
689 |
+
"active": 0,
|
690 |
+
"flagValue": -1
|
691 |
+
},
|
692 |
+
"cascade": {
|
693 |
+
"active": 1,
|
694 |
+
"flagValue": -1
|
695 |
+
},
|
696 |
+
"comments": {
|
697 |
+
"active": 1,
|
698 |
+
"flagValue": -1
|
699 |
+
},
|
700 |
+
"comparisons": {
|
701 |
+
"active": 1,
|
702 |
+
"flagValue": -1
|
703 |
+
},
|
704 |
+
"compress": {
|
705 |
+
"active": 1,
|
706 |
+
"flagValue": -1
|
707 |
+
},
|
708 |
+
"conditionals": {
|
709 |
+
"active": 1,
|
710 |
+
"flagValue": -1
|
711 |
+
},
|
712 |
+
"dead_code": {
|
713 |
+
"active": 0,
|
714 |
+
"flagValue": -1
|
715 |
+
},
|
716 |
+
"drop_console": {
|
717 |
+
"active": 0,
|
718 |
+
"flagValue": -1
|
719 |
+
},
|
720 |
+
"drop_debugger": {
|
721 |
+
"active": 1,
|
722 |
+
"flagValue": -1
|
723 |
+
},
|
724 |
+
"eval": {
|
725 |
+
"active": 0,
|
726 |
+
"flagValue": -1
|
727 |
+
},
|
728 |
+
"evaluate": {
|
729 |
+
"active": 1,
|
730 |
+
"flagValue": -1
|
731 |
+
},
|
732 |
+
"hoist_funs": {
|
733 |
+
"active": 1,
|
734 |
+
"flagValue": -1
|
735 |
+
},
|
736 |
+
"hoist_vars": {
|
737 |
+
"active": 0,
|
738 |
+
"flagValue": -1
|
739 |
+
},
|
740 |
+
"if_return": {
|
741 |
+
"active": 1,
|
742 |
+
"flagValue": -1
|
743 |
+
},
|
744 |
+
"indent-level": {
|
745 |
+
"active": 0,
|
746 |
+
"flagValue": 4
|
747 |
+
},
|
748 |
+
"indent-start": {
|
749 |
+
"active": 0,
|
750 |
+
"flagValue": 0
|
751 |
+
},
|
752 |
+
"inline-script": {
|
753 |
+
"active": 0,
|
754 |
+
"flagValue": -1
|
755 |
+
},
|
756 |
+
"join_vars": {
|
757 |
+
"active": 1,
|
758 |
+
"flagValue": -1
|
759 |
+
},
|
760 |
+
"keep_fargs": {
|
761 |
+
"active": 0,
|
762 |
+
"flagValue": -1
|
763 |
+
},
|
764 |
+
"keep_fnames": {
|
765 |
+
"active": 0,
|
766 |
+
"flagValue": -1
|
767 |
+
},
|
768 |
+
"loops": {
|
769 |
+
"active": 1,
|
770 |
+
"flagValue": -1
|
771 |
+
},
|
772 |
+
"mangle": {
|
773 |
+
"active": 1,
|
774 |
+
"flagValue": -1
|
775 |
+
},
|
776 |
+
"max-line-len": {
|
777 |
+
"active": 1,
|
778 |
+
"flagValue": 32000
|
779 |
+
},
|
780 |
+
"negate_iife": {
|
781 |
+
"active": 1,
|
782 |
+
"flagValue": -1
|
783 |
+
},
|
784 |
+
"properties": {
|
785 |
+
"active": 1,
|
786 |
+
"flagValue": -1
|
787 |
+
},
|
788 |
+
"pure_getters": {
|
789 |
+
"active": 0,
|
790 |
+
"flagValue": -1
|
791 |
+
},
|
792 |
+
"quote-keys": {
|
793 |
+
"active": 0,
|
794 |
+
"flagValue": -1
|
795 |
+
},
|
796 |
+
"screw-ie8": {
|
797 |
+
"active": 0,
|
798 |
+
"flagValue": -1
|
799 |
+
},
|
800 |
+
"semicolons": {
|
801 |
+
"active": 1,
|
802 |
+
"flagValue": -1
|
803 |
+
},
|
804 |
+
"sequences": {
|
805 |
+
"active": 1,
|
806 |
+
"flagValue": -1
|
807 |
+
},
|
808 |
+
"sort": {
|
809 |
+
"active": 0,
|
810 |
+
"flagValue": -1
|
811 |
+
},
|
812 |
+
"space-colon": {
|
813 |
+
"active": 1,
|
814 |
+
"flagValue": -1
|
815 |
+
},
|
816 |
+
"toplevel": {
|
817 |
+
"active": 0,
|
818 |
+
"flagValue": -1
|
819 |
+
},
|
820 |
+
"unsafe": {
|
821 |
+
"active": 0,
|
822 |
+
"flagValue": -1
|
823 |
+
},
|
824 |
+
"unused": {
|
825 |
+
"active": 0,
|
826 |
+
"flagValue": -1
|
827 |
+
},
|
828 |
+
"warnings": {
|
829 |
+
"active": 0,
|
830 |
+
"flagValue": -1
|
831 |
+
},
|
832 |
+
"width": {
|
833 |
+
"active": 1,
|
834 |
+
"flagValue": 80
|
835 |
+
}
|
836 |
+
},
|
837 |
+
"uglifyReservedNamesString": "$",
|
838 |
+
"websiteRelativeRoot": ""
|
839 |
+
},
|
840 |
+
"settingsFileVersion": "2"
|
841 |
+
}
|
js/gene/braintree/vzero-0.5.js
ADDED
@@ -0,0 +1,2074 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
/**
|
3 |
+
* Magento Braintree functionality wrapped up into a neat class
|
4 |
+
*
|
5 |
+
* @class vZero
|
6 |
+
* @author Dave Macaulay <dave@gene.co.uk>
|
7 |
+
*/
|
8 |
+
var vZero = Class.create();
|
9 |
+
vZero.prototype = {
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Initialize all our required variables that we'll need later on
|
13 |
+
*
|
14 |
+
* @param code The payment methods code
|
15 |
+
* @param clientToken The client token provided by the server
|
16 |
+
* @param threeDSecure Flag to determine whether 3D secure is active, this is verified server side
|
17 |
+
* @param hostedFields Flag to determine whether we're using hosted fields
|
18 |
+
* @param billingName Billing name used in verification of the card
|
19 |
+
* @param billingPostcode Billing postcode also needed to verify the card
|
20 |
+
* @param quoteUrl The URL to update the quote totals
|
21 |
+
* @param tokenizeUrl The URL to re-tokenize 3D secure cards
|
22 |
+
* @param vaultToNonceUrl The end point to vault a nonce then return a new nonce
|
23 |
+
*/
|
24 |
+
initialize: function (code, clientToken, threeDSecure, hostedFields, billingName, billingPostcode, quoteUrl, tokenizeUrl, vaultToNonceUrl) {
|
25 |
+
this.code = code;
|
26 |
+
this.clientToken = clientToken;
|
27 |
+
this.threeDSecure = threeDSecure;
|
28 |
+
this.hostedFields = hostedFields;
|
29 |
+
|
30 |
+
if (billingName) {
|
31 |
+
this.billingName = billingName;
|
32 |
+
}
|
33 |
+
if (billingPostcode) {
|
34 |
+
this.billingPostcode = billingPostcode;
|
35 |
+
}
|
36 |
+
if (quoteUrl) {
|
37 |
+
this.quoteUrl = quoteUrl;
|
38 |
+
}
|
39 |
+
if (tokenizeUrl) {
|
40 |
+
this.tokenizeUrl = tokenizeUrl;
|
41 |
+
}
|
42 |
+
if(vaultToNonceUrl) {
|
43 |
+
this.vaultToNonceUrl = vaultToNonceUrl;
|
44 |
+
}
|
45 |
+
|
46 |
+
this._hostedFieldsTokenGenerated = false;
|
47 |
+
|
48 |
+
this.acceptedCards = false;
|
49 |
+
|
50 |
+
this.closeMethod = false;
|
51 |
+
|
52 |
+
// Store whether hosted fields is running or not
|
53 |
+
this._hostedFieldsTimeout = false;
|
54 |
+
|
55 |
+
// Store the Ajax request for the updateData
|
56 |
+
this._updateDataXhr = false;
|
57 |
+
this._updateDataCallbacks = [];
|
58 |
+
this._updateDataParams = {};
|
59 |
+
},
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Init the vZero integration by starting a new version of the client
|
63 |
+
* If 3D secure is enabled we also listen out for window messages
|
64 |
+
*/
|
65 |
+
init: function() {
|
66 |
+
this.client = new braintree.api.Client({clientToken: this.clientToken});
|
67 |
+
},
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Init the hosted fields system
|
71 |
+
*
|
72 |
+
* @param integration
|
73 |
+
*/
|
74 |
+
initHostedFields: function(integration) {
|
75 |
+
|
76 |
+
// If the hosted field number element exists hosted fields is on the page and working!
|
77 |
+
if ($$('iframe[name^="braintree-"]').length > 0) {
|
78 |
+
return false;
|
79 |
+
}
|
80 |
+
|
81 |
+
// If it's already running there's no need to start another instance
|
82 |
+
// Also block the function if braintree-hosted-submit isn't yet on the page
|
83 |
+
if ($('braintree-hosted-submit') === null) {
|
84 |
+
return false;
|
85 |
+
}
|
86 |
+
|
87 |
+
// Pass the integration through to hosted fields
|
88 |
+
this.integration = integration;
|
89 |
+
|
90 |
+
this._hostedFieldsTokenGenerated = false;
|
91 |
+
|
92 |
+
// Utilise a 50ms timeout to ensure the last call of HF is ran
|
93 |
+
clearTimeout(this._hostedFieldsTimeout);
|
94 |
+
this._hostedFieldsTimeout = setTimeout(function() {
|
95 |
+
if (this._hostedIntegration) {
|
96 |
+
// If the integration already exists, tear it down and start again
|
97 |
+
this._hostedIntegration.teardown(function() {
|
98 |
+
// Setup the hosted fields client
|
99 |
+
this.setupHostedFieldsClient();
|
100 |
+
}.bind(this));
|
101 |
+
} else {
|
102 |
+
// Setup the hosted fields client
|
103 |
+
this.setupHostedFieldsClient();
|
104 |
+
}
|
105 |
+
|
106 |
+
}.bind(this), 50);
|
107 |
+
},
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Setup the hosted fields client utilising the Braintree JS SDK
|
111 |
+
*/
|
112 |
+
setupHostedFieldsClient: function() {
|
113 |
+
|
114 |
+
// If there are iframes within the fields already, don't run again!
|
115 |
+
// This function has a delay from the original call so we need to verify everything is still good to go!
|
116 |
+
if ($$('iframe[name^="braintree-"]').length > 0) {
|
117 |
+
return false;
|
118 |
+
}
|
119 |
+
|
120 |
+
this._hostedIntegration = false;
|
121 |
+
|
122 |
+
var hostedFieldsConfiguration = {
|
123 |
+
id: this.integration.form,
|
124 |
+
hostedFields: {
|
125 |
+
styles: {
|
126 |
+
// Style all elements
|
127 |
+
"input": {
|
128 |
+
"font-size": "14pt",
|
129 |
+
"color": "#3A3A3A"
|
130 |
+
},
|
131 |
+
|
132 |
+
// Styling element state
|
133 |
+
":focus": {
|
134 |
+
"color": "black"
|
135 |
+
},
|
136 |
+
".valid": {
|
137 |
+
"color": "green"
|
138 |
+
},
|
139 |
+
".invalid": {
|
140 |
+
"color": "red"
|
141 |
+
}
|
142 |
+
},
|
143 |
+
number: {
|
144 |
+
selector: "#card-number",
|
145 |
+
placeholder: "0000 0000 0000 0000"
|
146 |
+
},
|
147 |
+
expirationMonth: {
|
148 |
+
selector: "#expiration-month",
|
149 |
+
placeholder: "MM"
|
150 |
+
},
|
151 |
+
expirationYear: {
|
152 |
+
selector: "#expiration-year",
|
153 |
+
placeholder: "YY"
|
154 |
+
},
|
155 |
+
onFieldEvent: this.hostedFieldsOnFieldEvent.bind(this)
|
156 |
+
},
|
157 |
+
onReady: function(integration) {
|
158 |
+
this._hostedIntegration = integration;
|
159 |
+
}.bind(this),
|
160 |
+
onPaymentMethodReceived: this.hostedFieldsPaymentMethodReceived.bind(this),
|
161 |
+
onError: this.hostedFieldsError.bind(this)
|
162 |
+
};
|
163 |
+
|
164 |
+
// Include the CVV field with the request
|
165 |
+
if($('cvv') !== null) {
|
166 |
+
hostedFieldsConfiguration.hostedFields.cvv = {
|
167 |
+
selector: "#cvv"
|
168 |
+
};
|
169 |
+
}
|
170 |
+
|
171 |
+
braintree.setup(this.clientToken, "custom", hostedFieldsConfiguration);
|
172 |
+
},
|
173 |
+
|
174 |
+
/**
|
175 |
+
* Update the card type on field event
|
176 |
+
*
|
177 |
+
* @param event
|
178 |
+
*/
|
179 |
+
hostedFieldsOnFieldEvent: function(event) {
|
180 |
+
if (event.type === "fieldStateChange") {
|
181 |
+
if (event.card) {
|
182 |
+
var cardMapping = {
|
183 |
+
'visa': 'VI',
|
184 |
+
'american-express': 'AE',
|
185 |
+
'master-card': 'MC',
|
186 |
+
'discovery': 'DI',
|
187 |
+
'jcb': 'JCB',
|
188 |
+
'maestro': 'ME'
|
189 |
+
};
|
190 |
+
if (typeof cardMapping[event.card.type] !== undefined) {
|
191 |
+
this.updateCardType(false, cardMapping[event.card.type]);
|
192 |
+
} else {
|
193 |
+
this.updateCardType(false, 'card');
|
194 |
+
}
|
195 |
+
}
|
196 |
+
}
|
197 |
+
},
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Vault the nonce with the associated billing data
|
201 |
+
*
|
202 |
+
* @param nonce
|
203 |
+
* @param callback
|
204 |
+
*/
|
205 |
+
vaultToNonce: function(nonce, callback) {
|
206 |
+
|
207 |
+
// Craft the parameters
|
208 |
+
var parameters = this.getBillingAddress();
|
209 |
+
parameters['nonce'] = nonce;
|
210 |
+
|
211 |
+
// Start an Ajax request to retrieve a nonce from the vault
|
212 |
+
new Ajax.Request(
|
213 |
+
this.vaultToNonceUrl,
|
214 |
+
{
|
215 |
+
method: 'post',
|
216 |
+
parameters: parameters,
|
217 |
+
onSuccess: function (transport) {
|
218 |
+
// Verify we have some response text
|
219 |
+
if (transport && transport.responseText) {
|
220 |
+
|
221 |
+
// Parse as an object
|
222 |
+
try {
|
223 |
+
response = eval('(' + transport.responseText + ')');
|
224 |
+
}
|
225 |
+
catch (e) {
|
226 |
+
response = {};
|
227 |
+
}
|
228 |
+
|
229 |
+
if(response.success && response.nonce) {
|
230 |
+
callback(response.nonce);
|
231 |
+
} else {
|
232 |
+
|
233 |
+
// Hide the loading state
|
234 |
+
if (typeof this.integration.resetLoading === 'function') {
|
235 |
+
this.integration.resetLoading();
|
236 |
+
}
|
237 |
+
|
238 |
+
if(response.error) {
|
239 |
+
alert(response.error);
|
240 |
+
} else {
|
241 |
+
alert('Something wen\'t wrong and we\'re currently unable to take your payment.');
|
242 |
+
}
|
243 |
+
}
|
244 |
+
}
|
245 |
+
}.bind(this),
|
246 |
+
onFailure: function() {
|
247 |
+
|
248 |
+
// Hide the loading state
|
249 |
+
if (typeof this.integration.resetLoading === 'function') {
|
250 |
+
this.integration.resetLoading();
|
251 |
+
}
|
252 |
+
|
253 |
+
alert('Something wen\'t wrong and we\'re currently unable to take your payment.');
|
254 |
+
|
255 |
+
}.bind(this)
|
256 |
+
}
|
257 |
+
);
|
258 |
+
},
|
259 |
+
|
260 |
+
/**
|
261 |
+
* Action to call after receiving the payment method
|
262 |
+
*
|
263 |
+
* @param response
|
264 |
+
*/
|
265 |
+
hostedFieldsPaymentMethodReceived: function(response) {
|
266 |
+
|
267 |
+
// Check if validation failed or not?
|
268 |
+
if (this.threeDSecure) {
|
269 |
+
|
270 |
+
// Show the loading state
|
271 |
+
if (typeof this.integration.setLoading === 'function') {
|
272 |
+
this.integration.setLoading();
|
273 |
+
}
|
274 |
+
|
275 |
+
// Update the quote totals first
|
276 |
+
this.updateData(function () {
|
277 |
+
this.vaultToNonce(response.nonce, function(nonce) {
|
278 |
+
|
279 |
+
// Hide the loading state
|
280 |
+
if (typeof this.integration.resetLoading === 'function') {
|
281 |
+
this.integration.resetLoading();
|
282 |
+
}
|
283 |
+
|
284 |
+
// Verify the nonce through 3Ds
|
285 |
+
vzero.verify3dSecureNonce(nonce, {
|
286 |
+
onSuccess: function (response) {
|
287 |
+
this.hostedFieldsNonceReceived(response.nonce);
|
288 |
+
}.bind(this),
|
289 |
+
onFailure: function (response, error) {
|
290 |
+
alert(error);
|
291 |
+
}.bind(this)
|
292 |
+
});
|
293 |
+
|
294 |
+
}.bind(this));
|
295 |
+
}.bind(this));
|
296 |
+
|
297 |
+
} else {
|
298 |
+
this.hostedFieldsNonceReceived(response.nonce);
|
299 |
+
}
|
300 |
+
|
301 |
+
},
|
302 |
+
|
303 |
+
/**
|
304 |
+
* Once the nonce has been received update the field
|
305 |
+
*
|
306 |
+
* @param nonce
|
307 |
+
*/
|
308 |
+
hostedFieldsNonceReceived: function(nonce) {
|
309 |
+
|
310 |
+
$('creditcard-payment-nonce').value = nonce;
|
311 |
+
$('creditcard-payment-nonce').setAttribute('value', nonce);
|
312 |
+
|
313 |
+
if (typeof this.integration.resetLoading === 'function') {
|
314 |
+
this.integration.resetLoading();
|
315 |
+
}
|
316 |
+
|
317 |
+
this._hostedFieldsTokenGenerated = true;
|
318 |
+
|
319 |
+
// Is there a success function we're wanting to run?
|
320 |
+
if (typeof this.integration.afterHostedFieldsNonceReceived === 'function') {
|
321 |
+
this.integration.afterHostedFieldsNonceReceived(nonce);
|
322 |
+
}
|
323 |
+
},
|
324 |
+
|
325 |
+
/**
|
326 |
+
* Handle hosted fields throwing an error
|
327 |
+
*
|
328 |
+
* @param response
|
329 |
+
* @returns {boolean}
|
330 |
+
*/
|
331 |
+
hostedFieldsError: function(response) {
|
332 |
+
|
333 |
+
if (typeof this.integration.resetLoading === 'function') {
|
334 |
+
this.integration.resetLoading();
|
335 |
+
}
|
336 |
+
|
337 |
+
// Stop any "Cannot place two elements in #xxx" messages being shown to the user
|
338 |
+
// These are non critical errors and the functionality will still work as expected
|
339 |
+
if(response.message.indexOf('Cannot place two elements in') == -1) {
|
340 |
+
// Let the user know what went wrong
|
341 |
+
alert(response.message);
|
342 |
+
}
|
343 |
+
|
344 |
+
this._hostedFieldsTokenGenerated = false;
|
345 |
+
|
346 |
+
if (typeof this.integration.afterHostedFieldsError === 'function') {
|
347 |
+
this.integration.afterHostedFieldsError(response.message);
|
348 |
+
}
|
349 |
+
|
350 |
+
return false;
|
351 |
+
|
352 |
+
},
|
353 |
+
|
354 |
+
/**
|
355 |
+
* Is the customer attempting to use a saved card?
|
356 |
+
*
|
357 |
+
* @returns {boolean}
|
358 |
+
*/
|
359 |
+
usingSavedCard: function() {
|
360 |
+
return ($('creditcard-saved-accounts') != undefined
|
361 |
+
&& $$('#creditcard-saved-accounts input:checked[type=radio]').first() != undefined
|
362 |
+
&& $$('#creditcard-saved-accounts input:checked[type=radio]').first().value !== 'other');
|
363 |
+
},
|
364 |
+
|
365 |
+
|
366 |
+
/**
|
367 |
+
* Set the 3Ds flag
|
368 |
+
*
|
369 |
+
* @param flag a boolean value
|
370 |
+
*/
|
371 |
+
setThreeDSecure: function(flag) {
|
372 |
+
this.threeDSecure = flag;
|
373 |
+
},
|
374 |
+
|
375 |
+
/**
|
376 |
+
* Set the amount within the checkout, this is only used in the default integration
|
377 |
+
* For any other checkouts see the updateData method, this is used by 3D secure
|
378 |
+
*
|
379 |
+
* @param amount The grand total of the order
|
380 |
+
*/
|
381 |
+
setAmount: function(amount) {
|
382 |
+
this.amount = parseFloat(amount);
|
383 |
+
},
|
384 |
+
|
385 |
+
/**
|
386 |
+
* We sometimes need to set the billing name later on in the process
|
387 |
+
*
|
388 |
+
* @param billingName
|
389 |
+
*/
|
390 |
+
setBillingName: function(billingName) {
|
391 |
+
this.billingName = billingName;
|
392 |
+
},
|
393 |
+
|
394 |
+
/**
|
395 |
+
* Return the billing name
|
396 |
+
*
|
397 |
+
* @returns {*}
|
398 |
+
*/
|
399 |
+
getBillingName: function() {
|
400 |
+
|
401 |
+
// If billingName is an object we're wanting to grab the data from elements
|
402 |
+
if (typeof this.billingName == 'object') {
|
403 |
+
|
404 |
+
// Combine them with a space
|
405 |
+
return this.combineElementsValues(this.billingName);
|
406 |
+
|
407 |
+
} else {
|
408 |
+
|
409 |
+
// Otherwise we can presume that the billing name is a string
|
410 |
+
return this.billingName;
|
411 |
+
}
|
412 |
+
},
|
413 |
+
|
414 |
+
/**
|
415 |
+
* Same for billing postcode
|
416 |
+
*
|
417 |
+
* @param billingPostcode
|
418 |
+
*/
|
419 |
+
setBillingPostcode: function(billingPostcode) {
|
420 |
+
this.billingPostcode = billingPostcode;
|
421 |
+
},
|
422 |
+
|
423 |
+
/**
|
424 |
+
* Return the billing name
|
425 |
+
*
|
426 |
+
* @returns {*}
|
427 |
+
*/
|
428 |
+
getBillingPostcode: function() {
|
429 |
+
|
430 |
+
// If billingName is an object we're wanting to grab the data from elements
|
431 |
+
if (typeof this.billingPostcode == 'object') {
|
432 |
+
|
433 |
+
// Combine them with a space
|
434 |
+
return this.combineElementsValues(this.billingPostcode);
|
435 |
+
|
436 |
+
} else {
|
437 |
+
|
438 |
+
// Otherwise we can presume that the billing name is a string
|
439 |
+
return this.billingPostcode;
|
440 |
+
}
|
441 |
+
},
|
442 |
+
|
443 |
+
/**
|
444 |
+
* Push through the selected accepted cards from the admin
|
445 |
+
*
|
446 |
+
* @param cards an array of accepted cards
|
447 |
+
*/
|
448 |
+
setAcceptedCards: function(cards) {
|
449 |
+
this.acceptedCards = cards;
|
450 |
+
},
|
451 |
+
|
452 |
+
/**
|
453 |
+
* Return the full billing address, if we cannot just serialize the billing address serialize everything
|
454 |
+
*
|
455 |
+
* @returns {array}
|
456 |
+
*/
|
457 |
+
getBillingAddress: function() {
|
458 |
+
|
459 |
+
// Is there a function in the integration for this action?
|
460 |
+
if (typeof this.integration.getBillingAddress === 'function') {
|
461 |
+
return this.integration.getBillingAddress();
|
462 |
+
}
|
463 |
+
|
464 |
+
var billingAddress = {};
|
465 |
+
|
466 |
+
// If not try something generic
|
467 |
+
if($('co-billing-form') !== null) {
|
468 |
+
if($('co-billing-form').tagName == 'FORM') {
|
469 |
+
billingAddress = $('co-billing-form').serialize(true);
|
470 |
+
} else {
|
471 |
+
billingAddress = this.extractBilling($('co-billing-form').up('form').serialize(true));
|
472 |
+
}
|
473 |
+
} else if($('billing:firstname') !== null) {
|
474 |
+
billingAddress = this.extractBilling($('billing:firstname').up('form').serialize(true));
|
475 |
+
}
|
476 |
+
|
477 |
+
if(billingAddress) {
|
478 |
+
return billingAddress;
|
479 |
+
}
|
480 |
+
},
|
481 |
+
|
482 |
+
/**
|
483 |
+
* Extract only the serialized values that start with "billing"
|
484 |
+
*
|
485 |
+
* @param formData
|
486 |
+
* @returns {{}}
|
487 |
+
*/
|
488 |
+
extractBilling: function(formData) {
|
489 |
+
var billing = {};
|
490 |
+
$H(formData).each(function(data) {
|
491 |
+
// Only include billing details, exclusing passwords
|
492 |
+
if(data.key.indexOf('billing') == 0 && data.key.indexOf('password') == -1) {
|
493 |
+
billing[data.key] = data.value;
|
494 |
+
}
|
495 |
+
});
|
496 |
+
return billing;
|
497 |
+
},
|
498 |
+
|
499 |
+
/**
|
500 |
+
* Return the accepted cards
|
501 |
+
*
|
502 |
+
* @returns {boolean|*}
|
503 |
+
*/
|
504 |
+
getAcceptedCards: function() {
|
505 |
+
return this.acceptedCards;
|
506 |
+
},
|
507 |
+
|
508 |
+
|
509 |
+
/**
|
510 |
+
* Combine elements values into a string
|
511 |
+
*
|
512 |
+
* @param elements
|
513 |
+
* @param seperator
|
514 |
+
* @returns {string}
|
515 |
+
*/
|
516 |
+
combineElementsValues: function(elements, seperator) {
|
517 |
+
|
518 |
+
// If no seperator is set use a space
|
519 |
+
if (!seperator) {
|
520 |
+
seperator = ' ';
|
521 |
+
}
|
522 |
+
|
523 |
+
// Loop through the elements and build up an array
|
524 |
+
var response = [];
|
525 |
+
elements.each(function(element, index) {
|
526 |
+
if ($(element) !== undefined) {
|
527 |
+
response[index] = $(element).value;
|
528 |
+
}
|
529 |
+
});
|
530 |
+
|
531 |
+
// Join with a space
|
532 |
+
return response.join(seperator);
|
533 |
+
|
534 |
+
},
|
535 |
+
|
536 |
+
/**
|
537 |
+
* Update the card type from a card number
|
538 |
+
*
|
539 |
+
* @param cardNumber The card number that the user has entered
|
540 |
+
* @param cardType The card type, if already known
|
541 |
+
*/
|
542 |
+
updateCardType: function(cardNumber, cardType) {
|
543 |
+
|
544 |
+
if (!cardType) {
|
545 |
+
// Retrieve the card type
|
546 |
+
cardType = this.getCardType(cardNumber);
|
547 |
+
}
|
548 |
+
|
549 |
+
if ($('gene_braintree_creditcard_cc_type') != undefined) {
|
550 |
+
if (cardType == 'card') {
|
551 |
+
// If we cannot detect which kind of card they're using remove the value from the select
|
552 |
+
$('gene_braintree_creditcard_cc_type').value = '';
|
553 |
+
} else {
|
554 |
+
// Update the validation field
|
555 |
+
$('gene_braintree_creditcard_cc_type').value = cardType;
|
556 |
+
}
|
557 |
+
}
|
558 |
+
|
559 |
+
// Check the image exists on the page
|
560 |
+
if ($('card-type-image') != undefined) {
|
561 |
+
|
562 |
+
// Grab the skin image URL without the last part
|
563 |
+
var skinImageUrl = $('card-type-image').src.substring(0, $('card-type-image').src.lastIndexOf("/"));
|
564 |
+
|
565 |
+
// Rebuild the URL with the card type included, all card types are stored as PNG's
|
566 |
+
$('card-type-image').setAttribute('src', skinImageUrl + "/" + cardType + ".png");
|
567 |
+
|
568 |
+
}
|
569 |
+
|
570 |
+
},
|
571 |
+
|
572 |
+
/**
|
573 |
+
* Create a new event upon the card number field
|
574 |
+
*/
|
575 |
+
observeCardType: function() {
|
576 |
+
|
577 |
+
if ($$('[data-genebraintree-name="number"]').first() !== undefined) {
|
578 |
+
|
579 |
+
// Observe any blurring on the form
|
580 |
+
Element.observe($$('[data-genebraintree-name="number"]').first(), 'keyup', function () {
|
581 |
+
|
582 |
+
// Update the card type
|
583 |
+
vzero.updateCardType(this.value);
|
584 |
+
});
|
585 |
+
|
586 |
+
// Add a space every 4 characters
|
587 |
+
$$('[data-genebraintree-name="number"]').first().oninput = function() {
|
588 |
+
// Add a space every 4 characters
|
589 |
+
var number = this.value.split(" ").join("");
|
590 |
+
if (number.length > 0) {
|
591 |
+
number = number.match(new RegExp('.{1,4}', 'g')).join(" ");
|
592 |
+
}
|
593 |
+
this.value = number;
|
594 |
+
};
|
595 |
+
|
596 |
+
}
|
597 |
+
|
598 |
+
},
|
599 |
+
|
600 |
+
/**
|
601 |
+
* Observe all Ajax requests, this is needed on certain checkouts
|
602 |
+
* where we're unable to easily inject into methods
|
603 |
+
*
|
604 |
+
* @param callback A defined callback function if needed
|
605 |
+
* @param ignore An array of indexOf paths to ignore
|
606 |
+
*/
|
607 |
+
observeAjaxRequests: function(callback, ignore) {
|
608 |
+
|
609 |
+
// For every ajax request on complete update various Braintree things
|
610 |
+
Ajax.Responders.register({
|
611 |
+
onComplete: function(transport) {
|
612 |
+
return this.handleAjaxRequest(transport.url, callback, ignore);
|
613 |
+
}.bind(this)
|
614 |
+
});
|
615 |
+
|
616 |
+
// Is jQuery present on the page
|
617 |
+
if (window.jQuery) {
|
618 |
+
jQuery(document).ajaxComplete(function(event, xhr, settings) {
|
619 |
+
return this.handleAjaxRequest(settings.url, callback, ignore)
|
620 |
+
});
|
621 |
+
}
|
622 |
+
|
623 |
+
},
|
624 |
+
|
625 |
+
/**
|
626 |
+
* Handle the ajax request form the observer above
|
627 |
+
*
|
628 |
+
* @param url
|
629 |
+
* @param callback
|
630 |
+
* @param ignore
|
631 |
+
* @returns {boolean}
|
632 |
+
*/
|
633 |
+
handleAjaxRequest: function(url, callback, ignore) {
|
634 |
+
|
635 |
+
// Let's check the ignore variable
|
636 |
+
if (typeof ignore !== 'undefined' && ignore instanceof Array && ignore.length > 0) {
|
637 |
+
|
638 |
+
// Determine whether we should ignore this request?
|
639 |
+
var shouldIgnore = false;
|
640 |
+
ignore.each(function (element) {
|
641 |
+
if (url && url.indexOf(element) != -1) {
|
642 |
+
shouldIgnore = true;
|
643 |
+
}
|
644 |
+
});
|
645 |
+
|
646 |
+
// If so, stop here!
|
647 |
+
if (shouldIgnore === true) {
|
648 |
+
return false;
|
649 |
+
}
|
650 |
+
}
|
651 |
+
|
652 |
+
// Check the transport object has a URL and that it wasn't to our own controller
|
653 |
+
if (url && url.indexOf('braintree') == -1) {
|
654 |
+
|
655 |
+
// Some checkout implementations may require custom callbacks
|
656 |
+
if (callback) {
|
657 |
+
callback(url);
|
658 |
+
} else {
|
659 |
+
this.updateData();
|
660 |
+
}
|
661 |
+
}
|
662 |
+
|
663 |
+
},
|
664 |
+
|
665 |
+
/**
|
666 |
+
* Make an Ajax request to the server and request up to date information regarding the quote
|
667 |
+
*
|
668 |
+
* @param callback A defined callback function if needed
|
669 |
+
* @param params any extra data to be passed to the controller
|
670 |
+
*/
|
671 |
+
updateData: function(callback, params) {
|
672 |
+
|
673 |
+
// Push the callbacks into our array
|
674 |
+
this._updateDataCallbacks.push(callback);
|
675 |
+
this._updateDataParams = params;
|
676 |
+
|
677 |
+
// If an updateData ajax request is running, cancel it
|
678 |
+
if(this._updateDataXhr !== false) {
|
679 |
+
this._updateDataXhr.transport.abort();
|
680 |
+
}
|
681 |
+
|
682 |
+
// Make a new ajax request to the server
|
683 |
+
this._updateDataXhr = new Ajax.Request(
|
684 |
+
this.quoteUrl,
|
685 |
+
{
|
686 |
+
method:'post',
|
687 |
+
parameters: this._updateDataParams,
|
688 |
+
onSuccess: function(transport) {
|
689 |
+
// Verify we have some response text
|
690 |
+
if (transport && transport.responseText) {
|
691 |
+
|
692 |
+
// Parse as an object
|
693 |
+
try {
|
694 |
+
response = eval('(' + transport.responseText + ')');
|
695 |
+
}
|
696 |
+
catch (e) {
|
697 |
+
response = {};
|
698 |
+
}
|
699 |
+
|
700 |
+
if (response.billingName != undefined) {
|
701 |
+
this.billingName = response.billingName;
|
702 |
+
}
|
703 |
+
if (response.billingPostcode != undefined) {
|
704 |
+
this.billingPostcode = response.billingPostcode;
|
705 |
+
}
|
706 |
+
if (response.grandTotal != undefined) {
|
707 |
+
this.amount = response.grandTotal;
|
708 |
+
}
|
709 |
+
if (response.threeDSecure != undefined) {
|
710 |
+
this.setThreeDSecure(response.threeDSecure);
|
711 |
+
}
|
712 |
+
|
713 |
+
// If PayPal is active update it
|
714 |
+
if (typeof vzeroPaypal != "undefined") {
|
715 |
+
|
716 |
+
// Update the totals within the PayPal system
|
717 |
+
if (response.grandTotal != undefined && response.currencyCode != undefined) {
|
718 |
+
vzeroPaypal.setPricing(response.grandTotal, response.currencyCode);
|
719 |
+
}
|
720 |
+
|
721 |
+
}
|
722 |
+
|
723 |
+
// Reset the params
|
724 |
+
this._updateDataParams = {};
|
725 |
+
|
726 |
+
// Set the flag back
|
727 |
+
this._updateDataXhr = false;
|
728 |
+
|
729 |
+
// Run any callbacks that have been stored
|
730 |
+
if(this._updateDataCallbacks.length) {
|
731 |
+
this._updateDataCallbacks.each(function (callback) {
|
732 |
+
callback(response);
|
733 |
+
}.bind(this));
|
734 |
+
this._updateDataCallbacks = [];
|
735 |
+
}
|
736 |
+
}
|
737 |
+
}.bind(this),
|
738 |
+
onFailure: function() {
|
739 |
+
|
740 |
+
// Reset the params
|
741 |
+
this._updateDataParams = {};
|
742 |
+
this._updateDataXhr = false;
|
743 |
+
this._updateDataCallbacks = [];
|
744 |
+
|
745 |
+
}.bind(this)
|
746 |
+
}
|
747 |
+
);
|
748 |
+
|
749 |
+
},
|
750 |
+
|
751 |
+
/**
|
752 |
+
* Allow custom checkouts to set a custom method for closing 3D secure
|
753 |
+
*
|
754 |
+
* @param callback A defined callback function if needed
|
755 |
+
*/
|
756 |
+
close3dSecureMethod: function(callback) {
|
757 |
+
this.closeMethod = callback;
|
758 |
+
},
|
759 |
+
|
760 |
+
/**
|
761 |
+
* If the user attempts to use a 3D secure vaulted card and then cancels the 3D
|
762 |
+
* window the nonce associated with that card will become invalid, due to this
|
763 |
+
* we have to tokenize all the 3D secure cards again
|
764 |
+
*
|
765 |
+
* @param callback A defined callback function if needed
|
766 |
+
*/
|
767 |
+
tokenize3dSavedCards: function(callback) {
|
768 |
+
|
769 |
+
// Check 3D is enabled
|
770 |
+
if (this.threeDSecure) {
|
771 |
+
|
772 |
+
// Verify we have elements with data-token
|
773 |
+
if ($$('[data-token]').first() !== undefined) {
|
774 |
+
|
775 |
+
// Gather our tokens
|
776 |
+
var tokens = [];
|
777 |
+
$$('[data-token]').each(function (element, index) {
|
778 |
+
tokens[index] = element.getAttribute('data-token');
|
779 |
+
});
|
780 |
+
|
781 |
+
// Make a new ajax request to the server
|
782 |
+
new Ajax.Request(
|
783 |
+
this.tokenizeUrl,
|
784 |
+
{
|
785 |
+
method:'post',
|
786 |
+
onSuccess: function(transport) {
|
787 |
+
|
788 |
+
// Verify we have some response text
|
789 |
+
if (transport && transport.responseText) {
|
790 |
+
|
791 |
+
// Parse as an object
|
792 |
+
try {
|
793 |
+
response = eval('(' + transport.responseText + ')');
|
794 |
+
}
|
795 |
+
catch (e) {
|
796 |
+
response = {};
|
797 |
+
}
|
798 |
+
|
799 |
+
// Check the response was successful
|
800 |
+
if (response.success) {
|
801 |
+
|
802 |
+
// Loop through the returned tokens
|
803 |
+
$H(response.tokens).each(function (element) {
|
804 |
+
|
805 |
+
// If the token exists update it's nonce
|
806 |
+
if ($$('[data-token="' + element.key + '"]').first() != undefined) {
|
807 |
+
$$('[data-token="' + element.key + '"]').first().setAttribute('data-threedsecure-nonce', element.value);
|
808 |
+
}
|
809 |
+
});
|
810 |
+
}
|
811 |
+
|
812 |
+
if (callback) {
|
813 |
+
callback(response);
|
814 |
+
}
|
815 |
+
}
|
816 |
+
}.bind(this),
|
817 |
+
parameters: {'tokens': Object.toJSON(tokens)}
|
818 |
+
}
|
819 |
+
);
|
820 |
+
} else {
|
821 |
+
callback();
|
822 |
+
}
|
823 |
+
|
824 |
+
} else {
|
825 |
+
callback();
|
826 |
+
}
|
827 |
+
},
|
828 |
+
|
829 |
+
onUserClose3ds: function() {
|
830 |
+
this._hostedFieldsTokenGenerated = false;
|
831 |
+
// Is there a close method defined?
|
832 |
+
if (this.closeMethod) {
|
833 |
+
this.closeMethod();
|
834 |
+
} else {
|
835 |
+
checkout.setLoadWaiting(false);
|
836 |
+
}
|
837 |
+
},
|
838 |
+
|
839 |
+
/**
|
840 |
+
* Verify a nonce through 3ds
|
841 |
+
*
|
842 |
+
* @param nonce
|
843 |
+
* @param options
|
844 |
+
*/
|
845 |
+
verify3dSecureNonce: function(nonce, options) {
|
846 |
+
|
847 |
+
var threeDSecureRequest = {
|
848 |
+
amount: this.amount,
|
849 |
+
creditCard: nonce,
|
850 |
+
onUserClose: this.onUserClose3ds.bind(this)
|
851 |
+
};
|
852 |
+
|
853 |
+
// Run the verify function on the braintree client
|
854 |
+
this.client.verify3DS(threeDSecureRequest, function (error, response) {
|
855 |
+
|
856 |
+
if (!error) {
|
857 |
+
// Run any callback functions
|
858 |
+
if (options.onSuccess) {
|
859 |
+
options.onSuccess(response);
|
860 |
+
}
|
861 |
+
} else {
|
862 |
+
if (options.onFailure) {
|
863 |
+
options.onFailure(response, error.message);
|
864 |
+
}
|
865 |
+
}
|
866 |
+
});
|
867 |
+
|
868 |
+
},
|
869 |
+
|
870 |
+
/**
|
871 |
+
* Make a request to Braintree for 3D secure information
|
872 |
+
*
|
873 |
+
* @param options Contains any callback functions which have been set
|
874 |
+
*/
|
875 |
+
verify3dSecure: function(options) {
|
876 |
+
|
877 |
+
var threeDSecureRequest = {
|
878 |
+
amount: this.amount,
|
879 |
+
creditCard: {
|
880 |
+
number: $$('[data-genebraintree-name="number"]').first().value,
|
881 |
+
expirationMonth: $$('[data-genebraintree-name="expiration_month"]').first().value,
|
882 |
+
expirationYear: $$('[data-genebraintree-name="expiration_year"]').first().value,
|
883 |
+
cardholderName: this.getBillingName()
|
884 |
+
},
|
885 |
+
onUserClose: this.onUserClose3ds.bind(this)
|
886 |
+
};
|
887 |
+
|
888 |
+
// If the CVV field exists include it
|
889 |
+
if ($$('[data-genebraintree-name="cvv"]').first() != undefined) {
|
890 |
+
threeDSecureRequest.creditCard.cvv = $$('[data-genebraintree-name="cvv"]').first().value;
|
891 |
+
}
|
892 |
+
|
893 |
+
// If we have the billing postcode add it into the request
|
894 |
+
if (this.getBillingPostcode() != "") {
|
895 |
+
threeDSecureRequest.creditCard.billingAddress = {
|
896 |
+
postalCode: this.getBillingPostcode()
|
897 |
+
};
|
898 |
+
}
|
899 |
+
|
900 |
+
// Run the verify function on the braintree client
|
901 |
+
this.client.verify3DS(threeDSecureRequest, function (error, response) {
|
902 |
+
|
903 |
+
if (!error) {
|
904 |
+
|
905 |
+
// Store threeDSecure token and nonce in form
|
906 |
+
$('creditcard-payment-nonce').value = response.nonce;
|
907 |
+
$('creditcard-payment-nonce').setAttribute('value', response.nonce);
|
908 |
+
|
909 |
+
// Run any callback functions
|
910 |
+
if (options.onSuccess) {
|
911 |
+
options.onSuccess();
|
912 |
+
}
|
913 |
+
} else {
|
914 |
+
|
915 |
+
// Show the error
|
916 |
+
alert(error.message);
|
917 |
+
|
918 |
+
if (options.onFailure) {
|
919 |
+
options.onFailure();
|
920 |
+
} else {
|
921 |
+
checkout.setLoadWaiting(false);
|
922 |
+
}
|
923 |
+
}
|
924 |
+
});
|
925 |
+
|
926 |
+
},
|
927 |
+
|
928 |
+
/**
|
929 |
+
* Verify a card stored in the vault
|
930 |
+
*
|
931 |
+
* @param options Contains any callback functions which have been set
|
932 |
+
*/
|
933 |
+
verify3dSecureVault: function(options) {
|
934 |
+
|
935 |
+
// Get the payment nonce
|
936 |
+
var paymentNonce = $$('#creditcard-saved-accounts input:checked[type=radio]').first().getAttribute('data-threedsecure-nonce');
|
937 |
+
|
938 |
+
if (paymentNonce) {
|
939 |
+
// Run the verify function on the braintree client
|
940 |
+
this.client.verify3DS({
|
941 |
+
amount: this.amount,
|
942 |
+
creditCard: paymentNonce
|
943 |
+
}, function (error, response) {
|
944 |
+
if (!error) {
|
945 |
+
|
946 |
+
// Store threeDSecure token and nonce in form
|
947 |
+
$('creditcard-payment-nonce').removeAttribute('disabled');
|
948 |
+
$('creditcard-payment-nonce').value = response.nonce;
|
949 |
+
$('creditcard-payment-nonce').setAttribute('value', response.nonce);
|
950 |
+
|
951 |
+
// Run any callback functions
|
952 |
+
if (options.onSuccess) {
|
953 |
+
options.onSuccess();
|
954 |
+
}
|
955 |
+
} else {
|
956 |
+
|
957 |
+
// Show the error
|
958 |
+
alert(error.message);
|
959 |
+
|
960 |
+
if (options.onFailure) {
|
961 |
+
options.onFailure();
|
962 |
+
} else {
|
963 |
+
checkout.setLoadWaiting(false);
|
964 |
+
}
|
965 |
+
}
|
966 |
+
});
|
967 |
+
} else {
|
968 |
+
alert('No payment nonce present.');
|
969 |
+
|
970 |
+
if (options.onFailure) {
|
971 |
+
options.onFailure();
|
972 |
+
} else {
|
973 |
+
checkout.setLoadWaiting(false);
|
974 |
+
}
|
975 |
+
}
|
976 |
+
|
977 |
+
},
|
978 |
+
|
979 |
+
/**
|
980 |
+
* Process a standard card request
|
981 |
+
*
|
982 |
+
* @param options Contains any callback functions which have been set
|
983 |
+
*/
|
984 |
+
processCard: function(options) {
|
985 |
+
|
986 |
+
var tokenizeRequest = {
|
987 |
+
number: $$('[data-genebraintree-name="number"]').first().value,
|
988 |
+
cardholderName: this.getBillingName(),
|
989 |
+
expirationMonth: $$('[data-genebraintree-name="expiration_month"]').first().value,
|
990 |
+
expirationYear: $$('[data-genebraintree-name="expiration_year"]').first().value
|
991 |
+
};
|
992 |
+
|
993 |
+
// If the CVV field exists include it
|
994 |
+
if ($$('[data-genebraintree-name="cvv"]').first() != undefined) {
|
995 |
+
tokenizeRequest.cvv = $$('[data-genebraintree-name="cvv"]').first().value;
|
996 |
+
}
|
997 |
+
|
998 |
+
// If we have the billing postcode add it into the request
|
999 |
+
if (this.getBillingPostcode() != "") {
|
1000 |
+
tokenizeRequest.billingAddress = {
|
1001 |
+
postalCode: this.getBillingPostcode()
|
1002 |
+
};
|
1003 |
+
}
|
1004 |
+
|
1005 |
+
// Attempt to tokenize the card
|
1006 |
+
this.client.tokenizeCard(tokenizeRequest, function (errors, nonce) {
|
1007 |
+
|
1008 |
+
if (!errors) {
|
1009 |
+
// Update the nonce in the form
|
1010 |
+
$('creditcard-payment-nonce').value = nonce;
|
1011 |
+
$('creditcard-payment-nonce').setAttribute('value', nonce);
|
1012 |
+
|
1013 |
+
// Run any callback functions
|
1014 |
+
if (options.onSuccess) {
|
1015 |
+
options.onSuccess();
|
1016 |
+
}
|
1017 |
+
} else {
|
1018 |
+
// Handle errors
|
1019 |
+
for (var i = 0; i < errors.length; i++) {
|
1020 |
+
alert(errors[i].code + " " + errors[i].message);
|
1021 |
+
}
|
1022 |
+
|
1023 |
+
if (options.onFailure) {
|
1024 |
+
options.onFailure();
|
1025 |
+
} else {
|
1026 |
+
checkout.setLoadWaiting(false);
|
1027 |
+
}
|
1028 |
+
}
|
1029 |
+
});
|
1030 |
+
|
1031 |
+
},
|
1032 |
+
|
1033 |
+
/**
|
1034 |
+
* Should our integrations intercept credit card payments based on the settings?
|
1035 |
+
*
|
1036 |
+
* @returns {boolean}
|
1037 |
+
*/
|
1038 |
+
shouldInterceptCreditCard: function() {
|
1039 |
+
return true;
|
1040 |
+
},
|
1041 |
+
|
1042 |
+
/**
|
1043 |
+
* Should our integrations intercept PayPal payments based on the settings?
|
1044 |
+
*
|
1045 |
+
* @returns {boolean}
|
1046 |
+
*/
|
1047 |
+
shouldInterceptPayPal: function() {
|
1048 |
+
return true;
|
1049 |
+
},
|
1050 |
+
|
1051 |
+
/**
|
1052 |
+
* Conduct a regular expression check to determine card type automatically
|
1053 |
+
*
|
1054 |
+
* @param number
|
1055 |
+
* @returns {string}
|
1056 |
+
*/
|
1057 |
+
getCardType: function(number) {
|
1058 |
+
|
1059 |
+
if(number) {
|
1060 |
+
|
1061 |
+
if (number.match(/^4/) != null)
|
1062 |
+
return "VI";
|
1063 |
+
|
1064 |
+
if (number.match(/^(34|37)/) != null)
|
1065 |
+
return "AE";
|
1066 |
+
|
1067 |
+
if (number.match(/^5[1-5]/) != null)
|
1068 |
+
return "MC";
|
1069 |
+
|
1070 |
+
if (number.match(/^6011/) != null)
|
1071 |
+
return "DI";
|
1072 |
+
|
1073 |
+
if (number.match(/^(?:2131|1800|35)/) != null)
|
1074 |
+
return "JCB";
|
1075 |
+
|
1076 |
+
if (number.match(/^(5018|5020|5038|6304|67[0-9]{2})/) != null)
|
1077 |
+
return "ME";
|
1078 |
+
|
1079 |
+
}
|
1080 |
+
|
1081 |
+
// Otherwise return the standard card
|
1082 |
+
return "card";
|
1083 |
+
},
|
1084 |
+
|
1085 |
+
/**
|
1086 |
+
* Wrapper function which defines which method should be called
|
1087 |
+
*
|
1088 |
+
* verify3dSecureVault - used for verifying any vaulted card when 3D secure is enabled
|
1089 |
+
* verify3dSecure - verify a normal card via 3D secure
|
1090 |
+
* processCard - verify a normal card
|
1091 |
+
*
|
1092 |
+
* If the customer has choosen a vaulted card and 3D is disabled no client side interaction is needed
|
1093 |
+
*
|
1094 |
+
* @param options Object containing onSuccess, onFailure functions
|
1095 |
+
*/
|
1096 |
+
process: function(options) {
|
1097 |
+
|
1098 |
+
// If options isn't set, use an empty object
|
1099 |
+
options = options || {};
|
1100 |
+
|
1101 |
+
// If the hosted fields token has been generated just glide through
|
1102 |
+
if(this._hostedFieldsTokenGenerated) {
|
1103 |
+
|
1104 |
+
// No action required as we're using a saved card
|
1105 |
+
if (options.onSuccess) {
|
1106 |
+
options.onSuccess()
|
1107 |
+
}
|
1108 |
+
|
1109 |
+
} else if (this.usingSavedCard() && $$('#creditcard-saved-accounts input:checked[type=radio]').first().hasAttribute('data-threedsecure-nonce')) {
|
1110 |
+
|
1111 |
+
// The user has selected a card stored via 3D secure
|
1112 |
+
this.verify3dSecureVault(options);
|
1113 |
+
|
1114 |
+
} else if (this.usingSavedCard()) {
|
1115 |
+
|
1116 |
+
// Update data and process
|
1117 |
+
this.updateData(function() {
|
1118 |
+
// No action required as we're using a saved card
|
1119 |
+
if (options.onSuccess) {
|
1120 |
+
options.onSuccess()
|
1121 |
+
}
|
1122 |
+
});
|
1123 |
+
|
1124 |
+
} else if (this.threeDSecure == true) {
|
1125 |
+
|
1126 |
+
// Standard 3D secure callback
|
1127 |
+
this.verify3dSecure(options);
|
1128 |
+
|
1129 |
+
} else {
|
1130 |
+
|
1131 |
+
// Otherwise process the card normally
|
1132 |
+
this.processCard(options);
|
1133 |
+
}
|
1134 |
+
},
|
1135 |
+
|
1136 |
+
creditCardLoaded: function() {
|
1137 |
+
return false;
|
1138 |
+
},
|
1139 |
+
|
1140 |
+
paypalLoaded: function() {
|
1141 |
+
return false;
|
1142 |
+
}
|
1143 |
+
|
1144 |
+
};
|
1145 |
+
|
1146 |
+
/**
|
1147 |
+
* Separate class to handle functionality around the vZero PayPal button
|
1148 |
+
*
|
1149 |
+
* @class vZeroPayPalButton
|
1150 |
+
* @author Dave Macaulay <dave@gene.co.uk>
|
1151 |
+
*/
|
1152 |
+
var vZeroPayPalButton = Class.create();
|
1153 |
+
vZeroPayPalButton.prototype = {
|
1154 |
+
|
1155 |
+
/**
|
1156 |
+
* Initialize the PayPal button class
|
1157 |
+
*
|
1158 |
+
* @param clientToken Client token generated from server
|
1159 |
+
* @param storeFrontName The store name to show within the PayPal modal window
|
1160 |
+
* @param singleUse Should the system attempt to open in single payment mode?
|
1161 |
+
* @param locale The locale for the payment
|
1162 |
+
* @param futureSingleUse When using future payments should we process the transaction as a single payment?
|
1163 |
+
*/
|
1164 |
+
initialize: function (clientToken, storeFrontName, singleUse, locale, futureSingleUse) {
|
1165 |
+
this.clientToken = clientToken;
|
1166 |
+
this.storeFrontName = storeFrontName;
|
1167 |
+
this.singleUse = singleUse;
|
1168 |
+
this.locale = locale;
|
1169 |
+
this.futureSingleUse = futureSingleUse;
|
1170 |
+
|
1171 |
+
this._paypalOptions = {};
|
1172 |
+
this._paypalIntegration = false;
|
1173 |
+
},
|
1174 |
+
|
1175 |
+
/**
|
1176 |
+
* Update the pricing information for the PayPal button
|
1177 |
+
* If the PayPalClient has already been created we also update the _clientOptions
|
1178 |
+
* so the PayPal modal window displays the correct values
|
1179 |
+
*
|
1180 |
+
* @param amount The amount formatted to two decimal places
|
1181 |
+
* @param currency The currency code
|
1182 |
+
*/
|
1183 |
+
setPricing: function(amount, currency) {
|
1184 |
+
|
1185 |
+
// Set them into the class
|
1186 |
+
this.amount = parseFloat(amount);
|
1187 |
+
this.currency = currency;
|
1188 |
+
|
1189 |
+
// As the amounts and currency has been updated let's update the button by rebuilding it
|
1190 |
+
this.rebuildButton();
|
1191 |
+
|
1192 |
+
},
|
1193 |
+
|
1194 |
+
/**
|
1195 |
+
* Rebuild the PayPal button
|
1196 |
+
*/
|
1197 |
+
rebuildButton: function() {
|
1198 |
+
|
1199 |
+
if (this._paypalIntegration !== false) {
|
1200 |
+
this._paypalIntegration.teardown(function() {
|
1201 |
+
|
1202 |
+
// Re-add the button with the same options
|
1203 |
+
this.addPayPalButton(this._paypalOptions);
|
1204 |
+
|
1205 |
+
}.bind(this));
|
1206 |
+
}
|
1207 |
+
},
|
1208 |
+
|
1209 |
+
/**
|
1210 |
+
* Inject the PayPal button into the document
|
1211 |
+
*
|
1212 |
+
* @param options Object containing onSuccess method
|
1213 |
+
*/
|
1214 |
+
addPayPalButton: function(options) {
|
1215 |
+
|
1216 |
+
// If the container isn't present on the page we can't add the button
|
1217 |
+
if($('paypal-container') === null) {
|
1218 |
+
return false;
|
1219 |
+
}
|
1220 |
+
|
1221 |
+
// Store the options as we may need to rebuild the button
|
1222 |
+
this._paypalOptions = options;
|
1223 |
+
this._paypalIntegration = false;
|
1224 |
+
|
1225 |
+
// Build up our setup configuration
|
1226 |
+
var setupConfiguration = {
|
1227 |
+
container: "paypal-container",
|
1228 |
+
paymentMethodNonceInputField: "paypal-payment-nonce",
|
1229 |
+
displayName: this.storeFrontName,
|
1230 |
+
onPaymentMethodReceived: function(obj) {
|
1231 |
+
|
1232 |
+
// If we have a success callback we're most likely using a non-default checkout
|
1233 |
+
if (typeof options.onSuccess === 'function') {
|
1234 |
+
options.onSuccess(obj);
|
1235 |
+
} else {
|
1236 |
+
// Otherwise we're using the default checkout
|
1237 |
+
payment.switchMethod('gene_braintree_paypal');
|
1238 |
+
|
1239 |
+
// Re-enable the form
|
1240 |
+
$('paypal-payment-nonce').removeAttribute('disabled');
|
1241 |
+
|
1242 |
+
// Remove the PayPal button
|
1243 |
+
$('paypal-complete').remove();
|
1244 |
+
|
1245 |
+
// Submit the checkout steps
|
1246 |
+
window.review && review.save();
|
1247 |
+
}
|
1248 |
+
|
1249 |
+
},
|
1250 |
+
onUnsupported: function() {
|
1251 |
+
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.');
|
1252 |
+
},
|
1253 |
+
onReady: function(integration) {
|
1254 |
+
this._paypalIntegration = integration;
|
1255 |
+
if (typeof options.onReady === 'function') {
|
1256 |
+
options.onReady(integration);
|
1257 |
+
}
|
1258 |
+
}.bind(this)
|
1259 |
+
};
|
1260 |
+
|
1261 |
+
// Single use requires some extra data to be sent through, this is so the PayPal window can display the correct total etc
|
1262 |
+
if (this.singleUse == true) {
|
1263 |
+
|
1264 |
+
setupConfiguration.singleUse = true;
|
1265 |
+
setupConfiguration.amount = this.amount;
|
1266 |
+
setupConfiguration.currency = this.currency;
|
1267 |
+
setupConfiguration.locale = this.locale;
|
1268 |
+
|
1269 |
+
} else if (this.futureSingleUse == true) {
|
1270 |
+
|
1271 |
+
setupConfiguration.singleUse = true;
|
1272 |
+
|
1273 |
+
}
|
1274 |
+
|
1275 |
+
// Start a new version of the client and assign for later modifications
|
1276 |
+
braintree.setup(this.clientToken, "paypal", setupConfiguration);
|
1277 |
+
},
|
1278 |
+
|
1279 |
+
/**
|
1280 |
+
* Allow closing of the PayPal window
|
1281 |
+
*
|
1282 |
+
* @param callback A defined callback function if needed
|
1283 |
+
* @deprecated since version 1.0.4.1
|
1284 |
+
*/
|
1285 |
+
closePayPalWindow: function(callback) {
|
1286 |
+
// Function deprecated in favour of using event propagation
|
1287 |
+
}
|
1288 |
+
|
1289 |
+
};
|
1290 |
+
|
1291 |
+
/**
|
1292 |
+
* The integration class for the Default checkout
|
1293 |
+
*
|
1294 |
+
* @class vZeroIntegration
|
1295 |
+
* @author Dave Macaulay <dave@gene.co.uk>
|
1296 |
+
*/
|
1297 |
+
var vZeroIntegration = Class.create();
|
1298 |
+
vZeroIntegration.prototype = {
|
1299 |
+
|
1300 |
+
/**
|
1301 |
+
* Create an instance of the integration
|
1302 |
+
*
|
1303 |
+
* @param vzero The vZero class that's being used by the checkout
|
1304 |
+
* @param vzeroPaypal The vZero PayPal object
|
1305 |
+
* @param paypalMarkUp The markup used for the PayPal button
|
1306 |
+
* @param paypalButtonClass The class of the button we need to replace with the above mark up
|
1307 |
+
* @param isOnepage Is the integration a onepage checkout?
|
1308 |
+
* @param config Any further config the integration wants to push into the class
|
1309 |
+
*/
|
1310 |
+
initialize: function(vzero, vzeroPaypal, paypalMarkUp, paypalButtonClass, isOnepage, config) {
|
1311 |
+
|
1312 |
+
// Only allow the system to be initialized twice
|
1313 |
+
if (vZeroIntegration.prototype.loaded) {
|
1314 |
+
console.error('Your checkout is including the Braintree resources multiple times, please resolve this.');
|
1315 |
+
return false;
|
1316 |
+
}
|
1317 |
+
vZeroIntegration.prototype.loaded = true;
|
1318 |
+
|
1319 |
+
this.vzero = vzero || false;
|
1320 |
+
this.vzeroPaypal = vzeroPaypal || false;
|
1321 |
+
|
1322 |
+
// If both methods aren't present don't run the integration
|
1323 |
+
if(this.vzero === false && this.vzeroPaypal === false) {
|
1324 |
+
console.warn('The vzero and vzeroPaypal objects are not initiated.');
|
1325 |
+
return false;
|
1326 |
+
}
|
1327 |
+
|
1328 |
+
this.paypalMarkUp = paypalMarkUp || false;
|
1329 |
+
this.paypalButtonClass = paypalButtonClass || false;
|
1330 |
+
|
1331 |
+
this.isOnepage = isOnepage || false;
|
1332 |
+
|
1333 |
+
this.config = config || {};
|
1334 |
+
|
1335 |
+
this._methodSwitchTimeout = false;
|
1336 |
+
|
1337 |
+
// Hosted fields hasn't been initialized yet
|
1338 |
+
this._hostedFieldsInit = false;
|
1339 |
+
|
1340 |
+
// Call the function which is going to intercept the submit event
|
1341 |
+
this.prepareSubmitObserver();
|
1342 |
+
this.preparePaymentMethodSwitchObserver();
|
1343 |
+
|
1344 |
+
// Has the hosted fields method been generated successfully?
|
1345 |
+
this.hostedFieldsGenerated = false;
|
1346 |
+
|
1347 |
+
// Attach events for when the 3Ds window is closed
|
1348 |
+
this.vzero.close3dSecureMethod(function () {
|
1349 |
+
|
1350 |
+
// As hosted fields validation can still be true when a customer closes the modal clear it
|
1351 |
+
this.vzero._hostedFieldsValidationRunning = false;
|
1352 |
+
|
1353 |
+
// Re-tokenize all the saved cards
|
1354 |
+
this.vzero.tokenize3dSavedCards(function () {
|
1355 |
+
this.threeDTokenizationComplete();
|
1356 |
+
}.bind(this));
|
1357 |
+
|
1358 |
+
}.bind(this));
|
1359 |
+
|
1360 |
+
// On onepage checkouts we need to do some other magic
|
1361 |
+
if (this.isOnepage) {
|
1362 |
+
this.vzero.observeCardType();
|
1363 |
+
this.observeAjaxRequests();
|
1364 |
+
|
1365 |
+
document.observe("dom:loaded", function () {
|
1366 |
+
this.initSavedPayPal();
|
1367 |
+
this.initDefaultMethod();
|
1368 |
+
|
1369 |
+
if ($('braintree-hosted-submit') !== null) {
|
1370 |
+
this.initHostedFields();
|
1371 |
+
}
|
1372 |
+
}.bind(this));
|
1373 |
+
}
|
1374 |
+
|
1375 |
+
document.observe("dom:loaded", function () {
|
1376 |
+
// Saved methods need events to!
|
1377 |
+
this.initSavedMethods();
|
1378 |
+
}.bind(this));
|
1379 |
+
},
|
1380 |
+
|
1381 |
+
/**
|
1382 |
+
* Init the saved method events
|
1383 |
+
*/
|
1384 |
+
initSavedMethods: function() {
|
1385 |
+
|
1386 |
+
// Loop through each saved card being selected
|
1387 |
+
$$('#creditcard-saved-accounts input[type="radio"], #paypal-saved-accounts input[type="radio"]').each(function (element) {
|
1388 |
+
|
1389 |
+
// Determine which method we're observing
|
1390 |
+
var parentElement = '';
|
1391 |
+
var targetElement = '';
|
1392 |
+
if (element.up('#creditcard-saved-accounts') !== undefined) {
|
1393 |
+
parentElement = '#creditcard-saved-accounts';
|
1394 |
+
targetElement = '#credit-card-form';
|
1395 |
+
} else if (element.up('#paypal-saved-accounts') !== undefined) {
|
1396 |
+
parentElement = '#paypal-saved-accounts';
|
1397 |
+
targetElement = '.paypal-info';
|
1398 |
+
}
|
1399 |
+
|
1400 |
+
// Observe the elements changing
|
1401 |
+
$(element).stopObserving('change').observe('change', function (event) {
|
1402 |
+
return this.showHideOtherMethod(parentElement, targetElement);
|
1403 |
+
}.bind(this));
|
1404 |
+
|
1405 |
+
}.bind(this));
|
1406 |
+
|
1407 |
+
},
|
1408 |
+
|
1409 |
+
/**
|
1410 |
+
* Hide or show the "other" method for both PayPal & Credit Card
|
1411 |
+
*
|
1412 |
+
* @param parentElement
|
1413 |
+
* @param targetElement
|
1414 |
+
*/
|
1415 |
+
showHideOtherMethod: function(parentElement, targetElement) {
|
1416 |
+
|
1417 |
+
// Has the user selected other?
|
1418 |
+
if ($$(parentElement + ' input:checked[type=radio]').first() !== undefined && $$(parentElement + ' input:checked[type=radio]').first().value == 'other') {
|
1419 |
+
|
1420 |
+
if ($$(targetElement).first() !== undefined) {
|
1421 |
+
|
1422 |
+
// Show the credit card form
|
1423 |
+
$$(targetElement).first().show();
|
1424 |
+
|
1425 |
+
// Enable the credit card form all the elements in the credit card form
|
1426 |
+
$$(targetElement + ' input, ' + targetElement + ' select').each(function (formElement) {
|
1427 |
+
formElement.removeAttribute('disabled');
|
1428 |
+
});
|
1429 |
+
|
1430 |
+
}
|
1431 |
+
|
1432 |
+
} else if ($$(parentElement + ' input:checked[type=radio]').first() !== undefined) {
|
1433 |
+
|
1434 |
+
if ($$(targetElement).first() !== undefined) {
|
1435 |
+
|
1436 |
+
// Hide the new credit card form
|
1437 |
+
$$(targetElement).first().hide();
|
1438 |
+
|
1439 |
+
// Disable all the elements in the credit card form
|
1440 |
+
$$(targetElement + ' input, ' + targetElement + ' select').each(function (formElement) {
|
1441 |
+
formElement.setAttribute('disabled', 'disabled');
|
1442 |
+
});
|
1443 |
+
|
1444 |
+
}
|
1445 |
+
|
1446 |
+
}
|
1447 |
+
},
|
1448 |
+
|
1449 |
+
/**
|
1450 |
+
* Check to see if the "Other" option is selected and show the div correctly
|
1451 |
+
*/
|
1452 |
+
checkSavedOther: function() {
|
1453 |
+
var parentElement = '';
|
1454 |
+
var targetElement = '';
|
1455 |
+
|
1456 |
+
if (this.getPaymentMethod() == 'gene_braintree_creditcard') {
|
1457 |
+
parentElement = '#creditcard-saved-accounts';
|
1458 |
+
targetElement = '#credit-card-form';
|
1459 |
+
} else if (this.getPaymentMethod() == 'gene_braintree_paypal') {
|
1460 |
+
parentElement = '#paypal-saved-accounts';
|
1461 |
+
targetElement = '.paypal-info';
|
1462 |
+
}
|
1463 |
+
|
1464 |
+
// Only run this action if the parent element exists on the page
|
1465 |
+
if ($$(parentElement).first() !== undefined) {
|
1466 |
+
this.showHideOtherMethod(parentElement, targetElement);
|
1467 |
+
}
|
1468 |
+
},
|
1469 |
+
|
1470 |
+
/**
|
1471 |
+
* Init hosted fields
|
1472 |
+
*/
|
1473 |
+
initHostedFields: function() {
|
1474 |
+
|
1475 |
+
// Only init hosted fields if it's enabled
|
1476 |
+
if (this.vzero.hostedFields) {
|
1477 |
+
|
1478 |
+
// Verify the form is on the page
|
1479 |
+
if ($('braintree-hosted-submit') !== null) {
|
1480 |
+
|
1481 |
+
// Verify this checkout has a form (would be weird to have a formless checkout, but you never know!)
|
1482 |
+
if ($('braintree-hosted-submit').up('form') !== undefined) {
|
1483 |
+
|
1484 |
+
// Flag hosted fields being init
|
1485 |
+
this._hostedFieldsInit = true;
|
1486 |
+
|
1487 |
+
// Store the form in the integration class
|
1488 |
+
this.form = $('braintree-hosted-submit').up('form');
|
1489 |
+
|
1490 |
+
// Init hosted fields upon the form
|
1491 |
+
this.vzero.initHostedFields(this);
|
1492 |
+
|
1493 |
+
} else {
|
1494 |
+
console.error('Hosted Fields cannot be initialized as we\'re unable to locate the parent form.');
|
1495 |
+
}
|
1496 |
+
}
|
1497 |
+
}
|
1498 |
+
},
|
1499 |
+
|
1500 |
+
/**
|
1501 |
+
* After a successful hosted fields call
|
1502 |
+
*
|
1503 |
+
* @param nonce
|
1504 |
+
* @returns {*}
|
1505 |
+
*/
|
1506 |
+
afterHostedFieldsNonceReceived: function(nonce) {
|
1507 |
+
this.resetLoading();
|
1508 |
+
this.vzero._hostedFieldsTokenGenerated = true;
|
1509 |
+
this.hostedFieldsGenerated = true;
|
1510 |
+
if (this.isOnepage) {
|
1511 |
+
return this.submitCheckout();
|
1512 |
+
} else {
|
1513 |
+
return this.submitPayment();
|
1514 |
+
}
|
1515 |
+
},
|
1516 |
+
|
1517 |
+
/**
|
1518 |
+
* Handle hosted fields throwing an error
|
1519 |
+
*
|
1520 |
+
* @param message
|
1521 |
+
* @returns {boolean}
|
1522 |
+
*/
|
1523 |
+
afterHostedFieldsError: function(message) {
|
1524 |
+
this.vzero._hostedFieldsTokenGenerated = false;
|
1525 |
+
this.hostedFieldsGenerated = false;
|
1526 |
+
return false;
|
1527 |
+
},
|
1528 |
+
|
1529 |
+
/**
|
1530 |
+
* Init the default payment methods
|
1531 |
+
*/
|
1532 |
+
initDefaultMethod: function() {
|
1533 |
+
if (this.shouldAddPayPalButton(false)) {
|
1534 |
+
this.setLoading();
|
1535 |
+
this.vzero.updateData(function() {
|
1536 |
+
this.resetLoading();
|
1537 |
+
this.updatePayPalButton('add');
|
1538 |
+
}.bind(this));
|
1539 |
+
}
|
1540 |
+
},
|
1541 |
+
|
1542 |
+
/**
|
1543 |
+
* Observe any Ajax requests and refresh the PayPal button or update the checkouts data
|
1544 |
+
*/
|
1545 |
+
observeAjaxRequests: function() {
|
1546 |
+
this.vzero.observeAjaxRequests(function() {
|
1547 |
+
this.vzero.updateData(function() {
|
1548 |
+
|
1549 |
+
// The Ajax request might kill our events
|
1550 |
+
if (this.isOnepage) {
|
1551 |
+
this.initSavedPayPal();
|
1552 |
+
this.checkSavedOther();
|
1553 |
+
|
1554 |
+
// If hosted fields is enabled init the environment
|
1555 |
+
if (this.vzero.hostedFields) {
|
1556 |
+
this.initHostedFields();
|
1557 |
+
}
|
1558 |
+
}
|
1559 |
+
|
1560 |
+
// Make sure we're observing the saved methods correctly
|
1561 |
+
this.initSavedMethods();
|
1562 |
+
|
1563 |
+
}.bind(this));
|
1564 |
+
}.bind(this), (typeof this.config.ignoreAjax !== 'undefined' ? this.config.ignoreAjax : false))
|
1565 |
+
},
|
1566 |
+
|
1567 |
+
/**
|
1568 |
+
* Handle saved PayPals being present on the page
|
1569 |
+
*/
|
1570 |
+
initSavedPayPal: function() {
|
1571 |
+
|
1572 |
+
// If we have any saved accounts we'll need to do something jammy
|
1573 |
+
if ($$('#paypal-saved-accounts input[type=radio]').first() !== undefined) {
|
1574 |
+
$('paypal-saved-accounts').on('change', 'input[type=radio]', function(event) {
|
1575 |
+
|
1576 |
+
// Update the PayPal button accordingly
|
1577 |
+
this.updatePayPalButton(false, 'gene_braintree_paypal');
|
1578 |
+
|
1579 |
+
}.bind(this));
|
1580 |
+
}
|
1581 |
+
|
1582 |
+
},
|
1583 |
+
|
1584 |
+
/**
|
1585 |
+
* Set the submit function to be used
|
1586 |
+
*
|
1587 |
+
* This should be overridden within each checkouts .phtml file
|
1588 |
+
* vZeroIntegration.prototype.prepareSubmitObserver = function() {}
|
1589 |
+
*
|
1590 |
+
* @returns {boolean}
|
1591 |
+
*/
|
1592 |
+
prepareSubmitObserver: function() {
|
1593 |
+
return false;
|
1594 |
+
},
|
1595 |
+
|
1596 |
+
/**
|
1597 |
+
* Event to run before submit
|
1598 |
+
* Should always return _beforeSubmit
|
1599 |
+
*
|
1600 |
+
* @returns {boolean}
|
1601 |
+
*/
|
1602 |
+
beforeSubmit: function(callback) {
|
1603 |
+
return this._beforeSubmit(callback);
|
1604 |
+
},
|
1605 |
+
|
1606 |
+
/**
|
1607 |
+
* Private before submit function
|
1608 |
+
*
|
1609 |
+
* @param callback
|
1610 |
+
* @private
|
1611 |
+
*/
|
1612 |
+
_beforeSubmit: function(callback) {
|
1613 |
+
// If hosted fields is activated, and we're 100% not using a saved card
|
1614 |
+
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'))) {
|
1615 |
+
// Fake the form being submitted
|
1616 |
+
var button = $('braintree-hosted-submit').down('button');
|
1617 |
+
button.removeAttribute('disabled');
|
1618 |
+
button.click();
|
1619 |
+
} else {
|
1620 |
+
callback();
|
1621 |
+
}
|
1622 |
+
},
|
1623 |
+
|
1624 |
+
/**
|
1625 |
+
* Event to run after submit
|
1626 |
+
*
|
1627 |
+
* @returns {boolean}
|
1628 |
+
*/
|
1629 |
+
afterSubmit: function() {
|
1630 |
+
return false;
|
1631 |
+
},
|
1632 |
+
|
1633 |
+
/**
|
1634 |
+
* Submit the integration to tokenize the card
|
1635 |
+
*
|
1636 |
+
* @param type
|
1637 |
+
* @param successCallback
|
1638 |
+
* @param failedCallback
|
1639 |
+
* @param validateFailedCallback
|
1640 |
+
*/
|
1641 |
+
submit: function(type, successCallback, failedCallback, validateFailedCallback) {
|
1642 |
+
|
1643 |
+
// Check we actually want to intercept this credit card transaction?
|
1644 |
+
if (this.shouldInterceptSubmit(type)) {
|
1645 |
+
|
1646 |
+
// Validate the form before submission
|
1647 |
+
if (this.validateAll()) {
|
1648 |
+
|
1649 |
+
// Show the loading information
|
1650 |
+
this.setLoading();
|
1651 |
+
|
1652 |
+
// Call the before submit function
|
1653 |
+
this.beforeSubmit(function() {
|
1654 |
+
|
1655 |
+
// Always attempt to update the card type on submission
|
1656 |
+
if ($$('[data-genebraintree-name="number"]').first() != undefined) {
|
1657 |
+
this.vzero.updateCardType($$('[data-genebraintree-name="number"]').first().value);
|
1658 |
+
}
|
1659 |
+
|
1660 |
+
// Update the data within the vZero object
|
1661 |
+
this.vzero.updateData(
|
1662 |
+
function () {
|
1663 |
+
|
1664 |
+
// Update the billing details if they're present on the page
|
1665 |
+
this.updateBilling();
|
1666 |
+
|
1667 |
+
// Process the data on the page
|
1668 |
+
this.vzero.process({
|
1669 |
+
onSuccess: function () {
|
1670 |
+
|
1671 |
+
// Make some modifications to the form
|
1672 |
+
this.enableDeviceData();
|
1673 |
+
this.disableCreditCardForm();
|
1674 |
+
|
1675 |
+
// Unset the loading, as this can block success functions
|
1676 |
+
this.resetLoading();
|
1677 |
+
this.afterSubmit();
|
1678 |
+
|
1679 |
+
// Enable/disable the correct nonce input fields
|
1680 |
+
this.enableDisableNonce();
|
1681 |
+
|
1682 |
+
this.vzero._hostedFieldsTokenGenerated = false;
|
1683 |
+
this.hostedFieldsGenerated = false;
|
1684 |
+
|
1685 |
+
// Call the callback function
|
1686 |
+
if (typeof successCallback === 'function') {
|
1687 |
+
var response = successCallback();
|
1688 |
+
}
|
1689 |
+
|
1690 |
+
// Enable loading again, as things are happening!
|
1691 |
+
this.setLoading();
|
1692 |
+
|
1693 |
+
this.enableCreditCardForm();
|
1694 |
+
return response;
|
1695 |
+
|
1696 |
+
}.bind(this),
|
1697 |
+
onFailure: function () {
|
1698 |
+
|
1699 |
+
this.vzero._hostedFieldsTokenGenerated = false;
|
1700 |
+
this.hostedFieldsGenerated = false;
|
1701 |
+
|
1702 |
+
this.resetLoading();
|
1703 |
+
this.afterSubmit();
|
1704 |
+
if (typeof failedCallback === 'function') {
|
1705 |
+
return failedCallback();
|
1706 |
+
}
|
1707 |
+
}.bind(this)
|
1708 |
+
})
|
1709 |
+
}.bind(this),
|
1710 |
+
this.getUpdateDataParams()
|
1711 |
+
);
|
1712 |
+
|
1713 |
+
}.bind(this));
|
1714 |
+
|
1715 |
+
} else {
|
1716 |
+
|
1717 |
+
this.vzero._hostedFieldsTokenGenerated = false;
|
1718 |
+
this.hostedFieldsGenerated = false;
|
1719 |
+
|
1720 |
+
this.resetLoading();
|
1721 |
+
if (typeof validateFailedCallback === 'function') {
|
1722 |
+
validateFailedCallback();
|
1723 |
+
}
|
1724 |
+
}
|
1725 |
+
}
|
1726 |
+
},
|
1727 |
+
|
1728 |
+
/**
|
1729 |
+
* Submit the entire checkout
|
1730 |
+
*/
|
1731 |
+
submitCheckout: function() {
|
1732 |
+
// Submit the checkout steps
|
1733 |
+
window.review && review.save();
|
1734 |
+
},
|
1735 |
+
|
1736 |
+
/**
|
1737 |
+
* How to submit the payment section
|
1738 |
+
*/
|
1739 |
+
submitPayment: function() {
|
1740 |
+
payment.save && payment.save();
|
1741 |
+
},
|
1742 |
+
|
1743 |
+
/**
|
1744 |
+
* Enable/disable the correct nonce input fields
|
1745 |
+
*/
|
1746 |
+
enableDisableNonce: function() {
|
1747 |
+
// Make sure the nonce inputs aren't going to interfere
|
1748 |
+
if (this.getPaymentMethod() == 'gene_braintree_creditcard') {
|
1749 |
+
if ($('creditcard-payment-nonce') !== null) {
|
1750 |
+
$('creditcard-payment-nonce').removeAttribute('disabled');
|
1751 |
+
}
|
1752 |
+
if ($('paypal-payment-nonce') !== null) {
|
1753 |
+
$('paypal-payment-nonce').setAttribute('disabled', 'disabled');
|
1754 |
+
}
|
1755 |
+
} else if (this.getPaymentMethod() == 'gene_braintree_paypal') {
|
1756 |
+
if ($('creditcard-payment-nonce') !== null) {
|
1757 |
+
$('creditcard-payment-nonce').setAttribute('disabled', 'disabled');
|
1758 |
+
}
|
1759 |
+
if ($('paypal-payment-nonce') !== null) {
|
1760 |
+
$('paypal-payment-nonce').removeAttribute('disabled');
|
1761 |
+
}
|
1762 |
+
}
|
1763 |
+
},
|
1764 |
+
|
1765 |
+
/**
|
1766 |
+
* Replace the PayPal button at the correct time
|
1767 |
+
*
|
1768 |
+
* This should be overridden within each checkouts .phtml file
|
1769 |
+
* vZeroIntegration.prototype.preparePaymentMethodSwitchObserver = function() {}
|
1770 |
+
*/
|
1771 |
+
preparePaymentMethodSwitchObserver: function() {
|
1772 |
+
return this.defaultPaymentMethodSwitch();
|
1773 |
+
},
|
1774 |
+
|
1775 |
+
/**
|
1776 |
+
* If the checkout uses the Magento standard Payment.prototype.switchMethod we can utilise this function
|
1777 |
+
*/
|
1778 |
+
defaultPaymentMethodSwitch: function() {
|
1779 |
+
|
1780 |
+
// Store a pointer to the vZero integration
|
1781 |
+
var vzeroIntegration = this;
|
1782 |
+
|
1783 |
+
// Store the original payment method
|
1784 |
+
var paymentSwitchOriginal = Payment.prototype.switchMethod;
|
1785 |
+
|
1786 |
+
// Intercept the save function
|
1787 |
+
Payment.prototype.switchMethod = function (method) {
|
1788 |
+
|
1789 |
+
// Run our method switch function
|
1790 |
+
vzeroIntegration.paymentMethodSwitch(method);
|
1791 |
+
|
1792 |
+
// Run the original function
|
1793 |
+
return paymentSwitchOriginal.apply(this, arguments);
|
1794 |
+
};
|
1795 |
+
|
1796 |
+
},
|
1797 |
+
|
1798 |
+
/**
|
1799 |
+
* Function to run when the customer changes payment method
|
1800 |
+
* @param method
|
1801 |
+
*/
|
1802 |
+
paymentMethodSwitch: function(method) {
|
1803 |
+
|
1804 |
+
// Wait for 50ms to see if this function is called again, only ever run the last instance
|
1805 |
+
clearTimeout(this._methodSwitchTimeout);
|
1806 |
+
this._methodSwitchTimeout = setTimeout(function() {
|
1807 |
+
|
1808 |
+
// Should we add a PayPal button?
|
1809 |
+
if (this.shouldAddPayPalButton(method)) {
|
1810 |
+
this.updatePayPalButton('add', method);
|
1811 |
+
} else {
|
1812 |
+
this.updatePayPalButton('remove', method);
|
1813 |
+
}
|
1814 |
+
|
1815 |
+
// Has the user enabled hosted fields?
|
1816 |
+
if ((method ? method : this.getPaymentMethod()) == 'gene_braintree_creditcard') {
|
1817 |
+
this.initHostedFields();
|
1818 |
+
}
|
1819 |
+
|
1820 |
+
// Check to see if the other information should be displayed
|
1821 |
+
this.checkSavedOther();
|
1822 |
+
|
1823 |
+
}.bind(this), 50);
|
1824 |
+
|
1825 |
+
},
|
1826 |
+
|
1827 |
+
/**
|
1828 |
+
* Complete a PayPal transaction
|
1829 |
+
*
|
1830 |
+
* @returns {boolean}
|
1831 |
+
*/
|
1832 |
+
completePayPal: function(obj) {
|
1833 |
+
|
1834 |
+
// Make sure the nonces are the correct way around
|
1835 |
+
this.enableDisableNonce();
|
1836 |
+
|
1837 |
+
// Enable the device data
|
1838 |
+
this.enableDeviceData();
|
1839 |
+
|
1840 |
+
if (obj.nonce && $('paypal-payment-nonce') !== null) {
|
1841 |
+
$('paypal-payment-nonce').value = obj.nonce;
|
1842 |
+
$('paypal-payment-nonce').setAttribute('value', obj.nonce);
|
1843 |
+
} else {
|
1844 |
+
console.warn('Unable to update PayPal nonce, please verify that the nonce input field has the ID: paypal-payment-nonce');
|
1845 |
+
}
|
1846 |
+
|
1847 |
+
// Check the callback type is a function
|
1848 |
+
this.afterPayPalComplete();
|
1849 |
+
|
1850 |
+
return false;
|
1851 |
+
},
|
1852 |
+
|
1853 |
+
/**
|
1854 |
+
* Any operations that need to happen after the PayPal integration has completed
|
1855 |
+
*
|
1856 |
+
* @returns {boolean}
|
1857 |
+
*/
|
1858 |
+
afterPayPalComplete: function() {
|
1859 |
+
this.resetLoading();
|
1860 |
+
return this.submitCheckout();
|
1861 |
+
},
|
1862 |
+
|
1863 |
+
/**
|
1864 |
+
* Update the PayPal button, if we should add the button do so, otherwise remove it if it exists
|
1865 |
+
*/
|
1866 |
+
updatePayPalButton: function(action, method) {
|
1867 |
+
|
1868 |
+
if(this.paypalMarkUp === false) {
|
1869 |
+
return false;
|
1870 |
+
}
|
1871 |
+
|
1872 |
+
if (action == 'refresh') {
|
1873 |
+
this.updatePayPalButton('remove');
|
1874 |
+
this.updatePayPalButton('add');
|
1875 |
+
return true;
|
1876 |
+
}
|
1877 |
+
|
1878 |
+
// Check to see if we should be adding a PayPal button?
|
1879 |
+
if ((this.shouldAddPayPalButton(method) && action != 'remove') || action == 'add') {
|
1880 |
+
|
1881 |
+
// Hide the checkout button
|
1882 |
+
if ($$(this.paypalButtonClass).first() !== undefined) {
|
1883 |
+
|
1884 |
+
// Does a button already exist on the page and is visible?
|
1885 |
+
if ($$('#paypal-complete').first() !== undefined && $$('#paypal-complete').first().visible()) {
|
1886 |
+
return true;
|
1887 |
+
}
|
1888 |
+
|
1889 |
+
$$(this.paypalButtonClass).first().hide();
|
1890 |
+
|
1891 |
+
// Insert out PayPal button
|
1892 |
+
$$(this.paypalButtonClass).first().insert({after: this.paypalMarkUp});
|
1893 |
+
|
1894 |
+
var buttonParams = {
|
1895 |
+
onSuccess: this.completePayPal.bind(this),
|
1896 |
+
onReady: this.paypalOnReady.bind(this)
|
1897 |
+
};
|
1898 |
+
|
1899 |
+
// Add in the PayPal button
|
1900 |
+
this.vzeroPaypal.addPayPalButton(buttonParams);
|
1901 |
+
|
1902 |
+
} else {
|
1903 |
+
console.warn('We\'re unable to find the element ' + this.paypalButtonClass + '. Please check your integration.');
|
1904 |
+
}
|
1905 |
+
|
1906 |
+
} else {
|
1907 |
+
|
1908 |
+
// If not we need to remove it
|
1909 |
+
// Revert our madness
|
1910 |
+
if ($$(this.paypalButtonClass).first() !== undefined) {
|
1911 |
+
$$(this.paypalButtonClass).first().show();
|
1912 |
+
}
|
1913 |
+
|
1914 |
+
// Remove the PayPal element
|
1915 |
+
if ($$('#paypal-complete').first() !== undefined) {
|
1916 |
+
$('paypal-complete').remove();
|
1917 |
+
}
|
1918 |
+
}
|
1919 |
+
|
1920 |
+
},
|
1921 |
+
|
1922 |
+
/**
|
1923 |
+
* Attach a click event handler to the button to validate the form
|
1924 |
+
*
|
1925 |
+
* @param integration
|
1926 |
+
*/
|
1927 |
+
paypalOnReady: function(integration) {
|
1928 |
+
|
1929 |
+
// Always stop the window from opening
|
1930 |
+
$('braintree-paypal-button').stopObserving('click').on('click', function (event) {
|
1931 |
+
|
1932 |
+
// Validate the form before we open the PayPal modal window
|
1933 |
+
if (!this.validateAll()) {
|
1934 |
+
|
1935 |
+
// If the form fails to validate kill the event
|
1936 |
+
Event.stop(event);
|
1937 |
+
return false;
|
1938 |
+
}
|
1939 |
+
|
1940 |
+
}.bind(this));
|
1941 |
+
|
1942 |
+
},
|
1943 |
+
|
1944 |
+
/**
|
1945 |
+
* Set the loading state
|
1946 |
+
*/
|
1947 |
+
setLoading: function() {
|
1948 |
+
checkout.setLoadWaiting('payment');
|
1949 |
+
},
|
1950 |
+
|
1951 |
+
/**
|
1952 |
+
* Reset the loading state
|
1953 |
+
*/
|
1954 |
+
resetLoading: function() {
|
1955 |
+
checkout.setLoadWaiting(false);
|
1956 |
+
},
|
1957 |
+
|
1958 |
+
/**
|
1959 |
+
* Make sure the device data field isn't disabled
|
1960 |
+
*/
|
1961 |
+
enableDeviceData: function() {
|
1962 |
+
if ($('device_data') !== null) {
|
1963 |
+
$('device_data').removeAttribute('disabled');
|
1964 |
+
}
|
1965 |
+
},
|
1966 |
+
|
1967 |
+
/**
|
1968 |
+
* Disable all fields in the credit card form so they don't end up going server side
|
1969 |
+
*/
|
1970 |
+
disableCreditCardForm: function() {
|
1971 |
+
$$('#credit-card-form input, #credit-card-form select').each(function(formElement) {
|
1972 |
+
if (formElement.id != 'creditcard-payment-nonce' && formElement.id != 'gene_braintree_creditcard_store_in_vault') {
|
1973 |
+
formElement.setAttribute('disabled', 'disabled');
|
1974 |
+
}
|
1975 |
+
});
|
1976 |
+
},
|
1977 |
+
|
1978 |
+
/**
|
1979 |
+
* Re-enable the credit card form, just in case there was an error etc
|
1980 |
+
*/
|
1981 |
+
enableCreditCardForm: function() {
|
1982 |
+
$$('#credit-card-form input, #credit-card-form select').each(function (formElement) {
|
1983 |
+
formElement.removeAttribute('disabled');
|
1984 |
+
});
|
1985 |
+
},
|
1986 |
+
|
1987 |
+
/**
|
1988 |
+
* Update the billing of the vZero object
|
1989 |
+
*
|
1990 |
+
* @returns {boolean}
|
1991 |
+
*/
|
1992 |
+
updateBilling: function() {
|
1993 |
+
|
1994 |
+
// Verify we're not using a saved address
|
1995 |
+
if (($('billing-address-select') !== null && $('billing-address-select').value == '') || $('billing-address-select') === null) {
|
1996 |
+
|
1997 |
+
// Grab these directly from the form and update
|
1998 |
+
if ($('billing:firstname') !== null && $('billing:lastname') !== null) {
|
1999 |
+
this.vzero.setBillingName($('billing:firstname').value + ' ' + $('billing:lastname').value);
|
2000 |
+
}
|
2001 |
+
if ($('billing:postcode') !== null) {
|
2002 |
+
this.vzero.setBillingPostcode($('billing:postcode').value);
|
2003 |
+
}
|
2004 |
+
}
|
2005 |
+
},
|
2006 |
+
|
2007 |
+
/**
|
2008 |
+
* Any extra data we need to pass through to the updateData call
|
2009 |
+
*
|
2010 |
+
* @returns {{}}
|
2011 |
+
*/
|
2012 |
+
getUpdateDataParams: function() {
|
2013 |
+
var parameters = {};
|
2014 |
+
|
2015 |
+
// If the billing address is selected and we're wanting to ship to that address we need to pass the addressId
|
2016 |
+
if ($('billing-address-select') !== null && $('billing-address-select').value != '') {
|
2017 |
+
parameters.addressId = $('billing-address-select').value;
|
2018 |
+
}
|
2019 |
+
|
2020 |
+
return parameters;
|
2021 |
+
},
|
2022 |
+
|
2023 |
+
/**
|
2024 |
+
* Return the current payment method
|
2025 |
+
*
|
2026 |
+
* @returns {*}
|
2027 |
+
*/
|
2028 |
+
getPaymentMethod: function() {
|
2029 |
+
return payment.currentMethod;
|
2030 |
+
},
|
2031 |
+
|
2032 |
+
/**
|
2033 |
+
* Should we intercept the save action of the checkout
|
2034 |
+
*
|
2035 |
+
* @param type
|
2036 |
+
* @returns {*}
|
2037 |
+
*/
|
2038 |
+
shouldInterceptSubmit: function(type) {
|
2039 |
+
switch(type){
|
2040 |
+
case 'creditcard':
|
2041 |
+
return (this.getPaymentMethod() == 'gene_braintree_creditcard' && this.vzero.shouldInterceptCreditCard());
|
2042 |
+
break;
|
2043 |
+
case 'paypal':
|
2044 |
+
return (this.getPaymentMethod() == 'gene_braintree_paypal' && this.vzero.shouldInterceptCreditCard());
|
2045 |
+
break;
|
2046 |
+
}
|
2047 |
+
return false;
|
2048 |
+
},
|
2049 |
+
|
2050 |
+
/**
|
2051 |
+
* Should we be adding a PayPal button?
|
2052 |
+
* @returns {boolean}
|
2053 |
+
*/
|
2054 |
+
shouldAddPayPalButton: function(method) {
|
2055 |
+
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')));
|
2056 |
+
},
|
2057 |
+
|
2058 |
+
/**
|
2059 |
+
* Function to run once 3D retokenization is complete
|
2060 |
+
*/
|
2061 |
+
threeDTokenizationComplete: function() {
|
2062 |
+
this.resetLoading();
|
2063 |
+
},
|
2064 |
+
|
2065 |
+
/**
|
2066 |
+
* Validate the entire form
|
2067 |
+
*
|
2068 |
+
* @returns {boolean}
|
2069 |
+
*/
|
2070 |
+
validateAll: function() {
|
2071 |
+
return true;
|
2072 |
+
}
|
2073 |
+
|
2074 |
+
};
|
js/gene/braintree/vzero-0.5.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
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={}},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(){this._hostedIntegration?this._hostedIntegration.teardown(function(){this.setupHostedFieldsClient()}.bind(this)):this.setupHostedFieldsClient()}.bind(this),50)))},setupHostedFieldsClient:function(){if($$('iframe[name^="braintree-"]').length>0)return!1;this._hostedIntegration=!1;var e={id:this.integration.form,hostedFields:{styles:{input:{"font-size":"14pt",color:"#3A3A3A"},":focus":{color:"black"},".valid":{color:"green"},".invalid":{color:"red"}},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:function(e){this._hostedIntegration=e}.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)},hostedFieldsOnFieldEvent:function(e){if("fieldStateChange"===e.type&&e.card){var t={visa:"VI","american-express":"AE","master-card":"MC",discovery:"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(nonce,callback){var parameters=this.getBillingAddress();parameters.nonce=nonce,new Ajax.Request(this.vaultToNonceUrl,{method:"post",parameters:parameters,onSuccess:function(transport){if(transport&&transport.responseText){try{response=eval("("+transport.responseText+")")}catch(e){response={}}response.success&&response.nonce?callback(response.nonce):("function"==typeof this.integration.resetLoading&&this.integration.resetLoading(),response.error?alert(response.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)})},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(),vzero.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(),-1==e.message.indexOf("Cannot place two elements in")&&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){Ajax.Responders.register({onComplete:function(i){return this.handleAjaxRequest(i.url,e,t)}.bind(this)}),window.jQuery&&jQuery(document).ajaxComplete(function(i,n,a){return this.handleAjaxRequest(a.url,e,t)})},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(callback,params){this._updateDataCallbacks.push(callback),this._updateDataParams=params,this._updateDataXhr!==!1&&this._updateDataXhr.transport.abort(),this._updateDataXhr=new Ajax.Request(this.quoteUrl,{method:"post",parameters:this._updateDataParams,onSuccess:function(transport){if(transport&&transport.responseText){try{response=eval("("+transport.responseText+")")}catch(e){response={}}void 0!=response.billingName&&(this.billingName=response.billingName),void 0!=response.billingPostcode&&(this.billingPostcode=response.billingPostcode),void 0!=response.grandTotal&&(this.amount=response.grandTotal),void 0!=response.threeDSecure&&this.setThreeDSecure(response.threeDSecure),"undefined"!=typeof vzeroPaypal&&void 0!=response.grandTotal&&void 0!=response.currencyCode&&vzeroPaypal.setPricing(response.grandTotal,response.currencyCode),this._updateDataParams={},this._updateDataXhr=!1,this._updateDataCallbacks.length&&(this._updateDataCallbacks.each(function(e){e(response)}.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(callback){if(this.threeDSecure)if(void 0!==$$("[data-token]").first()){var tokens=[];$$("[data-token]").each(function(e,t){tokens[t]=e.getAttribute("data-token")}),new Ajax.Request(this.tokenizeUrl,{method:"post",onSuccess:function(transport){if(transport&&transport.responseText){try{response=eval("("+transport.responseText+")")}catch(e){response={}}response.success&&$H(response.tokens).each(function(e){void 0!=$$('[data-token="'+e.key+'"]').first()&&$$('[data-token="'+e.key+'"]').first().setAttribute("data-threedsecure-nonce",e.value)}),callback&&callback(response)}}.bind(this),parameters:{tokens:Object.toJSON(tokens)}})}else callback();else callback()},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},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()?this.updateData(function(){e.onSuccess&&e.onSuccess()}):1==this.threeDSecure?this.verify3dSecure(e):this.processCard(e)},creditCardLoaded:function(){return!1},paypalLoaded:function(){return!1}};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},setPricing:function(e,t){this.amount=parseFloat(e),this.currency=t,this.rebuildButton()},rebuildButton:function(){this._paypalIntegration!==!1&&this._paypalIntegration.teardown(function(){this.addPayPalButton(this._paypalOptions)}.bind(this))},addPayPalButton:function(e){if(null===$("paypal-container"))return!1;this._paypalOptions=e,this._paypalIntegration=!1;var t={container:"paypal-container",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,"function"==typeof e.onReady&&e.onReady(t)}.bind(this)};1==this.singleUse?(t.singleUse=!0,t.amount=this.amount,t.currency=this.currency,t.locale=this.locale):1==this.futureSingleUse&&(t.singleUse=!0),braintree.setup(this.clientToken,"paypal",t)},closePayPalWindow:function(e){}};var vZeroIntegration=Class.create();vZeroIntegration.prototype={initialize:function(e,t,i,n,a,s){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._methodSwitchTimeout=!1,this._hostedFieldsInit=!1,this.prepareSubmitObserver(),this.preparePaymentMethodSwitchObserver(),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()}.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.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.checkSavedOther(),this.vzero.hostedFields&&this.initHostedFields()),this.initSavedMethods()}.bind(this))}.bind(this),"undefined"!=typeof this.config.ignoreAjax?this.config.ignoreAjax:!1)},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()},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)}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){$("braintree-paypal-button").stopObserving("click").on("click",function(e){return this.validateAll()?void 0:(Event.stop(e),!1)}.bind(this))},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}};
|
js/gene/braintree/vzero.js
DELETED
@@ -1,775 +0,0 @@
|
|
1 |
-
|
2 |
-
/**
|
3 |
-
* Magento Braintree functionality wrapped up into a neat class
|
4 |
-
*
|
5 |
-
* @class vZero
|
6 |
-
* @author Dave Macaulay <dave@gene.co.uk>
|
7 |
-
*/
|
8 |
-
var vZero = Class.create();
|
9 |
-
vZero.prototype = {
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Initialize all our required variables that we'll need later on
|
13 |
-
*
|
14 |
-
* @param code The payment methods code
|
15 |
-
* @param clientToken The client token provided by the server
|
16 |
-
* @param threeDSecure Flag to determine whether 3D secure is active, this is verified server side
|
17 |
-
* @param billingName Billing name used in verification of the card
|
18 |
-
* @param billingPostcode Billing postcode also needed to verify the card
|
19 |
-
*/
|
20 |
-
initialize: function (code, clientToken, threeDSecure, billingName, billingPostcode, quoteUrl, tokenizeUrl) {
|
21 |
-
this.code = code;
|
22 |
-
this.clientToken = clientToken;
|
23 |
-
this.threeDSecure = threeDSecure;
|
24 |
-
|
25 |
-
if(billingName) {
|
26 |
-
this.billingName = billingName;
|
27 |
-
}
|
28 |
-
if(billingPostcode) {
|
29 |
-
this.billingPostcode = billingPostcode;
|
30 |
-
}
|
31 |
-
if(quoteUrl) {
|
32 |
-
this.quoteUrl = quoteUrl;
|
33 |
-
}
|
34 |
-
if(tokenizeUrl) {
|
35 |
-
this.tokenizeUrl = tokenizeUrl;
|
36 |
-
}
|
37 |
-
|
38 |
-
this.acceptedCards = false;
|
39 |
-
|
40 |
-
this.closeMethod = false;
|
41 |
-
},
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Init the vZero integration by starting a new version of the client
|
45 |
-
* If 3D secure is enabled we also listen out for window messages
|
46 |
-
*/
|
47 |
-
init: function() {
|
48 |
-
|
49 |
-
// Different environments depending on 3D secure
|
50 |
-
if(this.threeDSecure == true) {
|
51 |
-
|
52 |
-
// Add an event in for messages
|
53 |
-
if (window.addEventListener){
|
54 |
-
window.addEventListener("message", this.receiveMessage.bind(this), false);
|
55 |
-
} else {
|
56 |
-
window.attachEvent("onmessage", this.receiveMessage.bind(this));
|
57 |
-
}
|
58 |
-
}
|
59 |
-
|
60 |
-
this.client = new braintree.api.Client({clientToken: this.clientToken});
|
61 |
-
|
62 |
-
},
|
63 |
-
|
64 |
-
/**
|
65 |
-
* Set the 3Ds flag
|
66 |
-
*
|
67 |
-
* @param flag a boolean value
|
68 |
-
*/
|
69 |
-
setThreeDSecure: function(flag) {
|
70 |
-
this.threeDSecure = flag;
|
71 |
-
},
|
72 |
-
|
73 |
-
/**
|
74 |
-
* Set the amount within the checkout, this is only used in the default integration
|
75 |
-
* For any other checkouts see the updateData method, this is used by 3D secure
|
76 |
-
*
|
77 |
-
* @param amount The grand total of the order
|
78 |
-
*/
|
79 |
-
setAmount: function(amount) {
|
80 |
-
this.amount = parseFloat(amount);
|
81 |
-
},
|
82 |
-
|
83 |
-
/**
|
84 |
-
* We sometimes need to set the billing name later on in the process
|
85 |
-
*
|
86 |
-
* @param billingName
|
87 |
-
*/
|
88 |
-
setBillingName: function(billingName) {
|
89 |
-
this.billingName = billingName;
|
90 |
-
},
|
91 |
-
|
92 |
-
/**
|
93 |
-
* Return the billing name
|
94 |
-
*
|
95 |
-
* @returns {*}
|
96 |
-
*/
|
97 |
-
getBillingName: function() {
|
98 |
-
|
99 |
-
// If billingName is an object we're wanting to grab the data from elements
|
100 |
-
if(typeof this.billingName == 'object') {
|
101 |
-
|
102 |
-
// Combine them with a space
|
103 |
-
return this.combineElementsValues(this.billingName);
|
104 |
-
|
105 |
-
} else {
|
106 |
-
|
107 |
-
// Otherwise we can presume that the billing name is a string
|
108 |
-
return this.billingName;
|
109 |
-
}
|
110 |
-
},
|
111 |
-
|
112 |
-
/**
|
113 |
-
* Same for billing postcode
|
114 |
-
*
|
115 |
-
* @param billingPostcode
|
116 |
-
*/
|
117 |
-
setBillingPostcode: function(billingPostcode) {
|
118 |
-
this.billingPostcode = billingPostcode;
|
119 |
-
},
|
120 |
-
|
121 |
-
/**
|
122 |
-
* Return the billing name
|
123 |
-
*
|
124 |
-
* @returns {*}
|
125 |
-
*/
|
126 |
-
getBillingPostcode: function() {
|
127 |
-
|
128 |
-
// If billingName is an object we're wanting to grab the data from elements
|
129 |
-
if(typeof this.billingPostcode == 'object') {
|
130 |
-
|
131 |
-
// Combine them with a space
|
132 |
-
return this.combineElementsValues(this.billingPostcode);
|
133 |
-
|
134 |
-
} else {
|
135 |
-
|
136 |
-
// Otherwise we can presume that the billing name is a string
|
137 |
-
return this.billingPostcode;
|
138 |
-
}
|
139 |
-
},
|
140 |
-
|
141 |
-
/**
|
142 |
-
* Push through the selected accepted cards from the admin
|
143 |
-
*
|
144 |
-
* @param cards an array of accepted cards
|
145 |
-
*/
|
146 |
-
setAcceptedCards: function(cards) {
|
147 |
-
this.acceptedCards = cards;
|
148 |
-
},
|
149 |
-
|
150 |
-
/**
|
151 |
-
* Return the accepted cards
|
152 |
-
*
|
153 |
-
* @returns {boolean|*}
|
154 |
-
*/
|
155 |
-
getAcceptedCards: function() {
|
156 |
-
return this.acceptedCards;
|
157 |
-
},
|
158 |
-
|
159 |
-
|
160 |
-
/**
|
161 |
-
* Combine elements values into a string
|
162 |
-
*
|
163 |
-
* @param elements
|
164 |
-
* @param seperator
|
165 |
-
* @returns {string}
|
166 |
-
*/
|
167 |
-
combineElementsValues: function(elements, seperator) {
|
168 |
-
|
169 |
-
// If no seperator is set use a space
|
170 |
-
if(!seperator) {
|
171 |
-
seperator = ' ';
|
172 |
-
}
|
173 |
-
|
174 |
-
// Loop through the elements and build up an array
|
175 |
-
var response = [];
|
176 |
-
elements.each(function(element, index) {
|
177 |
-
if($(element) !== undefined) {
|
178 |
-
response[index] = $(element).value;
|
179 |
-
}
|
180 |
-
});
|
181 |
-
|
182 |
-
// Join with a space
|
183 |
-
return response.join(seperator);
|
184 |
-
|
185 |
-
},
|
186 |
-
|
187 |
-
/**
|
188 |
-
* Update the card type from a card number
|
189 |
-
*
|
190 |
-
* @param cardNumber The card number that the user has entered
|
191 |
-
*/
|
192 |
-
updateCardType: function(cardNumber) {
|
193 |
-
|
194 |
-
// Retrieve the card type
|
195 |
-
var cardType = vzero.getCardType(cardNumber);
|
196 |
-
|
197 |
-
if (cardType == 'card') {
|
198 |
-
// If we cannot detect which kind of card they're using remove the value from the select
|
199 |
-
$('gene_braintree_creditcard_cc_type').value = '';
|
200 |
-
} else {
|
201 |
-
// Update the validation field
|
202 |
-
$('gene_braintree_creditcard_cc_type').value = cardType;
|
203 |
-
}
|
204 |
-
|
205 |
-
// Check the image exists on the page
|
206 |
-
if($('card-type-image') != undefined) {
|
207 |
-
|
208 |
-
// Grab the skin image URL without the last part
|
209 |
-
var skinImageUrl = $('card-type-image').src.substring(0, $('card-type-image').src.lastIndexOf("/"));
|
210 |
-
|
211 |
-
// Rebuild the URL with the card type included, all card types are stored as PNG's
|
212 |
-
$('card-type-image').setAttribute('src', skinImageUrl + "/" + cardType + ".png");
|
213 |
-
|
214 |
-
}
|
215 |
-
|
216 |
-
},
|
217 |
-
|
218 |
-
/**
|
219 |
-
* Create a new event upon the card number field
|
220 |
-
*/
|
221 |
-
observeCardType: function() {
|
222 |
-
|
223 |
-
if(!$$('[data-genebraintree-name="number"]').first() != undefined) {
|
224 |
-
|
225 |
-
// Observe any blurring on the form
|
226 |
-
Element.observe($$('[data-genebraintree-name="number"]').first(), 'keyup', function (event) {
|
227 |
-
vzero.updateCardType(this.value);
|
228 |
-
});
|
229 |
-
|
230 |
-
}
|
231 |
-
|
232 |
-
},
|
233 |
-
|
234 |
-
/**
|
235 |
-
* Observe all Ajax requests, this is needed on certain checkouts
|
236 |
-
* where we're unable to easily inject into methods
|
237 |
-
*
|
238 |
-
* @param callback A defined callback function if needed
|
239 |
-
*/
|
240 |
-
observeAjaxRequests: function(callback) {
|
241 |
-
|
242 |
-
// For every ajax request on complete update various Braintree things
|
243 |
-
Ajax.Responders.register({
|
244 |
-
onComplete: function(transport) {
|
245 |
-
|
246 |
-
// Check the transport object has a URL and that it wasn't to our own controller
|
247 |
-
if(transport.url && transport.url.indexOf('braintree') == -1) {
|
248 |
-
|
249 |
-
// Some checkout implementations may require custom callbacks
|
250 |
-
if(callback) {
|
251 |
-
callback(transport);
|
252 |
-
} else {
|
253 |
-
this.updateData();
|
254 |
-
}
|
255 |
-
}
|
256 |
-
}.bind(this)
|
257 |
-
});
|
258 |
-
|
259 |
-
},
|
260 |
-
|
261 |
-
/**
|
262 |
-
* Make an Ajax request to the server and request up to date information regarding the quote
|
263 |
-
*
|
264 |
-
* @param callback A defined callback function if needed
|
265 |
-
* @param params any extra data to be passed to the controller
|
266 |
-
*/
|
267 |
-
updateData: function(callback, params) {
|
268 |
-
|
269 |
-
// Make a new ajax request to the server
|
270 |
-
new Ajax.Request(
|
271 |
-
this.quoteUrl,
|
272 |
-
{
|
273 |
-
method:'post',
|
274 |
-
parameters: params,
|
275 |
-
onSuccess: function(transport) {
|
276 |
-
|
277 |
-
// Verify we have some response text
|
278 |
-
if (transport && transport.responseText) {
|
279 |
-
|
280 |
-
// Parse as an object
|
281 |
-
try {
|
282 |
-
response = eval('(' + transport.responseText + ')');
|
283 |
-
}
|
284 |
-
catch (e) {
|
285 |
-
response = {};
|
286 |
-
}
|
287 |
-
|
288 |
-
if(response.billingName != undefined) {
|
289 |
-
this.billingName = response.billingName;
|
290 |
-
}
|
291 |
-
if(response.billingPostcode != undefined) {
|
292 |
-
this.billingPostcode = response.billingPostcode;
|
293 |
-
}
|
294 |
-
if(response.grandTotal != undefined) {
|
295 |
-
this.amount = response.grandTotal;
|
296 |
-
}
|
297 |
-
if(response.threeDSecure != undefined) {
|
298 |
-
this.setThreeDSecure(response.threeDSecure);
|
299 |
-
}
|
300 |
-
|
301 |
-
// If PayPal is active update it
|
302 |
-
if(typeof vzeroPaypal != "undefined") {
|
303 |
-
|
304 |
-
// Update the totals within the PayPal system
|
305 |
-
if(response.grandTotal != undefined && response.currencyCode != undefined) {
|
306 |
-
vzeroPaypal.setPricing(response.grandTotal, response.currencyCode);
|
307 |
-
}
|
308 |
-
|
309 |
-
}
|
310 |
-
|
311 |
-
if(callback) {
|
312 |
-
callback(response);
|
313 |
-
}
|
314 |
-
}
|
315 |
-
}.bind(this)
|
316 |
-
}
|
317 |
-
);
|
318 |
-
|
319 |
-
},
|
320 |
-
|
321 |
-
/**
|
322 |
-
* Handle the user closing the 3D secure interface
|
323 |
-
*
|
324 |
-
* @param event
|
325 |
-
* @todo this functionality is not officially documented, waiting for official release of onClose method
|
326 |
-
*/
|
327 |
-
receiveMessage: function(event) {
|
328 |
-
|
329 |
-
// If the user closed the window unset the load waiting
|
330 |
-
if(event.data == 'user_closed=true') {
|
331 |
-
|
332 |
-
// Is there a close method defined?
|
333 |
-
if(this.closeMethod) {
|
334 |
-
this.closeMethod();
|
335 |
-
} else {
|
336 |
-
checkout.setLoadWaiting(false);
|
337 |
-
}
|
338 |
-
}
|
339 |
-
},
|
340 |
-
|
341 |
-
/**
|
342 |
-
* Allow custom checkouts to set a custom method for closing 3D secure
|
343 |
-
*
|
344 |
-
* @param callback A defined callback function if needed
|
345 |
-
*/
|
346 |
-
close3dSecureMethod: function(callback) {
|
347 |
-
this.closeMethod = callback;
|
348 |
-
},
|
349 |
-
|
350 |
-
/**
|
351 |
-
* If the user attempts to use a 3D secure vaulted card and then cancels the 3D
|
352 |
-
* window the nonce associated with that card will become invalid, due to this
|
353 |
-
* we have to tokenize all the 3D secure cards again
|
354 |
-
*
|
355 |
-
* @param callback A defined callback function if needed
|
356 |
-
*/
|
357 |
-
tokenize3dSavedCards: function(callback) {
|
358 |
-
|
359 |
-
// Check 3D is enabled
|
360 |
-
if(this.threeDSecure) {
|
361 |
-
|
362 |
-
// Verify we have elements with data-token
|
363 |
-
if($$('[data-token]').first() != undefined) {
|
364 |
-
|
365 |
-
// Gather our tokens
|
366 |
-
tokens = [];
|
367 |
-
$$('[data-token]').each(function (element, index) {
|
368 |
-
tokens[index] = element.getAttribute('data-token');
|
369 |
-
});
|
370 |
-
|
371 |
-
// Make a new ajax request to the server
|
372 |
-
new Ajax.Request(
|
373 |
-
this.tokenizeUrl,
|
374 |
-
{
|
375 |
-
method:'post',
|
376 |
-
onSuccess: function(transport) {
|
377 |
-
|
378 |
-
// Verify we have some response text
|
379 |
-
if (transport && transport.responseText) {
|
380 |
-
|
381 |
-
// Parse as an object
|
382 |
-
try {
|
383 |
-
response = eval('(' + transport.responseText + ')');
|
384 |
-
}
|
385 |
-
catch (e) {
|
386 |
-
response = {};
|
387 |
-
}
|
388 |
-
|
389 |
-
// Check the response was successful
|
390 |
-
if(response.success) {
|
391 |
-
|
392 |
-
// Loop through the returned tokens
|
393 |
-
$H(response.tokens).each(function (element) {
|
394 |
-
|
395 |
-
// If the token exists update it's nonce
|
396 |
-
if($$('[data-token="' + element.key + '"]').first() != undefined) {
|
397 |
-
$$('[data-token="' + element.key + '"]').first().setAttribute('data-threedsecure-nonce', element.value);
|
398 |
-
}
|
399 |
-
});
|
400 |
-
}
|
401 |
-
|
402 |
-
if(callback) {
|
403 |
-
callback(response);
|
404 |
-
}
|
405 |
-
}
|
406 |
-
}.bind(this),
|
407 |
-
parameters: {'tokens': Object.toJSON(tokens)}
|
408 |
-
}
|
409 |
-
);
|
410 |
-
} else {
|
411 |
-
callback();
|
412 |
-
}
|
413 |
-
|
414 |
-
} else {
|
415 |
-
callback();
|
416 |
-
}
|
417 |
-
},
|
418 |
-
|
419 |
-
/**
|
420 |
-
* Make a request to Braintree for 3D secure information
|
421 |
-
*
|
422 |
-
* @param options Contains any callback functions which have been set
|
423 |
-
*/
|
424 |
-
verify3dSecure: function(options) {
|
425 |
-
|
426 |
-
var threeDSecureRequest = {
|
427 |
-
amount: this.amount,
|
428 |
-
creditCard: {
|
429 |
-
number: $$('[data-genebraintree-name="number"]').first().value,
|
430 |
-
expirationMonth: $$('[data-genebraintree-name="expiration_month"]').first().value,
|
431 |
-
expirationYear: $$('[data-genebraintree-name="expiration_year"]').first().value,
|
432 |
-
cardholderName: this.getBillingName()
|
433 |
-
}
|
434 |
-
};
|
435 |
-
|
436 |
-
// If the CVV field exists include it
|
437 |
-
if($$('[data-genebraintree-name="cvv"]').first() != undefined) {
|
438 |
-
threeDSecureRequest.creditCard.cvv = $$('[data-genebraintree-name="cvv"]').first().value;
|
439 |
-
}
|
440 |
-
|
441 |
-
// If we have the billing postcode add it into the request
|
442 |
-
if(this.getBillingPostcode() != "") {
|
443 |
-
threeDSecureRequest.creditCard.billingAddress = {
|
444 |
-
postalCode: this.getBillingPostcode()
|
445 |
-
};
|
446 |
-
}
|
447 |
-
|
448 |
-
// Run the verify function on the braintree client
|
449 |
-
this.client.verify3DS(threeDSecureRequest, function (error, response) {
|
450 |
-
|
451 |
-
if (!error) {
|
452 |
-
|
453 |
-
// Store threeDSecure token and nonce in form
|
454 |
-
$('creditcard-payment-nonce').value = response.nonce;
|
455 |
-
|
456 |
-
// Run any callback functions
|
457 |
-
if(options.onSuccess) {
|
458 |
-
options.onSuccess();
|
459 |
-
}
|
460 |
-
} else {
|
461 |
-
|
462 |
-
// Show the error
|
463 |
-
alert(error.message);
|
464 |
-
|
465 |
-
if(options.onFailure) {
|
466 |
-
options.onFailure();
|
467 |
-
} else {
|
468 |
-
checkout.setLoadWaiting(false);
|
469 |
-
}
|
470 |
-
}
|
471 |
-
});
|
472 |
-
|
473 |
-
},
|
474 |
-
|
475 |
-
/**
|
476 |
-
* Verify a card stored in the vault
|
477 |
-
*
|
478 |
-
* @param options Contains any callback functions which have been set
|
479 |
-
*/
|
480 |
-
verify3dSecureVault: function(options) {
|
481 |
-
|
482 |
-
// Get the payment nonce
|
483 |
-
var paymentNonce = $$('#creditcard-saved-accounts input:checked[type=radio]').first().getAttribute('data-threedsecure-nonce');
|
484 |
-
|
485 |
-
if(paymentNonce) {
|
486 |
-
// Run the verify function on the braintree client
|
487 |
-
this.client.verify3DS({
|
488 |
-
amount: this.amount,
|
489 |
-
creditCard: paymentNonce
|
490 |
-
}, function (error, response) {
|
491 |
-
|
492 |
-
if (!error) {
|
493 |
-
|
494 |
-
// Store threeDSecure token and nonce in form
|
495 |
-
$('creditcard-payment-nonce').removeAttribute('disabled');
|
496 |
-
$('creditcard-payment-nonce').value = response.nonce;
|
497 |
-
|
498 |
-
// Run any callback functions
|
499 |
-
if (options.onSuccess) {
|
500 |
-
options.onSuccess();
|
501 |
-
}
|
502 |
-
} else {
|
503 |
-
|
504 |
-
// Show the error
|
505 |
-
alert(error.message);
|
506 |
-
|
507 |
-
if(options.onFailure) {
|
508 |
-
options.onFailure();
|
509 |
-
} else {
|
510 |
-
checkout.setLoadWaiting(false);
|
511 |
-
}
|
512 |
-
}
|
513 |
-
});
|
514 |
-
} else {
|
515 |
-
|
516 |
-
alert('No payment nonce present.');
|
517 |
-
|
518 |
-
if(options.onFailure) {
|
519 |
-
options.onFailure();
|
520 |
-
} else {
|
521 |
-
checkout.setLoadWaiting(false);
|
522 |
-
}
|
523 |
-
}
|
524 |
-
|
525 |
-
},
|
526 |
-
|
527 |
-
/**
|
528 |
-
* Process a standard card request
|
529 |
-
*
|
530 |
-
* @param options Contains any callback functions which have been set
|
531 |
-
*/
|
532 |
-
processCard: function(options) {
|
533 |
-
|
534 |
-
var tokenizeRequest = {
|
535 |
-
number: $$('[data-genebraintree-name="number"]').first().value,
|
536 |
-
cardholderName: this.getBillingName(),
|
537 |
-
expirationMonth: $$('[data-genebraintree-name="expiration_month"]').first().value,
|
538 |
-
expirationYear: $$('[data-genebraintree-name="expiration_year"]').first().value
|
539 |
-
};
|
540 |
-
|
541 |
-
// If the CVV field exists include it
|
542 |
-
if($$('[data-genebraintree-name="cvv"]').first() != undefined) {
|
543 |
-
tokenizeRequest.cvv = $$('[data-genebraintree-name="cvv"]').first().value;
|
544 |
-
}
|
545 |
-
|
546 |
-
// If we have the billing postcode add it into the request
|
547 |
-
if(this.getBillingPostcode() != "") {
|
548 |
-
tokenizeRequest.billingAddress = {
|
549 |
-
postalCode: this.getBillingPostcode()
|
550 |
-
};
|
551 |
-
}
|
552 |
-
|
553 |
-
// Attempt to tokenize the card
|
554 |
-
this.client.tokenizeCard(tokenizeRequest, function (errors, nonce) {
|
555 |
-
|
556 |
-
if(!errors) {
|
557 |
-
// Update the nonce in the form
|
558 |
-
$('creditcard-payment-nonce').value = nonce;
|
559 |
-
|
560 |
-
// Run any callback functions
|
561 |
-
if(options.onSuccess) {
|
562 |
-
options.onSuccess();
|
563 |
-
}
|
564 |
-
} else {
|
565 |
-
// Handle errors
|
566 |
-
for (var i = 0; i < errors.length; i++) {
|
567 |
-
alert(errors[i].code + " " + errors[i].message);
|
568 |
-
}
|
569 |
-
|
570 |
-
if(options.onFailure) {
|
571 |
-
options.onFailure();
|
572 |
-
} else {
|
573 |
-
checkout.setLoadWaiting(false);
|
574 |
-
}
|
575 |
-
}
|
576 |
-
});
|
577 |
-
|
578 |
-
},
|
579 |
-
|
580 |
-
/**
|
581 |
-
* Conduct a regular expression check to determine card type automatically
|
582 |
-
*
|
583 |
-
* @param number
|
584 |
-
* @returns {string}
|
585 |
-
*/
|
586 |
-
getCardType: function(number) {
|
587 |
-
|
588 |
-
if (number.match(/^4/) != null)
|
589 |
-
return "VI";
|
590 |
-
|
591 |
-
if (number.match(/^(34|37)/) != null)
|
592 |
-
return "AE";
|
593 |
-
|
594 |
-
if (number.match(/^5[1-5]/) != null)
|
595 |
-
return "MC";
|
596 |
-
|
597 |
-
if (number.match(/^6011/) != null)
|
598 |
-
return "DI";
|
599 |
-
|
600 |
-
if (number.match(/^(?:2131|1800|35)/) != null)
|
601 |
-
return "JCB";
|
602 |
-
|
603 |
-
if (number.match(/^(5018|5020|5038|6304|67[0-9]{2})/) != null)
|
604 |
-
return "ME";
|
605 |
-
|
606 |
-
// Otherwise return the standard card
|
607 |
-
return "card";
|
608 |
-
},
|
609 |
-
|
610 |
-
/**
|
611 |
-
* Wrapper function which defines which method should be called
|
612 |
-
*
|
613 |
-
* verify3dSecureVault - used for verifying any vaulted card when 3D secure is enabled
|
614 |
-
* verify3dSecure - verify a normal card via 3D secure
|
615 |
-
* processCard - verify a normal card
|
616 |
-
*
|
617 |
-
* If the customer has choosen a vaulted card and 3D is disabled no client side interaction is needed
|
618 |
-
*
|
619 |
-
* @param options Object containing onSuccess, onFailure functions
|
620 |
-
*/
|
621 |
-
process: function(options) {
|
622 |
-
|
623 |
-
// We have to handle vaulted 3D secure cards differently
|
624 |
-
if ($('creditcard-saved-accounts') != undefined
|
625 |
-
&& $$('#creditcard-saved-accounts input:checked[type=radio]').first() != undefined
|
626 |
-
&& $$('#creditcard-saved-accounts input:checked[type=radio]').first().hasAttribute('data-threedsecure-nonce'))
|
627 |
-
{
|
628 |
-
// The user has selected a card stored via 3D secure
|
629 |
-
this.verify3dSecureVault(options);
|
630 |
-
|
631 |
-
} else if($('creditcard-saved-accounts') != undefined
|
632 |
-
&& $$('#creditcard-saved-accounts input:checked[type=radio]').first() != undefined
|
633 |
-
&& $$('#creditcard-saved-accounts input:checked[type=radio]').first().value !== 'other')
|
634 |
-
{
|
635 |
-
// No action required as we're using a saved card
|
636 |
-
if(options.onSuccess) {
|
637 |
-
options.onSuccess()
|
638 |
-
}
|
639 |
-
|
640 |
-
} else if(this.threeDSecure == true) {
|
641 |
-
|
642 |
-
// Standard 3D secure callback
|
643 |
-
this.verify3dSecure(options);
|
644 |
-
|
645 |
-
} else {
|
646 |
-
|
647 |
-
// Otherwise process the card normally
|
648 |
-
this.processCard(options);
|
649 |
-
}
|
650 |
-
}
|
651 |
-
|
652 |
-
};
|
653 |
-
|
654 |
-
/**
|
655 |
-
* Separate class to handle functionality around the vZero PayPal button
|
656 |
-
*
|
657 |
-
* @class vZeroPayPalButton
|
658 |
-
* @author Dave Macaulay <dave@gene.co.uk>
|
659 |
-
*/
|
660 |
-
var vZeroPayPalButton = Class.create();
|
661 |
-
vZeroPayPalButton.prototype = {
|
662 |
-
|
663 |
-
/**
|
664 |
-
* Initialize the PayPal button class
|
665 |
-
*
|
666 |
-
* @param clientToken Client token generated from server
|
667 |
-
* @param storeFrontName The store name to show within the PayPal modal window
|
668 |
-
* @param singleUse Should the system attempt to open in single payment mode?
|
669 |
-
* @param locale The locale for the pamynet
|
670 |
-
* @param futureSingleUse When using future payments should we process the transaction as a single payment?
|
671 |
-
*/
|
672 |
-
initialize: function (clientToken, storeFrontName, singleUse, locale, futureSingleUse) {
|
673 |
-
this.clientToken = clientToken;
|
674 |
-
this.storeFrontName = storeFrontName;
|
675 |
-
this.singleUse = singleUse;
|
676 |
-
this.locale = locale;
|
677 |
-
this.futureSingleUse = futureSingleUse;
|
678 |
-
|
679 |
-
this.PayPalClient = false;
|
680 |
-
},
|
681 |
-
|
682 |
-
/**
|
683 |
-
* Update the pricing information for the PayPal button
|
684 |
-
* If the PayPalClient has already been created we also update the _clientOptions
|
685 |
-
* so the PayPal modal window displays the correct values
|
686 |
-
*
|
687 |
-
* @param amount The amount formatted to two decimal places
|
688 |
-
* @param currency The currency code
|
689 |
-
*/
|
690 |
-
setPricing: function(amount, currency) {
|
691 |
-
|
692 |
-
// Set them into the class
|
693 |
-
this.amount = parseFloat(amount);
|
694 |
-
this.currency = currency;
|
695 |
-
|
696 |
-
// If the client exists update the clientOptions
|
697 |
-
if(this.PayPalClient._clientOptions != undefined) {
|
698 |
-
this.PayPalClient._clientOptions.amount = parseFloat(amount);
|
699 |
-
this.PayPalClient._clientOptions.currency = currency;
|
700 |
-
}
|
701 |
-
},
|
702 |
-
|
703 |
-
/**
|
704 |
-
* Inject the PayPal button into the document
|
705 |
-
*
|
706 |
-
* @param options Object containing onSuccess method
|
707 |
-
*/
|
708 |
-
addPayPalButton: function(options) {
|
709 |
-
|
710 |
-
// Build up our setup configuration
|
711 |
-
var setupConfiguration = {
|
712 |
-
container: "paypal-container",
|
713 |
-
paymentMethodNonceInputField: "paypal-payment-nonce",
|
714 |
-
displayName: this.storeFrontName,
|
715 |
-
onPaymentMethodReceived: function(obj) {
|
716 |
-
|
717 |
-
// If a callback is defined we're doing something crazy!
|
718 |
-
if(typeof options != 'undefined' && options.onSuccess) {
|
719 |
-
options.onSuccess(obj);
|
720 |
-
} else {
|
721 |
-
// Force check
|
722 |
-
payment.switchMethod('gene_braintree_paypal');
|
723 |
-
|
724 |
-
// Re-enable the form
|
725 |
-
$('paypal-payment-nonce').disabled = false;
|
726 |
-
|
727 |
-
// Remove the PayPal button
|
728 |
-
$('paypal-complete').remove();
|
729 |
-
|
730 |
-
// Submit the checkout steps
|
731 |
-
review.save();
|
732 |
-
}
|
733 |
-
|
734 |
-
},
|
735 |
-
onUnsupported: function() {
|
736 |
-
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.');
|
737 |
-
}
|
738 |
-
};
|
739 |
-
|
740 |
-
// Detect single use
|
741 |
-
if(this.singleUse == true) {
|
742 |
-
|
743 |
-
setupConfiguration.singleUse = true;
|
744 |
-
setupConfiguration.amount = this.amount;
|
745 |
-
setupConfiguration.currency = this.currency;
|
746 |
-
setupConfiguration.locale = this.locale;
|
747 |
-
|
748 |
-
} else if(this.futureSingleUse == true) {
|
749 |
-
|
750 |
-
setupConfiguration.singleUse = true;
|
751 |
-
|
752 |
-
}
|
753 |
-
|
754 |
-
// Start a new version of the client and assign for later modifications
|
755 |
-
this.PayPalClient = braintree.setup(this.clientToken, "paypal", setupConfiguration);
|
756 |
-
},
|
757 |
-
|
758 |
-
/**
|
759 |
-
* Allow closing of the PayPal window
|
760 |
-
*
|
761 |
-
* @param callback A defined callback function if needed
|
762 |
-
*/
|
763 |
-
closePayPalWindow: function(callback) {
|
764 |
-
|
765 |
-
// Make sure the client is active
|
766 |
-
if(this.PayPalClient != undefined) {
|
767 |
-
this.PayPalClient._close();
|
768 |
-
|
769 |
-
if(callback) {
|
770 |
-
callback();
|
771 |
-
}
|
772 |
-
}
|
773 |
-
}
|
774 |
-
|
775 |
-
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Gene_Braintree</name>
|
4 |
-
<version>1.0.
|
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 @@ Easily add PayPal to your checkout. We've built the best PayPal integration arou
|
|
36 |
</ul></description>
|
37 |
<notes>Connect your Magento store to Braintree to accept Credit Cards &amp; PayPal using V.Zero SDK</notes>
|
38 |
<authors><author><name>Dave Macaulay</name><user>dave</user><email>magento@gene.co.uk</email></author></authors>
|
39 |
-
<date>2015-
|
40 |
-
<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="eaaf6c74be4233a315d5aa5932f7c9ca"/><file name="Currency.php" hash="9ffa8a2ded53be75e88a60a024883b07"/><file name="Moduleversion.php" hash="fe3836bde24bb31c4c4585f2cd2f20ed"/><file name="Version.php" hash="ce58278a4faf965301cc2d8b2da4483c"/></dir></dir></dir></dir><dir name="Cart"><file name="Totals.php" hash="a03c441e8143896f92d02931a809f666"/></dir><dir name="Creditcard"><file name="Info.php" hash="8050c4c5321535fe93e62b47eab97b82"/><file name="Threedsecure.php" hash="7848d4ecac743be985f328fa969318bf"/></dir><file name="Creditcard.php" hash="989678324ff3fcddcc99cbe4613019fa"/><file name="Info.php" hash="2a8367489959ba9c1de4fe4c9afa62e4"/><file name="Js.php" hash="50cdd6d01eddfbdcc0061f4369cbeb58"/><dir name="Paypal"><file name="Info.php" hash="0874c0839a27c14ec9be47fed152e880"/></dir><file name="Paypal.php" hash="36294a461378cceee66e99d45753c6e1"/><file name="Saved.php" hash="74ed8e70a404a814b94f21f88c1ca737"/></dir><dir name="Helper"><file name="Data.php" hash="7ab1dba0f90dc067f0293e3f34bdf387"/></dir><dir name="Model"><file name="Debug.php" hash="f3360f71e2346881f93424792ed9f209"/><file name="Observer.php" hash="7d312de6cfb4c1683493a5a085260a7a"/><dir name="Paymentmethod"><file name="Abstract.php" hash="f6f818eb5720ceee4e43cff281209a88"/><file name="Creditcard.php" hash="c0c1307ada89f675ff97b96412205615"/><file name="Paypal.php" hash="6523279bdc21c8b047d85b99d251a26a"/></dir><file name="Saved.php" hash="3b235b454a3692d1c3d5343e2a1c91e9"/><dir name="Source"><file name="Cctype.php" hash="d76aa6c3a4bd798e3a47695f579d21d4"/><dir name="Creditcard"><file name="CaptureAction.php" hash="6444cfc430de44f06e85bd9c8b80d77b"/><file name="PaymentAction.php" hash="a2f3f3d36a98df4d12f76b6ab77f9c47"/></dir><file name="Environment.php" hash="02567d2ddba74d06ac000b4ddb12723a"/><dir name="Paypal"><file name="Locale.php" hash="8988ca77f9c2aa2d19ff0b614a4b7621"/><file name="Paymenttype.php" hash="fe1fe4ee89d5b7a87c7c28716bb2f1cb"/></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="b176325a312062bcf82127aef2da546a"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="BraintreeController.php" hash="7c621fa1548c04e24bb1136bcbbe1d72"/></dir><file name="CheckoutController.php" hash="19551187f161f5df4e49a9a009c0adaf"/><file name="SavedController.php" hash="036e97703c853a5bae064dd7cf5030a8"/></dir><dir name="etc"><file name="adminhtml.xml" hash="c9c940beffa0ec19e4a1499a66f7fd12"/><file name="config.xml" hash="ccd005e62a7a5e60fb9561dd08687a86"/><file name="system.xml" hash="01fc95e2c590d2fad81b007e361cfa63"/></dir><dir name="sql"><dir name="gene_braintree_setup"><file name="install-0.1.0.php" hash="7ef62b7c19b9da5990974da6edb3e77c"/></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="bcbe37b1ece07d6f574c5214db71f61f"/></dir></dir><dir name="template"><dir name="gene"><dir name="braintree"><dir name="creditcard"><file name="info.phtml" hash="2ae1e397b3a633dd305bc26c7b9c1065"/><file name="threedsecure.phtml" hash="ee8ad689afde041c39dd92ffa5274883"/></dir><file name="creditcard.phtml" hash="281f2fe022232deda152d2a625f2a532"/><dir name="customer"><file name="methods.phtml" hash="eb5e2d8f4a0f419fcf720c12062f808a"/><file name="saved.phtml" hash="691162b89ed085599f76072226ca2307"/></dir><dir name="js"><file name="aheadworks.phtml" hash="ca6ee23a15c32c39c984906adb8859c4"/><file name="amasty.phtml" hash="a41a8160d5c4b83e9ec13d7036873be0"/><file name="data.phtml" hash="2d575380d05455c6eae90d3644b525dc"/><file name="default.phtml" hash="6c25afd0c6a80f9ddc6a8f8211ea5cf5"/><file name="firecheckout.phtml" hash="947c3d4db0e6e74f9ebc5597b6240eeb"/><file name="idev.phtml" hash="f3e4afc6540ec5290e47baf8a94a1589"/><file name="iwd.phtml" hash="0d9af526a45878d8bb2d94848c03fb7b"/><file name="magestore.phtml" hash="1800124c22bae590af7ae95ad3548a5e"/><file name="setup.phtml" hash="5d15d864c0fe783061679716273d4300"/></dir><dir name="paypal"><file name="info.phtml" hash="5149b273730121e4dec3c3179820f747"/></dir><file name="paypal.phtml" hash="4280fcf89509eb959171f2214779de35"/></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="1995e85eb47b909120ce8b9b537bf5db"/></dir></dir><dir name="template"><dir name="gene"><dir name="braintree"><dir name="creditcard"><file name="info.phtml" hash="24c67bab482ea7383ce57d9a06bb9d6f"/></dir><file name="creditcard.phtml" hash="0c6b7806732c336ead14fab596f1b923"/><file name="js.phtml" hash="0f3e0b631726c2faf9b119beb2f2ffc6"/><dir name="paypal"><file name="info.phtml" hash="a8f92f312f8aa5a9463f1d5c2a38cd1b"/></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.js" hash="4a074b2952d6e3c0052f85442b284abc"/><file name="vzero.js" hash="145a67d5135de282eb9d2d60a1e15351"/></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=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir></dir></dir><dir name="css"><dir name="gene"><dir name="braintree"><file name="aheadworks.css" hash="af097f350d4562bbb73c872da3d23909"/><file name="amasty.css" hash="2833339cc9735ce0437f003d65c2184f"/><file name="firecheckout.css" hash="86584668b7190226386dc4c41dfda37f"/><file name="idev.css" hash="330a5d4b5fd63a474e499e4718f0bb57"/><file name="iwd.css" hash="d21129818d313e87c6619f21d64c3733"/><file name="magestore.css" hash="b5190c300305e2e85623b2e7ba23b025"/></dir></dir></dir></dir></dir></dir></target><target name="magelib"><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="7a1de1da0aa0733277a87b75307bb201"/><file name="ApplePayCard.php" hash="06eea10b110792c18d692e482445ffe4"/><file name="Base.php" hash="60d52fd1bef5655bcb607fba45bb4c1c"/><file name="ClientToken.php" hash="358c0a1dba687baf635db818cb7d1dac"/><file name="ClientTokenGateway.php" hash="6f2259a51415a779a072719288811c16"/><file name="CoinbaseAccount.php" hash="ee5cb6963f675a9a71293c453b128866"/><file name="Collection.php" hash="0e7d31ffcbd9780fb554186bd2c194b0"/><file name="Configuration.php" hash="cce5e6b7e215c73767127d3d8441cc8f"/><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="1232a22dd6de6ad1446c6fbb9b0f79c3"/><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><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="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="103156f5646a8193ed548405f5ac476f"/><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="e2e238d067f43c0f28fcb25c2de4a274"/><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="1ce13a8b1ec93cf32b8029c55ea26fa2"/><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="230dc3687abaf95e9f516573b1836f4a"/><file name="TransactionAmounts.php" hash="ed9bf1f57d871542c32d11de9e031f05"/><file name="VenmoSdk.php" hash="6ce94deccd1f968596011487c7e69cc7"/></dir><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="4dab3acc0cc35b5a6f12f95004074374"/><file name="ApplePayCardDetails.php" hash="c4dd87cd46fe7269e1bd51c867adf7cb"/><file name="CoinbaseDetails.php" hash="d19a625f8de98698b8277c25660358f0"/><file name="CreditCardDetails.php" hash="aac5eb1f5804d4f979b9c71f7b98cb36"/><file name="CustomerDetails.php" hash="e137895c646127312be44292c84a2d81"/><file name="PayPalDetails.php" hash="ede299e376bce7714838d79ca3d40842"/><file name="StatusDetails.php" hash="7c6e719c51bf13bdfd07615030100ac6"/><file name="SubscriptionDetails.php" hash="1cf1f511d1545a2e27b8d3f4bee800ca"/></dir><file name="Transaction.php" hash="09b9e7a574d304e9edebe578173f2994"/><file name="TransactionGateway.php" hash="4282d7497100c26afcd709fd77eae0bd"/><file name="TransactionSearch.php" hash="3101c79514520a1a500e4623f4ca1c32"/><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="2f088b43efe46edb3262b89b7d40d051"/><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><dir name="."><file name="Braintree.php" hash="424b8ccb072fda0ddf3459be6279734a"/></dir><dir name="ssl"><file name="api_braintreegateway_com.ca.crt" hash="04beb23c767547e980c76eb68c7eab15"/><file name="sandbox_braintreegateway_com.ca.crt" hash="f1b529883c7c2cbb4251658f5da7b4c9"/></dir></target><target name="magelocale"><dir><dir name="en_US"><file name="Gene_Braintree.csv" hash="00ae6dc359bc0d9c48bfc90a865232a3"/></dir></dir></target></contents>
|
42 |
<compatible/>
|
43 |
<dependencies><required><php><min>5.2.1</min><max>6.0.0</max></php><package><name/><channel>connect.magentocommerce.com/core</channel><min/><max/></package></required></dependencies>
|
44 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Gene_Braintree</name>
|
4 |
+
<version>1.0.5</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/mit-license.php">MIT License</license>
|
7 |
<channel>community</channel>
|
36 |
</ul></description>
|
37 |
<notes>Connect your Magento store to Braintree to accept Credit Cards &amp; PayPal using V.Zero SDK</notes>
|
38 |
<authors><author><name>Dave Macaulay</name><user>dave</user><email>magento@gene.co.uk</email></author></authors>
|
39 |
+
<date>2015-10-14</date>
|
40 |
+
<time>09:42:09</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="eaaf6c74be4233a315d5aa5932f7c9ca"/><file name="Currency.php" hash="9ffa8a2ded53be75e88a60a024883b07"/><file name="Moduleversion.php" hash="fe3836bde24bb31c4c4585f2cd2f20ed"/><file name="Version.php" hash="ce58278a4faf965301cc2d8b2da4483c"/></dir></dir></dir></dir><dir name="Cart"><file name="Totals.php" hash="a03c441e8143896f92d02931a809f666"/></dir><dir name="Creditcard"><file name="Info.php" hash="6faf4be87ad62f13373a6b2e852a478b"/><file name="Threedsecure.php" hash="7848d4ecac743be985f328fa969318bf"/></dir><file name="Creditcard.php" hash="3d9dd20d9617a891084950f9a8aa1309"/><file name="Info.php" hash="4d9513f53e20bf7752c1f826bbd63b0e"/><file name="Js.php" hash="eb24c9f10bac596fbbe06fc399ed50f2"/><dir name="Paypal"><file name="Info.php" hash="0874c0839a27c14ec9be47fed152e880"/></dir><file name="Paypal.php" hash="36294a461378cceee66e99d45753c6e1"/><file name="Saved.php" hash="213d66f1dc05052fc389ff353fc4ed2c"/></dir><dir name="Helper"><file name="Data.php" hash="7ab1dba0f90dc067f0293e3f34bdf387"/></dir><dir name="Model"><file name="Debug.php" hash="f3360f71e2346881f93424792ed9f209"/><file name="Observer.php" hash="adfd3115aa000d73e63f888052b403e6"/><dir name="Paymentmethod"><file name="Abstract.php" hash="237976cd80eaaf4dc86051b525af2dbc"/><file name="Creditcard.php" hash="a582f52c8a721ce84bd5731290c61543"/><file name="Paypal.php" hash="54d4c11ac4527f3af97f9a07a9612a64"/></dir><file name="Saved.php" hash="3b235b454a3692d1c3d5343e2a1c91e9"/><dir name="Source"><file name="Cctype.php" hash="d76aa6c3a4bd798e3a47695f579d21d4"/><dir name="Creditcard"><file name="CaptureAction.php" hash="6444cfc430de44f06e85bd9c8b80d77b"/><file name="FormIntegration.php" hash="4f137002a98c8f1f352b02abc4506b3b"/><file name="PaymentAction.php" hash="a2f3f3d36a98df4d12f76b6ab77f9c47"/></dir><file name="Environment.php" hash="02567d2ddba74d06ac000b4ddb12723a"/><dir name="Paypal"><file name="Locale.php" hash="8988ca77f9c2aa2d19ff0b614a4b7621"/><file name="Paymenttype.php" hash="fe1fe4ee89d5b7a87c7c28716bb2f1cb"/></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="4230f248d167abadb574e6c42a3aef6a"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="BraintreeController.php" hash="7c621fa1548c04e24bb1136bcbbe1d72"/></dir><file name="CheckoutController.php" hash="35475823fe0afdf7f62651a5bb3af58c"/><file name="SavedController.php" hash="036e97703c853a5bae064dd7cf5030a8"/></dir><dir name="etc"><file name="adminhtml.xml" hash="c9c940beffa0ec19e4a1499a66f7fd12"/><file name="config.xml" hash="1f1a2d10efb872bed6878de1f0db3815"/><file name="system.xml" hash="9aa9be1ba351343fe90920b4233bd1c2"/></dir><dir name="sql"><dir name="gene_braintree_setup"><file name="install-0.1.0.php" hash="7ef62b7c19b9da5990974da6edb3e77c"/></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="bfd8ca8a7a6f2c9f21946fde160d4c07"/></dir></dir><dir name="template"><dir name="gene"><dir name="braintree"><dir name="creditcard"><file name="hostedfields.phtml" hash="10757415338b805700d36b25296c90c5"/><file name="info.phtml" hash="2ae1e397b3a633dd305bc26c7b9c1065"/><file name="threedsecure.phtml" hash="ee8ad689afde041c39dd92ffa5274883"/></dir><file name="creditcard.phtml" hash="e019b6da4d3c50fbc570d446b18962c5"/><dir name="customer"><file name="methods.phtml" hash="eb5e2d8f4a0f419fcf720c12062f808a"/><file name="saved.phtml" hash="691162b89ed085599f76072226ca2307"/></dir><dir name="js"><file name="aheadworks.phtml" hash="c024bdbf79bfb5dda71ad6acbbcb58d1"/><file name="amasty.phtml" hash="905800a115f06a681a1d31cb0696b2d7"/><file name="data.phtml" hash="2d575380d05455c6eae90d3644b525dc"/><file name="default.phtml" hash="d2375da07bf8f1d50f5b38ba8fab70aa"/><file name="firecheckout.phtml" hash="6295ce2e602c91dc5fbe14e849e7791f"/><file name="idev.phtml" hash="87c9c2014e12d25cb50b00a614615c8f"/><file name="iwd.phtml" hash="30ee8f1351f091278ad16482140d472c"/><file name="magestore.phtml" hash="9d15ccd68804eb72a5db280793922668"/><file name="setup.phtml" hash="f39b3e066b1c1eef36834d41b59174f7"/><file name="unicode.phtml" hash="caeae3b5031ee8539185f78fd4554765"/></dir><dir name="paypal"><file name="info.phtml" hash="5149b273730121e4dec3c3179820f747"/></dir><file name="paypal.phtml" hash="c81c90096517a5a844306345b3c648ca"/></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="67a55c4c984286607f15dd66406b2c5b"/></dir></dir><dir name="template"><dir name="gene"><dir name="braintree"><dir name="creditcard"><file name="hostedfields.phtml" hash="3e835a116317449620a90964d2b34b5e"/><file name="info.phtml" hash="24c67bab482ea7383ce57d9a06bb9d6f"/></dir><file name="creditcard.phtml" hash="e95b7ff1b2db6ed33190b879ad547a45"/><file name="js.phtml" hash="4f547da52ab1888485cea4f376aa9d5a"/><dir name="paypal"><file name="info.phtml" hash="a8f92f312f8aa5a9463f1d5c2a38cd1b"/></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="34c2ad713dd097a9fee41f979b28183c"/><file name="vzero-0.5.js" hash="bb743fd9480ed4b3f6df783b4e872452"/><file name="vzero-0.5.min.js" hash="3824911eb9b06d8303dfcaed5cf210c8"/></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=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir></dir></dir><dir name="css"><dir name="gene"><dir name="braintree"><file name="aheadworks.css" hash="6a9d989e354e4069c1a93301460e4151"/><file name="amasty.css" hash="4c7d73736d10dd1d6be077c091e6511d"/><file name="default.css" hash="17035148ee7da331e11f321f8962536b"/><file name="firecheckout.css" hash="9cd93a2534ca4dc6d049c4146bee4f25"/><file name="idev.css" hash="542423bbb2c61c09331717808cd8c841"/><file name="iwd.css" hash="3774db6ec06341de440a5c73b04ca488"/><file name="magestore.css" hash="47bc1ec7b9bd6ac0cf44f0711bf950a9"/><file name="unicode.css" hash="582421c71dbcd123916cb35c4c0d2618"/></dir></dir></dir></dir></dir></dir></target><target name="magelib"><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="7a1de1da0aa0733277a87b75307bb201"/><file name="ApplePayCard.php" hash="06eea10b110792c18d692e482445ffe4"/><file name="Base.php" hash="60d52fd1bef5655bcb607fba45bb4c1c"/><file name="ClientToken.php" hash="358c0a1dba687baf635db818cb7d1dac"/><file name="ClientTokenGateway.php" hash="6f2259a51415a779a072719288811c16"/><file name="CoinbaseAccount.php" hash="ee5cb6963f675a9a71293c453b128866"/><file name="Collection.php" hash="0e7d31ffcbd9780fb554186bd2c194b0"/><file name="Configuration.php" hash="cce5e6b7e215c73767127d3d8441cc8f"/><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="1232a22dd6de6ad1446c6fbb9b0f79c3"/><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><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="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="103156f5646a8193ed548405f5ac476f"/><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="e2e238d067f43c0f28fcb25c2de4a274"/><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="1ce13a8b1ec93cf32b8029c55ea26fa2"/><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="230dc3687abaf95e9f516573b1836f4a"/><file name="TransactionAmounts.php" hash="ed9bf1f57d871542c32d11de9e031f05"/><file name="VenmoSdk.php" hash="6ce94deccd1f968596011487c7e69cc7"/></dir><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="4dab3acc0cc35b5a6f12f95004074374"/><file name="ApplePayCardDetails.php" hash="c4dd87cd46fe7269e1bd51c867adf7cb"/><file name="CoinbaseDetails.php" hash="d19a625f8de98698b8277c25660358f0"/><file name="CreditCardDetails.php" hash="aac5eb1f5804d4f979b9c71f7b98cb36"/><file name="CustomerDetails.php" hash="e137895c646127312be44292c84a2d81"/><file name="PayPalDetails.php" hash="ede299e376bce7714838d79ca3d40842"/><file name="StatusDetails.php" hash="7c6e719c51bf13bdfd07615030100ac6"/><file name="SubscriptionDetails.php" hash="1cf1f511d1545a2e27b8d3f4bee800ca"/></dir><file name="Transaction.php" hash="09b9e7a574d304e9edebe578173f2994"/><file name="TransactionGateway.php" hash="4282d7497100c26afcd709fd77eae0bd"/><file name="TransactionSearch.php" hash="3101c79514520a1a500e4623f4ca1c32"/><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="2f088b43efe46edb3262b89b7d40d051"/><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><dir name="."><file name="Braintree.php" hash="424b8ccb072fda0ddf3459be6279734a"/></dir><dir name="ssl"><file name="api_braintreegateway_com.ca.crt" hash="04beb23c767547e980c76eb68c7eab15"/><file name="sandbox_braintreegateway_com.ca.crt" hash="f1b529883c7c2cbb4251658f5da7b4c9"/></dir></target><target name="magelocale"><dir><dir name="en_US"><file name="Gene_Braintree.csv" hash="00ae6dc359bc0d9c48bfc90a865232a3"/></dir></dir></target></contents>
|
42 |
<compatible/>
|
43 |
<dependencies><required><php><min>5.2.1</min><max>6.0.0</max></php><package><name/><channel>connect.magentocommerce.com/core</channel><min/><max/></package></required></dependencies>
|
44 |
</package>
|
skin/frontend/base/default/css/gene/braintree/aheadworks.css
CHANGED
@@ -1,11 +1,129 @@
|
|
1 |
/* This checkout extension has lots of fixed widths, leaving styling as default */
|
2 |
|
|
|
|
|
|
|
|
|
3 |
#paypal-complete {
|
4 |
position: relative;
|
5 |
background: #fbfaf6;
|
6 |
text-align: center;
|
7 |
z-index: 6;
|
8 |
}
|
|
|
|
|
|
|
9 |
#paypal-complete label {
|
10 |
margin-bottom: 8px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
}
|
1 |
/* This checkout extension has lots of fixed widths, leaving styling as default */
|
2 |
|
3 |
+
#braintree-paypal-button {
|
4 |
+
line-height: unset;
|
5 |
+
padding: 0;
|
6 |
+
}
|
7 |
#paypal-complete {
|
8 |
position: relative;
|
9 |
background: #fbfaf6;
|
10 |
text-align: center;
|
11 |
z-index: 6;
|
12 |
}
|
13 |
+
#paypal-container iframe {
|
14 |
+
display: none;
|
15 |
+
}
|
16 |
#paypal-complete label {
|
17 |
margin-bottom: 8px;
|
18 |
+
}
|
19 |
+
#braintree-paypal-button {
|
20 |
+
margin: 0 auto;
|
21 |
+
}
|
22 |
+
|
23 |
+
#payment_form_gene_braintree_paypal, #payment_form_gene_braintree_creditcard {
|
24 |
+
padding-top: 6px;
|
25 |
+
padding-bottom: 6px;
|
26 |
+
}
|
27 |
+
|
28 |
+
/* Saved Accounts */
|
29 |
+
#creditcard-saved-accounts, #paypal-saved-accounts {
|
30 |
+
font-size: 0;
|
31 |
+
width: 100%;
|
32 |
+
}
|
33 |
+
#creditcard-saved-accounts tr, #paypal-saved-accounts tr {
|
34 |
+
border-bottom: 1px dotted lightgrey;
|
35 |
+
}
|
36 |
+
#creditcard-saved-accounts tr.other-row, #paypal-saved-accounts tr.other-row {
|
37 |
+
border-bottom: 0;
|
38 |
+
}
|
39 |
+
#creditcard-saved-accounts label {
|
40 |
+
padding: 14px 0;
|
41 |
+
line-height: 48px;
|
42 |
+
width: auto;
|
43 |
+
}
|
44 |
+
#creditcard-saved-accounts tr.other-row label, #paypal-saved-accounts tr.other-row label {
|
45 |
+
padding: 18px 0;
|
46 |
+
}
|
47 |
+
#paypal-saved-accounts label {
|
48 |
+
padding: 8px 0;
|
49 |
+
line-height: 48px;
|
50 |
+
width: auto;
|
51 |
+
}
|
52 |
+
#creditcard-saved-accounts label img {
|
53 |
+
float: left;
|
54 |
+
}
|
55 |
+
#creditcard-saved-accounts label .saved-card-info, #paypal-saved-accounts label .saved-paypal-email {
|
56 |
+
margin-left: 12px;
|
57 |
+
float: left;
|
58 |
+
}
|
59 |
+
#creditcard-saved-accounts label .saved-card-info span {
|
60 |
+
display: block;
|
61 |
+
line-height: 24px;
|
62 |
+
}
|
63 |
+
#creditcard-saved-accounts label .saved-card-info span.saved-expiry-date {
|
64 |
+
font-size: 12px;
|
65 |
+
}
|
66 |
+
|
67 |
+
/* Hosted Fields */
|
68 |
+
#braintree-hosted-submit {
|
69 |
+
display: none;
|
70 |
+
}
|
71 |
+
.braintree-input-field {
|
72 |
+
height: 42px;
|
73 |
+
max-width: 340px;
|
74 |
+
padding: 0 10px;
|
75 |
+
border: 1px solid lightgrey;
|
76 |
+
background: white;
|
77 |
+
}
|
78 |
+
.braintree-card-input-field {
|
79 |
+
height: 50px;
|
80 |
+
width: 100%;
|
81 |
+
max-width: 372px;
|
82 |
+
border: 1px solid lightgrey;
|
83 |
+
position: relative;
|
84 |
+
background: white;
|
85 |
+
}
|
86 |
+
.braintree-card-input-field .card-type {
|
87 |
+
position: absolute;
|
88 |
+
top: 0;
|
89 |
+
left: 0;
|
90 |
+
bottom: 0;
|
91 |
+
padding: 0 10px 0 8px;
|
92 |
+
}
|
93 |
+
.braintree-card-input-field .card-type img {
|
94 |
+
height: 48px;
|
95 |
+
}
|
96 |
+
.braintree-card-input-field #card-number {
|
97 |
+
float: left;
|
98 |
+
height: 48px;
|
99 |
+
width: 100%;
|
100 |
+
padding-left: 66px;
|
101 |
+
box-sizing: border-box;
|
102 |
+
}
|
103 |
+
#braintree-expiration-container {
|
104 |
+
display: block;
|
105 |
+
width: 100%;
|
106 |
+
vertical-align: middle;
|
107 |
+
font-size: 0;
|
108 |
+
}
|
109 |
+
.braintree-expiration {
|
110 |
+
width: 70px;
|
111 |
+
display: inline-block;
|
112 |
+
*zoom: 1;
|
113 |
+
*display: inline;
|
114 |
+
}
|
115 |
+
.braintree-expiration-seperator {
|
116 |
+
vertical-align: top;
|
117 |
+
line-height: 42px;
|
118 |
+
display: inline-block;
|
119 |
+
*zoom: 1;
|
120 |
+
*display: inline;
|
121 |
+
font-size: 30px;
|
122 |
+
padding: 0 8px;
|
123 |
+
}
|
124 |
+
.braintree-cvv {
|
125 |
+
width: 80px;
|
126 |
+
}
|
127 |
+
.braintree-hostedfield .cvv-what-is-this {
|
128 |
+
margin-left: 0;
|
129 |
}
|
skin/frontend/base/default/css/gene/braintree/amasty.css
CHANGED
@@ -1,13 +1,136 @@
|
|
1 |
#braintree-paypal-button {
|
2 |
line-height: unset;
|
3 |
padding: 0;
|
|
|
|
|
|
|
|
|
|
|
4 |
float: left;
|
|
|
|
|
|
|
|
|
5 |
}
|
6 |
#paypal-label {
|
7 |
-
line-height:
|
8 |
-
|
9 |
margin-right: 12px;
|
10 |
}
|
11 |
-
#
|
|
|
|
|
|
|
12 |
vertical-align: middle;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
}
|
1 |
#braintree-paypal-button {
|
2 |
line-height: unset;
|
3 |
padding: 0;
|
4 |
+
margin: 0 auto;
|
5 |
+
}
|
6 |
+
#paypal-complete {
|
7 |
+
margin-top: 12px;
|
8 |
+
text-align: center;
|
9 |
float: left;
|
10 |
+
width: 100%;
|
11 |
+
}
|
12 |
+
#paypal-container iframe {
|
13 |
+
display: none;
|
14 |
}
|
15 |
#paypal-label {
|
16 |
+
line-height: 32px;
|
17 |
+
display: block;
|
18 |
margin-right: 12px;
|
19 |
}
|
20 |
+
#paypal-container {
|
21 |
+
display: block;
|
22 |
+
}
|
23 |
+
#creditcard-saved-accounts td, #paypal-saved-accounts td {
|
24 |
vertical-align: middle;
|
25 |
+
}
|
26 |
+
#gene_braintree_creditcard_cc_number {
|
27 |
+
text-indent: 62px!important;
|
28 |
+
}
|
29 |
+
|
30 |
+
#payment_form_gene_braintree_paypal, #payment_form_gene_braintree_creditcard {
|
31 |
+
padding-top: 6px;
|
32 |
+
padding-bottom: 6px;
|
33 |
+
}
|
34 |
+
|
35 |
+
/* Saved Accounts */
|
36 |
+
#creditcard-saved-accounts, #paypal-saved-accounts {
|
37 |
+
font-size: 0;
|
38 |
+
width: 100%;
|
39 |
+
}
|
40 |
+
#creditcard-saved-accounts tr, #paypal-saved-accounts tr {
|
41 |
+
border-bottom: 1px dotted lightgrey;
|
42 |
+
}
|
43 |
+
#creditcard-saved-accounts tr.other-row, #paypal-saved-accounts tr.other-row {
|
44 |
+
border-bottom: 0;
|
45 |
+
}
|
46 |
+
#creditcard-saved-accounts label {
|
47 |
+
padding: 14px 0;
|
48 |
+
line-height: 48px;
|
49 |
+
width: auto;
|
50 |
+
}
|
51 |
+
#creditcard-saved-accounts tr.other-row label, #paypal-saved-accounts tr.other-row label {
|
52 |
+
padding: 18px 0;
|
53 |
+
}
|
54 |
+
#paypal-saved-accounts label {
|
55 |
+
padding: 8px 0;
|
56 |
+
line-height: 48px;
|
57 |
+
width: auto;
|
58 |
+
}
|
59 |
+
#creditcard-saved-accounts label img {
|
60 |
+
float: left;
|
61 |
+
}
|
62 |
+
#creditcard-saved-accounts label .saved-card-info, #paypal-saved-accounts label .saved-paypal-email {
|
63 |
+
margin-left: 12px;
|
64 |
+
float: left;
|
65 |
+
}
|
66 |
+
#creditcard-saved-accounts label .saved-card-info span {
|
67 |
+
display: block;
|
68 |
+
line-height: 24px;
|
69 |
+
}
|
70 |
+
#creditcard-saved-accounts label .saved-card-info span.saved-expiry-date {
|
71 |
+
font-size: 12px;
|
72 |
+
}
|
73 |
+
|
74 |
+
/* Hosted Fields */
|
75 |
+
#braintree-hosted-submit {
|
76 |
+
display: none;
|
77 |
+
}
|
78 |
+
.braintree-input-field {
|
79 |
+
height: 42px;
|
80 |
+
max-width: 340px;
|
81 |
+
padding: 0 10px;
|
82 |
+
border: 1px solid lightgrey;
|
83 |
+
background: white;
|
84 |
+
}
|
85 |
+
.braintree-card-input-field {
|
86 |
+
height: 50px;
|
87 |
+
width: 100%;
|
88 |
+
max-width: 372px;
|
89 |
+
border: 1px solid lightgrey;
|
90 |
+
position: relative;
|
91 |
+
background: white;
|
92 |
+
}
|
93 |
+
.braintree-card-input-field .card-type {
|
94 |
+
position: absolute;
|
95 |
+
top: 0;
|
96 |
+
left: 0;
|
97 |
+
bottom: 0;
|
98 |
+
padding: 0 10px 0 8px;
|
99 |
+
}
|
100 |
+
.braintree-card-input-field .card-type img {
|
101 |
+
height: 48px;
|
102 |
+
}
|
103 |
+
.braintree-card-input-field #card-number {
|
104 |
+
float: left;
|
105 |
+
height: 48px;
|
106 |
+
width: 100%;
|
107 |
+
padding-left: 66px;
|
108 |
+
box-sizing: border-box;
|
109 |
+
}
|
110 |
+
#braintree-expiration-container {
|
111 |
+
display: block;
|
112 |
+
width: 100%;
|
113 |
+
vertical-align: middle;
|
114 |
+
font-size: 0;
|
115 |
+
}
|
116 |
+
.braintree-expiration {
|
117 |
+
width: 70px;
|
118 |
+
display: inline-block;
|
119 |
+
*zoom: 1;
|
120 |
+
*display: inline;
|
121 |
+
}
|
122 |
+
.braintree-expiration-seperator {
|
123 |
+
vertical-align: top;
|
124 |
+
line-height: 42px;
|
125 |
+
display: inline-block;
|
126 |
+
*zoom: 1;
|
127 |
+
*display: inline;
|
128 |
+
font-size: 30px;
|
129 |
+
padding: 0 8px;
|
130 |
+
}
|
131 |
+
.braintree-cvv {
|
132 |
+
width: 80px;
|
133 |
+
}
|
134 |
+
.braintree-hostedfield .cvv-what-is-this {
|
135 |
+
margin-left: 0;
|
136 |
}
|
skin/frontend/base/default/css/gene/braintree/default.css
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#paypal-container iframe {
|
2 |
+
display: none;
|
3 |
+
}
|
4 |
+
|
5 |
+
/* Saved Accounts */
|
6 |
+
#creditcard-saved-accounts, #paypal-saved-accounts {
|
7 |
+
font-size: 0;
|
8 |
+
width: 100%;
|
9 |
+
}
|
10 |
+
#creditcard-saved-accounts tr, #paypal-saved-accounts tr {
|
11 |
+
border-bottom: 1px dotted lightgrey;
|
12 |
+
}
|
13 |
+
#creditcard-saved-accounts tr td, #paypal-saved-accounts tr td {
|
14 |
+
vertical-align: middle;
|
15 |
+
}
|
16 |
+
#payment_form_gene_braintree_creditcard label, #payment_form_gene_braintree_paypal label {
|
17 |
+
width: 100%;
|
18 |
+
padding: 0;
|
19 |
+
text-align: left;
|
20 |
+
float: none;
|
21 |
+
}
|
22 |
+
#payment_form_gene_braintree_creditcard p, #payment_form_gene_braintree_paypal p {
|
23 |
+
padding: 0;
|
24 |
+
}
|
25 |
+
#creditcard-saved-accounts tr.other-row, #paypal-saved-accounts tr.other-row {
|
26 |
+
border-bottom: 0;
|
27 |
+
}
|
28 |
+
#creditcard-saved-accounts label {
|
29 |
+
float: left;
|
30 |
+
padding: 10px 0;
|
31 |
+
line-height: 40px;
|
32 |
+
width: 100%;
|
33 |
+
}
|
34 |
+
#creditcard-saved-accounts tr.other-row label, #paypal-saved-accounts tr.other-row label {
|
35 |
+
padding: 8px 0;
|
36 |
+
}
|
37 |
+
#paypal-saved-accounts label {
|
38 |
+
padding: 6px 0;
|
39 |
+
line-height: 40px;
|
40 |
+
}
|
41 |
+
#creditcard-saved-accounts label img, #paypal-saved-accounts label img {
|
42 |
+
margin-left: 6px;
|
43 |
+
height: 40px;
|
44 |
+
float: left;
|
45 |
+
}
|
46 |
+
#creditcard-saved-accounts label .saved-card-info, #paypal-saved-accounts label .saved-paypal-email {
|
47 |
+
margin-left: 14px;
|
48 |
+
float: left;
|
49 |
+
}
|
50 |
+
#creditcard-saved-accounts label .saved-card-info span {
|
51 |
+
line-height: 40px;
|
52 |
+
}
|
53 |
+
#creditcard-saved-accounts label .saved-card-info span.saved-expiry-date {
|
54 |
+
font-size: 12px;
|
55 |
+
font-weight: normal;
|
56 |
+
margin-left: 14px;
|
57 |
+
}
|
58 |
+
#gene_braintree_creditcard_store_in_vault_div label, label[for="gene_braintree_paypal_store_in_vault"] {
|
59 |
+
width: auto!important;
|
60 |
+
}
|
61 |
+
|
62 |
+
/* Hosted Fields */
|
63 |
+
#braintree-hosted-submit {
|
64 |
+
display: none;
|
65 |
+
}
|
66 |
+
.braintree-input-field {
|
67 |
+
height: 42px;
|
68 |
+
max-width: 340px;
|
69 |
+
padding: 0 10px;
|
70 |
+
border: 1px solid lightgrey;
|
71 |
+
background: white;
|
72 |
+
}
|
73 |
+
.braintree-card-input-field {
|
74 |
+
height: 50px;
|
75 |
+
width: 100%;
|
76 |
+
max-width: 372px;
|
77 |
+
border: 1px solid lightgrey;
|
78 |
+
position: relative;
|
79 |
+
background: white;
|
80 |
+
}
|
81 |
+
.braintree-card-input-field .card-type {
|
82 |
+
position: absolute;
|
83 |
+
top: 0;
|
84 |
+
left: 0;
|
85 |
+
bottom: 0;
|
86 |
+
padding: 0 10px 0 8px;
|
87 |
+
}
|
88 |
+
.braintree-card-input-field .card-type img {
|
89 |
+
height: 48px;
|
90 |
+
}
|
91 |
+
.braintree-card-input-field #card-number {
|
92 |
+
float: left;
|
93 |
+
height: 48px;
|
94 |
+
width: 100%;
|
95 |
+
padding-left: 66px;
|
96 |
+
box-sizing: border-box;
|
97 |
+
}
|
98 |
+
#braintree-expiration-container {
|
99 |
+
display: block;
|
100 |
+
width: 100%;
|
101 |
+
vertical-align: middle;
|
102 |
+
font-size: 0;
|
103 |
+
}
|
104 |
+
.braintree-expiration {
|
105 |
+
width: 70px;
|
106 |
+
display: inline-block;
|
107 |
+
*zoom: 1;
|
108 |
+
*display: inline;
|
109 |
+
}
|
110 |
+
.braintree-expiration-seperator {
|
111 |
+
vertical-align: top;
|
112 |
+
line-height: 42px;
|
113 |
+
display: inline-block;
|
114 |
+
*zoom: 1;
|
115 |
+
*display: inline;
|
116 |
+
font-size: 30px;
|
117 |
+
padding: 0 8px;
|
118 |
+
}
|
119 |
+
.braintree-cvv {
|
120 |
+
width: 80px;
|
121 |
+
}
|
122 |
+
.braintree-hostedfield .cvv-what-is-this {
|
123 |
+
margin-left: 0;
|
124 |
+
}
|
skin/frontend/base/default/css/gene/braintree/firecheckout.css
CHANGED
@@ -1,13 +1,125 @@
|
|
1 |
#paypal-complete #paypal-label {
|
2 |
-
|
3 |
-
display:inline-block;
|
4 |
-
zoom:1;
|
5 |
-
*display:inline;
|
6 |
margin-right: 8px;
|
|
|
|
|
|
|
|
|
7 |
}
|
8 |
#paypal-complete #paypal-container {
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
}
|
1 |
#paypal-complete #paypal-label {
|
2 |
+
float: right;
|
|
|
|
|
|
|
3 |
margin-right: 8px;
|
4 |
+
line-height: 44px;
|
5 |
+
}
|
6 |
+
#paypal-container iframe {
|
7 |
+
display: none;
|
8 |
}
|
9 |
#paypal-complete #paypal-container {
|
10 |
+
float: right;
|
11 |
+
}
|
12 |
+
#braintree-paypal-button {
|
13 |
+
padding: 0;
|
14 |
+
}
|
15 |
+
|
16 |
+
#payment_form_gene_braintree_paypal, #payment_form_gene_braintree_creditcard {
|
17 |
+
padding-top: 6px;
|
18 |
+
padding-bottom: 6px;
|
19 |
+
}
|
20 |
+
|
21 |
+
/* Saved Accounts */
|
22 |
+
#creditcard-saved-accounts, #paypal-saved-accounts {
|
23 |
+
font-size: 0;
|
24 |
+
width: 100%;
|
25 |
+
}
|
26 |
+
#creditcard-saved-accounts tr, #paypal-saved-accounts tr {
|
27 |
+
border-bottom: 1px dotted lightgrey;
|
28 |
+
}
|
29 |
+
#creditcard-saved-accounts tr.other-row, #paypal-saved-accounts tr.other-row {
|
30 |
+
border-bottom: 0;
|
31 |
+
}
|
32 |
+
#creditcard-saved-accounts label {
|
33 |
+
padding: 14px 0;
|
34 |
+
line-height: 48px;
|
35 |
+
width: auto;
|
36 |
+
}
|
37 |
+
#creditcard-saved-accounts tr.other-row label, #paypal-saved-accounts tr.other-row label {
|
38 |
+
padding: 18px 0;
|
39 |
+
}
|
40 |
+
#creditcard-saved-accounts tr.other-row label[for="other-creditcard"], #paypal-saved-accounts tr.other-row label[for="other-paypal"] {
|
41 |
+
padding: 8px 0;
|
42 |
+
}
|
43 |
+
#paypal-saved-accounts label {
|
44 |
+
padding: 8px 0;
|
45 |
+
line-height: 48px;
|
46 |
+
width: auto;
|
47 |
+
}
|
48 |
+
#creditcard-saved-accounts label img {
|
49 |
+
float: left;
|
50 |
+
}
|
51 |
+
#creditcard-saved-accounts label .saved-card-info, #paypal-saved-accounts label .saved-paypal-email {
|
52 |
+
margin-left: 12px;
|
53 |
+
float: left;
|
54 |
+
}
|
55 |
+
#creditcard-saved-accounts label .saved-card-info span {
|
56 |
+
display: block;
|
57 |
+
line-height: 24px;
|
58 |
+
}
|
59 |
+
#creditcard-saved-accounts label .saved-card-info span.saved-expiry-date {
|
60 |
+
font-size: 12px;
|
61 |
+
}
|
62 |
+
|
63 |
+
/* Hosted Fields */
|
64 |
+
#braintree-hosted-submit {
|
65 |
+
display: none;
|
66 |
+
}
|
67 |
+
.braintree-input-field {
|
68 |
+
height: 42px;
|
69 |
+
max-width: 340px;
|
70 |
+
padding: 0 10px;
|
71 |
+
border: 1px solid lightgrey;
|
72 |
+
background: white;
|
73 |
+
}
|
74 |
+
.braintree-card-input-field {
|
75 |
+
height: 50px;
|
76 |
+
width: 100%;
|
77 |
+
max-width: 372px;
|
78 |
+
border: 1px solid lightgrey;
|
79 |
+
position: relative;
|
80 |
+
background: white;
|
81 |
+
}
|
82 |
+
.braintree-card-input-field .card-type {
|
83 |
+
position: absolute;
|
84 |
+
top: 0;
|
85 |
+
left: 0;
|
86 |
+
bottom: 0;
|
87 |
+
padding: 0 10px 0 8px;
|
88 |
+
}
|
89 |
+
.braintree-card-input-field .card-type img {
|
90 |
+
height: 48px;
|
91 |
+
}
|
92 |
+
.braintree-card-input-field #card-number {
|
93 |
+
float: left;
|
94 |
+
height: 48px;
|
95 |
+
width: 100%;
|
96 |
+
padding-left: 66px;
|
97 |
+
box-sizing: border-box;
|
98 |
+
}
|
99 |
+
#braintree-expiration-container {
|
100 |
+
display: block;
|
101 |
+
width: 100%;
|
102 |
+
vertical-align: middle;
|
103 |
+
font-size: 0;
|
104 |
+
}
|
105 |
+
.braintree-expiration {
|
106 |
+
width: 70px;
|
107 |
+
display: inline-block;
|
108 |
+
*zoom: 1;
|
109 |
+
*display: inline;
|
110 |
+
}
|
111 |
+
.braintree-expiration-seperator {
|
112 |
+
vertical-align: top;
|
113 |
+
line-height: 42px;
|
114 |
+
display: inline-block;
|
115 |
+
*zoom: 1;
|
116 |
+
*display: inline;
|
117 |
+
font-size: 30px;
|
118 |
+
padding: 0 8px;
|
119 |
+
}
|
120 |
+
.braintree-cvv {
|
121 |
+
width: 80px;
|
122 |
+
}
|
123 |
+
.braintree-hostedfield .cvv-what-is-this {
|
124 |
+
margin-left: 0;
|
125 |
}
|
skin/frontend/base/default/css/gene/braintree/idev.css
CHANGED
@@ -1,6 +1,9 @@
|
|
1 |
#paypal-container {
|
2 |
float: right;
|
3 |
}
|
|
|
|
|
|
|
4 |
#paypal-label {
|
5 |
line-height: 44px;
|
6 |
float: right;
|
@@ -18,4 +21,107 @@
|
|
18 |
}
|
19 |
#credit-card-form .form-list:before, #credit-card-form .form-list:after {
|
20 |
border: 0!important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
}
|
1 |
#paypal-container {
|
2 |
float: right;
|
3 |
}
|
4 |
+
#paypal-container iframe {
|
5 |
+
display: none;
|
6 |
+
}
|
7 |
#paypal-label {
|
8 |
line-height: 44px;
|
9 |
float: right;
|
21 |
}
|
22 |
#credit-card-form .form-list:before, #credit-card-form .form-list:after {
|
23 |
border: 0!important;
|
24 |
+
}
|
25 |
+
|
26 |
+
/* Saved Accounts */
|
27 |
+
#creditcard-saved-accounts, #paypal-saved-accounts {
|
28 |
+
font-size: 0;
|
29 |
+
width: 100%;
|
30 |
+
}
|
31 |
+
#creditcard-saved-accounts tr, #paypal-saved-accounts tr {
|
32 |
+
border-bottom: 1px dotted lightgrey;
|
33 |
+
}
|
34 |
+
#creditcard-saved-accounts tr.other-row, #paypal-saved-accounts tr.other-row {
|
35 |
+
border-bottom: 0;
|
36 |
+
}
|
37 |
+
#creditcard-saved-accounts label {
|
38 |
+
padding: 14px 0;
|
39 |
+
line-height: 48px;
|
40 |
+
width: auto;
|
41 |
+
}
|
42 |
+
#creditcard-saved-accounts tr.other-row label, #paypal-saved-accounts tr.other-row label {
|
43 |
+
padding: 18px 0;
|
44 |
+
}
|
45 |
+
#paypal-saved-accounts label {
|
46 |
+
padding: 8px 0;
|
47 |
+
line-height: 48px;
|
48 |
+
width: auto;
|
49 |
+
}
|
50 |
+
#creditcard-saved-accounts label img {
|
51 |
+
float: left;
|
52 |
+
}
|
53 |
+
#creditcard-saved-accounts label .saved-card-info, #paypal-saved-accounts label .saved-paypal-email {
|
54 |
+
margin-left: 12px;
|
55 |
+
float: left;
|
56 |
+
}
|
57 |
+
#creditcard-saved-accounts label .saved-card-info span {
|
58 |
+
display: block;
|
59 |
+
line-height: 24px;
|
60 |
+
}
|
61 |
+
#creditcard-saved-accounts label .saved-card-info span.saved-expiry-date {
|
62 |
+
font-size: 12px;
|
63 |
+
}
|
64 |
+
|
65 |
+
/* Hosted Fields */
|
66 |
+
#braintree-hosted-submit {
|
67 |
+
display: none;
|
68 |
+
}
|
69 |
+
.braintree-input-field {
|
70 |
+
height: 42px;
|
71 |
+
max-width: 340px;
|
72 |
+
padding: 0 10px;
|
73 |
+
border: 1px solid lightgrey;
|
74 |
+
background: white;
|
75 |
+
}
|
76 |
+
.braintree-card-input-field {
|
77 |
+
height: 50px;
|
78 |
+
width: 100%;
|
79 |
+
max-width: 372px;
|
80 |
+
border: 1px solid lightgrey;
|
81 |
+
position: relative;
|
82 |
+
background: white;
|
83 |
+
}
|
84 |
+
.braintree-card-input-field .card-type {
|
85 |
+
position: absolute;
|
86 |
+
top: 0;
|
87 |
+
left: 0;
|
88 |
+
bottom: 0;
|
89 |
+
padding: 0 10px 0 8px;
|
90 |
+
}
|
91 |
+
.braintree-card-input-field .card-type img {
|
92 |
+
height: 48px;
|
93 |
+
}
|
94 |
+
.braintree-card-input-field #card-number {
|
95 |
+
float: left;
|
96 |
+
height: 48px;
|
97 |
+
width: 100%;
|
98 |
+
padding-left: 66px;
|
99 |
+
box-sizing: border-box;
|
100 |
+
}
|
101 |
+
#braintree-expiration-container {
|
102 |
+
display: block;
|
103 |
+
width: 100%;
|
104 |
+
vertical-align: middle;
|
105 |
+
font-size: 0;
|
106 |
+
}
|
107 |
+
.braintree-expiration {
|
108 |
+
width: 70px;
|
109 |
+
display: inline-block;
|
110 |
+
*zoom: 1;
|
111 |
+
*display: inline;
|
112 |
+
}
|
113 |
+
.braintree-expiration-seperator {
|
114 |
+
vertical-align: top;
|
115 |
+
line-height: 42px;
|
116 |
+
display: inline-block;
|
117 |
+
*zoom: 1;
|
118 |
+
*display: inline;
|
119 |
+
font-size: 30px;
|
120 |
+
padding: 0 8px;
|
121 |
+
}
|
122 |
+
.braintree-cvv {
|
123 |
+
width: 80px;
|
124 |
+
}
|
125 |
+
.braintree-hostedfield .cvv-what-is-this {
|
126 |
+
margin-left: 0;
|
127 |
}
|
skin/frontend/base/default/css/gene/braintree/iwd.css
CHANGED
@@ -1,5 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
#braintree-paypal-button {
|
2 |
line-height: unset;
|
3 |
padding: 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
float: left;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
}
|
1 |
+
#paypal-saved-accounts, .paypal-info, #creditcard-saved-accounts, #credit-card-form {
|
2 |
+
margin-bottom: 20px;
|
3 |
+
}
|
4 |
+
#paypal-complete {
|
5 |
+
text-align: center;
|
6 |
+
padding: 4px 0;
|
7 |
+
}
|
8 |
+
#paypal-complete label {
|
9 |
+
margin-bottom: 8px;
|
10 |
+
}
|
11 |
+
#paypal-container iframe {
|
12 |
+
display: none;
|
13 |
+
}
|
14 |
#braintree-paypal-button {
|
15 |
line-height: unset;
|
16 |
padding: 0;
|
17 |
+
}
|
18 |
+
a#braintree-paypal-button {
|
19 |
+
margin: 0 auto;
|
20 |
+
}
|
21 |
+
|
22 |
+
/* Saved Accounts */
|
23 |
+
#creditcard-saved-accounts, #paypal-saved-accounts {
|
24 |
+
font-size: 0;
|
25 |
+
width: 100%;
|
26 |
+
}
|
27 |
+
#creditcard-saved-accounts tr, #paypal-saved-accounts tr {
|
28 |
+
border-bottom: 1px dotted lightgrey;
|
29 |
+
}
|
30 |
+
#creditcard-saved-accounts tr.other-row, #paypal-saved-accounts tr.other-row {
|
31 |
+
border-bottom: 0;
|
32 |
+
}
|
33 |
+
#creditcard-saved-accounts label {
|
34 |
+
padding: 14px 0;
|
35 |
+
line-height: 48px;
|
36 |
+
width: auto;
|
37 |
+
}
|
38 |
+
#creditcard-saved-accounts tr.other-row label, #paypal-saved-accounts tr.other-row label {
|
39 |
+
padding: 0;
|
40 |
+
}
|
41 |
+
#paypal-saved-accounts label {
|
42 |
+
padding: 8px 0;
|
43 |
+
line-height: 48px;
|
44 |
+
width: auto;
|
45 |
+
}
|
46 |
+
#creditcard-saved-accounts label img, #paypal-saved-accounts label img {
|
47 |
+
margin-left: 6px;
|
48 |
+
float: left;
|
49 |
+
}
|
50 |
+
#creditcard-saved-accounts label .saved-card-info, #paypal-saved-accounts label .saved-paypal-email {
|
51 |
+
margin-left: 14px;
|
52 |
+
float: left;
|
53 |
+
}
|
54 |
+
#creditcard-saved-accounts label .saved-card-info span {
|
55 |
+
display: block;
|
56 |
+
line-height: 24px;
|
57 |
+
}
|
58 |
+
#creditcard-saved-accounts label .saved-card-info span.saved-expiry-date {
|
59 |
+
font-size: 12px;
|
60 |
+
}
|
61 |
+
|
62 |
+
/* Hosted Fields */
|
63 |
+
#braintree-hosted-submit {
|
64 |
+
display: none;
|
65 |
+
}
|
66 |
+
.braintree-input-field {
|
67 |
+
height: 42px;
|
68 |
+
max-width: 340px;
|
69 |
+
padding: 0 10px;
|
70 |
+
border: 1px solid lightgrey;
|
71 |
+
background: white;
|
72 |
+
}
|
73 |
+
.braintree-card-input-field {
|
74 |
+
height: 50px;
|
75 |
+
width: 100%;
|
76 |
+
max-width: 372px;
|
77 |
+
border: 1px solid lightgrey;
|
78 |
+
position: relative;
|
79 |
+
background: white;
|
80 |
+
}
|
81 |
+
.braintree-card-input-field .card-type {
|
82 |
+
position: absolute;
|
83 |
+
top: 0;
|
84 |
+
left: 0;
|
85 |
+
bottom: 0;
|
86 |
+
padding: 0 10px 0 8px;
|
87 |
+
}
|
88 |
+
.braintree-card-input-field .card-type img {
|
89 |
+
height: 48px;
|
90 |
+
}
|
91 |
+
.braintree-card-input-field #card-number {
|
92 |
float: left;
|
93 |
+
height: 48px;
|
94 |
+
width: 100%;
|
95 |
+
padding-left: 66px;
|
96 |
+
box-sizing: border-box;
|
97 |
+
}
|
98 |
+
#braintree-expiration-container {
|
99 |
+
display: block;
|
100 |
+
width: 100%;
|
101 |
+
vertical-align: middle;
|
102 |
+
font-size: 0;
|
103 |
+
}
|
104 |
+
.braintree-expiration {
|
105 |
+
width: 70px;
|
106 |
+
display: inline-block;
|
107 |
+
*zoom: 1;
|
108 |
+
*display: inline;
|
109 |
+
}
|
110 |
+
.braintree-expiration-seperator {
|
111 |
+
vertical-align: top;
|
112 |
+
line-height: 42px;
|
113 |
+
display: inline-block;
|
114 |
+
*zoom: 1;
|
115 |
+
*display: inline;
|
116 |
+
font-size: 30px;
|
117 |
+
padding: 0 8px;
|
118 |
+
}
|
119 |
+
.braintree-cvv {
|
120 |
+
width: 80px;
|
121 |
+
}
|
122 |
+
.braintree-hostedfield .cvv-what-is-this {
|
123 |
+
margin-left: 0;
|
124 |
}
|
skin/frontend/base/default/css/gene/braintree/magestore.css
CHANGED
@@ -3,41 +3,153 @@
|
|
3 |
}
|
4 |
#paypal-complete label {
|
5 |
margin-right: 16px;
|
|
|
6 |
}
|
7 |
#braintree-paypal-button {
|
8 |
line-height: unset;
|
9 |
padding: 0;
|
10 |
float: left;
|
11 |
}
|
|
|
|
|
|
|
12 |
.one-step-checkout .input-text[name="payment[cc_number]"] {
|
13 |
height: 46px!important;
|
14 |
text-indent: 56px!important;
|
15 |
}
|
16 |
-
|
17 |
.saved-cards-intro {
|
18 |
float: left;
|
19 |
}
|
20 |
-
|
21 |
-
#creditcard-saved-accounts .saved-card-number {
|
22 |
-
float: left;
|
23 |
-
}
|
24 |
-
#creditcard-saved-accounts .saved-expiry-date {
|
25 |
-
float: right;
|
26 |
-
display: block;
|
27 |
-
font-weight: normal;
|
28 |
-
}
|
29 |
-
|
30 |
#credit-card-form {
|
31 |
padding-bottom: 12px;
|
32 |
float: left;
|
33 |
}
|
34 |
-
#credit-card-form .form-list, #payment_form_gene_braintree_creditcard {
|
35 |
width: 100%;
|
36 |
padding: 0;
|
37 |
}
|
|
|
|
|
|
|
38 |
#credit-card-form label {
|
|
|
|
|
|
|
39 |
margin-top: 8px;
|
40 |
}
|
41 |
#credit-card-form #gene_braintree_creditcard_store_in_vault_div {
|
42 |
float: left;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
}
|
3 |
}
|
4 |
#paypal-complete label {
|
5 |
margin-right: 16px;
|
6 |
+
line-height: 44px;
|
7 |
}
|
8 |
#braintree-paypal-button {
|
9 |
line-height: unset;
|
10 |
padding: 0;
|
11 |
float: left;
|
12 |
}
|
13 |
+
#paypal-container iframe {
|
14 |
+
display: none;
|
15 |
+
}
|
16 |
.one-step-checkout .input-text[name="payment[cc_number]"] {
|
17 |
height: 46px!important;
|
18 |
text-indent: 56px!important;
|
19 |
}
|
|
|
20 |
.saved-cards-intro {
|
21 |
float: left;
|
22 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
#credit-card-form {
|
24 |
padding-bottom: 12px;
|
25 |
float: left;
|
26 |
}
|
27 |
+
#credit-card-form .form-list, #payment_form_gene_braintree_creditcard, #payment_form_gene_braintree_paypal {
|
28 |
width: 100%;
|
29 |
padding: 0;
|
30 |
}
|
31 |
+
#payment_form_gene_braintree_creditcard, #payment_form_gene_braintree_paypal {
|
32 |
+
padding: 4px 0;
|
33 |
+
}
|
34 |
#credit-card-form label {
|
35 |
+
display: block;
|
36 |
+
width: 100%;
|
37 |
+
float: none;
|
38 |
margin-top: 8px;
|
39 |
}
|
40 |
#credit-card-form #gene_braintree_creditcard_store_in_vault_div {
|
41 |
float: left;
|
42 |
+
width: 100%;
|
43 |
+
}
|
44 |
+
#credit-card-form #gene_braintree_creditcard_store_in_vault_div input, #credit-card-form #gene_braintree_creditcard_store_in_vault_div label {
|
45 |
+
display: inline;
|
46 |
+
}
|
47 |
+
#payment_form_gene_braintree_paypal p {
|
48 |
+
float: left;
|
49 |
+
width: 100%;
|
50 |
+
}
|
51 |
+
|
52 |
+
/* Saved Accounts */
|
53 |
+
#creditcard-saved-accounts, #paypal-saved-accounts {
|
54 |
+
font-size: 0;
|
55 |
+
width: 100%;
|
56 |
+
}
|
57 |
+
#creditcard-saved-accounts tr, #paypal-saved-accounts tr {
|
58 |
+
border-bottom: 1px dotted lightgrey;
|
59 |
+
}
|
60 |
+
#creditcard-saved-accounts tr.other-row, #paypal-saved-accounts tr.other-row {
|
61 |
+
border-bottom: 0;
|
62 |
+
}
|
63 |
+
#creditcard-saved-accounts label {
|
64 |
+
padding: 14px 0;
|
65 |
+
line-height: 48px;
|
66 |
+
width: auto;
|
67 |
+
}
|
68 |
+
#creditcard-saved-accounts tr.other-row label, #paypal-saved-accounts tr.other-row label {
|
69 |
+
padding: 18px 0;
|
70 |
+
}
|
71 |
+
#paypal-saved-accounts label {
|
72 |
+
padding: 8px 0;
|
73 |
+
line-height: 48px;
|
74 |
+
width: auto;
|
75 |
+
}
|
76 |
+
#creditcard-saved-accounts label img {
|
77 |
+
margin-left: 6px;
|
78 |
+
float: left;
|
79 |
+
}
|
80 |
+
#creditcard-saved-accounts label .saved-card-info, #paypal-saved-accounts label .saved-paypal-email {
|
81 |
+
margin-left: 12px;
|
82 |
+
float: left;
|
83 |
+
}
|
84 |
+
#creditcard-saved-accounts label .saved-card-info span {
|
85 |
+
display: block;
|
86 |
+
line-height: 24px;
|
87 |
+
}
|
88 |
+
#creditcard-saved-accounts label .saved-card-info span.saved-expiry-date {
|
89 |
+
font-size: 12px;
|
90 |
+
font-weight: normal;
|
91 |
+
}
|
92 |
+
|
93 |
+
/* Hosted Fields */
|
94 |
+
#braintree-hosted-submit {
|
95 |
+
display: none;
|
96 |
+
}
|
97 |
+
.braintree-input-field {
|
98 |
+
height: 42px;
|
99 |
+
max-width: 340px;
|
100 |
+
padding: 0 10px;
|
101 |
+
border: 1px solid lightgrey;
|
102 |
+
background: white;
|
103 |
+
}
|
104 |
+
.braintree-card-input-field {
|
105 |
+
height: 50px;
|
106 |
+
width: 100%;
|
107 |
+
max-width: 372px;
|
108 |
+
border: 1px solid lightgrey;
|
109 |
+
position: relative;
|
110 |
+
background: white;
|
111 |
+
}
|
112 |
+
.braintree-card-input-field .card-type {
|
113 |
+
position: absolute;
|
114 |
+
top: 0;
|
115 |
+
left: 0;
|
116 |
+
bottom: 0;
|
117 |
+
padding: 0 10px 0 8px;
|
118 |
+
}
|
119 |
+
.braintree-card-input-field .card-type img {
|
120 |
+
height: 48px;
|
121 |
+
}
|
122 |
+
.braintree-card-input-field #card-number {
|
123 |
+
float: left;
|
124 |
+
height: 48px;
|
125 |
+
width: 100%;
|
126 |
+
padding-left: 66px;
|
127 |
+
box-sizing: border-box;
|
128 |
+
}
|
129 |
+
#braintree-expiration-container {
|
130 |
+
display: block;
|
131 |
+
width: 100%;
|
132 |
+
vertical-align: middle;
|
133 |
+
font-size: 0;
|
134 |
+
}
|
135 |
+
.braintree-expiration {
|
136 |
+
width: 70px;
|
137 |
+
display: inline-block;
|
138 |
+
*zoom: 1;
|
139 |
+
*display: inline;
|
140 |
+
}
|
141 |
+
.braintree-expiration-seperator {
|
142 |
+
vertical-align: top;
|
143 |
+
line-height: 42px;
|
144 |
+
display: inline-block;
|
145 |
+
*zoom: 1;
|
146 |
+
*display: inline;
|
147 |
+
font-size: 30px;
|
148 |
+
padding: 0 8px;
|
149 |
+
}
|
150 |
+
.braintree-cvv {
|
151 |
+
width: 80px;
|
152 |
+
}
|
153 |
+
.braintree-hostedfield .cvv-what-is-this {
|
154 |
+
margin-left: 0;
|
155 |
}
|
skin/frontend/base/default/css/gene/braintree/unicode.css
ADDED
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#payment_form_gene_braintree_paypal, #payment_form_gene_braintree_creditcard {
|
2 |
+
margin-left: 0!important;
|
3 |
+
padding: 8px 0;
|
4 |
+
}
|
5 |
+
#payment_form_gene_braintree_paypal label, #payment_form_gene_braintree_creditcard label {
|
6 |
+
width: 100%;
|
7 |
+
text-align: left;
|
8 |
+
float: none;
|
9 |
+
}
|
10 |
+
#payment_form_gene_braintree_paypal p {
|
11 |
+
padding: 0!important;
|
12 |
+
}
|
13 |
+
#paypal-complete {
|
14 |
+
padding: 20px 0;
|
15 |
+
text-align: center;
|
16 |
+
}
|
17 |
+
#paypal-complete label {
|
18 |
+
line-height: 32px;
|
19 |
+
}
|
20 |
+
#braintree-paypal-button {
|
21 |
+
line-height: unset;
|
22 |
+
padding: 0;
|
23 |
+
margin: 0 auto;
|
24 |
+
}
|
25 |
+
#paypal-container iframe {
|
26 |
+
display: none;
|
27 |
+
}
|
28 |
+
|
29 |
+
/* Saved Accounts */
|
30 |
+
#creditcard-saved-accounts, #paypal-saved-accounts {
|
31 |
+
font-size: 0;
|
32 |
+
width: 100%;
|
33 |
+
}
|
34 |
+
#creditcard-saved-accounts tr, #paypal-saved-accounts tr {
|
35 |
+
border-bottom: 1px dotted lightgrey;
|
36 |
+
}
|
37 |
+
#creditcard-saved-accounts tr td, #paypal-saved-accounts tr td {
|
38 |
+
vertical-align: middle!important;
|
39 |
+
}
|
40 |
+
#creditcard-saved-accounts tr.other-row, #paypal-saved-accounts tr.other-row {
|
41 |
+
border-bottom: 0;
|
42 |
+
}
|
43 |
+
#creditcard-saved-accounts label, #paypal-saved-accounts label {
|
44 |
+
float: left;
|
45 |
+
}
|
46 |
+
#creditcard-saved-accounts label {
|
47 |
+
padding: 14px 0;
|
48 |
+
line-height: 48px;
|
49 |
+
width: auto;
|
50 |
+
}
|
51 |
+
#creditcard-saved-accounts tr.other-row label, #paypal-saved-accounts tr.other-row label {
|
52 |
+
padding: 10px 0;
|
53 |
+
}
|
54 |
+
#paypal-saved-accounts label {
|
55 |
+
padding: 8px 0;
|
56 |
+
line-height: 48px;
|
57 |
+
width: auto;
|
58 |
+
}
|
59 |
+
#creditcard-saved-accounts label img {
|
60 |
+
float: left;
|
61 |
+
}
|
62 |
+
#creditcard-saved-accounts label .saved-card-info, #paypal-saved-accounts label .saved-paypal-email {
|
63 |
+
margin-left: 12px;
|
64 |
+
float: left;
|
65 |
+
}
|
66 |
+
#creditcard-saved-accounts label .saved-card-info span {
|
67 |
+
display: block;
|
68 |
+
line-height: 24px;
|
69 |
+
}
|
70 |
+
#creditcard-saved-accounts label .saved-card-info span.saved-expiry-date {
|
71 |
+
font-size: 12px;
|
72 |
+
}
|
73 |
+
|
74 |
+
/* Hosted Fields */
|
75 |
+
#braintree-hosted-submit {
|
76 |
+
display: none;
|
77 |
+
}
|
78 |
+
.braintree-input-field {
|
79 |
+
height: 42px;
|
80 |
+
max-width: 340px;
|
81 |
+
padding: 0 10px;
|
82 |
+
border: 1px solid lightgrey;
|
83 |
+
background: white;
|
84 |
+
}
|
85 |
+
.braintree-card-input-field {
|
86 |
+
height: 50px;
|
87 |
+
width: 100%;
|
88 |
+
max-width: 372px;
|
89 |
+
border: 1px solid lightgrey;
|
90 |
+
position: relative;
|
91 |
+
background: white;
|
92 |
+
}
|
93 |
+
.braintree-card-input-field .card-type {
|
94 |
+
position: absolute;
|
95 |
+
top: 0;
|
96 |
+
left: 0;
|
97 |
+
bottom: 0;
|
98 |
+
padding: 0 10px 0 8px;
|
99 |
+
}
|
100 |
+
.braintree-card-input-field .card-type img {
|
101 |
+
height: 48px;
|
102 |
+
}
|
103 |
+
.braintree-card-input-field #card-number {
|
104 |
+
float: left;
|
105 |
+
height: 48px;
|
106 |
+
width: 100%;
|
107 |
+
padding-left: 66px;
|
108 |
+
box-sizing: border-box;
|
109 |
+
}
|
110 |
+
#braintree-expiration-container {
|
111 |
+
display: block;
|
112 |
+
width: 100%;
|
113 |
+
vertical-align: middle;
|
114 |
+
font-size: 0;
|
115 |
+
}
|
116 |
+
.braintree-expiration {
|
117 |
+
width: 70px;
|
118 |
+
display: inline-block;
|
119 |
+
*zoom: 1;
|
120 |
+
*display: inline;
|
121 |
+
}
|
122 |
+
.braintree-expiration-seperator {
|
123 |
+
vertical-align: top;
|
124 |
+
line-height: 42px;
|
125 |
+
display: inline-block;
|
126 |
+
*zoom: 1;
|
127 |
+
*display: inline;
|
128 |
+
font-size: 30px;
|
129 |
+
padding: 0 8px;
|
130 |
+
}
|
131 |
+
.braintree-cvv {
|
132 |
+
width: 80px;
|
133 |
+
}
|
134 |
+
.braintree-hostedfield .cvv-what-is-this {
|
135 |
+
margin-left: 0;
|
136 |
+
}
|