diff --git a/integration-libs/opf/base/root/config/default-opf-config.ts b/integration-libs/opf/base/root/config/default-opf-config.ts index 892fa7fc041..fea91606294 100644 --- a/integration-libs/opf/base/root/config/default-opf-config.ts +++ b/integration-libs/opf/base/root/config/default-opf-config.ts @@ -9,5 +9,8 @@ import { OpfConfig } from './opf-config'; export const defaultOpfConfig: OpfConfig = { opf: { opfBaseUrl: '', + paymentOption: { + enableInfoMessage: true, + }, }, }; diff --git a/integration-libs/opf/base/root/config/opf-config.ts b/integration-libs/opf/base/root/config/opf-config.ts index 5fcde7c4cc4..b28fb557587 100644 --- a/integration-libs/opf/base/root/config/opf-config.ts +++ b/integration-libs/opf/base/root/config/opf-config.ts @@ -15,6 +15,26 @@ export abstract class OpfConfig { opf?: { opfBaseUrl?: string; commerceCloudPublicKey?: string; + paymentOption?: { + /** + * The map of info message translation keys for specific payment configuration IDs + * @example + * ```ts + * const opfConfig = { + * opf: { + * paymentInfoMessagesMap: { + * 213: 'opfCheckout.payPalPaymentInfoMessage' // Message key for payment method ID 213 + * } + * } + * }; + * ``` + */ + paymentInfoMessagesMap?: Record; + /** + * Enables the payment info message section within the payment options + */ + enableInfoMessage?: boolean; + }; }; } diff --git a/integration-libs/opf/checkout/assets/translations/en/opfCheckout.json b/integration-libs/opf/checkout/assets/translations/en/opfCheckout.json index 2d276cfd15a..780c43ca5bf 100644 --- a/integration-libs/opf/checkout/assets/translations/en/opfCheckout.json +++ b/integration-libs/opf/checkout/assets/translations/en/opfCheckout.json @@ -9,8 +9,11 @@ "billingAddress": "Billing Address", "paymentOption": "Payment option", "termsAndConditions": "Terms & Conditions", + "closeTermsAndConditionsAlert": "Close alert", "itemsToBeShipped": "Items to be shipped", "proceedPayment": "Place Order", + "defaultPaymentInfoMessage": "You are about to make a payment. Depending on the option selected, you will either be redirected to a secure external page or complete the process directly within this page", + "proceedPaymentButtonLabel": "Place Order, opens external page", "retryPayment": "Retry to Continue", "checkTermsAndConditionsExplicit": "You must agree Terms & Conditions to see available payment options.", "checkTermsAndConditionsImplicit": "By submitting the order, you are agreeing to our Terms & Conditions.", diff --git a/integration-libs/opf/checkout/components/opf-checkout-billing-address-form/opf-checkout-billing-address-form.component.html b/integration-libs/opf/checkout/components/opf-checkout-billing-address-form/opf-checkout-billing-address-form.component.html index 4cce8a8fb21..92504a6cac0 100644 --- a/integration-libs/opf/checkout/components/opf-checkout-billing-address-form/opf-checkout-billing-address-form.component.html +++ b/integration-libs/opf/checkout/components/opf-checkout-billing-address-form/opf-checkout-billing-address-form.component.html @@ -1,62 +1,66 @@ -

{{ 'opfCheckout.billingAddress' | cxTranslate }}

- - -
-
- +
+

{{ 'opfCheckout.billingAddress' | cxTranslate }}

+ + +
+
+ +
-
- -
- + +
+ - -
-
+ +
+
- - + + + - - - - + + + + diff --git a/integration-libs/opf/checkout/components/opf-checkout-payment-and-review/opf-checkout-payment-and-review.component.html b/integration-libs/opf/checkout/components/opf-checkout-payment-and-review/opf-checkout-payment-and-review.component.html index b123c0e4bb7..edcfe9c39b4 100644 --- a/integration-libs/opf/checkout/components/opf-checkout-payment-and-review/opf-checkout-payment-and-review.component.html +++ b/integration-libs/opf/checkout/components/opf-checkout-payment-and-review/opf-checkout-payment-and-review.component.html @@ -1,132 +1,163 @@ - -
+
-

{{ 'opfCheckout.termsAndConditions' | cxTranslate }}

+

+ {{ 'opfCheckout.tabs.paymentAndReview' | cxTranslate }} +

-
-
- -
-
-
+

{{ 'opfCheckout.termsAndConditions' | cxTranslate }}

+ + - +
+
+ +
+
+
- + - + - - -
- {{ - 'cartItems.cartTotal' - | cxTranslate: { count: cart.deliveryItemsQuantity } - }}: - {{ cart.totalPrice?.formattedValue }} -
-
- + + -
- {{ 'opfCheckout.itemsToBeShipped' | cxTranslate }} + + +
+ {{ + 'cartItems.cartTotal' + | cxTranslate: { count: cart.deliveryItemsQuantity } + }}: + {{ cart.totalPrice?.formattedValue }}
+
+ -
-
- -
- -
+
+ {{ 'opfCheckout.itemsToBeShipped' | cxTranslate }}
-
- -
- +
+
+ +
+ +
+
+ +
+ +
+ +
-
- - -
- + + +
+ + diff --git a/integration-libs/opf/checkout/components/opf-checkout-payment-wrapper/opf-checkout-payment-wrapper.component.html b/integration-libs/opf/checkout/components/opf-checkout-payment-wrapper/opf-checkout-payment-wrapper.component.html index e3f6616b68b..8476c9865f6 100644 --- a/integration-libs/opf/checkout/components/opf-checkout-payment-wrapper/opf-checkout-payment-wrapper.component.html +++ b/integration-libs/opf/checkout/components/opf-checkout-payment-wrapper/opf-checkout-payment-wrapper.component.html @@ -21,9 +21,15 @@ " class="cx-payment-link" > - {{ - 'opfCheckout.proceedPayment' | cxTranslate - }} + {{ 'opfCheckout.proceedPayment' | cxTranslate }}
diff --git a/integration-libs/opf/checkout/components/opf-checkout-payments/opf-checkout-payments.component.html b/integration-libs/opf/checkout/components/opf-checkout-payments/opf-checkout-payments.component.html index 54387ce2451..b17253ff81b 100644 --- a/integration-libs/opf/checkout/components/opf-checkout-payments/opf-checkout-payments.component.html +++ b/integration-libs/opf/checkout/components/opf-checkout-payments/opf-checkout-payments.component.html @@ -1,59 +1,87 @@ -

- {{ 'opfCheckout.paymentOption' | cxTranslate }} -

- - -
- -
- -
+ +
+
+ + + + + diff --git a/integration-libs/opf/checkout/components/opf-checkout-payments/opf-checkout-payments.component.ts b/integration-libs/opf/checkout/components/opf-checkout-payments/opf-checkout-payments.component.ts index 4498a06077a..f67a5be9f9b 100644 --- a/integration-libs/opf/checkout/components/opf-checkout-payments/opf-checkout-payments.component.ts +++ b/integration-libs/opf/checkout/components/opf-checkout-payments/opf-checkout-payments.component.ts @@ -17,15 +17,18 @@ import { GlobalMessageType, PaginationModel, QueryState, + TranslationService, } from '@spartacus/core'; import { OpfActiveConfiguration, OpfActiveConfigurationsPagination, OpfActiveConfigurationsResponse, OpfBaseFacade, + OpfConfig, OpfMetadataModel, OpfMetadataStoreService, } from '@spartacus/opf/base/root'; +import { ICON_TYPE } from '@spartacus/storefront'; import { Observable, Subscription } from 'rxjs'; import { tap } from 'rxjs/operators'; @@ -36,6 +39,8 @@ import { tap } from 'rxjs/operators'; }) export class OpfCheckoutPaymentsComponent implements OnInit, OnDestroy { protected opfBaseService = inject(OpfBaseFacade); + protected opfConfig = inject(OpfConfig); + protected translation = inject(TranslationService); protected opfMetadataStoreService = inject(OpfMetadataStoreService); protected globalMessageService = inject(GlobalMessageService); @@ -58,6 +63,8 @@ export class OpfCheckoutPaymentsComponent implements OnInit, OnDestroy { QueryState >; + iconTypes = ICON_TYPE; + getActiveConfigurations(): Observable< QueryState > { @@ -89,6 +96,21 @@ export class OpfCheckoutPaymentsComponent implements OnInit, OnDestroy { this.activeConfigurations$ = this.getActiveConfigurations(); } + getPaymentInfoMessage(paymentId: number | undefined): Observable { + const defaultMessage = 'opfCheckout.defaultPaymentInfoMessage'; + const translationKey = + paymentId && this.opfConfig?.opf?.paymentOption?.paymentInfoMessagesMap + ? (this.opfConfig.opf.paymentOption.paymentInfoMessagesMap[paymentId] ?? + defaultMessage) + : defaultMessage; + + return this.translation.translate(translationKey); + } + + get isPaymentInfoMessageVisible(): boolean { + return Boolean(this.opfConfig?.opf?.paymentOption?.enableInfoMessage); + } + /** * Method pre-selects (based on terms and conditions state) * previously selected payment option ID by customer. diff --git a/integration-libs/opf/checkout/components/opf-checkout-payments/opf-checkout-payments.module.ts b/integration-libs/opf/checkout/components/opf-checkout-payments/opf-checkout-payments.module.ts index 35373c7cd1c..98d625e6e48 100644 --- a/integration-libs/opf/checkout/components/opf-checkout-payments/opf-checkout-payments.module.ts +++ b/integration-libs/opf/checkout/components/opf-checkout-payments/opf-checkout-payments.module.ts @@ -7,7 +7,11 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { I18nModule } from '@spartacus/core'; -import { PaginationModule, SpinnerModule } from '@spartacus/storefront'; +import { + IconModule, + PaginationModule, + SpinnerModule, +} from '@spartacus/storefront'; import { OpfCheckoutPaymentWrapperModule } from '../opf-checkout-payment-wrapper'; import { OpfCheckoutTermsAndConditionsAlertModule } from '../opf-checkout-terms-and-conditions-alert/opf-checkout-terms-and-conditions-alert.module'; import { OpfCheckoutPaymentsComponent } from './opf-checkout-payments.component'; @@ -22,6 +26,7 @@ import { OpfCheckoutPaymentsComponent } from './opf-checkout-payments.component' PaginationModule, OpfCheckoutPaymentWrapperModule, OpfCheckoutTermsAndConditionsAlertModule, + IconModule, ], }) export class OpfCheckoutPaymentsModule {} diff --git a/integration-libs/opf/checkout/components/opf-checkout-terms-and-conditions-alert/opf-checkout-terms-and-conditions-alert.component.html b/integration-libs/opf/checkout/components/opf-checkout-terms-and-conditions-alert/opf-checkout-terms-and-conditions-alert.component.html index 290b1728a86..5981e725a6c 100644 --- a/integration-libs/opf/checkout/components/opf-checkout-terms-and-conditions-alert/opf-checkout-terms-and-conditions-alert.component.html +++ b/integration-libs/opf/checkout/components/opf-checkout-terms-and-conditions-alert/opf-checkout-terms-and-conditions-alert.component.html @@ -1,17 +1,26 @@
- + - +
diff --git a/integration-libs/opf/checkout/components/opf-checkout-terms-and-conditions-alert/opf-checkout-terms-and-conditions-alert.component.ts b/integration-libs/opf/checkout/components/opf-checkout-terms-and-conditions-alert/opf-checkout-terms-and-conditions-alert.component.ts index 43c9f16dd33..fa921532f1f 100644 --- a/integration-libs/opf/checkout/components/opf-checkout-terms-and-conditions-alert/opf-checkout-terms-and-conditions-alert.component.ts +++ b/integration-libs/opf/checkout/components/opf-checkout-terms-and-conditions-alert/opf-checkout-terms-and-conditions-alert.component.ts @@ -25,6 +25,11 @@ export class OpfCheckoutTermsAndConditionsAlertComponent implements OnInit { iconTypes = ICON_TYPE; + /** + * Defines if alert could be dismissed or not + */ + @Input() isDismissible: boolean; + @Input() isVisible: boolean; /** * Explicit Terms and Conditions (isExplicit true) requires user to accept T&C to see and select payments options. diff --git a/integration-libs/opf/checkout/styles/components/_opf-checkout-payment-and-review.scss b/integration-libs/opf/checkout/styles/components/_opf-checkout-payment-and-review.scss index ce650d038b6..1cc1cad8c54 100644 --- a/integration-libs/opf/checkout/styles/components/_opf-checkout-payment-and-review.scss +++ b/integration-libs/opf/checkout/styles/components/_opf-checkout-payment-and-review.scss @@ -87,7 +87,7 @@ } } - > cx-opf-checkout-terms-and-conditions-alert { + > section > cx-opf-checkout-terms-and-conditions-alert { display: none; @include media-breakpoint-down(md) { display: block; diff --git a/integration-libs/opf/checkout/styles/components/_opf-checkout-payments.scss b/integration-libs/opf/checkout/styles/components/_opf-checkout-payments.scss index eeb1d2bc6d0..6986ad15dd8 100644 --- a/integration-libs/opf/checkout/styles/components/_opf-checkout-payments.scss +++ b/integration-libs/opf/checkout/styles/components/_opf-checkout-payments.scss @@ -45,4 +45,23 @@ .cx-payment-options-list-pagination { justify-content: flex-end; } + + .cx-payment-info-box { + display: flex; + margin: 12px 0; + padding: 16px; + border: 1px solid #d3d6db; + border-radius: 10px; + background-color: #f1f1f1f1; + + cx-icon { + color: var(--cx-color-info); + } + } + + .cx-payment-info-box-message { + text-transform: none; + margin: 0; + font-weight: 600; + } } diff --git a/integration-libs/opf/checkout/styles/components/_opf-checkout-terms-and-conditions-alert.scss b/integration-libs/opf/checkout/styles/components/_opf-checkout-terms-and-conditions-alert.scss index 4f042640d4a..1569f1ccaf4 100644 --- a/integration-libs/opf/checkout/styles/components/_opf-checkout-terms-and-conditions-alert.scss +++ b/integration-libs/opf/checkout/styles/components/_opf-checkout-terms-and-conditions-alert.scss @@ -1,5 +1,6 @@ %cx-opf-checkout-terms-and-conditions-alert { .alert { + padding-inline-end: 3rem; .close { top: var(--cx-top, 50%); right: 1.5rem; @@ -10,6 +11,8 @@ } .message { padding: 10px 0; + margin: 0; + text-align: left; } } } diff --git a/projects/assets/src/translations/en/payment.json b/projects/assets/src/translations/en/payment.json index 6316898b222..33dc21c5d6e 100644 --- a/projects/assets/src/translations/en/payment.json +++ b/projects/assets/src/translations/en/payment.json @@ -14,6 +14,7 @@ "saveAsDefault": "Save as default", "setAsDefault": "Set as default payment method", "billingAddress": "Billing address", + "editBillingAddress": "Edit billing Address", "sameAsDeliveryAddress": "Same as delivery address", "billingAddressSameAsShipping": "Billing address is the same as delivery address", "selectOne": "Select One...",