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

com.global.api.gateways.bill_pay.requests.GetTransactionByOrderIDRequest Maven / Gradle / Ivy

There is a newer version: 14.2.3
Show newest version
package com.global.api.gateways.bill_pay.requests;

import com.global.api.builders.ReportBuilder;
import com.global.api.builders.TransactionReportBuilder;
import com.global.api.entities.billing.Credentials;
import com.global.api.entities.exceptions.BuilderException;
import com.global.api.utils.Element;
import com.global.api.utils.ElementTree;

public class GetTransactionByOrderIDRequest extends BillPayRequestBase {
    protected static final String SOAPENV_BODY = "soapenv:Body";
    protected static final String BIL_GET_TRANSACTION_BY_ORDER_ID = "bil:GetTransactionByOrderID";
    protected static final String BIL_GET_TRANSACTION_BY_ORDER_ID_REQUEST = "bil:GetTransactionByOrderIDRequest";
    protected static final String BDMS_ORDER_ID = "bdms:OrderID";
    protected static final String BUILDER_EXCEPTION = "This method only support TransactionReportBuilder.";
    public GetTransactionByOrderIDRequest(ElementTree et) {
        super(et);
    }

    public String build(Element envelope, ReportBuilder builder, Credentials credentials) throws BuilderException {
        if (builder instanceof TransactionReportBuilder) {
            Element body = et.subElement(envelope, SOAPENV_BODY);
            Element methodElement = et.subElement(body, BIL_GET_TRANSACTION_BY_ORDER_ID);
            Element requestElement = et.subElement(methodElement, BIL_GET_TRANSACTION_BY_ORDER_ID_REQUEST);

            buildCredentials(requestElement, credentials);

            et.subElement(requestElement,BDMS_ORDER_ID,((TransactionReportBuilder) builder).getTransactionId());

            return et.toString(envelope);
        }
        else
            throw new BuilderException(BUILDER_EXCEPTION);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy