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

cl.transbank.transaccioncompleta.model.MallTransactionCommitDetails Maven / Gradle / Ivy

There is a newer version: 5.0.0
Show newest version
package cl.transbank.transaccioncompleta.model;

import cl.transbank.transaccioncompleta.TransactionCommitRequest;
import com.google.gson.annotations.SerializedName;
import lombok.*;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class MallTransactionCommitDetails {
    private List detailList = new ArrayList<>();

    private MallTransactionCommitDetails() {}

    public static MallTransactionCommitDetails build() {
        return new MallTransactionCommitDetails();
    }

    public static MallTransactionCommitDetails build(String commerceCode, String buyOrder,long idQueryInstallments,byte deferredPeriodIndex, boolean gracePeriod) {
        return MallTransactionCommitDetails.build().add(commerceCode, buyOrder, idQueryInstallments, deferredPeriodIndex, gracePeriod);
    }

    public MallTransactionCommitDetails add(String commerceCode, String buyOrder,long idQueryInstallments,byte deferredPeriodIndex, boolean gracePeriod) {
        detailList.add(new MallTransactionCommitDetails.Detail(commerceCode, buyOrder, idQueryInstallments, deferredPeriodIndex, gracePeriod));
        return this;
    }

    public boolean remove(String commerceCode, String buyOrder,long idQueryInstallments,byte deferredPeriodIndex, boolean gracePeriod) {
        return getDetails().remove(new MallTransactionCommitDetails.Detail(commerceCode, buyOrder, idQueryInstallments, deferredPeriodIndex, gracePeriod));
    }

    public List getDetails() {
        return Collections.unmodifiableList(detailList);
    }

    @Data
    @AllArgsConstructor
    public class Detail extends TransactionCommitRequest {
        @SerializedName("commerce_code")private String commerceCode;
        @SerializedName("buy_order")private String buyOrder;

        Detail(String commerceCode, String buyOrder,long idQueryInstallments,byte deferredPeriodIndex,boolean gracePeriod){
            super(idQueryInstallments, deferredPeriodIndex, gracePeriod);
            this.commerceCode = commerceCode;
            this.buyOrder = buyOrder;
        }

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy