
com.starkinfra.MerchantCountry Maven / Gradle / Ivy
Show all versions of sdk Show documentation
package com.starkinfra;
import com.starkinfra.utils.Rest;
import com.starkinfra.utils.Generator;
import com.starkinfra.utils.SubResource;
import java.util.Map;
import java.util.HashMap;
public final class MerchantCountry extends SubResource {
/**
* MerchantCountry object
*
* MerchantCountry's codes are used to define country filters in IssuingRules.
*
* Parameters:
* code [string]: country's code. ex: "BRA"
* name [string]: country's name. ex: "Brazil"
* number [string]: country's number. ex: "076"
* shortCode [string]: country's short code. ex: "81"
*
*/
static SubResource.ClassData data = new SubResource.ClassData(MerchantCountry.class, "MerchantCountry");
public String code;
public String name;
public String number;
public String shortCode;
/**
* MerchantCountry object
*
* MerchantCountry's codes are used to define country filters in IssuingRules.
*
* Parameters:
* @param code [string]: country's code. ex: "BRA"
* @param name [string]: country's name. ex: "Brazil"
* @param number [string]: country's number. ex: "076"
* @param shortCode [string]: country's short code. ex: "BR"
*/
public MerchantCountry(String code, String name, String number, String shortCode){
this.code = code;
this.name = name;
this.number = number;
this.shortCode = shortCode;
}
/**
* MerchantCountry object
*
* MerchantCountry's codes are used to define country filters in IssuingRules.
*
* Parameters (required):
* @param data map of properties for the creation of the MerchantCountry
* code [string]: country's code. ex: "BRA"
*
* Attributes (return-only):
* name [string]: country's name. ex: "Brazil"
* number [string]: country's number. ex: "076"
* shortCode [string]: country's short code. ex: "BR"
* @throws Exception error in the request
*/
public MerchantCountry(Map data) throws Exception {
HashMap dataCopy = new HashMap<>(data);
this.code = (String) dataCopy.remove("code");
this.name = null;
this.number = null;
this.shortCode = null;
if (!dataCopy.isEmpty()) {
throw new Exception("Unknown parameters used in constructor: [" + String.join(", ", dataCopy.keySet()) + "]");
}
}
/**
* Retrieve MerchantCountries
*
* Receive a generator of MerchantCountry objects available in the Stark Infra API
*
* Parameters:
* @param params map of parameters for the query
* search [string, default null]: keyword to search for code, name, number or shortCode
* @param user [Project object, default null]: Project object. Not necessary if StarkInfra.Settings.user was set before function call
*
* Return:
* @return generator of MerchantCountry objects with updated attributes
* @throws Exception error in the request
*/
public static Generator query(Map params, User user) throws Exception {
return Rest.getStream(data, params, user);
}
/**
* Retrieve MerchantCountries
*
* Receive a generator of MerchantCountry objects available in the Stark Infra API
*
* Parameters:
* @param params map of parameters for the query
* search [string, default null]: keyword to search for code, name, number or shortCode
*
* Return:
* @return generator of MerchantCountry objects with updated attributes
* @throws Exception error in the request
*/
public static Generator query(Map params) throws Exception {
return Rest.getStream(data, params, null);
}
/**
* Retrieve MerchantCountries
*
* Receive a generator of MerchantCountry objects available in the Stark Infra API
*
* Parameters:
* @param user [Project object, default null]: Project object. Not necessary if StarkInfra.Settings.user was set before function call
*
* Return:
* @return generator of MerchantCountry objects with updated attributes
* @throws Exception error in the request
*/
public static Generator query(User user) throws Exception{
return Rest.getStream(data, new HashMap<>(), user);
}
/**
* Retrieve MerchantCountries
*
* Receive a generator of MerchantCountry objects available in the Stark Infra API
*
* Return:
* @return generator of MerchantCountry objects with updated attributes
* @throws Exception error in the request
*/
public static Generator query() throws Exception{
return Rest.getStream(data, new HashMap<>(), null);
}
}