@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class AccessToken {

    @XmlElement(name = "token_type")
    private String tokenType;

    @XmlElement(name = "access_token")
    private String accessToken;

    @XmlElement(name = "refresh_token")
    private String refreshToken;

    @XmlElement(name = "expires_in")
    private long expiresIn;

    public AccessToken() {
    }

    public AccessToken(String tokenType, String accessToken, String refreshToken,
            long expiresIn) {
        this.tokenType = tokenType;
        this.accessToken = accessToken;
        this.refreshToken = refreshToken;
        this.expiresIn = expiresIn;
    }

    public String getTokenType() {
        return tokenType;
    }

    public void setTokenType(String tokenType) {
        this.tokenType = tokenType;
    }

    public String getAccessToken() {
        return accessToken;
    }

    public void setAccessToken(String accessToken) {
        this.accessToken = accessToken;
    }

    public String getRefreshToken() {
        return refreshToken;
    }

    public void setRefreshToken(String refreshToken) {
        this.refreshToken = refreshToken;
    }

    public long getExpiresIn() {
        return expiresIn;
    }

    public void setExpiresIn(long expiresIn) {
        this.expiresIn = expiresIn;
    }
} public enum Currency {
    CZK(203),
    EUR(978),
    PLN(985),
    HUF(348),
    USD(840),
    GBP(826),
    BGN(975),
    HRK(191),
    RON(946);
        
    public static final String CODE_CZK = String.valueOf(CZK);
    public static final String CODE_EUR = String.valueOf(EUR);
    public static final String CODE_PLN = String.valueOf(PLN);
    public static final String CODE_HUF = String.valueOf(HUF);
    public static final String CODE_USD = String.valueOf(USD);
    public static final String CODE_GBP = String.valueOf(GBP);
    public static final String CODE_BGN = String.valueOf(BGN);
    public static final String CODE_HRK = String.valueOf(HRK);
    public static final String CODE_RON = String.valueOf(RON);
    
    private Integer numericalCode;

    private Currency(Integer numericalCode) {
        this.numericalCode = numericalCode;
    }

    public Integer getNumericalCode() {
        return numericalCode;
    }

    public String getCode() {
        return String.valueOf(this);
    }

    public void setNumericalCode(int numericalCode) {
        this.numericalCode = numericalCode;
    }

    public static Currency getByCode(String code) {
        Currency result = null;
        for (Currency item : EnumSet.allOf(Currency.class)) {
            if (String.valueOf(item).equals(code)) {
                result = item;
                break;
            }
        }
        return result;
    }

    public static Currency getByNumericalCode(Integer code) {
        Currency result = null;
        for (Currency item : EnumSet.allOf(Currency.class)) {
            if (item.getNumericalCode().equals(code)) {
                result = item;
                break;
            }
        }

        return result;
    }

} @XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
public class EETReceipt {
	
	public enum REETReceiptState {
		CREATED,
		DELIVERY_FAILED,
		DELIVERED
	}
	
	public enum REETMode {
		AUTO,
		EET
	}
	
	@XmlElement(name = "payment_id")
	private Long paymentId;
	
	@XmlElement(name = "state")
	private REETReceiptState state;
	
	@XmlElement(name = "date_last_attempt")
	@XmlJavaTypeAdapter(GPTimestampAdapter.class)
	private Date dateLastAttempt;
	
	@XmlElement(name = "date_next_attempt")
	@XmlJavaTypeAdapter(GPTimestampAdapter.class)
	private Date dateNextAttempt;
	
	@XmlElement(name = "error_code")
	private Integer commErrorCode;
	
	@XmlElement(name = "kod_chyby")
	private Integer errorCode;
	
	@XmlElement(name = "kody_varovani")
	private String kodyVarovani;
	
	@XmlElement(name = "eet_mode")
	private REETMode reetMode;
	
	@XmlElement(name = "uuid_zprava")
	private String uuidZprava;
	
	@XmlElement(name = "date_odesl")
	@XmlJavaTypeAdapter(GPTimestampAdapter.class)
	private Date datOdesl;
	
	@XmlElement(name = "dic_popl")
	private String dicPopl;
	
	@XmlElement(name = "id_provoz")
	private Integer idProvoz;
	
	@XmlElement(name = "id_pokl")
	private String idPokl;
	
	@XmlElement(name = "dat_trzby")
	@XmlJavaTypeAdapter(GPTimestampAdapter.class)
	private Date datTrzby;
	
	@XmlElement(name = "porad_cis")
	private String poradCis;
	
	@XmlElement(name = "fik")
	private String fik;
	
	@XmlElement(name = "bkp")
	private String bkp;
	
	@XmlElement(name = "pkp")
	private String pkp;
	
	@XmlElement(name = "dic_poverujiciho")
	private String dicPoverujiciho;
	
	@XmlElement(name = "celk_trzba")
	private Long celkTrzba;
	
	@XmlElement(name = "zakl_nepodl_dph")
	private Long zaklNepodlDPH;
	
	@XmlElement(name = "zakl_dan1")
	private Long zaklDan1;
	
	@XmlElement(name = "dan1")
	private Long dan1;
	
	@XmlElement(name = "zakl_dan2")
	private Long zaklDan2;
	
	@XmlElement(name = "dan2")
	private Long dan2;
	
	@XmlElement(name = "zakl_dan3")
	private Long zaklDan3;
	
	@XmlElement(name = "dan3")
	private Long dan3;
	
	@XmlElement(name = "cest_sluz")
	private Long cestSluz;
	
	@XmlElement(name = "pouzit_zboz1")
	private Long pouzitZboz1;
	
	@XmlElement(name = "pouzit_zboz2")
	private Long pouzitZboz2;
	
	@XmlElement(name = "pouzit_zboz3")
	private Long pouzitZboz3;
	
	@XmlElement(name = "urceno_cerp_zuct")
	private Long urcenoCerpZuct;
	
	@XmlElement(name = "cerp_zuct")
	private Long cerpZuct;
	
	public Long getPaymentId() {
		return paymentId;
	}
	
	public void setPaymentId(Long paymentId) {
		this.paymentId = paymentId;
	}
	
	public REETReceiptState getState() {
		return state;
	}
	
	public void setState(REETReceiptState state) {
		this.state = state;
	}
	
	public Date getDateLastAttempt() {
		return dateLastAttempt;
	}
	
	public void setDateLastAttempt(Date dateLastAttempt) {
		this.dateLastAttempt = dateLastAttempt;
	}
	
	public Date getDateNextAttempt() {
		return dateNextAttempt;
	}
	
	public void setDateNextAttempt(Date dateNextAttempt) {
		this.dateNextAttempt = dateNextAttempt;
	}
	
	public Integer getCommunicationErrorCode() {
		return commErrorCode;
	}
	
	public void setCommunication(Integer commErrorCode) {
		this.commErrorCode = commErrorCode;
	}
	
	public Integer getKodChyby() {
		return errorCode;
	}
	
	public void setKodChyby(Integer errorCode) {
		this.errorCode = errorCode;
	}
	
	public String getKodyVarovani() {
		return kodyVarovani;
	}
	
	public void setKodyVarovani(String kodyVarovani) {
		this.kodyVarovani = kodyVarovani;
	}
	
	public REETMode getReetMode() {
		return reetMode;
	}
	
	public void setReetMode(REETMode reetMode) {
		this.reetMode = reetMode;
	}
	
	public String getUuidZprava() {
		return uuidZprava;
	}
	
	public void setUuidZprava(String uuidZprava) {
		this.uuidZprava = uuidZprava;
	}
	
	public Date getDatOdesl() {
		return datOdesl;
	}
	
	public void setDatOdesl(Date datOdesl) {
		this.datOdesl = datOdesl;
	}
	
	public String getDicPopl() {
		return dicPopl;
	}
	
	public void setDicPopl(String dicPopl) {
		this.dicPopl = dicPopl;
	}
	
	public Integer getIdProvoz() {
		return idProvoz;
	}
	
	public void setIdProvoz(Integer idProvoz) {
		this.idProvoz = idProvoz;
	}
	
	public String getIdPokl() {
		return idPokl;
	}
	
	public void setIdPokl(String idPokl) {
		this.idPokl = idPokl;
	}
	
	public Date getDatTrzby() {
		return datTrzby;
	}
	
	public void setDatTrzby(Date datTrzby) {
		this.datTrzby = datTrzby;
	}
	
	public String getPoradCis() {
		return poradCis;
	}
	
	public void setPoradCis(String poradCis) {
		this.poradCis = poradCis;
	}
	
	public String getFik() {
		return fik;
	}
	
	public void setFik(String fik) {
		this.fik = fik;
	}
	
	public String getBkp() {
		return bkp;
	}
	
	public void setBkp(String bkp) {
		this.bkp = bkp;
	}
	
	public String getPkp() {
		return pkp;
	}
	
	public void setPkp(String pkp) {
		this.pkp = pkp;
	}
	
	public String getDicPoverujiciho() {
		return dicPoverujiciho;
	}
	
	public void setDicPoverujiciho(String dicPoverujiciho) {
		this.dicPoverujiciho = dicPoverujiciho;
	}
	
	public Long getCelkTrzba() {
		return celkTrzba;
	}
	
	public void setCelkTrzba(Long celkTrzba) {
		this.celkTrzba = celkTrzba;
	}
	
	public Long getZaklNepodlDPH() {
		return zaklNepodlDPH;
	}
	
	public void setZaklNepodlDPH(Long zaklNepodlDPH) {
		this.zaklNepodlDPH = zaklNepodlDPH;
	}
	
	public Long getZaklDan1() {
		return zaklDan1;
	}
	
	public void setZaklDan1(Long zaklDan1) {
		this.zaklDan1 = zaklDan1;
	}
	
	public Long getDan1() {
		return dan1;
	}
	
	public void setDan1(Long dan1) {
		this.dan1 = dan1;
	}
	
	public Long getZaklDan2() {
		return zaklDan2;
	}
	
	public void setZaklDan2(Long zaklDan2) {
		this.zaklDan2 = zaklDan2;
	}
	
	public Long getDan2() {
		return dan2;
	}
	
	public void setDan2(Long dan2) {
		this.dan2 = dan2;
	}
	
	public Long getZaklDan3() {
		return zaklDan3;
	}
	
	public void setZaklDan3(Long zaklDan3) {
		this.zaklDan3 = zaklDan3;
	}
	
	public Long getDan3() {
		return dan3;
	}
	
	public void setDan3(Long dan3) {
		this.dan3 = dan3;
	}
	
	public Long getCestSluz() {
		return cestSluz;
	}
	
	public void setCestSluz(Long cestSluz) {
		this.cestSluz = cestSluz;
	}
	
	public Long getPouzitZboz1() {
		return pouzitZboz1;
	}
	
	public void setPouzitZboz1(Long pouzitZboz1) {
		this.pouzitZboz1 = pouzitZboz1;
	}
	
	public Long getPouzitZboz2() {
		return pouzitZboz2;
	}
	
	public void setPouzitZboz2(Long pouzitZboz2) {
		this.pouzitZboz2 = pouzitZboz2;
	}
	
	public Long getPouzitZboz3() {
		return pouzitZboz3;
	}
	
	public void setPouzitZboz3(Long pouzitZboz3) {
		this.pouzitZboz3 = pouzitZboz3;
	}
	
	public Long getUrcenoCerpZuct() {
		return urcenoCerpZuct;
	}
	
	public void setUrcenoCerpZuct(Long urcenoCerpZuct) {
		this.urcenoCerpZuct = urcenoCerpZuct;
	}
	
	public Long getCerpZuct() {
		return cerpZuct;
	}
	
	public void setCerpZuct(Long cerpZuct) {
		this.cerpZuct = cerpZuct;
	}
	
	@Override
	public String toString() {
		return String.format("EETReceipt[paymentId=%s, state=%s, idProvoz=%s, datTrzby=%s, celkTrzba=%s]",
										 paymentId, state, idProvoz, datTrzby, celkTrzba);
	}
} @XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class EETReceiptFilter {
	
	@XmlElement(name = "date_from")
	@XmlJavaTypeAdapter(GPDateAdapter.class)
	private Date dateFrom;
	
	@XmlElement(name = "date_to")
	@XmlJavaTypeAdapter(GPDateAdapter.class)
	private Date dateTo;
	
	@XmlElement(name = "id_provozovny")
	private Integer idProvoz;
	
	public Date getDateFrom() {
		return dateFrom;
	}
	
	public void setDateFrom(Date dateFrom) {
		this.dateFrom = dateFrom;
	}
	
	public Date getDateTo() {
		return dateTo;
	}
	
	public void setDateTo(Date dateTo) {
		this.dateTo = dateTo;
	}
	
	public Integer getIdProvoz() {
		return idProvoz;
	}
	
	public void setIdProvoz(Integer idProvoz) {
		this.idProvoz = idProvoz;
	}
	
	@Override
	public String toString() {
		return String.format("EETReceiptFilter[dateFrom=%s, dateTo=%s, idProvoz=%s]", dateFrom, dateTo, idProvoz);
	}
	
	public static EETReceiptFilter create(Integer idProvoz, Date dateFrom, Date dateTo) {
		EETReceiptFilter filter = new EETReceiptFilter();
		filter.dateFrom = dateFrom;
		filter.dateTo = dateTo;
		filter.idProvoz = idProvoz;
		return filter;
	}
} @XmlRootElement
public class BasePayment {

    @XmlElement(name = "payer")
    private Payer payer;

    @XmlElement(name = "target")
    private Target target;

    @XmlElement(name = "amount")
    private Long amount;

    @XmlElement(name = "currency")
    private Currency currency;

    @XmlElement(name = "order_number")
    private String orderNumber;

    @XmlElement(name = "order_description")
    private String orderDescription;

    @XmlElement(name = "items")
    private List<OrderItem> items;

    @XmlElement(name = "callback")
    private Callback callback;

    @XmlElement(name = "recurrence")
    private Recurrence recurrence;

    @XmlElement(name = "preauthorization")
    private Boolean preAuthorization;

    @XmlElement(name = "additional_params")
    private List<AdditionalParam> additionalParams;

    @XmlElement(name = "lang")
    private String lang;

    @XmlElement(name = "eet")
    private EET eet;
    
    public Long getAmount() {
        return amount;
    }

    public void setAmount(Long amount) {
        this.amount = amount;
    }

    public Currency getCurrency() {
        return currency;
    }

    public void setCurrency(Currency currency) {
        this.currency = currency;
    }

    public Target getTarget() {
        return target;
    }

    public void setTarget(Target target) {
        this.target = target;
    }

    public String getOrderNumber() {
        return orderNumber;
    }

    public void setOrderNumber(String orderNumber) {
        this.orderNumber = orderNumber;
    }

    public Payer getPayer() {
        return payer;
    }

    public void setPayer(Payer payer) {
        this.payer = payer;
    }

    public String getOrderDescription() {
        return orderDescription;
    }

    public void setOrderDescription(String orderDescription) {
        this.orderDescription = orderDescription;
    }

    public List<OrderItem> getItems() {
        return items;
    }

    public void setItems(List<OrderItem> items) {
        this.items = items;
    }

    public Callback getCallback() {
        return callback;
    }

    public void setCallback(Callback callback) {
        this.callback = callback;
    }

    public Recurrence getRecurrence() {
        return recurrence;
    }

    public void setRecurrence(Recurrence recurrence) {
        this.recurrence = recurrence;
    }

    public List<AdditionalParam> getAdditionalParams() {
        return additionalParams;
    }

    public void setAdditionalParams(List<AdditionalParam> aditionalParams) {
        this.additionalParams = aditionalParams;
    }

    public Boolean getPreAuthorization() {
        return preAuthorization;
    }

    public void setPreAuthorization(Boolean preAuthorization) {
        this.preAuthorization = preAuthorization;
    }

    public String getLang() {
        return lang;
    }

    public void setLang(String lang) {
        this.lang = lang;
    }
    
    
    public EET getEet() {
        return eet;
    }
    
    public void setEet(EET eet) {
        this.eet = eet;
    }
    
    @Override
    public String toString() {
        return String.format(
                "BasePayment [orderNumber=%s, payer=%s, target=%s, amount=%s, currency=%s, callback=%s, recurrence=%s, preAuthorization=%s, lang=%s]",
                orderNumber, payer, target, amount, currency, callback, recurrence, preAuthorization, lang);
    }
} @XmlRootElement
public class CapturePayment {
	
	@XmlElement(name = "amount")
	private Long amount;
	
	@XmlElement(name = "items")
	private List<OrderItem> items;
	
	@XmlElement(name = "eet")
	private EET eet;
	
	public Long getAmount() {
		return amount;
	}
	
	public void setAmount(Long amount) {
		this.amount = amount;
	}
	
	public List<OrderItem> getItems() {
		return items;
	}
	
	public void setItems(List<OrderItem> items) {
		this.items = items;
	}
	
	public EET getEet() {
		return eet;
	}
	
	public void setEet(EET eet) {
		this.eet = eet;
	}
} @XmlRootElement
public class NextPayment {

    @XmlElement(name = "amount")
    private Long amount;

    @XmlElement(name = "currency")
    private Currency currency;

    @XmlElement(name = "order_number")
    private String orderNumber;

    @XmlElement(name = "order_description")
    private String orderDescription;

    @XmlElement(name = "items")
    private List<OrderItem> items;

    @XmlElement(name = "additional_params")
    private List<AdditionalParam> additionalParams;

    @XmlElement(name = "eet")
    private EET eet;
    
    public Long getAmount() {
        return amount;
    }

    public void setAmount(Long amount) {
        this.amount = amount;
    }

    public Currency getCurrency() {
        return currency;
    }

    public void setCurrency(Currency currency) {
        this.currency = currency;
    }

    public String getOrderNumber() {
        return orderNumber;
    }

    public void setOrderNumber(String orderNumber) {
        this.orderNumber = orderNumber;
    }

    public String getOrderDescription() {
        return orderDescription;
    }

    public void setOrderDescription(String orderDescription) {
        this.orderDescription = orderDescription;
    }

    public List<OrderItem> getItems() {
        return items;
    }

    public void setItems(List<OrderItem> items) {
        this.items = items;
    }

    public List<AdditionalParam> getAdditionalParams() {
        return additionalParams;
    }
    
    public EET getEet() {
        return eet;
    }
    
    public void setEet(EET eet) {
        this.eet = eet;
    }
    
    public void setAdditionalParams(List<AdditionalParam> additionalParams) {
        this.additionalParams = additionalParams;
    }

    @Override
    public String toString() {
        return String.format("CreateNextPayment [amount=%s, currency=%s, orderNumber=%s, orderDescription=%s]",
                amount, currency, orderNumber,
                orderDescription);
    }

    public static NextPayment create() {
        NextPayment result = new NextPayment();
        return result;
    }
    
} @XmlRootElement
public class Payment {

    public enum SessionState {
        CREATED,
        PAYMENT_METHOD_CHOSEN,
        PAID,
        AUTHORIZED,
        CANCELED,
        TIMEOUTED,
        REFUNDED,
        PARTIALLY_REFUNDED
    }

    @XmlElement(name = "id")
    private Long id;

    @XmlElement(name = "parent_id")
    private Long parentId;

    @XmlElement(name = "order_number")
    private String orderNumber;

    @XmlElement(name = "state")
    private SessionState state;
    
    @XmlElement(name = "sub_state")
    private SessionSubState subState;

    @XmlElement(name = "payment_instrument")
    private PaymentInstrument paymentInstrument;

    @XmlElement(name = "amount")
    private Long amount;

    @XmlElement(name = "currency")
    private Currency currency;

    @XmlElement(name = "payer")
    private Payer payer;

    @XmlElement(name = "target")
    private Target target;

    @XmlElement(name = "recurrence")
    private Recurrence recurrence;

    @XmlElement(name = "preauthorization")
    private Preauthorization preAuthorization;

    @XmlElement(name = "additional_params")
    private List<AdditionalParam> additionalParams;

    @XmlElement(name = "lang")
    private String lang;

    @XmlElement(name = "gw_url")
    private String gwUrl;

    @XmlElement(name = "eet_code")
    private EETCode eetCode;
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public SessionState getState() {
        return state;
    }

    public void setState(SessionState state) {
        this.state = state;
    }
    
    public SessionSubState getSubState() {
        return subState;
    }
    
    public void setSubState(SessionSubState subState) {
        this.subState = subState;
    }
    
    public PaymentInstrument getPaymentInstrument() {
        return paymentInstrument;
    }

    public void setPaymentInstrument(PaymentInstrument paymentInstrument) {
        this.paymentInstrument = paymentInstrument;
    }

    public Long getAmount() {
        return amount;
    }

    public void setAmount(Long amount) {
        this.amount = amount;
    }

    public Currency getCurrency() {
        return currency;
    }

    public void setCurrency(Currency currency) {
        this.currency = currency;
    }

    public Payer getPayer() {
        return payer;
    }

    public void setPayer(Payer payer) {
        this.payer = payer;
    }

    public Target getTarget() {
        return target;
    }

    public void setTarget(Target target) {
        this.target = target;
    }

    public Recurrence getRecurrence() {
        return recurrence;
    }

    public void setRecurrence(Recurrence recurrence) {
        this.recurrence = recurrence;
    }

    public List<AdditionalParam> getAdditionalParams() {
        return additionalParams;
    }

    public void setAdditionalParams(List<AdditionalParam> aditionalParams) {
        this.additionalParams = aditionalParams;
    }

    public String getOrderNumber() {
        return orderNumber;
    }

    public void setOrderNumber(String orderNumber) {
        this.orderNumber = orderNumber;
    }

    public Preauthorization getPreAuthorization() {
        return preAuthorization;
    }

    public void setPreAuthorization(Preauthorization preAuthorization) {
        this.preAuthorization = preAuthorization;
    }

    public String getLang() {
        return lang;
    }

    public void setLang(String lang) {
        this.lang = lang;
    }

    public String getGwUrl() {
        return gwUrl;
    }

    public void setGwUrl(String gwUrl) {
        this.gwUrl = gwUrl;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }
    
    public EETCode getEetCode() {
        return eetCode;
    }
    
    public void setEetCode(EETCode eetCode) {
        this.eetCode = eetCode;
    }
    
    @Override
    public String toString() {
        return String.format(
                "Payment [id=%s, parentId=%s, state=%s, paymentInstrument=%s, amount=%s, currency=%s, payer=%s, target=%s, recurrence=%s, aditionalParams=%s, preAuthorization=%s, lang=%s]",
                id, parentId, state, paymentInstrument, amount, currency, payer, target, recurrence, additionalParams,
                preAuthorization, lang);
    }

    
    
    public static Payment create(Long id, Long parentId, SessionState state) {
        Payment result = new Payment();
        result.setId(id);
        result.setParentId(parentId);
        result.setState(state);
        return result;
    }

    public Payment chosenPaymentInstrument(PaymentInstrument paymentInstrument) {
        this.paymentInstrument = paymentInstrument;
        return this;
    }

    public Payment withPrice(Long amount, Currency currency) {
        this.amount = amount;
        this.currency = currency;
        return this;
    }

    public Payment identifiedBy(String orderNumber) {
        this.orderNumber = orderNumber;
        return this;
    }

    public Payment withPayerParty(Payer payer) {
        this.payer = payer;
        return this;
    }

    public Payment withTargetParty(Target target) {
        this.target = target;
        return this;
    }

    public Payment withRecurrence(Recurrence recurrence) {
        this.recurrence = recurrence;
        return this;
    }

    public Payment asChildOf(Long parentId) {
        this.parentId = parentId;
        return this;
    }

    public Payment addAdditionalParam(String name, String value) {
        if (name == null || value == null) {
            return this;
        }
        if (additionalParams == null) {
            this.additionalParams = new ArrayList<>();
        }
        this.additionalParams.add(AdditionalParam.of(name, value));
        return this;
    }

    public Payment addAdditionalParam(AdditionalParam param) {
        if (param == null) {
            return this;
        }
        if (additionalParams == null) {
            this.additionalParams = new ArrayList<>();
        }
        this.additionalParams.add(param);
        return this;
    }

    public Payment withPreAuthorization(Preauthorization preAuthorization) {
        this.preAuthorization = preAuthorization;
        return this;
    }

    public Payment onURL(String url) {
        this.gwUrl = url;
        return this;
    }

    public Payment inLang(String lang) {
        this.lang = lang;
        return this;
    }
} @XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
public class PaymentResult {

    public enum Result {
        ACCEPTED,
        FINISHED,
        FAILED;
    }

    @XmlElement(name = "id")
    private Long id;

    @XmlElement(name = "result")
    private Result result;

    @XmlElement(name = "description")
    private String description;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Result getResult() {
        return result;
    }

    public void setResult(Result result) {
        this.result = result;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Override
    public String toString() {
        return String.format("PaymentResult [id=%s, result=%s, description=%s]",
                id, result, description);
    }

    public static PaymentResult create(Long paymentId) {
        PaymentResult result = new PaymentResult();
        result.setId(paymentId);
        return result;
    }

    public PaymentResult success() {
        setResult(Result.FINISHED);
        return this;
    }

    public PaymentResult accepted() {
        setResult(Result.ACCEPTED);
        return this;
    }

    public PaymentResult failed(String desc) {
        setResult(Result.FAILED);
        setDescription(desc);
        return this;
    }

} @XmlRootElement
public class RefundPayment {
	
	@XmlElement(name = "amount")
	private Long amount;
	
	@XmlElement(name = "items")
	private List<OrderItem> items;
	
	@XmlElement(name = "eet")
	private EET eet;
	
	public Long getAmount() {
		return amount;
	}
	
	public void setAmount(Long amount) {
		this.amount = amount;
	}
	
	public List<OrderItem> getItems() {
		return items;
	}
	
	public void setItems(List<OrderItem> items) {
		this.items = items;
	}
	
	public EET getEet() {
		return eet;
	}
	
	public void setEet(EET eet) {
		this.eet = eet;
	}
} @XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class AccountStatement {
	
	@XmlElement(name="date_from")
	@XmlJavaTypeAdapter(GPDateAdapter.class)
	private Date dateFrom;
	
	@XmlElement(name="date_to")
	@XmlJavaTypeAdapter(GPDateAdapter.class)
	private Date dateTo;
	
	@XmlElement(name="goid")
	private Long goID;
	
	@XmlElement(name="currency")
	private Currency currency;
	
	private StatementGeneratingFormat format;
	
	public StatementGeneratingFormat getFormat() {
		return format;
	}
	
	public void setFormat(StatementGeneratingFormat format) {
		this.format = format;
	}
	
	public Date getDateFrom() {
		return dateFrom;
	}
	
	public void setDateFrom(Date dateFrom) {
		this.dateFrom = dateFrom;
	}
	
	public Date getDateTo() {
		return dateTo;
	}
	
	public void setDateTo(Date dateTo) {
		this.dateTo = dateTo;
	}
	
	public Long getGoID() {
		return goID;
	}
	
	public void setGoID(Long goID) {
		this.goID = goID;
	}
	
	public Currency getCurrency() {
		return currency;
	}
	
	public void setCurrency(Currency currency) {
		this.currency = currency;
	}
	
	@Override
	public String toString() {
		return String.format("AccountStatement=[dateFrom=%s,dateTo=%s,goId=%s,currency=%s,format=%s]",dateFrom,dateTo,goID,currency,format);
	}
} @XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class PaymentInstrumentRoot {
	
	@XmlElement(name = "groups")
	private Map<CheckoutGroup, Group> groups;
	
	@XmlElement(name = "enabledPaymentInstruments")
	private List<EnabledPaymentInstrument> enabledPaymentInstruments;
	
	public Map<CheckoutGroup, Group> getGroups() {
		return groups;
	}
	
	public PaymentInstrumentRoot addGroup(CheckoutGroup coGroup, Group groupData) {
		
		if (this.groups == null) {
			this.groups = new LinkedHashMap<>();
		}
		
		this.groups.put(coGroup, groupData);
		return this;
	}
	
	public List<EnabledPaymentInstrument> getEnabledPaymentInstruments() {
		return enabledPaymentInstruments;
	}
	
	public PaymentInstrumentRoot addEnabledPaymentInstrument(EnabledPaymentInstrument instrument) {
		
		if (this.enabledPaymentInstruments == null) {
			this.enabledPaymentInstruments = new ArrayList<>();
		}
		
		this.enabledPaymentInstruments.add(instrument);
		return this;
	}
	
}
import cz.gopay.api.v3.model.access.AccessToken;
import cz.gopay.api.v3.model.common.Currency;
import cz.gopay.api.v3.model.eet.EETReceipt;
import cz.gopay.api.v3.model.eet.EETReceiptFilter;
import cz.gopay.api.v3.model.payment.BasePayment;
import cz.gopay.api.v3.model.payment.CapturePayment;
import cz.gopay.api.v3.model.payment.NextPayment;
import cz.gopay.api.v3.model.payment.Payment;
import cz.gopay.api.v3.model.payment.PaymentResult;
import cz.gopay.api.v3.model.payment.RefundPayment;
import cz.gopay.api.v3.model.payment.support.AccountStatement;
import cz.gopay.api.v3.model.payment.support.PaymentInstrumentRoot;
import java.util.List;
package cz.gopay.api.v3;



/**
 *
 * @author František Sichinger
 */
public interface IGPConnector {

    IGPConnector getAppToken(String clientId, String clientCredentials) throws GPClientException;

    IGPConnector getAppToken(String clientId, String clientCredentials,
            String scope) throws GPClientException;

    Payment createPayment(BasePayment payment) throws GPClientException;

    PaymentResult refundPayment(Long id, Long amount) throws GPClientException;

    Payment createRecurrentPayment(Long id, NextPayment nextPayment) throws GPClientException;

    PaymentResult voidRecurrency(Long id) throws GPClientException;

    PaymentResult capturePayment(Long id) throws GPClientException;
    
    PaymentResult capturePayment(Long id, CapturePayment capturePayment) throws GPClientException;

    PaymentResult voidAuthorization(Long id) throws GPClientException;

    Payment paymentStatus(Long id) throws GPClientException;
    
    PaymentResult refundPayment(Long id, RefundPayment refundPayment) throws GPClientException;