Skip to content

Commit

Permalink
Merge pull request #189 from Adyen/develop
Browse files Browse the repository at this point in the history
Release 6.6.0
  • Loading branch information
rkewlani authored Jun 29, 2020
2 parents 2ee7343 + 57ed7cd commit b171ebe
Show file tree
Hide file tree
Showing 20 changed files with 172 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<formElement:formInputBox idKey="address.line1" labelKey="address.line1" path="billingAddress.line1" inputCSS="form-control" mandatory="true" tabindex="${tabindex + 4}"/>
<formElement:formInputBox idKey="address.line2" labelKey="address.line2" path="billingAddress.line2" inputCSS="form-control" mandatory="false" tabindex="${tabindex + 5}"/>
<formElement:formInputBox idKey="address.townCity" labelKey="address.townCity" path="billingAddress.townCity" inputCSS="form-control" mandatory="true" tabindex="${tabindex + 6}"/>
<formElement:formSelectBox idKey="address.region" labelKey="address.regionIso" path="billingAddress.regionIso" mandatory="true" skipBlank="false" skipBlankMessageKey="address.selectState"
<formElement:formSelectBox idKey="address.region" labelKey="address.state" path="billingAddress.regionIso" mandatory="true" skipBlank="false" skipBlankMessageKey="address.selectState"
items="${regions}" itemValue="isocodeShort" tabindex="${tabindex + 7}" selectCSSClass="form-control"/>
<formElement:formInputBox idKey="address.postcode" labelKey="address.postcode" path="billingAddress.postcode" inputCSS="form-control" mandatory="true" tabindex="${tabindex + 8}"/>
<formElement:formInputBox idKey="address.phone" labelKey="address.phone" path="billingAddress.phoneNumber" inputCSS="form-control" mandatory="false" tabindex="${tabindex + 9}"/>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>

<form:form commandName="adyenPaymentForm">
<address:billingAddressFormElements regions="${regions}"
country="${country}" tabindex="12"/>
</form:form>
<form:form modelAttribute="adyenPaymentForm">
<address:billingAddressFormElements regions="${regions}"
country="${country}" tabindex="12"/>
</form:form>
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@
AdyenCheckoutHybris.createDfValue();
<c:if test="${sepadirectdebit}">
AdyenCheckoutHybris.initiateSepaDirectDebit( );
</c:if>
<c:if test="${not empty issuerLists['ideal']}">
AdyenCheckoutHybris.initiateIdeal( ${issuerLists['ideal']} );
</c:if>
Expand Down Expand Up @@ -121,6 +125,8 @@
<form:hidden path="browserInfo"/>
<form:hidden path="terminalId"/>
<form:hidden path="rememberTheseDetails" value="false"/>
<form:hidden path="sepaOwnerName"/>
<form:hidden path="sepaIbanNumber"/>

<%-- Billing Information --%>
<div class="headline"><spring:message text="Billing Information"/></div>
Expand Down Expand Up @@ -177,6 +183,13 @@
/>
</c:forEach>

<c:if test="${sepadirectdebit}">
<adyen:alternativeMethod
brandCode="sepadirectdebit"
name="SEPA Direct Debit"
/>
</c:if>

<c:if test="${not empty issuerLists['ideal']}">
<adyen:alternativeMethod
brandCode="ideal"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ var AdyenCheckoutHybris = (function () {
card: null,
oneClickCards: {},
selectedCardBrand: null,
sepaDirectDebit:null,

convertCardBrand: function () {
var cardBrand = this.selectedCardBrand;
Expand Down Expand Up @@ -84,6 +85,7 @@ var AdyenCheckoutHybris = (function () {
this.copyOneClickCardData( recurringReference, oneClickCard.data.paymentMethod.encryptedSecurityCode );
}
}
$( 'input[name="txvariant"]' ).remove();

if ( ['eps','ideal'].includes(paymentMethod) ) {
var issuerIdField = document.getElementById('issuerId');
Expand All @@ -101,7 +103,12 @@ var AdyenCheckoutHybris = (function () {
}
}

$( 'input[name="txvariant"]' ).remove();
if( paymentMethod === "sepadirectdebit" ){
if( !this.sepaDirectDebit.state.isValid ) {
window.alert("Invalid SEPA Owner Name and IBAN number");
return false;
}
}

return true;
},
Expand Down Expand Up @@ -221,6 +228,27 @@ var AdyenCheckoutHybris = (function () {
this.card.mount(document.getElementById('card-div'));
},

initiateSepaDirectDebit: function () {
var context = this;
var sepaDirectDebitNode = document.getElementById( 'adyen_hpp_sepadirectdebit_container' );
this.sepaDirectDebit = this.checkout.create( 'sepadirectdebit', {
onChange: handleOnChange
} );

function handleOnChange ( event ) {
var sepaOwnerNameField = document.getElementById( 'sepaOwnerName' );
var sepaIbanNumberField = document.getElementById( 'sepaIbanNumber' );

var sepaOwnerName = event.data.paymentMethod[ "sepa.ownerName" ]
var sepaIbanNumber = event.data.paymentMethod[ "sepa.ibanNumber" ]

sepaOwnerNameField.value = sepaOwnerName;
sepaIbanNumberField.value = sepaIbanNumber;
}
this.sepaDirectDebit.mount( sepaDirectDebitNode );
},


initiateIdeal: function (idealDetails) {
var idealNode = document.getElementById('adyen_hpp_ideal_container');
var ideal = this.checkout.create('ideal', {
Expand All @@ -242,6 +270,7 @@ var AdyenCheckoutHybris = (function () {
}
},


initiateEps: function (epsDetails) {
var epsNode = document.getElementById('adyen_hpp_eps_container');
var eps = this.checkout.create('eps', {
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=6.5.0
version.api=6.5.0
version=6.6.0
version.api=6.6.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=6.5.0
version.api=6.5.0
version=6.6.0
version.api=6.6.0
4 changes: 4 additions & 0 deletions adyenv6core/resources/adyenv6core-beans.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
<property name="adyenIssuerId" type="java.lang.String"/>
<property name="adyenDob" type="java.util.Date"/>
<property name="adyenSocialSecurityNumber" type="java.lang.String"/>
<property name="adyenSepaOwnerName" type="java.lang.String"/>
<property name="adyenSepaIbanNumber" type="java.lang.String"/>
<property name="adyenDfValue" type="java.lang.String"/>
<property name="adyenFirstName" type="java.lang.String"/>
<property name="adyenInstallments" type="java.lang.Integer"/>
Expand Down Expand Up @@ -65,6 +67,8 @@
<property name="adyenPaymentMethod" type="String" />
<property name="adyenSelectedReference" type="String" />
<property name="adyenSocialSecurityNumber" type="String" />
<property name="adyenSepaOwnerName" type="java.lang.String"/>
<property name="adyenSepaIbanNumber" type="java.lang.String"/>
<property name="adyenFirstName" type="String" />
<property name="installments" type="Integer" />
<property name="terminalId" type="String" />
Expand Down
8 changes: 8 additions & 0 deletions adyenv6core/resources/adyenv6core-items.xml
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,14 @@
<description>Shopper's social security number (applicable for openinvoice methods)</description>
<persistence type="property"/>
</attribute>
<attribute qualifier="adyenSepaOwnerName" type="java.lang.String">
<description>Shopper's name on the SEPA bank account</description>
<persistence type="property"/>
</attribute>
<attribute qualifier="adyenSepaIbanNumber" type="java.lang.String">
<description>Shopper's IBAN Number of the SEPA bank account</description>
<persistence type="property"/>
</attribute>
<attribute qualifier="adyenFirstName" type="java.lang.String">
<description>Shopper's first name (applicable for Boleto)</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=6.5.0
version.api=6.5.0
version=6.6.0
version.api=6.6.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 = "6.5.0";
public static final String PLUGIN_VERSION = "6.6.0";
public static final String PAYMENT_PROVIDER = "Adyen";
public static final String PAYMENT_METHOD ="paymentMethod";

Expand All @@ -40,6 +40,7 @@ public final class Adyenv6coreConstants extends GeneratedAdyenv6coreConstants {
final public static String PAYMENT_METHOD_IDEAL = "ideal";
final public static String PAYMENT_METHOD_ONECLICK = "adyen_oneclick_";
final public static String PAYMENT_METHOD_BOLETO = "boleto";
final public static String PAYMENT_METHOD_SEPA_DIRECTDEBIT = "sepadirectdebit";
final public static String PAYMENT_METHOD_BOLETO_SANTANDER = "boletobancario_santander";
final public static String PAYMENT_METHOD_MULTIBANCO = "multibanco";
final public static String PAYMENT_METHOD_POS = "pos";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,15 @@ public PerformResult perform(final CronJobModel cronJob) {
if (isDuplicate) {
LOG.debug("Skipping duplicate notification");
} else {
adyenNotificationService.processNotification(notificationItemModel);
LOG.debug("Notification with PSPReference " + notificationItemModel.getPspReference() + " was processed");
boolean isOldNotification = notificationItemRepository.isNewerNotificationExists(notificationItemModel.getMerchantReference(),
notificationItemModel.getEventDate(),
notificationItemModel.getMerchantAccountCode());
if (isOldNotification) {
LOG.debug("Skipping delayed notification");
} else {
adyenNotificationService.processNotification(notificationItemModel);
LOG.debug("Notification with PSPReference " + notificationItemModel.getPspReference() + " was processed");
}
}

modelService.save(notificationItemModel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
Expand Down Expand Up @@ -135,6 +136,7 @@
import static com.adyen.v6.constants.Adyenv6coreConstants.PAYMENT_METHOD_CC;
import static com.adyen.v6.constants.Adyenv6coreConstants.PAYMENT_METHOD_MULTIBANCO;
import static com.adyen.v6.constants.Adyenv6coreConstants.PAYMENT_METHOD_ONECLICK;
import static com.adyen.v6.constants.Adyenv6coreConstants.PAYMENT_METHOD_SEPA_DIRECTDEBIT;
import static com.adyen.v6.constants.Adyenv6coreConstants.RATEPAY;
import static de.hybris.platform.order.impl.DefaultCartService.SESSION_CART_PARAMETER_NAME;

Expand Down Expand Up @@ -770,6 +772,15 @@ public void initializeCheckoutData(Model model) {
}
}

Optional<PaymentMethod> sepaDirectDebit = alternativePaymentMethods.stream().
filter(paymentMethod -> ! paymentMethod.getType().isEmpty() &&
PAYMENT_METHOD_SEPA_DIRECTDEBIT.contains(paymentMethod.getType())).findFirst()
;
if(sepaDirectDebit.isPresent())
{
model.addAttribute(PAYMENT_METHOD_SEPA_DIRECTDEBIT, true);
}

//Exclude cards, boleto, bcmc and bcmc_mobile_QR and iDeal
alternativePaymentMethods = alternativePaymentMethods.stream()
.filter(paymentMethod -> ! paymentMethod.getType().isEmpty() && ! isHiddenPaymentMethod(paymentMethod))
Expand Down Expand Up @@ -834,6 +845,7 @@ private boolean isHiddenPaymentMethod(PaymentMethod paymentMethod) {
(paymentMethodType.contains("wechatpay")
&& ! paymentMethodType.equals("wechatpayWeb")) ||
paymentMethodType.startsWith(PAYMENT_METHOD_BOLETO) ||
paymentMethodType.contains(PAYMENT_METHOD_SEPA_DIRECTDEBIT) ||
ISSUER_PAYMENT_METHODS.contains(paymentMethodType)) {
return true;
}
Expand Down Expand Up @@ -934,6 +946,9 @@ public PaymentInfoModel createPaymentInfo(final CartModel cartModel, AdyenPaymen

paymentInfo.setAdyenSocialSecurityNumber(adyenPaymentForm.getSocialSecurityNumber());

paymentInfo.setAdyenSepaOwnerName(adyenPaymentForm.getSepaOwnerName());
paymentInfo.setAdyenSepaIbanNumber(adyenPaymentForm.getSepaIbanNumber());

// Boleto fields
paymentInfo.setAdyenFirstName(adyenPaymentForm.getFirstName());
paymentInfo.setAdyenLastName(adyenPaymentForm.getLastName());
Expand Down Expand Up @@ -972,6 +987,8 @@ public PaymentInfoModel createPaymentInfo(final CartModel cartModel, PaymentDeta
paymentInfo.setAdyenPaymentMethod(paymentDetails.getAdyenPaymentMethod());
paymentInfo.setAdyenSelectedReference(paymentDetails.getAdyenSelectedReference());
paymentInfo.setAdyenSocialSecurityNumber(paymentDetails.getAdyenSocialSecurityNumber());
paymentInfo.setAdyenSepaOwnerName(paymentDetails.getAdyenSepaOwnerName());
paymentInfo.setAdyenSepaIbanNumber(paymentDetails.getAdyenSepaIbanNumber());
paymentInfo.setAdyenFirstName(paymentDetails.getAdyenFirstName());
paymentInfo.setAdyenLastName(paymentDetails.getAdyenLastName());
paymentInfo.setOwner(cartModel.getOwner());
Expand Down
21 changes: 18 additions & 3 deletions adyenv6core/src/com/adyen/v6/factory/AdyenRequestFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
import static com.adyen.v6.constants.Adyenv6coreConstants.PAYMENT_METHOD_FACILPAY_PREFIX;
import static com.adyen.v6.constants.Adyenv6coreConstants.PAYMENT_METHOD_ONECLICK;
import static com.adyen.v6.constants.Adyenv6coreConstants.PAYMENT_METHOD_PAYPAL;
import static com.adyen.v6.constants.Adyenv6coreConstants.PAYMENT_METHOD_SEPA_DIRECTDEBIT;
import static com.adyen.v6.constants.Adyenv6coreConstants.PLUGIN_NAME;
import static com.adyen.v6.constants.Adyenv6coreConstants.PLUGIN_VERSION;

Expand Down Expand Up @@ -232,6 +233,10 @@ else if (adyenPaymentMethod.indexOf(PAYMENT_METHOD_ONECLICK) == 0) {
else if (cartData.getAdyenPaymentMethod().indexOf(PAYMENT_METHOD_BOLETO) == 0) {
setBoletoData(paymentsRequest, cartData);
}
else if (PAYMENT_METHOD_SEPA_DIRECTDEBIT.equals(cartData.getAdyenPaymentMethod())) {
setSepaDirectDebitData(paymentsRequest, cartData);
}

//For alternate payment methods like iDeal, Paypal etc.
else {
updatePaymentRequestForAlternateMethod(paymentsRequest, cartData, customerModel);
Expand Down Expand Up @@ -355,8 +360,10 @@ private void updatePaymentRequestForCC(PaymentsRequest paymentsRequest, CartData
}
if (Recurring.ContractEnum.ONECLICK_RECURRING == contractEnum) {
paymentsRequest.setEnableRecurring(true);
paymentsRequest.setEnableOneClick(true);
} else if (Recurring.ContractEnum.ONECLICK == contractEnum) {
if(cartData.getAdyenRememberTheseDetails()) {
paymentsRequest.setEnableOneClick(true);
}
} else if (Recurring.ContractEnum.ONECLICK == contractEnum && cartData.getAdyenRememberTheseDetails() ) {
paymentsRequest.setEnableOneClick(true);
} else if (Recurring.ContractEnum.RECURRING == contractEnum) {
paymentsRequest.setEnableRecurring(true);
Expand All @@ -383,7 +390,7 @@ private void updatePaymentRequestForDC(PaymentsRequest paymentsRequest, CartData
String encryptedCardNumber = cartData.getAdyenEncryptedCardNumber();
String encryptedExpiryMonth = cartData.getAdyenEncryptedExpiryMonth();
String encryptedExpiryYear = cartData.getAdyenEncryptedExpiryYear();
if (Recurring.ContractEnum.ONECLICK_RECURRING == contractEnum || Recurring.ContractEnum.ONECLICK == contractEnum) {
if ((Recurring.ContractEnum.ONECLICK_RECURRING == contractEnum || Recurring.ContractEnum.ONECLICK == contractEnum) && cartData.getAdyenRememberTheseDetails()) {
paymentsRequest.setEnableOneClick(true);
}
if (! StringUtils.isEmpty(encryptedCardNumber) && ! StringUtils.isEmpty(encryptedExpiryMonth) && ! StringUtils.isEmpty(encryptedExpiryYear)) {
Expand Down Expand Up @@ -907,6 +914,14 @@ private void setPaypalEcsData(PaymentRequest paymentRequest, CartData cartData)
paymentRequest.setPaymentToken(cartData.getAdyenPaymentToken());
}

private void setSepaDirectDebitData(PaymentsRequest paymentRequest, CartData cartData) {
DefaultPaymentMethodDetails paymentMethodDetails = new DefaultPaymentMethodDetails();
paymentMethodDetails.setSepaOwnerName(cartData.getAdyenSepaOwnerName());
paymentMethodDetails.setSepaIbanNumber(cartData.getAdyenSepaIbanNumber());
paymentMethodDetails.setType(PAYMENT_METHOD_SEPA_DIRECTDEBIT);
paymentRequest.setPaymentMethod(paymentMethodDetails);
}

private String getPlatformVersion() {
return getConfigurationService().getConfiguration().getString(PLATFORM_VERSION_PROPERTY);
}
Expand Down
Loading

0 comments on commit b171ebe

Please sign in to comment.