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/v6.3.6.0 #1195

Merged
merged 60 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
feba306
Added card-fields component
L3RAZ Jan 23, 2024
c06d93b
Changed input padding
L3RAZ Jan 23, 2024
83afbf6
changed isCardFields API call property back to isHostedFields
L3RAZ Feb 1, 2024
f44859f
PAYSHIP-2609 no capture for canceled order
Matt75 Dec 18, 2023
6625568
Initial commit
L3RAZ Dec 22, 2023
f594814
Working cardfields component
L3RAZ Jan 10, 2024
08f6615
Added card vendor error
L3RAZ Jan 10, 2024
656efe5
Removed forced buyer country
L3RAZ Jan 10, 2024
ddff166
Added new template for cardFields and moved field selectors to queryS…
L3RAZ Jan 11, 2024
14035f5
Fixed card fields styling
L3RAZ Jan 23, 2024
1e96865
Merge branch 'release/v6.3.6.0' into feat/PAYSHIP-2612-1.6
L3RAZ Feb 1, 2024
07cd957
Added payment_source and supplementary_data to order creation
L3RAZ Jan 31, 2024
6d09444
Remove PayPal Client Token
Matt75 Feb 1, 2024
05096c3
Bump version to 6.3.6.0
Matt75 Feb 1, 2024
060938e
Add new configuration for displaying the logo on the product page and…
Matt75 Feb 12, 2024
f62868e
Removed hosted-fields component from sdk link
L3RAZ Feb 6, 2024
59653cc
Load PayPal SDK with PayPal package
btafforeau Dec 18, 2023
a877af8
Replaced paypal script creation with using paypal npm lib
L3RAZ Oct 2, 2023
96b4e22
1.6 fixes and removed client token
L3RAZ Feb 8, 2024
eb43a1d
Removed token fetch functions
L3RAZ Feb 8, 2024
ef04bba
Removed CGV notification
L3RAZ Feb 8, 2024
fd009d4
Removed token controller
L3RAZ Feb 8, 2024
fcfe422
Upgrade paypal-js package
Matt75 Feb 8, 2024
47df1fb
Upgrade paypal-js to 8.0.2
Matt75 Feb 12, 2024
9357632
Move PayPalSdkConfigurationBuilder
Matt75 Feb 12, 2024
d377cc4
Fixes
Matt75 Feb 12, 2024
44b0b12
Adding payment methods logo on checkout pages
bbool Jun 15, 2023
47518cc
Fix fatal when data not found
Matt75 Feb 15, 2024
ff6b352
Add supported card brand logos
Matt75 Feb 12, 2024
238400b
Fix phpstan
Matt75 Feb 16, 2024
b18a872
Merge branch 'release/v6.3.6.0' into feat/PAYSHIP-2612-1.6
Matt75 Feb 19, 2024
72ca5c4
Merge pull request #1185 from PrestaShopCorp/feat/PAYSHIP-2612-1.6
Matt75 Feb 19, 2024
a68ed5d
Fixes
L3RAZ Feb 8, 2024
670a790
Added 3DS block in order view
L3RAZ Feb 7, 2024
1326647
Fixes
Matt75 Feb 19, 2024
7a027c7
Fix error cases
Matt75 Feb 19, 2024
26558e1
Fix 3D Secure badge color
Matt75 Feb 19, 2024
0620c33
Update french translations
Matt75 Feb 19, 2024
2f09ad9
Clear template cache on module upgrade
Matt75 Feb 20, 2024
0f1928b
Hide card form if not found
Matt75 Feb 20, 2024
f7e644e
Fix empty error on BO order detail
Matt75 Feb 20, 2024
bb0f315
Remove sofort
Matt75 Feb 20, 2024
5634f37
Remove Sofort on upgrade
Matt75 Feb 20, 2024
84d5577
Fix french translations
Matt75 Feb 20, 2024
359d6ef
Fix js issue
Matt75 Feb 20, 2024
4b61ec4
Fix http response code for webhook Unauthorized
Matt75 Feb 21, 2024
cba27d2
Add seller protection and move liability shift
Matt75 Feb 21, 2024
5e9c6e9
Fix issue with BO order detail
Matt75 Feb 21, 2024
69c5df2
Fix phpstan feedback
Matt75 Feb 21, 2024
5cdec56
Fix translations
Matt75 Feb 21, 2024
f41b1b9
Add module dependencies file
Matt75 Feb 22, 2024
0dda24b
Fix 3D Secure
Matt75 Feb 22, 2024
b54c149
Missing fundingSource for card-fields
Matt75 Feb 22, 2024
706115c
Refactor and fix Guzzle5 issues
Matt75 Feb 26, 2024
fd96d88
Send card supplementary data
Matt75 Feb 28, 2024
737e8af
Restore http logger
Matt75 Feb 28, 2024
6b7043b
Add user-friendly message for popup closed
Matt75 Feb 29, 2024
a8d111d
Added a fix for order cancel for card-fields and changed refund statu…
L3RAZ Feb 29, 2024
9a0de19
Added wrapper for cvv field and tooltip
L3RAZ Mar 4, 2024
7e41c66
Fix PayPal Pay Later banner display
Matt75 Mar 4, 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