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

com.midtrans.service.impl.MidtransSnapApiImpl 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.SnapApi;
import com.midtrans.httpclient.error.MidtransError;
import com.midtrans.service.MidtransSnapApi;
import org.json.JSONObject;

import java.util.Map;

/**
 * Implements from {@link MidtransSnapApi MidtransSnapApi}
 */
public class MidtransSnapApiImpl implements MidtransSnapApi {
    private Config config;

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

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

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

    @Override
    public String createTransactionToken(Map params) throws MidtransError {
        return SnapApi.createTransactionToken(params, config);
    }

    @Override
    public String createTransactionRedirectUrl(Map params) throws MidtransError {
        return SnapApi.createTransactionRedirectUrl(params, config);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy