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/v7.3.6.0 #1196

Merged
merged 53 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
c0129bf
PAYSHIP-2609 no capture for canceled order
Matt75 Dec 18, 2023
3265b02
Initial commit
L3RAZ Dec 22, 2023
c91383d
Working cardfields component
L3RAZ Jan 10, 2024
ba3f710
Added card vendor error
L3RAZ Jan 10, 2024
7116682
Removed forced buyer country
L3RAZ Jan 10, 2024
c71758f
Added new template for cardFields and moved field selectors to queryS…
L3RAZ Jan 11, 2024
11f430d
Fixed card fields styling
L3RAZ Jan 23, 2024
f81dc62
Added payment_source and supplementary_data to order creation
L3RAZ Jan 31, 2024
3f81bd5
Remove PayPal Client Token
Matt75 Feb 1, 2024
84e6096
Bump version to 7.3.6.0
Matt75 Feb 1, 2024
baa048a
Add new configuration for displaying the logo on the product page and…
Matt75 Feb 12, 2024
699dbb1
Removed hosted-fields component from sdk link
L3RAZ Feb 6, 2024
0d03f28
Load PayPal SDK with PayPal package
btafforeau Dec 18, 2023
e834115
Replaced paypal script creation with using paypal npm lib
L3RAZ Oct 2, 2023
878b03a
1.6 fixes and removed client token
L3RAZ Feb 8, 2024
f6d3785
Removed token fetch functions
L3RAZ Feb 8, 2024
954ac81
Removed CGV notification
L3RAZ Feb 8, 2024
a4cbd74
Removed token controller
L3RAZ Feb 8, 2024
d3543f7
Upgrade paypal-js package
Matt75 Feb 8, 2024
41107e9
Upgrade paypal-js to 8.0.2
Matt75 Feb 12, 2024
d27a39b
Move PayPalSdkConfigurationBuilder
Matt75 Feb 12, 2024
a7252a8
Fixes
Matt75 Feb 12, 2024
46ea9ec
Adding payment methods logo on checkout pages
bbool Jun 15, 2023
fa1c653
Fix fatal when data not found
Matt75 Feb 15, 2024
4d928aa
Add supported card brand logos
Matt75 Feb 12, 2024
3c67960
Fix phpstan
Matt75 Feb 16, 2024
bfff47e
Added 3DS block in order view
L3RAZ Feb 7, 2024
4dfecaf
Fixes
Matt75 Feb 19, 2024
59a8be4
Fix error cases
Matt75 Feb 19, 2024
681de3a
Fix 3D Secure badge color
Matt75 Feb 19, 2024
75a7683
Update french translations
Matt75 Feb 19, 2024
03c82f4
Fix empty error on BO order detail
Matt75 Feb 20, 2024
9ab5a56
Remove sofort
Matt75 Feb 20, 2024
df641e9
Remove Sofort on upgrade
Matt75 Feb 20, 2024
3b2ff44
Fix french translations
Matt75 Feb 20, 2024
021e53b
Fix js issue
Matt75 Feb 20, 2024
7d25824
Fix http response code for webhook Unauthorized
Matt75 Feb 21, 2024
8e59b99
Add seller protection and move liability shift
Matt75 Feb 21, 2024
29aa399
Fix issue with BO order detail
Matt75 Feb 21, 2024
bf37922
Fix phpstan feedback
Matt75 Feb 21, 2024
2948f27
Fix translations
Matt75 Feb 21, 2024
50be851
Add PrestaShop module dependencies library
Matt75 Feb 22, 2024
16f8c6d
Fix 3D Secure
Matt75 Feb 22, 2024
d286ac9
Refactor and fix Guzzle5 issues
Matt75 Feb 26, 2024
3bafeeb
Merge pull request #1204 from PrestaShopCorp/fix-guzzle5-issues
Matt75 Feb 28, 2024
14822f9
Send card supplementary data
Matt75 Feb 28, 2024
2a23c69
Restore http logger
Matt75 Feb 28, 2024
2f7a984
Add user-friendly message for popup closed
Matt75 Feb 29, 2024
68c3904
Added a fix for order cancel for card-fields and changed refund statu…
L3RAZ Feb 29, 2024
9d27546
Merge pull request #1205 from PrestaShopCorp/fix/order-refund
Matt75 Mar 1, 2024
0c20038
Added wrapper for cvv field and tooltip
L3RAZ Mar 4, 2024
81b243d
Fix hummingbird selectors & Pay Later banner display
Matt75 Mar 4, 2024
ac16006
Fix Pay Later amount
Matt75 Mar 5, 2024
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
1 change: 1 addition & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ $config
->setUsingCache(true)
->getFinder()
->in(__DIR__)
->exclude('_dev')
->exclude('vendor');

return $config;
24,144 changes: 8,848 additions & 15,296 deletions _dev/js/front/package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions _dev/js/front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"webpack-merge": "^5.3.0"
},
"dependencies": {
"@paypal/paypal-js": "^8.0.0",
"@ungap/event-target": "^0.2.2",
"classlist-polyfill": "^1.2.0",
"promise-polyfill": "8.1.3",
Expand Down
75 changes: 19 additions & 56 deletions _dev/js/front/src/api/ps-checkout.api.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import { BaseClass } from '../core/dependency-injection/base.class';

export class PsCheckoutApi extends BaseClass {
static Inject = {
config: 'PsCheckoutConfig'
config: 'PsCheckoutConfig',
$: '$'
};

postCancelOrder(data) {
Expand All @@ -42,11 +43,11 @@ export class PsCheckoutApi extends BaseClass {
return response.json().then((response) => {
throw response.body && response.body.error
? response.body.error
: { message: 'Unknown error' };
: { message: this.$('checkout.form.error.label') };
});
}

throw new Error('Invalid response');
throw new Error(this.$('checkout.form.error.label'));
}
});
}
Expand All @@ -72,14 +73,14 @@ export class PsCheckoutApi extends BaseClass {
return response.json().then((response) => {
throw response.body && response.body.error
? response.body.error
: { message: 'Unknown error' };
: { message: this.$('checkout.form.error.label') };
});
}

return response.json();
}

throw new Error('Invalid response');
throw new Error(this.$('checkout.form.error.label'));
})
.then((data) => {
if (!data) {
Expand Down Expand Up @@ -111,60 +112,22 @@ export class PsCheckoutApi extends BaseClass {
contentType && contentType.indexOf('application/json') !== -1;

if (isJsonResponse) {
if (false === response.ok) {
if (false === response.ok || response.status >= 400) {
return response.json().then((response) => {
throw response.body && response.body.error
? response.body.error
: { message: 'Unknown error' };
: { message: this.$('checkout.form.error.label') };
});
}

return response.json();
}

throw new Error('Invalid response');
throw new Error(this.$('checkout.form.error.label'));
})
.then(({ body: { orderID } }) => orderID);
}

getGetToken() {
return (
fetch(this.config.getTokenUrl, {
method: 'get',
credentials: 'same-origin',
headers: {
'Content-Type': 'application/json',
Accept: 'application/json'
}
})
.then((response) => {
const contentType = response.headers.get('content-type');
const isJsonResponse =
contentType && contentType.indexOf('application/json') !== -1;

if (isJsonResponse) {
if (false === response.ok) {
return response.json().then((response) => {
throw response.body && response.body.error
? response.body.error
: { message: 'Unknown error' };
});
}

return response.json();
}

throw new Error('Invalid response');
})
.then(({ body: { token } }) => {
window.ps_checkoutPayPalClientToken = token;
return token;
})
// TODO: Handle error
.catch(() => {})
);
}

postValidateOrder(data, actions) {
return fetch(this.config.validateOrderUrl, {
method: 'post',
Expand All @@ -181,18 +144,22 @@ export class PsCheckoutApi extends BaseClass {
contentType && contentType.indexOf('application/json') !== -1;

if (isJsonResponse) {
if (false === response.ok) {
if (false === response.ok || response.status >= 400) {
return response.json().then((response) => {
if (actions?.restart && response.body && 85 === response.body.error.code) {
return actions.restart();
}

throw response.body && response.body.error
? response.body.error
: { message: 'Unknown error' };
: { message: this.$('checkout.form.error.label') };
});
}

return response.json();
}

throw new Error('Invalid response');
throw new Error(this.$('checkout.form.error.label'));
})
.then((response) => {
if (response.body && response.body.id_order) {
Expand All @@ -218,10 +185,6 @@ export class PsCheckoutApi extends BaseClass {

window.location.href = confirmationUrl.toString();
}

if (response.error && 'INSTRUMENT_DECLINED' === response.error) {
return actions.restart();
}
});
}

Expand All @@ -247,11 +210,11 @@ export class PsCheckoutApi extends BaseClass {
contentType && contentType.indexOf('application/json') !== -1;

if (isJsonResponse) {
if (false === response.ok) {
if (false === response.ok || response.status >= 400) {
return response.json().then((response) => {
throw response.body && response.body.error
? response.body.error
: { message: 'Unknown error' };
: { message: this.$('checkout.form.error.label') };
});
}

Expand All @@ -260,7 +223,7 @@ export class PsCheckoutApi extends BaseClass {
).toString();
}

throw new Error('Invalid response');
throw new Error(this.$('checkout.form.error.label'));
})
);
}
Expand Down
18 changes: 6 additions & 12 deletions _dev/js/front/src/components/1_6/express-button-cart.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export class ExpressButtonCartComponent extends BaseComponent {
};

created() {
this.buttonReferenceContainer = this.querySelectorService.getExpressCheckoutButtonContainerCart();
this.buttonReferenceContainer =
this.querySelectorService.getExpressCheckoutButtonContainerCart();
}

renderComponent() {
Expand All @@ -50,14 +51,7 @@ export class ExpressButtonCartComponent extends BaseComponent {
this.app,
{
fundingSource: 'paypal',
// TODO: Move this to constant when ExpressCheckoutButton component is created
querySelector: '#ps_checkout-express-button-cart',
createOrder: (data) =>
this.psCheckoutApi.postCreateOrder({
...data,
fundingSource: 'paypal',
isExpressCheckout: true
})
querySelector: '#ps_checkout-express-button-cart'
}
).render();
}
Expand All @@ -67,9 +61,9 @@ export class ExpressButtonCartComponent extends BaseComponent {

this.renderComponent();
this.prestashopService.onUpdatedShoppingCartExtra(() => {
if (null === document.querySelector('#ps_checkout-express-button-cart')) {
this.renderComponent();
}
if (null === document.querySelector('#ps_checkout-express-button-cart')) {
this.renderComponent();
}
});

return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export class ExpressButtonCheckoutComponent extends BaseComponent {
};

created() {
this.buttonReferenceContainer = this.querySelectorService.getExpressCheckoutButtonContainerCheckout();
this.buttonReferenceContainer =
this.querySelectorService.getExpressCheckoutButtonContainerCheckout();
}

renderTitle() {
Expand All @@ -53,13 +54,7 @@ export class ExpressButtonCheckoutComponent extends BaseComponent {
this.app,
{
fundingSource: 'paypal',
querySelector: '#ps_checkout-express-button-checkout',
createOrder: (data) =>
this.psCheckoutApi.postCreateOrder({
...data,
fundingSource: 'paypal',
isExpressCheckout: true
})
querySelector: '#ps_checkout-express-button-checkout'
}
).render();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ export class ExpressButtonProductComponent extends BaseComponent {
};

created() {
this.buttonReferenceContainer = this.querySelectorService.getExpressCheckoutButtonContainerProduct();
this.buttonReferenceContainer =
this.querySelectorService.getExpressCheckoutButtonContainerProduct();
}

render() {
Expand All @@ -42,28 +43,23 @@ export class ExpressButtonProductComponent extends BaseComponent {

buttonContainer.append(this.checkoutExpressButton);

const {
id_product,
id_product_attribute,
id_customization,
quantity_wanted
} = this.prestashopService.getProductDetails();

this.children.expressCheckoutButton = new ExpressCheckoutButtonComponent(
this.app,
{
fundingSource: 'paypal',
// TODO: Move this to constant when ExpressCheckoutButton component is created
querySelector: '#ps-checkout-express-button',
createOrder: () => {
const {
id_product,
id_product_attribute,
id_customization,
quantity_wanted
} = this.prestashopService.getProductDetails();

return this.psCheckoutApi.postCreateOrder({
id_product,
id_product_attribute,
id_customization,
quantity_wanted,
fundingSource: 'paypal',
isExpressCheckout: true
});
data: {
id_product,
id_product_attribute,
id_customization,
quantity_wanted
}
}
).render();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@ export class PayLaterButtonCartComponent extends BaseComponent {
querySelectorService: 'QuerySelectorService',
prestashopService: 'PrestashopService',
psCheckoutApi: 'PsCheckoutApi',
payPalService: 'PayPalService',
$: '$'
};

created() {
this.buttonReferenceContainer = this.querySelectorService.getExpressCheckoutButtonContainerCart();
this.buttonReferenceContainer =
this.querySelectorService.getExpressCheckoutButtonContainerCart();
this.data.orderId = this.payPalService.getOrderId();
}

renderComponent() {
Expand All @@ -52,14 +55,7 @@ export class PayLaterButtonCartComponent extends BaseComponent {
this.app,
{
fundingSource: 'paylater',
// TODO: Move this to constant when ExpressCheckoutButton component is created
querySelector: '#ps_checkout-express-button-cart',
createOrder: (data) =>
this.psCheckoutApi.postCreateOrder({
...data,
fundingSource: 'paylater',
isExpressCheckout: true
})
querySelector: '#ps_checkout-express-button-cart'
}
).render();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@ export class PayLaterButtonCheckoutComponent extends BaseComponent {
querySelectorService: 'QuerySelectorService',
prestashopService: 'PrestashopService',
psCheckoutApi: 'PsCheckoutApi',
payPalService: 'PayPalService',
$: '$'
};

created() {
this.buttonReferenceContainer = this.querySelectorService.getExpressCheckoutButtonContainerCheckout();
this.buttonReferenceContainer =
this.querySelectorService.getExpressCheckoutButtonContainerCheckout();
this.data.orderId = this.payPalService.getOrderId();
}

renderTitle() {
Expand All @@ -55,19 +58,13 @@ export class PayLaterButtonCheckoutComponent extends BaseComponent {
this.app,
{
fundingSource: 'paylater',
querySelector: '#ps_checkout-express-button-checkout',
createOrder: (data) =>
this.psCheckoutApi.postCreateOrder({
...data,
fundingSource: 'paylater',
isExpressCheckout: true
})
querySelector: '#ps_checkout-express-button-checkout'
}
).render();

if (
this.prestashopService.isNativeOnePageCheckoutPage()
&& !document.getElementById('ps_checkout-express-button-checkout')
this.prestashopService.isNativeOnePageCheckoutPage() &&
!document.getElementById('ps_checkout-express-button-checkout')
) {
const separatorText = document.createElement('div');
separatorText.classList.add('ps_checkout-express-separator');
Expand Down
Loading
Loading