Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grad release 1.10.1 #118

Merged
merged 6 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</parent>
<groupId>ca.bc.gov</groupId>
<artifactId>educ-grad-business-api</artifactId>
<version>1.8.24</version>
<version>1.8.25</version>
<name>educ-grad-business-api</name>
<description>GRAD Business API for external clients</description>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ public ResponseEntity<byte[]> studentCredentialByType(@PathVariable String pen,
@PreAuthorize("hasAuthority('SCOPE_GET_GRADUATION_DATA')")
@Operation(summary = "Get Transcript Report pdf by PEN and optional xml type parameter", description = "Get Transcript Report pdf by PEN and optional xml type parameter", tags = { "Graduation Data" })
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
public ResponseEntity<byte[]> studentTranscriptByType(@PathVariable String pen, @RequestParam(required = false) String type, @RequestHeader(name="Authorization") String accessToken) {
return gradBusinessService.getStudentTranscriptPDFByType(pen, type, accessToken.replace(BEARER, ""));
public ResponseEntity<byte[]> studentTranscriptByType(@PathVariable String pen, @RequestParam(required = false) String type, @RequestParam(required = false) String interim, @RequestHeader(name="Authorization") String accessToken) {
return gradBusinessService.getStudentTranscriptPDFByType(pen, type, interim, accessToken.replace(BEARER, ""));
}

@GetMapping(EducGraduationApiConstants.AMALGAMATED_SCHOOL_REPORT_PDF)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import ca.bc.gov.educ.api.gradbusiness.util.EducGraduationApiConstants;
import io.github.resilience4j.retry.annotation.Retry;
import jakarta.transaction.Transactional;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -286,13 +286,16 @@ public ResponseEntity<byte[]> getStudentCredentialPDFByType(String pen, String t


@Transactional
public ResponseEntity<byte[]> getStudentTranscriptPDFByType(String pen, String type, String accessToken) {
public ResponseEntity<byte[]> getStudentTranscriptPDFByType(String pen, String type, String interim, String accessToken) {
try {
byte[] reportData = prepareReportDataByPen(pen, type, accessToken).getBody();
boolean isPreview = (StringUtils.isNotBlank(type) && StringUtils.equalsAnyIgnoreCase(type, "xml", "interim") ||
StringUtils.isNotBlank(interim) && StringUtils.equalsAnyIgnoreCase(interim, "xml", "interim"));
StringBuilder reportRequest = new StringBuilder();
String reportOptions = "\"options\": {\n" +
" \"cacheReport\": false,\n" +
" \"convertTo\": \"pdf\",\n" +
" \"preview\": \""+ (isPreview ? "true" : "false") +"\",\n" +
" \"overwrite\": false,\n" +
" \"reportName\": \"transcript\",\n" +
" \"reportFile\": \""+pen+" Transcript Report.pdf\"\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ void testStudentTranscriptPDFByTypeByPen() throws Exception {
when(this.requestHeadersMock.retrieve()).thenReturn(this.responseMock);
when(this.responseMock.bodyToMono(byte[].class)).thenReturn(Mono.just(transcriptPdfSample));

ResponseEntity<byte[]> transcriptPdf = gradBusinessService.getStudentTranscriptPDFByType(pen, "xml", "accessToken");
ResponseEntity<byte[]> transcriptPdf = gradBusinessService.getStudentTranscriptPDFByType(pen, "xml", null,"accessToken");
assertNotNull(transcriptPdf.getBody());
assertEquals(transcriptPdfSample,transcriptPdf.getBody());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,9 @@ void testStudentTranscriptPDFByType() throws Exception {
.contentType(MediaType.APPLICATION_XML)
.body(greBPack);

Mockito.when(gradBusinessService.getStudentTranscriptPDFByType("12312321","xml", "accessToken")).thenReturn(response);
gradBusinessController.studentTranscriptByType("12312321", "xml","accessToken");
Mockito.verify(gradBusinessService).getStudentTranscriptPDFByType("12312321","xml", "accessToken");
Mockito.when(gradBusinessService.getStudentTranscriptPDFByType("12312321","xml", null,"accessToken")).thenReturn(response);
gradBusinessController.studentTranscriptByType("12312321", "xml", null, "accessToken");
Mockito.verify(gradBusinessService).getStudentTranscriptPDFByType("12312321","xml", null,"accessToken");

}

Expand Down
Loading