diff --git a/pom.xml b/pom.xml
index f6f53b2..4c5af74 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
ISO-8859-1
SW-JAVA
- 0.0.5.0
+ 0.0.5.1
jar
https://github.com/lunasoft/sw-sdk-java
diff --git a/src/main/java/Services/Csd/SWCsdService.java b/src/main/java/Services/Csd/SWCsdService.java
index bfbd973..8ca3619 100644
--- a/src/main/java/Services/Csd/SWCsdService.java
+++ b/src/main/java/Services/Csd/SWCsdService.java
@@ -32,5 +32,47 @@ public IResponse UploadMyCsd(String b64Cer, String b64Key, String passwordCsd, S
CsdRequest req = new CsdRequest();
return req.sendRequest(settings);
}
+
+ public IResponse DisableMyCsd(String certificateNumber) throws AuthException, GeneralException, IOException {
+ CsdOptionsRequest settings = null;
+ settings = new CsdOptionsRequest(getToken(), getURI(), certificateNumber, getProxyHost(), getProxyPort());
+ CsdRequest req = new CsdRequest();
+ return req.DisableCsdRequest(settings);
+ }
+
+ public IResponse GetListCsd() throws AuthException, GeneralException, IOException {
+ CsdOptionsRequest settings = null;
+ settings = new CsdOptionsRequest(getToken(), getURI(), getProxyHost(), getProxyPort());
+ CsdRequest req = new CsdRequest();
+ return req.GetListCsdRequest(settings);
+ }
+
+ public IResponse GetListCsdByType(String type) throws AuthException, GeneralException, IOException {
+ CsdOptionsRequest settings = null;
+ settings = new CsdOptionsRequest(getToken(), getURI(), "type/" + type, getProxyHost(), getProxyPort());
+ CsdRequest req = new CsdRequest();
+ return req.GetListCsdRequest(settings);
+ }
+
+ public IResponse GetListCsdByRfc(String rfc) throws AuthException, GeneralException, IOException {
+ CsdOptionsRequest settings = null;
+ settings = new CsdOptionsRequest(getToken(), getURI(), "rfc/" + rfc, getProxyHost(), getProxyPort());
+ CsdRequest req = new CsdRequest();
+ return req.GetListCsdRequest(settings);
+ }
+
+ public IResponse SearchMyCsd(String certificateNumber) throws AuthException, GeneralException, IOException {
+ CsdOptionsRequest settings = null;
+ settings = new CsdOptionsRequest(getToken(), getURI(), certificateNumber, getProxyHost(), getProxyPort());
+ CsdRequest req = new CsdRequest();
+ return req.GetInfoCsdRequest(settings);
+ }
+
+ public IResponse SearchActiveCsd(String rfc, String type) throws AuthException, GeneralException, IOException {
+ CsdOptionsRequest settings = null;
+ settings = new CsdOptionsRequest(getToken(), getURI(), "rfc/" + rfc, type, getProxyHost(), getProxyPort());
+ CsdRequest req = new CsdRequest();
+ return req.GetInfoCsdRequest(settings);
+ }
}
diff --git a/src/main/java/Services/Issue/SWIssueService.java b/src/main/java/Services/Issue/SWIssueService.java
index 6ab7a79..7857029 100644
--- a/src/main/java/Services/Issue/SWIssueService.java
+++ b/src/main/java/Services/Issue/SWIssueService.java
@@ -41,13 +41,13 @@ public IResponse IssueJson(byte[] jsonFile, String version) throws AuthException
return req.sendRequest(settings);
}
public IResponse IssueXml(String xml, String version) throws AuthException, GeneralException, IOException {
- IssueOptionsRequest settings = new IssueOptionsRequest(getToken(), getURI(), xml, version, true, getProxyHost(), getProxyPort());
+ IssueOptionsRequest settings = new IssueOptionsRequest(getToken(), getURI(), xml, version, true, getProxyHost(), getProxyPort(), false);
IssueRequest req = new IssueRequest();
return req.sendRequestXml(settings);
}
public IResponse IssueXml(byte[] xmlfile, String version) throws AuthException, GeneralException, IOException {
String xmlProcess = new String(xmlfile, Charset.forName("UTF-8"));
- IssueOptionsRequest settings = new IssueOptionsRequest(getToken(), getURI(), xmlProcess, version, true, getProxyHost(), getProxyPort());
+ IssueOptionsRequest settings = new IssueOptionsRequest(getToken(), getURI(), xmlProcess, version, true, getProxyHost(), getProxyPort(), false);
IssueRequest req = new IssueRequest();
return req.sendRequestXml(settings);
}
diff --git a/src/main/java/Services/Issue/SWIssueServiceV2.java b/src/main/java/Services/Issue/SWIssueServiceV2.java
new file mode 100644
index 0000000..df5dd2b
--- /dev/null
+++ b/src/main/java/Services/Issue/SWIssueServiceV2.java
@@ -0,0 +1,41 @@
+package Services.Issue;
+
+import Exceptions.AuthException;
+import Exceptions.GeneralException;
+import Utils.Requests.Issue.IssueOptionsRequest;
+import Utils.Requests.Issue.IssueRequest;
+import Utils.Responses.IResponse;
+
+import java.io.IOException;
+import java.nio.charset.Charset;
+
+public class SWIssueServiceV2 extends SWIssueService {
+
+ public SWIssueServiceV2(String user, String password, String URI) throws AuthException {
+ super(user, password, URI);
+ }
+
+ public SWIssueServiceV2(String token, String URI) {
+ super(token, URI);
+ }
+
+ public SWIssueServiceV2(String user, String password, String URI, String proxyHost, int proxyPort) throws AuthException {
+ super(user, password, URI, proxyHost, proxyPort);
+ }
+
+ public SWIssueServiceV2(String token, String URI, String proxyHost, int proxyPort) {
+ super(token, URI, proxyHost, proxyPort);
+ }
+
+ public IResponse IssueXml(String xml, String version) throws AuthException, GeneralException, IOException {
+ IssueOptionsRequest settings = new IssueOptionsRequest(getToken(), getURI(), xml, version, true, getProxyHost(), getProxyPort(), true);
+ IssueRequest req = new IssueRequest();
+ return req.sendRequestXml(settings);
+ }
+ public IResponse IssueXml(byte[] xmlfile, String version) throws AuthException, GeneralException, IOException {
+ String xmlProcess = new String(xmlfile, Charset.forName("UTF-8"));
+ IssueOptionsRequest settings = new IssueOptionsRequest(getToken(), getURI(), xmlProcess, version, true, getProxyHost(), getProxyPort(), true);
+ IssueRequest req = new IssueRequest();
+ return req.sendRequestXml(settings);
+ }
+}
diff --git a/src/main/java/Services/Stamp/SWStampService.java b/src/main/java/Services/Stamp/SWStampService.java
index 5c4c9a6..1e68ddf 100644
--- a/src/main/java/Services/Stamp/SWStampService.java
+++ b/src/main/java/Services/Stamp/SWStampService.java
@@ -30,7 +30,7 @@ public SWStampService(String token, String URI, String proxyHost, int proxyPort)
}
public IResponse Stamp(String xml, String version) throws AuthException, GeneralException, IOException {
- StampOptionsRequest settings = new StampOptionsRequest(getToken(), getURI(), xml, version, getProxyHost(), getProxyPort());
+ StampOptionsRequest settings = new StampOptionsRequest(getToken(), getURI(), xml, version, getProxyHost(), getProxyPort(), false);
StampRequest req = new StampRequest();
return req.sendRequest(settings);
}
@@ -38,11 +38,11 @@ public IResponse Stamp(String xml, String version) throws AuthException, General
public IResponse Stamp(String xml, String version, boolean isb64)
throws AuthException, GeneralException, IOException {
if (isb64) {
- StampOptionsRequest settings = new StampOptionsRequest(getToken(), getURI(), xml, version, isb64, getProxyHost(), getProxyPort());
+ StampOptionsRequest settings = new StampOptionsRequest(getToken(), getURI(), xml, version, isb64, getProxyHost(), getProxyPort(), false);
StampRequest req = new StampRequest();
return req.sendRequest(settings);
} else {
- StampOptionsRequest settings = new StampOptionsRequest(getToken(), getURI(), xml, version, getProxyHost(), getProxyPort());
+ StampOptionsRequest settings = new StampOptionsRequest(getToken(), getURI(), xml, version, getProxyHost(), getProxyPort(), false);
StampRequest req = new StampRequest();
return req.sendRequest(settings);
}
@@ -51,14 +51,14 @@ public IResponse Stamp(String xml, String version, boolean isb64)
public IResponse Stamp(byte[] xmlFile, String version, boolean isb64)
throws AuthException, GeneralException, IOException {
String xmlProcess = new String(xmlFile, Charset.forName("UTF-8"));
- StampOptionsRequest settings = new StampOptionsRequest(getToken(), getURI(), xmlProcess, version, getProxyHost(), getProxyPort());
+ StampOptionsRequest settings = new StampOptionsRequest(getToken(), getURI(), xmlProcess, version, getProxyHost(), getProxyPort(), false);
StampRequest req = new StampRequest();
return req.sendRequest(settings);
}
public IResponse Stamp(byte[] xmlFile, String version) throws AuthException, GeneralException, IOException {
String xmlProcess = new String(xmlFile, Charset.forName("UTF-8"));
- StampOptionsRequest settings = new StampOptionsRequest(getToken(), getURI(), xmlProcess, version, getProxyHost(), getProxyPort());
+ StampOptionsRequest settings = new StampOptionsRequest(getToken(), getURI(), xmlProcess, version, getProxyHost(), getProxyPort(), false);
StampRequest req = new StampRequest();
return req.sendRequest(settings);
diff --git a/src/main/java/Services/Stamp/SWStampServiceV2.java b/src/main/java/Services/Stamp/SWStampServiceV2.java
new file mode 100644
index 0000000..15f1009
--- /dev/null
+++ b/src/main/java/Services/Stamp/SWStampServiceV2.java
@@ -0,0 +1,66 @@
+package Services.Stamp;
+
+import Exceptions.AuthException;
+import Exceptions.GeneralException;
+import Services.SWService;
+import Utils.Requests.Stamp.StampOptionsRequest;
+import Utils.Requests.Stamp.StampRequest;
+
+import Utils.Responses.IResponse;
+
+import java.io.IOException;
+import java.nio.charset.Charset;
+
+public class SWStampServiceV2 extends SWService {
+
+ public SWStampServiceV2(String user, String password, String URI) throws AuthException {
+ super(user, password, URI);
+ }
+
+ public SWStampServiceV2(String token, String URI) {
+ super(token, URI);
+ }
+
+ public SWStampServiceV2(String user, String password, String URI, String proxyHost, int proxyPort) throws AuthException {
+ super(user, password, URI, proxyHost, proxyPort);
+ }
+
+ public SWStampServiceV2(String token, String URI, String proxyHost, int proxyPort) {
+ super(token, URI, proxyHost, proxyPort);
+ }
+
+ public IResponse Stamp(String xml, String version) throws AuthException, GeneralException, IOException {
+ StampOptionsRequest settings = new StampOptionsRequest(getToken(), getURI(), xml, version, getProxyHost(), getProxyPort(), true);
+ StampRequest req = new StampRequest();
+ return req.sendRequest(settings);
+ }
+
+ public IResponse Stamp(String xml, String version, boolean isb64)
+ throws AuthException, GeneralException, IOException {
+ if (isb64) {
+ StampOptionsRequest settings = new StampOptionsRequest(getToken(), getURI(), xml, version, isb64, getProxyHost(), getProxyPort(), true);
+ StampRequest req = new StampRequest();
+ return req.sendRequest(settings);
+ } else {
+ StampOptionsRequest settings = new StampOptionsRequest(getToken(), getURI(), xml, version, getProxyHost(), getProxyPort(), true);
+ StampRequest req = new StampRequest();
+ return req.sendRequest(settings);
+ }
+ }
+
+ public IResponse Stamp(byte[] xmlFile, String version, boolean isb64)
+ throws AuthException, GeneralException, IOException {
+ String xmlProcess = new String(xmlFile, Charset.forName("UTF-8"));
+ StampOptionsRequest settings = new StampOptionsRequest(getToken(), getURI(), xmlProcess, version, getProxyHost(), getProxyPort(), true);
+ StampRequest req = new StampRequest();
+ return req.sendRequest(settings);
+ }
+
+ public IResponse Stamp(byte[] xmlFile, String version) throws AuthException, GeneralException, IOException {
+ String xmlProcess = new String(xmlFile, Charset.forName("UTF-8"));
+ StampOptionsRequest settings = new StampOptionsRequest(getToken(), getURI(), xmlProcess, version, getProxyHost(), getProxyPort(), true);
+ StampRequest req = new StampRequest();
+ return req.sendRequest(settings);
+
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/Utils/Constants.java b/src/main/java/Utils/Constants.java
index 971333a..2a21e59 100644
--- a/src/main/java/Utils/Constants.java
+++ b/src/main/java/Utils/Constants.java
@@ -4,8 +4,10 @@ public class Constants {
public static String BASE_PATH = "http://services.test.sw.com.mx";
public static String AUTH_PATH = "/security/authenticate";
public static String STAMP_PATH = "/cfdi33/stamp/";
+ public static String STAMP_V2_PATH = "/cfdi33/v2/stamp/";
public static String ISSUE_JSON_PATH = "/v3/cfdi33/issue/json/";
public static String ISSUE_XML_PATH = "/cfdi33/issue/";
+ public static String ISSUE_XML_V2_PATH = "/cfdi33/v2/issue/";
public static String CANCELATION_CSD_PATH = "/cfdi33/cancel/csd";
public static String CANCELATION_XML_PATH = "/cfdi33/cancel/xml";
public static String CANCELATION_PFX_PATH = "/cfdi33/cancel/pfx";
@@ -26,4 +28,7 @@ public class Constants {
public static String PENDIENTES_CANCELAR_PATH = "/pendings/";
public static String SAVE_CSD = "/csd/save";
public static String TAXPAYERS_PATH = "/taxpayers/";
+ public static String SAVE_CSD = "/certificates/save";
+ public static String DISABLE_SEARCH_CSD = "/certificates/";
+ public static String LIST_CSD = "/certificates";
}
diff --git a/src/main/java/Utils/Helpers/BuildResponseV1.java b/src/main/java/Utils/Helpers/BuildResponseV1.java
index 80c92ac..5ac2eb0 100644
--- a/src/main/java/Utils/Helpers/BuildResponseV1.java
+++ b/src/main/java/Utils/Helpers/BuildResponseV1.java
@@ -7,7 +7,7 @@
public class BuildResponseV1 extends ResponseStamp {
public IResponse getResponse() {
- if(!response.trim().isEmpty()) {
+ if(!response.trim().isEmpty() && status < 500) {
JSONObject body = new JSONObject(response);
if(status == 200) {
JSONObject data = body.getJSONObject("data");
@@ -18,11 +18,17 @@ public IResponse getResponse() {
if (!body.isNull("messageDetail")){
messageDetail = body.getString("messageDetail");
}
+ if(body.getString("message").equals("307. El comprobante contiene un timbre previo.")) {
+ if(!body.isNull("data")) {
+ JSONObject data = body.getJSONObject("data");
+ return new SuccessV1Response(status, body.getString("status"), data.getString("tfd"), body.getString("message"), messageDetail);
+ }
+ }
return new SuccessV1Response(status, body.getString("status"), "", body.getString("message"), messageDetail);
}
}
else {
- return new SuccessV1Response(status, "error", "","Error con código "+status+": "+reason.getReasonPhrase(), reason.getProtocolVersion().getProtocol());
+ return new SuccessV1Response(status, "error", "","Error con código "+status+": "+reason.getReasonPhrase(), response);
}
}
}
diff --git a/src/main/java/Utils/Helpers/BuildResponseV2.java b/src/main/java/Utils/Helpers/BuildResponseV2.java
index f3bdccf..6b472bc 100644
--- a/src/main/java/Utils/Helpers/BuildResponseV2.java
+++ b/src/main/java/Utils/Helpers/BuildResponseV2.java
@@ -3,11 +3,12 @@
import org.json.JSONObject;
import Utils.Responses.IResponse;
+import Utils.Responses.Stamp.SuccessV1Response;
import Utils.Responses.Stamp.SuccessV2Response;
public class BuildResponseV2 extends ResponseStamp {
public IResponse getResponse() {
- if(!response.trim().isEmpty()) {
+ if(!response.trim().isEmpty() && status < 500) {
JSONObject body = new JSONObject(response);
if(status == 200) {
JSONObject data = body.getJSONObject("data");
@@ -18,11 +19,17 @@ public IResponse getResponse() {
if (!body.isNull("messageDetail")){
messageDetail = body.getString("messageDetail");
}
- return new SuccessV2Response(status, body.getString("status"), "", "",body.getString("message"), messageDetail);
+ if(body.getString("message").equals("307. El comprobante contiene un timbre previo.")) {
+ if(!body.isNull("data")) {
+ JSONObject data = body.getJSONObject("data");
+ return new SuccessV2Response(status, body.getString("status"), data.getString("tfd"), data.getString("cfdi"), body.getString("message"), messageDetail);
+ }
+ }
+ return new SuccessV2Response(status, body.getString("status"), "", "", body.getString("message"), messageDetail);
}
}
else {
- return new SuccessV2Response(status, "error", "", "","Error con código "+status+": "+reason.getReasonPhrase(), reason.getProtocolVersion().getProtocol());
+ return new SuccessV2Response(status, "error", "", "","Error con código "+status+": "+reason.getReasonPhrase(), response);
}
}
}
diff --git a/src/main/java/Utils/Helpers/BuildResponseV3.java b/src/main/java/Utils/Helpers/BuildResponseV3.java
index fb1335c..4355f19 100644
--- a/src/main/java/Utils/Helpers/BuildResponseV3.java
+++ b/src/main/java/Utils/Helpers/BuildResponseV3.java
@@ -3,26 +3,33 @@
import org.json.JSONObject;
import Utils.Responses.IResponse;
+import Utils.Responses.Stamp.SuccessV2Response;
import Utils.Responses.Stamp.SuccessV3Response;
public class BuildResponseV3 extends ResponseStamp {
public IResponse getResponse() {
- if(!response.trim().isEmpty()) {
+ if(!response.trim().isEmpty() && status < 500) {
JSONObject body = new JSONObject(response);
if(status == 200) {
JSONObject data = body.getJSONObject("data");
- return new SuccessV3Response(status, body.getString("status"), data.getString("cfdi"),reason.getReasonPhrase(), reason.getReasonPhrase());
+ return new SuccessV3Response(status, body.getString("status"), data.getString("cfdi"), "OK", "OK");
}
else {
String messageDetail = "";
if (!body.isNull("messageDetail")){
messageDetail = body.getString("messageDetail");
}
- return new SuccessV3Response(status, body.getString("status"), "",body.getString("message"), messageDetail);
+ if(body.getString("message").equals("307. El comprobante contiene un timbre previo.")) {
+ if(!body.isNull("data")) {
+ JSONObject data = body.getJSONObject("data");
+ return new SuccessV3Response(status, body.getString("status"), data.getString("cfdi"), body.getString("message"), messageDetail);
+ }
+ }
+ return new SuccessV3Response(status, body.getString("status"), "", body.getString("message"), messageDetail);
}
}
else {
- return new SuccessV3Response(status, "error", "","Error con código "+status+": "+reason.getReasonPhrase(), reason.getProtocolVersion().getProtocol());
+ return new SuccessV3Response(status, "error", "","Error con código "+status+": "+reason.getReasonPhrase(), response);
}
}
}
diff --git a/src/main/java/Utils/Helpers/BuildResponseV4.java b/src/main/java/Utils/Helpers/BuildResponseV4.java
index 6df3976..7e38307 100644
--- a/src/main/java/Utils/Helpers/BuildResponseV4.java
+++ b/src/main/java/Utils/Helpers/BuildResponseV4.java
@@ -3,11 +3,12 @@
import org.json.JSONObject;
import Utils.Responses.IResponse;
+import Utils.Responses.Stamp.SuccessV3Response;
import Utils.Responses.Stamp.SuccessV4Response;
public class BuildResponseV4 extends ResponseStamp {
public IResponse getResponse() {
- if(!response.trim().isEmpty()) {
+ if(!response.trim().isEmpty() && status < 500) {
JSONObject body = new JSONObject(response);
if(status == 200) {
JSONObject data = body.getJSONObject("data");
@@ -16,18 +17,29 @@ public IResponse getResponse() {
data.getString("noCertificadoSAT"), data.getString("noCertificadoCFDI"),
data.getString("uuid"), data.getString("selloSAT"),
data.getString("selloCFDI"), data.getString("fechaTimbrado"),
- data.getString("qrCode"), reason.getReasonPhrase(), reason.getReasonPhrase());
+ data.getString("qrCode"), "OK", "OK");
}
else {
String messageDetail = "";
if (!body.isNull("messageDetail")){
messageDetail = body.getString("messageDetail");
}
+ if(body.getString("message").equals("307. El comprobante contiene un timbre previo.")) {
+ if(!body.isNull("data")) {
+ JSONObject data = body.getJSONObject("data");
+ return new SuccessV4Response(status, body.getString("status"),
+ data.getString("cfdi"), data.getString("cadenaOriginalSAT"),
+ data.getString("noCertificadoSAT"), data.getString("noCertificadoCFDI"),
+ data.getString("uuid"), data.getString("selloSAT"),
+ data.getString("selloCFDI"), data.getString("fechaTimbrado"),
+ data.getString("qrCode"), body.getString("message"), messageDetail);
+ }
+ }
return new SuccessV4Response(status, body.getString("status"), "", "", "", "", "", "", "", "", "", body.getString("message"), messageDetail);
}
}
else {
- return new SuccessV4Response(status, "error", "", "", "", "", "", "", "", "", "", "Error con código "+status+": "+reason.getReasonPhrase(), reason.getProtocolVersion().getProtocol());
+ return new SuccessV4Response(status, "error", "", "", "", "", "", "", "", "", "", "Error con código "+status+": "+reason.getReasonPhrase(), response);
}
}
}
diff --git a/src/main/java/Utils/Helpers/RequestHelper.java b/src/main/java/Utils/Helpers/RequestHelper.java
index cc01c3e..4d1970e 100644
--- a/src/main/java/Utils/Helpers/RequestHelper.java
+++ b/src/main/java/Utils/Helpers/RequestHelper.java
@@ -30,7 +30,7 @@ public static JSONArray buildJSONFromMap(Map map) throws General
}
public static void setProxy(Builder build, String host, int port) throws GeneralException {
- if(host != null){
+ if(!stringEmptyOrNull(host)){
try {
HttpHost proxy = new HttpHost(host, port);
build.setProxy(proxy);
diff --git a/src/main/java/Utils/Requests/AcceptReject/AceptarRechazarCancelationRequest.java b/src/main/java/Utils/Requests/AcceptReject/AceptarRechazarCancelationRequest.java
index 407f245..03695f2 100644
--- a/src/main/java/Utils/Requests/AcceptReject/AceptarRechazarCancelationRequest.java
+++ b/src/main/java/Utils/Requests/AcceptReject/AceptarRechazarCancelationRequest.java
@@ -66,7 +66,7 @@ public IResponse sendRequest(IRequest request) throws GeneralException, AuthExce
int status = responseB.getStatusLine().getStatusCode();
client.close();
responseB.close();
- if (!responseString.isEmpty()) {
+ if (!responseString.isEmpty() && status < 500) {
JSONObject body = new JSONObject(responseString);
if (status == 200) {
JSONObject data = body.getJSONObject("data");
@@ -88,7 +88,7 @@ public IResponse sendRequest(IRequest request) throws GeneralException, AuthExce
}
} else {
return new AceptarRechazarCancelationResponse(status, "error", responseB.getStatusLine().getReasonPhrase(),
- responseB.getStatusLine().getReasonPhrase());
+ responseString);
}
} catch (JSONException e) {
throw new GeneralException(500, e.getMessage());
diff --git a/src/main/java/Utils/Requests/Authentication/AuthRequest.java b/src/main/java/Utils/Requests/Authentication/AuthRequest.java
index 7aa3f74..8cd9551 100644
--- a/src/main/java/Utils/Requests/Authentication/AuthRequest.java
+++ b/src/main/java/Utils/Requests/Authentication/AuthRequest.java
@@ -41,7 +41,7 @@ public IResponse sendRequest(IRequest request) throws GeneralException, AuthExce
int status = responseB.getStatusLine().getStatusCode();
client.close();
responseB.close();
- if(!responseString.isEmpty()) {
+ if(!responseString.isEmpty() && status < 500) {
JSONObject body = new JSONObject(responseString);
if(!body.isNull("messageDetail")){
messageDetail = body.getString("messageDetail");
@@ -57,7 +57,7 @@ public IResponse sendRequest(IRequest request) throws GeneralException, AuthExce
}
}
else{
- return new SuccessAuthResponse(status,"error","",0,responseB.getStatusLine().getReasonPhrase(),responseB.getStatusLine().getReasonPhrase());
+ return new SuccessAuthResponse(status,"error","",0,responseB.getStatusLine().getReasonPhrase(), responseString);
}
diff --git a/src/main/java/Utils/Requests/BalanceAccount/BalanceAcctRequest.java b/src/main/java/Utils/Requests/BalanceAccount/BalanceAcctRequest.java
index ceafd05..b823e81 100644
--- a/src/main/java/Utils/Requests/BalanceAccount/BalanceAcctRequest.java
+++ b/src/main/java/Utils/Requests/BalanceAccount/BalanceAcctRequest.java
@@ -34,7 +34,7 @@ public IResponse sendRequest(IRequest request) throws GeneralException, AuthExce
int status = responseB.getStatusLine().getStatusCode();
client.close();
responseB.close();
- if(!responseString.isEmpty()) {
+ if(!responseString.isEmpty() && status < 500) {
JSONObject body = new JSONObject(responseString);
if (status == 200) {
JSONObject data = body.getJSONObject("data");
@@ -52,7 +52,7 @@ public IResponse sendRequest(IRequest request) throws GeneralException, AuthExce
return new BalanceAcctResponse(status, body.getString("status"), body.getString("message"), messageDetail);
}
} else {
- return new BalanceAcctResponse(status, "error", responseB.getStatusLine().getReasonPhrase(), responseB.getStatusLine().getReasonPhrase());
+ return new BalanceAcctResponse(status, "error", responseB.getStatusLine().getReasonPhrase(), responseString);
}
} catch (JSONException e) {
diff --git a/src/main/java/Utils/Requests/Cancelation/CancelationRequest.java b/src/main/java/Utils/Requests/Cancelation/CancelationRequest.java
index ed3e4c4..3f0702b 100644
--- a/src/main/java/Utils/Requests/Cancelation/CancelationRequest.java
+++ b/src/main/java/Utils/Requests/Cancelation/CancelationRequest.java
@@ -57,7 +57,7 @@ public IResponse sendRequest(IRequest request) throws GeneralException, AuthExce
int status = responseB.getStatusLine().getStatusCode();
client.close();
responseB.close();
- if (!responseString.isEmpty()) {
+ if (!responseString.isEmpty() && status < 500) {
JSONObject body = new JSONObject(responseString);
if (status == 200) {
JSONObject data = body.getJSONObject("data");
@@ -76,7 +76,7 @@ public IResponse sendRequest(IRequest request) throws GeneralException, AuthExce
}
} else {
return new CancelationResponse(status, "error", responseB.getStatusLine().getReasonPhrase(),
- responseB.getStatusLine().getReasonPhrase());
+ responseString);
}
} catch (JSONException e) {
throw new GeneralException(500, e.getMessage());
@@ -111,7 +111,7 @@ public IResponse sendRequest(IRequest request, boolean isXml) throws GeneralExce
int status = responseB.getStatusLine().getStatusCode();
client.close();
responseB.close();
- if (!responseString.isEmpty()) {
+ if (!responseString.isEmpty() && status < 500) {
JSONObject body = new JSONObject(responseString);
if (status == 200) {
JSONObject data = body.getJSONObject("data");
@@ -131,7 +131,7 @@ public IResponse sendRequest(IRequest request, boolean isXml) throws GeneralExce
}
} else {
return new CancelationResponse(status, "error", responseB.getStatusLine().getReasonPhrase(),
- responseB.getStatusLine().getReasonPhrase());
+ responseString);
}
} catch (JSONException e) {
throw new GeneralException(500, e.getMessage());
@@ -165,7 +165,7 @@ public IResponse sendRequestPfx(IRequest request) throws ClientProtocolException
int status = responseB.getStatusLine().getStatusCode();
client.close();
responseB.close();
- if (!responseString.isEmpty()) {
+ if (!responseString.isEmpty() && status < 500) {
JSONObject body = new JSONObject(responseString);
if (status == 200) {
JSONObject data = body.getJSONObject("data");
@@ -184,7 +184,7 @@ public IResponse sendRequestPfx(IRequest request) throws ClientProtocolException
}
} else {
return new CancelationResponse(status, "error", responseB.getStatusLine().getReasonPhrase(),
- responseB.getStatusLine().getReasonPhrase());
+ responseString);
}
} catch (JSONException e) {
throw new GeneralException(500, e.getMessage());
@@ -206,7 +206,7 @@ public IResponse sendRequestUuid(IRequest request) throws ClientProtocolExceptio
int status = responseB.getStatusLine().getStatusCode();
client.close();
responseB.close();
- if (!responseString.isEmpty()) {
+ if (!responseString.isEmpty() && status < 500) {
JSONObject body = new JSONObject(responseString);
if (status == 200) {
JSONObject data = body.getJSONObject("data");
@@ -225,7 +225,7 @@ public IResponse sendRequestUuid(IRequest request) throws ClientProtocolExceptio
}
} else {
return new CancelationResponse(status, "error", responseB.getStatusLine().getReasonPhrase(),
- responseB.getStatusLine().getReasonPhrase());
+ responseString);
}
} catch (JSONException e) {
throw new GeneralException(500, e.getMessage());
diff --git a/src/main/java/Utils/Requests/Csd/CsdOptionsRequest.java b/src/main/java/Utils/Requests/Csd/CsdOptionsRequest.java
index 7f1e9d8..d5a9d53 100644
--- a/src/main/java/Utils/Requests/Csd/CsdOptionsRequest.java
+++ b/src/main/java/Utils/Requests/Csd/CsdOptionsRequest.java
@@ -19,6 +19,17 @@ public CsdOptionsRequest(String token, String URI, String b64Cer, String b64Key,
this.isActive = isActive;
}
+ public CsdOptionsRequest(String token, String URI, String CertificateNumber, String proxyHost, int proxyPort) {
+ super(token, URI + Constants.DISABLE_SEARCH_CSD + CertificateNumber, proxyHost, proxyPort);
+ }
+ public CsdOptionsRequest(String token, String URI, String CertificateNumber, String type, String proxyHost, int proxyPort) {
+ super(token, URI + Constants.DISABLE_SEARCH_CSD + CertificateNumber + "/" + type, proxyHost, proxyPort);
+ }
+
+ public CsdOptionsRequest(String token, String URI, String proxyHost, int proxyPort) {
+ super(token, URI + Constants.LIST_CSD, proxyHost, proxyPort);
+ }
+
public String getB64Cer() {
return b64Cer;
}
diff --git a/src/main/java/Utils/Requests/Csd/CsdRequest.java b/src/main/java/Utils/Requests/Csd/CsdRequest.java
index 8eade0b..8730a59 100644
--- a/src/main/java/Utils/Requests/Csd/CsdRequest.java
+++ b/src/main/java/Utils/Requests/Csd/CsdRequest.java
@@ -5,6 +5,8 @@
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpDelete;
+import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.entity.mime.HttpMultipartMode;
@@ -13,9 +15,13 @@
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicHeader;
import org.apache.http.util.EntityUtils;
+import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import java.util.LinkedList;
+import java.util.List;
+
import Exceptions.AuthException;
import Exceptions.GeneralException;
import Utils.Helpers.RequestHelper;
@@ -23,16 +29,20 @@
import Utils.Requests.IRequestor;
import Utils.Requests.Csd.CsdOptionsRequest;
import Utils.Responses.IResponse;
-import Utils.Responses.Csd.UploadCsdResponse;;
+import Utils.Responses.Csd.CsdResponse;
+import Utils.Responses.Csd.InfoCsd;
+import Utils.Responses.Csd.InfoCsdResponse;
+import Utils.Responses.Csd.ListInfoCsdResponse;
public class CsdRequest implements IRequestor {
public IResponse sendRequest(IRequest request) throws GeneralException, AuthException, IOException {
try {
- if(RequestHelper.stringEmptyOrNull(((CsdOptionsRequest) request).getB64Cer()) || RequestHelper.stringEmptyOrNull(((CsdOptionsRequest) request).getB64key())) {
- return new UploadCsdResponse(400, "error", "El certificado o llave proporcionados vienen vacíos", "");
+ if (RequestHelper.stringEmptyOrNull(((CsdOptionsRequest) request).getB64Cer())
+ || RequestHelper.stringEmptyOrNull(((CsdOptionsRequest) request).getB64key())) {
+ return new CsdResponse(400, "error", "El certificado o llave proporcionados vienen vacíos", "");
}
JSONObject requestJSON = new JSONObject();
- requestJSON.put("certificate_type", ((CsdOptionsRequest) request).getCertificateType());
+ requestJSON.put("type", ((CsdOptionsRequest) request).getCertificateType());
requestJSON.put("password", ((CsdOptionsRequest) request).getPasswordCsd());
requestJSON.put("is_active", ((CsdOptionsRequest) request).getIsActive());
requestJSON.put("b64Cer", ((CsdOptionsRequest) request).getB64Cer());
@@ -57,21 +67,148 @@ public IResponse sendRequest(IRequest request) throws GeneralException, AuthExce
int status = responseB.getStatusLine().getStatusCode();
client.close();
responseB.close();
- if (!responseString.isEmpty()) {
+ if (!responseString.isEmpty() && status < 500) {
+ JSONObject body = new JSONObject(responseString);
+ if (status == 200) {
+ String data = body.getString("data");
+ return new CsdResponse(status, body.getString("status"), data, "OK", "OK");
+
+ } else {
+ String messageDetail = "";
+ if (!body.isNull("messageDetail")) {
+ messageDetail = body.getString("messageDetail");
+ }
+ return new CsdResponse(status, body.getString("status"), body.getString("message"), messageDetail);
+ }
+ } else {
+ return new CsdResponse(status, "error", responseB.getStatusLine().getReasonPhrase(),
+ responseString);
+ }
+ } catch (JSONException e) {
+ throw new GeneralException(500, e.getMessage());
+ }
+ }
+
+ public IResponse DisableCsdRequest(IRequest request) throws GeneralException, AuthException, IOException {
+ try {
+ CloseableHttpClient client = HttpClients.createDefault();
+ HttpDelete http = new HttpDelete(request.URI);
+ RequestHelper.setTimeOut(request.options, 3000);
+ RequestHelper.setProxy(request.options, request.proxyHost, request.proxyPort);
+ http.setConfig(request.options.build());
+ http.setHeader(new BasicHeader("Authorization", "bearer " + request.Token));
+ http.addHeader(new BasicHeader("Content-Type", "application/json"));
+ CloseableHttpResponse responseB = client.execute(http);
+ HttpEntity entity = responseB.getEntity();
+ String responseString = EntityUtils.toString(entity, "UTF-8");
+ int status = responseB.getStatusLine().getStatusCode();
+ client.close();
+ responseB.close();
+ if (!responseString.isEmpty() && status < 500) {
JSONObject body = new JSONObject(responseString);
if (status == 200) {
String data = body.getString("data");
- return new UploadCsdResponse(status, body.getString("status"),data, "OK", "OK");
+ return new CsdResponse(status, body.getString("status"), data, "OK", "OK");
+
+ } else {
+ String messageDetail = "";
+ if (!body.isNull("messageDetail")) {
+ messageDetail = body.getString("messageDetail");
+ }
+ return new CsdResponse(status, body.getString("status"), body.getString("message"), messageDetail);
+ }
+ } else {
+ return new CsdResponse(status, "error", responseB.getStatusLine().getReasonPhrase(),
+ responseString);
+ }
+ } catch (JSONException e) {
+ throw new GeneralException(500, e.getMessage());
+ }
+ }
+
+ public IResponse GetListCsdRequest(IRequest request) throws GeneralException, AuthException, IOException {
+ try {
+ CloseableHttpClient client = HttpClients.createDefault();
+ HttpGet http = new HttpGet(request.URI);
+ RequestHelper.setTimeOut(request.options, 3000);
+ RequestHelper.setProxy(request.options, request.proxyHost, request.proxyPort);
+ http.setConfig(request.options.build());
+ http.setHeader(new BasicHeader("Authorization", "bearer " + request.Token));
+ http.addHeader(new BasicHeader("Content-Type", "application/json"));
+ CloseableHttpResponse responseB = client.execute(http);
+ HttpEntity entity = responseB.getEntity();
+ String responseString = EntityUtils.toString(entity, "UTF-8");
+ int status = responseB.getStatusLine().getStatusCode();
+ client.close();
+ responseB.close();
+ if (!responseString.isEmpty() && status < 500) {
+ JSONObject body = new JSONObject(responseString);
+ if (status == 200) {
+ JSONArray data = body.getJSONArray("data");
+ List lista = new LinkedList();
+ for (int i = 0; i < data.length(); i++) {
+ JSONObject dato = new JSONObject(data.get(i).toString());
+ InfoCsd datos = new InfoCsd(dato.getString("issuer_rfc"), dato.getString("certificate_number"),
+ dato.getBoolean("is_active"), dato.getString("issuer_business_name"),
+ dato.getString("valid_from"), dato.getString("valid_to"),
+ dato.getString("certificate_type"));
+ lista.add(datos);
+ }
+ return new ListInfoCsdResponse(status, body.getString("status"), lista, "OK", "OK");
+
+ } else {
+ String messageDetail = "";
+ if (!body.isNull("messageDetail")) {
+ messageDetail = body.getString("messageDetail");
+ }
+ return new ListInfoCsdResponse(status, body.getString("status"), body.getString("message"),
+ messageDetail);
+ }
+ } else {
+ return new ListInfoCsdResponse(status, "error", responseB.getStatusLine().getReasonPhrase(),
+ responseString);
+ }
+ } catch (JSONException e) {
+ throw new GeneralException(500, e.getMessage());
+ }
+ }
+
+ public IResponse GetInfoCsdRequest(IRequest request) throws GeneralException, AuthException, IOException {
+ try {
+ CloseableHttpClient client = HttpClients.createDefault();
+ HttpGet http = new HttpGet(request.URI);
+ RequestHelper.setTimeOut(request.options, 3000);
+ RequestHelper.setProxy(request.options, request.proxyHost, request.proxyPort);
+ http.setConfig(request.options.build());
+ http.setHeader(new BasicHeader("Authorization", "bearer " + request.Token));
+ http.addHeader(new BasicHeader("Content-Type", "application/json"));
+ CloseableHttpResponse responseB = client.execute(http);
+ HttpEntity entity = responseB.getEntity();
+ String responseString = EntityUtils.toString(entity, "UTF-8");
+ int status = responseB.getStatusLine().getStatusCode();
+ client.close();
+ responseB.close();
+ if (!responseString.isEmpty() && status < 500) {
+ JSONObject body = new JSONObject(responseString);
+ if (status == 200) {
+ JSONObject data = body.getJSONObject("data");
+ InfoCsd datos = new InfoCsd(data.getString("issuer_rfc"), data.getString("certificate_number"),
+ data.getBoolean("is_active"), data.getString("issuer_business_name"),
+ data.getString("valid_from"), data.getString("valid_to"),
+ data.getString("certificate_type"));
+ return new InfoCsdResponse(status, body.getString("status"), datos, "OK", "OK");
} else {
String messageDetail = "";
if (!body.isNull("messageDetail")) {
messageDetail = body.getString("messageDetail");
}
- return new UploadCsdResponse(status, body.getString("status"), body.getString("message"), messageDetail);
+ return new InfoCsdResponse(status, body.getString("status"), body.getString("message"),
+ messageDetail);
}
} else {
- return new UploadCsdResponse(status, "error", responseB.getStatusLine().getReasonPhrase(), responseB.getStatusLine().getReasonPhrase());
+ return new InfoCsdResponse(status, "error", responseB.getStatusLine().getReasonPhrase(),
+ responseString);
}
} catch (JSONException e) {
throw new GeneralException(500, e.getMessage());
diff --git a/src/main/java/Utils/Requests/Issue/IssueOptionsRequest.java b/src/main/java/Utils/Requests/Issue/IssueOptionsRequest.java
index 81eb25a..99601fc 100644
--- a/src/main/java/Utils/Requests/Issue/IssueOptionsRequest.java
+++ b/src/main/java/Utils/Requests/Issue/IssueOptionsRequest.java
@@ -5,7 +5,6 @@
public class IssueOptionsRequest extends IRequest {
private String xml;
- private String version;
public String getXml() {
return xml;
@@ -16,8 +15,8 @@ public IssueOptionsRequest(String token, String URI, String xml, String version,
this.xml = xml;
this.version = version;
}
- public IssueOptionsRequest(String token, String URI, String xml, String version, boolean isXml, String proxyHost, int proxyPort) {
- super(token, URI + Constants.ISSUE_XML_PATH + version, xml, version, proxyHost, proxyPort);
+ public IssueOptionsRequest(String token, String URI, String xml, String version, boolean isXml, String proxyHost, int proxyPort, boolean isV2) {
+ super(token, URI + (isV2 ? Constants.ISSUE_XML_V2_PATH : Constants.ISSUE_XML_PATH) + version, xml, version, proxyHost, proxyPort);
this.xml = xml;
this.version = version;
}
diff --git a/src/main/java/Utils/Requests/Pdf/PdfRequest.java b/src/main/java/Utils/Requests/Pdf/PdfRequest.java
index 2bd7b7b..a9e46bb 100644
--- a/src/main/java/Utils/Requests/Pdf/PdfRequest.java
+++ b/src/main/java/Utils/Requests/Pdf/PdfRequest.java
@@ -64,7 +64,7 @@ public IResponse sendRequest(IRequest request) throws GeneralException, AuthExce
client.close();
responseB.close();
System.out.println(responseString);
- if(!responseString.isEmpty()) {
+ if(!responseString.isEmpty() && statusE < 500) {
JSONObject body = new JSONObject(responseString);
if(statusE==200){
JSONObject data = new JSONObject(body.get("data").toString());
@@ -79,7 +79,7 @@ public IResponse sendRequest(IRequest request) throws GeneralException, AuthExce
}
}
else {
- return new PdfResponse(statusE,"error",responseB.getStatusLine().getReasonPhrase(),responseB.getStatusLine().getReasonPhrase());
+ return new PdfResponse(statusE,"error",responseB.getStatusLine().getReasonPhrase(), responseString);
}
}
catch (JSONException e){
diff --git a/src/main/java/Utils/Requests/Pendings/PendientesCancelarRequest.java b/src/main/java/Utils/Requests/Pendings/PendientesCancelarRequest.java
index 2c50025..111d877 100644
--- a/src/main/java/Utils/Requests/Pendings/PendientesCancelarRequest.java
+++ b/src/main/java/Utils/Requests/Pendings/PendientesCancelarRequest.java
@@ -38,7 +38,7 @@ public IResponse sendRequest(IRequest request)
int status = responseB.getStatusLine().getStatusCode();
client.close();
responseB.close();
- if (!responseString.isEmpty()) {
+ if (!responseString.isEmpty() && status < 500) {
JSONObject body = new JSONObject(responseString);
if (status == 200) {
JSONObject data = body.getJSONObject("data");
@@ -64,7 +64,7 @@ public IResponse sendRequest(IRequest request)
}
} else {
return new PendientesCancelarResponse(status, "error", responseB.getStatusLine().getReasonPhrase(),
- responseB.getStatusLine().getReasonPhrase());
+ responseString);
}
} catch (JSONException e) {
diff --git a/src/main/java/Utils/Requests/Relations/CfdiRelacionadosRequest.java b/src/main/java/Utils/Requests/Relations/CfdiRelacionadosRequest.java
index 65cab24..16628f8 100644
--- a/src/main/java/Utils/Requests/Relations/CfdiRelacionadosRequest.java
+++ b/src/main/java/Utils/Requests/Relations/CfdiRelacionadosRequest.java
@@ -61,7 +61,7 @@ public IResponse sendRequest(IRequest request) throws GeneralException, AuthExce
int status = responseB.getStatusLine().getStatusCode();
client.close();
responseB.close();
- if (!responseString.isEmpty()) {
+ if (!responseString.isEmpty() && status < 500) {
JSONObject body = new JSONObject(responseString);
if (status == 200) {
int codStatus = Integer.parseInt(body.getString("codStatus").trim());
@@ -104,7 +104,7 @@ public IResponse sendRequest(IRequest request) throws GeneralException, AuthExce
}
} else {
return new CfdiRelacionadosResponse(status, "error", responseB.getStatusLine().getReasonPhrase(),
- responseB.getStatusLine().getReasonPhrase());
+ responseString);
}
} catch (JSONException e) {
throw new GeneralException(500, e.getMessage());
@@ -138,7 +138,7 @@ public IResponse sendRequestPFX(IRequest request) throws ClientProtocolException
int status = responseB.getStatusLine().getStatusCode();
client.close();
responseB.close();
- if (!responseString.isEmpty()) {
+ if (!responseString.isEmpty() && status < 500) {
JSONObject body = new JSONObject(responseString);
if (status == 200) {
int codStatus = Integer.parseInt(body.getString("codStatus").trim());
@@ -181,7 +181,7 @@ public IResponse sendRequestPFX(IRequest request) throws ClientProtocolException
}
} else {
return new CfdiRelacionadosResponse(status, "error", responseB.getStatusLine().getReasonPhrase(),
- responseB.getStatusLine().getReasonPhrase());
+ responseString);
}
} catch (JSONException e) {
throw new GeneralException(500, e.getMessage());
@@ -215,7 +215,7 @@ public IResponse sendRequestXML(IRequest request) throws GeneralException, AuthE
int status = responseB.getStatusLine().getStatusCode();
client.close();
responseB.close();
- if (!responseString.isEmpty()) {
+ if (!responseString.isEmpty() && status < 500) {
JSONObject body = new JSONObject(responseString);
if (status == 200) {
int codStatus = Integer.parseInt(body.getString("codStatus").trim());
@@ -258,7 +258,7 @@ public IResponse sendRequestXML(IRequest request) throws GeneralException, AuthE
}
} else {
return new CfdiRelacionadosResponse(status, "error", responseB.getStatusLine().getReasonPhrase(),
- responseB.getStatusLine().getReasonPhrase());
+ responseString);
}
} catch (JSONException e) {
throw new GeneralException(500, e.getMessage());
@@ -281,7 +281,7 @@ public IResponse sendRequestUUID(IRequest request) throws ClientProtocolExceptio
int status = responseB.getStatusLine().getStatusCode();
client.close();
responseB.close();
- if (!responseString.isEmpty()) {
+ if (!responseString.isEmpty() && status < 500) {
JSONObject body = new JSONObject(responseString);
if (status == 200) {
int codStatus = Integer.parseInt(body.getString("codStatus").trim());
@@ -324,7 +324,7 @@ public IResponse sendRequestUUID(IRequest request) throws ClientProtocolExceptio
}
} else {
return new CfdiRelacionadosResponse(status, "error", responseB.getStatusLine().getReasonPhrase(),
- responseB.getStatusLine().getReasonPhrase());
+ responseString);
}
} catch (JSONException e) {
throw new GeneralException(500, e.getMessage());
diff --git a/src/main/java/Utils/Requests/Stamp/StampOptionsRequest.java b/src/main/java/Utils/Requests/Stamp/StampOptionsRequest.java
index 61a83b1..9e658c8 100644
--- a/src/main/java/Utils/Requests/Stamp/StampOptionsRequest.java
+++ b/src/main/java/Utils/Requests/Stamp/StampOptionsRequest.java
@@ -6,15 +6,14 @@
public class StampOptionsRequest extends IRequest {
private String xml;
- public StampOptionsRequest(String token, String URI, String xml, String version, boolean isb64, String proxyHost, int proxyPort) {
-
- super(token, URI + Constants.STAMP_PATH + version + "/b64", version, isb64, proxyHost, proxyPort);
+ public StampOptionsRequest(String token, String URI, String xml, String version, boolean isb64, String proxyHost, int proxyPort, boolean isV2) {
+ super(token, URI + (isV2 ? Constants.STAMP_V2_PATH : Constants.STAMP_PATH) + version + "/b64", version, isb64, proxyHost, proxyPort);
this.xml = xml;
this.version = version;
}
- public StampOptionsRequest(String token, String URI, String xml, String version, String proxyHost, int proxyPort) {
- super(token, URI + Constants.STAMP_PATH + version, xml, version, proxyHost, proxyPort);
+ public StampOptionsRequest(String token, String URI, String xml, String version, String proxyHost, int proxyPort, boolean isV2) {
+ super(token, URI + (isV2 ? Constants.STAMP_V2_PATH : Constants.STAMP_PATH) + version, xml, version, proxyHost, proxyPort);
this.xml = xml;
this.version = version;
}
diff --git a/src/main/java/Utils/Requests/Validate/ValidateLcoRequest.java b/src/main/java/Utils/Requests/Validate/ValidateLcoRequest.java
index 5f172c1..07c4c72 100644
--- a/src/main/java/Utils/Requests/Validate/ValidateLcoRequest.java
+++ b/src/main/java/Utils/Requests/Validate/ValidateLcoRequest.java
@@ -37,7 +37,7 @@ public IResponse sendRequest(IRequest request) throws GeneralException, AuthExce
int statusE = responseB.getStatusLine().getStatusCode();
client.close();
responseB.close();
- if(!responseString.isEmpty()) {
+ if(!responseString.isEmpty() && statusE < 500) {
JSONObject body = new JSONObject(responseString);
if(statusE==200){
JSONObject data = new JSONObject(body.get("data").toString());
@@ -52,7 +52,7 @@ public IResponse sendRequest(IRequest request) throws GeneralException, AuthExce
}
}
else {
- return new ValidateLcoResponse(statusE,"error",responseB.getStatusLine().getReasonPhrase(),responseB.getStatusLine().getReasonPhrase());
+ return new ValidateLcoResponse(statusE,"error",responseB.getStatusLine().getReasonPhrase(), responseString);
}
}
catch (JSONException e){
diff --git a/src/main/java/Utils/Requests/Validate/ValidateLrfcRequest.java b/src/main/java/Utils/Requests/Validate/ValidateLrfcRequest.java
index 25b42d0..bfb7bcf 100644
--- a/src/main/java/Utils/Requests/Validate/ValidateLrfcRequest.java
+++ b/src/main/java/Utils/Requests/Validate/ValidateLrfcRequest.java
@@ -37,7 +37,7 @@ public IResponse sendRequest(IRequest request) throws GeneralException, AuthExce
int statusE = responseB.getStatusLine().getStatusCode();
client.close();
responseB.close();
- if(!responseString.isEmpty()) {
+ if(!responseString.isEmpty() && statusE < 500) {
JSONObject body = new JSONObject(responseString);
if(statusE==200){
JSONObject data = new JSONObject(body.get("data").toString());
@@ -52,7 +52,7 @@ public IResponse sendRequest(IRequest request) throws GeneralException, AuthExce
}
}
else {
- return new ValidateLrfcResponse(statusE,"error",responseB.getStatusLine().getReasonPhrase(),responseB.getStatusLine().getReasonPhrase());
+ return new ValidateLrfcResponse(statusE,"error",responseB.getStatusLine().getReasonPhrase(), responseString);
}
}
catch (JSONException e){
diff --git a/src/main/java/Utils/Requests/Validate/ValidateXmlRequest.java b/src/main/java/Utils/Requests/Validate/ValidateXmlRequest.java
index 34a95a8..4a9933d 100644
--- a/src/main/java/Utils/Requests/Validate/ValidateXmlRequest.java
+++ b/src/main/java/Utils/Requests/Validate/ValidateXmlRequest.java
@@ -54,7 +54,7 @@ public IResponse sendRequest(IRequest request) throws GeneralException, AuthExce
int statusE = responseB.getStatusLine().getStatusCode();
client.close();
responseB.close();
- if(!responseString.isEmpty()) {
+ if(!responseString.isEmpty() && statusE < 500) {
JSONObject body = new JSONObject(responseString);
if(statusE==200){
LinkedList List = new LinkedList();
@@ -65,7 +65,9 @@ public IResponse sendRequest(IRequest request) throws GeneralException, AuthExce
JSONArray detail = new JSONArray(detailNode.get("detail").toString());
for (int j = 0; j < detail.length (); j++) {
JSONObject detaildata = new JSONObject(detail.get(j).toString());
- DetailData nuevo = new DetailData(detaildata.getString("message"),detaildata.getString("messageDetail"),String.valueOf(detaildata.getInt("type")));
+ String message = detaildata.isNull("message") ? "" : detaildata.getString("message");
+ String messageDetail = detaildata.isNull("messageDetail") ? "" : detaildata.getString("messageDetail");
+ DetailData nuevo = new DetailData(message, messageDetail, String.valueOf(detaildata.getInt("type")));
ListItem.add(nuevo);
}
DetailNode x = new DetailNode(detailNode.getString("section"),ListItem);
@@ -83,7 +85,7 @@ public IResponse sendRequest(IRequest request) throws GeneralException, AuthExce
}
}
else {
- return new ValidateXmlResponse(statusE,"error",responseB.getStatusLine().getReasonPhrase(),responseB.getStatusLine().getReasonPhrase());
+ return new ValidateXmlResponse(statusE,"error",responseB.getStatusLine().getReasonPhrase(), responseString);
}
}
catch (JSONException e){
diff --git a/src/main/java/Utils/Responses/Csd/CsdResponse.java b/src/main/java/Utils/Responses/Csd/CsdResponse.java
new file mode 100644
index 0000000..4f3aa44
--- /dev/null
+++ b/src/main/java/Utils/Responses/Csd/CsdResponse.java
@@ -0,0 +1,16 @@
+package Utils.Responses.Csd;
+
+import Utils.Responses.IResponse;
+
+public class CsdResponse extends IResponse {
+
+ public String data;
+
+ public CsdResponse(int httpStatusCode, String status, String data, String msg, String msgDetail) {
+ super(httpStatusCode, status, msg, msgDetail);
+ this.data = data;
+ }
+ public CsdResponse(int httpStatusCode, String status, String msg, String msgDetail) {
+ super(httpStatusCode, status, msg, msgDetail);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/Utils/Responses/Csd/InfoCsd.java b/src/main/java/Utils/Responses/Csd/InfoCsd.java
new file mode 100644
index 0000000..f18f10d
--- /dev/null
+++ b/src/main/java/Utils/Responses/Csd/InfoCsd.java
@@ -0,0 +1,21 @@
+package Utils.Responses.Csd;
+
+public class InfoCsd {
+ public String issuerRfc;
+ public String certificateNumber;
+ public boolean isActive;
+ public String issuerBussinesName;
+ public String validFrom;
+ public String validTo;
+ public String certificateType;
+
+ public InfoCsd(String issuerRfc, String certificateNumber, boolean isActive, String issuerBussinesName, String validFrom, String validTo, String certificateType) {
+ this.issuerRfc = issuerRfc;
+ this.certificateNumber = certificateNumber;
+ this.isActive = isActive;
+ this.issuerBussinesName = issuerBussinesName;
+ this.validFrom = validFrom;
+ this.validTo = validTo;
+ this.certificateType = certificateType;
+ }
+}
diff --git a/src/main/java/Utils/Responses/Csd/InfoCsdResponse.java b/src/main/java/Utils/Responses/Csd/InfoCsdResponse.java
new file mode 100644
index 0000000..004ecb0
--- /dev/null
+++ b/src/main/java/Utils/Responses/Csd/InfoCsdResponse.java
@@ -0,0 +1,15 @@
+package Utils.Responses.Csd;
+
+import Utils.Responses.IResponse;
+
+public class InfoCsdResponse extends IResponse {
+ public InfoCsd data;
+
+ public InfoCsdResponse(int httpStatusCode, String status, String message, String messageDetail) {
+ super(httpStatusCode, status, message, messageDetail);
+ }
+ public InfoCsdResponse(int httpStatusCode, String status, InfoCsd data, String message, String messageDetail) {
+ super(httpStatusCode, status, message, messageDetail);
+ this.data = data;
+ }
+}
diff --git a/src/main/java/Utils/Responses/Csd/ListInfoCsdResponse.java b/src/main/java/Utils/Responses/Csd/ListInfoCsdResponse.java
new file mode 100644
index 0000000..6c6a194
--- /dev/null
+++ b/src/main/java/Utils/Responses/Csd/ListInfoCsdResponse.java
@@ -0,0 +1,19 @@
+package Utils.Responses.Csd;
+
+import java.util.List;
+
+import Utils.Responses.IResponse;
+
+public class ListInfoCsdResponse extends IResponse {
+ public List data;
+
+ public ListInfoCsdResponse(int httpStatusCode, String status, String message, String messageDetail) {
+ super(httpStatusCode, status, message, messageDetail);
+ }
+
+ public ListInfoCsdResponse(int httpStatusCode, String status, List lista, String message, String messageDetail) {
+ super(httpStatusCode, status, message, messageDetail);
+ data = lista;
+ }
+
+}
diff --git a/src/main/java/Utils/Responses/Csd/UploadCsdResponse.java b/src/main/java/Utils/Responses/Csd/UploadCsdResponse.java
deleted file mode 100644
index 77ffa92..0000000
--- a/src/main/java/Utils/Responses/Csd/UploadCsdResponse.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package Utils.Responses.Csd;
-
-import Utils.Responses.IResponse;
-
-public class UploadCsdResponse extends IResponse {
-
- public String data;
-
- public UploadCsdResponse(int httpStatusCode, String status, String data, String msg, String msgDetail) {
- super(httpStatusCode, status, msg, msgDetail);
- this.data = data;
- }
- public UploadCsdResponse(int httpStatusCode, String status, String msg, String msgDetail) {
- super(httpStatusCode, status, msg, msgDetail);
- }
-}
\ No newline at end of file
diff --git a/src/main/java/Utils/Responses/IResponse.java b/src/main/java/Utils/Responses/IResponse.java
index da23f01..679eb21 100644
--- a/src/main/java/Utils/Responses/IResponse.java
+++ b/src/main/java/Utils/Responses/IResponse.java
@@ -6,19 +6,6 @@ public abstract class IResponse {
public String message = null;
public String messageDetail = null;
-
-
- public boolean isAuth;
-
-
-
-
- public IResponse(int httpStatusCode, String status, boolean isAuth) {
- HttpStatusCode = httpStatusCode;
- Status = status;
- this.isAuth = isAuth;
- }
-
//Status error
public IResponse(int httpStatusCode, String status, String message, String messageDetail) {
HttpStatusCode = httpStatusCode;
@@ -26,19 +13,9 @@ public IResponse(int httpStatusCode, String status, String message, String messa
this.message = message;
this.messageDetail = messageDetail;
}
-
-
-
//Status success general
public IResponse(int httpStatusCode, String status) {
HttpStatusCode = httpStatusCode;
Status = status;
-
-
}
-
-
-
-
-
}
diff --git a/src/test/java/Tests/AcceptReject/SWAcceptRejectServiceTest.java b/src/test/java/Tests/AcceptReject/SWAcceptRejectServiceTest.java
index 5a2f7b0..b99b640 100644
--- a/src/test/java/Tests/AcceptReject/SWAcceptRejectServiceTest.java
+++ b/src/test/java/Tests/AcceptReject/SWAcceptRejectServiceTest.java
@@ -6,14 +6,14 @@
import java.util.Map;
import org.junit.Assert;
+import org.junit.Test;
import Services.AcceptReject.SWAcceptRejectService;
import Tests.Utils;
import Utils.Responses.AcceptReject.AceptarRechazarCancelationResponse;
import Utils.Responses.AcceptReject.CancelationData;
-import junit.framework.TestCase;
-public class SWAcceptRejectServiceTest extends TestCase {
+public class SWAcceptRejectServiceTest {
public String uuid = "06a46e4b-b154-4c12-bb77-f9a63ed55ff2";
public String password_csd = "12345678a";
public String rfc = "LAN7008173R5";
@@ -22,7 +22,7 @@ public class SWAcceptRejectServiceTest extends TestCase {
public String token = "T2lYQ0t4L0RHVkR4dHZ5Nkk1VHNEakZ3Y0J4Nk9GODZuRyt4cE1wVm5tbXB3YVZxTHdOdHAwVXY2NTdJb1hkREtXTzE3dk9pMmdMdkFDR2xFWFVPUXpTUm9mTG1ySXdZbFNja3FRa0RlYURqbzdzdlI2UUx1WGJiKzViUWY2dnZGbFloUDJ6RjhFTGF4M1BySnJ4cHF0YjUvbmRyWWpjTkVLN3ppd3RxL0dJPQ.T2lYQ0t4L0RHVkR4dHZ5Nkk1VHNEakZ3Y0J4Nk9GODZuRyt4cE1wVm5tbFlVcU92YUJTZWlHU3pER1kySnlXRTF4alNUS0ZWcUlVS0NhelhqaXdnWT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federal, C=MX, PostalCode=06300, STREET=\"Av. Hidalgo 77, Col. Guerrero\", E=asisnet@pruebas.sat.gob.mx, OU=Administraci?n de Seguridad de la Informaci?n, O=Servicio de Administraci?n Tributaria, CN=A.C. 2 de pruebas(4096)3230303031303030303030333030303232383135MIIFxTCCA62gAwIBAgIUMjAwMDEwMDAwMDAzMDAwMjI4MTUwDQYJKoZIhvcNAQELBQAwggFmMSAwHgYDVQQDDBdBLkMuIDIgZGUgcHJ1ZWJhcyg0MDk2KTEvMC0GA1UECgwmU2VydmljaW8gZGUgQWRtaW5pc3RyYWNpw7NuIFRyaWJ1dGFyaWExODA2BgNVBAsML0FkbWluaXN0cmFjacOzbiBkZSBTZWd1cmlkYWQgZGUgbGEgSW5mb3JtYWNpw7NuMSkwJwYJKoZIhvcNAQkBFhphc2lzbmV0QHBydWViYXMuc2F0LmdvYi5teDEmMCQGA1UECQwdQXYuIEhpZGFsZ28gNzcsIENvbC4gR3VlcnJlcm8xDjAMBgNVBBEMBTA2MzAwMQswCQYDVQQGEwJNWDEZMBcGA1UECAwQRGlzdHJpdG8gRmVkZXJhbDESMBAGA1UEBwwJQ295b2Fjw6FuMRUwEwYDVQQtEwxTQVQ5NzA3MDFOTjMxITAfBgkqhkiG9w0BCQIMElJlc3BvbnNhYmxlOiBBQ0RNQTAeFw0xNjEwMjUyMTUyMTFaFw0yMDEwMjUyMTUyMTFaMIGxMRowGAYDVQQDExFDSU5ERU1FWCBTQSBERSBDVjEaMBgGA1UEKRMRQ0lOREVNRVggU0EgREUgQ1YxGjAYBgNVBAoTEUNJTkRFTUVYIFNBIERFIENWMSUwIwYDVQQtExxMQU43MDA4MTczUjUgLyBGVUFCNzcwMTE3QlhBMR4wHAYDVQQFExUgLyBGVUFCNzcwMTE3TURGUk5OMDkxFDASBgNVBAsUC1BydWViYV9DRkRJMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAgvvCiCFDFVaYX7xdVRhp/38ULWto/LKDSZy1yrX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hdv0gxoxQdDTh1VvhFG7Ij7487kicwIFpOXjDu/A+JzfutXpXemRkDAXMm3D/vDX0yKIyzHUNFzxEQDeAo/UZAfLMEbCE6XTjcrX5Gu/xoqC5NA/J389Wl3sMyAQxynsTld6yZlTid4rPpgxjbTm0m8yMyv+zvZNQFNjUxXgHyog36be5LIu7IU6zUj8hvl+jOG78a+lra+mXEKvowo/9/UEWZCZDUvWPbka67SLOLDdPrRwJB+KqNdMMkGZwfRauDyrvFi25yV87NtrHFQXz/9FNqIuGuRz7i1suDB+WPdk7Rc3CPYoK30IRo0Ae74mdA+AN07lQC7Q8FicpTDlNjqh+VV5nqLht8wzzq/l1QFgcjxgp23520G/YpCGhseJv2PWcV0H1rs0coAi3qCr7G+A2MYwGJA4DCAfD92xZWtZgPUpPSELvEBgWqMsW87xd1MSkumJ8e7zGOMXoFRo3ID4wot1FIaWU/EJyzb3xowrbY64Ytquuu9s9ef0weTumPMvkWcnGeqgKaEMnl24Is6CoG+qS+HfvgS8qxiv1TfTTIRmT0nhYWRoEkE/0ue6X4Zs+qT28Z8P/LzcIJECJvd39K5BI0q3RMqEVumgVcKGPB9nkxReDPR1M/cxY9qru99NaOK0dZJAin5AXDVOrCZzOdLeEU5lIRXWZwr9i1/rVvLh6f3tnhVWgbghp+JsuhaX2ALRY74pAosbzVMZJlf31TElMCMGCSqGSIb3DQEJFTEWBBTV2Mqe5ylxDwy8SvKAi/DPPo81QzAxMCEwCQYFKw4DAhoFAAQUro+9ySRmBaYPd9oC4rXFvP20CPkECEuQk0rStkWzAgIIAA==";
-
+ @Test
public void testAcceptrejectCancelationService_CSD() throws Exception {
SWAcceptRejectService app = new SWAcceptRejectService("demo", "123456789", Utils.url_pruebas);
Map uuids = new HashMap();
@@ -47,7 +47,7 @@ public void testAcceptrejectCancelationService_CSD() throws Exception {
String expect_status = "success";
Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status));
}
-
+ @Test
public void testAcceptrejectCancelationService_XML() throws Exception {
SWAcceptRejectService app = new SWAcceptRejectService("demo", "123456789", Utils.url_pruebas);
String xml = " 06a46e4b-b154-4c12-bb77-f9a63ed55ff2 Aceptacion AQ36cbqKJKHy5vaS6GhDTWtwKE4= HVlFUPmRLyxeztem827eaasDObRXi+oqedCNNvDyMsRizqsS99cHt5mJCEE4vWgpDGPGLrph/yd++R4aN+V562DPp9qreFkisFpEvJy5Z8o/KzG7vc5qqaD8z9ohPpRERPHvxFrIm3ryEBqnSV6zqJG02PuxkWvYonVc+B7RdsO5iAiDTMs9guUhOvHBK8BVXQHKCbUAPCp/4YepZ4LUkcdloCAMPsN0x9GaUty2RMtNJuwaRWy+5IIBUCeXXZmQhoQfS0QfPpCByt0ago5v+FocJQiYQrsUV/8mesmNw5JoOCmufQYliQFyZgsstV8+h76dU/rwLr6R8YlFOkTxKg== OID.1.2.840.113549.1.9.2=Responsable: ACDMA, OID.2.5.4.45=SAT970701NN3, L=Coyoacán, S=Distrito Federal, C=MX, PostalCode=06300, STREET=\"Av. Hidalgo 77, Col. Guerrero\", E=asisnet@pruebas.sat.gob.mx, OU=Administración de Seguridad de la Información, O=Servicio de Administración Tributaria, CN=A.C. 2 de pruebas(4096) 3230303031303030303030333030303232383135 MIIFxTCCA62gAwIBAgIUMjAwMDEwMDAwMDAzMDAwMjI4MTUwDQYJKoZIhvcNAQELBQAwggFmMSAwHgYDVQQDDBdBLkMuIDIgZGUgcHJ1ZWJhcyg0MDk2KTEvMC0GA1UECgwmU2VydmljaW8gZGUgQWRtaW5pc3RyYWNpw7NuIFRyaWJ1dGFyaWExODA2BgNVBAsML0FkbWluaXN0cmFjacOzbiBkZSBTZWd1cmlkYWQgZGUgbGEgSW5mb3JtYWNpw7NuMSkwJwYJKoZIhvcNAQkBFhphc2lzbmV0QHBydWViYXMuc2F0LmdvYi5teDEmMCQGA1UECQwdQXYuIEhpZGFsZ28gNzcsIENvbC4gR3VlcnJlcm8xDjAMBgNVBBEMBTA2MzAwMQswCQYDVQQGEwJNWDEZMBcGA1UEC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fi9j6lI9/T6MNZ+/LM2L/t72Vau4r7m94JDEzaO3A0wHAtQ97fjBfBiO5M8AEISAV7eZidIl3iaJJHkQbBYiiW2gikreUZKPUX0HmlnIqqQcBJhWKRu6Nqk6aZBTETLLpGrvF9OArV1JSsbdw/ZH+P88RAt5em5/gjwwtFlNHyiKG5w+UFpaZOK3gZP0su0sa6dlPeQ9EL4JlFkGqQCgSQ+NOsXqaOavgoP5VLykLwuGnwIUnuhBTVeDbzpgrg9LuF5dYp/zs+Y9ScJqe5VMAagLSYTShNtN8luV7LvxF9pgWwZdcM7lUwqJmUddCiZqdngg3vzTactMToG16gZA4CWnMgbU4E+r541+FNMpgAZNvs2CiW/eApfaaQojsZEAHDsDv4L5n3M1CC7fYjE/d61aSng1LaO6T1mh+dEfPvLzp7zyzz+UgWMhi5Cs4pcXx1eic5r7uxPoBwcCTt3YI1jKVVnV7/w= ";
@@ -70,7 +70,7 @@ public void testAcceptrejectCancelationService_XML() throws Exception {
String expect_status = "success";
Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status));
}
-
+ @Test
public void testAcceptrejectCancelationService_PFX() throws Exception {
SWAcceptRejectService app = new SWAcceptRejectService("demo", "123456789", Utils.url_pruebas);
Map uuids = new HashMap();
@@ -94,7 +94,7 @@ public void testAcceptrejectCancelationService_PFX() throws Exception {
String expect_status = "success";
Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status));
}
-
+ @Test
public void testAcceptrejectCancelationService_UUID() throws Exception {
SWAcceptRejectService app = new SWAcceptRejectService("demo", "123456789", Utils.url_pruebas);
String uuidC = "06a46e4b-b154-4c12-bb77-f9a63ed55ff2";
diff --git a/src/test/java/Tests/Authentication/SWAuthenticationServiceTest.java b/src/test/java/Tests/Authentication/SWAuthenticationServiceTest.java
index 3b7bc37..90eb7f0 100644
--- a/src/test/java/Tests/Authentication/SWAuthenticationServiceTest.java
+++ b/src/test/java/Tests/Authentication/SWAuthenticationServiceTest.java
@@ -2,11 +2,14 @@
import Services.Authentication.SWAuthenticationService;
import Utils.Responses.Authentication.SuccessAuthResponse;
-
+import java.io.IOException;
import org.junit.Assert;
-import junit.framework.TestCase;
+import org.junit.Test;
+import Exceptions.AuthException;
+import Exceptions.GeneralException;
-public class SWAuthenticationServiceTest extends TestCase {
+public class SWAuthenticationServiceTest {
+ @Test
public void testAuth(){
try {
SWAuthenticationService auth = new SWAuthenticationService("demo","123456789","http://services.test.sw.com.mx");
@@ -22,4 +25,19 @@ public void testAuth(){
e.printStackTrace();
}
}
+ @Test
+ public void testBadAuth(){
+ try {
+ SWAuthenticationService auth = new SWAuthenticationService("user","password","http://services.test.sw.com.mx");
+ SuccessAuthResponse res = (SuccessAuthResponse) auth.Token();
+ } catch (AuthException e) {
+ System.out.println(e.getErrorMSG());
+ System.out.println(e.getHttpStatusCode());
+ Assert.assertTrue(true);
+ } catch (GeneralException e) {
+ Assert.fail();
+ } catch (IOException e) {
+ Assert.fail();
+ }
+ }
}
diff --git a/src/test/java/Tests/BalanceAccount/SWBalanceAccountServiceTest.java b/src/test/java/Tests/BalanceAccount/SWBalanceAccountServiceTest.java
index d5c6d42..e9f6acb 100644
--- a/src/test/java/Tests/BalanceAccount/SWBalanceAccountServiceTest.java
+++ b/src/test/java/Tests/BalanceAccount/SWBalanceAccountServiceTest.java
@@ -5,24 +5,18 @@
import Services.BalanceAccount.SWBalanceAccountService;
import Tests.Utils;
import Utils.Responses.BalanceAccount.BalanceAcctResponse;
-import junit.framework.TestCase;
-
import java.io.IOException;
import org.junit.Assert;
+import org.junit.Test;
-public class SWBalanceAccountServiceTest extends TestCase {
-
+public class SWBalanceAccountServiceTest {
public String token = "T2lYQ0t4L0RHVkR4dHZ5Nkk1VHNEakZ3Y0J4Nk9GODZuRyt4cE1wVm5tbXB3YVZxTHdOdHAwVXY2NTdJb1hkREtXTzE3dk9pMmdMdkFDR2xFWFVPUXpTUm9mTG1ySXdZbFNja3FRa0RlYURqbzdzdlI2UUx1WGJiKzViUWY2dnZGbFloUDJ6RjhFTGF4M1BySnJ4cHF0YjUvbmRyWWpjTkVLN3ppd3RxL0dJPQ.T2lYQ0t4L0RHVkR4dHZ5Nkk1VHNEakZ3Y0J4Nk9GODZuRyt4cE1wVm5tbFlVcU92YUJTZWlHU3pER1kySnlXRTF4alNUS0ZWcUlVS0NhelhqaXdnWTRncklVSWVvZlFZMWNyUjVxYUFxMWFxcStUL1IzdGpHRTJqdS9Zakw2UGRiMTFPRlV3a2kyOWI5WUZHWk85ODJtU0M2UlJEUkFTVXhYTDNKZVdhOXIySE1tUVlFdm1jN3kvRStBQlpLRi9NeWJrd0R3clhpYWJrVUMwV0Mwd3FhUXdpUFF5NW5PN3J5cklMb0FETHlxVFRtRW16UW5ZVjAwUjdCa2g0Yk1iTExCeXJkVDRhMGMxOUZ1YWlIUWRRVC8yalFTNUczZXdvWlF0cSt2UW0waFZKY2gyaW5jeElydXN3clNPUDNvU1J2dm9weHBTSlZYNU9aaGsvalpQMUxrUndzK0dHS2dpTittY1JmR3o2M3NqNkh4MW9KVXMvUHhZYzVLQS9UK2E1SVhEZFJKYWx4ZmlEWDFuSXlqc2ZRYXlUQk1ldlZkU2tEdU10NFVMdHZKUURLblBxakw0SDl5bUxabDFLNmNPbEp6b3Jtd2Q1V2htRHlTdDZ6eTFRdUNnYnVvK2tuVUdhMmwrVWRCZi9rQkU9.7k2gVCGSZKLzJK5Ky3Nr5tKxvGSJhL13Q8W-YhT0uIo";
-
-
-
+ @Test
public void testBalanceAccountService() throws AuthException, GeneralException, IOException {
SWBalanceAccountService app = new SWBalanceAccountService("demo","123456789",Utils.url_pruebas);
- BalanceAcctResponse response = null;
- response = (BalanceAcctResponse) app.GetBalanceAccount();
-
+ BalanceAcctResponse response = (BalanceAcctResponse) app.GetBalanceAccount();
System.out.println(response.Status);
System.out.println(response.HttpStatusCode);
System.out.println(response.idSaldoCliente);
@@ -35,11 +29,10 @@ public void testBalanceAccountService() throws AuthException, GeneralException,
String expect_status = "success";
Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status));
}
-
+ @Test
public void testBalanceAccountService_authToken() throws Exception {
SWBalanceAccountService app = new SWBalanceAccountService(token,Utils.url_pruebas);
- BalanceAcctResponse response = null;
- response = (BalanceAcctResponse) app.GetBalanceAccount();
+ BalanceAcctResponse response = (BalanceAcctResponse) app.GetBalanceAccount();
System.out.println(response.Status);
System.out.println(response.HttpStatusCode);
@@ -53,30 +46,44 @@ public void testBalanceAccountService_authToken() throws Exception {
String expect_status = "success";
Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status));
}
-
- public void testBalanceAccountService_incorrectToken() throws Exception {
-
- SWBalanceAccountService app = new SWBalanceAccountService("wrong token",Utils.url_pruebas);
- BalanceAcctResponse response = null;
- response = (BalanceAcctResponse) app.GetBalanceAccount();
- System.out.println(response.Status);
- System.out.println(response.HttpStatusCode);
- System.out.println(response.message);
- System.out.println(response.messageDetail);
- String expect_message = "Unauthorized";
- Assert.assertTrue(expect_message.equalsIgnoreCase(response.message));
+ @Test
+ public void testBalanceAccountService_incorrectToken() {
+ try {
+ SWBalanceAccountService app = new SWBalanceAccountService("wrong token", Utils.url_pruebas);
+ BalanceAcctResponse response = (BalanceAcctResponse) app.GetBalanceAccount();
+ System.out.println(response.Status);
+ System.out.println(response.HttpStatusCode);
+ System.out.println(response.idSaldoCliente);
+ System.out.println(response.idClienteUsuario);
+ System.out.println(response.saldoTimbres);
+ System.out.println(response.timbresUtilizados);
+ System.out.println(response.fechaExpiracion);
+ System.out.println(response.unlimited);
+ System.out.println(response.timbresAsignados);
+ Assert.assertTrue(response.HttpStatusCode == 401);
+ }
+ catch(AuthException e) {
+ Assert.fail();
+ } catch (GeneralException e) {
+ Assert.fail();
+ } catch (IOException e) {
+ Assert.fail();
+ }
}
-
- public void testBalanceAccountService_emptyUserParams() throws AuthException, GeneralException {
- SWBalanceAccountService app = new SWBalanceAccountService("", "", "");
- BalanceAcctResponse response = null;
+ @Test
+ public void testBalanceAccountService_emptyUserParams(){
try {
- response = (BalanceAcctResponse) app.GetBalanceAccount();
+ SWBalanceAccountService app = new SWBalanceAccountService("", "", "");
+ BalanceAcctResponse response = (BalanceAcctResponse) app.GetBalanceAccount();
}
- catch(Exception e){
- System.out.println("Something bad happened");
- System.out.println(e.getMessage());
- Assert.assertNotNull("Something bad happened", e);
- }
+ catch(AuthException e) {
+ System.out.println(e.getErrorMSG());
+ System.out.println(e.getHttpStatusCode());
+ Assert.assertTrue(true);
+ } catch (GeneralException e) {
+ Assert.fail();
+ } catch (IOException e) {
+ Assert.fail();
+ }
}
}
diff --git a/src/test/java/Tests/Cancelation/SWCancelationServiceTest.java b/src/test/java/Tests/Cancelation/SWCancelationServiceTest.java
index c545070..8f81f3c 100644
--- a/src/test/java/Tests/Cancelation/SWCancelationServiceTest.java
+++ b/src/test/java/Tests/Cancelation/SWCancelationServiceTest.java
@@ -3,11 +3,10 @@
import Services.Cancelation.SWCancelationService;
import Tests.Utils;
import Utils.Responses.Cancelation.CancelationResponse;
-import junit.framework.TestCase;
-
import org.junit.Assert;
+import org.junit.Test;
-public class SWCancelationServiceTest extends TestCase {
+public class SWCancelationServiceTest {
public String uuid = "06a46e4b-b154-4c12-bb77-f9a63ed55ff2";
public String password_csd = "12345678a";
@@ -19,6 +18,7 @@ public class SWCancelationServiceTest extends TestCase {
public String b64Pfx = "MIIMCQIBAzCCC88GCSqGSIb3DQEHAaCCC8AEggu8MIILuDCCBm8GCSqGSIb3DQEHBqCCBmAwggZcAgEAMIIGVQYJKoZIhvcNAQcBMBwGCiqGSIb3DQEMAQYwDgQIXBNHDmeisrgCAggAgIIGKJcMawHjf9xBaT9VO58xdlwS2Ufj764W2RbrMDN/0RXY8vLgnn+bfi1ifqlSTS5YwlcAfLEwCB6mk9T4nYorqsirI8eIzThz5tt0W/XP28byMrMxwl7Ebt99q1FdaDFwGCLSgeKb+hLmyssyS/+ne1eldmC31MVYU9DX2jLWZ5vKhxPNFDkqbx+iNq1Qc4uSrXqMeWhM36DhvAosWR3ZANhtvIwvsvg9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jxgp23520G/YpCGhseJv2PWcV0H1rs0coAi3qCr7G+A2MYwGJA4DCAfD92xZWtZgPUpPSELvEBgWqMsW87xd1MSkumJ8e7zGOMXoFRo3ID4wot1FIaWU/EJyzb3xowrbY64Ytquuu9s9ef0weTumPMvkWcnGeqgKaEMnl24Is6CoG+qS+HfvgS8qxiv1TfTTIRmT0nhYWRoEkE/0ue6X4Zs+qT28Z8P/LzcIJECJvd39K5BI0q3RMqEVumgVcKGPB9nkxReDPR1M/cxY9qru99NaOK0dZJAin5AXDVOrCZzOdLeEU5lIRXWZwr9i1/rVvLh6f3tnhVWgbghp+JsuhaX2ALRY74pAosbzVMZJlf31TElMCMGCSqGSIb3DQEJFTEWBBTV2Mqe5ylxDwy8SvKAi/DPPo81QzAxMCEwCQYFKw4DAhoFAAQUro+9ySRmBaYPd9oC4rXFvP20CPkECEuQk0rStkWzAgIIAA==";
//csd
+ @Test
public void testCancelationServiceCSD_authUser() throws Exception {
SWCancelationService app = new SWCancelationService("demo", "123456789", Utils.url_pruebas);
CancelationResponse response = null;
@@ -31,7 +31,7 @@ public void testCancelationServiceCSD_authUser() throws Exception {
String expect_status = "success";
Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status));
}
-
+ @Test
public void testCancelationServiceCSD_authToken() throws Exception {
SWCancelationService app = new SWCancelationService(token, Utils.url_pruebas);
CancelationResponse response = null;
@@ -44,7 +44,7 @@ public void testCancelationServiceCSD_authToken() throws Exception {
String expect_status = "success";
Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status));
}
-
+ @Test
public void testCancelationServiceCSD_incorrectParams() throws Exception {
SWCancelationService app = new SWCancelationService(token, Utils.url_pruebas);
CancelationResponse response = null;
@@ -56,7 +56,7 @@ public void testCancelationServiceCSD_incorrectParams() throws Exception {
String expect_status = "error";
Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status));
}
-
+ @Test
public void testCancelationServiceCSD_incorrectToken() throws Exception {
SWCancelationService app = new SWCancelationService("wrong token", Utils.url_pruebas);
CancelationResponse response = null;
@@ -65,10 +65,9 @@ public void testCancelationServiceCSD_incorrectToken() throws Exception {
System.out.println(response.HttpStatusCode);
System.out.println(response.message);
System.out.println(response.messageDetail);
- String expect_message = "Unauthorized";
- Assert.assertTrue(expect_message.equalsIgnoreCase(response.message));
+ Assert.assertTrue(response.HttpStatusCode == 401);
}
-
+ @Test
public void testCancelationServiceCSD_emptyUserParams() throws Exception {
try {
SWCancelationService app = new SWCancelationService("", "", "");
@@ -84,7 +83,7 @@ public void testCancelationServiceCSD_emptyUserParams() throws Exception {
Assert.assertNotNull("Something bad happened", e);
}
}
-
+ @Test
public void testCancelationServiceCSD_emptyCancelationParams() throws Exception {
SWCancelationService app = new SWCancelationService("demo", "123456789", Utils.url_pruebas);
CancelationResponse response = null;
@@ -99,6 +98,7 @@ public void testCancelationServiceCSD_emptyCancelationParams() throws Exception
}
//XML
+ @Test
public void testCancelationServiceXML_validXML() throws Exception {
SWCancelationService app = new SWCancelationService("demo", "123456789", Utils.url_pruebas);
CancelationResponse response = null;
@@ -113,7 +113,7 @@ public void testCancelationServiceXML_validXML() throws Exception {
String expect_status = "success";
Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status));
}
-
+ @Test
public void testCancelationServiceXML_invalidXML() throws Exception {
SWCancelationService app = new SWCancelationService("demo", "123456789", Utils.url_pruebas);
CancelationResponse response = null;
@@ -124,9 +124,9 @@ public void testCancelationServiceXML_invalidXML() throws Exception {
System.out.println(response.messageDetail);
String expect_status = "error";
Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status));
- Assert.assertTrue(response.message.contains("CA1000"));
+ Assert.assertTrue(response.message.contains("CASD - Acuse"));
}
-
+ @Test
public void testCancelationServiceXML_nullXML() throws Exception {
SWCancelationService app = new SWCancelationService("demo", "123456789", Utils.url_pruebas);
CancelationResponse response = null;
@@ -136,12 +136,12 @@ public void testCancelationServiceXML_nullXML() throws Exception {
System.out.println(response.message);
System.out.println(response.messageDetail);
String expect_status = "error";
- String expect_message = "CA1000. El xml proporcionado está mal formado o es inválido.There is an error in XML document (0, 0).";
Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status));
- Assert.assertTrue(response.message.contains("CA1000"));
+ Assert.assertTrue(response.message.contains("CASD - Acuse"));
}
// Pfx
+ @Test
public void testCancelationServicePfx_authUser() throws Exception {
SWCancelationService app = new SWCancelationService("demo", "123456789", Utils.url_pruebas);
CancelationResponse response = null;
@@ -154,7 +154,7 @@ public void testCancelationServicePfx_authUser() throws Exception {
String expect_status = "success";
Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status));
}
-
+ @Test
public void testCancelationServicePfx_authToken() throws Exception {
SWCancelationService app = new SWCancelationService(token, Utils.url_pruebas);
CancelationResponse response = null;
@@ -167,7 +167,7 @@ public void testCancelationServicePfx_authToken() throws Exception {
String expect_status = "success";
Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status));
}
-
+ @Test
public void testCancelationServicePfx_incorrectParams() throws Exception {
SWCancelationService app = new SWCancelationService(token, Utils.url_pruebas);
CancelationResponse response = null;
@@ -179,7 +179,7 @@ public void testCancelationServicePfx_incorrectParams() throws Exception {
String expect_status = "error";
Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status));
}
-
+ @Test
public void testCancelationServicePfx_incorrectToken() throws Exception {
SWCancelationService app = new SWCancelationService("wrong token", Utils.url_pruebas);
CancelationResponse response = null;
@@ -188,10 +188,9 @@ public void testCancelationServicePfx_incorrectToken() throws Exception {
System.out.println(response.HttpStatusCode);
System.out.println(response.message);
System.out.println(response.messageDetail);
- String expect_message = "Unauthorized";
- Assert.assertTrue(expect_message.equalsIgnoreCase(response.message));
+ Assert.assertTrue(response.HttpStatusCode == 401);
}
-
+ @Test
public void testCancelationServicePfx_emptyUserParams() throws Exception {
try {
SWCancelationService app = new SWCancelationService("", "", "");
@@ -207,7 +206,7 @@ public void testCancelationServicePfx_emptyUserParams() throws Exception {
Assert.assertNotNull("Something bad happened", e);
}
}
-
+ @Test
public void testCancelationServicePfx_emptyCancelationParams() throws Exception {
SWCancelationService app = new SWCancelationService("demo", "123456789", Utils.url_pruebas);
CancelationResponse response = null;
@@ -222,6 +221,7 @@ public void testCancelationServicePfx_emptyCancelationParams() throws Exception
}
// Uuid
+ @Test
public void testCancelationServiceUuid_authUser() throws Exception {
SWCancelationService app = new SWCancelationService("demo", "123456789", Utils.url_pruebas);
CancelationResponse response = null;
@@ -234,7 +234,7 @@ public void testCancelationServiceUuid_authUser() throws Exception {
String expect_status = "success";
Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status));
}
-
+ @Test
public void testCancelationServiceUuid_authToken() throws Exception {
SWCancelationService app = new SWCancelationService(token, Utils.url_pruebas);
CancelationResponse response = null;
@@ -247,7 +247,7 @@ public void testCancelationServiceUuid_authToken() throws Exception {
String expect_status = "success";
Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status));
}
-
+ @Test
public void testCancelationServiceUuid_incorrectParams() throws Exception {
SWCancelationService app = new SWCancelationService(token, Utils.url_pruebas);
CancelationResponse response = null;
@@ -259,7 +259,7 @@ public void testCancelationServiceUuid_incorrectParams() throws Exception {
String expect_status = "error";
Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status));
}
-
+ @Test
public void testCancelationServiceUuid_incorrectToken() throws Exception {
SWCancelationService app = new SWCancelationService("wrong token", Utils.url_pruebas);
CancelationResponse response = null;
@@ -268,10 +268,9 @@ public void testCancelationServiceUuid_incorrectToken() throws Exception {
System.out.println(response.HttpStatusCode);
System.out.println(response.message);
System.out.println(response.messageDetail);
- String expect_message = "Unauthorized";
- Assert.assertTrue(expect_message.equalsIgnoreCase(response.message));
+ Assert.assertTrue(response.HttpStatusCode == 401);
}
-
+ @Test
public void testCancelationServiceUuid_emptyUserParams() throws Exception {
try {
SWCancelationService app = new SWCancelationService("", "", "");
@@ -287,7 +286,7 @@ public void testCancelationServiceUuid_emptyUserParams() throws Exception {
Assert.assertNotNull("Something bad happened", e);
}
}
-
+ @Test
public void testCancelationServiceUuid_emptyCancelationParams() throws Exception {
SWCancelationService app = new SWCancelationService("demo", "123456789", Utils.url_pruebas);
CancelationResponse response = null;
diff --git a/src/test/java/Tests/Csd/SWCsdServiceTest.java b/src/test/java/Tests/Csd/SWCsdServiceTest.java
index 11bc0ec..c951f0f 100644
--- a/src/test/java/Tests/Csd/SWCsdServiceTest.java
+++ b/src/test/java/Tests/Csd/SWCsdServiceTest.java
@@ -1,22 +1,28 @@
package Tests.Csd;
+import java.util.List;
+
import org.junit.Assert;
+import org.junit.Test;
import Services.Csd.SWCsdService;
import Tests.Utils;
-import Utils.Responses.Csd.UploadCsdResponse;
-import junit.framework.TestCase;
+import Utils.Responses.Csd.CsdResponse;
+import Utils.Responses.Csd.InfoCsd;
+import Utils.Responses.Csd.InfoCsdResponse;
+import Utils.Responses.Csd.ListInfoCsdResponse;
-public class SWCsdServiceTest extends TestCase {
+public class SWCsdServiceTest {
public String password_csd = "12345678a";
public String rfc = "LAN7008173R5";
public String b64Cer = "MIIFxTCCA62gAwIBAgIUMjAwMDEwMDAwMDAzMDAwMjI4MTUwDQYJKoZIhvcNAQELBQAwggFmMSAwHgYDVQQDDBdBLkMuIDIgZGUgcHJ1ZWJhcyg0MDk2KTEvMC0GA1UECgwmU2VydmljaW8gZGUgQWRtaW5pc3RyYWNpw7NuIFRyaWJ1dGFyaWExODA2BgNVBAsML0FkbWluaXN0cmFjacOzbiBkZSBTZWd1cmlkYWQgZGUgbGEgSW5mb3JtYWNpw7NuMSkwJwYJKoZIhvcNAQkBFhphc2lzbmV0QHBydWViYXMuc2F0LmdvYi5teDEmMCQGA1UECQwdQXYuIEhpZGFsZ28gNzcsIENvbC4gR3VlcnJlcm8xDjAMBgNVBBEMBTA2MzAwMQswCQYDVQQGEwJNWDEZMBcGA1UECAwQRGlzdHJpdG8gRmVkZXJhbDESMBAGA1UEBwwJQ295b2Fjw6FuMRUwEwYDVQQtEwxTQVQ5NzA3MDFOTjMxITAfBgkqhkiG9w0BCQIMElJlc3BvbnN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9GODZuRyt4cE1wVm5tbXB3YVZxTHdOdHAwVXY2NTdJb1hkREtXTzE3dk9pMmdMdkFDR2xFWFVPUXpTUm9mTG1ySXdZbFNja3FRa0RlYURqbzdzdlI2UUx1WGJiKzViUWY2dnZGbFloUDJ6RjhFTGF4M1BySnJ4cHF0YjUvbmRyWWpjTkVLN3ppd3RxL0dJPQ.T2lYQ0t4L0RHVkR4dHZ5Nkk1VHNEakZ3Y0J4Nk9GODZuRyt4cE1wVm5tbFlVcU92YUJTZWlHU3pER1kySnlXRTF4alNUS0ZWcUlVS0NhelhqaXdnWTRncklVSWVvZlFZMWNyUjVxYUFxMWFxcStUL1IzdGpHRTJqdS9Zakw2UGRiMTFPRlV3a2kyOWI5WUZHWk85ODJtU0M2UlJEUkFTVXhYTDNKZVdhOXIySE1tUVlFdm1jN3kvRStBQlpLRi9NeWJrd0R3clhpYWJrVUMwV0Mwd3FhUXdpUFF5NW5PN3J5cklMb0FETHlxVFRtRW16UW5ZVjAwUjdCa2g0Yk1iTExCeXJkVDRhMGMxOUZ1YWlIUWRRVC8yalFTNUczZXdvWlF0cSt2UW0waFZKY2gyaW5jeElydXN3clNPUDNvU1J2dm9weHBTSlZYNU9aaGsvalpQMUxrUndzK0dHS2dpTittY1JmR3o2M3NqNkh4MW9KVXMvUHhZYzVLQS9UK2E1SVhEZFJKYWx4ZmlEWDFuSXlqc2ZRYXlUQk1ldlZkU2tEdU10NFVMdHZKUURLblBxakw0SDl5bUxabDFLNmNPbEp6b3Jtd2Q1V2htRHlTdDZ6eTFRdUNnYnVvK2tuVUdhMmwrVWRCZi9rQkU9.7k2gVCGSZKLzJK5Ky3Nr5tKxvGSJhL13Q8W-YhT0uIo";
+ @Test
public void testCargaCsd_authUser() throws Exception {
- SWCsdService app = new SWCsdService("demo", "123456789", Utils.url_pruebas, "127.0.0.1", 8888);
- UploadCsdResponse response = null;
- response = (UploadCsdResponse) app.UploadMyCsd(b64Cer, b64Key, password_csd, "stamp", true);
+ SWCsdService app = new SWCsdService("demo", "123456789", Utils.url_pruebas);
+ CsdResponse response = null;
+ response = (CsdResponse) app.UploadMyCsd(b64Cer, b64Key, password_csd, "stamp", true);
System.out.println(response.HttpStatusCode);
System.out.println(response.data);
System.out.println(response.Status);
@@ -25,11 +31,11 @@ public void testCargaCsd_authUser() throws Exception {
String expect_status = "success";
Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status));
}
-
+ @Test
public void testCargaCsd_authToken() throws Exception {
SWCsdService app = new SWCsdService(token, Utils.url_pruebas);
- UploadCsdResponse response = null;
- response = (UploadCsdResponse) app.UploadMyCsd(b64Cer, b64Key, password_csd, "stamp", true);
+ CsdResponse response = null;
+ response = (CsdResponse) app.UploadMyCsd(b64Cer, b64Key, password_csd, "stamp", true);
System.out.println(response.HttpStatusCode);
System.out.println(response.data);
System.out.println(response.Status);
@@ -38,4 +44,132 @@ public void testCargaCsd_authToken() throws Exception {
String expect_status = "success";
Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status));
}
+ @Test
+ public void testDisableCsd_authUser() throws Exception {
+ SWCsdService app = new SWCsdService("demo", "123456789", Utils.url_pruebas);
+ CsdResponse response = null;
+ response = (CsdResponse) app.DisableMyCsd("20001000000300022763");
+ System.out.println(response.HttpStatusCode);
+ System.out.println(response.data);
+ System.out.println(response.Status);
+ System.out.println(response.message);
+ System.out.println(response.messageDetail);
+ String expect_status = "success";
+ Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status));
+ }
+ @Test
+ public void testGetListCsd_authUser() throws Exception {
+ SWCsdService app = new SWCsdService("demo", "123456789", Utils.url_pruebas);
+ ListInfoCsdResponse response = null;
+ response = (ListInfoCsdResponse) app.GetListCsd();
+ System.out.println(response.HttpStatusCode);
+ List lista = response.data;
+ if(lista != null) {
+ for(int i=0; i lista = response.data;
+ if(lista != null) {
+ for(int i=0; i lista = response.data;
+ if(lista != null) {
+ for(int i=0; i ";
-
+public class SWIssueServiceTest {
+ static Utils ut = new Utils();
+ @Test
public void testStampREAL_JSON_STRING_USER_PASSWORD_AUTH_V1() throws Exception {
SWIssueService api = new SWIssueService("demo", "123456789", Utils.url_pruebas);
+ String testJson = ut.JsonGenBasico();
SuccessV1Response response = null;
response = (SuccessV1Response) api.IssueJson(testJson, "v1");
System.out.println(response.Status);
@@ -23,12 +23,12 @@ public void testStampREAL_JSON_STRING_USER_PASSWORD_AUTH_V1() throws Exception {
System.out.println(response.tfd);
System.out.println(response.message);
String expect_status = "success";
- String expect_error = "401 - El rango de la fecha de generación no debe de ser mayor a 72 horas para la emisión del timbre.";
- Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status) || expect_error.equalsIgnoreCase(response.message));
+ Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status));
}
-
+ @Test
public void testStampREAL_JSON_STRING_USER_PASSWORD_AUTH_V2() throws Exception {
SWIssueService api = new SWIssueService("demo", "123456789", Utils.url_pruebas);
+ String testJson = ut.JsonGenBasico();
SuccessV2Response response = null;
response = (SuccessV2Response) api.IssueJson(testJson, "v2");
System.out.println(response.Status);
@@ -37,12 +37,12 @@ public void testStampREAL_JSON_STRING_USER_PASSWORD_AUTH_V2() throws Exception {
System.out.println(response.cfdi);
System.out.println(response.message);
String expect_status = "success";
- String expect_error = "401 - El rango de la fecha de generación no debe de ser mayor a 72 horas para la emisión del timbre.";
- Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status) || expect_error.equalsIgnoreCase(response.message));
+ Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status));
}
-
+ @Test
public void testStampREAL_JSON_STRING_USER_PASSWORD_AUTH_V3() throws Exception {
SWIssueService api = new SWIssueService("demo", "123456789", Utils.url_pruebas);
+ String testJson = ut.JsonGenBasico();
SuccessV3Response response = null;
response = (SuccessV3Response) api.IssueJson(testJson, "v3");
System.out.println(response.Status);
@@ -50,13 +50,13 @@ public void testStampREAL_JSON_STRING_USER_PASSWORD_AUTH_V3() throws Exception {
System.out.println(response.message);
System.out.println(response.cfdi);
String expect_status = "success";
- String expect_error = "401 - El rango de la fecha de generación no debe de ser mayor a 72 horas para la emisión del timbre.";
Assert.assertTrue(
- expect_status.equalsIgnoreCase(response.Status) || expect_error.equalsIgnoreCase(response.message));
+ expect_status.equalsIgnoreCase(response.Status));
}
-
+ @Test
public void testStampREAL_JSON_STRING_USER_PASSWORD_AUTH_V4() throws Exception {
SWIssueService api = new SWIssueService("demo", "123456789", Utils.url_pruebas);
+ String testJson = ut.JsonGenBasico();
SuccessV4Response response = null;
response = (SuccessV4Response) api.IssueJson(testJson, "v4");
System.out.println(response.message);
@@ -71,55 +71,54 @@ public void testStampREAL_JSON_STRING_USER_PASSWORD_AUTH_V4() throws Exception {
System.out.println(response.fechaTimbrado);
System.out.println(response.uuid);
String expect_status = "success";
- String expect_error = "401 - El rango de la fecha de generación no debe de ser mayor a 72 horas para la emisión del timbre.";
- Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status) || expect_error.equalsIgnoreCase(response.message));
+ Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status));
}
-
+ @Test
public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V1() throws Exception {
SWIssueService api = new SWIssueService("demo", "123456789", Utils.url_pruebas);
+ String normalXml = ut.StringgenBasico();
SuccessV1Response response = null;
- response = (SuccessV1Response) api.IssueXml(xmlIssue, "v1");
+ response = (SuccessV1Response) api.IssueXml(normalXml, "v1");
System.out.println(response.Status);
System.out.println(response.HttpStatusCode);
System.out.println(response.tfd);
System.out.println(response.message);
String expect_status = "success";
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status) || expect_error.equalsIgnoreCase(response.message));
+ Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status));
}
-
+ @Test
public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V2() throws Exception {
SWIssueService api = new SWIssueService("demo", "123456789", Utils.url_pruebas);
+ String normalXml = ut.genc10();
SuccessV2Response response = null;
- response = (SuccessV2Response) api.IssueXml(xmlIssue, "v2");
+ response = (SuccessV2Response) api.IssueXml(normalXml, "v2");
System.out.println(response.Status);
System.out.println(response.HttpStatusCode);
System.out.println(response.tfd);
System.out.println(response.cfdi);
System.out.println(response.message);
String expect_status = "success";
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status) || expect_error.equalsIgnoreCase(response.message));
+ Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status));
}
-
+ @Test
public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V3() throws Exception {
SWIssueService api = new SWIssueService("demo", "123456789", Utils.url_pruebas);
+ String normalXml = ut.genNomina10();
SuccessV3Response response = null;
- response = (SuccessV3Response) api.IssueXml(xmlIssue, "v3");
+ response = (SuccessV3Response) api.IssueXml(normalXml, "v3");
System.out.println(response.Status);
System.out.println(response.HttpStatusCode);
System.out.println(response.message);
System.out.println(response.cfdi);
String expect_status = "success";
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(
- expect_status.equalsIgnoreCase(response.Status) || expect_error.equalsIgnoreCase(response.message));
+ Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status));
}
-
+ @Test
public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V4() throws Exception {
SWIssueService api = new SWIssueService("demo", "123456789", Utils.url_pruebas);
+ String normalXml = ut.genPagos10();
SuccessV4Response response = null;
- response = (SuccessV4Response) api.IssueXml(xmlIssue, "v4");
+ response = (SuccessV4Response) api.IssueXml(normalXml, "v4");
System.out.println(response.message);
System.out.println(response.Status);
System.out.println(response.cfdi);
@@ -132,7 +131,6 @@ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V4() throws Exception {
System.out.println(response.fechaTimbrado);
System.out.println(response.uuid);
String expect_status = "success";
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status) || expect_error.equalsIgnoreCase(response.message));
+ Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status));
}
}
\ No newline at end of file
diff --git a/src/test/java/Tests/Issue/SWIssueServiceV2Test.java b/src/test/java/Tests/Issue/SWIssueServiceV2Test.java
new file mode 100644
index 0000000..a4c53e9
--- /dev/null
+++ b/src/test/java/Tests/Issue/SWIssueServiceV2Test.java
@@ -0,0 +1,89 @@
+package Tests.Issue;
+
+import Tests.Utils;
+import Utils.Responses.Stamp.SuccessV1Response;
+import Utils.Responses.Stamp.SuccessV2Response;
+import Utils.Responses.Stamp.SuccessV3Response;
+import Utils.Responses.Stamp.SuccessV4Response;
+
+import java.io.IOException;
+
+import org.junit.Assert;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+import Exceptions.AuthException;
+import Exceptions.GeneralException;
+import Services.Issue.SWIssueServiceV2;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class SWIssueServiceV2Test {
+ static Utils ut = new Utils();
+ static String normalXml = ut.StringgenBasico();
+
+ @Test
+ public void testFirst() throws AuthException, GeneralException, IOException {
+ SWIssueServiceV2 api = new SWIssueServiceV2("demo", "123456789", Utils.url_pruebas);
+ SuccessV3Response response = null;
+ response = (SuccessV3Response) api.IssueXml(normalXml, "v3");
+ Assert.assertNotNull(response);
+ Assert.assertNotNull(response.cfdi);
+ Assert.assertTrue(!response.cfdi.equalsIgnoreCase(""));
+ }
+ @Test
+ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V1() throws Exception {
+ SWIssueServiceV2 api = new SWIssueServiceV2("demo", "123456789", Utils.url_pruebas);
+ SuccessV1Response response = null;
+ response = (SuccessV1Response) api.IssueXml(normalXml, "v1");
+ System.out.println(response.Status);
+ System.out.println(response.HttpStatusCode);
+ System.out.println(response.tfd);
+ System.out.println(response.message);
+ String expect_error = "307. El comprobante contiene un timbre previo.";
+ Assert.assertTrue(!response.tfd.equalsIgnoreCase("") && expect_error.equalsIgnoreCase(response.message));
+ }
+ @Test
+ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V2() throws Exception {
+ SWIssueServiceV2 api = new SWIssueServiceV2("demo", "123456789", Utils.url_pruebas);
+ SuccessV2Response response = null;
+ response = (SuccessV2Response) api.IssueXml(normalXml, "v2");
+ System.out.println(response.Status);
+ System.out.println(response.HttpStatusCode);
+ System.out.println(response.tfd);
+ System.out.println(response.cfdi);
+ String expect_error = "307. El comprobante contiene un timbre previo.";
+ Assert.assertTrue(!response.tfd.equalsIgnoreCase("") && expect_error.equalsIgnoreCase(response.message));
+ }
+ @Test
+ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V3() throws Exception {
+ SWIssueServiceV2 api = new SWIssueServiceV2("demo", "123456789", Utils.url_pruebas);
+ SuccessV3Response response = null;
+ response = (SuccessV3Response) api.IssueXml(normalXml, "v3");
+ System.out.println(response.Status);
+ System.out.println(response.HttpStatusCode);
+ System.out.println(response.message);
+ System.out.println(response.cfdi);
+ String expect_error = "307. El comprobante contiene un timbre previo.";
+ Assert.assertTrue(!response.cfdi.equalsIgnoreCase("") && expect_error.equalsIgnoreCase(response.message));
+ }
+ @Test
+ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V4() throws Exception {
+ SWIssueServiceV2 api = new SWIssueServiceV2("demo", "123456789", Utils.url_pruebas);
+ SuccessV4Response response = null;
+ response = (SuccessV4Response) api.IssueXml(normalXml, "v4");
+ System.out.println(response.message);
+ System.out.println(response.Status);
+ System.out.println(response.cfdi);
+ System.out.println(response.qrCode);
+ System.out.println(response.cadenaOriginalSAT);
+ System.out.println(response.selloCFDI);
+ System.out.println(response.selloSAT);
+ System.out.println(response.noCertificadoCFDI);
+ System.out.println(response.noCertificadoSAT);
+ System.out.println(response.fechaTimbrado);
+ System.out.println(response.uuid);
+ String expect_error = "307. El comprobante contiene un timbre previo.";
+ Assert.assertTrue(!response.uuid.equalsIgnoreCase("") && expect_error.equalsIgnoreCase(response.message));
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/Tests/Pendings/SWPendingsServiceTest.java b/src/test/java/Tests/Pendings/SWPendingsServiceTest.java
index 4f73f6b..0ff349f 100644
--- a/src/test/java/Tests/Pendings/SWPendingsServiceTest.java
+++ b/src/test/java/Tests/Pendings/SWPendingsServiceTest.java
@@ -4,13 +4,13 @@
import java.util.List;
import org.junit.Assert;
+import org.junit.Test;
import Services.Pendings.SWPendingsService;
import Tests.Utils;
import Utils.Responses.Pendings.PendientesCancelarResponse;
-import junit.framework.TestCase;
-public class SWPendingsServiceTest extends TestCase {
+public class SWPendingsServiceTest {
public String uuid = "06a46e4b-b154-4c12-bb77-f9a63ed55ff2";
public String password_csd = "12345678a";
public String rfc = "LAN7008173R5";
@@ -19,7 +19,7 @@ public class SWPendingsServiceTest extends TestCase {
public String token = "T2lYQ0t4L0RHVkR4dHZ5Nkk1VHNEakZ3Y0J4Nk9GODZuRyt4cE1wVm5tbXB3YVZxTHdOdHAwVXY2NTdJb1hkREtXTzE3dk9pMmdMdkFDR2xFWFVPUXpTUm9mTG1ySXdZbFNja3FRa0RlYURqbzdzdlI2UUx1WGJiKzViUWY2dnZGbFloUDJ6RjhFTGF4M1BySnJ4cHF0YjUvbmRyWWpjTkVLN3ppd3RxL0dJPQ.T2lYQ0t4L0RHVkR4dHZ5Nkk1VHNEakZ3Y0J4Nk9GODZuRyt4cE1wVm5tbFlVcU92YUJTZWlHU3pER1kySnlXRTF4alNUS0ZWcUlVS0NhelhqaXdnWTRncklVSWVvZlFZMWNyUjVxYUFxMWFxcStUL1IzdGpHRTJqdS9Zakw2UGRiMTFPRlV3a2kyOWI5WUZHWk85ODJtU0M2UlJEUkFTVXhYTDNKZVdhOXIySE1tUVlFdm1jN3kvRStBQlpLRi9NeWJrd0R3clhpYWJrVUMwV0Mwd3FhUXdpUFF5NW5PN3J5cklMb0FETHlxVFRtRW16UW5ZVjAwUjdCa2g0Yk1iTExCeXJkVDRhMGMxOUZ1YWlIUWRRVC8yalFTNUczZXdvWlF0cSt2UW0waFZKY2gyaW5jeElydXN3clNPUDNvU1J2dm9weHBTSlZYNU9aaGsvalpQMUxrUndzK0dHS2dpTittY1JmR3o2M3NqNkh4MW9KVXMvUHhZYzVLQS9UK2E1SVhEZFJKYWx4ZmlEWDFuSXlqc2ZRYXlUQk1ldlZkU2tEdU10NFVMdHZKUURLblBxakw0SDl5bUxabDFLNmNPbEp6b3Jtd2Q1V2htRHlTdDZ6eTFRdUNnYnVvK2tuVUdhMmwrVWRCZi9rQkU9.7k2gVCGSZKLzJK5Ky3Nr5tKxvGSJhL13Q8W-YhT0uIo";
public String xml = "3eaeabc9-ea41-4627-9609-c6856b78e2b1rs2ZcFnS9hbfmyJLmR3Mtnklt7g=O/I7ILsU2y1fqeb2NBZSQKlQC3DpN/bgcDB5LWCMIYp4mFCLmLxEq/6ADz0xVQWUw49BqWDZ1GAI4ODIZLDQtafHSIE7BXKy8huvKD1dtpRLQ/39IfpxXsz1g6Q14mH3LxDOQugk/GhKMWILXZnIipyQosv3IbgLMZ/V/4btK7xrFX/KiOt0PcefChyaerj9A815dA3J4JgpBUNzbOz9VlhvdZMJskrHxzZ5riU1TAuSw/oi68dJfA7S+6XrTmeFDQzYxACHyOzj24RjLi/31+Fc/wiqQXNu9O6oWl8p5+GVoz2xtU4aRqLxVh73L6WAAef/WDeKDMfIge1BtMrxYw==OID.1.2.840.113549.1.9.2=Responsable: ACDMA, OID.2.5.4.45=SAT970701NN3, L=Coyoac?n, S=Distrito Federal, C=MX, PostalCode=06300, STREET=\"Av. Hidalgo 77, Col. Guerrero\", E=asisnet@pruebas.sat.gob.mx, OU=Administraci?n de Seguridad de la Informaci?n, O=Servicio de Administraci?n Tributaria, CN=A.C. 2 de pruebas(4096)3230303031303030303030333030303232383135MIIFxTCCA62gAwIBAgIUMjAwMDEwMDAwMDAzMDAwMjI4MTUwDQYJKoZIhvcNAQELBQAwggFmMSAwHgYDVQQDDBdBLkMuIDIgZGUgcHJ1ZWJhcyg0MDk2KTEvMC0GA1UECgwmU2VydmljaW8gZGUgQWRtaW5pc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0Ae74mdA+AN07lQC7Q8FicpTDlNjqh+VV5nqLht8wzzq/l1QFgcjxgp23520G/YpCGhseJv2PWcV0H1rs0coAi3qCr7G+A2MYwGJA4DCAfD92xZWtZgPUpPSELvEBgWqMsW87xd1MSkumJ8e7zGOMXoFRo3ID4wot1FIaWU/EJyzb3xowrbY64Ytquuu9s9ef0weTumPMvkWcnGeqgKaEMnl24Is6CoG+qS+HfvgS8qxiv1TfTTIRmT0nhYWRoEkE/0ue6X4Zs+qT28Z8P/LzcIJECJvd39K5BI0q3RMqEVumgVcKGPB9nkxReDPR1M/cxY9qru99NaOK0dZJAin5AXDVOrCZzOdLeEU5lIRXWZwr9i1/rVvLh6f3tnhVWgbghp+JsuhaX2ALRY74pAosbzVMZJlf31TElMCMGCSqGSIb3DQEJFTEWBBTV2Mqe5ylxDwy8SvKAi/DPPo81QzAxMCEwCQYFKw4DAhoFAAQUro+9ySRmBaYPd9oC4rXFvP20CPkECEuQk0rStkWzAgIIAA==";
-
+ @Test
public void testPendientesCancelarService() throws Exception {
SWPendingsService app = new SWPendingsService("demo", "123456789", Utils.url_pruebas);
String rfc = "LAN7008173R5";
diff --git a/src/test/java/Tests/Relations/SWRelationsServiceTest.java b/src/test/java/Tests/Relations/SWRelationsServiceTest.java
index f6baf28..3eff2e5 100644
--- a/src/test/java/Tests/Relations/SWRelationsServiceTest.java
+++ b/src/test/java/Tests/Relations/SWRelationsServiceTest.java
@@ -3,14 +3,14 @@
import java.util.LinkedList;
import org.junit.Assert;
+import org.junit.Test;
import Services.Relations.SWRelationsService;
import Tests.Utils;
import Utils.Responses.Relations.CfdiRelacionadosResponse;
import Utils.Responses.Relations.RelacionData;
-import junit.framework.TestCase;
-public class SWRelationsServiceTest extends TestCase {
+public class SWRelationsServiceTest {
public String uuid = "52C02B64-D12E-4163-B581-BF749238896D";
public String password_csd = "12345678a";
public String rfc = "LAN7008173R5";
@@ -19,7 +19,7 @@ public class SWRelationsServiceTest extends TestCase {
public String token = "T2lYQ0t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/6ADz0xVQWUw49BqWDZ1GAI4ODIZLDQtafHSIE7BXKy8huvKD1dtpRLQ/39IfpxXsz1g6Q14mH3LxDOQugk/GhKMWILXZnIipyQosv3IbgLMZ/V/4btK7xrFX/KiOt0PcefChyaerj9A815dA3J4JgpBUNzbOz9VlhvdZMJskrHxzZ5riU1TAuSw/oi68dJfA7S+6XrTmeFDQzYxACHyOzj24RjLi/31+Fc/wiqQXNu9O6oWl8p5+GVoz2xtU4aRqLxVh73L6WAAef/WDeKDMfIge1BtMrxYw==OID.1.2.840.113549.1.9.2=Responsable: ACDMA, OID.2.5.4.45=SAT970701NN3, L=Coyoac?n, S=Distrito Federal, C=MX, PostalCode=06300, STREET=\"Av. Hidalgo 77, Col. Guerrero\", E=asisnet@pruebas.sat.gob.mx, OU=Administraci?n de Seguridad de la Informaci?n, O=Servicio de Administraci?n Tributaria, CN=A.C. 2 de pruebas(4096)3230303031303030303030333030303232383135MIIFxTCCA62gAwIBAgIUMjAwMDEwMDAwMDAzMDAwMjI4MTUwDQYJKoZIhvcNAQELBQAwggFmMSAwHgYDVQQDDBdBLkMuIDIgZGUgcHJ1ZWJhcyg0MDk2KTEvMC0GA1UECgwmU2VydmljaW8gZGUgQWRtaW5pc3RyYWNpw7NuIFRyaWJ1dGFyaWExODA2BgNVBAsML0FkbWluaXN0cmFjacOzbiBkZSBTZWd1cmlkYWQgZGUgbGEgSW5mb3JtYWNpw7NuMSkwJwYJKoZIhvcNAQkBFhphc2lzbmV0QHBydWViYXMuc2F0LmdvYi5teDEmMCQGA1UECQwdQXYuIEhpZGFsZ28gNzcsIENvbC4gR3VlcnJlcm8xDjAMBgNVBBEMBTA2MzAwMQswCQYDVQQGEwJNWDEZMBcGA1UECAwQRGlzdHJpdG8gRmVkZXJhbDESMBAGA1UEBwwJQ295b2Fjw6FuMRUwEwYDVQQtEwxTQVQ5NzA3MDFOTjMxITAfBgkqhkiG9w0BCQIMElJlc3BvbnNhYmxlOiBBQ0RNQTAeFw0xNjEwM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MCMGCSqGSIb3DQEJFTEWBBTV2Mqe5ylxDwy8SvKAi/DPPo81QzAxMCEwCQYFKw4DAhoFAAQUro+9ySRmBaYPd9oC4rXFvP20CPkECEuQk0rStkWzAgIIAA==";
-
+ @Test
public void testCfdiRelacionadosService_CSD() throws Exception {
SWRelationsService app = new SWRelationsService("demo", "123456789", Utils.url_pruebas);
CfdiRelacionadosResponse response = null;
@@ -50,7 +50,7 @@ public void testCfdiRelacionadosService_CSD() throws Exception {
String expect_status = "success";
Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status));
}
-
+ @Test
public void testCfdiRelacionadosService_Pfx() throws Exception {
SWRelationsService app = new SWRelationsService("demo", "123456789", Utils.url_pruebas);
CfdiRelacionadosResponse response = null;
@@ -81,7 +81,7 @@ public void testCfdiRelacionadosService_Pfx() throws Exception {
String expect_status = "success";
Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status));
}
-
+ @Test
public void testCfdiRelacionadosService_Xml() throws Exception {
SWRelationsService app = new SWRelationsService("demo", "123456789", Utils.url_pruebas);
CfdiRelacionadosResponse response = null;
@@ -113,7 +113,7 @@ public void testCfdiRelacionadosService_Xml() throws Exception {
String expect_status = "success";
Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status));
}
-
+ @Test
public void testCfdiRelacionadosService_UUID() throws Exception {
SWRelationsService app = new SWRelationsService("demo", "123456789", Utils.url_pruebas);
CfdiRelacionadosResponse response = null;
diff --git a/src/test/java/Tests/Stamp/SWStampServiceTest.java b/src/test/java/Tests/Stamp/SWStampServiceTest.java
index 543cf01..7b12a3b 100644
--- a/src/test/java/Tests/Stamp/SWStampServiceTest.java
+++ b/src/test/java/Tests/Stamp/SWStampServiceTest.java
@@ -7,624 +7,570 @@
import Utils.Responses.Stamp.SuccessV2Response;
import Utils.Responses.Stamp.SuccessV3Response;
import Utils.Responses.Stamp.SuccessV4Response;
-import junit.framework.TestCase;
-
import org.junit.Assert;
-
-
-
-
-public class SWStampServiceTest extends TestCase {
-
-
-//STANDARD XML
- public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V1() throws Exception {
- SWStampService api = new SWStampService("demo","123456789",Utils.url_pruebas);
- SuccessV1Response response = null;
- Utils ut = new Utils();
- response = (SuccessV1Response) api.Stamp(ut.StringgenBasico(),"v1");
- System.out.println(response.Status);
- System.out.println(response.HttpStatusCode);
- System.out.println(response.tfd);
- System.out.println(response.message);
- String expect_status = "success";
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status) || expect_error.equalsIgnoreCase(response.message));
- }
-
- public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V2() throws Exception {
- SWStampService api = new SWStampService("demo","123456789",Utils.url_pruebas);
- SuccessV2Response response = null;
- Utils ut = new Utils();
- if(ut.getRandomBoolean()){
- response = (SuccessV2Response) api.Stamp(ut.StringgenBasico(),"v2");
- }else{
- response = (SuccessV2Response) api.Stamp(ut.signXML(ut.StringgenBasico()),"v2");
- }
-
- System.out.println(response.message);
- System.out.println(response.Status);
- System.out.println(response.HttpStatusCode);
- System.out.println(response.tfd);
- System.out.println(response.cfdi);
- String expect_status = "success";
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status) || expect_error.equalsIgnoreCase(response.message));
- }
-
- public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V3() throws Exception {
- SWStampService api = new SWStampService("demo","123456789",Utils.url_pruebas);
- SuccessV3Response response = null;
- Utils ut = new Utils();
- response = (SuccessV3Response) api.Stamp(ut.StringgenBasico(),"v3");
- System.out.println(response.Status);
- System.out.println(response.HttpStatusCode);
- System.out.println(response.cfdi);
- String expect_status = "success";
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status) || expect_error.equalsIgnoreCase(response.message));
- }
-
- public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V4() throws Exception {
- SWStampService api = new SWStampService("demo","123456789",Utils.url_pruebas);
- SuccessV4Response response = null;
- Utils ut = new Utils();
- response = (SuccessV4Response) api.Stamp(ut.StringgenBasico(),"V4");
- System.out.println(response.message);
- System.out.println(response.Status);
- System.out.println(response.cfdi);
- System.out.println(response.qrCode);
- System.out.println(response.cadenaOriginalSAT);
- System.out.println(response.selloCFDI);
- System.out.println(response.selloSAT);
- System.out.println(response.noCertificadoCFDI);
- System.out.println(response.noCertificadoSAT);
- System.out.println(response.fechaTimbrado);
- System.out.println(response.uuid);
- System.out.println(response.messageDetail);
- String expect_status = "success";
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status) || expect_error.equalsIgnoreCase(response.message));
-
- }
-
- public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V1_b64() throws Exception {
- SWStampService api = new SWStampService("demo","123456789",Utils.url_pruebas);
- SuccessV1Response response = null;
- Utils ut = new Utils();
- response = (SuccessV1Response) api.Stamp(ut.toBase64(ut.StringgenBasico()),"v1",true);
- System.out.println(response.Status);
- System.out.println(response.message);
- System.out.println(response.HttpStatusCode);
- System.out.println(response.tfd);
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(Utils.isValidB64(response.tfd) || expect_error.equalsIgnoreCase(response.message));
- }
-
- public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V2_b64() throws Exception {
- SWStampService api = new SWStampService("demo","123456789",Utils.url_pruebas);
- SuccessV2Response response = null;
- Utils ut = new Utils();
- response = (SuccessV2Response) api.Stamp(ut.toBase64(ut.StringgenBasico()),"v2",true);
- System.out.println(response.Status);
- System.out.println(response.HttpStatusCode);
- System.out.println(response.tfd);
- System.out.println(response.cfdi);
- boolean cfdi_valid = Utils.isValidB64(response.cfdi), tfd_valid = Utils.isValidB64(response.tfd);
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(cfdi_valid && tfd_valid || expect_error.equalsIgnoreCase((response.message)));
- }
-
- public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V3_b64() throws Exception {
- SWStampService api = new SWStampService("demo","123456789",Utils.url_pruebas);
- SuccessV3Response response = null;
- Utils ut = new Utils();
- response = (SuccessV3Response) api.Stamp(ut.toBase64(ut.StringgenBasico()),"v3",true);
- System.out.println(response.message);
- System.out.println(response.Status);
- System.out.println(response.HttpStatusCode);
- System.out.println(response.message);
- System.out.println(response.cfdi);
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(Utils.isValidB64(response.cfdi) || expect_error.equalsIgnoreCase(response.message));
- }
-
- public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V4_b64() throws Exception {
- SWStampService api = new SWStampService("demo","123456789",Utils.url_pruebas);
- SuccessV4Response response = null;
- Utils ut = new Utils();
- response = (SuccessV4Response) api.Stamp(ut.toBase64(ut.StringgenBasico()),"V4",true);
- System.out.println(response.message);
- System.out.println(response.Status);
- System.out.println(response.cfdi);
- System.out.println(response.qrCode);
- System.out.println(response.cadenaOriginalSAT);
- System.out.println(response.selloCFDI);
- System.out.println(response.selloSAT);
- System.out.println(response.noCertificadoCFDI);
- System.out.println(response.noCertificadoSAT);
- System.out.println(response.fechaTimbrado);
- System.out.println(response.uuid);
- boolean valid_cfdi = Utils.isValidB64(response.cfdi),
- valid_qr = Utils.isValidB64(response.qrCode),
- valid_sellocfdi = Utils.isValidB64(response.selloCFDI),
- valid_sellosat = Utils.isValidB64(response.selloSAT);
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(valid_cfdi && valid_qr && valid_sellocfdi && valid_sellosat || expect_error.equalsIgnoreCase(response.message));
- }
-
-
-
- //cc10 XML
-
- public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V1_CC10() throws Exception {
- SWStampService api = new SWStampService("demo","123456789",Utils.url_pruebas);
- SuccessV1Response response = null;
- Utils ut = new Utils();
- response = (SuccessV1Response) api.Stamp(ut.genc10(),"v1");
- System.out.println(response.message);
- System.out.println(response.Status);
- System.out.println(response.HttpStatusCode);
- System.out.println(response.tfd);
- String expect_status = "success";
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status) || expect_error.equalsIgnoreCase(response.message));
- }
-
- public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V2_CC10() throws Exception {
- SWStampService api = new SWStampService("demo","123456789",Utils.url_pruebas);
- SuccessV2Response response = null;
- Utils ut = new Utils();
- response = (SuccessV2Response) api.Stamp(ut.genc10(),"v2");
- System.out.println(response.Status);
- System.out.println(response.message);
- System.out.println(response.HttpStatusCode);
- System.out.println(response.tfd);
- System.out.println(response.cfdi);
- String expect_status = "success";
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status) || expect_error.equalsIgnoreCase(response.message));
- }
-
- public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V3_CC10() throws Exception {
- SWStampService api = new SWStampService("demo","123456789",Utils.url_pruebas);
- SuccessV3Response response = null;
- Utils ut = new Utils();
- response = (SuccessV3Response) api.Stamp(ut.genc10(),"v3");
- System.out.println(response.Status);
- System.out.println(response.HttpStatusCode);
- System.out.println(response.cfdi);
- String expect_status = "success";
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status) || expect_error.equalsIgnoreCase(response.message));
- }
-
- public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V4_CC10() throws Exception {
- SWStampService api = new SWStampService("demo","123456789",Utils.url_pruebas);
- SuccessV4Response response = null;
- Utils ut = new Utils();
- response = (SuccessV4Response) api.Stamp(ut.genc10(),"V4");
- System.out.println(response.Status);
-
- System.out.println(response.qrCode);
- System.out.println(response.cadenaOriginalSAT);
- System.out.println(response.selloCFDI);
- System.out.println(response.selloSAT);
- System.out.println(response.noCertificadoCFDI);
- System.out.println(response.noCertificadoSAT);
- System.out.println(response.fechaTimbrado);
- System.out.println(response.uuid);
- String expect_status = "success";
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status) || expect_error.equalsIgnoreCase(response.message));
-
- }
-
- public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V1_b64_CC10() throws Exception {
- SWStampService api = new SWStampService("demo","123456789",Utils.url_pruebas);
- SuccessV1Response response = null;
- Utils ut = new Utils();
- response = (SuccessV1Response) api.Stamp(ut.toBase64(ut.genc10()),"v1",true);
- System.out.println(response.Status);
- System.out.println(response.HttpStatusCode);
- System.out.println(response.tfd);
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(Utils.isValidB64(response.tfd) || expect_error.equalsIgnoreCase(response.message));
- }
-
- public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V2_b64_CC10() throws Exception {
- SWStampService api = new SWStampService("demo","123456789",Utils.url_pruebas);
- SuccessV2Response response = null;
- Utils ut = new Utils();
- response = (SuccessV2Response) api.Stamp(ut.toBase64(ut.genc10()),"v2",true);
- System.out.println(response.Status);
- System.out.println(response.HttpStatusCode);
- System.out.println(response.tfd);
- System.out.println(response.cfdi);
- boolean cfdi_valid = Utils.isValidB64(response.cfdi), tfd_valid = Utils.isValidB64(response.tfd);
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(cfdi_valid && tfd_valid || expect_error.equalsIgnoreCase(response.message));
-
- }
-
- public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V3_b64_CC10() throws Exception {
- SWStampService api = new SWStampService("demo","123456789",Utils.url_pruebas);
- SuccessV3Response response = null;
- Utils ut = new Utils();
- response = (SuccessV3Response) api.Stamp(ut.toBase64(ut.genc10()),"v3",true);
- System.out.println(response.Status);
- System.out.println(response.HttpStatusCode);
- System.out.println(response.cfdi);
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(Utils.isValidB64(response.cfdi) || expect_error.equalsIgnoreCase(response.message));
- }
-
- public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V4_b64_CC10() throws Exception {
- SWStampService api = new SWStampService("demo","123456789",Utils.url_pruebas);
- SuccessV4Response response = null;
- Utils ut = new Utils();
- response = (SuccessV4Response) api.Stamp(ut.toBase64(ut.genc10()),"V4",true);
- System.out.println(response.Status);
- System.out.println(response.cfdi);
- System.out.println(response.qrCode);
- System.out.println(response.cadenaOriginalSAT);
- System.out.println(response.selloCFDI);
- System.out.println(response.selloSAT);
- System.out.println(response.noCertificadoCFDI);
- System.out.println(response.noCertificadoSAT);
- System.out.println(response.fechaTimbrado);
- System.out.println(response.uuid);
- boolean valid_cfdi = Utils.isValidB64(response.cfdi),
- valid_qr = Utils.isValidB64(response.qrCode),
- valid_sellocfdi = Utils.isValidB64(response.selloCFDI),
- valid_sellosat = Utils.isValidB64(response.selloSAT);
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(valid_cfdi && valid_qr && valid_sellocfdi && valid_sellosat || expect_error.equalsIgnoreCase(response.message));
- }
-
-
-
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-
- //////////////////////////////////////////PAGOS10/////////////////////////////////////////////////////////////////////////////////////////
-
-
- public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V1_PAGOS10() throws Exception {
- SWStampService api = new SWStampService("demo","123456789",Utils.url_pruebas);
- SuccessV1Response response = null;
- Utils ut = new Utils();
- response = (SuccessV1Response) api.Stamp(ut.genPagos10(),"v1");
- System.out.println(response.Status);
- System.out.println(response.message);
- System.out.println(response.HttpStatusCode);
- System.out.println(response.tfd);
- String expect_status = "success";
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status) || expect_error.equalsIgnoreCase(response.message));
- }
-
- public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V2_PAGOS10() throws Exception {
- SWStampService api = new SWStampService("demo","123456789",Utils.url_pruebas);
- SuccessV2Response response = null;
- Utils ut = new Utils();
- response = (SuccessV2Response) api.Stamp(ut.genPagos10(),"v2");
- System.out.println(response.Status);
- System.out.println(response.message);
- System.out.println(response.HttpStatusCode);
- System.out.println(response.tfd);
- System.out.println(response.cfdi);
- String expect_status = "success";
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status) || expect_error.equalsIgnoreCase(response.message));
- }
-
- public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V3_PAGOS10() throws Exception {
- SWStampService api = new SWStampService("demo","123456789",Utils.url_pruebas);
- SuccessV3Response response = null;
- Utils ut = new Utils();
- response = (SuccessV3Response) api.Stamp(ut.genPagos10(),"v3");
- System.out.println(response.Status);
- System.out.println(response.message);
- System.out.println(response.HttpStatusCode);
-
- System.out.println(response.cfdi);
- String expect_status = "success";
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status) || expect_error.equalsIgnoreCase(response.message));
- }
-
- public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V4_PAGOS10() throws Exception {
- SWStampService api = new SWStampService("demo","123456789",Utils.url_pruebas);
- SuccessV4Response response = null;
- Utils ut = new Utils();
- response = (SuccessV4Response) api.Stamp(ut.genPagos10(),"V4");
- System.out.println(response.Status);
- System.out.println(response.cfdi);
- System.out.println(response.qrCode);
- System.out.println(response.cadenaOriginalSAT);
- System.out.println(response.selloCFDI);
- System.out.println(response.selloSAT);
- System.out.println(response.noCertificadoCFDI);
- System.out.println(response.noCertificadoSAT);
- System.out.println(response.fechaTimbrado);
- System.out.println(response.uuid);
- String expect_status = "success";
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status) || expect_error.equalsIgnoreCase(response.message));
-
- }
-
- public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V1_b64_PAGOS10() throws Exception {
- SWStampService api = new SWStampService("demo","123456789",Utils.url_pruebas);
- SuccessV1Response response = null;
- Utils ut = new Utils();
- response = (SuccessV1Response) api.Stamp(ut.toBase64(ut.genPagos10()),"v1",true);
- System.out.println(response.Status);
- System.out.println(response.message);
- System.out.println(response.HttpStatusCode);
- System.out.println(response.tfd);
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(Utils.isValidB64(response.tfd) || expect_error.equalsIgnoreCase(response.message));
- }
-
- public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V2_b64_PAGOS10() throws Exception {
- SWStampService api = new SWStampService("demo","123456789",Utils.url_pruebas);
- SuccessV2Response response = null;
- Utils ut = new Utils();
- response = (SuccessV2Response) api.Stamp(ut.toBase64(ut.genPagos10()),"v2",true);
- System.out.println(response.Status);
- System.out.println(response.message);
- System.out.println(response.HttpStatusCode);
- System.out.println(response.tfd);
- System.out.println(response.cfdi);
- boolean cfdi_valid = Utils.isValidB64(response.cfdi), tfd_valid = Utils.isValidB64(response.tfd);
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(cfdi_valid && tfd_valid || expect_error.equalsIgnoreCase(response.message));
-
- }
-
- public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V3_b64_PAGOS10() throws Exception {
- SWStampService api = new SWStampService("demo","123456789",Utils.url_pruebas);
- SuccessV3Response response = null;
- Utils ut = new Utils();
- response = (SuccessV3Response) api.Stamp(ut.toBase64(ut.genPagos10()),"v3",true);
- System.out.println(response.Status);
- System.out.println(response.message);
- System.out.println(response.HttpStatusCode);
- System.out.println(response.cfdi);
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(Utils.isValidB64(response.cfdi) || expect_error.equalsIgnoreCase(response.message));
- }
-
- public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V4_b64_PAGOS10() throws Exception {
- SWStampService api = new SWStampService("demo","123456789",Utils.url_pruebas);
- SuccessV4Response response = null;
- Utils ut = new Utils();
- response = (SuccessV4Response) api.Stamp(ut.toBase64(ut.genPagos10()),"V4",true);
- System.out.println(response.Status);
- System.out.println(response.message);
- System.out.println(response.cfdi);
-
- System.out.println(response.qrCode);
- System.out.println(response.cadenaOriginalSAT);
- System.out.println(response.selloCFDI);
- System.out.println(response.selloSAT);
- System.out.println(response.noCertificadoCFDI);
- System.out.println(response.noCertificadoSAT);
- System.out.println(response.fechaTimbrado);
- System.out.println(response.uuid);
- boolean valid_cfdi = Utils.isValidB64(response.cfdi),
- valid_qr = Utils.isValidB64(response.qrCode),
- valid_sellocfdi = Utils.isValidB64(response.selloCFDI),
- valid_sellosat = Utils.isValidB64(response.selloSAT);
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(valid_cfdi && valid_qr && valid_sellocfdi && valid_sellosat || expect_error.equalsIgnoreCase(response.message));
- }
-
-
-
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
- //////////////////////////////////////////NOMINA12/////////////////////////////////////////////////////////////////////////////////////////
-
-
- public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V1_NOMINA12() throws Exception {
- SWStampService api = new SWStampService("demo","123456789",Utils.url_pruebas);
- SuccessV1Response response = null;
- Utils ut = new Utils();
- response = (SuccessV1Response) api.Stamp(ut.genNomina10(),"v1");
- System.out.println(response.Status);
- System.out.print(response.message);
- System.out.println(response.HttpStatusCode);
- System.out.println(response.tfd);
- String expect_status = "success";
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status) || expect_error.equalsIgnoreCase(response.message));
- }
-
- public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V2_NOMINA12() throws Exception {
- SWStampService api = new SWStampService("demo","123456789",Utils.url_pruebas);
- SuccessV2Response response = null;
- Utils ut = new Utils();
- response = (SuccessV2Response) api.Stamp(ut.genNomina10(),"v2");
- System.out.println(response.Status);
- System.out.println(response.HttpStatusCode);
- System.out.println(response.tfd);
- System.out.println(response.cfdi);
- String expect_status = "success";
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status) || expect_error.equalsIgnoreCase(response.message));
- }
-
- public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V3_NOMINA12() throws Exception {
- SWStampService api = new SWStampService("demo","123456789",Utils.url_pruebas);
- SuccessV3Response response = null;
- Utils ut = new Utils();
- response = (SuccessV3Response) api.Stamp(ut.genNomina10(),"v3");
- System.out.println(response.Status);
- System.out.println(response.HttpStatusCode);
- System.out.println(response.cfdi);
- String expect_status = "success";
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status) || expect_error.equalsIgnoreCase(response.message));
- }
-
- public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V4_NOMINA12() throws Exception {
- SWStampService api = new SWStampService("demo","123456789",Utils.url_pruebas);
- SuccessV4Response response = null;
- Utils ut = new Utils();
- response = (SuccessV4Response) api.Stamp(ut.genNomina10(),"V4");
- System.out.println(response.Status);
- System.out.println(response.cfdi);
- System.out.println(response.qrCode);
- System.out.println(response.cadenaOriginalSAT);
- System.out.println(response.selloCFDI);
- System.out.println(response.selloSAT);
- System.out.println(response.noCertificadoCFDI);
- System.out.println(response.noCertificadoSAT);
- System.out.println(response.fechaTimbrado);
- System.out.println(response.uuid);
- String expect_status = "success";
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status) || expect_error.equalsIgnoreCase(response.message));
- }
-
- public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V1_b64_NOMINA12() throws Exception {
- SWStampService api = new SWStampService("demo","123456789",Utils.url_pruebas);
- SuccessV1Response response = null;
- Utils ut = new Utils();
- response = (SuccessV1Response) api.Stamp(ut.toBase64(ut.genNomina10()),"v1",true);
- System.out.println(response.Status);
- System.out.println(response.HttpStatusCode);
- System.out.println(response.message);
- System.out.println(response.tfd);
- Assert.assertTrue(Utils.isValidB64(response.tfd));
- String expect_status = "success";
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(expect_status.equalsIgnoreCase(response.Status) || expect_error.equalsIgnoreCase(response.message));
- }
-
- public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V2_b64_NOMINA12() throws Exception {
- SWStampService api = new SWStampService("demo","123456789",Utils.url_pruebas);
- SuccessV2Response response = null;
- Utils ut = new Utils();
- response = (SuccessV2Response) api.Stamp(ut.toBase64(ut.genNomina10()),"v2",true);
- System.out.println(response.Status);
- System.out.println(response.HttpStatusCode);
- System.out.println(response.tfd);
- System.out.println(response.cfdi);
- boolean cfdi_valid = Utils.isValidB64(response.cfdi), tfd_valid = Utils.isValidB64(response.tfd);
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(cfdi_valid && tfd_valid || expect_error.equalsIgnoreCase(response.message));
-
- }
-
- public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V3_b64_NOMINA12() throws Exception {
- SWStampService api = new SWStampService("demo","123456789",Utils.url_pruebas);
- SuccessV3Response response = null;
- Utils ut = new Utils();
- response = (SuccessV3Response) api.Stamp(ut.toBase64(ut.genNomina10()),"v3",true);
- System.out.println(response.Status);
- System.out.println(response.HttpStatusCode);
- System.out.println(response.cfdi);
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(Utils.isValidB64(response.cfdi) || expect_error.equalsIgnoreCase(response.message));
- }
-
- public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V4_b64_NOMINA12() throws Exception {
- SWStampService api = new SWStampService("demo","123456789",Utils.url_pruebas);
- SuccessV4Response response = null;
- Utils ut = new Utils();
- response = (SuccessV4Response) api.Stamp(ut.toBase64(ut.genNomina10()),"V4",true);
- System.out.println(response.Status);
- System.out.println(response.cfdi);
- System.out.println(response.qrCode);
- System.out.println(response.cadenaOriginalSAT);
- System.out.println(response.selloCFDI);
- System.out.println(response.selloSAT);
- System.out.println(response.noCertificadoCFDI);
- System.out.println(response.noCertificadoSAT);
- System.out.println(response.fechaTimbrado);
- System.out.println(response.uuid);
- boolean valid_cfdi = Utils.isValidB64(response.cfdi),
- valid_qr = Utils.isValidB64(response.qrCode),
- valid_sellocfdi = Utils.isValidB64(response.selloCFDI),
- valid_sellosat = Utils.isValidB64(response.selloSAT);
- String expect_error = "307. El comprobante contiene un timbre previo.";
- Assert.assertTrue(valid_cfdi && valid_qr && valid_sellocfdi && valid_sellosat || expect_error.equalsIgnoreCase(response.message));
- }
-
-
-
- public void testStampREAL_XML_STRING_EMPTY_PARAMS() throws Exception {
-
- try{
- SWStampService api = new SWStampService("","","");
- IResponse response = null;
- Utils ut = new Utils();
- response = api.Stamp(ut.StringgenBasico(),"v1");
- System.out.println(response.Status);
- System.out.println(response.HttpStatusCode);
-
- }
- catch(Exception e){
- System.out.println("Something bad happened");
- System.out.println(e.getMessage());
- Assert.assertNotNull("Something bad happened", e);
-
- }
-
- }
-
- public void testStampREAL_XML_STRING_INCORRECT_PARAMS() throws Exception {
-
- try{
- SWStampService api = new SWStampService("USER_BAD","PASSWORD_BAD","BAD_URI");
- IResponse response = null;
- Utils ut = new Utils();
- response = api.Stamp(ut.StringgenBasico(),"v1");
- System.out.println(response.Status);
- System.out.println(response.HttpStatusCode);
-
- }
- catch(Exception e){
- System.out.println("Something bad happened");
- System.out.println(e.getMessage());
- Assert.assertNotNull("Something bad happened", e);
-
- }
-
- }
-
- public void testStampTOKEN_EXPIRES_NOT_USER_NOT_PASSWORD() throws Exception {
- SWStampService api = new SWStampService("demo","123456789",Utils.url_pruebas);
- IResponse response = null;
-
- int request_number = 50;
- int revoke_token_step = request_number/2;
- int counter;
-
- for (counter=0;counter");
+ return signXML("");
}
public String genPagos10(){
@@ -67,13 +46,25 @@ public String genNomina10(){
public String StringgenBasico(){
return signXML("");
}
+
+ public String JsonGenBasico() {
+ return changeDateJson("{ \"Complemento\": null, \"Addenda\": null, \"Version\": \"3.3\", \"Serie\": \"RogueOne\", \"Folio\": \"HNFK231\", \"Fecha\": \"2019-01-22T10:44:54\", \"Sello\": \"\", \"FormaPago\": \"01\", \"NoCertificado\": \"20001000000300022816\", \"Certificado\": \"\", \"CondicionesDePago\": null, \"SubTotal\": \"200.00\", \"Moneda\": \"MXN\", \"TipoCambio\": \"1\", \"Total\": \"603.20\", \"TipoDeComprobante\": \"I\", \"MetodoPago\": \"PUE\", \"LugarExpedicion\": \"06300\", \"CfdiRelacionados\": null, \"Emisor\": { \"Rfc\": \"LAN8507268IA\", \"Nombre\": \"MB IDEAS DIGITALES SC\", \"RegimenFiscal\": \"601\" }, \"Receptor\": { \"Rfc\": \"AAA010101AAA\", \"Nombre\": \"SW SMARTERWEB\", \"NumRegIdTrib\": null, \"UsoCFDI\": \"G03\" }, \"Conceptos\": [ { \"Impuestos\": { \"Traslados\": [ { \"Base\": \"200.00\", \"Impuesto\": \"002\", \"TipoFactor\": \"Tasa\", \"TasaOCuota\": \"0.160000\", \"Importe\": \"32.00\" }, { \"Base\": \"232.00\", \"Impuesto\": \"003\", \"TipoFactor\": \"Tasa\", \"TasaOCuota\": \"1.600000\", \"Importe\": \"371.20\" } ], \"Retenciones\": null }, \"InformacionAduanera\": null, \"CuentaPredial\": null, \"ComplementoConcepto\": null, \"Parte\": null, \"ClaveProdServ\": \"50211503\", \"NoIdentificacion\": \"UT421511\", \"Cantidad\": 1, \"ClaveUnidad\": \"H87\", \"Unidad\": \"Pieza\", \"Descripcion\": \"Cigarros\", \"ValorUnitario\": \"200.00\", \"Importe\": \"200.00\" } ], \"Impuestos\": { \"Retenciones\": null, \"Traslados\": [ { \"Impuesto\": \"002\", \"TipoFactor\": \"Tasa\", \"TasaOCuota\": \"0.160000\", \"Importe\": \"32.00\" }, { \"Impuesto\": \"003\", \"TipoFactor\": \"Tasa\", \"TasaOCuota\": \"1.600000\", \"Importe\": \"371.20\" } ], \"TotalImpuestosTrasladados\": \"403.20\" } }");
+ }
public boolean getRandomBoolean() {
Random random = new Random();
return random.nextBoolean();
}
-
+ public String changeDateJson(String json) {
+ JSONObject data = new JSONObject(json);
+ Random random = new Random();
+ SimpleDateFormat formater = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
+ formater.setTimeZone(TimeZone.getTimeZone("America/Mexico_City"));
+ data.put("Fecha", formater.format(new Date()));
+ data.put("Folio", String.valueOf(random.nextInt()));
+ return data.toString();
+ }
public static String remove2(String input) {
// Descomposición canónica
@@ -83,28 +74,27 @@ public static String remove2(String input) {
return pattern.matcher(normalized).replaceAll("");
}
+ public String encodeBase64(String text) throws UnsupportedEncodingException {
+ byte[] bytesEncoded = Base64.encodeBase64(text.getBytes("UTF-8"));
+ return new String(bytesEncoded);
+ }
-
- public String toBase64(String xmlF) throws UnsupportedEncodingException{
-
+ public String toBase64(String xmlF) throws UnsupportedEncodingException{
String xml = this.signXML(xmlF);
- byte[] bytesEncoded = Base64.encodeBase64(xml.getBytes("UTF-8"));
+ byte[] bytesEncoded = Base64.encodeBase64(xml.getBytes("UTF-8"));
return new String(bytesEncoded);
}
public String changeDate(String xml) {
- SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd");
+ SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
date.setTimeZone(TimeZone.getTimeZone("America/Mexico_City"));
- SimpleDateFormat time = new SimpleDateFormat("HH:mm:ss");
- time.setTimeZone(TimeZone.getTimeZone("America/Mexico_City"));
String datetime;
- datetime = date.format(new Date())+"T"+time.format(new Date());
+ datetime = date.format(new Date());
DocumentBuilderFactory factory = newInstance();
DocumentBuilder builder;
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer;
- Sign si = new Sign();
try
{ UUID uuid = UUID.randomUUID();
String randomUUIDString = uuid.toString().replace("-","");
@@ -149,8 +139,6 @@ public String signXML(String xml){
public String putsSign(String xml, String sello){
try{
-
-
DocumentBuilderFactory factory = newInstance();
DocumentBuilder builder;
TransformerFactory tf = TransformerFactory.newInstance();
@@ -163,8 +151,6 @@ public String putsSign(String xml, String sello){
StringWriter writer = new StringWriter();
transformer.transform(new DOMSource(doc), new StreamResult(writer));
String output = writer.getBuffer().toString();
-
-
return output;
}catch (Exception e){
@@ -212,10 +198,6 @@ public static boolean isValidB64(String value){
}
}
-
-
-
-
public static String removeBadChars(String s) {
if (s == null) return null;
StringBuilder sb = new StringBuilder();