diff --git a/pom.xml b/pom.xml
index ea1c0ec..0a63b26 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
ISO-8859-1
SW-JAVA
- 1.0.6.5${rcsuffix}
+ 1.1.0.0${rcsuffix}
jar
https://github.com/lunasoft/sw-sdk-java
diff --git a/src/main/java/Services/Stamp/SWStampService.java b/src/main/java/Services/Stamp/SWStampService.java
index 1e68ddf..28d8230 100644
--- a/src/main/java/Services/Stamp/SWStampService.java
+++ b/src/main/java/Services/Stamp/SWStampService.java
@@ -3,6 +3,7 @@
import Exceptions.AuthException;
import Exceptions.GeneralException;
import Services.SWService;
+import Utils.Enums.StampVersions;
import Utils.Requests.Stamp.StampOptionsRequest;
import Utils.Requests.Stamp.StampRequest;
@@ -29,38 +30,29 @@ public SWStampService(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(), false);
- StampRequest req = new StampRequest();
- return req.sendRequest(settings);
+ public IResponse Stamp(String xml, StampVersions version) throws AuthException, GeneralException, IOException {
+ return this.Stamp(xml, version, false);
}
- public IResponse Stamp(String xml, String version, boolean isb64)
+ public IResponse Stamp(String xml, StampVersions version, boolean isb64)
throws AuthException, GeneralException, IOException {
- if (isb64) {
- 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(), false);
- StampRequest req = new StampRequest();
- return req.sendRequest(settings);
- }
+ StampRequest req = new StampRequest();
+ return req.sendRequest(this.getOptions(xml, version, isb64));
}
- public IResponse Stamp(byte[] xmlFile, String version, boolean isb64)
+ public IResponse Stamp(byte[] xmlFile, StampVersions 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(), false);
- StampRequest req = new StampRequest();
- return req.sendRequest(settings);
+ return this.Stamp(xmlProcess, version, isb64);
}
- 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(), false);
- StampRequest req = new StampRequest();
- return req.sendRequest(settings);
+ public IResponse Stamp(byte[] xmlFile, StampVersions version) throws AuthException, GeneralException, IOException {
+ return this.Stamp(xmlFile, version, false);
+ }
+ private StampOptionsRequest getOptions(String xml, StampVersions version, boolean isBase64) throws AuthException,
+ GeneralException, IOException {
+ return new StampOptionsRequest(super.getToken(), super.getURI(), xml, version.version, isBase64,
+ super.getProxyHost(), super.getProxyPort(), false);
}
}
\ No newline at end of file
diff --git a/src/main/java/Utils/Enums/StampVersions.java b/src/main/java/Utils/Enums/StampVersions.java
new file mode 100644
index 0000000..41e3d0f
--- /dev/null
+++ b/src/main/java/Utils/Enums/StampVersions.java
@@ -0,0 +1,14 @@
+package Utils.Enums;
+
+public enum StampVersions {
+ v1("v1"),
+ v2("v2"),
+ v3("v3"),
+ v4("V4");
+
+ public final String version;
+
+ private StampVersions(String version){
+ this.version = version;
+ }
+}
diff --git a/src/main/java/Utils/Requests/Stamp/StampOptionsRequest.java b/src/main/java/Utils/Requests/Stamp/StampOptionsRequest.java
index 9e658c8..61b24f4 100644
--- a/src/main/java/Utils/Requests/Stamp/StampOptionsRequest.java
+++ b/src/main/java/Utils/Requests/Stamp/StampOptionsRequest.java
@@ -7,7 +7,7 @@ public class StampOptionsRequest extends IRequest {
private String xml;
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);
+ super(token, URI + (isV2 ? Constants.STAMP_V2_PATH : Constants.STAMP_PATH) + version + (isb64 ? "/b64" : ""), version, isb64, proxyHost, proxyPort);
this.xml = xml;
this.version = version;
}
diff --git a/src/test/java/Tests/Stamp/SWStampServiceTest.java b/src/test/java/Tests/Stamp/SWStampServiceTest.java
index 9af613f..1117b15 100644
--- a/src/test/java/Tests/Stamp/SWStampServiceTest.java
+++ b/src/test/java/Tests/Stamp/SWStampServiceTest.java
@@ -2,6 +2,7 @@
import Services.Stamp.SWStampService;
import Tests.Utils;
+import Utils.Enums.StampVersions;
import Utils.Responses.*;
import Utils.Responses.Stamp.SuccessV1Response;
import Utils.Responses.Stamp.SuccessV2Response;
@@ -17,7 +18,7 @@ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V1() throws Exception {
SWStampService api = new SWStampService(Utils.userSW, Utils.passwordSW, Utils.urlSW);
SuccessV1Response response = null;
Utils ut = new Utils();
- response = (SuccessV1Response) api.Stamp(ut.StringgenBasico(false), "v1");
+ response = (SuccessV1Response) api.Stamp(ut.StringgenBasico(false), StampVersions.v1);
System.out.println(response.Status);
System.out.println(response.HttpStatusCode);
System.out.println(response.tfd);
@@ -30,7 +31,7 @@ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V2() throws Exception {
SWStampService api = new SWStampService(Utils.userSW, Utils.passwordSW, Utils.urlSW);
SuccessV2Response response = null;
Utils ut = new Utils();
- response = (SuccessV2Response) api.Stamp(ut.StringgenBasico(false), "v2");
+ response = (SuccessV2Response) api.Stamp(ut.StringgenBasico(false), StampVersions.v2);
System.out.println(response.message);
System.out.println(response.Status);
@@ -45,7 +46,7 @@ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V3() throws Exception {
SWStampService api = new SWStampService(Utils.userSW, Utils.passwordSW, Utils.urlSW);
SuccessV3Response response = null;
Utils ut = new Utils();
- response = (SuccessV3Response) api.Stamp(ut.StringgenBasico(false), "v3");
+ response = (SuccessV3Response) api.Stamp(ut.StringgenBasico(false), StampVersions.v3);
System.out.println(response.Status);
System.out.println(response.HttpStatusCode);
System.out.println(response.cfdi);
@@ -57,7 +58,7 @@ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V4() throws Exception {
SWStampService api = new SWStampService(Utils.userSW, Utils.passwordSW, Utils.urlSW);
SuccessV4Response response = null;
Utils ut = new Utils();
- response = (SuccessV4Response) api.Stamp(ut.StringgenBasico(false), "V4");
+ response = (SuccessV4Response) api.Stamp(ut.StringgenBasico(false), StampVersions.v4);
System.out.println(response.message);
System.out.println(response.Status);
System.out.println(response.cfdi);
@@ -80,7 +81,7 @@ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V1_b64() throws Exceptio
SWStampService api = new SWStampService(Utils.userSW, Utils.passwordSW, Utils.urlSW);
SuccessV1Response response = null;
Utils ut = new Utils();
- response = (SuccessV1Response) api.Stamp(ut.StringgenBasico(true), "v1", true);
+ response = (SuccessV1Response) api.Stamp(ut.StringgenBasico(true), StampVersions.v1, true);
System.out.println(response.Status);
System.out.println(response.message);
System.out.println(response.HttpStatusCode);
@@ -92,7 +93,7 @@ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V2_b64() throws Exceptio
SWStampService api = new SWStampService(Utils.userSW, Utils.passwordSW, Utils.urlSW);
SuccessV2Response response = null;
Utils ut = new Utils();
- response = (SuccessV2Response) api.Stamp(ut.StringgenBasico(true), "v2", true);
+ response = (SuccessV2Response) api.Stamp(ut.StringgenBasico(true), StampVersions.v2, true);
System.out.println(response.Status);
System.out.println(response.HttpStatusCode);
System.out.println(response.tfd);
@@ -105,7 +106,7 @@ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V3_b64() throws Exceptio
SWStampService api = new SWStampService(Utils.userSW, Utils.passwordSW, Utils.urlSW);
SuccessV3Response response = null;
Utils ut = new Utils();
- response = (SuccessV3Response) api.Stamp(ut.StringgenBasico(true), "v3", true);
+ response = (SuccessV3Response) api.Stamp(ut.StringgenBasico(true), StampVersions.v3, true);
System.out.println(response.message);
System.out.println(response.Status);
System.out.println(response.HttpStatusCode);
@@ -118,7 +119,7 @@ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V4_b64() throws Exceptio
SWStampService api = new SWStampService(Utils.userSW, Utils.passwordSW, Utils.urlSW);
SuccessV4Response response = null;
Utils ut = new Utils();
- response = (SuccessV4Response) api.Stamp(ut.StringgenBasico(true), "V4", true);
+ response = (SuccessV4Response) api.Stamp(ut.StringgenBasico(true), StampVersions.v4, true);
System.out.println(response.message);
System.out.println(response.Status);
System.out.println(response.cfdi);
@@ -142,7 +143,7 @@ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V1_CC10() throws Excepti
SWStampService api = new SWStampService(Utils.userSW, Utils.passwordSW, Utils.urlSW);
SuccessV1Response response = null;
Utils ut = new Utils();
- response = (SuccessV1Response) api.Stamp(ut.genComercioExterior(false), "v1");
+ response = (SuccessV1Response) api.Stamp(ut.genComercioExterior(false), StampVersions.v1);
System.out.println(response.message);
System.out.println(response.Status);
System.out.println(response.HttpStatusCode);
@@ -155,7 +156,7 @@ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V2_CC10() throws Excepti
SWStampService api = new SWStampService(Utils.userSW, Utils.passwordSW, Utils.urlSW);
SuccessV2Response response = null;
Utils ut = new Utils();
- response = (SuccessV2Response) api.Stamp(ut.genComercioExterior(false), "v2");
+ response = (SuccessV2Response) api.Stamp(ut.genComercioExterior(false), StampVersions.v2);
System.out.println(response.Status);
System.out.println(response.message);
System.out.println(response.HttpStatusCode);
@@ -169,7 +170,7 @@ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V3_CC10() throws Excepti
SWStampService api = new SWStampService(Utils.userSW, Utils.passwordSW, Utils.urlSW);
SuccessV3Response response = null;
Utils ut = new Utils();
- response = (SuccessV3Response) api.Stamp(ut.genComercioExterior(false), "v3");
+ response = (SuccessV3Response) api.Stamp(ut.genComercioExterior(false), StampVersions.v3);
System.out.println(response.Status);
System.out.println(response.HttpStatusCode);
System.out.println(response.cfdi);
@@ -181,7 +182,7 @@ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V4_CC10() throws Excepti
SWStampService api = new SWStampService(Utils.userSW, Utils.passwordSW, Utils.urlSW);
SuccessV4Response response = null;
Utils ut = new Utils();
- response = (SuccessV4Response) api.Stamp(ut.genComercioExterior(false), "V4");
+ response = (SuccessV4Response) api.Stamp(ut.genComercioExterior(false), StampVersions.v4);
System.out.println(response.Status);
System.out.println(response.qrCode);
@@ -201,7 +202,7 @@ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V1_b64_CC10() throws Exc
SWStampService api = new SWStampService(Utils.userSW, Utils.passwordSW, Utils.urlSW);
SuccessV1Response response = null;
Utils ut = new Utils();
- response = (SuccessV1Response) api.Stamp(ut.genComercioExterior(true), "v1", true);
+ response = (SuccessV1Response) api.Stamp(ut.genComercioExterior(true), StampVersions.v1, true);
System.out.println(response.Status);
System.out.println(response.HttpStatusCode);
System.out.println(response.tfd);
@@ -212,7 +213,7 @@ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V2_b64_CC10() throws Exc
SWStampService api = new SWStampService(Utils.userSW, Utils.passwordSW, Utils.urlSW);
SuccessV2Response response = null;
Utils ut = new Utils();
- response = (SuccessV2Response) api.Stamp(ut.genComercioExterior(true), "v2", true);
+ response = (SuccessV2Response) api.Stamp(ut.genComercioExterior(true), StampVersions.v2, true);
System.out.println(response.Status);
System.out.println(response.HttpStatusCode);
System.out.println(response.tfd);
@@ -225,7 +226,7 @@ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V3_b64_CC10() throws Exc
SWStampService api = new SWStampService(Utils.userSW, Utils.passwordSW, Utils.urlSW);
SuccessV3Response response = null;
Utils ut = new Utils();
- response = (SuccessV3Response) api.Stamp(ut.genComercioExterior(true), "v3", true);
+ response = (SuccessV3Response) api.Stamp(ut.genComercioExterior(true), StampVersions.v3, true);
System.out.println(response.Status);
System.out.println(response.HttpStatusCode);
System.out.println(response.cfdi);
@@ -236,7 +237,7 @@ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V4_b64_CC10() throws Exc
SWStampService api = new SWStampService(Utils.userSW, Utils.passwordSW, Utils.urlSW);
SuccessV4Response response = null;
Utils ut = new Utils();
- response = (SuccessV4Response) api.Stamp(ut.genComercioExterior(true), "V4", true);
+ response = (SuccessV4Response) api.Stamp(ut.genComercioExterior(true), StampVersions.v4, true);
System.out.println(response.Status);
System.out.println(response.cfdi);
System.out.println(response.qrCode);
@@ -261,7 +262,7 @@ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V1_PAGOS10() throws Exce
SWStampService api = new SWStampService(Utils.userSW, Utils.passwordSW, Utils.urlSW);
SuccessV1Response response = null;
Utils ut = new Utils();
- response = (SuccessV1Response) api.Stamp(ut.genPagos10(false), "v1");
+ response = (SuccessV1Response) api.Stamp(ut.genPagos10(false), StampVersions.v1);
System.out.println(response.Status);
System.out.println(response.message);
System.out.println(response.HttpStatusCode);
@@ -275,7 +276,7 @@ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V2_PAGOS10() throws Exce
SWStampService api = new SWStampService(Utils.userSW, Utils.passwordSW, Utils.urlSW);
SuccessV2Response response = null;
Utils ut = new Utils();
- response = (SuccessV2Response) api.Stamp(ut.genPagos10(false), "v2");
+ response = (SuccessV2Response) api.Stamp(ut.genPagos10(false), StampVersions.v2);
System.out.println(response.Status);
System.out.println(response.message);
System.out.println(response.HttpStatusCode);
@@ -289,7 +290,7 @@ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V3_PAGOS10() throws Exce
SWStampService api = new SWStampService(Utils.userSW, Utils.passwordSW, Utils.urlSW);
SuccessV3Response response = null;
Utils ut = new Utils();
- response = (SuccessV3Response) api.Stamp(ut.genPagos10(false), "v3");
+ response = (SuccessV3Response) api.Stamp(ut.genPagos10(false), StampVersions.v3);
System.out.println(response.Status);
System.out.println(response.message);
System.out.println(response.HttpStatusCode);
@@ -303,7 +304,7 @@ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V4_PAGOS10() throws Exce
SWStampService api = new SWStampService(Utils.userSW, Utils.passwordSW, Utils.urlSW);
SuccessV4Response response = null;
Utils ut = new Utils();
- response = (SuccessV4Response) api.Stamp(ut.genPagos10(false), "V4");
+ response = (SuccessV4Response) api.Stamp(ut.genPagos10(false), StampVersions.v4);
System.out.println(response.Status);
System.out.println(response.cfdi);
System.out.println(response.qrCode);
@@ -323,7 +324,7 @@ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V1_b64_PAGOS10() throws
SWStampService api = new SWStampService(Utils.userSW, Utils.passwordSW, Utils.urlSW);
SuccessV1Response response = null;
Utils ut = new Utils();
- response = (SuccessV1Response) api.Stamp(ut.genPagos10(true), "v1", true);
+ response = (SuccessV1Response) api.Stamp(ut.genPagos10(true), StampVersions.v1, true);
System.out.println(response.Status);
System.out.println(response.message);
System.out.println(response.HttpStatusCode);
@@ -335,7 +336,7 @@ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V2_b64_PAGOS10() throws
SWStampService api = new SWStampService(Utils.userSW, Utils.passwordSW, Utils.urlSW);
SuccessV2Response response = null;
Utils ut = new Utils();
- response = (SuccessV2Response) api.Stamp(ut.genPagos10(true), "v2", true);
+ response = (SuccessV2Response) api.Stamp(ut.genPagos10(true), StampVersions.v2, true);
System.out.println(response.Status);
System.out.println(response.message);
System.out.println(response.HttpStatusCode);
@@ -350,7 +351,7 @@ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V3_b64_PAGOS10() throws
SWStampService api = new SWStampService(Utils.userSW, Utils.passwordSW, Utils.urlSW);
SuccessV3Response response = null;
Utils ut = new Utils();
- response = (SuccessV3Response) api.Stamp(ut.genPagos10(true), "v3", true);
+ response = (SuccessV3Response) api.Stamp(ut.genPagos10(true), StampVersions.v3, true);
System.out.println(response.Status);
System.out.println(response.message);
System.out.println(response.HttpStatusCode);
@@ -362,7 +363,7 @@ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V4_b64_PAGOS10() throws
SWStampService api = new SWStampService(Utils.userSW, Utils.passwordSW, Utils.urlSW);
SuccessV4Response response = null;
Utils ut = new Utils();
- response = (SuccessV4Response) api.Stamp(ut.genPagos10(true), "V4", true);
+ response = (SuccessV4Response) api.Stamp(ut.genPagos10(true), StampVersions.v4, true);
System.out.println(response.Status);
System.out.println(response.message);
System.out.println(response.cfdi);
@@ -389,7 +390,7 @@ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V1_NOMINA12() throws Exc
SWStampService api = new SWStampService(Utils.userSW, Utils.passwordSW, Utils.urlSW);
SuccessV1Response response = null;
Utils ut = new Utils();
- response = (SuccessV1Response) api.Stamp(ut.genNomina12(false), "v1");
+ response = (SuccessV1Response) api.Stamp(ut.genNomina12(false), StampVersions.v1);
System.out.println(response.Status);
System.out.print(response.message);
System.out.println(response.HttpStatusCode);
@@ -402,7 +403,7 @@ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V2_NOMINA12() throws Exc
SWStampService api = new SWStampService(Utils.userSW, Utils.passwordSW, Utils.urlSW);
SuccessV2Response response = null;
Utils ut = new Utils();
- response = (SuccessV2Response) api.Stamp(ut.genNomina12(false), "v2");
+ response = (SuccessV2Response) api.Stamp(ut.genNomina12(false), StampVersions.v2);
System.out.println(response.Status);
System.out.println(response.HttpStatusCode);
System.out.println(response.tfd);
@@ -415,7 +416,7 @@ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V3_NOMINA12() throws Exc
SWStampService api = new SWStampService(Utils.userSW, Utils.passwordSW, Utils.urlSW);
SuccessV3Response response = null;
Utils ut = new Utils();
- response = (SuccessV3Response) api.Stamp(ut.genNomina12(false), "v3");
+ response = (SuccessV3Response) api.Stamp(ut.genNomina12(false), StampVersions.v3);
System.out.println(response.Status);
System.out.println(response.HttpStatusCode);
System.out.println(response.cfdi);
@@ -427,7 +428,7 @@ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V4_NOMINA12() throws Exc
SWStampService api = new SWStampService(Utils.userSW, Utils.passwordSW, Utils.urlSW);
SuccessV4Response response = null;
Utils ut = new Utils();
- response = (SuccessV4Response) api.Stamp(ut.genNomina12(false), "V4");
+ response = (SuccessV4Response) api.Stamp(ut.genNomina12(false), StampVersions.v4);
System.out.println(response.Status);
System.out.println(response.cfdi);
System.out.println(response.qrCode);
@@ -446,7 +447,7 @@ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V1_b64_NOMINA12() throws
SWStampService api = new SWStampService(Utils.userSW, Utils.passwordSW, Utils.urlSW);
SuccessV1Response response = null;
Utils ut = new Utils();
- response = (SuccessV1Response) api.Stamp(ut.genNomina12(true), "v1", true);
+ response = (SuccessV1Response) api.Stamp(ut.genNomina12(true), StampVersions.v1, true);
System.out.println(response.Status);
System.out.println(response.HttpStatusCode);
System.out.println(response.message);
@@ -460,7 +461,7 @@ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V2_b64_NOMINA12() throws
SWStampService api = new SWStampService(Utils.userSW, Utils.passwordSW, Utils.urlSW);
SuccessV2Response response = null;
Utils ut = new Utils();
- response = (SuccessV2Response) api.Stamp(ut.genNomina12(true), "v2", true);
+ response = (SuccessV2Response) api.Stamp(ut.genNomina12(true), StampVersions.v2, true);
System.out.println(response.Status);
System.out.println(response.HttpStatusCode);
System.out.println(response.tfd);
@@ -474,7 +475,7 @@ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V3_b64_NOMINA12() throws
SWStampService api = new SWStampService(Utils.userSW, Utils.passwordSW, Utils.urlSW);
SuccessV3Response response = null;
Utils ut = new Utils();
- response = (SuccessV3Response) api.Stamp(ut.genNomina12(true), "v3", true);
+ response = (SuccessV3Response) api.Stamp(ut.genNomina12(true), StampVersions.v3, true);
System.out.println(response.Status);
System.out.println(response.HttpStatusCode);
System.out.println(response.cfdi);
@@ -485,7 +486,7 @@ public void testStampREAL_XML_STRING_USER_PASSWORD_AUTH_V4_b64_NOMINA12() throws
SWStampService api = new SWStampService(Utils.userSW, Utils.passwordSW, Utils.urlSW);
SuccessV4Response response = null;
Utils ut = new Utils();
- response = (SuccessV4Response) api.Stamp(ut.genNomina12(true), "V4", true);
+ response = (SuccessV4Response) api.Stamp(ut.genNomina12(true), StampVersions.v4, true);
System.out.println(response.Status);
System.out.println(response.cfdi);
System.out.println(response.qrCode);
@@ -508,7 +509,7 @@ public void testStampREAL_XML_STRING_EMPTY_PARAMS() throws Exception {
SWStampService api = new SWStampService("", "", "");
IResponse response = null;
Utils ut = new Utils();
- response = api.Stamp(ut.StringgenBasico(false), "v1");
+ response = api.Stamp(ut.StringgenBasico(false), StampVersions.v1);
System.out.println(response.Status);
System.out.println(response.HttpStatusCode);
} catch (Exception e) {
@@ -523,7 +524,7 @@ public void testStampREAL_XML_STRING_INCORRECT_PARAMS() throws Exception {
SWStampService api = new SWStampService("USER_BAD", "PASSWORD_BAD", "BAD_URI");
IResponse response = null;
Utils ut = new Utils();
- response = api.Stamp(ut.StringgenBasico(false), "v1");
+ response = api.Stamp(ut.StringgenBasico(false), StampVersions.v1);
System.out.println(response.Status);
System.out.println(response.HttpStatusCode);
} catch (Exception e) {
@@ -548,7 +549,7 @@ public void testStampTOKEN_EXPIRES_NOT_USER_NOT_PASSWORD() throws Exception {
api.setPassword(null); }
try {
Utils ut = new Utils();
- api.Stamp(ut.StringgenBasico(false), "v1");
+ api.Stamp(ut.StringgenBasico(false), StampVersions.v1);
} catch (Exception e) {
System.out.println(e.getMessage());
System.out.println("Something bad happened");
diff --git a/src/test/java/Tests/helpers/StampV1.java b/src/test/java/Tests/helpers/StampV1.java
index 1eab345..f0aa3a8 100644
--- a/src/test/java/Tests/helpers/StampV1.java
+++ b/src/test/java/Tests/helpers/StampV1.java
@@ -5,6 +5,7 @@
import Exceptions.AuthException;
import Exceptions.GeneralException;
import Services.Stamp.SWStampService;
+import Utils.Enums.StampVersions;
import Utils.Responses.Stamp.SuccessV1Response;
import Utils.Responses.Stamp.SuccessV2Response;
import Utils.Responses.Stamp.SuccessV3Response;
@@ -35,24 +36,24 @@ public StampV1(Boolean isToken) throws AuthException
public SuccessV1Response StampResponseV1(String fileName, String stampVersion, boolean signed,
boolean isBase64) throws AuthException, GeneralException, IOException {
- return (SuccessV1Response) stamp.Stamp(settings.getCFDI(fileName, true, "4.0", isBase64), "v1", isBase64);
+ return (SuccessV1Response) stamp.Stamp(settings.getCFDI(fileName, true, "4.0", isBase64), StampVersions.v1, isBase64);
}
@Override
public SuccessV2Response StampResponseV2(String fileName, String stampVersion, boolean signed,
boolean isBase64) throws AuthException, GeneralException, IOException {
- return (SuccessV2Response) stamp.Stamp(settings.getCFDI(fileName, true, "4.0", isBase64), "v2", isBase64);
+ return (SuccessV2Response) stamp.Stamp(settings.getCFDI(fileName, true, "4.0", isBase64), StampVersions.v2, isBase64);
}
@Override
public SuccessV3Response StampResponseV3(String fileName, String stampVersion, boolean signed,
boolean isBase64) throws AuthException, GeneralException, IOException {
- return (SuccessV3Response) stamp.Stamp(settings.getCFDI(fileName, true, "4.0", isBase64), "v3", isBase64);
+ return (SuccessV3Response) stamp.Stamp(settings.getCFDI(fileName, true, "4.0", isBase64), StampVersions.v3, isBase64);
}
@Override
public SuccessV4Response StampResponseV4(String fileName, String stampVersion, boolean signed,
boolean isBase64) throws AuthException, GeneralException, IOException {
- return (SuccessV4Response) stamp.Stamp(settings.getCFDI(fileName, true, "4.0", isBase64), "v4", isBase64);
- }
+ return (SuccessV4Response) stamp.Stamp(settings.getCFDI(fileName, true, "4.0", isBase64), StampVersions.v4, isBase64);
+ }
}