com.safecharge.request.CardDetailsRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of safecharge-sdk-java Show documentation
Show all versions of safecharge-sdk-java Show documentation
SafeCharge’s REST API SDK for Java provides developer tools for accessing Safecharge's REST API. SafeCharge’s REST API is a simple,
easy to use, secure and stateless API, which enables online merchants and service providers to process consumer payments through SafeCharge’s
payment gateway. The API supports merchants of all levels of PCI certification, from their online and mobile merchant applications, and is
compatible with a large variety of payment options, i.e. payment cards, alternative payment methods, etc.
package com.safecharge.request;
import javax.validation.ConstraintViolationException;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import com.safecharge.request.builder.SafechargeBuilder;
import com.safecharge.util.APIConstants;
import com.safecharge.util.Constants;
import com.safecharge.util.ValidChecksum;
import com.safecharge.util.ValidationUtils;
/**
* Copyright (C) 2007-2020 SafeCharge International Group Limited.
*
* A request used to retrieve card details such as card brand and type. It will also return amount info.
*
* see getCardDetails
*
* @since 7/27/2020
*/
@ValidChecksum(orderMappingName = Constants.ChecksumOrderMapping.API_GENERIC_CHECKSUM_MAPPING)
public class CardDetailsRequest extends SafechargeRequest {
@Size(max = 45)
private String clientUniqueId;
@NotNull
@Size(min = 6, max = APIConstants.CREDIT_CARD_MAX_LENGTH)
private String cardNumber;
public String getClientUniqueId() {
return clientUniqueId;
}
public void setClientUniqueId(String clientUniqueId) {
this.clientUniqueId = clientUniqueId;
}
public String getCardNumber() {
return cardNumber;
}
public void setCardNumber(String cardNumber) {
this.cardNumber = cardNumber;
}
public static Builder builder() {
return new Builder();
}
@Override
public String toString() {
return "GetCardDetailsRequest{" +
"clientUniqueId='" + clientUniqueId + '\'' +
", cardNumber='" + cardNumber + '\'' + super.toString() +
'}';
}
public static class Builder extends SafechargeBuilder {
private String clientUniqueId;
private String cardNumber;
public Builder addClientUniqueId(String clientUniqueId) {
this.clientUniqueId = clientUniqueId;
return this;
}
public Builder addCardNumber(String cardNumber) {
this.cardNumber = cardNumber;
return this;
}
/**
* {@inheritDoc}
*/
@Override
public CardDetailsRequest build() throws ConstraintViolationException {
CardDetailsRequest request = new CardDetailsRequest();
request.setClientUniqueId(clientUniqueId);
request.setCardNumber(cardNumber);
return ValidationUtils.validate(super.build(request));
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy