Skip to content

Commit

Permalink
Merge pull request #476 from Adyen/feature/AD-336b
Browse files Browse the repository at this point in the history
AD-336: Google Express Payments, fix for java-lib update
  • Loading branch information
kpieloch authored Nov 5, 2024
2 parents 5f26356 + 47a4d07 commit 796fcc3
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
import com.adyen.commerce.constants.AdyenoccConstants;
import com.adyen.commerce.request.GooglePayExpressCartRequest;
import com.adyen.commerce.request.GooglePayExpressPDPRequest;
import com.adyen.commerce.request.PlaceOrderRequest;
import com.adyen.commerce.resolver.PaymentRedirectReturnUrlResolver;
import com.adyen.commerce.response.OCCPlaceOrderResponse;
import com.adyen.model.checkout.CheckoutPaymentMethod;
import com.adyen.model.checkout.GooglePayDetails;
import com.adyen.model.checkout.PaymentRequest;
import com.adyen.v6.constants.Adyenv6coreConstants;
import com.adyen.v6.facades.AdyenExpressCheckoutFacade;
Expand Down Expand Up @@ -50,8 +52,11 @@ public class GooglePayExpressCheckoutController extends ExpressCheckoutControlle
@Operation(operationId = "placeOrderGooglePayExpressPDP", summary = "Handle googlePayExpress place order request", description =
"Places order based on request data")
@ApiBaseSiteIdUserIdAndCartIdParam
public ResponseEntity<String> googlePayCartExpressCheckout(final HttpServletRequest request, @RequestBody GooglePayExpressPDPRequest googlePayExpressPDPRequest) throws Exception {
public ResponseEntity<String> googlePayCartExpressCheckoutPDP(final HttpServletRequest request, @RequestBody String googlePayExpressPDPRequestString) throws Exception {
GooglePayExpressPDPRequest googlePayExpressPDPRequest = objectMapper.readValue(googlePayExpressPDPRequestString, GooglePayExpressPDPRequest.class);

PaymentRequest paymentRequest = new PaymentRequest();
googlePayExpressPDPRequest.getGooglePayDetails().setType(GooglePayDetails.TypeEnum.GOOGLEPAY);
paymentRequest.setPaymentMethod(new CheckoutPaymentMethod(googlePayExpressPDPRequest.getGooglePayDetails()));

OCCPlaceOrderResponse placeOrderResponse = handlePayment(request, paymentRequest, Adyenv6coreConstants.PAYMENT_METHOD_GOOGLE_PAY, googlePayExpressPDPRequest.getAddressData(), googlePayExpressPDPRequest.getProductCode(), true);
Expand All @@ -64,8 +69,10 @@ public ResponseEntity<String> googlePayCartExpressCheckout(final HttpServletRequ
@Operation(operationId = "placeOrderGooglePayExpressCart", summary = "Handle googlePayExpress place order request", description =
"Places order based on request data")
@ApiBaseSiteIdUserIdAndCartIdParam
public ResponseEntity<String> googlePayCartExpressCheckout(final HttpServletRequest request, @RequestBody GooglePayExpressCartRequest googlePayExpressCartRequest) throws Exception {
public ResponseEntity<String> googlePayCartExpressCheckoutCart(final HttpServletRequest request, @RequestBody String googlePayExpressCartRequestString) throws Exception {
GooglePayExpressCartRequest googlePayExpressCartRequest = objectMapper.readValue(googlePayExpressCartRequestString, GooglePayExpressCartRequest.class);
PaymentRequest paymentRequest = new PaymentRequest();
googlePayExpressCartRequest.getGooglePayDetails().setType(GooglePayDetails.TypeEnum.GOOGLEPAY);
paymentRequest.setPaymentMethod(new CheckoutPaymentMethod(googlePayExpressCartRequest.getGooglePayDetails()));

OCCPlaceOrderResponse placeOrderResponse = handlePayment(request, paymentRequest, Adyenv6coreConstants.PAYMENT_METHOD_GOOGLE_PAY, googlePayExpressCartRequest.getAddressData(), null, false);
Expand Down

0 comments on commit 796fcc3

Please sign in to comment.