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

com.global.api.builders.TransactionBuilder Maven / Gradle / Ivy

There is a newer version: 14.3.1
Show newest version
package com.global.api.builders;

import com.global.api.entities.EcommerceInfo;
import com.global.api.entities.PayByLinkData;
import com.global.api.entities.enums.*;
import com.global.api.network.elements.EWICData;
import com.global.api.network.entities.*;
import com.global.api.network.entities.gnap.GnapRequestData;
import com.global.api.network.entities.nts.NtsNetworkMessageHeader;
import com.global.api.network.entities.nts.NtsRequestMessageHeader;
import com.global.api.network.enums.CardIssuerEntryTag;
import com.global.api.paymentMethods.IPaymentMethod;
import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;

@Getter @Setter
public abstract class TransactionBuilder extends BaseBuilder {
    protected TransactionType transactionType;
    protected TransactionModifier transactionModifier = TransactionModifier.None;
    protected IPaymentMethod paymentMethod;
    protected HashMap> simulatedHostErrors;

    // network fields
    protected int batchNumber;
    protected String companyId;
    protected String description;
    protected FleetData fleetData;
    protected LinkedHashMap issuerData;
    protected Integer followOnStan;
    protected PriorMessageInformation priorMessageInformation;
    protected ProductData productData;
    protected int sequenceNumber;
    protected int systemTraceAuditNumber;
    protected String uniqueDeviceId;
    protected PayByLinkData payByLinkData; // Entity specific to PayByLink service
    protected String paymentLinkId; // A unique identifier generated by Global Payments to identify the payment link.
    protected TransactionMatchingData transactionMatchingData;
    protected MasterCardCITMITIndicator citMitIndicator;
    protected boolean terminalError;
    protected GnapRequestData gnapRequestData;
    protected BigDecimal taxAmount;
    protected BigDecimal tipAmount;
    protected BigDecimal surchargeAmount;
    protected BigDecimal cashBackAmount;

    //Nts
    protected String invoiceNumber;
    protected String cvn;
    protected BigDecimal amount;
    protected String tagData;

    //Emv
    protected String emvMaxPinEntry;

    // P66 Tag 16
    protected NtsTag16 ntsTag16;
    private String posSequenceNumber;
    protected String serviceCode;
    protected String cardSequenceNumber;     // Card Sequence number.
    protected NtsProductData ntsProductData;
    protected String ecommerceAuthIndicator;
    protected String ecommerceData1;
    protected String ecommerceData2;
    protected String mcUCAF;
    protected String mcWalletId;
    protected String mcSLI;
    protected NtsNetworkMessageHeader ntsNetworkMessageHeader;
    protected NtsRequestMessageHeader ntsRequestMessageHeader;
    protected String transactionDate;
    protected String transactionTime;
    protected EWICData ewicData;
    protected String ewicIssuingEntity;
    private String zipCode;
    private String customerCode;
    private String hostResponseCode = "";
    private String offlineDeclineIndicator;
    private Boolean isSAFIndicator;
    private String safOriginalDateTime;
    private int pdlTimeout;
    protected EcommerceInfo ecommerceInfo;
    protected String merchantOrCustomerInitiatedFlag;

    public TransactionBuilder withServiceCode(String serviceCode) {
        this.serviceCode = serviceCode;
        return this;
    }
    public TransactionBuilder withNtsProductData(NtsProductData ntsProductData) {
        this.ntsProductData = ntsProductData;
        return this;
    }
    public TransactionBuilder withEcommerceAuthIndicator(String ecommerceAuthIndicator) {
        this.ecommerceAuthIndicator = ecommerceAuthIndicator;
        return this;
    }
    public TransactionBuilder withEcommerceData1(String ecommerceData1) {
        this.ecommerceData1 = ecommerceData1;
        return this;
    }
    public TransactionBuilder withEcommerceData2(String ecommerceData2) {
        this.ecommerceData2 = ecommerceData2;
        return this;
    }
    public TransactionBuilder withEWICData(EWICData ewicData) {
        this.ewicData = ewicData;
        return this;
    }
    public TransactionBuilder withZipCode(String zipCode) {
        this.zipCode = zipCode;
        return this;
    }
    public TransactionBuilder withCustomerCode(String customerCode) {
        this.customerCode = customerCode;
        return this;
    }
    public TransactionBuilder withHostResponseCode(String hostResponseCode) {
        this.hostResponseCode = hostResponseCode;
        return this;
    }
    public TransactionBuilder withOfflineDeclineIndicator(String offlineDeclineIndicator) {
        this.offlineDeclineIndicator = offlineDeclineIndicator;
        return this;
    }
    public TransactionBuilder withSAFIndicator(Boolean value) {
        this.isSAFIndicator = value;
        return this;
    }
    public TransactionBuilder withSAFOrigDT(String value) {
        this.safOriginalDateTime = value;
        return this;
    }
    public TransactionBuilder withMerchantOrCustomerInitiatedFlag(String merchantOrCustomerInitiatedFlag){
        this.merchantOrCustomerInitiatedFlag = merchantOrCustomerInitiatedFlag;
        return this;
    }
    public TransactionBuilder withPDLTimeout(int value){
        this.pdlTimeout = value;
        return this;
    }

    protected TransactionBuilder(TransactionType type) {
        this(type, null);
    }

    protected TransactionBuilder(TransactionType type, IPaymentMethod paymentMethod) {
        super();
        this.transactionType = type;
        this.paymentMethod = paymentMethod;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy