com.cardpay.sdk.model.PaymentRequestPaymentData 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 PaymentRequestPaymentData {
@SerializedName("amount")
private BigDecimal amount = null;
@SerializedName("currency")
private String currency = null;
@SerializedName("dynamic_descriptor")
private String dynamicDescriptor = null;
@SerializedName("encrypted_data")
private String encryptedData = null;
@SerializedName("generate_token")
private Boolean generateToken = null;
@SerializedName("hold_period")
private Integer holdPeriod = 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;
/**
* The value contains payment status after hold period if payment has not been completed. Possible values: COMPLETE, REVERSE
*/
@JsonAdapter(PostauthStatusEnum.Adapter.class)
public enum PostauthStatusEnum {
REVERSE("REVERSE"),
COMPLETE("COMPLETE");
private String value;
PostauthStatusEnum(String value) {
this.value = value;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static PostauthStatusEnum fromValue(String text) {
for (PostauthStatusEnum b : PostauthStatusEnum.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 PostauthStatusEnum enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public PostauthStatusEnum read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return PostauthStatusEnum.fromValue(String.valueOf(value));
}
}
}
@SerializedName("postauth_status")
private PostauthStatusEnum postauthStatus = null;
@SerializedName("preauth")
private Boolean preauth = null;
@SerializedName("sca_exemption")
private String scaExemption = null;
@SerializedName("three_ds_challenge_indicator")
private String threeDsChallengeIndicator = null;
@SerializedName("three_ds_mode")
private String threeDsMode = null;
/**
* Gets or Sets transType
*/
@JsonAdapter(TransTypeEnum.Adapter.class)
public enum TransTypeEnum {
_01("01"),
_03("03"),
_10("10"),
_11("11"),
_28("28");
private String value;
TransTypeEnum(String value) {
this.value = value;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static TransTypeEnum fromValue(String text) {
for (TransTypeEnum b : TransTypeEnum.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 TransTypeEnum enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public TransTypeEnum read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return TransTypeEnum.fromValue(String.valueOf(value));
}
}
}
@SerializedName("trans_type")
private TransTypeEnum transType = null;
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
/**
* @param amount The total transaction amount in selected currency with dot as a decimal separator, must be less than 10 billion If 'payment_method' = `BITCOIN` then minimum order amount is approximately 0.003 bitcoins or its equivalent. The exact value should be provided by the account manager.
* @return bean instance
**/
public PaymentRequestPaymentData 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 PaymentRequestPaymentData currency(String currency) {
this.currency = currency;
return this;
}
public void setDynamicDescriptor(String dynamicDescriptor) {
this.dynamicDescriptor = dynamicDescriptor;
}
/**
* @param dynamicDescriptor Short description of the service or product, must be enabled by CardPay manager to be used *(for BANKCARD payment method only)*
* @return bean instance
**/
public PaymentRequestPaymentData dynamicDescriptor(String dynamicDescriptor) {
this.dynamicDescriptor = dynamicDescriptor;
return this;
}
public void setEncryptedData(String encryptedData) {
this.encryptedData = encryptedData;
}
/**
* @param encryptedData The encrypted payment credentials encoded in base64. *(for APPLEPAY payment method only)*
* @return bean instance
**/
public PaymentRequestPaymentData encryptedData(String encryptedData) {
this.encryptedData = encryptedData;
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. Token can be generated only for successful transactions (not for declined transactions) *(for BANKCARD payment method only)*
* @return bean instance
**/
public PaymentRequestPaymentData generateToken(Boolean generateToken) {
this.generateToken = generateToken;
return this;
}
public void setHoldPeriod(Integer holdPeriod) {
this.holdPeriod = holdPeriod;
}
/**
* minimum: 1
* maximum: 168
* @param holdPeriod The delay between the authorisation and scheduled auto-capture or auto-void, specified in hours. The minimum hold period is 1 hour, maximum hold period is 7 days (168 hours).
* @return bean instance
**/
public PaymentRequestPaymentData holdPeriod(Integer holdPeriod) {
this.holdPeriod = holdPeriod;
return this;
}
public void setInstallmentAmount(BigDecimal installmentAmount) {
this.installmentAmount = installmentAmount;
}
/**
* @param installmentAmount Amount of 1 installment payment, 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 PaymentRequestPaymentData 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 PaymentRequestPaymentData 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 PaymentRequestPaymentData installments(List installments) {
this.installments = installments;
return this;
}
public PaymentRequestPaymentData 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 transaction that will not be displayed to Customer
* @return bean instance
**/
public PaymentRequestPaymentData note(String note) {
this.note = note;
return this;
}
public void setPostauthStatus(PostauthStatusEnum postauthStatus) {
this.postauthStatus = postauthStatus;
}
/**
* @param postauthStatus The value contains payment status after hold period if payment has not been completed. Possible values: COMPLETE, REVERSE
* @return bean instance
**/
public PaymentRequestPaymentData postauthStatus(PostauthStatusEnum postauthStatus) {
this.postauthStatus = postauthStatus;
return this;
}
public void setPreauth(Boolean preauth) {
this.preauth = preauth;
}
/**
* @param preauth If set to `true`, the amount will not be captured but only blocked. Payments with 'preauth' attribute will be captured automatically in 7 days from the time of creating the preauth transaction. *(for BANKCARD payment method only)*.
* @return bean instance
**/
public PaymentRequestPaymentData preauth(Boolean preauth) {
this.preauth = preauth;
return this;
}
public void setScaExemption(String scaExemption) {
this.scaExemption = scaExemption;
}
/**
* @param scaExemption Indicates the exemption type that you want to request for the transaction. Possible value: LOW_VALUE
* @return bean instance
**/
public PaymentRequestPaymentData scaExemption(String scaExemption) {
this.scaExemption = scaExemption;
return this;
}
public void setThreeDsChallengeIndicator(String threeDsChallengeIndicator) {
this.threeDsChallengeIndicator = threeDsChallengeIndicator;
}
/**
* @param threeDsChallengeIndicator threeDsChallengeIndicator
* @return bean instance
**/
public PaymentRequestPaymentData threeDsChallengeIndicator(String threeDsChallengeIndicator) {
this.threeDsChallengeIndicator = threeDsChallengeIndicator;
return this;
}
public void setThreeDsMode(String threeDsMode) {
this.threeDsMode = threeDsMode;
}
/**
* @param threeDsMode Parameter 'three_ds_mode' indicates desire to conduct the transaction with full 3-D Secure, partial 3-D Secure, or without it, possible values: `01` - FULL 3-D Secure `02` - 3DS required but can be skipped `03` - NON 3-D Secure
* @return bean instance
**/
public PaymentRequestPaymentData threeDsMode(String threeDsMode) {
this.threeDsMode = threeDsMode;
return this;
}
public void setTransType(TransTypeEnum transType) {
this.transType = transType;
}
/**
* @param transType transType
* @return bean instance
**/
public PaymentRequestPaymentData transType(TransTypeEnum transType) {
this.transType = transType;
return this;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("PaymentRequestPaymentData( ");
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 (encryptedData != null) sb.append("encryptedData=").append(encryptedData.toString()).append("; ");
if (generateToken != null) sb.append("generateToken=").append(generateToken.toString()).append("; ");
if (holdPeriod != null) sb.append("holdPeriod=").append(holdPeriod.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 (postauthStatus != null) sb.append("postauthStatus=").append(postauthStatus.toString()).append("; ");
if (preauth != null) sb.append("preauth=").append(preauth.toString()).append("; ");
if (scaExemption != null) sb.append("scaExemption=").append(scaExemption.toString()).append("; ");
if (threeDsChallengeIndicator != null) sb.append("threeDsChallengeIndicator=").append(threeDsChallengeIndicator.toString()).append("; ");
if (threeDsMode != null) sb.append("threeDsMode=").append(threeDsMode.toString()).append("; ");
if (transType != null) sb.append("transType=").append(transType.toString()).append("; ");
sb.append(")");
return sb.toString();
}
}