4.3.604 • Published 1 year ago

@worldpay2020/spartacus v4.3.604

Weekly downloads
7
License
-
Repository
-
Last release
1 year ago

Worldpay Connector for the SAP Spartacus Storefront

The Worldpay Connector for SAP Spartacus Storefront is an Angular Library that provides the components to integrate WorldPay payment solutions with the SAP Commerce Cloud Spartacus storefront.

About Worldpay from FIS

Worldpay from FIS is one of the world's leading global eCommerce and payment technology companies. FIS is a leading provider of technology solutions for merchants, banks and capital markets firms globally.

About Spartacus

Spartacus is a lean, Angular-based JavaScript storefront for SAP Commerce Cloud. Spartacus talks to SAP Commerce Cloud exclusively through the Commerce REST API. Spartacus is also an open source project. You can view the Spartacus source code in this GitHub repository.

Spartacus documentation: https://sap.github.io/spartacus-docs/. Release information: https://sap.github.io/spartacus-docs/release-information/.

Requirements

  • For the back end, SAP Commerce Cloud version 1905 or higher is required, and SAP Commerce Cloud version 2005 or newer is recommended.
  • Angular CLI: Version 12.0.5 or later, < 13.
  • Yarn: Version 1.15 or later.
  • Node.js: The most recent 14.x version is required. Version 12.x reached end-of-life on April 30, 2022, and is no longer supported by Spartacus. It is strongly recommended that you migrate any existing Spartacus storefronts to Node.js 14 as soon as possible. If there are any issues with Spartacus and Node.js 14, please upgrade to the latest releases. If you continue to experience issues with Node.js 14, create a support ticket with SAP. Spartacus also supports version 16.x of Node.js, but this version is not yet supported in Commerce Cloud in the Public Cloud builder.

Note: Some Spartacus features require API endpoints that are only available in newer versions of SAP Commerce Cloud. For more information, see Feature Compatibility.

Compatibility

The Connector is compatible with the Spartacus Release 4.3.6

Installation & Usage

Development

Run the command ./install.sh to do a clean install and run the example-storefront

Installing Spartacus

  • Install @worldpay2020/spartacus to your Spartacus project - final name pending
  npm install @worldpay2020/spartacus

Configuring Spartacus

Perform the following in your Spartacus storefront's app.module.ts file.

Note: You can skip this step and import a new WorldpayModule that includes all the required modules in one feature.

  • Import Worldpay Modules
import { 
   WorldpayPaymentComponentModule,
   WorldpayPlaceOrderComponentModule,
   WorldpayStoreModule,
   OccWorldpayModule,
   WorldpayPaymentComponent,
   WorldpayPlaceOrderComponent,
   WorldpayDdcIframeModule,
   WorldpayDdcIframeRoutingModule,
   Worldpay3dsChallengeIframeModule,
   Worldpay3dsChallengeIframeRoutingModule,
   worldpayTranslations
} from '@worldpay2020/worldpay-spartacus';

@NgModule({
  imports: [
    ...
    OccWorldpayModule,
    WorldpayStoreModule,
    WorldpayDdcIframeModule,
    WorldpayFraudsightRiskModule,
    WorldpayDdcIframeRoutingModule,
    WorldpayPaymentComponentModule,
    Worldpay3dsChallengeIframeModule,
    WorldpayPlaceOrderComponentModule,
    WorldpayCheckoutReviewSubmitModule,
    Worldpay3dsChallengeIframeRoutingModule,
    WorldpayOrderConfirmationModule,
    WorldpayOrderDetailShippingModule,
  ],
  ...
})
  • Include Guaranteed Payments Module

import { WorldpayGuaranteedPaymentsModule } from '../../../worldpay-spartacus/src/storefrontlib/cms-components/worldpay-guaranteed-payments/worldpay-guaranteed-payments.module';

import {
  WorldpayGuaranteedPaymentsModule,
} from '@worldpay2020/worldpay-spartacus';
  • Add additional translations
@NgModule({
  providers: [
    provideConfig({
      i18n: { resources: worldpayTranslations },
      ...
    }),
  ]
})

Or import WordlpayModule

Perform the following in your Spartacus storefront's app.module.ts file.

import { WorldpayModule } from '@worldpay2020/worldpay-spartacus';

@NgModule({
  imports: [
    ...
    WorldpayModule,
  ],
})

Upgrading from @worldpay2020/worldpay-spartacus v1.0.0

As B2cStorefrontModule has been removed from spartacus, you can remove this code from your app.module file Override the following CMS components in the B2cStorefrontModule

@NgModule({
  imports: [
    B2cStorefrontModule.withConfig({
      cmsComponents: {
        CheckoutPaymentDetails: {
          component: WorldpayPaymentComponent
        },
        CheckoutPlaceOrder: {
          component: WorldpayPlaceOrderComponent
        }
      },
      ...
    }),
  ]
})
  • WorldpayPaymentComponentModule configuration will automatically Override the following CMS components:
@NgModule({
  providers: [
    ...
    provideConfig({
      cmsComponents: {
        CheckoutPaymentDetails: {
          component: WorldpayPaymentComponent
        },
        CheckoutPlaceOrder: {
          component: WorldpayPlaceOrderComponent
        }
      },
      ...
    }),
  ]
})

Include Worldpay script before closing the body tag inside the index.html file

<html>
...
<app-root></app-root>
...
<script src="https://secure.worldpay.com/resources/cse/js/worldpay-cse-1.latest.min.js"></script>
</body>
</html>

Known issues

1. Product image missing in Order confirmation page:

You can manually import WorldpayOrderConfirmationItemsComponent to fix the issue.

@NgModule({
  providers: [
    ...
    provideConfig({
      cmsComponents: {
        OrderConfirmationItemsComponent: {
          component: WorldpayOrderConfirmationItemsComponent,
          guards: [WorldpayCheckoutPaymentRedirectGuard],
        },
      }
    }),
  ]
})

License

Copyright (c) 2022 Worldpay Ltd.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.