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

Pspaypal take over changes oxid7 #378

Merged
merged 14 commits into from
Jan 9, 2025
83 changes: 37 additions & 46 deletions metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,6 @@
'onDeactivate' => '\OxidSolutionCatalysts\PayPal\Core\Events\Events::onDeactivate'
],
'blocks' => [
[
'template' => 'page/checkout/order.tpl',
'block' => 'shippingAndPayment',
'file' => 'views/blocks/page/checkout/shipping_and_payment.tpl'
],
[
'template' => 'page/checkout/order.tpl',
'block' => 'checkout_order_btn_submit_bottom',
'file' => '/views/blocks/page/checkout/checkout_order_btn_submit_bottom.tpl'
],
[
'template' => 'headitem.tpl',
'block' => 'admin_headitem_inccss',
Expand Down Expand Up @@ -191,59 +181,66 @@
'block' => 'base_style',
'file' => 'views/blocks/layout/base_style.tpl'
],
[
'template' => 'page/account/inc/account_menu.tpl',
'block' => 'account_menu',
'file' => '/views/blocks/page/account/inc/account_menu.tpl',
],
[
'template' => 'page/checkout/basket.tpl',
'block' => 'basket_btn_next_bottom',
'file' => '/views/blocks/page/checkout/basket_btn_next_bottom.tpl',
],
[
'template' => 'widget/minibasket/minibasket.tpl',
'block' => 'dd_layout_page_header_icon_menu_minibasket_functions',
'file' => '/views/blocks/widget/minibasket/dd_layout_page_header_icon_menu_minibasket_functions.tpl',
'template' => 'page/checkout/basket.tpl',
'block' => 'checkout_basket_next_step_top',
'file' => '/views/blocks/page/checkout/basket_installment_banner_after.tpl'
],
[
'template' => 'payment_main.tpl',
'block' => 'admin_payment_main_form',
'file' => '/views/blocks/admin/admin_payment_main_form.tpl',
'template' => 'page/checkout/basket.tpl',
'block' => 'checkout_basket_emptyshippingcart',
'file' => '/views/blocks/page/checkout/basket_installment_banner_before.tpl'
],
// @Todo PAYPAL-486: Using the same file, with 2 themes. Should be more generic, if possible.
[
'template' => 'page/checkout/payment.tpl',
'block' => 'select_payment',
'file' => '/views/blocks/page/checkout/select_payment.tpl',
'template' => 'page/checkout/order.tpl',
'block' => 'checkout_order_btn_submit_bottom',
'file' => 'views/blocks/page/checkout/checkout_order_btn_submit_bottom.tpl'
],
[
'template' => 'page/checkout/order.tpl',
'block' => 'shippingAndPayment',
'file' => 'views/blocks/page/checkout/shipping_and_payment.tpl'
],
[
'template' => 'page/checkout/payment.tpl',
'block' => 'change_payment',
'file' => '/views/blocks/page/checkout/change_payment.tpl',
],
[
'template' => 'page/details/inc/productmain.tpl',
'block' => 'details_productmain_tobasket',
'file' => '/views/blocks/page/details/inc/details_productmain_tobasket.tpl',
],

// PSPAYPAL-491 Installment banners -->
[
'template' => 'page/checkout/basket.tpl',
'block' => 'checkout_basket_next_step_top',
'file' => '/views/blocks/page/checkout/basket_installment_banner_after.tpl'
],
[
'template' => 'page/checkout/basket.tpl',
'block' => 'checkout_basket_emptyshippingcart',
'template' => 'page/checkout/payment.tpl',
'block' => 'checkout_payment_main',
'file' => '/views/blocks/page/checkout/basket_installment_banner_before.tpl'
],
[
'template' => 'page/checkout/payment.tpl',
'block' => 'checkout_payment_main',
'file' => '/views/blocks/page/checkout/basket_installment_banner_before.tpl'
'block' => 'select_payment',
'file' => '/views/blocks/page/checkout/select_payment.tpl',
],
[
'template' => 'page/checkout/thankyou.tpl',
'block' => 'checkout_thankyou_info',
'file' => '/views/blocks/page/checkout/thankyou.tpl',
],
[
'template' => 'page/details/inc/productmain.tpl',
'block' => 'details_productmain_price_value',
'file' => '/views/blocks/page/details/inc/productmain.tpl'
],
[
'template' => 'page/details/inc/productmain.tpl',
'block' => 'details_productmain_tobasket',
'file' => '/views/blocks/page/details/inc/details_productmain_tobasket.tpl',
],
[
'template' => 'page/list/list.tpl',
'block' => 'page_list_listhead',
Expand All @@ -260,16 +257,10 @@
'file' => '/views/blocks/page/shop/start.tpl',
],
[
'template' => 'page/account/inc/account_menu.tpl',
'block' => 'account_menu',
'file' => '/views/blocks/page/account/inc/account_menu.tpl',
],
[
'template' => 'page/checkout/thankyou.tpl',
'block' => 'checkout_thankyou_info',
'file' => '/views/blocks/page/checkout/thankyou.tpl',
'template' => 'widget/minibasket/minibasket.tpl',
'block' => 'dd_layout_page_header_icon_menu_minibasket_functions',
'file' => '/views/blocks/widget/minibasket/dd_layout_page_header_icon_menu_minibasket_functions.tpl',
],
// <-- PSPAYPAL-491
],
'settings' => [
[
Expand Down Expand Up @@ -567,7 +558,7 @@
[
'name' => 'oscPayPalDefaultShippingPriceExpress',
'type' => 'str',
'value' => 3.5,
'value' => '3.5',
'group' => null
],
[
Expand Down
7 changes: 7 additions & 0 deletions out/img/loading.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions out/src/css/paypal.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,10 @@
max-width: 250px; }
.paypal-button-wrapper.small {
max-width: 200px; }

.paypal-button-right {
margin-left: auto;
text-align: right; }

#paypal-installment-banner-container {
margin-bottom: 1rem; }
2 changes: 1 addition & 1 deletion out/src/css/paypal.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions out/src/css/paypal_installment.css

This file was deleted.

1 change: 0 additions & 1 deletion out/src/css/paypal_installment.min.css

This file was deleted.

1 change: 1 addition & 0 deletions out/src/js/paypal-frontend.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

64 changes: 64 additions & 0 deletions resources/build/js/paypal-frontend-googlepay-3ds.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// After receiving PAYER_ACTION_REQUIRED from PayPal

window.OxidPayPalGooglePay3DS = {
handle: async (paypalOrderResponse) => {
// Create new payment data request with 3DS parameters
const paymentDataRequest = await window.OxidPayPalGooglePay.getGooglePaymentDataRequest();
const threeDSPaymentDataRequest = {
...paymentDataRequest,
paymentData: {
tokenizationData: {
type: 'PAYMENT_GATEWAY',
token: paypalOrderResponse.id // Original PayPal order ID
},
// 3DS specific parameters
threeDSData: {
authenticationParameters: {
threeDSRequestData: {
threeDSServerTransID: generateTransactionId(),
challengeWindowSize: "03", // Full screen
messageCategory: "PAYMENT_AUTHENTICATION"
}
}
}
}
};

try {
// This triggers the 3DS popup
const paymentData = await paymentClient.loadPaymentData(threeDSPaymentDataRequest);

// After successful 3DS authentication
// Update PayPal order with new payment token
const updateOrderResponse = await fetch(`/v2/checkout/orders/${paypalOrderResponse.id}`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify([{
op: 'replace',
path: '/payment_source/google_pay/card/authentication_result',
value: {
liability_shift: "POSSIBLE",
three_d_secure: {
authentication_status: "Y",
enrollment_status: "Y"
}
}
}])
});

// Finally capture the order
if (updateOrderResponse.ok) {
const captureResponse = await fetch(`/v2/checkout/orders/${paypalOrderResponse.id}/capture`, {
method: 'POST'
});
return captureResponse;
}
} catch (error) {
// Handle 3DS or payment errors
console.error('3DS Authentication failed:', error);
throw error;
}
}
};
Loading
Loading