Open GoogleCodeExporter opened 9 years ago
package com.google.checkout;
import com.google.checkout.util.Base64Coder;
/**
* This class encapsulates the various merchant specific settings. An instance
* of this class will be required by most of the other classes in order to
* properly parameterise the API requests.
*
* @author simonjsmith
*/
public class MerchantConstants {
private String merchantId;
private String merchantKey;
private String env;
private String currencyCode;
private String checkoutUrl;
private String merchantCheckoutUrl;
private String requestUrl;
/**
* The constructor.
*
* @param merchantId
* The Merchant Id.
* @param merchantKey
* The Merchant Key.
* @param env
* The Environment Type.
* @param currencyCode
* The Currency Code.
* @param checkoutUrl
* The Checkout Url
* @param merchantCheckoutUrl
* The Merchant Checkout Url
* @param requestUrl
* The Request Url
*/
public MerchantConstants(String merchantId, String merchantKey,
String env,
String currencyCode, String checkoutUrl,
String merchantCheckoutUrl, String requestUrl) {
this.merchantId = merchantId;
this.merchantKey = merchantKey;
this.env = env;
this.currencyCode = currencyCode;
this.checkoutUrl = checkoutUrl;
this.merchantCheckoutUrl = merchantCheckoutUrl;
this.requestUrl = requestUrl;
}
/**
* Return the Currency Code.
*
* @return The Currency Code.
*/
public String getCurrencyCode() {
return this.currencyCode;
}
/**
* Return the Environment Type value.
*
* @return The Environment Type.
*
* @see EnvironmentType
*/
public String getEnv() {
return this.env;
}
/**
* Return the Merchant Id.
*
* @return The Merchant Id.
*/
public String getMerchantId() {
return this.merchantId;
}
/**
* Return the Merchant Key.
*
* @return The Merchant Key.
*/
public String getMerchantKey() {
return this.merchantKey;
}
/**
* Set the Currency Code.
*
* @param currencyCode
* The Currency Code.
*/
public void setCurrencyCode(String currencyCode) {
this.currencyCode = currencyCode;
}
/**
* Set the Environment Type value.
*
* @param env
* The Environment Type.
*
* @see EnvironmentType
*/
public void setEnv(String env) {
this.env = env;
}
/**
* Set the Merchant Id.
*
* @param merchantId
* The Merchant Id.
*/
public void setMerchantId(String merchantId) {
this.merchantId = merchantId;
}
/**
* Set the Merchant Key.
*
* @param merchantKey
* The Merchant Key.
*/
public void setMerchantKey(String merchantKey) {
this.merchantKey = merchantKey;
}
/**
* Return the Checkout URL.
*
* @return The Checkout URL.
*/
public String getCheckoutUrl() {
return checkoutUrl;
}
/**
* Return the Request URL.
*
* @return The Request URL.
*/
public String getRequestUrl() {
return requestUrl;
}
/**
* Return the HTTP Auth value.
*
* @return The HTTP Auth value.
*/
public String getHttpAuth() {
return Base64Coder.encode(new
StringBuffer(getMerchantId()).append(":")
.append(getMerchantKey()).toString());
}
/**
* Return the Merchant Checkout URL.
*
* @return The Checkout URL.
*/
public String getMerchantCheckoutUrl() {
return merchantCheckoutUrl;
}
/**
* Set the Merchant Checkout URL.
*
* @param merchantCheckoutUrl
* The Merchant Checkout URL.
*/
public void setMerchantCheckoutUrl(String merchantCheckoutUrl) {
this.merchantCheckoutUrl = merchantCheckoutUrl;
}
/**
* Set the Checkout URL.
*
* @param checkoutUrl
* The Checkout URL.
*/
public void setCheckoutUrl(String checkoutUrl) {
this.checkoutUrl = checkoutUrl;
}
/**
* Set the Request URL.
*
* @param requestUrl
* The Checkout URL.
*/
public void setRequestUrl(String requestUrl) {
this.requestUrl = requestUrl;
}
}
And this is my MerchantConstantsFactory.java class
package com.google.checkout.example;
import com.google.checkout.MerchantConstants;
public class MerchantConstantsFactory {
public static MerchantConstants getMerchantConstants(){
MerchantConstants mc=new
MerchantConstants
("11453453454","XXXXXXXXXXXXXXXXXX","","USD","","https://sandbox.google.com/chec
kout/
api/checkout/v2/merchantCheckout/Merchant/11453453454","");
return mc;
}
}
NOT WORKING
Original comment by mady.a...@gmail.com
on 31 May 2010 at 1:10
Original issue reported on code.google.com by
01.is...@gmail.com
on 16 Jun 2009 at 8:06