@Test public void testTerminalApiPaymentRequestWithRecurring() throws Exception { TerminalAPIRequest terminalApiRequest = adyenRequestFactory.createTerminalAPIRequest(cartDataMock, customerModelMock, RecurringContractMode.ONECLICK_RECURRING, SERVICE_ID); validateTerminalApiPaymentRequest(terminalApiRequest); assertNotNull(terminalApiRequest.getSaleToPOIRequest().getPaymentRequest().getSaleData().getSaleToAcquirerData()); SaleToAcquirerData saleToAcquirerData = terminalApiRequest.getSaleToPOIRequest().getPaymentRequest().getSaleData().getSaleToAcquirerData(); assertTrue(saleToAcquirerData.getRecurringContract().equals( Recurring.ContractEnum.ONECLICK_RECURRING.toString())); assertTrue(saleToAcquirerData.getShopperEmail().equals(CUSTOMER_EMAIL)); assertTrue(saleToAcquirerData.getShopperReference().equals(CUSTOMER_ID)); }
public TerminalAPIRequest createTerminalAPIRequest(final CartData cartData, CustomerModel customer, RecurringContractMode recurringContractMode, String serviceId) throws Exception { com.adyen.model.nexo.PaymentRequest paymentRequest = new com.adyen.model.nexo.PaymentRequest(); SaleData saleData = new SaleData(); TransactionIdentification transactionIdentification = new TransactionIdentification(); transactionIdentification.setTransactionID(cartData.getCode()); XMLGregorianCalendar timestamp = DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar()); transactionIdentification.setTimeStamp(timestamp); saleData.setSaleTransactionID(transactionIdentification); if(customer != null) { String shopperReference = customer.getCustomerID(); String shopperEmail = customer.getContactEmail(); Recurring recurringContract = getRecurringContractType(recurringContractMode); SaleToAcquirerData saleToAcquirerData = new SaleToAcquirerData(); if (recurringContract != null && StringUtils.isNotEmpty(shopperReference) && StringUtils.isNotEmpty(shopperEmail)) { saleToAcquirerData.setShopperEmail(shopperEmail); saleToAcquirerData.setShopperReference(shopperReference); saleToAcquirerData.setRecurringContract(recurringContract.getContract().toString()); } updateApplicationInfoPos(saleToAcquirerData.getApplicationInfo()); saleData.setSaleToAcquirerData(saleToAcquirerData); } paymentRequest.setSaleData(saleData); PaymentTransaction paymentTransaction = new PaymentTransaction(); AmountsReq amountsReq = new AmountsReq(); amountsReq.setCurrency(cartData.getTotalPrice().getCurrencyIso()); amountsReq.setRequestedAmount(cartData.getTotalPrice().getValue()); paymentTransaction.setAmountsReq(amountsReq); paymentRequest.setPaymentTransaction(paymentTransaction); TerminalAPIRequestBuilder builder = new TerminalAPIRequestBuilder(cartData.getStore(), serviceId, cartData.getAdyenTerminalId()); builder.withPaymentRequest(paymentRequest); return builder.build(); }
AdyenRequestFactory { public TerminalAPIRequest createTerminalAPIRequest(final CartData cartData, CustomerModel customer, RecurringContractMode recurringContractMode, String serviceId) throws Exception { com.adyen.model.nexo.PaymentRequest paymentRequest = new com.adyen.model.nexo.PaymentRequest(); SaleData saleData = new SaleData(); TransactionIdentification transactionIdentification = new TransactionIdentification(); transactionIdentification.setTransactionID(cartData.getCode()); XMLGregorianCalendar timestamp = DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar()); transactionIdentification.setTimeStamp(timestamp); saleData.setSaleTransactionID(transactionIdentification); if(customer != null) { String shopperReference = customer.getCustomerID(); String shopperEmail = customer.getContactEmail(); Recurring recurringContract = getRecurringContractType(recurringContractMode); SaleToAcquirerData saleToAcquirerData = new SaleToAcquirerData(); if (recurringContract != null && StringUtils.isNotEmpty(shopperReference) && StringUtils.isNotEmpty(shopperEmail)) { saleToAcquirerData.setShopperEmail(shopperEmail); saleToAcquirerData.setShopperReference(shopperReference); saleToAcquirerData.setRecurringContract(recurringContract.getContract().toString()); } updateApplicationInfoPos(saleToAcquirerData.getApplicationInfo()); saleData.setSaleToAcquirerData(saleToAcquirerData); } paymentRequest.setSaleData(saleData); PaymentTransaction paymentTransaction = new PaymentTransaction(); AmountsReq amountsReq = new AmountsReq(); amountsReq.setCurrency(cartData.getTotalPrice().getCurrencyIso()); amountsReq.setRequestedAmount(cartData.getTotalPrice().getValue()); paymentTransaction.setAmountsReq(amountsReq); paymentRequest.setPaymentTransaction(paymentTransaction); TerminalAPIRequestBuilder builder = new TerminalAPIRequestBuilder(cartData.getStore(), serviceId, cartData.getAdyenTerminalId()); builder.withPaymentRequest(paymentRequest); return builder.build(); } }
AdyenRequestFactory { public TerminalAPIRequest createTerminalAPIRequest(final CartData cartData, CustomerModel customer, RecurringContractMode recurringContractMode, String serviceId) throws Exception { com.adyen.model.nexo.PaymentRequest paymentRequest = new com.adyen.model.nexo.PaymentRequest(); SaleData saleData = new SaleData(); TransactionIdentification transactionIdentification = new TransactionIdentification(); transactionIdentification.setTransactionID(cartData.getCode()); XMLGregorianCalendar timestamp = DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar()); transactionIdentification.setTimeStamp(timestamp); saleData.setSaleTransactionID(transactionIdentification); if(customer != null) { String shopperReference = customer.getCustomerID(); String shopperEmail = customer.getContactEmail(); Recurring recurringContract = getRecurringContractType(recurringContractMode); SaleToAcquirerData saleToAcquirerData = new SaleToAcquirerData(); if (recurringContract != null && StringUtils.isNotEmpty(shopperReference) && StringUtils.isNotEmpty(shopperEmail)) { saleToAcquirerData.setShopperEmail(shopperEmail); saleToAcquirerData.setShopperReference(shopperReference); saleToAcquirerData.setRecurringContract(recurringContract.getContract().toString()); } updateApplicationInfoPos(saleToAcquirerData.getApplicationInfo()); saleData.setSaleToAcquirerData(saleToAcquirerData); } paymentRequest.setSaleData(saleData); PaymentTransaction paymentTransaction = new PaymentTransaction(); AmountsReq amountsReq = new AmountsReq(); amountsReq.setCurrency(cartData.getTotalPrice().getCurrencyIso()); amountsReq.setRequestedAmount(cartData.getTotalPrice().getValue()); paymentTransaction.setAmountsReq(amountsReq); paymentRequest.setPaymentTransaction(paymentTransaction); TerminalAPIRequestBuilder builder = new TerminalAPIRequestBuilder(cartData.getStore(), serviceId, cartData.getAdyenTerminalId()); builder.withPaymentRequest(paymentRequest); return builder.build(); }  }
AdyenRequestFactory { public TerminalAPIRequest createTerminalAPIRequest(final CartData cartData, CustomerModel customer, RecurringContractMode recurringContractMode, String serviceId) throws Exception { com.adyen.model.nexo.PaymentRequest paymentRequest = new com.adyen.model.nexo.PaymentRequest(); SaleData saleData = new SaleData(); TransactionIdentification transactionIdentification = new TransactionIdentification(); transactionIdentification.setTransactionID(cartData.getCode()); XMLGregorianCalendar timestamp = DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar()); transactionIdentification.setTimeStamp(timestamp); saleData.setSaleTransactionID(transactionIdentification); if(customer != null) { String shopperReference = customer.getCustomerID(); String shopperEmail = customer.getContactEmail(); Recurring recurringContract = getRecurringContractType(recurringContractMode); SaleToAcquirerData saleToAcquirerData = new SaleToAcquirerData(); if (recurringContract != null && StringUtils.isNotEmpty(shopperReference) && StringUtils.isNotEmpty(shopperEmail)) { saleToAcquirerData.setShopperEmail(shopperEmail); saleToAcquirerData.setShopperReference(shopperReference); saleToAcquirerData.setRecurringContract(recurringContract.getContract().toString()); } updateApplicationInfoPos(saleToAcquirerData.getApplicationInfo()); saleData.setSaleToAcquirerData(saleToAcquirerData); } paymentRequest.setSaleData(saleData); PaymentTransaction paymentTransaction = new PaymentTransaction(); AmountsReq amountsReq = new AmountsReq(); amountsReq.setCurrency(cartData.getTotalPrice().getCurrencyIso()); amountsReq.setRequestedAmount(cartData.getTotalPrice().getValue()); paymentTransaction.setAmountsReq(amountsReq); paymentRequest.setPaymentTransaction(paymentTransaction); TerminalAPIRequestBuilder builder = new TerminalAPIRequestBuilder(cartData.getStore(), serviceId, cartData.getAdyenTerminalId()); builder.withPaymentRequest(paymentRequest); return builder.build(); }  PaymentRequest3d create3DAuthorizationRequest(final String merchantAccount, final HttpServletRequest request, final String md, final String paRes); @Deprecated PaymentRequest createAuthorizationRequest(final String merchantAccount,
                                                     final CartData cartData,
                                                     final HttpServletRequest request,
                                                     final CustomerModel customerModel,
                                                     final RecurringContractMode recurringContractMode); PaymentsDetailsRequest create3DPaymentsRequest(final String paymentData, final String md, final String paRes); PaymentsDetailsRequest create3DS2PaymentsRequest(final String paymentData, final String token, String type); PaymentsRequest createPaymentsRequest(final String merchantAccount,
                                                 final CartData cartData,
                                                 final RequestInfo requestInfo,
                                                 final CustomerModel customerModel,
                                                 final RecurringContractMode recurringContractMode); PaymentsRequest createPaymentsRequest(final String merchantAccount,
                                                 final CartData cartData,
                                                 final PaymentMethodDetails paymentMethodDetails,
                                                 final RequestInfo requestInfo,
                                                 final CustomerModel customerModel); PaymentsRequest enhanceForThreeDS2(PaymentsRequest paymentsRequest, CartData cartData); BrowserInfo updateBrowserInfoFromRequest(BrowserInfo browserInfo, PaymentsRequest paymentsRequest); ApplicationInfo updateApplicationInfoEcom(ApplicationInfo applicationInfo); ApplicationInfo updateApplicationInfoPos(ApplicationInfo applicationInfo); CaptureRequest createCaptureRequest(final String merchantAccount, final BigDecimal amount, final Currency currency, final String authReference, final String merchantReference); CancelOrRefundRequest createCancelOrRefundRequest(final String merchantAccount, final String authReference, final String merchantReference); RefundRequest createRefundRequest(final String merchantAccount, final BigDecimal amount, final Currency currency, final String authReference, final String merchantReference); RecurringDetailsRequest createListRecurringDetailsRequest(final String merchantAccount, final String customerId); DisableRequest createDisableRequest(final String merchantAccount, final String customerId, final String recurringReference); TerminalAPIRequest createTerminalAPIRequestForStatus(final CartData cartData, String originalServiceId); TerminalAPIRequest createTerminalAPIRequest(final CartData cartData, CustomerModel customer, RecurringContractMode recurringContractMode, String serviceId); void setOpenInvoiceData(PaymentRequest paymentRequest, CartData cartData, final CustomerModel customerModel); void setOpenInvoiceData(PaymentsRequest paymentsRequest, CartData cartData); ConfigurationService getConfigurationService(); void setConfigurationService(ConfigurationService configurationService); }
AdyenRequestFactory { public TerminalAPIRequest createTerminalAPIRequest(final CartData cartData, CustomerModel customer, RecurringContractMode recurringContractMode, String serviceId) throws Exception { com.adyen.model.nexo.PaymentRequest paymentRequest = new com.adyen.model.nexo.PaymentRequest(); SaleData saleData = new SaleData(); TransactionIdentification transactionIdentification = new TransactionIdentification(); transactionIdentification.setTransactionID(cartData.getCode()); XMLGregorianCalendar timestamp = DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar()); transactionIdentification.setTimeStamp(timestamp); saleData.setSaleTransactionID(transactionIdentification); if(customer != null) { String shopperReference = customer.getCustomerID(); String shopperEmail = customer.getContactEmail(); Recurring recurringContract = getRecurringContractType(recurringContractMode); SaleToAcquirerData saleToAcquirerData = new SaleToAcquirerData(); if (recurringContract != null && StringUtils.isNotEmpty(shopperReference) && StringUtils.isNotEmpty(shopperEmail)) { saleToAcquirerData.setShopperEmail(shopperEmail); saleToAcquirerData.setShopperReference(shopperReference); saleToAcquirerData.setRecurringContract(recurringContract.getContract().toString()); } updateApplicationInfoPos(saleToAcquirerData.getApplicationInfo()); saleData.setSaleToAcquirerData(saleToAcquirerData); } paymentRequest.setSaleData(saleData); PaymentTransaction paymentTransaction = new PaymentTransaction(); AmountsReq amountsReq = new AmountsReq(); amountsReq.setCurrency(cartData.getTotalPrice().getCurrencyIso()); amountsReq.setRequestedAmount(cartData.getTotalPrice().getValue()); paymentTransaction.setAmountsReq(amountsReq); paymentRequest.setPaymentTransaction(paymentTransaction); TerminalAPIRequestBuilder builder = new TerminalAPIRequestBuilder(cartData.getStore(), serviceId, cartData.getAdyenTerminalId()); builder.withPaymentRequest(paymentRequest); return builder.build(); }  PaymentRequest3d create3DAuthorizationRequest(final String merchantAccount, final HttpServletRequest request, final String md, final String paRes); @Deprecated PaymentRequest createAuthorizationRequest(final String merchantAccount,
                                                     final CartData cartData,
                                                     final HttpServletRequest request,
                                                     final CustomerModel customerModel,
                                                     final RecurringContractMode recurringContractMode); PaymentsDetailsRequest create3DPaymentsRequest(final String paymentData, final String md, final String paRes); PaymentsDetailsRequest create3DS2PaymentsRequest(final String paymentData, final String token, String type); PaymentsRequest createPaymentsRequest(final String merchantAccount,
                                                 final CartData cartData,
                                                 final RequestInfo requestInfo,
                                                 final CustomerModel customerModel,
                                                 final RecurringContractMode recurringContractMode); PaymentsRequest createPaymentsRequest(final String merchantAccount,
                                                 final CartData cartData,
                                                 final PaymentMethodDetails paymentMethodDetails,
                                                 final RequestInfo requestInfo,
                                                 final CustomerModel customerModel); PaymentsRequest enhanceForThreeDS2(PaymentsRequest paymentsRequest, CartData cartData); BrowserInfo updateBrowserInfoFromRequest(BrowserInfo browserInfo, PaymentsRequest paymentsRequest); ApplicationInfo updateApplicationInfoEcom(ApplicationInfo applicationInfo); ApplicationInfo updateApplicationInfoPos(ApplicationInfo applicationInfo); CaptureRequest createCaptureRequest(final String merchantAccount, final BigDecimal amount, final Currency currency, final String authReference, final String merchantReference); CancelOrRefundRequest createCancelOrRefundRequest(final String merchantAccount, final String authReference, final String merchantReference); RefundRequest createRefundRequest(final String merchantAccount, final BigDecimal amount, final Currency currency, final String authReference, final String merchantReference); RecurringDetailsRequest createListRecurringDetailsRequest(final String merchantAccount, final String customerId); DisableRequest createDisableRequest(final String merchantAccount, final String customerId, final String recurringReference); TerminalAPIRequest createTerminalAPIRequestForStatus(final CartData cartData, String originalServiceId); TerminalAPIRequest createTerminalAPIRequest(final CartData cartData, CustomerModel customer, RecurringContractMode recurringContractMode, String serviceId); void setOpenInvoiceData(PaymentRequest paymentRequest, CartData cartData, final CustomerModel customerModel); void setOpenInvoiceData(PaymentsRequest paymentsRequest, CartData cartData); ConfigurationService getConfigurationService(); void setConfigurationService(ConfigurationService configurationService);  }