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

com.midtrans.service.impl.MidtransCoreApiImpl Maven / Gradle / Ivy

Go to download

This is the Official Java API client/library for Midtrans Payment API. Visit https://midtrans.com. More information about the product and see documentation at http://docs.midtrans.com for more technical details. This library used java version 1.8

There is a newer version: 3.2.0
Show newest version
package com.midtrans.service.impl;

import com.midtrans.Config;
import com.midtrans.httpclient.CoreApi;
import com.midtrans.httpclient.TransactionApi;
import com.midtrans.httpclient.error.MidtransError;
import com.midtrans.service.MidtransCoreApi;
import org.json.JSONObject;

import java.util.Map;

/**
 * Implements from {@link MidtransCoreApi MidtransCoreApi}
 */
public class MidtransCoreApiImpl implements MidtransCoreApi {

    private Config config;

    /**
     * CoreAPI constructor
     *
     * @param config Midtrans {@link Config configuration}
     */
    public MidtransCoreApiImpl(Config config) {
        this.config = config;
    }

    @Override
    public Config apiConfig() {
        return config;
    }

    @Override
    public JSONObject chargeTransaction(Map body) throws MidtransError {
        return CoreApi.chargeTransaction(body, config);
    }

    @Override
    public JSONObject checkTransaction(String param) throws MidtransError {
        return TransactionApi.checkTransaction(param, config);
    }

    @Override
    public JSONObject approveTransaction(String param) throws MidtransError {
        return TransactionApi.approveTransaction(param, config);
    }

    @Override
    public JSONObject cancelTransaction(String param) throws MidtransError {
        return TransactionApi.cancelTransaction(param, config);
    }

    @Override
    public JSONObject expireTransaction(String param) throws MidtransError {
        return TransactionApi.expireTransaction(param, config);
    }

    @Override
    public JSONObject refundTransaction(String param, Map body) throws MidtransError {
        return TransactionApi.refundTransaction(param, body, config);
    }

    @Override
    public JSONObject cardToken(Map params) throws MidtransError {
        return CoreApi.cardToken(params, config);
    }

    @Override
    public JSONObject registerCard(Map params) throws MidtransError {
        return CoreApi.registerCard(params, config);
    }

    @Override
    public JSONObject cardPointInquiry(String tokenId) throws MidtransError {
        return CoreApi.cardPointInquiry(tokenId, config);
    }

    @Override
    public JSONObject captureTransaction(Map params) throws MidtransError {
        return TransactionApi.captureTransaction(params, config);
    }

    @Override
    public JSONObject getTransactionStatusB2B(String param) throws MidtransError {
        return TransactionApi.getStatusB2b(param, config);
    }

    @Override
    public JSONObject directRefundTransaction(String param, Map requestBody) throws MidtransError {
        return TransactionApi.directRefundTransaction(param, requestBody, config);
    }

    @Override
    public JSONObject denyTransaction(String param) throws MidtransError {
        return TransactionApi.denyTransaction(param, config);
    }

    @Override
    public JSONObject getBIN(String binNumber) throws MidtransError {
        return CoreApi.getBin(binNumber, config);
    }

    @Override
    public JSONObject createSubscription(Map subscriptionReq) throws MidtransError {
        return CoreApi.createSubscription(subscriptionReq, config);
    }

    @Override
    public JSONObject getSubscription(String subscriptionId) throws MidtransError {
        return CoreApi.getSubscription(subscriptionId, config);
    }

    @Override
    public JSONObject disableSubscription(String subscriptionId) throws MidtransError {
        return CoreApi.disableSubscription(subscriptionId, config);
    }

    @Override
    public JSONObject enableSubscription(String subscriptionId) throws MidtransError {
        return CoreApi.enableSubscription(subscriptionId, config);
    }

    @Override
    public JSONObject updateSubscription(String subscriptionId, Map subscriptionReq) throws MidtransError {
        return CoreApi.updateSubscription(subscriptionId, subscriptionReq, config);
    }

    @Override
    public JSONObject linkPaymentAccount(Map accountRequest) throws MidtransError {
        return CoreApi.linkPaymentAccount(accountRequest, config);
    }

    @Override
    public JSONObject getPaymentAccount(String accountId) throws MidtransError {
        return CoreApi.getPaymentAccount(accountId, config);
    }

    @Override
    public JSONObject unlinkPaymentAccount(String accountId) throws MidtransError {
        return CoreApi.unlinkPaymentAccount(accountId, config);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy