com.cardpay.sdk.model.AuthDataRequest Maven / Gradle / Ivy
/*
* CardPay REST API
* Welcome to the CardPay REST API. The CardPay API uses HTTP verbs and a [REST](https://en.wikipedia.org/wiki/Representational_state_transfer) resources endpoint structure (see more info about REST). Request and response payloads are formatted as JSON. Merchant uses API to create payments, refunds, payouts or recurrings, check or update transaction status and get information about created transactions. In API authentication process based on [OAuth 2.0](https://oauth.net/2/) standard. For recent changes see changelog section.
*
* OpenAPI spec version: 3.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package com.cardpay.sdk.model;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import lombok.Data;
@Data
public class AuthDataRequest {
@SerializedName("amount")
private BigDecimal amount = null;
@SerializedName("currency")
private String currency = null;
@SerializedName("dynamic_descriptor")
private String dynamicDescriptor = null;
@SerializedName("generate_token")
private Boolean generateToken = null;
@SerializedName("installment_amount")
private BigDecimal installmentAmount = null;
@SerializedName("installment_type")
private String installmentType = null;
@SerializedName("installments")
private List installments = null;
@SerializedName("note")
private String note = null;
@SerializedName("recurring_data")
private RecurringData recurringData = null;
@SerializedName("sca_exemption")
private String scaExemption = null;
@SerializedName("three_ds_challenge_indicator")
private String threeDsChallengeIndicator = null;
@SerializedName("trans_type")
private String transType = null;
/**
* Gets or Sets type
*/
@JsonAdapter(TypeEnum.Adapter.class)
public enum TypeEnum {
AVS("AVS"),
THREE_DS_PA("THREE_DS_PA"),
THREE_DS_NPA("THREE_DS_NPA");
private String value;
TypeEnum(String value) {
this.value = value;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static TypeEnum fromValue(String text) {
for (TypeEnum b : TypeEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
public static class Adapter extends TypeAdapter {
@Override
public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public TypeEnum read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return TypeEnum.fromValue(String.valueOf(value));
}
}
}
@SerializedName("type")
private TypeEnum type = null;
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
/**
* @param amount The total invoice amount in selected currency with dot as a decimal separator, must be less than 10 billion
* @return bean instance
**/
public AuthDataRequest amount(BigDecimal amount) {
this.amount = amount;
return this;
}
public void setCurrency(String currency) {
this.currency = currency;
}
/**
* @param currency [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code
* @return bean instance
**/
public AuthDataRequest currency(String currency) {
this.currency = currency;
return this;
}
public void setDynamicDescriptor(String dynamicDescriptor) {
this.dynamicDescriptor = dynamicDescriptor;
}
/**
* @param dynamicDescriptor dynamicDescriptor
* @return bean instance
**/
public AuthDataRequest dynamicDescriptor(String dynamicDescriptor) {
this.dynamicDescriptor = dynamicDescriptor;
return this;
}
public void setGenerateToken(Boolean generateToken) {
this.generateToken = generateToken;
}
/**
* @param generateToken If set to `true`, token will be generated and returned in the response (callback). Token can be generated only for successful transactions (not for declined transactions) *(for BANKCARD payment method only)*
* @return bean instance
**/
public AuthDataRequest generateToken(Boolean generateToken) {
this.generateToken = generateToken;
return this;
}
public void setInstallmentAmount(BigDecimal installmentAmount) {
this.installmentAmount = installmentAmount;
}
/**
* @param installmentAmount Amount of 1 installment authentication, should be less or equal to total amount of subscription, can have dot as a decimal separator. Mandatory for Payment Page Mode only.
* @return bean instance
**/
public AuthDataRequest installmentAmount(BigDecimal installmentAmount) {
this.installmentAmount = installmentAmount;
return this;
}
public void setInstallmentType(String installmentType) {
this.installmentType = installmentType;
}
/**
* @param installmentType Installment type, 2 possible values: `IF` - issuer financed `MF_HOLD' - merchant financed. For installment subscription with hold rest amount.
* @return bean instance
**/
public AuthDataRequest installmentType(String installmentType) {
this.installmentType = installmentType;
return this;
}
public void setInstallments(List installments) {
this.installments = installments;
}
/**
* @param installments Number of total installment payments, to be charged per defined interval. For installment subscription with installment_type = `MF_HOLD` can be 1-12. For installment subscription with installment_type = `IF` can be 1-99.
* @return bean instance
**/
public AuthDataRequest installments(List installments) {
this.installments = installments;
return this;
}
public AuthDataRequest addInstallmentsItem(Integer installmentsItem) {
if (this.installments == null) {
this.installments = new ArrayList<>();
}
this.installments.add(installmentsItem);
return this;
}
public void setNote(String note) {
this.note = note;
}
/**
* @param note Note about the authentication, not shown to Customer
* @return bean instance
**/
public AuthDataRequest note(String note) {
this.note = note;
return this;
}
public void setRecurringData(RecurringData recurringData) {
this.recurringData = recurringData;
}
/**
* @param recurringData Recurring data
* @return bean instance
**/
public AuthDataRequest recurringData(RecurringData recurringData) {
this.recurringData = recurringData;
return this;
}
public void setScaExemption(String scaExemption) {
this.scaExemption = scaExemption;
}
/**
* @param scaExemption Indicates the exemption type that you want to request for the authentication. Possible value: LOW_VALUE
* @return bean instance
**/
public AuthDataRequest scaExemption(String scaExemption) {
this.scaExemption = scaExemption;
return this;
}
public void setThreeDsChallengeIndicator(String threeDsChallengeIndicator) {
this.threeDsChallengeIndicator = threeDsChallengeIndicator;
}
/**
* @param threeDsChallengeIndicator threeDsChallengeIndicator
* @return bean instance
**/
public AuthDataRequest threeDsChallengeIndicator(String threeDsChallengeIndicator) {
this.threeDsChallengeIndicator = threeDsChallengeIndicator;
return this;
}
public void setTransType(String transType) {
this.transType = transType;
}
/**
* @param transType Identifies the type of transaction being authenticated.
* @return bean instance
**/
public AuthDataRequest transType(String transType) {
this.transType = transType;
return this;
}
public void setType(TypeEnum type) {
this.type = type;
}
/**
* @param type type
* @return bean instance
**/
public AuthDataRequest type(TypeEnum type) {
this.type = type;
return this;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("AuthDataRequest( ");
if (amount != null) sb.append("amount=").append(amount.toString()).append("; ");
if (currency != null) sb.append("currency=").append(currency.toString()).append("; ");
if (dynamicDescriptor != null) sb.append("dynamicDescriptor=").append(dynamicDescriptor.toString()).append("; ");
if (generateToken != null) sb.append("generateToken=").append(generateToken.toString()).append("; ");
if (installmentAmount != null) sb.append("installmentAmount=").append(installmentAmount.toString()).append("; ");
if (installmentType != null) sb.append("installmentType=").append(installmentType.toString()).append("; ");
if (installments != null) sb.append("installments=").append(installments.toString()).append("; ");
if (note != null) sb.append("note=").append(note.toString()).append("; ");
if (recurringData != null) sb.append("recurringData=").append(recurringData.toString()).append("; ");
if (scaExemption != null) sb.append("scaExemption=").append(scaExemption.toString()).append("; ");
if (threeDsChallengeIndicator != null) sb.append("threeDsChallengeIndicator=").append(threeDsChallengeIndicator.toString()).append("; ");
if (transType != null) sb.append("transType=").append(transType.toString()).append("; ");
if (type != null) sb.append("type=").append(type.toString()).append("; ");
sb.append(")");
return sb.toString();
}
}