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

com.hps.integrator.services.HpsActivationService Maven / Gradle / Ivy

Go to download

The SecureSubmit Java SDK simplifies processing of credit card transactions using Heartland Payment Systems' Portico Payment Gateway

There is a newer version: v2.5.2
Show newest version
package com.hps.integrator.services;

import com.hps.integrator.entities.activation.HpsDeviceActivationKeyResponse;

import com.hps.integrator.infrastructure.HpsInvalidRequestException;

import java.util.HashMap;

public class HpsActivationService extends HpsRestGatewayService{
    private HpsActivationServiceConfig mConfig;

    public HpsActivationService(HpsActivationServiceConfig configuration) {
        super(configuration);
        mConfig = configuration;
        configureBaseUrl(mConfig.IsTest);
    }

    private void configureBaseUrl(boolean isForTesting){
        String serviceUri = isForTesting ? "https://huds.test.e-hps.com/config-server/v1/" : "https://huds.prod.e-hps.com/config-server/v1/";
        mConfig.setServiceUri(serviceUri);
    }

    public HpsDeviceActivationKeyResponse activateDevice(String merchantId, String activationCode) throws Exception {
        if (merchantId == null)
            throw new HpsInvalidRequestException("MerchantId is required.");

        if (activationCode == null)
            throw new HpsInvalidRequestException("Activation Code is required.");

        HashMap qs = new HashMap();
        qs.put("merchantId", merchantId);
        qs.put("activationCode", activationCode);

        String response = doRequest("GET", "deviceActivationKey", null, null, qs);
        return this.hydrateObject(response, HpsDeviceActivationKeyResponse.class);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy