88 lines
2.2 KiB
Java
88 lines
2.2 KiB
Java
package it.acxent.checkVatService;
|
|
|
|
import checkVat.services.vies.taxud.eu.europa.ec.CheckVatPortTypeProxy;
|
|
import java.sql.Date;
|
|
import javax.xml.rpc.holders.BooleanHolder;
|
|
import javax.xml.rpc.holders.StringHolder;
|
|
import org.apache.axis.holders.DateHolder;
|
|
|
|
public class CheckVatClient {
|
|
private String name;
|
|
|
|
private String address;
|
|
|
|
private String vatNumber;
|
|
|
|
private String countryCode;
|
|
|
|
private Date requestDate;
|
|
|
|
private boolean valid;
|
|
|
|
public CheckVatClient(String countryCode, String vatNumber) {
|
|
BooleanHolder validSH = new BooleanHolder();
|
|
DateHolder requestDateSH = new DateHolder();
|
|
StringHolder countryCodeSH = new StringHolder(countryCode);
|
|
StringHolder vatNumberSH = new StringHolder(vatNumber);
|
|
StringHolder nameSH = new StringHolder();
|
|
StringHolder addressSH = new StringHolder();
|
|
CheckVatPortTypeProxy service = new CheckVatPortTypeProxy();
|
|
try {
|
|
service.checkVat(countryCodeSH, vatNumberSH, requestDateSH, validSH, nameSH, addressSH);
|
|
setAddress(addressSH.value);
|
|
setName(nameSH.value);
|
|
setValid(validSH.value);
|
|
setRequestDate(new Date(requestDateSH.value.getTime()));
|
|
setCountryCode(countryCode);
|
|
setVatNumber(vatNumber);
|
|
} catch (Exception e) {}
|
|
}
|
|
|
|
public String getName() {
|
|
return (this.name == null) ? "" : this.name;
|
|
}
|
|
|
|
public void setName(String name) {
|
|
this.name = name;
|
|
}
|
|
|
|
public String getAddress() {
|
|
return (this.address == null) ? "" : this.address.trim();
|
|
}
|
|
|
|
public void setAddress(String address) {
|
|
this.address = address;
|
|
}
|
|
|
|
public String getVatNumber() {
|
|
return (this.vatNumber == null) ? "" : this.vatNumber;
|
|
}
|
|
|
|
public void setVatNumber(String vatNumber) {
|
|
this.vatNumber = vatNumber;
|
|
}
|
|
|
|
public String getCountryCode() {
|
|
return (this.countryCode == null) ? "" : this.countryCode;
|
|
}
|
|
|
|
public void setCountryCode(String countryCode) {
|
|
this.countryCode = countryCode;
|
|
}
|
|
|
|
public Date getRequestDate() {
|
|
return this.requestDate;
|
|
}
|
|
|
|
public void setRequestDate(Date requestDate) {
|
|
this.requestDate = requestDate;
|
|
}
|
|
|
|
public boolean getValid() {
|
|
return this.valid;
|
|
}
|
|
|
|
public void setValid(boolean valid) {
|
|
this.valid = valid;
|
|
}
|
|
}
|