diff --git a/src/main/java/cl/transbank/patpass/PatpassByWebpayTransaction.java b/src/main/java/cl/transbank/patpass/PatpassByWebpayTransaction.java index 3d090d5..f8a5baf 100644 --- a/src/main/java/cl/transbank/patpass/PatpassByWebpayTransaction.java +++ b/src/main/java/cl/transbank/patpass/PatpassByWebpayTransaction.java @@ -26,8 +26,19 @@ public PatpassByWebpayTransactionCreateResponse create( String expirationDate, String commerceMail, boolean ufFlag) throws IOException, TransactionCreateException { String endpoint = String.format("%s/transactions", ApiConstants.WEBPAY_ENDPOINT); final TransactionCreateRequest request = new TransactionCreateRequest(buyOrder, sessionId, amount, returnUrl); - request.setDetails(serviceId, cardHolderId, cardHolderName, cardHolderLastName1, cardHolderLastName2, - cardHolderMail, cellphoneNumber, expirationDate, commerceMail, ufFlag); + TransactionCreateRequest.Detail transactionDetails = request.new Detail(); + transactionDetails.setServiceId(serviceId); + transactionDetails.setCardHolderId(cardHolderId); + transactionDetails.setCardHolderName(cardHolderName); + transactionDetails.setCardHolderLastName1(cardHolderLastName1); + transactionDetails.setCardHolderLastName2(cardHolderLastName2); + transactionDetails.setCardHolderMail(cardHolderMail); + transactionDetails.setCellphoneNumber(cellphoneNumber); + transactionDetails.setExpirationDate(expirationDate); + transactionDetails.setCommerceMail(commerceMail); + transactionDetails.setUfFlag(ufFlag); + + request.setDetails(transactionDetails); try { return WebpayApiResource.execute(endpoint, HttpUtil.RequestMethod.POST, request, options, PatpassByWebpayTransactionCreateResponse.class); } catch (TransbankException e) { diff --git a/src/main/java/cl/transbank/patpass/requests/TransactionCreateRequest.java b/src/main/java/cl/transbank/patpass/requests/TransactionCreateRequest.java index 0f49a1e..75e2984 100644 --- a/src/main/java/cl/transbank/patpass/requests/TransactionCreateRequest.java +++ b/src/main/java/cl/transbank/patpass/requests/TransactionCreateRequest.java @@ -41,31 +41,8 @@ public class TransactionCreateRequest extends WebpayApiRequest { * @param ufFlag The UF flag. */ - public void setDetails( - String serviceId, - String cardHolderId, - String cardHolderName, - String cardHolderLastName1, - String cardHolderLastName2, - String cardHolderMail, - String cellphoneNumber, - String expirationDate, - String commerceMail, - boolean ufFlag - ) { - wpmDetail = - new Detail( - serviceId, - cardHolderId, - cardHolderName, - cardHolderLastName1, - cardHolderLastName2, - cardHolderMail, - cellphoneNumber, - expirationDate, - commerceMail, - ufFlag - ); + public void setDetails(Detail detail) { + wpmDetail = detail; } /** @@ -88,5 +65,85 @@ public class Detail { private String expirationDate; private String commerceMail; private boolean ufFlag; + + public String getServiceId() { + return serviceId; + } + + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + + public String getCardHolderId() { + return cardHolderId; + } + + public void setCardHolderId(String cardHolderId) { + this.cardHolderId = cardHolderId; + } + + public String getCardHolderName() { + return cardHolderName; + } + + public void setCardHolderName(String cardHolderName) { + this.cardHolderName = cardHolderName; + } + + public String getCardHolderLastName1() { + return cardHolderLastName1; + } + + public void setCardHolderLastName1(String cardHolderLastName1) { + this.cardHolderLastName1 = cardHolderLastName1; + } + + public String getCardHolderLastName2() { + return cardHolderLastName2; + } + + public void setCardHolderLastName2(String cardHolderLastName2) { + this.cardHolderLastName2 = cardHolderLastName2; + } + + public String getCardHolderMail() { + return cardHolderMail; + } + + public void setCardHolderMail(String cardHolderMail) { + this.cardHolderMail = cardHolderMail; + } + + public String getCellphoneNumber() { + return cellphoneNumber; + } + + public void setCellphoneNumber(String cellphoneNumber) { + this.cellphoneNumber = cellphoneNumber; + } + + public String getExpirationDate() { + return expirationDate; + } + + public void setExpirationDate(String expirationDate) { + this.expirationDate = expirationDate; + } + + public String getCommerceMail() { + return commerceMail; + } + + public void setCommerceMail(String commerceMail) { + this.commerceMail = commerceMail; + } + + public boolean isUfFlag() { + return ufFlag; + } + + public void setUfFlag(boolean ufFlag) { + this.ufFlag = ufFlag; + } } }