Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1 from 202-ecommerce/develop
Browse files Browse the repository at this point in the history
2.0.8
  • Loading branch information
clotairer authored Dec 10, 2019
2 parents 7471313 + af1ad1d commit f340834
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 55 deletions.
102 changes: 51 additions & 51 deletions _dev/js/payments.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,7 @@ $(function(){
// Check if the Payment Request is available.
if (await paymentRequest.canMakePayment()) {
prButton.mount('#stripe-payment-request-button');
} else {
$('.card-payment-informations').hide();
$('.card-payment-informations').show();
}

prButton.on('click', function(event) {
Expand All @@ -145,62 +144,62 @@ $(function(){
}
});
}
}

card.addEventListener('change', function(event) {
setOutcome(event);
cardType = event.brand;
if (typeof cardType != "undefined" && cardType != "unknown") {
if (cardType == "American Express")
cardType = "amex";
if (cardType == "Diners Club")
cardType = "diners";
if ($('.img-card').length > 0) {
if ($('#img-'+cardType).length > 0) {
return false;
} else {
$('.img-card').remove();
}
}

var card_logo = document.createElement('img');
card_logo.src = stripe_module_dir + '/views/img/cc-' + cardType.toLowerCase() +'.png';
card_logo.id = "img-"+cardType;
card_logo.className = "img-card";
$('#stripe-card-number').append($(card_logo));
$('#img-'+cardType).css({'margin-left': '-34px'});

$('.cc-icon').removeClass('enable');
$('.cc-icon').removeClass('disable');
$('.cc-icon').each(function() {
if ($(this).attr('rel') == cardType) {
$(this).addClass('enable');
} else {
$(this).addClass('disable');
}
});
} else {
if ($('.img-card').length > 0) {
$('.img-card').remove();
}
$('.cc-icon').removeClass('enable');
$('.cc-icon:not(.disable)').addClass('disable');
}
});

if (stripe_reinsurance_enabled == 'on') {
cardExpiry.addEventListener('change', function(event) {
card.addEventListener('change', function(event) {
setOutcome(event);
cardType = event.brand;
if (typeof cardType != "undefined" && cardType != "unknown") {
if (cardType == "American Express")
cardType = "amex";
if (cardType == "Diners Club")
cardType = "diners";
if ($('.img-card').length > 0) {
if ($('#img-'+cardType).length > 0) {
return false;
} else {
$('.img-card').remove();
}
}

var card_logo = document.createElement('img');
card_logo.src = stripe_module_dir + '/views/img/cc-' + cardType.toLowerCase() +'.png';
card_logo.id = "img-"+cardType;
card_logo.className = "img-card";
$('#stripe-card-number').append($(card_logo));
$('#img-'+cardType).css({'margin-left': '-34px'});

$('.cc-icon').removeClass('enable');
$('.cc-icon').removeClass('disable');
$('.cc-icon').each(function() {
if ($(this).attr('rel') == cardType) {
$(this).addClass('enable');
} else {
$(this).addClass('disable');
}
});
} else {
if ($('.img-card').length > 0) {
$('.img-card').remove();
}
$('.cc-icon').removeClass('enable');
$('.cc-icon:not(.disable)').addClass('disable');
}
});

cardCvc.addEventListener('change', function(event) {
setOutcome(event);
});
if (stripe_reinsurance_enabled == 'on') {
cardExpiry.addEventListener('change', function(event) {
setOutcome(event);
});

if (stripe_postcode_disabled != 'on') {
cardPostalCode.addEventListener('change', function(event) {
cardCvc.addEventListener('change', function(event) {
setOutcome(event);
});

if (stripe_postcode_disabled != 'on') {
cardPostalCode.addEventListener('change', function(event) {
setOutcome(event);
});
}
}
}

Expand Down Expand Up @@ -336,6 +335,7 @@ $(function(){
$.ajax({
type: 'POST',
dataType: 'json',
async: false,
url: stripe_validation_return_url,
data: {
response: response,
Expand Down
1 change: 1 addition & 0 deletions _dev/scss/checkout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
.card-payment-informations {
margin-top: 10px;
text-align: center;
display: none;
}

.payment-options #stripe-card-payment {
Expand Down
14 changes: 12 additions & 2 deletions stripe_official.php
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,16 @@ protected function retrievePaymentIntent($amount, $currency)
);
}

// Check that the currency is still correct
if ($intent->currency != $currency) {
$intent->update(
$this->context->cookie->stripe_payment_intent,
array(
"currency" => Tools::strtolower($this->context->currency->iso_code)
)
);
}

return $intent;
} catch (Exception $e) {
Stripe_officialClasslib\Extensions\ProcessLogger\ProcessLoggerHandler::logError(
Expand Down Expand Up @@ -1239,8 +1249,8 @@ public function hookPayment($params)

public function hookDisplayPaymentEU($params)
{
if (!self::isWellConfigured() || !$this->active) {
return;
if (!self::isWellConfigured() || !$this->active || version_compare(_PS_VERSION_, '1.7', '>=')) {
return array();
}

$payment = $this->hookPayment($params);
Expand Down
5 changes: 5 additions & 0 deletions translations/fr.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@
$_MODULE['<{stripe_official}prestashop>faq_9dcc0c7c9418a6cc3bd4f8bb6a3b34a2'] = 'Sachant cela, il est impossible de garantir que notre module sera entièrement compatible avec toutes les boutiques personnalisées.';
$_MODULE['<{stripe_official}prestashop>faq_9c2a79bedf1b4097564ca5639857022a'] = 'Ce module est compatible avec la plupart des modules existants. La seule exception concerne les modules qui modifient le comportement normal du flux de paiement. Si vous avez installé des modules de ce type pour votre boutique, nous vous recommandons d\'essayer d\'abord notre module dans votre environnement de test.';
$_MODULE['<{stripe_official}prestashop>faq_49752262ed9f5dd6d8206c1f0bba864e'] = 'En cas d\'incompatibilité, vous devriez demander à votre développeur d\'apporter les changements nécessaires pour que notre module soit compatible avec votre boutique.';
$_MODULE['<{stripe_official}prestashop>faq_054306cae6137f51b6f9d1eee39bf5ea'] = 'Il existe un problème de compatibilité de code avec certains modules qui modifient l’entonnoir de checkout. Stripe fournit les « hooks » (points d’ancrage) nécessaires aux autres modules, mais certains d’entre eux ne sont pas en mesure de lire les hooks correctement.';
$_MODULE['<{stripe_official}prestashop>faq_96744ed6f382816f5d679d4a411b31af'] = 'Nous avons rencontré ce problème avec les modules suivant (liste non exhaustive) :';
$_MODULE['<{stripe_official}prestashop>faq_b3e629bba90483636317ded03d814e56'] = 'The checkout';
$_MODULE['<{stripe_official}prestashop>faq_20016e84cfcff4620f0839ce0bddacb0'] = 'One Page Checkout, Social Login & Mailchimp';
$_MODULE['<{stripe_official}prestashop>faq_c393f1802c6a461b192e5bab90027cb3'] = 'Ces modules ont rencontré des problèmes avec la version 2.0.7 de Stripe en octobre 2019, il est possible que des évolutions aient été apportées à ces modules depuis cette date les rendant compatibles avec le module Stripe.';
$_MODULE['<{stripe_official}prestashop>faq_1832fb53d97c341171d496239042b60e'] = 'Que sont les modes Test et Production ?';
$_MODULE['<{stripe_official}prestashop>faq_af30939cf1cf45944120e1ab1252b568'] = 'Le mode Test vous permet de vérifier que le module fonctionne correctement avec votre boutique et de voir à quoi ressemble l\'expérience client sans que ni vous ni lui ayez à payer.';
$_MODULE['<{stripe_official}prestashop>faq_9785f64bbd19d66c2253fcd76cf7575d'] = 'Une fois que vous êtes prêt à débiter vos clients avec notre module, vous pouvez passer au mode Production.';
Expand Down
9 changes: 8 additions & 1 deletion views/templates/admin/_partials/faq.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,14 @@
- {l s='PrestaShop is a highly customisable online shop solution with many ready to use extensions in order to fit your specific needs.' mod='stripe_official'}<br>
- {l s='Knowing this, it is impossible to guarantee that our module will work with all customised shops.' mod='stripe_official'}<br>
- {l s='This module is compatible with most of the existing modules. The only exception concerns modules altering the standard behavior of the checkout flow. If you have such modules installed in your shop, we recommend you try our module in your test environment first.' mod='stripe_official'}<br>
- {l s='In case there is an incompatibility, you should reach out to your developer to make our module compatible with your shop.' mod='stripe_official'}
- {l s='In case there is an incompatibility, you should reach out to your developer to make our module compatible with your shop.' mod='stripe_official'}<br>
- {l s='There is a code compatibility problem with some modules that modify the checkout funnel. Stripe provides the necessary hooks for the other modules, but some of them are not able to read the hooks correctly.' mod='stripe_official'}<br>
- {l s='We encountered this problem with the following modules (non-exhaustive list):' mod='stripe_official'}<br>
<ul>
<li>{l s='The checkout' mod='stripe_official'}</li>
<li>{l s='One Page Checkout, Social Login & Mailchimp' mod='stripe_official'}</li>
</ul>
{l s='These modules have encountered problems with the 2.0.7 version of Stripe in October 2019, it’s possible that evolutions have been made to these modules since that date making them compatible with the Stripe module.' mod='stripe_official'}
</p>
</div>
</li>
Expand Down
2 changes: 1 addition & 1 deletion views/templates/front/payment_info_redirect.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
* @license Commercial license
*}

<p class="notice">Youll be redirected to the banking site to complete your payment.</p>
<p class="notice">{l s='You\'ll be redirected to the banking site to complete your payment.' mod='stripe_official'}</p>

0 comments on commit f340834

Please sign in to comment.