All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jp.gopay.sdk.models.request.subscription.SubscriptionRequestData Maven / Gradle / Ivy

There is a newer version: 0.11.17
Show newest version
package jp.gopay.sdk.models.request.subscription;

import com.google.gson.annotations.SerializedName;
import jp.gopay.sdk.models.common.TransactionTokenId;
import jp.gopay.sdk.models.response.subscription.ScheduleSettings;
import jp.gopay.sdk.types.MetadataMap;
import jp.gopay.sdk.types.SubscriptionPeriod;

import java.math.BigInteger;
import java.util.Date;
import java.util.UUID;

public abstract class SubscriptionRequestData {

    @SerializedName("transaction_token_id")
    private UUID transactionTokenId;

    @SerializedName("period")
    private SubscriptionPeriod period;

    @SerializedName("initial_amount")
    private BigInteger initialAmount;

    @SerializedName("only_direct_currency")
    private Boolean onlyDirectCurrency;

    @SerializedName("descriptor")
    private String descriptor;

    @SerializedName("metadata")
    private MetadataMap metadata;

    @SerializedName("installment_plan")
    private InstallmentPlanRequest installmentPlan;

    @SerializedName("schedule_settings")
    private ScheduleSettings scheduleSettings;

    @SerializedName("subsequent_cycles_start")
    private Date subsequentCyclesStart;

    public SubscriptionRequestData(TransactionTokenId transactionTokenId, SubscriptionPeriod period, BigInteger initialAmount,
                                   MetadataMap metadata, InstallmentPlanRequest installmentPlan,
                                   ScheduleSettings scheduleSettings, Date subsequentCyclesStart,
                                   Boolean onlyDirectCurrency, String descriptor
    ) {
        if(transactionTokenId != null){
            this.transactionTokenId = transactionTokenId.toUUID();
        }
        this.period = period;
        this.initialAmount = initialAmount;
        this.metadata = metadata;
        this.installmentPlan = installmentPlan;
        this.scheduleSettings = scheduleSettings;
        this.subsequentCyclesStart = subsequentCyclesStart;
        this.onlyDirectCurrency = onlyDirectCurrency;
        this.descriptor = descriptor;
    }

    public TransactionTokenId getTransactionTokenId() {
        return new TransactionTokenId(transactionTokenId);
    }

    public SubscriptionPeriod getPeriod() {
        return period;
    }

    public BigInteger getInitialAmount() {
        return initialAmount;
    }

    public Boolean getOnlyDirectCurrency() {
        return onlyDirectCurrency;
    }

    public String getDescriptor() {
        return descriptor;
    }

    public MetadataMap getMetadata() {
        return metadata;
    }

    public InstallmentPlanRequest getInstallmentPlan() {
        return installmentPlan;
    }

    public ScheduleSettings getScheduleSettings() {
        return scheduleSettings;
    }

    public Date getSubsequentCyclesStart() {
        return subsequentCyclesStart;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy