Skip to content

Commit

Permalink
Merge pull request #1215 from PrestaShopCorp/release/v7.3.6.1
Browse files Browse the repository at this point in the history
Release v7.3.6.1
  • Loading branch information
Matt75 committed Mar 12, 2024
2 parents 8cad7cf + 5d37124 commit 634382d
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 27 deletions.
8 changes: 7 additions & 1 deletion _dev/js/front/src/api/ps-checkout.api.js
Expand Up @@ -146,7 +146,11 @@ export class PsCheckoutApi extends BaseClass {
if (isJsonResponse) {
if (false === response.ok || response.status >= 400) {
return response.json().then((response) => {
if (actions?.restart && response.body && 85 === response.body.error.code) {
if (
actions?.restart &&
response.body &&
85 === response.body.error.code
) {
return actions.restart();
}

Expand Down Expand Up @@ -221,6 +225,8 @@ export class PsCheckoutApi extends BaseClass {
window.location.href = new URL(
this.config.checkoutCheckoutUrl
).toString();

return;
}

throw new Error(this.$('checkout.form.error.label'));
Expand Down
4 changes: 2 additions & 2 deletions config.xml
Expand Up @@ -2,12 +2,12 @@
<module>
<name>ps_checkout</name>
<displayName><![CDATA[PrestaShop Checkout]]></displayName>
<version><![CDATA[7.3.6.0]]></version>
<version><![CDATA[7.3.6.1]]></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>
<confirmUninstall><![CDATA[Are you sure you want to uninstall this module?]]></confirmUninstall>
<is_configurable>1</is_configurable>
<need_instance>1</need_instance>
<limited_countries></limited_countries>
</module>
</module>
30 changes: 13 additions & 17 deletions controllers/front/cancel.php
Expand Up @@ -72,31 +72,27 @@ public function postProcess()
$reason = isset($bodyValues['reason']) ? Tools::safeOutput($bodyValues['reason']) : null;
$error = isset($bodyValues['error']) ? Tools::safeOutput($bodyValues['error']) : null;

if (empty($orderId)) {
$this->exitWithResponse([
'httpCode' => 400,
'body' => 'Missing PayPal Order Id',
]);
}

/** @var CommandBusInterface $commandBus */
$commandBus = $this->module->getService('ps_checkout.bus.command');
if ($orderId) {
/** @var CommandBusInterface $commandBus */
$commandBus = $this->module->getService('ps_checkout.bus.command');

$commandBus->handle(new CancelCheckoutCommand(
$this->context->cart->id,
$orderId,
PsCheckoutCart::STATUS_CANCELED,
$fundingSource,
$isExpressCheckout,
$isHostedFields
));
$commandBus->handle(new CancelCheckoutCommand(
$this->context->cart->id,
$orderId,
PsCheckoutCart::STATUS_CANCELED,
$fundingSource,
$isExpressCheckout,
$isHostedFields
));
}

$this->module->getLogger()->log(
$error ? 400 : 200,
'Customer canceled payment',
[
'PayPalOrderId' => $orderId,
'FundingSource' => $fundingSource,
'id_cart' => $this->context->cart->id,
'isExpressCheckout' => $isExpressCheckout,
'isHostedFields' => $isHostedFields,
'reason' => $reason,
Expand Down
30 changes: 23 additions & 7 deletions ps_checkout.php
Expand Up @@ -112,7 +112,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 = '7.3.6.0';
const VERSION = '7.3.6.1';

const INTEGRATION_DATE = '2022-14-06';

Expand All @@ -133,7 +133,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 = '7.3.6.0';
$this->version = '7.3.6.1';
$this->author = 'PrestaShop';
$this->currencies = true;
$this->currencies_mode = 'checkbox';
Expand Down Expand Up @@ -376,9 +376,6 @@ public function uninstallTabs()
public function getContent()
{
try {
$mboInstaller = new \Prestashop\ModuleLibMboInstaller\DependencyBuilder($this);
$requiredDependencies = $mboInstaller->handleDependencies();
$hasRequiredDependencies = $mboInstaller->areDependenciesMet();
/** @var \PrestaShop\PsAccountsInstaller\Installer\Facade\PsAccounts $psAccountsFacade */
$psAccountsFacade = $this->getService('ps_accounts.facade');
/** @var \PrestaShop\PsAccountsInstaller\Installer\Presenter\InstallerPresenter $psAccountsPresenter */
Expand All @@ -387,8 +384,6 @@ public function getContent()
$contextPsAccounts = $psAccountsPresenter->present($this->name);
} catch (Exception $exception) {
$contextPsAccounts = [];
$requiredDependencies = [];
$hasRequiredDependencies = false;
$this->getLogger()->error(
'Failed to get PsAccounts context',
[
Expand Down Expand Up @@ -422,6 +417,27 @@ public function getContent()
}

$this->context->controller->addJS($boSdkUrl, false);
$isShopContext = !(Shop::isFeatureActive() && Shop::getContext() !== Shop::CONTEXT_SHOP);
$requiredDependencies = [];
$hasRequiredDependencies = true;

if ($isShopContext) {
try {
$mboInstaller = new \Prestashop\ModuleLibMboInstaller\DependencyBuilder($this);
$requiredDependencies = $mboInstaller->handleDependencies();
$hasRequiredDependencies = $mboInstaller->areDependenciesMet();
} catch (Exception $exception) {
$this->getLogger()->error(
'Failed to get required dependencies',
[
'exception' => get_class($exception),
'exceptionCode' => $exception->getCode(),
'exceptionMessage' => $exception->getMessage(),
]
);
}
}

$this->context->smarty->assign([
'requiredDependencies' => $requiredDependencies,
'hasRequiredDependencies' => $hasRequiredDependencies,
Expand Down

0 comments on commit 634382d

Please sign in to comment.