Skip to content

Commit

Permalink
Merge pull request #352 from 202ecommerce/release/x
Browse files Browse the repository at this point in the history
Release 6.4.1
  • Loading branch information
bogdan202 authored Jul 23, 2024
2 parents 09b9a96 + c3d3555 commit c243e65
Show file tree
Hide file tree
Showing 22 changed files with 1,513 additions and 1,222 deletions.
19 changes: 17 additions & 2 deletions 202/_dev/js/bnpl.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const BNPL = {
BNPL.button.style.display = 'none';
}

totPaypalBnplSdkButtons.Buttons({
const paypalButton = totPaypalBnplSdkButtons.Buttons({
fundingSource: totPaypalBnplSdkButtons.FUNDING.PAYLATER,

style: {
Expand All @@ -124,8 +124,23 @@ const BNPL = {
BNPL.sendData(data);
},

}).render(this.button);
});

if (!paypalButton.isEligible()) {
const paymentOption = document.querySelector('[data-module-name="paypal_bnpl"]');

if (paymentOption) {
const paymentOptionRow = paymentOption.closest('.payment-option');

if (paymentOptionRow) {
paymentOptionRow.style.display = 'none';
}
}

return;
}

paypalButton.render(this.button);
let event = new Event('paypal-after-init-bnpl-button');
document.dispatchEvent(event);
},
Expand Down
2 changes: 1 addition & 1 deletion 202/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<property name="src-dir" value="${basedir}" />
<property name="TARGETNAME" value="paypal" />
<property name="TARGETBRANCH" value="${env.GIT_BRANCH}" />
<property name="TARGETVERSION" value="6.4.0" />
<property name="TARGETVERSION" value="6.4.1" />
<property name="PHPVERSION" value="5.6" />
<property name="PSVERSION" value="1.7.5.2" />

Expand Down
3 changes: 3 additions & 0 deletions classes/API/Client/HttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ protected function getOptions(HttpRequestInterface $request)
$options[CURLOPT_RETURNTRANSFER] = true;
$options[CURLOPT_HEADER] = false;
$options[CURLOPT_SSLVERSION] = CURL_SSLVERSION_TLSv1_2;
$options[CURLOPT_CONNECTTIMEOUT] = 0;
$options[CURLOPT_TIMEOUT] = 10;

if (false === empty($request->getBody())) {
$options[CURLOPT_POSTFIELDS] = $request->getBody();
Expand Down Expand Up @@ -179,6 +181,7 @@ protected function makeCall($ch)

$response->setContent($data);
$response->setCode($code);
$response->setHeaders($headers);

return $response;
}
Expand Down
2 changes: 1 addition & 1 deletion classes/API/HttpResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function getCode()
}

/** @return self*/
public function setCode(int $code)
public function setCode($code)
{
$this->code = $code;

Expand Down
4 changes: 2 additions & 2 deletions classes/API/Injector/UserAgentInjector.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ protected function getUserAgent()
_PS_VERSION_,
$this->module->version,
PHP_VERSION,
str_replace(' ', '_', php_uname('s') . ' ' . php_uname('r')),
php_uname('m')
function_exists('php_uname') ? str_replace(' ', '_', php_uname('s') . ' ' . php_uname('r')) : 'Undefined',
function_exists('php_uname') ? php_uname('m') : 'Undefined'
);
}
}
206 changes: 0 additions & 206 deletions classes/APM/ApmCollection.php

This file was deleted.

52 changes: 0 additions & 52 deletions classes/APM/ApmFunctionality.php

This file was deleted.

16 changes: 10 additions & 6 deletions classes/AbstractMethodPaypal.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,19 @@ public function validation()
$vaultingFunctionality = $this->initVaultingFunctionality();

if (!Validate::isLoadedObject($customer)) {
throw new Exception('Customer is not loaded object');
throw new PaypalException(PaypalException::INVALID_CUSTOMER, 'Customer is not loaded object');
}

if ($this->getPaymentId() == false) {
throw new Exception('Payment ID isn\'t setted');
if (empty($this->getPaymentId())) {
throw new PaypalException(PaypalException::ARGUMENT_MISSING, 'Payment ID isn\'t setted');
}

if (false === $this->isCorrectCart($cart, $this->getPaymentId())) {
throw new Exception('The elements in the shopping cart were changed. Please try to pay again.');
throw new PaypalException(PaypalException::CART_CHANGED, 'The elements in the shopping cart were changed. Please try to pay again.');
}
if ($cart->isAllProductsInStock() !== true ||
(method_exists($cart, 'checkAllProductsAreStillAvailableInThisState') && $cart->checkAllProductsAreStillAvailableInThisState() !== true) ||
(method_exists($cart, 'checkAllProductsHaveMinimalQuantities') && $cart->checkAllProductsHaveMinimalQuantities() !== true)
) {
throw new PaypalException(PaypalException::PRODUCT_UNAVAILABLE, sprintf('Cart with id %d contains products unavailable. Cannot capture the order.', (int) $cart->id));
}

$response = $this->completePayment();
Expand Down
2 changes: 0 additions & 2 deletions classes/Constants/PaypalConfigurations.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ class PaypalConfigurations

const SEPA_ENABLED = 'PAYPAL_SEPA_ENABLED';

const GIROPAY_ENABLED = 'PAYPAL_GIROPAY_ENABLED';

const SOFORT_ENABLED = 'PAYPAL_SOFORT_ENABLED';

const VENMO_OPTION = 'PAYPAL_VENMO_ENABLED';
Expand Down
Loading

0 comments on commit c243e65

Please sign in to comment.