Skip to content

Commit c243e65

Browse files
authored
Merge pull request #352 from 202ecommerce/release/x
Release 6.4.1
2 parents 09b9a96 + c3d3555 commit c243e65

22 files changed

Lines changed: 1513 additions & 1222 deletions

202/_dev/js/bnpl.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ const BNPL = {
107107
BNPL.button.style.display = 'none';
108108
}
109109

110-
totPaypalBnplSdkButtons.Buttons({
110+
const paypalButton = totPaypalBnplSdkButtons.Buttons({
111111
fundingSource: totPaypalBnplSdkButtons.FUNDING.PAYLATER,
112112

113113
style: {
@@ -124,8 +124,23 @@ const BNPL = {
124124
BNPL.sendData(data);
125125
},
126126

127-
}).render(this.button);
127+
});
128+
129+
if (!paypalButton.isEligible()) {
130+
const paymentOption = document.querySelector('[data-module-name="paypal_bnpl"]');
131+
132+
if (paymentOption) {
133+
const paymentOptionRow = paymentOption.closest('.payment-option');
134+
135+
if (paymentOptionRow) {
136+
paymentOptionRow.style.display = 'none';
137+
}
138+
}
139+
140+
return;
141+
}
128142

143+
paypalButton.render(this.button);
129144
let event = new Event('paypal-after-init-bnpl-button');
130145
document.dispatchEvent(event);
131146
},

202/build.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<property name="src-dir" value="${basedir}" />
3232
<property name="TARGETNAME" value="paypal" />
3333
<property name="TARGETBRANCH" value="${env.GIT_BRANCH}" />
34-
<property name="TARGETVERSION" value="6.4.0" />
34+
<property name="TARGETVERSION" value="6.4.1" />
3535
<property name="PHPVERSION" value="5.6" />
3636
<property name="PSVERSION" value="1.7.5.2" />
3737

classes/API/Client/HttpClient.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ protected function getOptions(HttpRequestInterface $request)
101101
$options[CURLOPT_RETURNTRANSFER] = true;
102102
$options[CURLOPT_HEADER] = false;
103103
$options[CURLOPT_SSLVERSION] = CURL_SSLVERSION_TLSv1_2;
104+
$options[CURLOPT_CONNECTTIMEOUT] = 0;
105+
$options[CURLOPT_TIMEOUT] = 10;
104106

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

180182
$response->setContent($data);
181183
$response->setCode($code);
184+
$response->setHeaders($headers);
182185

183186
return $response;
184187
}

classes/API/HttpResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function getCode()
4747
}
4848

4949
/** @return self*/
50-
public function setCode(int $code)
50+
public function setCode($code)
5151
{
5252
$this->code = $code;
5353

classes/API/Injector/UserAgentInjector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ protected function getUserAgent()
7070
_PS_VERSION_,
7171
$this->module->version,
7272
PHP_VERSION,
73-
str_replace(' ', '_', php_uname('s') . ' ' . php_uname('r')),
74-
php_uname('m')
73+
function_exists('php_uname') ? str_replace(' ', '_', php_uname('s') . ' ' . php_uname('r')) : 'Undefined',
74+
function_exists('php_uname') ? php_uname('m') : 'Undefined'
7575
);
7676
}
7777
}

classes/APM/ApmCollection.php

Lines changed: 0 additions & 206 deletions
This file was deleted.

classes/APM/ApmFunctionality.php

Lines changed: 0 additions & 52 deletions
This file was deleted.

classes/AbstractMethodPaypal.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -234,15 +234,19 @@ public function validation()
234234
$vaultingFunctionality = $this->initVaultingFunctionality();
235235

236236
if (!Validate::isLoadedObject($customer)) {
237-
throw new Exception('Customer is not loaded object');
237+
throw new PaypalException(PaypalException::INVALID_CUSTOMER, 'Customer is not loaded object');
238238
}
239-
240-
if ($this->getPaymentId() == false) {
241-
throw new Exception('Payment ID isn\'t setted');
239+
if (empty($this->getPaymentId())) {
240+
throw new PaypalException(PaypalException::ARGUMENT_MISSING, 'Payment ID isn\'t setted');
242241
}
243-
244242
if (false === $this->isCorrectCart($cart, $this->getPaymentId())) {
245-
throw new Exception('The elements in the shopping cart were changed. Please try to pay again.');
243+
throw new PaypalException(PaypalException::CART_CHANGED, 'The elements in the shopping cart were changed. Please try to pay again.');
244+
}
245+
if ($cart->isAllProductsInStock() !== true ||
246+
(method_exists($cart, 'checkAllProductsAreStillAvailableInThisState') && $cart->checkAllProductsAreStillAvailableInThisState() !== true) ||
247+
(method_exists($cart, 'checkAllProductsHaveMinimalQuantities') && $cart->checkAllProductsHaveMinimalQuantities() !== true)
248+
) {
249+
throw new PaypalException(PaypalException::PRODUCT_UNAVAILABLE, sprintf('Cart with id %d contains products unavailable. Cannot capture the order.', (int) $cart->id));
246250
}
247251

248252
$response = $this->completePayment();

classes/Constants/PaypalConfigurations.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ class PaypalConfigurations
5757

5858
const SEPA_ENABLED = 'PAYPAL_SEPA_ENABLED';
5959

60-
const GIROPAY_ENABLED = 'PAYPAL_GIROPAY_ENABLED';
61-
6260
const SOFORT_ENABLED = 'PAYPAL_SOFORT_ENABLED';
6361

6462
const VENMO_OPTION = 'PAYPAL_VENMO_ENABLED';

0 commit comments

Comments
 (0)