Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v8.4.2.1 #1267

Merged
merged 18 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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[8.4.2.0]]></version>
<version><![CDATA[8.4.2.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>
Expand Down
1 change: 1 addition & 0 deletions config/command-handlers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ services:
- '@PrestaShop\Module\PrestashopCheckout\Http\MaaslandHttpClient'
- '@PrestaShop\Module\PrestashopCheckout\Event\SymfonyEventDispatcherAdapter'
- '@PrestaShop\Module\PrestashopCheckout\ShopContext'
- '@PrestaShop\Module\PrestashopCheckout\PayPal\PayPalOrderProvider'

PrestaShop\Module\PrestashopCheckout\PayPal\Order\CommandHandler\CapturePayPalOrderCommandHandler:
class: 'PrestaShop\Module\PrestashopCheckout\PayPal\Order\CommandHandler\CapturePayPalOrderCommandHandler'
Expand Down
4 changes: 3 additions & 1 deletion controllers/front/cancel.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ public function postProcess()
$isExpressCheckout = isset($bodyValues['isExpressCheckout']) && $bodyValues['isExpressCheckout'];
$isHostedFields = isset($bodyValues['isHostedFields']) && $bodyValues['isHostedFields'];
$reason = isset($bodyValues['reason']) ? Tools::safeOutput($bodyValues['reason']) : null;
$error = isset($bodyValues['error']) ? Tools::safeOutput($bodyValues['error']) : null;
$error = isset($bodyValues['error'])
? Tools::safeOutput(is_string($bodyValues['error']) ? $bodyValues['error'] : json_encode($bodyValues['error']))
: null;

if ($orderId) {
/** @var CommandBusInterface $commandBus */
Expand Down
22 changes: 22 additions & 0 deletions controllers/front/create.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,28 @@ public function postProcess()
$isCardFields = isset($bodyValues['isCardFields']) && $bodyValues['isCardFields'];
$isExpressCheckout = (isset($bodyValues['isExpressCheckout']) && $bodyValues['isExpressCheckout']) || empty($this->context->cart->id_address_delivery);

if ($isExpressCheckout) {
$psCheckoutCartCollection = new PrestaShopCollection(PsCheckoutCart::class);
$psCheckoutCartCollection->where('id_cart', '=', (int) $cartId);
$psCheckoutCartCollection->where('isExpressCheckout', '=', '1');
$psCheckoutCartCollection->where('paypal_status', 'IN', [PsCheckoutCart::STATUS_CREATED, PsCheckoutCart::STATUS_APPROVED, PsCheckoutCart::STATUS_PAYER_ACTION_REQUIRED]);
$psCheckoutCartCollection->where('date_upd', '>', date('Y-m-d H:i:s', strtotime('-1 hour')));
$psCheckoutCartCollection->orderBy('date_upd', 'desc');
/** @var PsCheckoutCart|false $psCheckoutCart */
$psCheckoutCart = $psCheckoutCartCollection->getFirst();
if ($psCheckoutCart) {
$this->exitWithResponse([
'status' => true,
'httpCode' => 200,
'body' => [
'orderID' => $psCheckoutCart->paypal_order,
],
'exceptionCode' => null,
'exceptionMessage' => null,
]);
}
}

/** @var CommandBusInterface $commandBus */
$commandBus = $this->module->getService('ps_checkout.bus.command');
$commandBus->handle(new CreatePayPalOrderCommand($cartId, $fundingSource, $isCardFields, $isExpressCheckout, $vaultId, $favorite, $vault));
Expand Down
10 changes: 5 additions & 5 deletions ps_checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Ps_checkout extends PaymentModule
'actionObjectOrderPaymentUpdateAfter',
'displayPaymentReturn',
'displayOrderDetail',
'moduleRoutes'
'moduleRoutes',
];

/**
Expand Down Expand Up @@ -116,7 +116,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 = '8.4.2.0';
const VERSION = '8.4.2.1';

const INTEGRATION_DATE = '2024-04-01';

Expand All @@ -137,7 +137,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 = '8.4.2.0';
$this->version = '8.4.2.1';
$this->author = 'PrestaShop';
$this->currencies = true;
$this->currencies_mode = 'checkbox';
Expand Down Expand Up @@ -1803,9 +1803,9 @@ public function hookModuleRoutes()
'params' => [
'fc' => 'module',
'module' => 'ps_checkout',
'action' => 'getDomainAssociation'
'action' => 'getDomainAssociation',
],
]
],
];
}
}
2 changes: 1 addition & 1 deletion src/FundingSource/FundingSourceInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function createFundingSources($shopId = null)
$fundingSourceConfigurationRepository->save([
'name' => $fundingSourceEntity->getName(),
'position' => $fundingSourceEntity->getPosition(),
'isEnabled' => $fundingSourceEntity->getName() !== 'apple_pay' && $fundingSourceEntity->getIsEnabled() ? 1 : 0,
'isEnabled' => !in_array($fundingSourceEntity->getName(), ['google_pay', 'apple_pay']) ? 1 : 0,
], $shopId);
}

Expand Down
6 changes: 0 additions & 6 deletions src/Http/MaaslandHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ public function refundOrder(array $payload, array $options = [])
* @throws RequestException
* @throws TransferException
* @throws PayPalException
* @throws HttpTimeoutException
*/
public function sendRequest(RequestInterface $request)
{
Expand All @@ -152,11 +151,6 @@ public function sendRequest(RequestInterface $request)
} catch (HttpException $exception) {
$response = $exception->getResponse();
$body = json_decode($response->getBody(), true);

if (isset($body['isResponseUndefined']) && $body['isResponseUndefined']) {
throw new HttpTimeoutException($exception->getMessage(), $exception->getCode(), $exception);
}

$message = $this->extractMessage($body);

if ($message) {
Expand Down
17 changes: 0 additions & 17 deletions src/Order/Query/GetOrderForApprovalReversedQueryResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

use PrestaShop\Module\PrestashopCheckout\Order\Exception\OrderException;
use PrestaShop\Module\PrestashopCheckout\Order\State\Exception\OrderStateException;
use PrestaShop\Module\PrestashopCheckout\Order\State\ValueObject\OrderStateId;
use PrestaShop\Module\PrestashopCheckout\Order\ValueObject\OrderId;

class GetOrderForApprovalReversedQueryResult
Expand All @@ -32,11 +31,6 @@ class GetOrderForApprovalReversedQueryResult
*/
private $orderId;

/**
* @var OrderStateId
*/
private $currentStateId;

/**
* @var bool
*/
Expand All @@ -49,7 +43,6 @@ class GetOrderForApprovalReversedQueryResult

/**
* @param int $orderId
* @param int $currentStateId
* @param bool $hasBeenPaid
* @param bool $hasBeenCanceled
*
Expand All @@ -58,12 +51,10 @@ class GetOrderForApprovalReversedQueryResult
*/
public function __construct(
$orderId,
$currentStateId,
$hasBeenPaid,
$hasBeenCanceled
) {
$this->orderId = new OrderId($orderId);
$this->currentStateId = new OrderStateId($currentStateId);
$this->hasBeenPaid = $hasBeenPaid;
$this->hasBeenCanceled = $hasBeenCanceled;
}
Expand All @@ -76,14 +67,6 @@ public function getOrderId()
return $this->orderId;
}

/**
* @return OrderStateId
*/
public function getCurrentStateId()
{
return $this->currentStateId;
}

/**
* @return bool
*/
Expand Down
35 changes: 0 additions & 35 deletions src/Order/Query/GetOrderForPaymentCompletedQueryResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
use PrestaShop\Module\PrestashopCheckout\Cart\Exception\CartException;
use PrestaShop\Module\PrestashopCheckout\Cart\ValueObject\CartId;
use PrestaShop\Module\PrestashopCheckout\Order\Exception\OrderException;
use PrestaShop\Module\PrestashopCheckout\Order\State\Exception\OrderStateException;
use PrestaShop\Module\PrestashopCheckout\Order\State\ValueObject\OrderStateId;
use PrestaShop\Module\PrestashopCheckout\Order\ValueObject\OrderId;

class GetOrderForPaymentCompletedQueryResult
Expand All @@ -39,11 +37,6 @@ class GetOrderForPaymentCompletedQueryResult
*/
private $cartId;

/**
* @var OrderStateId
*/
private $currentStateId;

/**
* @var bool
*/
Expand All @@ -54,11 +47,6 @@ class GetOrderForPaymentCompletedQueryResult
*/
private $totalAmount;

/**
* @var string
*/
private $totalAmountPaid;

/**
* @var int
*/
Expand All @@ -77,35 +65,28 @@ class GetOrderForPaymentCompletedQueryResult
/**
* @param int $orderId
* @param int $cartId
* @param int $currentStateId
* @param bool $hasBeenPaid
* @param string $totalAmount
* @param string $totalAmountPaid
* @param int $currencyId
* @param string $paymentMethod
* @param int|null $orderPaymentId
*
* @throws OrderException
* @throws CartException
* @throws OrderStateException
*/
public function __construct(
$orderId,
$cartId,
$currentStateId,
$hasBeenPaid,
$totalAmount,
$totalAmountPaid,
$currencyId,
$paymentMethod,
$orderPaymentId = null
) {
$this->orderId = new OrderId($orderId);
$this->cartId = new CartId($cartId);
$this->currentStateId = new OrderStateId($currentStateId);
$this->hasBeenPaid = $hasBeenPaid;
$this->totalAmount = $totalAmount;
$this->totalAmountPaid = $totalAmountPaid;
$this->currencyId = $currencyId;
$this->paymentMethod = $paymentMethod;
$this->orderPaymentId = $orderPaymentId;
Expand All @@ -127,14 +108,6 @@ public function getCartId()
return $this->cartId;
}

/**
* @return OrderStateId
*/
public function getCurrentStateId()
{
return $this->currentStateId;
}

/**
* @return bool
*/
Expand All @@ -151,14 +124,6 @@ public function getTotalAmount()
return $this->totalAmount;
}

/**
* @return string
*/
public function getTotalAmountPaid()
{
return $this->totalAmountPaid;
}

/**
* @return int
*/
Expand Down
19 changes: 0 additions & 19 deletions src/Order/Query/GetOrderForPaymentDeniedQueryResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
namespace PrestaShop\Module\PrestashopCheckout\Order\Query;

use PrestaShop\Module\PrestashopCheckout\Order\Exception\OrderException;
use PrestaShop\Module\PrestashopCheckout\Order\State\Exception\OrderStateException;
use PrestaShop\Module\PrestashopCheckout\Order\State\ValueObject\OrderStateId;
use PrestaShop\Module\PrestashopCheckout\Order\ValueObject\OrderId;

class GetOrderForPaymentDeniedQueryResult
Expand All @@ -32,31 +30,22 @@ class GetOrderForPaymentDeniedQueryResult
*/
private $orderId;

/**
* @var OrderStateId
*/
private $currentStateId;

/**
* @var bool
*/
private $hasBeenError;

/**
* @param int $orderId
* @param int $currentState
* @param bool $hasBeenError
*
* @throws OrderException
* @throws OrderStateException
*/
public function __construct(
$orderId,
$currentState,
$hasBeenError
) {
$this->orderId = new OrderId($orderId);
$this->currentStateId = new OrderStateId($currentState);
$this->hasBeenError = $hasBeenError;
}

Expand All @@ -68,14 +57,6 @@ public function getOrderId()
return $this->orderId;
}

/**
* @return OrderStateId
*/
public function getCurrentStateId()
{
return $this->currentStateId;
}

/**
* @return bool
*/
Expand Down
Loading