Skip to content

Commit

Permalink
Merge pull request #756 from PrestaShopCorp/v2.15.2
Browse files Browse the repository at this point in the history
V2.15.2
  • Loading branch information
L3RAZ authored May 4, 2021
2 parents f9c788e + 7a5cd7c commit f94ca37
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 3 deletions.
6 changes: 6 additions & 0 deletions _dev/js/front/src/core/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { PrestashopService } from '../service/prestashop.service';
import { PsCheckoutService } from '../service/ps-checkout.service';
import { TranslationService } from '../service/translation.service';
import { QuerySelectorService } from '../service/query-selector.service';
import { PaymentOptionsLoaderComponent } from '../components/common/payment-options-loader.component';

function initService(app) {
return (service) => () => new service(app);
Expand All @@ -34,6 +35,7 @@ function initContainer(app) {
bottle.factory('PsCheckoutApi', serviceFactory(PsCheckoutApi));
bottle.factory('PsCheckoutService', serviceFactory(PsCheckoutService));
bottle.factory('TranslationService', serviceFactory(TranslationService));
bottle.factory('PaymentOptionsLoaderComponent', serviceFactory(PaymentOptionsLoaderComponent));

bottle.factory('$', (container) => {
return (id) => container.TranslationService.getTranslationString(id);
Expand All @@ -50,6 +52,7 @@ export class App {

this.prestashopService = this.container.PrestashopService;
this.psCheckoutService = this.container.PsCheckoutService;
this.paymentOptionsLoader = this.container.PaymentOptionsLoaderComponent;

this.$ = this.container.$;

Expand Down Expand Up @@ -111,6 +114,9 @@ export class App {
if (this.prestashopService.isOrderPaymentStepPage()) {
await this.renderCheckout();
return this;
} else if(this.prestashopService.isOrderPage()) {
this.paymentOptionsLoader.hide();
return this;
}
}

Expand Down
4 changes: 4 additions & 0 deletions _dev/js/front/src/service/prestashop.service/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ export class PrestashopService {
return !!this.instance.isOrderPaymentStepPage();
}

isOrderPage() {
return this.instance.isOrderPage();
}

isIframeProductPage() {
return !!this.instance.isIframeProductPage();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ export class PrestashopPs1_6Service {
return document.body.id === 'order-opc';
}

static isOrderPage() {
return document.body.id === 'order' || document.body.id === 'order-opc';
}

static isOrderPersonalInformationStepPage() {
return (
document.body.id === 'authentication' ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ export class PrestashopPs1_7Service {
return document.querySelector('[data-module-name^="ps_checkout"]');
}

static isOrderPage() {
return document.body.id === 'checkout';
}

static isOrderPersonalInformationStepPage() {
if (document.body.id !== 'checkout') return false;
const step = document.querySelector('#checkout-personal-information-step');
Expand Down
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<module>
<name>ps_checkout</name>
<displayName><![CDATA[PrestaShop Checkout]]></displayName>
<version><![CDATA[2.15.1]]></version>
<version><![CDATA[2.15.2]]></version>
<description><![CDATA[Provide the most commonly used payment methods to your customers in this all-in-one module, and manage all your sales in a centralized interface.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[payments_gateways]]></tab>
Expand Down
22 changes: 20 additions & 2 deletions ps_checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class Ps_checkout extends PaymentModule

// Needed in order to retrieve the module version easier (in api call headers) than instanciate
// the module each time to get the version
const VERSION = '2.15.1';
const VERSION = '2.15.2';

const INTEGRATION_DATE = '2020-07-30';

Expand All @@ -153,7 +153,7 @@ public function __construct()

// We cannot use the const VERSION because the const is not computed by addons marketplace
// when the zip is uploaded
$this->version = '2.15.1';
$this->version = '2.15.2';
$this->author = 'PrestaShop';
$this->need_instance = 0;
$this->currencies = true;
Expand Down Expand Up @@ -432,6 +432,15 @@ public function hookDisplayPersonalInformationTop()
*/
public function hookDisplayExpressCheckout()
{
/** @var \PrestaShop\Module\PrestashopCheckout\Repository\PsAccountRepository $psAccountRepository */
$psAccountRepository = $this->getService('ps_checkout.repository.prestashop.account');
/** @var \PrestaShop\Module\PrestashopCheckout\Repository\PaypalAccountRepository $paypalAccountRepository */
$paypalAccountRepository = $this->getService('ps_checkout.repository.paypal.account');

if (!$psAccountRepository->onBoardingIsCompleted() || !$paypalAccountRepository->onBoardingIsCompleted()) {
return '';
}

/** @var \PrestaShop\Module\PrestashopCheckout\PayPal\PayPalPayIn4XConfiguration $payIn4XService */
$payIn4XService = $this->getService('ps_checkout.pay_in_4x.configuration');

Expand Down Expand Up @@ -481,6 +490,15 @@ public function hookDisplayExpressCheckout()
*/
public function hookDisplayProductAdditionalInfo()
{
/** @var \PrestaShop\Module\PrestashopCheckout\Repository\PsAccountRepository $psAccountRepository */
$psAccountRepository = $this->getService('ps_checkout.repository.prestashop.account');
/** @var \PrestaShop\Module\PrestashopCheckout\Repository\PaypalAccountRepository $paypalAccountRepository */
$paypalAccountRepository = $this->getService('ps_checkout.repository.paypal.account');

if (!$psAccountRepository->onBoardingIsCompleted() || !$paypalAccountRepository->onBoardingIsCompleted()) {
return '';
}

/** @var \PrestaShop\Module\PrestashopCheckout\FundingSource\FundingSourceProvider $fundingSourceProvider */
$fundingSourceProvider = $this->getService('ps_checkout.funding_source.provider');

Expand Down

0 comments on commit f94ca37

Please sign in to comment.