Skip to content

Commit

Permalink
Ticket #3040 - Issue when cache is enabled.
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonLV committed Dec 10, 2020
1 parent aee5a53 commit ee3f50c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
7 changes: 2 additions & 5 deletions modules/boonex/payment/classes/BxPaymentProviderStripeV3.php
Expand Up @@ -391,18 +391,15 @@ protected function _getButtonJs($sType, $iClientId, $iVendorId, $aParams = array
break;
}

$sJsCode = $this->_oModule->_oTemplate->_wrapInTagJs('https://js.stripe.com/v3/');
$sJsCode .= $this->_oModule->_oTemplate->getJsCode($this->_sName, array_merge(array(
return array($this->_oModule->_oTemplate->getJsCode($this->_sName, array_merge(array(
'js_object' => $sJsObject,
'sProvider' => $this->_sName,
'sPublicKey' => !empty($sPublicKey) ? $sPublicKey : $this->_getPublicKey(),
'sVendorName' => '',
'sVendorCurrency' => '',
'sVendorIcon' => '',
'sClientEmail' => $sClientEmail,
), $aParams));

return array($sJsCode, $sJsMethod);
), $aParams)), $sJsMethod);
}
}

Expand Down
10 changes: 5 additions & 5 deletions modules/boonex/payment/classes/BxPaymentTemplate.php
Expand Up @@ -49,14 +49,14 @@ public function addJsCssCart($sType = '', $iVendorId = 0)

$oModule = $this->getModule();
if(!empty($iVendorId)) {
$sMethod = 'getVendorInfoProviders' . bx_gen_method_name($sType);
$aProviders = $this->_oDb->$sMethod($iVendorId);
foreach($aProviders as $sProvider => $aProvider)
$oModule->getObjectProvider($sProvider, $iVendorId)->addJsCss();
$sMethod = 'getVendorInfoProviders' . bx_gen_method_name($sType);
$aProviders = $this->_oDb->$sMethod($iVendorId);
foreach($aProviders as $sProvider => $aProvider)
$oModule->getObjectProvider($sProvider, $iVendorId)->addJsCss();
}
}

public function displayCartJs($sType = '', $iVendorId = 0)
public function displayCartJs($sType = '', $iVendorId = 0)
{
$this->addJsCssCart($sType, $iVendorId);
return $this->displayJsCode('cart');
Expand Down
11 changes: 9 additions & 2 deletions modules/boonex/payment/js/stripe_v3.js
Expand Up @@ -21,8 +21,6 @@ BxPaymentProviderStripeV3.prototype.init = function(oOptions) {
this._sAnimationEffect = oOptions.sAnimationEffect == undefined ? 'fade' : oOptions.sAnimationEffect;
this._iAnimationSpeed = oOptions.iAnimationSpeed == undefined ? 'slow' : oOptions.iAnimationSpeed;

this._rHandler = Stripe(oOptions.sPublicKey);

//--- For Single payment
this._sObjNameGrid = oOptions.sObjNameGrid;

Expand All @@ -34,6 +32,15 @@ BxPaymentProviderStripeV3.prototype.init = function(oOptions) {
this._iItemCount = oOptions.iItemCount;
this._sRedirect = oOptions.sRedirect;
this._sCustom = oOptions.sCustom;

var $this = this;
if(window.Stripe === undefined) {
$.getScript('https://js.stripe.com/v3/', function() {
$this._rHandler = Stripe(oOptions.sPublicKey);
});
}
else
this._rHandler = Stripe(oOptions.sPublicKey);
};

BxPaymentProviderStripeV3.prototype.onCartCheckout = function(oData) {
Expand Down

0 comments on commit ee3f50c

Please sign in to comment.