Skip to content

Commit

Permalink
Merge pull request #3 from checkout/release/2105-v1.2
Browse files Browse the repository at this point in the history
Checkout SAP Commerce plugin 2105 R1.2
  • Loading branch information
slleshi12 authored Apr 22, 2022
2 parents cba840f + 2135329 commit 82637a3
Show file tree
Hide file tree
Showing 52 changed files with 429 additions and 117 deletions.
Binary file not shown.
14 changes: 4 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The Connector for SAP Commerce Cloud (formerly Hybris) enables customers to impl
This release is compatible with:
- SAP Commerce: B2C Accelerator of SAP Commerce Cloud 2105. It is advised to install the latest patch version of SAP Commerce Cloud.
- SAP Commerce REST API (OCC).
- Spartacus 4
- Spartacus 4.2.
- Java 11.
- Checkout.com Java SDK version 3.

Expand Down Expand Up @@ -79,15 +79,9 @@ Follow [this guideline](https://help.sap.com/viewer/1be46286b36a4aa48205be5a9624
Spartacus is a lean, Angular-based JavaScript storefront for SAP Commerce Cloud. Spartacus talks to SAP Commerce Cloud exclusively through the Commerce REST API (OCC). The Connector for SAP Commerce Cloud supports the Spartacus frontend. Check out details and release notes in the Checkout.com repository for Spartacus.

# Release Notes
- Spartacus application support:
- New: OCC extension for Spartacus
- New: OCC endpoint for getting merchant public key
- New: OCC endpoint for listing the APMs
- New: Klarna client token endpoint
- New: APIs support guess checkout
- New: API endpoint to set billing address and shipping address
- New APM supported: Oxxo payment method
- Success and Failure URLs configured for every site
- GooglePay 3D Secure payment support for both accelerator and spartacus
- Spartacus: Fix 3D Secure redirect issue for card and googlePay payments
- Spartacus: fix address selector

# Support
Contact your Checkout.com team if you have any question, technical problem or feature request for the SAP Commerce Cloud Connector.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.gpay-card-info-container {
width: 100% !important;
}
Original file line number Diff line number Diff line change
Expand Up @@ -338,3 +338,9 @@ button#submitKlarnaForm {
margin-top: 0px;
margin-bottom: 0px;
}

.gpay-card-info-container {
width: 100% !important;
margin: 16px 0;
height: 48px !important;
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ ACC.applePay = {
$('[for="coUseDeliveryAddress"]').closest('.checkbox').hide();
$('#coBillingCountrySelector').hide();
$('#coBillingAddress').hide();
$('.gpay-card-info-container').remove()

/* hide the checkout next button */
$('.checkout-next').hide();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ ACC.checkoutCom = {

resetPaymentMethod: function () {
$('.applePayButton').hide();
$('.gpay-button').hide();
$('.gpay-card-info-container').remove()

$('[for="coUseDeliveryAddress"]').closest('.checkbox').show();
$('#coBillingCountrySelector').show();
Expand Down Expand Up @@ -283,5 +283,9 @@ ACC.checkoutCom = {
const orderId = order.guestCustomer ? order.guid : order.code;

window.location.href = ACC.config.encodedContextPath + '/checkout/orderConfirmation/' + orderId;
},

redirectToGooglePay3DSUrl: function (response) {
window.location.href = response.redirectUrl;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ ACC.googlePay = {
url: ACC.config.encodedContextPath + '/checkout/payment/checkout-com/googlepay/placeGooglePayOrder',
data: JSON.stringify(data),
success: function (response) {
if(response.redirectUrl){
ACC.checkoutCom.redirectToGooglePay3DSUrl(response)
}
if (response.status === 'SUCCESS') {
resolve(response.orderData);
} else {
Expand Down Expand Up @@ -186,9 +189,12 @@ ACC.googlePay = {
if (errorMessage === undefined || errorMessage === '') {
paymentFailureError = ACC.googlePay.paymentCancelled;
}
setTimeout(() => {
$('<div class="alert alert-danger">' + paymentFailureError + '</div>')
.prependTo(globalAlerts);
}, 1000);


$('<div class="alert alert-danger">' + paymentFailureError + '</div>')
.prependTo(globalAlerts);
}

};
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Mon, 31 Jan 2022 17:21:23 +0000
#Thu, 21 Apr 2022 15:15:23 +0000
# Specifies the location of the spring context file added automatically to the global platform application context.
checkoutaddon.application-context=checkoutaddon-spring.xml

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#Ant properties
#Mon Jan 31 17:34:07 UTC 2022
#Thu Apr 21 15:28:34 UTC 2022
version.api=2105
vendor=hybris
group.id=de.hybris.platform
name=checkoutaddon
description=checkoutaddon
builddate=20220131 1734
builddate=20220421 1528
releasedate=20211216 1837
version=2105.5
module.name=platform-module
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#Ant properties
#Mon Jan 31 17:34:07 UTC 2022
#Thu Apr 21 15:28:34 UTC 2022
version.api=2105
vendor=hybris
group.id=de.hybris.platform
name=checkoutbackoffice
description=checkoutbackoffice
builddate=20220131 1734
builddate=20220421 1528
releasedate=20211216 1837
version=2105.5
module.name=platform-module
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#Ant properties
#Mon Jan 31 17:34:08 UTC 2022
#Thu Apr 21 15:28:35 UTC 2022
version.api=2105
vendor=hybris
group.id=de.hybris.platform
name=checkoutevents
description=checkoutevents
builddate=20220131 1734
builddate=20220421 1528
releasedate=20211216 1837
version=2105.5
module.name=platform-module
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@
<bean class="com.checkout.hybris.facades.beans.GooglePayAuthorisationRequest">
<property name="token" type="com.checkout.hybris.facades.beans.GooglePayPaymentToken"/>
<property name="billingAddress" type="com.checkout.hybris.facades.beans.GooglePayPaymentContact"/>
<property name="tokenFormat" type="com.checkout.hybris.core.google.payment.enums.TokenFormatType"/>
</bean>

<bean class="com.checkout.hybris.facades.beans.GooglePayPaymentContact"
Expand All @@ -203,6 +204,7 @@
<property name="orderData" type="de.hybris.platform.commercefacades.order.data.OrderData"/>
<property name="status" type="com.checkout.hybris.facades.enums.PlaceWalletOrderStatus"/>
<property name="errorMessage" type="java.lang.String"/>
<property name="redirectUrl" type="java.lang.String"/>
</bean>

<bean class="com.checkout.hybris.facades.beans.GooglePaySettingsData">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#Ant properties
#Mon Jan 31 17:34:08 UTC 2022
#Thu Apr 21 15:28:35 UTC 2022
version.api=2105
vendor=hybris
group.id=de.hybris.platform
name=checkoutfacades
description=checkoutfacades
builddate=20220131 1734
builddate=20220421 1528
releasedate=20211216 1837
version=2105.5
module.name=platform-module
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@
import com.checkout.hybris.core.currency.services.CheckoutComCurrencyService;
import com.checkout.hybris.core.klarna.session.request.KlarnaProductRequestDto;
import com.checkout.hybris.core.klarna.session.request.KlarnaSessionRequestDto;
import de.hybris.platform.cms2.model.site.CMSSiteModel;
import de.hybris.platform.converters.Populator;
import de.hybris.platform.core.model.c2l.C2LItemModel;
import de.hybris.platform.core.model.c2l.CurrencyModel;
import de.hybris.platform.core.model.order.CartModel;
import de.hybris.platform.core.model.user.AddressModel;
import de.hybris.platform.servicelayer.dto.converter.ConversionException;
import de.hybris.platform.servicelayer.dto.converter.Converter;
import org.apache.commons.lang.StringUtils;

import java.util.List;
import java.util.Locale;
import java.util.Optional;

import static de.hybris.platform.servicelayer.util.ServicesUtil.validateParameterNotNull;

Expand All @@ -35,15 +40,22 @@ public void populate(final CartModel source, final KlarnaSessionRequestDto targe
validateParameterNotNull(source, "CartModel cannot be null.");
validateParameterNotNull(target, "KlarnaSessionRequestDto cannot be null.");

final String currencyCode = source.getCurrency() != null ? source.getCurrency().getIsocode() : null;
target.setCurrency(currencyCode);
final CMSSiteModel site = (CMSSiteModel) source.getSite();
target.setLocale(site != null ? site.getLocale().replace("_", "-") : null);
if (source.getPaymentAddress() != null && source.getPaymentAddress().getCountry() != null) {
target.setPurchaseCountry(source.getPaymentAddress().getCountry().getIsocode());
}
target.setAmount(checkoutComCurrencyService.convertAmountIntoPennies(currencyCode, source.getTotalPrice()));
target.setTaxAmount(checkoutComCurrencyService.convertAmountIntoPennies(currencyCode, source.getTotalTax()));
final Optional<String> currencyCode = Optional.ofNullable(source.getCurrency())
.map(CurrencyModel::getIsocode)
.filter(StringUtils::isNotBlank);
currencyCode.ifPresent(target::setCurrency);

target.setLocale(Optional.ofNullable(source.getSite().getLocale())
.orElse(Locale.UK.toString())
.replace("_", "-")
);
Optional.ofNullable(source.getPaymentAddress())
.map(AddressModel::getCountry)
.map(C2LItemModel::getIsocode)
.ifPresent(target::setPurchaseCountry);

currencyCode.ifPresent(currency -> target.setAmount(checkoutComCurrencyService.convertAmountIntoPennies(currency, source.getTotalPrice())));
currencyCode.ifPresent(currency -> target.setTaxAmount(checkoutComCurrencyService.convertAmountIntoPennies(currency, source.getTotalTax())));
target.setProducts(checkoutComKlarnaProductsRequestDtoConverter.convert(source));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ public PlaceWalletOrderDataResponse placeWalletOrder(final WalletPaymentAddition
LOG.error("Error with the authorization process. Redirecting to payment method step.");
return handleFailureProcess(response, messageSource.getMessage("checkout.error.authorization.failed", null, i18nService.getCurrentLocale()));
}
if (authorizeResponseData.getIsRedirect()) {
response.setRedirectUrl(authorizeResponseData.getRedirectUrl());
return response;
}

final OrderData orderData;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
@RunWith(MockitoJUnitRunner.class)
public class DefaultCheckoutComWalletOrderFacadeTest {

private static final String REDIRECT_URL = "/redirecturl";
private static final String AUTHORIZATION_FAILED_ERROR_MSG = "Authorization failed";
private static final String PLACE_ORDER_FAILED_ERROR_MSG = "Place order failed";

Expand Down Expand Up @@ -79,7 +80,18 @@ public void placeWalletOrder_WhenAuthorizationSuccess_ShouldPlaceOrder() {
}

@Test
public void placeWalletOrder_WhenAuthorizationSuccess_ShouldNotPlaceOrder() {
public void placeWalletOrder_WhenAuthorizationRedirectUrl_ShouldPlaceOrder() throws InvalidCartException {
when(authorizeResponseDataMock.getIsRedirect()).thenReturn(Boolean.TRUE);
when(authorizeResponseDataMock.getRedirectUrl()).thenReturn(REDIRECT_URL);

final PlaceWalletOrderDataResponse result = testObj.placeWalletOrder(walletAdditionalInfoMock, GOOGLEPAY);

assertThat(result.getRedirectUrl()).isEqualTo(REDIRECT_URL);
verify(checkoutFlowFacadeMock, never()).placeOrder();
}

@Test
public void placeWalletOrder_WhenAuthorizationNotSuccess_ShouldNotPlaceOrder() {
when(authorizeResponseDataMock.getIsSuccess()).thenReturn(false);

final PlaceWalletOrderDataResponse result = testObj.placeWalletOrder(walletAdditionalInfoMock, GOOGLEPAY);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#Ant properties
#Mon Jan 31 17:34:08 UTC 2022
#Thu Apr 21 15:28:35 UTC 2022
version.api=2105
vendor=hybris
group.id=de.hybris.platform
name=checkoutfulfilmentprocess
description=checkoutfulfilmentprocess
builddate=20220131 1734
builddate=20220421 1528
releasedate=20211216 1837
version=2105.5
module.name=platform-module
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
<property name="orderData" type="de.hybris.platform.commercewebservicescommons.dto.order.OrderWsDTO"/>
<property name="status" type="com.checkout.hybris.facades.enums.PlaceWalletOrderStatus"/>
<property name="errorMessage" type="java.lang.String"/>
<property name="redirectUrl" type="java.lang.String"/>
</bean>

<bean class="com.checkout.dto.order.ApplePayValidateMerchantRequestWsDTO">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#Ant properties
#Mon Jan 31 17:34:08 UTC 2022
#Thu Apr 21 15:28:35 UTC 2022
version.api=2105
vendor=hybris
group.id=de.hybris.platform
name=checkoutocc
description=checkoutocc
builddate=20220131 1734
builddate=20220421 1528
releasedate=20211216 1837
version=2105.5
module.name=platform-module
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
<property name="levelMapping">
<map>
<entry key="BASIC"
value="status,errorMessage,orderData(BASIC)"/>
value="status,errorMessage,orderData(BASIC),redirectUrl"/>
<entry key="DEFAULT"
value="status,errorMessage,orderData(DEFAULT)"/>
value="status,errorMessage,orderData(DEFAULT),redirectUrl"/>
<entry key="FULL"
value="status,errorMessage,orderData(FULL)"/>
value="status,errorMessage,orderData(FULL),redirectUrl"/>
</map>
</property>
</bean>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#Ant properties
#Mon Jan 31 17:34:08 UTC 2022
#Thu Apr 21 15:28:35 UTC 2022
version.api=2105
vendor=hybris
group.id=de.hybris.platform
name=checkoutocctests
description=checkoutocctests
builddate=20220131 1734
builddate=20220421 1528
releasedate=20211216 1837
version=2105.5
module.name=platform-module
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public static void loadExtensionDataInJunit() {
getSetupImpexService().importImpexFile("/checkoutocctests/import/sampledata/cms-content.impex", true, false);
getSetupImpexService().importImpexFile("/checkoutocctests/import/sampledata/store.impex", true, false);
getSetupImpexService().importImpexFile("/checkoutocctests/import/sampledata/product-prices.impex", true, false);
getSetupImpexService().importImpexFile("/checkoutocctests/import/sampledata/essentialdata-OAuthClientDetails.impex", true, false);
getSetupSyncJobService().executeCatalogSyncJob(String.format("%sProductCatalog", WS_TEST));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ class CheckoutComAPMOrdersTest extends AbstractCheckoutComPaymentsTest {
then: "error message is thrown"
with(response) {
status == SC_BAD_REQUEST
data.errors[0].message == 'Payment authorization was not successful'
data.errors[0].message == 'The application has encountered an error'
data.errors[0].type == 'PaymentAuthorizationError'
}

where:
Expand Down
Loading

0 comments on commit 82637a3

Please sign in to comment.