Skip to content

Commit

Permalink
Merge pull request #230 from Adyen/develop
Browse files Browse the repository at this point in the history
Release version 9.1.0
  • Loading branch information
saquibsayyad authored Dec 31, 2020
2 parents faf94b6 + 86819e2 commit 7de6601
Show file tree
Hide file tree
Showing 23 changed files with 243 additions and 50 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,18 @@ Please make sure your merchant has Variant true in API and responses section so

Credit Card payments are supported using Checkout Components.

### Apple Pay

[Apple Pay](https://docs.adyen.com/payment-methods/apple-pay/) is supported using Checkout Components.


### Ratepay

Ratepay is supported via Adyen API.

### Boleto

[Boleto](https://docs.adyen.com/developers/payment-methods/boleto-bancario) is supported via Adyen API.
[Boleto](https://docs.adyen.com/payment-methods/boleto-bancario) is supported via Adyen API.

### Paypal Express Checkout Shortcut

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import com.adyen.model.checkout.PaymentMethodDetails;
import com.adyen.model.checkout.PaymentsResponse;
import com.adyen.model.checkout.details.ApplePayDetails;
import com.adyen.model.checkout.details.MbwayDetails;
import com.adyen.model.checkout.details.PayPalDetails;
import com.adyen.service.exception.ApiException;
Expand Down Expand Up @@ -98,6 +99,8 @@ public String componentPayment(final HttpServletRequest request) throws AdyenCom
paymentMethodDetails = gson.fromJson(requestJson.get("paymentMethodDetails"), PayPalDetails.class);
} else if("mbway".equals(paymentMethod)) {
paymentMethodDetails = gson.fromJson(requestJson.get("paymentMethodDetails"), MbwayDetails.class);
} else if("applepay".equals(paymentMethod)) {
paymentMethodDetails = gson.fromJson(requestJson.get("paymentMethodDetails"), ApplePayDetails.class);
} else {
throw new InvalidCartException("checkout.error.paymentethod.formentry.invalid");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.net.SocketTimeoutException;
import java.util.Arrays;
import java.util.HashMap;
Expand All @@ -83,6 +82,7 @@
import static com.adyen.v6.constants.AdyenControllerConstants.CART_PREFIX;
import static com.adyen.v6.constants.AdyenControllerConstants.SELECT_PAYMENT_METHOD_PREFIX;
import static com.adyen.v6.constants.AdyenControllerConstants.SUMMARY_CHECKOUT_PREFIX;
import static com.adyen.v6.constants.Adyenv6coreConstants.PAYMENT_METHOD_APPLEPAY;
import static com.adyen.v6.constants.Adyenv6coreConstants.PAYMENT_METHOD_BOLETO;
import static com.adyen.v6.constants.Adyenv6coreConstants.PAYMENT_METHOD_CC;
import static com.adyen.v6.constants.Adyenv6coreConstants.PAYMENT_METHOD_MULTIBANCO;
Expand Down Expand Up @@ -607,7 +607,8 @@ private String redirectToOrderSummaryWithError(final Model model,
final RedirectAttributes redirectAttributes,
final String messageKey) throws CommerceCartModificationException, CMSItemNotFoundException {
final CartData cartData = getCheckoutFacade().getCheckoutCart();
if(cartData == null || cartData.getAdyenPaymentMethod() == null) {
if(cartData == null || cartData.getAdyenPaymentMethod() == null
|| PAYMENT_METHOD_APPLEPAY.equals(cartData.getAdyenPaymentMethod())) {
return redirectToSelectPaymentMethodWithError(redirectAttributes, messageKey);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ payment.method.terminal.selector=Select your terminal

checkout.summary.spinner.message=Please wait while your payment is processed. Do not click back or refresh the page.
checkout.summary.component.mbway.payment=Provide your MB WAY account data to finalize your payment
checkout.summary.component.notavailable=This payment method is not available on your current browser or device
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ payment.method.terminal.selector=Select your terminal

checkout.summary.spinner.message=Please wait while your payment is processed. Do not click back or refresh the page.
checkout.summary.component.mbway.payment=Provide your MB WAY account data to finalize your payment
checkout.summary.component.notavailable=This payment method is not available on your current browser or device
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@
<spring:url value="/checkout/multi/termsAndConditions" var="getTermsAndConditionsUrl"/>

<%-- Components --%>
<c:if test="${selectedPaymentMethod eq 'mbway' || selectedPaymentMethod eq 'paypal'}">
<%-- Paypal button --%>
<c:if test="${selectedPaymentMethod eq 'paypal'}">
<c:if test="${selectedPaymentMethod eq 'mbway' || selectedPaymentMethod eq 'paypal' || selectedPaymentMethod eq 'applepay'}">
<%-- Render Paypal or Apple Pay button --%>
<c:if test="${selectedPaymentMethod eq 'paypal' || selectedPaymentMethod eq 'applepay'}">
<div class="checkbox">
<label>
<input type="checkbox" id="terms-conditions-check-${label}" />
<spring:theme var="readTermsAndConditions" code="checkout.summary.placeOrder.readTermsAndConditions" arguments="${fn:escapeXml(getTermsAndConditionsUrl)}" htmlEscape="false"/>
${ycommerce:sanitizeHTML(readTermsAndConditions)}
</label>
</div>
<div id="adyen-paypal-container-${label}"></div>
<div id="adyen-component-button-container-${label}"></div>
</c:if>

<c:if test="${selectedPaymentMethod eq 'mbway'}">
Expand All @@ -32,8 +32,8 @@
</c:if>
</c:if>

<%-- Paypal has it's own button --%>
<c:if test="${selectedPaymentMethod ne 'paypal'}">
<%-- Paypal and Apple Pay has it's own button --%>
<c:if test="${selectedPaymentMethod ne 'paypal' && selectedPaymentMethod ne 'applepay'}">
<form:form action="${placeOrderUrl}" id="placeOrderForm-${label}" modelAttribute="placeOrderForm">
<div class="checkbox">
<label> <form:checkbox id="terms-conditions-check-${label}" path="termsCheck" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
<template:page pageTitle="${pageTitle}" hideHeaderLinks="true">
<jsp:attribute name="pageScripts">
<script type="text/javascript" src="${dfUrl}"></script>
<script type="text/javascript" src="https://${checkoutShopperHost}/checkoutshopper/sdk/3.18.2/adyen.js"></script>
<script type="text/javascript" src="https://${checkoutShopperHost}/checkoutshopper/sdk/3.19.0/adyen.js"></script>
<link rel="stylesheet" href="https://checkoutshopper-live.adyen.com/checkoutshopper/css/chckt-default-v1.css"/>
<link rel="stylesheet" href="https://${checkoutShopperHost}/checkoutshopper/sdk/3.18.2/adyen.css"/>
<link rel="stylesheet" href="https://${checkoutShopperHost}/checkoutshopper/sdk/3.19.0/adyen.css"/>

<script type="text/javascript">
AdyenCheckoutHybris.initiateCheckout("${shopperLocale}", "${environmentMode}", "${clientKey}");
Expand All @@ -27,13 +27,19 @@
var amountJS = {value: "${amount.value}", currency: "${amount.currency}"};
AdyenCheckoutHybris.initiatePaypal(amountJS, "${immediateCapture}", "${paypalMerchantId}", "hidden-xs");
AdyenCheckoutHybris.initiatePaypal(amountJS, "${immediateCapture}", "${paypalMerchantId}", "visible-xs");
</c:when>
</c:when>
<c:when test="${selectedPaymentMethod eq 'mbway'}">
AdyenCheckoutHybris.initiateMbway("hidden-xs");
AdyenCheckoutHybris.initiateMbway("visible-xs");
</c:when>
<c:when test="${selectedPaymentMethod eq 'applepay'}">
var amountJS = {value: "${amount.value}", currency: "${amount.currency}"};
AdyenCheckoutHybris.initiateApplePay(amountJS, "${countryCode}", "${applePayMerchantIdentifier}", "${applePayMerchantName}", "hidden-xs");
AdyenCheckoutHybris.initiateApplePay(amountJS, "${countryCode}", "${applePayMerchantIdentifier}", "${applePayMerchantName}", "visible-xs");
</c:when>
<%-- API only payments methods --%>
<c:otherwise>
AdyenCheckoutHybris.configureButton($( "#placeOrderForm-hidden-xs" ), true, "hidden-xs");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
<template:page pageTitle="${pageTitle}" hideHeaderLinks="true">
<jsp:attribute name="pageScripts">
<script type="text/javascript" src="${dfUrl}"></script>
<script type="text/javascript" src="https://${checkoutShopperHost}/checkoutshopper/sdk/3.18.2/adyen.js"></script>
<script type="text/javascript" src="https://${checkoutShopperHost}/checkoutshopper/sdk/3.19.0/adyen.js"></script>
<link rel="stylesheet" href="https://checkoutshopper-live.adyen.com/checkoutshopper/css/chckt-default-v1.css"/>
<link rel="stylesheet" href="https://${checkoutShopperHost}/checkoutshopper/sdk/3.18.2/adyen.css"/>
<link rel="stylesheet" href="https://${checkoutShopperHost}/checkoutshopper/sdk/3.19.0/adyen.css"/>

<script type="text/javascript">
AdyenCheckoutHybris.initiateCheckout( "${shopperLocale}", "${environmentMode}", "${clientKey}" );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,10 @@ div#section_break {
padding: 5px;
margin: 10px 0 5px;
clear: both;
}

@supports not (-webkit-appearance: -apple-pay-button) {
.chckt-pm-applepay {
display: none;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ var AdyenCheckoutHybris = (function () {

var ErrorMessages = {
PaymentCancelled: 'checkout.error.authorization.payment.cancelled',
PaymentError: 'checkout.error.authorization.payment.error'
PaymentError: 'checkout.error.authorization.payment.error',
PaymentNotAvailable: 'checkout.summary.component.notavailable',
TermsNotAccepted: 'checkout.error.terms.not.accepted'
};

return {
Expand Down Expand Up @@ -301,7 +303,7 @@ var AdyenCheckoutHybris = (function () {
},

initiatePaypal: function (amount, isImmediateCapture, paypalMerchantId, label) {
var paypalNode = document.getElementById('adyen-paypal-container-' + label);
var paypalNode = document.getElementById('adyen-component-button-container-' + label);

var adyenComponent = this.checkout.create("paypal", {
environment: this.checkout.options.environment,
Expand Down Expand Up @@ -343,6 +345,54 @@ var AdyenCheckoutHybris = (function () {
}
},

initiateApplePay: function (amount, countryCode, applePayMerchantIdentifier, applePayMerchantName, label) {
var applePayNode = document.getElementById('adyen-component-button-container-' + label);
var adyenComponent = this.checkout.create("applepay", {
amount: {
currency: amount.currency,
value: amount.value
},
countryCode: countryCode,
configuration: {
merchantName: applePayMerchantName,
merchantIdentifier: applePayMerchantIdentifier
},
// Button config
buttonType: "plain",
buttonColor: "black",
onChange: (state, component) => {
if (!state.isValid) {
this.enablePlaceOrder(label);
}
},
onSubmit: (state, component) => {
if (!state.isValid) {
this.enablePlaceOrder(label);
return false;
}
this.makePayment(state.data.paymentMethod, component, this.handleResult, label);
},
onClick: (resolve, reject) => {
if (this.isTermsAccepted(label)) {
resolve();
} else {
reject();
this.handleResult(ErrorMessages.TermsNotAccepted, true);
}
}
});

adyenComponent.isAvailable()
.then(() => {
adyenComponent.mount(applePayNode);
})
.catch(e => {
// Apple Pay is not available
console.log('Something went wrong trying to mount the Apple Pay component: ' + e);
this.handleResult(ErrorMessages.PaymentNotAvailable, true);
});
},

initiateMbway: function (label) {
var mbwayNode = document.getElementById('adyen-component-container-' + label);

Expand Down Expand Up @@ -403,6 +453,8 @@ var AdyenCheckoutHybris = (function () {
var response = JSON.parse(data);
if (response.resultCode && response.resultCode === 'Pending' && response.action) {
component.handleAction(response.action);
} else if (response.resultCode && response.resultCode === 'Authorised') {
handleResult(response, false);
} else {
handleResult(ErrorMessages.PaymentError, true);
}
Expand Down Expand Up @@ -454,6 +506,10 @@ var AdyenCheckoutHybris = (function () {
})
},

isTermsAccepted: function(label) {
return document.getElementById('terms-conditions-check-' + label).checked;
},

handleResult: function (data, error) {
if (error) {
document.querySelector("#resultData").value = data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ module.name=platform-module
name=adyenv6b2ccheckoutaddon
releasedate=20170509 1903
vendor=adyen
version=9.0.0
version.api=9.0.0
version=9.1.0
version.api=9.1.0
4 changes: 2 additions & 2 deletions adyenv6backoffice/resources/adyenv6backoffice.build.number
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ module.name=platform-module
name=adyenv6backoffice
releasedate=20170509 1903
vendor=adyen
version=9.0.0
version.api=9.0.0
version=9.1.0
version.api=9.1.0
14 changes: 9 additions & 5 deletions adyenv6core/resources/adyenv6core-beans.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ [y] hybris Platform
~
~
~ Copyright (c) 2000-2016 SAP SE
~ All rights reserved.
~
~ This software is the confidential and proprietary information of SAP
~ Hybris ("Confidential Information"). You shall not disclose such
~ Confidential Information and shall use it only in accordance with the
~
~ This software is the confidential and proprietary information of SAP
~ Hybris ("Confidential Information"). You shall not disclose such
~ Confidential Information and shall use it only in accordance with the
~ terms of the license agreement you entered into with SAP Hybris.
-->

Expand Down Expand Up @@ -38,6 +38,8 @@
<property name="adyenTerminalId" type="java.lang.String"/>
<property name="adyenBrowserInfo" type="java.lang.String"/>
<property name="adyenBillingAddress" type="de.hybris.platform.commercefacades.user.data.AddressData"/>
<property name="adyenApplePayMerchantName" type="java.lang.String"/>
<property name="adyenApplePayMerchantIdentifier" type="java.lang.String"/>
</bean>

<bean class="de.hybris.platform.commercefacades.order.data.AbstractOrderData">
Expand Down Expand Up @@ -73,6 +75,8 @@
<property name="terminalId" type="String" />
<property name="adyenLastName" type="String" />
<property name="adyenBillingAddress" type="de.hybris.platform.commercewebservicescommons.dto.user.AddressWsDTO"/>
<property name="adyenApplePayMerchantName" type="java.lang.String"/>
<property name="adyenApplePayMerchantIdentifier" type="java.lang.String"/>
</bean>

<bean class="de.hybris.platform.commercewebservicescommons.dto.order.AbstractOrderWsDTO">
Expand Down
19 changes: 19 additions & 0 deletions adyenv6core/resources/adyenv6core-items.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@
</columntype>
</persistence>
</attribute>
<!-- Apple Pay -->
<attribute qualifier="adyenApplePayMerchantName" type="java.lang.String">
<description>Apple Pay merchant name</description>
<persistence type="property"/>
</attribute>
<attribute qualifier="adyenApplePayMerchantIdentifier" type="java.lang.String">
<description>Apple Pay merchant identifier</description>
<persistence type="property"/>
</attribute>
</attributes>
</itemtype>

Expand Down Expand Up @@ -414,6 +423,16 @@
</columntype>
</persistence>
</attribute>
<!-- Apple Pay -->
<attribute qualifier="adyenApplePayMerchantName" type="java.lang.String">
<description>Apple Pay merchant name</description>
<persistence type="property"/>
</attribute>
<attribute qualifier="adyenApplePayMerchantIdentifier" type="java.lang.String">
<description>Apple Pay merchant identifier</description>
<persistence type="property"/>
</attribute>

<attribute qualifier="encryptedCardNumber" type="java.lang.String">
<description>Adyen Encrypted Card Number</description>
<persistence type="property">
Expand Down
4 changes: 2 additions & 2 deletions adyenv6core/resources/adyenv6core.build.number
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ group.id=com.adyen.v6
module.name=platform-module
name=adyenv6core
vendor=adyen
version=9.0.0
version.api=9.0.0
version=9.1.0
version.api=9.1.0
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public final class Adyenv6coreConstants extends GeneratedAdyenv6coreConstants {
public static final String EXTENSIONNAME = "adyenv6core";

public static final String PLUGIN_NAME = "adyen-hybris";
public static final String PLUGIN_VERSION = "9.0.0";
public static final String PLUGIN_VERSION = "9.1.0";
public static final String PAYMENT_PROVIDER = "Adyen";
public static final String PAYMENT_METHOD ="paymentMethod";

Expand All @@ -46,6 +46,8 @@ public final class Adyenv6coreConstants extends GeneratedAdyenv6coreConstants {
final public static String PAYMENT_METHOD_POS = "pos";
final public static String PAYMENT_METHOD_PAYPAL = "paypal";
final public static String PAYMENT_METHOD_SCHEME = "scheme";
final public static String PAYMENT_METHOD_APPLEPAY = "applepay";


public static final String PROCESS_EVENT_ADYEN_CAPTURED = "AdyenCaptured";
public static final String PROCESS_EVENT_ADYEN_PAYMENT_RESULT = "AdyenPaymentResult";
Expand Down
Loading

0 comments on commit 7de6601

Please sign in to comment.