Skip to content

Commit

Permalink
Merge pull request #70 from e2y/RELEASE_R2105_1.0
Browse files Browse the repository at this point in the history
Worldpay Hybris Plugin 2105-R1.0
  • Loading branch information
racuevji authored Sep 30, 2021
2 parents c9b78d1 + 098bc70 commit baffcf7
Show file tree
Hide file tree
Showing 784 changed files with 38,787 additions and 15,984 deletions.
44 changes: 33 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ About Worldpay: Worldpay (formerly RBS WorldPay) is a payment processing company
The extension is crafted for SAP Commerce Cloud as well previous versions of what was formerly called Hybris.

## Release Information
This release is tailored for SAP Commerce Cloud 2005. It is advised to use the latest release available in Github to get the benefits of newest development made to this extension.
This release is tailored for SAP Commerce Cloud 2105. It is advised to use the latest release available in Github to get the benefits of newest development made to this extension.

# Installation and Usage

Expand Down Expand Up @@ -38,14 +38,36 @@ In order to install the AddOn using one of the recipes, run the following comman
HYBRIS_HOME/installer$ ./install.sh -r [RECIPE_NAME] perform

## RELEASE NOTES
- A read/write socket connection timeout was configured in the library
##Features:
- SEPA Direct Debit has been integrated as an APM
- Prime routing
- Level2/3 Data
- Request and response payloads are now saved into the Order
- Fraud Sight Integration
- Unprocessed order tickets are now linked to their order

##Breaking changes:
- Several POJO objects are now created as beans defined in a beans.xml file.
- transformToInternalModel has been removed. New Converters/Populators per each one of the types that we have has been created and are used instead
- Java Classes from the Worldpay's DTD are now generated with JAXB's xjc
- The merchant configuration has been migrated to the data model:
1. Every merchant.xml file has been deleted from the repository and sensitive data like passwords, macSecret are not visible anymore.
2. New Types have been added into the DB definition: WorldpayMerchantConfiguration, WorldpayApplePayConfiguration, WorldpayGooglePayConfiguration, WorldpayThreeDS2JsonWebTokenConfiguration.
3. New enumerations have been added into the DB definition: EnvironmentType, ApplePaySupportedNetworks, ApplePayMerchantCapabilities, GooglePayCardNetworks, GooglePayCardAuthMethods, ChallengePreference
4. The Merchant Configuration can be found in the backoffice following the path: Worldpay → Merchant Configuration
5. The Merchant Configuration is related to the Site. Every site will have now a new tab called Worldpay. Inside this type there is the section MERCHANT CONFIGURATION DETAILS in which you can find the new 3 attributes:
- Web Merchant Configuration
- ASM Merchant Configuration
- Replenishment Merchant Configuration
- All of them are of the same type WorldpayMerchantConfiguration. This new configuration represents the old xml configuration of the merchant.xml file.

##Bugs Fixed:
- Fixed an issue related with date generation that was causing unprocessed order tickets not being created.
- Fixed an issue that was causing customers being redirected to an incorrect HOP URL when using express checkout.
- Fixed a NPE thrown on the summary step of the checkout when a paymentInfo has no bin number set.
- Fixed an issue with Ideal that was making the successURL not being encrypted.
- The profiletagaddon has been added to the project to fix a JSP file not found exception.
- Fixed an issue related to the tax configuration that was causing an error in the Electronics site when paying with a saved card.
- Fixed an issue related to the client side encryption that was causing an error when accessing to the payment details page.
- Fixed an issue with Klarna where an invalid shopper locale was being set.

- ypay-lib was updated to the latest DTD version

- When upgrading to version 2011 redundant address converters were removed after ootb hybris populated the email

- A bug was raised to fix hybris ootb causing an order process failure. Unnecessary user rights were removed and warehouse users were imported just for OMS. User rights were also moved to the common impex

- Added obfuscated cart number, card expiry month and year in the order confirmation page and payment info for googlepay with spartacus

- Fixed a bug related to saved cards for the b2b accelerator. The issue was caused by order placed with replenishment and card tokenized and saved in the step. The billing address was not saved in this case and it was causing the error when reusing the saved card.
Binary file added YPAY-1823670290-300921-0935.pdf
Binary file not shown.
Binary file removed YPAY-902561797-180121-1453.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed YPAY-TestingApplePay2011R1.0-180121-1454.pdf
Binary file not shown.
Binary file added YPAY-TestingApplePay2105R1.0-300921-0935.pdf
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
import de.hybris.platform.commerceservices.strategies.CheckoutCustomerStrategy;
import de.hybris.platform.order.InvalidCartException;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
Expand All @@ -30,7 +31,7 @@
@RequestMapping(value = "/checkout/multi/worldpay/googlepay")
public class GooglePayController extends AbstractCheckoutController {

private static final Logger LOG = Logger.getLogger(GooglePayController.class);
private static final Logger LOG = LoggerFactory.getLogger(GooglePayController.class);

@Resource
private WorldpayDirectOrderFacade worldpayDirectOrderFacade;
Expand Down Expand Up @@ -81,7 +82,7 @@ protected void setRegion(final AddressData addressData, final GooglePayAddressDa
if (region != null) {
addressData.setRegion(region);
} else {
LOG.debug(MessageFormat.format("Failed to determine region from country {0} and region code {1}", countryIsoCode, administrativeArea));
LOG.debug("Failed to determine region from country {} and region code {}", countryIsoCode, administrativeArea);
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
import de.hybris.platform.commerceservices.customer.DuplicateUidException;
import de.hybris.platform.order.InvalidCartException;
import org.apache.commons.collections.CollectionUtils;
import org.apache.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindingResult;
Expand All @@ -42,7 +43,7 @@
@RequestMapping(value = "/checkout/worldpay/payment/api")
public class WorldpayPaymentAPIController extends WorldpayChoosePaymentMethodCheckoutStepController {

private static final Logger LOGGER = Logger.getLogger(WorldpayPaymentAPIController.class);
private static final Logger LOGGER = LoggerFactory.getLogger(WorldpayPaymentAPIController.class);

@Resource
protected Validator cseFormValidator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
* Web controller to handle a CSE checkout step
Expand All @@ -38,7 +40,8 @@
@RequestMapping(value = "/checkout/multi/worldpay/cse")
public class WorldpayCseCheckoutStepController extends AbstractWorldpayDirectCheckoutStepController {

protected static final Logger LOGGER = LogManager.getLogger(WorldpayCseCheckoutStepController.class);
private static final Logger LOGGER = LogManager.getLogger(WorldpayCseCheckoutStepController.class);

protected static final String CSE_PUBLIC_KEY = "csePublicKey";
protected static final String CSE_PAYMENT_FORM = "csePaymentForm";
protected static final String REDIRECT_TO_CSE_PAGE = "redirect:/checkout/multi/worldpay/cse/cse-data";
Expand Down Expand Up @@ -131,7 +134,7 @@ public String addCseData(final HttpServletRequest request, final Model model, @V
}

final CSEAdditionalAuthInfo cseAdditionalAuthInfo = createCSEAdditionalAuthInfo(csePaymentForm);
final WorldpayAdditionalInfoData worldpayAdditionalInfoData = createWorldpayAdditionalInfo(request, csePaymentForm.getCvc(), cseAdditionalAuthInfo);
final WorldpayAdditionalInfoData worldpayAdditionalInfoData = createWorldpayAdditionalInfo(request, csePaymentForm, cseAdditionalAuthInfo);

return authoriseAndHandleResponse(model, cseAdditionalAuthInfo, worldpayAdditionalInfoData, response);
}
Expand Down Expand Up @@ -173,9 +176,11 @@ public String getChallengeIframeContent(final Model model) {
return worldpayAddonEndpointService.getChallengeIframe3dSecureFlex();
}

protected WorldpayAdditionalInfoData createWorldpayAdditionalInfo(final HttpServletRequest request, final String cvc, final CSEAdditionalAuthInfo cseAdditionalAuthInfo) {
protected WorldpayAdditionalInfoData createWorldpayAdditionalInfo(final HttpServletRequest request, final CSEPaymentForm csePaymentForm, final CSEAdditionalAuthInfo cseAdditionalAuthInfo) {
final WorldpayAdditionalInfoData worldpayAdditionalInfo = worldpayAdditionalInfoFacade.createWorldpayAdditionalInfoData(request);
worldpayAdditionalInfo.setSecurityCode(cvc);
worldpayAdditionalInfo.setDateOfBirth(csePaymentForm.getDateOfBirth());
worldpayAdditionalInfo.setSecurityCode(csePaymentForm.getCvc());
worldpayAdditionalInfo.setDeviceSession(csePaymentForm.getDeviceSession());
if (cseAdditionalAuthInfo.getAdditional3DS2() != null) {
worldpayAdditionalInfo.setAdditional3DS2(cseAdditionalAuthInfo.getAdditional3DS2());
}
Expand All @@ -188,7 +193,11 @@ protected WorldpayAdditionalInfoData createWorldpayAdditionalInfo(final HttpServ
@Override
protected void setupAddPaymentPage(final Model model) throws CMSItemNotFoundException {
super.setupAddPaymentPage(model);

model.addAttribute(CSE_PAYMENT_FORM, new CSEPaymentForm());
model.addAttribute(IS_FS_ENABLED, worldpayPaymentCheckoutFacade.isFSEnabled());
final SimpleDateFormat dateFormat = new SimpleDateFormat(BIRTH_DAY_DATE_FORMAT);
model.addAttribute(CURRENT_DATE, dateFormat.format(new Date()));
model.addAttribute(CSE_PUBLIC_KEY, worldpayMerchantConfigDataFacade.getCurrentSiteMerchantConfigData().getCsePublicKey());
model.addAttribute(THREEDSFLEX_EVENT_ORIGIN_DOMAIN, worldpayDDCFacade.getEventOriginDomainForDDC());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
import de.hybris.platform.order.InvalidCartException;
import de.hybris.platform.payment.model.PaymentTransactionModel;
import de.hybris.platform.servicelayer.dto.converter.Converter;
import org.apache.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

Expand All @@ -31,7 +32,6 @@
import java.util.Set;

import static com.worldpay.enums.order.AuthorisedStatus.*;
import static java.text.MessageFormat.format;

/**
* Web controller to handle HOP responses
Expand All @@ -40,7 +40,7 @@
@RequestMapping(value = "/checkout/multi/worldpay")
public class WorldpayHopResponseController extends WorldpayChoosePaymentMethodCheckoutStepController {

private static final Logger LOG = Logger.getLogger(WorldpayHopResponseController.class);
private static final Logger LOG = LoggerFactory.getLogger(WorldpayHopResponseController.class);

private static final String REDIRECT_URL_ADD_DELIVERY_ADDRESS = REDIRECT_PREFIX + "/checkout/multi/delivery-address/add";
private static final String REDIRECT_URL_CHOOSE_DELIVERY_METHOD = REDIRECT_PREFIX + "/checkout/multi/delivery-method/choose";
Expand Down Expand Up @@ -76,7 +76,7 @@ public class WorldpayHopResponseController extends WorldpayChoosePaymentMethodCh
* @return
*/
@RequireHardLogIn
@RequestMapping(value = "/hop-response", method = RequestMethod.GET)
@GetMapping(value = "/hop-response")
public String doHandleHopResponse(final HttpServletRequest request, final Model model, final RedirectAttributes redirectAttributes) {
final Map<String, String> requestParameterMap = getRequestParameterMap(request);
final RedirectAuthoriseResult response = extractAuthoriseResultFromRequest(request);
Expand All @@ -97,7 +97,7 @@ public String doHandleHopResponse(final HttpServletRequest request, final Model
* @return
*/
@RequireHardLogIn
@RequestMapping(value = "/hop-pending", method = RequestMethod.GET)
@GetMapping(value = "/hop-pending")
public String doHandlePendingHopResponse(final HttpServletRequest request, final Model model, final RedirectAttributes redirectAttributes) {
final Map<String, String> requestParameterMap = getRequestParameterMap(request);
AuthorisedStatus paymentStatus = AuthorisedStatus.ERROR;
Expand All @@ -109,7 +109,7 @@ public String doHandlePendingHopResponse(final HttpServletRequest request, final
worldpayHostedOrderFacade.completeRedirectAuthorise(authoriseResult);
return placeOrderAndRedirect(model, redirectAttributes);
} else {
LOG.error(format("Failed to create payment authorisation for successful hop-response (/hop-pending). Received {0}", paymentStatus.name()));
LOG.error("Failed to create payment authorisation for successful hop-response (/hop-pending). Received {}", paymentStatus);
}
}
return doHostedOrderPageError(paymentStatus.name(), redirectAttributes);
Expand All @@ -125,7 +125,7 @@ public String doHandlePendingHopResponse(final HttpServletRequest request, final
* @return
*/
@RequireHardLogIn
@RequestMapping(value = "bank-transfer/hop-response", method = RequestMethod.GET)
@GetMapping(value = "bank-transfer/hop-response")
public String doHandleBankTransferHopResponse(@RequestParam(value = "orderId") final String orderId, final HttpServletRequest request, final Model model, final RedirectAttributes redirectAttributes) {
if (!worldpayOrderCodeVerificationService.isValidEncryptedOrderCode(orderId)) {
redirectAttributes.addFlashAttribute(PAYMENT_STATUS_PARAMETER_NAME, REFUSED.name());
Expand All @@ -145,11 +145,10 @@ public String doHandleBankTransferHopResponse(@RequestParam(value = "orderId") f
* @return
*/
@RequireHardLogIn
@RequestMapping(value = "bank-transfer/hop-failure", method = RequestMethod.GET)
@GetMapping(value = "bank-transfer/hop-failure")
public String doHandleBankTransferHopFailure(final HttpServletRequest request, final RedirectAttributes redirectAttributes) {
final Map<String, String> requestParameterMap = getRequestParameterMap(request);
LOG.info(format("Failed to complete bank transfer for selected payment method. request params {0}", requestParameterMap));

LOG.info("Failed to complete bank transfer for selected payment method. request params {}", requestParameterMap);
redirectAttributes.addFlashAttribute(PAYMENT_STATUS_PARAMETER_NAME, REFUSED.name());
return REDIRECT_URL_CHOOSE_PAYMENT_METHOD;
}
Expand All @@ -159,7 +158,7 @@ public String doHandleBankTransferHopFailure(final HttpServletRequest request, f
*
* @return the string
*/
@RequestMapping(value = "/hop-cancel", method = RequestMethod.GET)
@GetMapping(value = "/hop-cancel")
@RequireHardLogIn
public String doCancelPayment() {
String redirectUrl = REDIRECT_URL_CHOOSE_PAYMENT_METHOD;
Expand All @@ -180,7 +179,7 @@ public String doCancelPayment() {
* @param redirectAttributes the {@link RedirectAttributes } to be used
* @return url for view
*/
@RequestMapping(value = "/error", method = RequestMethod.GET)
@GetMapping(value = "/error")
@RequireHardLogIn
public String doHostedOrderPageError(@RequestParam(value = "paymentStatus", required = false) final String paymentStatus, final RedirectAttributes redirectAttributes) {
redirectAttributes.addFlashAttribute(PAYMENT_STATUS_PARAMETER_NAME, paymentStatus != null ? paymentStatus : AuthorisedStatus.ERROR.name());
Expand All @@ -193,7 +192,7 @@ public String doHostedOrderPageError(@RequestParam(value = "paymentStatus", requ
* @param model the {@link Model} to be used
* @return
*/
@RequestMapping(value = "/billingaddressform", method = RequestMethod.GET)
@GetMapping(value = "/billingaddressform")
public String getCountryAddressForm(@RequestParam("countryIsoCode") final String countryIsoCode,
@RequestParam("useDeliveryAddress") final boolean useDeliveryAddress, final Model model) {
model.addAttribute("supportedCountries", getCountries());
Expand Down Expand Up @@ -228,8 +227,9 @@ protected String processResponse(final Model model, final RedirectAttributes red
worldpayHostedOrderFacade.completeRedirectAuthorise(response);
return placeOrderAndRedirect(model, redirectAttributes);
} else {
LOG.error(format("Failed to create payment authorisation for successful hop-response (/hop-response). Received {0}", paymentStatus.name()));
return doHostedOrderPageError(paymentStatus.name(), redirectAttributes);
final String paymentStatusName = paymentStatus.name();
LOG.error("Failed to create payment authorisation for successful hop-response (/hop-response). Received {}", paymentStatusName);
return doHostedOrderPageError(paymentStatusName, redirectAttributes);
}
}

Expand Down
Loading

0 comments on commit baffcf7

Please sign in to comment.