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

com.mastercard.api.mcon.Offers Maven / Gradle / Ivy

Go to download

Java Core SDK for use with SDKs available on MasterCard Developer Zone (https://developer.mastercard.com)

There is a newer version: 1.0.3
Show newest version
/*
 * Copyright 2016 MasterCard International.
 *
 * Redistribution and use in source and binary forms, with or without modification, are 
 * permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list of 
 * conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * Neither the name of the MasterCard International Incorporated nor the names of its 
 * contributors may be used to endorse or promote products derived from this software 
 * without specific prior written permission.
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
 * SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 
 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
 * SUCH DAMAGE.
 *
 */

package com.mastercard.api.mcon;

import com.mastercard.api.core.exception.*;
import com.mastercard.api.core.model.*;
import com.mastercard.api.core.security.*;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Offers extends BaseObject  {

    private static Map operationConfigs;

    static {
        operationConfigs = new HashMap();
        operationConfigs.put("2d4b4a5f-f1d5-49bb-807f-4d439d717656", new OperationConfig("/loyalty/v1/offers", Action.query, Arrays.asList("userId","preferredLanguage","sort","category","featured","favorite","partner","latitude","longitude","searchRadius"), Arrays.asList("x-client-correlation-id")));
        operationConfigs.put("ae992b0d-2c4d-4a2e-9258-5e06eedfdc0f", new OperationConfig("/loyalty/v1/offers/{offerId}/activate", Action.create, Arrays.asList(""), Arrays.asList("x-client-correlation-id")));
        operationConfigs.put("a63b71fe-d45e-40ee-a66b-71fd29714af5", new OperationConfig("/loyalty/v1/offers/{offerId}/detail", Action.query, Arrays.asList("userId","preferredLanguage"), Arrays.asList("x-client-correlation-id")));
        operationConfigs.put("4e87671c-c199-4195-88bf-ecc262237307", new OperationConfig("/loyalty/v1/offers/{offerId}/favorite", Action.create, Arrays.asList(""), Arrays.asList("x-client-correlation-id")));
        operationConfigs.put("05598051-4297-49b8-bd1e-56734208c27f", new OperationConfig("/loyalty/v1/offers/{offerId}/redeem", Action.create, Arrays.asList(""), Arrays.asList("x-client-correlation-id")));
        operationConfigs.put("96770890-92fb-4cca-85cf-9d6e709fd40d", new OperationConfig("/loyalty/v1/offers/{offerId}/unfavorite", Action.create, Arrays.asList(""), Arrays.asList("x-client-correlation-id")));
        operationConfigs.put("1884fb06-cafa-4348-b5ef-53f699cb870e", new OperationConfig("/loyalty/v1/offers/promo", Action.create, Arrays.asList(""), Arrays.asList("x-client-correlation-id")));
        operationConfigs.put("1a9d5113-8ceb-426d-933e-531bacee265d", new OperationConfig("/loyalty/v1/offers/redeemed", Action.query, Arrays.asList("userId","preferredLanguage"), Arrays.asList("x-client-correlation-id")));
        operationConfigs.put("8ea5f531-61c8-4495-9c86-fde8f61f9744", new OperationConfig("/loyalty/v1/points/expiring", Action.query, Arrays.asList("userId"), Arrays.asList("x-client-correlation-id")));
        operationConfigs.put("c9615a6a-853b-4c23-9d12-0301695be077", new OperationConfig("/loyalty/v1/points", Action.query, Arrays.asList("userId"), Arrays.asList("x-client-correlation-id")));
        operationConfigs.put("2a58ae43-b0a0-40d8-b254-9064699ba288", new OperationConfig("/loyalty/v1/users/{userId}/offers", Action.query, Arrays.asList(""), Arrays.asList("x-client-correlation-id")));
        operationConfigs.put("4a8e7fe3-0829-407c-929c-71b0e43d7cc0", new OperationConfig("/loyalty/v1/vouchers", Action.query, Arrays.asList("userId"), Arrays.asList("x-client-correlation-id")));
        operationConfigs.put("1a8a1619-1edd-439e-a6fa-21803288f004", new OperationConfig("/loyalty/v1/vouchers/{voucherId}/detail", Action.query, Arrays.asList("userId"), Arrays.asList("x-client-correlation-id")));
    }

    public Offers() {
    }

    public Offers(BaseObject o) {
        putAll(o);
    }

    public Offers(RequestMap requestMap) {
        putAll(requestMap);
    }

    @Override protected final OperationConfig getOperationConfig(String operationUUID) throws IllegalArgumentException{
        OperationConfig operationConfig = operationConfigs.get(operationUUID);

        if(operationConfig == null) {
            throw new IllegalArgumentException("Invalid operationUUID supplied: " + operationUUID);
        }

        return operationConfig;
    }

    @Override protected OperationMetadata getOperationMetadata() throws IllegalArgumentException {
        return new OperationMetadata(ResourceConfig.getInstance().getVersion(), ResourceConfig.getInstance().getHost(), ResourceConfig.getInstance().getContext(), ResourceConfig.getInstance().getJsonNative(), ResourceConfig.getInstance().getContentTypeOverride());
    }






    /**
     * Query / Retrieve a Offers object
     *
     * @param query a map of query parameters
     *
     * @return a Offers object
     *
     * @throws ApiException - which encapsulates the http status code and the error return by the server
     */
    public static Offers getOffers(RequestMap query)
        throws ApiException {

        return getOffers(null, query);
    }

    /**
     * Query / Retrieve a Offers object
     *
     * @param auth Authentication object overriding ApiConfig.setAuthentication(authentication)
     * @param query a map of query parameters
     *
     * @return a Offers object
     *
     * @throws ApiException - which encapsulates the http status code and the error return by the server
     */
    public static Offers getOffers(Authentication auth, RequestMap query)
        throws ApiException {

        Offers val = new Offers();
        if (query != null)  val.putAll(query);
        return new Offers(BaseObject.executeOperation(auth, "2d4b4a5f-f1d5-49bb-807f-4d439d717656", val));
    }
  /**
   * Creates a Offers object
   *
   * @param map a map of parameters to create a Offers object
   *
   * @return a Offers object.
   *
   * @throws ApiException - which encapsulates the http status code and the error return by the server
   */
  public static Offers activateOffer(RequestMap map)
    throws ApiException {

    return activateOffer(null, map);
  }

  /**
   * Creates a Offers object
   *
   * @param auth Authentication object overriding ApiConfig.setAuthentication(authentication)
   * @param map a map of parameters to create a Offers object
   *
   * @return a Offers object.
   *
   * @throws ApiException - which encapsulates the http status code and the error return by the server
   */
  public static Offers activateOffer(Authentication auth, RequestMap map)
    throws ApiException {

    return new Offers(BaseObject.executeOperation(auth, "ae992b0d-2c4d-4a2e-9258-5e06eedfdc0f", new Offers(map)));
  }











    /**
     * Query / Retrieve a Offers object
     *
     * @param query a map of query parameters
     *
     * @return a Offers object
     *
     * @throws ApiException - which encapsulates the http status code and the error return by the server
     */
    public static Offers getOfferDetail(RequestMap query)
        throws ApiException {

        return getOfferDetail(null, query);
    }

    /**
     * Query / Retrieve a Offers object
     *
     * @param auth Authentication object overriding ApiConfig.setAuthentication(authentication)
     * @param query a map of query parameters
     *
     * @return a Offers object
     *
     * @throws ApiException - which encapsulates the http status code and the error return by the server
     */
    public static Offers getOfferDetail(Authentication auth, RequestMap query)
        throws ApiException {

        Offers val = new Offers();
        if (query != null)  val.putAll(query);
        return new Offers(BaseObject.executeOperation(auth, "a63b71fe-d45e-40ee-a66b-71fd29714af5", val));
    }
  /**
   * Creates a Offers object
   *
   * @param map a map of parameters to create a Offers object
   *
   * @return a Offers object.
   *
   * @throws ApiException - which encapsulates the http status code and the error return by the server
   */
  public static Offers favoriteOffer(RequestMap map)
    throws ApiException {

    return favoriteOffer(null, map);
  }

  /**
   * Creates a Offers object
   *
   * @param auth Authentication object overriding ApiConfig.setAuthentication(authentication)
   * @param map a map of parameters to create a Offers object
   *
   * @return a Offers object.
   *
   * @throws ApiException - which encapsulates the http status code and the error return by the server
   */
  public static Offers favoriteOffer(Authentication auth, RequestMap map)
    throws ApiException {

    return new Offers(BaseObject.executeOperation(auth, "4e87671c-c199-4195-88bf-ecc262237307", new Offers(map)));
  }






  /**
   * Creates a Offers object
   *
   * @param map a map of parameters to create a Offers object
   *
   * @return a Offers object.
   *
   * @throws ApiException - which encapsulates the http status code and the error return by the server
   */
  public static Offers redeemOffer(RequestMap map)
    throws ApiException {

    return redeemOffer(null, map);
  }

  /**
   * Creates a Offers object
   *
   * @param auth Authentication object overriding ApiConfig.setAuthentication(authentication)
   * @param map a map of parameters to create a Offers object
   *
   * @return a Offers object.
   *
   * @throws ApiException - which encapsulates the http status code and the error return by the server
   */
  public static Offers redeemOffer(Authentication auth, RequestMap map)
    throws ApiException {

    return new Offers(BaseObject.executeOperation(auth, "05598051-4297-49b8-bd1e-56734208c27f", new Offers(map)));
  }






  /**
   * Creates a Offers object
   *
   * @param map a map of parameters to create a Offers object
   *
   * @return a Offers object.
   *
   * @throws ApiException - which encapsulates the http status code and the error return by the server
   */
  public static Offers unfavoriteOffer(RequestMap map)
    throws ApiException {

    return unfavoriteOffer(null, map);
  }

  /**
   * Creates a Offers object
   *
   * @param auth Authentication object overriding ApiConfig.setAuthentication(authentication)
   * @param map a map of parameters to create a Offers object
   *
   * @return a Offers object.
   *
   * @throws ApiException - which encapsulates the http status code and the error return by the server
   */
  public static Offers unfavoriteOffer(Authentication auth, RequestMap map)
    throws ApiException {

    return new Offers(BaseObject.executeOperation(auth, "96770890-92fb-4cca-85cf-9d6e709fd40d", new Offers(map)));
  }






  /**
   * Creates a Offers object
   *
   * @param map a map of parameters to create a Offers object
   *
   * @return a Offers object.
   *
   * @throws ApiException - which encapsulates the http status code and the error return by the server
   */
  public static Offers submitOfferPromo(RequestMap map)
    throws ApiException {

    return submitOfferPromo(null, map);
  }

  /**
   * Creates a Offers object
   *
   * @param auth Authentication object overriding ApiConfig.setAuthentication(authentication)
   * @param map a map of parameters to create a Offers object
   *
   * @return a Offers object.
   *
   * @throws ApiException - which encapsulates the http status code and the error return by the server
   */
  public static Offers submitOfferPromo(Authentication auth, RequestMap map)
    throws ApiException {

    return new Offers(BaseObject.executeOperation(auth, "1884fb06-cafa-4348-b5ef-53f699cb870e", new Offers(map)));
  }











    /**
     * Query / Retrieve a Offers object
     *
     * @param query a map of query parameters
     *
     * @return a Offers object
     *
     * @throws ApiException - which encapsulates the http status code and the error return by the server
     */
    public static Offers getRedeemedOffers(RequestMap query)
        throws ApiException {

        return getRedeemedOffers(null, query);
    }

    /**
     * Query / Retrieve a Offers object
     *
     * @param auth Authentication object overriding ApiConfig.setAuthentication(authentication)
     * @param query a map of query parameters
     *
     * @return a Offers object
     *
     * @throws ApiException - which encapsulates the http status code and the error return by the server
     */
    public static Offers getRedeemedOffers(Authentication auth, RequestMap query)
        throws ApiException {

        Offers val = new Offers();
        if (query != null)  val.putAll(query);
        return new Offers(BaseObject.executeOperation(auth, "1a9d5113-8ceb-426d-933e-531bacee265d", val));
    }





    /**
     * Query / Retrieve a Offers object
     *
     * @param query a map of query parameters
     *
     * @return a Offers object
     *
     * @throws ApiException - which encapsulates the http status code and the error return by the server
     */
    public static Offers getPointsExpiring(RequestMap query)
        throws ApiException {

        return getPointsExpiring(null, query);
    }

    /**
     * Query / Retrieve a Offers object
     *
     * @param auth Authentication object overriding ApiConfig.setAuthentication(authentication)
     * @param query a map of query parameters
     *
     * @return a Offers object
     *
     * @throws ApiException - which encapsulates the http status code and the error return by the server
     */
    public static Offers getPointsExpiring(Authentication auth, RequestMap query)
        throws ApiException {

        Offers val = new Offers();
        if (query != null)  val.putAll(query);
        return new Offers(BaseObject.executeOperation(auth, "8ea5f531-61c8-4495-9c86-fde8f61f9744", val));
    }





    /**
     * Query / Retrieve a Offers object
     *
     * @param query a map of query parameters
     *
     * @return a Offers object
     *
     * @throws ApiException - which encapsulates the http status code and the error return by the server
     */
    public static Offers getPoints(RequestMap query)
        throws ApiException {

        return getPoints(null, query);
    }

    /**
     * Query / Retrieve a Offers object
     *
     * @param auth Authentication object overriding ApiConfig.setAuthentication(authentication)
     * @param query a map of query parameters
     *
     * @return a Offers object
     *
     * @throws ApiException - which encapsulates the http status code and the error return by the server
     */
    public static Offers getPoints(Authentication auth, RequestMap query)
        throws ApiException {

        Offers val = new Offers();
        if (query != null)  val.putAll(query);
        return new Offers(BaseObject.executeOperation(auth, "c9615a6a-853b-4c23-9d12-0301695be077", val));
    }





    /**
     * Query / Retrieve a Offers object
     *
     * @param query a map of query parameters
     *
     * @return a Offers object
     *
     * @throws ApiException - which encapsulates the http status code and the error return by the server
     */
    public static Offers userOffersRegistrationStatus(RequestMap query)
        throws ApiException {

        return userOffersRegistrationStatus(null, query);
    }

    /**
     * Query / Retrieve a Offers object
     *
     * @param auth Authentication object overriding ApiConfig.setAuthentication(authentication)
     * @param query a map of query parameters
     *
     * @return a Offers object
     *
     * @throws ApiException - which encapsulates the http status code and the error return by the server
     */
    public static Offers userOffersRegistrationStatus(Authentication auth, RequestMap query)
        throws ApiException {

        Offers val = new Offers();
        if (query != null)  val.putAll(query);
        return new Offers(BaseObject.executeOperation(auth, "2a58ae43-b0a0-40d8-b254-9064699ba288", val));
    }





    /**
     * Query / Retrieve a Offers object
     *
     * @param query a map of query parameters
     *
     * @return a Offers object
     *
     * @throws ApiException - which encapsulates the http status code and the error return by the server
     */
    public static Offers getVouchers(RequestMap query)
        throws ApiException {

        return getVouchers(null, query);
    }

    /**
     * Query / Retrieve a Offers object
     *
     * @param auth Authentication object overriding ApiConfig.setAuthentication(authentication)
     * @param query a map of query parameters
     *
     * @return a Offers object
     *
     * @throws ApiException - which encapsulates the http status code and the error return by the server
     */
    public static Offers getVouchers(Authentication auth, RequestMap query)
        throws ApiException {

        Offers val = new Offers();
        if (query != null)  val.putAll(query);
        return new Offers(BaseObject.executeOperation(auth, "4a8e7fe3-0829-407c-929c-71b0e43d7cc0", val));
    }





    /**
     * Query / Retrieve a Offers object
     *
     * @param query a map of query parameters
     *
     * @return a Offers object
     *
     * @throws ApiException - which encapsulates the http status code and the error return by the server
     */
    public static Offers getVoucherDetail(RequestMap query)
        throws ApiException {

        return getVoucherDetail(null, query);
    }

    /**
     * Query / Retrieve a Offers object
     *
     * @param auth Authentication object overriding ApiConfig.setAuthentication(authentication)
     * @param query a map of query parameters
     *
     * @return a Offers object
     *
     * @throws ApiException - which encapsulates the http status code and the error return by the server
     */
    public static Offers getVoucherDetail(Authentication auth, RequestMap query)
        throws ApiException {

        Offers val = new Offers();
        if (query != null)  val.putAll(query);
        return new Offers(BaseObject.executeOperation(auth, "1a8a1619-1edd-439e-a6fa-21803288f004", val));
    }
}






© 2015 - 2025 Weber Informatics LLC | Privacy Policy