Skip to content

Commit

Permalink
Revert "refactor: use build pattern to avoid methods with more than 4…
Browse files Browse the repository at this point in the history
… arguments"

This reverts commit 53bed13.
  • Loading branch information
tribiec committed Mar 22, 2024
1 parent 8eaa05d commit bfcb878
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 15 deletions.
15 changes: 2 additions & 13 deletions src/main/java/cl/transbank/patpass/PatpassByWebpayTransaction.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,8 @@ 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);
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);
request.setDetails(serviceId, cardHolderId, cardHolderName, cardHolderLastName1, cardHolderLastName2,
cardHolderMail, cellphoneNumber, expirationDate, commerceMail, ufFlag);
try {
return WebpayApiResource.execute(endpoint, HttpUtil.RequestMethod.POST, request, options, PatpassByWebpayTransactionCreateResponse.class);
} catch (TransbankException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,31 @@ public class TransactionCreateRequest extends WebpayApiRequest {
* @param detail The details for the transaction.
*/

public void setDetails(Detail detail) {
wpmDetail = detail;
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
);
}

/**
Expand Down

0 comments on commit bfcb878

Please sign in to comment.