Skip to content

Commit

Permalink
Add new Exception for when user information is missing (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
JCAbrantes authored and tiagoppinho committed Jul 16, 2019
1 parent 18d34e3 commit 959ae4a
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.fenixedu.santandersdk.exception;

public class SantanderMissingInformationException extends SantanderValidationException {

public SantanderMissingInformationException() {
super();
}

public SantanderMissingInformationException(String msg) {
super(msg);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.fenixedu.santandersdk.dto.CardPreviewBean;
import org.fenixedu.santandersdk.dto.CreateRegisterRequest;
import org.fenixedu.santandersdk.dto.PickupAddress;
import org.fenixedu.santandersdk.exception.SantanderMissingInformationException;
import org.fenixedu.santandersdk.exception.SantanderValidationException;
import org.joda.time.DateTime;
import org.slf4j.Logger;
Expand Down Expand Up @@ -81,7 +82,7 @@ public CardPreviewBean generateLine(CreateRegisterRequest request) throws Santan

if (!errors.isEmpty()) {
String errors_message = String.join("\n", errors);
throw new SantanderValidationException(errors_message);
throw new SantanderMissingInformationException(errors_message);
}

CardPreviewBean cardPreviewBean = new CardPreviewBean();
Expand All @@ -104,7 +105,7 @@ public CardPreviewBean generateLine(CreateRegisterRequest request) throws Santan
PickupAddress pickupAddress = request.getPickupAddress();

if (pickupAddress == null) {
throw new SantanderValidationException("santander.sdk.error.line.generation.user.has.no.current.campus");
throw new SantanderMissingInformationException("santander.sdk.error.line.generation.user.has.no.current.campus");
}

String address1 = pickupAddress.getAddress1();
Expand Down Expand Up @@ -142,51 +143,51 @@ public CardPreviewBean generateLine(CreateRegisterRequest request) throws Santan

String expireData_AAMM = expireDate_dateTime.toString("yy") + expireDate_dateTime.toString("MM");

String templateCode = ""; //TODO
String templateCode = "";

String actionCode = request.getAction().name();

String roleCode = getRoleCode(role);

String roleDesc = getRoleDescripriton(role);

String idDocumentType = "0"; // TODO
String idDocumentType = "0";

String checkDigit = ""; // TODO
String checkDigit = "";

String cardType = "00"; // TODO
String cardType = "00";

String expedictionCode = "00"; // TODO
String expedictionCode = "00";

String detourAdress1 = ""; // TODO
String detourAdress1 = "";

String detourAdress2 = ""; // TODO
String detourAdress2 = "";

String detourAdress3 = ""; // TODO
String detourAdress3 = "";

String detourZipCode = ""; // TODO
String detourZipCode = "";

String detourTown = ""; // TODO
String detourTown = "";

String aditionalData = "1"; // TODO
String aditionalData = "1";

String cardName = cardNames[0].toUpperCase() + " " + cardNames[1].toUpperCase();

String email = ""; // TODO
String email = "";

String phone = ""; // TODO
String phone = "";

String photoFlag = "0"; // TODO
String photoFlag = "0";

String photoRef = ""; // TODO
String photoRef = "";

String signatureFlag = "0"; // TODO
String signatureFlag = "0";

String signatureRef = ""; // TODO
String signatureRef = "";

String digCertificateFlag = "0"; // TODO
String digCertificateFlag = "0";

String digCertificateRef = ""; // TODO
String digCertificateRef = "";

String filler = "";

Expand Down

0 comments on commit 959ae4a

Please sign in to comment.