Skip to content

Commit

Permalink
Merge pull request #265 from Adyen/develop
Browse files Browse the repository at this point in the history
Release 10.1.0
  • Loading branch information
saquibsayyad authored Aug 3, 2021
2 parents 7af6e30 + 5b51dfd commit f10e9ca
Show file tree
Hide file tree
Showing 27 changed files with 256 additions and 98 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.adyen.model.checkout.PaymentMethodDetails;
import com.adyen.model.checkout.PaymentsDetailsResponse;
import com.adyen.model.checkout.PaymentsResponse;
import com.adyen.model.checkout.details.AmazonPayDetails;
import com.adyen.model.checkout.details.ApplePayDetails;
import com.adyen.model.checkout.details.GooglePayDetails;
import com.adyen.model.checkout.details.MbwayDetails;
Expand Down Expand Up @@ -64,6 +65,7 @@

import static com.adyen.v6.constants.AdyenControllerConstants.COMPONENT_PREFIX;
import static com.adyen.v6.constants.AdyenControllerConstants.SUMMARY_CHECKOUT_PREFIX;
import static com.adyen.v6.constants.Adyenv6coreConstants.PAYMENT_METHOD_AMAZONPAY;
import static com.adyen.v6.constants.Adyenv6coreConstants.PAYMENT_METHOD_PIX;

@RestController
Expand Down Expand Up @@ -108,6 +110,8 @@ public String componentPayment(final HttpServletRequest request) throws AdyenCom
paymentMethodDetails = gson.fromJson(requestJson.get("paymentMethodDetails"), ApplePayDetails.class);
} else if(GooglePayDetails.GOOGLEPAY.equals(paymentMethod)) {
paymentMethodDetails = gson.fromJson(requestJson.get("paymentMethodDetails"), GooglePayDetails.class);
} else if(AmazonPayDetails.AMAZONPAY.equals(paymentMethod)) {
paymentMethodDetails = gson.fromJson(requestJson.get("paymentMethodDetails"), AmazonPayDetails.class);
} else if(PAYMENT_METHOD_PIX.equals(paymentMethod)) {
paymentMethodDetails = new DefaultPaymentMethodDetails();
paymentMethodDetails.setType(PAYMENT_METHOD_PIX);
Expand Down Expand Up @@ -176,7 +180,9 @@ protected void validateOrderForm(JsonObject requestJson) throws InvalidCartExcep
JsonObject paymentMethodDetails = requestJson.get("paymentMethodDetails").getAsJsonObject();
String paymentMethod = gson.fromJson(paymentMethodDetails.get("type"), String.class);

if(!PAYMENT_METHOD_PIX.equals(paymentMethod) &&(termsCheck == null || !termsCheck)) {
// Pix and Amazon already have the terms validated on a previous step
if(!PAYMENT_METHOD_PIX.equals(paymentMethod) && !PAYMENT_METHOD_AMAZONPAY.equals(paymentMethod)
&& (termsCheck == null || !termsCheck)) {
throw new InvalidCartException("checkout.error.terms.not.accepted");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ payment.method.first.name=First name
payment.method.last.name=Last name
payment.method.issuer.selector=Please select issuer
payment.method.terminal.selector=Select your terminal
payment.method.telephonenumber=Phone Number

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ payment.method.first.name=First name
payment.method.last.name=Last name
payment.method.issuer.selector=Please select issuer
payment.method.terminal.selector=Select your terminal
payment.method.telephonenumber=Phone Number

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ payment.method.first.name=Nome
payment.method.last.name=Sobrenome
payment.method.issuer.selector=Selecione o banco
payment.method.terminal.selector=Selecione o terminal
payment.method.telephonenumber=Número de telefone

checkout.summary.spinner.message=Aguarde...
checkout.summary.component.pix.generateqr = Gerar QR Code
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<%@ attribute name="showLastName" required="false" type="java.lang.Boolean" %>
<%@ attribute name="showTerminalList" required="false" type="java.lang.Boolean" %>
<%@ attribute name="countryCode" required="false" type="java.lang.String" %>
<%@ attribute name="showTelephoneNumber" required="false" type="java.lang.Boolean" %>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="adyen" tagdir="/WEB-INF/tags/addons/adyenv6b2ccheckoutaddon/responsive" %>
Expand Down Expand Up @@ -129,6 +130,18 @@
</label>
</c:if>

<c:if test="${showTelephoneNumber}">
<label for="p_method_adyen_hpp_${brandCode}_telephonenumber">
<span>
<spring:theme code="payment.method.telephonenumber"/>
</span>
<input id="p_method_adyen_hpp_${brandCode}_telephonenumber"
type="text"
name="telephoneNumber"
value="${cartData.deliveryAddress.phone}">
</label>
</c:if>

<c:if test="${brandCode eq 'afterpay_default'}">
<div id="afterpay-container"></div>
</c:if>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
<spring:url value="/checkout/multi/adyen/summary/placeOrder" var="placeOrderUrl"/>
<spring:url value="/checkout/multi/termsAndConditions" var="getTermsAndConditionsUrl"/>

<c:set var="componentsWithPayButton" value="amazonpay,applepay,paypal,paywithgoogle,pix" />

<%-- Components --%>
<c:if test="${selectedPaymentMethod eq 'paypal' || selectedPaymentMethod eq 'applepay' || selectedPaymentMethod eq 'pix' || selectedPaymentMethod eq 'paywithgoogle'}">
<c:if test="${fn:contains(componentsWithPayButton, selectedPaymentMethod)}">
<div class="checkbox">
<label>
<input type="checkbox" id="terms-conditions-check-${label}" />
Expand All @@ -29,7 +31,7 @@
<div id="pix-container-${label}"></div>
</c:when>
<c:otherwise>
<%-- Render Paypal, Apple or Google Pay button --%>
<%-- Render payment button --%>
<div id="adyen-component-button-container-${label}"></div>
</c:otherwise>
</c:choose>
Expand All @@ -43,7 +45,7 @@
</c:if>

<%-- For components that do not have it's own button --%>
<c:if test="${selectedPaymentMethod ne 'paypal' && selectedPaymentMethod ne 'applepay' && selectedPaymentMethod ne 'pix' && selectedPaymentMethod ne 'paywithgoogle'}">
<c:if test="${not fn:contains(componentsWithPayButton, selectedPaymentMethod)}">
<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 @@ -55,6 +55,11 @@
AdyenCheckoutHybris.initiateGooglePay(amountJS, "${merchantAccount}", "hidden-xs");
AdyenCheckoutHybris.initiateGooglePay(amountJS, "${merchantAccount}", "visible-xs");
</c:when>
<c:when test="${selectedPaymentMethod eq 'amazonpay'}">
var amountJS = {value: "${amount.value}", currency: "${amount.currency}"};
AdyenCheckoutHybris.initiateAmazonPay(amountJS, ${deliveryAddress}, ${amazonPayConfiguration});
</c:when>
<%-- API only payments methods --%>
<c:otherwise>
Expand Down Expand Up @@ -89,7 +94,7 @@
<multi-checkout:orderTotals cartData="${cartData}" showTaxEstimate="${showTaxEstimate}" showTax="${showTax}" subtotalsCssClasses="dark"/>
</div>
</div>
<div class="place-order-form hidden-xs">
<div id="adyen-checkout-hidden-xs" class="place-order-form hidden-xs">
<adyen:checkoutOrderSummary paymentMethod="${selectedPaymentMethod}" label="hidden-xs"/>
</div>
</ycommerce:testId>
Expand Down Expand Up @@ -125,7 +130,7 @@
</ycommerce:testId>
</div>

<div class="visible-xs clearfix">
<div id="adyen-checkout-visible-xs" class="visible-xs clearfix">
<adyen:checkoutOrderSummary paymentMethod="${selectedPaymentMethod}" label="visible-xs"/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@
showLastName="${paymentMethod.type=='pix'}"
showSocialSecurityNumber="${showSocialSecurityNumber || paymentMethod.type=='pix'}"
countryCode="${countryCode}"
showTelephoneNumber="${paymentMethod.type=='paybright'}"
/>
</c:forEach>

Expand Down
Loading

0 comments on commit f10e9ca

Please sign in to comment.